ATLAS Offline Software
MuonHitTesterAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 #include "MuonHitTesterAlg.h"
5 
8 
14 
15 
16 
17 
18 using namespace MuonVal;
19 using namespace MuonPRDTest;
20 namespace MuonValR4 {
21  MuonHitTesterAlg::MuonHitTesterAlg(const std::string& alg_name,
22  ISvcLocator* pSvcLocator):
23  AthHistogramAlgorithm{alg_name, pSvcLocator}{}
24 
26  int evOpts{0};
27  if (m_isMC) evOpts |= EventInfoBranch::isMC;
28 
29  m_tree.addBranch(std::make_shared<EventInfoBranch>(m_tree, evOpts));
32  ATH_CHECK(m_tree.init(this));
33  return StatusCode::SUCCESS;
34  }
36  if (!m_writeSimHits || !m_isMC){
37  return StatusCode::SUCCESS;
38  }
39  if (m_writeMdtSim) {
40  m_tree.addBranch(std::make_shared<SimHitTester>(m_tree, m_mdtSimHitKey,
42  msgLevel()));
43  }
44  if (m_writeRpcSim) {
45  m_tree.addBranch(std::make_shared<SimHitTester>(m_tree, m_rpcSimHitKey,
47  msgLevel()));
48  }
49  if (m_writeTgcSim) {
50  m_tree.addBranch(std::make_shared<SimHitTester>(m_tree,
53  msgLevel()));
54  }
55  if (m_writesTgcSim) {
56  m_tree.addBranch(std::make_shared<SimHitTester>(m_tree, m_sTgcSimHitKey,
58  msgLevel()));
59  }
60  if (m_writeMmSim) {
61  m_tree.addBranch(std::make_shared<SimHitTester>(m_tree, m_mmSimHitKey,
63  msgLevel()));
64  }
65  return StatusCode::SUCCESS;
66  }
68  if (!m_writeDigits || !m_isMC){
69  return StatusCode::SUCCESS;
70  }
71  if (m_writeMdtDigits) {
72  m_tree.addBranch(std::make_shared<MdtDigitVariables>(m_tree, m_mdtDigitKey, msgLevel()));
73  }
74  if (m_writeRpcDigits) {
75  m_tree.addBranch(std::make_shared<RpcDigitVariables>(m_tree, m_rpcDigitKey, msgLevel()));
76  }
77  if (m_writeTgcDigits) {
78  m_tree.addBranch(std::make_shared<TgcDigitVariables>(m_tree, m_tgcDigitKey, msgLevel()));
79  }
80  if (m_writeMmDigits) {
81  m_tree.addBranch(std::make_shared<MMDigitVariables>(m_tree, m_mmDigitKey, msgLevel()));
82  }
83  if (m_writesTgcDigits) {
84  m_tree.addBranch(std::make_shared<sTgcDigitVariables>(m_tree, m_sTgcDigitKey, msgLevel()));
85  }
86  return StatusCode::SUCCESS;
87  }
88 
91  return StatusCode::SUCCESS;
92  }
94  const EventContext& ctx{Gaudi::Hive::currentContext()};
95  return m_tree.fill(ctx) ? StatusCode::SUCCESS : StatusCode::FAILURE;
96  }
97 }
TGCDigitVariables.h
MuonValR4::MuonHitTesterAlg::m_sTgcDigitKey
Gaudi::Property< std::string > m_sTgcDigitKey
Definition: MuonHitTesterAlg.h:70
MuonVal::MuonTesterTree::init
StatusCode init(OWNER *instance)
Initialize method.
RPCDigitVariables.h
MuonValR4::MuonHitTesterAlg::setupSimHits
StatusCode setupSimHits()
Toggle whether the simHit collection of each sub detector shall be written to disk.
Definition: MuonHitTesterAlg.cxx:35
MuonVal::EventInfoBranch::isMC
@ isMC
Flag determining whether the branch is simulation.
Definition: EventInfoBranch.h:20
MuonValR4::MuonHitTesterAlg::initialize
StatusCode initialize() override final
Definition: MuonHitTesterAlg.cxx:25
MuonValR4::MuonHitTesterAlg::m_mdtSimHitKey
Gaudi::Property< std::string > m_mdtSimHitKey
Container keys of the particular sim hit collections.
Definition: MuonHitTesterAlg.h:45
run_gep.alg_name
alg_name
Definition: run_gep.py:298
MuonValR4::MuonHitTesterAlg::m_mdtDigitKey
Gaudi::Property< std::string > m_mdtDigitKey
Container keys of the particular digit collections.
Definition: MuonHitTesterAlg.h:66
ActsTrk::DetectorType::Tgc
@ Tgc
Resitive Plate Chambers.
MuonValR4::MuonHitTesterAlg::m_writesTgcSim
Gaudi::Property< bool > m_writesTgcSim
Definition: MuonHitTesterAlg.h:39
MuonValR4::MuonHitTesterAlg::m_writeMmDigits
Gaudi::Property< bool > m_writeMmDigits
Definition: MuonHitTesterAlg.h:61
EventInfoBranch.h
MuonValR4::MuonHitTesterAlg::m_writeMdtDigits
Gaudi::Property< bool > m_writeMdtDigits
Definition: MuonHitTesterAlg.h:57
MuonValR4::MuonHitTesterAlg::m_writeDigits
Gaudi::Property< bool > m_writeDigits
Definition: MuonHitTesterAlg.h:54
ActsTrk::DetectorType::sTgc
@ sTgc
Micromegas (NSW)
MuonValR4::MuonHitTesterAlg::m_sTgcSimHitKey
Gaudi::Property< std::string > m_sTgcSimHitKey
Definition: MuonHitTesterAlg.h:49
MuonValR4::MuonHitTesterAlg::finalize
StatusCode finalize() override final
Definition: MuonHitTesterAlg.cxx:89
MuonValR4::MuonHitTesterAlg::m_rpcSimHitKey
Gaudi::Property< std::string > m_rpcSimHitKey
Definition: MuonHitTesterAlg.h:46
MDTDigitVariables.h
ActsTrk::DetectorType::Mm
@ Mm
Maybe not needed in the migration.
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
MuonValR4::MuonHitTesterAlg::m_tree
MuonVal::MuonTesterTree m_tree
Definition: MuonHitTesterAlg.h:25
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
sTGCDigitVariables.h
AthHistogramAlgorithm
Definition: AthHistogramAlgorithm.h:32
MuonValR4::MuonHitTesterAlg::setupDigits
StatusCode setupDigits()
Toggle whether the digit collections shall be tested.
Definition: MuonHitTesterAlg.cxx:67
MuonValR4
Lightweight algorithm to read xAOD MDT sim hits and (fast-digitised) drift circles from SG and fill a...
Definition: MDTFastDigiTester.cxx:8
MuonVal
Class to store array like branches into the n-tuples.
Definition: MuonTPMetaDataAlg.cxx:25
ActsTrk::DetectorType::Mdt
@ Mdt
MuonSpectrometer.
MuonValR4::MuonHitTesterAlg::m_writesTgcDigits
Gaudi::Property< bool > m_writesTgcDigits
Definition: MuonHitTesterAlg.h:60
MuonValR4::MuonHitTesterAlg::execute
StatusCode execute() override final
Definition: MuonHitTesterAlg.cxx:93
MuonValR4::MuonHitTesterAlg::m_isMC
Gaudi::Property< bool > m_isMC
Definition: MuonHitTesterAlg.h:27
MuonValR4::MuonHitTesterAlg::m_mmDigitKey
Gaudi::Property< std::string > m_mmDigitKey
Definition: MuonHitTesterAlg.h:69
MuonValR4::MuonHitTesterAlg::m_writeTgcSim
Gaudi::Property< bool > m_writeTgcSim
Definition: MuonHitTesterAlg.h:38
MuonValR4::MuonHitTesterAlg::m_writeSimHits
Gaudi::Property< bool > m_writeSimHits
Definition: MuonHitTesterAlg.h:34
SimHitTester.h
MuonValR4::MuonHitTesterAlg::m_writeMdtSim
Gaudi::Property< bool > m_writeMdtSim
Definition: MuonHitTesterAlg.h:36
MuonValR4::MuonHitTesterAlg::m_writeRpcSim
Gaudi::Property< bool > m_writeRpcSim
Definition: MuonHitTesterAlg.h:37
MuonValR4::MuonHitTesterAlg::m_tgcSimHitKey
Gaudi::Property< std::string > m_tgcSimHitKey
Definition: MuonHitTesterAlg.h:47
MuonHitTesterAlg.h
MuonPRDTest
Definition: CSCDigitVariables.h:10
MuonValR4::MuonHitTesterAlg::m_writeMmSim
Gaudi::Property< bool > m_writeMmSim
Definition: MuonHitTesterAlg.h:40
ActsTrk::DetectorType::Rpc
@ Rpc
Monitored Drift Tubes.
MuonVal::MuonTesterTree::fill
bool fill(const EventContext &ctx)
Fills the tree per call.
Definition: MuonTesterTree.cxx:89
MMDigitVariables.h
MuonVal::MuonTesterTree::write
StatusCode write()
Finally write the TTree objects.
Definition: MuonTesterTree.cxx:178
MuonValR4::MuonHitTesterAlg::m_rpcDigitKey
Gaudi::Property< std::string > m_rpcDigitKey
Definition: MuonHitTesterAlg.h:67
MuonValR4::MuonHitTesterAlg::m_writeTgcDigits
Gaudi::Property< bool > m_writeTgcDigits
Definition: MuonHitTesterAlg.h:59
MuonValR4::MuonHitTesterAlg::m_mmSimHitKey
Gaudi::Property< std::string > m_mmSimHitKey
Definition: MuonHitTesterAlg.h:48
MuonValR4::MuonHitTesterAlg::m_tgcDigitKey
Gaudi::Property< std::string > m_tgcDigitKey
Definition: MuonHitTesterAlg.h:68
MuonValR4::MuonHitTesterAlg::m_writeRpcDigits
Gaudi::Property< bool > m_writeRpcDigits
Definition: MuonHitTesterAlg.h:58
MuonVal::MuonTesterTree::addBranch
bool addBranch(std::shared_ptr< IMuonTesterBranch > branch)
Branch is added to the tree without transferring the ownership.
Definition: MuonTesterTree.cxx:61