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 
17 
21 
22 using namespace MuonVal;
23 using namespace MuonPRDTest;
24 namespace MuonValR4 {
25  MuonHitTesterAlg::MuonHitTesterAlg(const std::string& alg_name,
26  ISvcLocator* pSvcLocator):
27  AthHistogramAlgorithm{alg_name, pSvcLocator}{}
28 
30  int evOpts{0};
31  if (m_isMC) evOpts |= EventInfoBranch::isMC;
33  m_tree.addBranch(std::make_shared<EventInfoBranch>(m_tree, evOpts,m_evtKey.key()));
37  ATH_CHECK(m_tree.init(this));
38  return StatusCode::SUCCESS;
39  }
41  if (!m_writeSimHits || !m_isMC){
42  return StatusCode::SUCCESS;
43  }
44  if (m_writeMdtSim) {
45  m_tree.addBranch(std::make_shared<SimHitTester>(m_tree, m_mdtSimHitKey,
47  msgLevel()));
48  }
49  if (m_writeRpcSim) {
50  m_tree.addBranch(std::make_shared<SimHitTester>(m_tree, m_rpcSimHitKey,
52  msgLevel()));
53  }
54  if (m_writeTgcSim) {
55  m_tree.addBranch(std::make_shared<SimHitTester>(m_tree,
58  msgLevel()));
59  }
60  if (m_writesTgcSim) {
61  m_tree.addBranch(std::make_shared<SimHitTester>(m_tree, m_sTgcSimHitKey,
63  msgLevel()));
64  }
65  if (m_writeMmSim) {
66  m_tree.addBranch(std::make_shared<SimHitTester>(m_tree, m_mmSimHitKey,
68  msgLevel()));
69  }
70  return StatusCode::SUCCESS;
71  }
73  if (!m_writeDigits) {
74  return StatusCode::SUCCESS;
75  }
76  if (m_writeMdtDigits) {
77  m_tree.addBranch(std::make_shared<MdtDigitVariables>(m_tree, m_mdtDigitKey, msgLevel()));
78  }
79  if (m_writeRpcDigits) {
80  m_tree.addBranch(std::make_shared<RpcDigitVariables>(m_tree, m_rpcDigitKey, msgLevel()));
81  }
82  if (m_writeTgcDigits) {
83  m_tree.addBranch(std::make_shared<TgcDigitVariables>(m_tree, m_tgcDigitKey, msgLevel()));
84  }
85  if (m_writeMmDigits) {
86  m_tree.addBranch(std::make_shared<MMDigitVariables>(m_tree, m_mmDigitKey, msgLevel()));
87  }
88  if (m_writesTgcDigits) {
89  m_tree.addBranch(std::make_shared<sTgcDigitVariables>(m_tree, m_sTgcDigitKey, msgLevel()));
90  }
91  return StatusCode::SUCCESS;
92  }
94  if (!m_writePrds) {
95  return StatusCode::SUCCESS;
96  }
97  if (m_writeMdtPrds) {
98  m_tree.addBranch(std::make_shared<MdtDriftCircleVariables>(m_tree, m_mdtPrdKey, msgLevel()));
99  m_tree.addBranch(std::make_shared<MdtTwinDriftCircleVariables>(m_tree, m_mdtTwinPrdKey, msgLevel()));
100  }
101  if (m_writeRpcPrds) {
102  m_tree.addBranch(std::make_shared<RpcMeasurementVariables>(m_tree, m_rpcPrdKey, msgLevel()));
103  }
104  if (m_writeTgcPrds) {
105  m_tree.addBranch(std::make_shared<TgcStripVariables>(m_tree, m_tgcPrdKey, msgLevel()));
106  }
107  if (m_writeMmPrds) {
108  m_tree.addBranch(std::make_shared<MmClusterVariables>(m_tree, m_mmPrdKey, msgLevel()));
109  }
110  return StatusCode::SUCCESS;
111  }
114  return StatusCode::SUCCESS;
115  }
117  const EventContext& ctx{Gaudi::Hive::currentContext()};
118  return m_tree.fill(ctx) ? StatusCode::SUCCESS : StatusCode::FAILURE;
119  }
120 }
MuonValR4::MuonHitTesterAlg::m_mdtPrdKey
Gaudi::Property< std::string > m_mdtPrdKey
Prd collection names.
Definition: MuonHitTesterAlg.h:87
TgcStripVariables.h
MuonValR4::MuonHitTesterAlg::m_writeRpcPrds
Gaudi::Property< bool > m_writeRpcPrds
Definition: MuonHitTesterAlg.h:81
TGCDigitVariables.h
MuonValR4::MuonHitTesterAlg::m_sTgcDigitKey
Gaudi::Property< std::string > m_sTgcDigitKey
Definition: MuonHitTesterAlg.h:72
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:40
MuonValR4::MuonHitTesterAlg::m_writeMmPrds
Gaudi::Property< bool > m_writeMmPrds
Definition: MuonHitTesterAlg.h:83
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:29
MuonValR4::MuonHitTesterAlg::m_mdtSimHitKey
Gaudi::Property< std::string > m_mdtSimHitKey
Container keys of the particular sim hit collections.
Definition: MuonHitTesterAlg.h:47
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:68
ActsTrk::DetectorType::Tgc
@ Tgc
Resitive Plate Chambers.
MuonValR4::MuonHitTesterAlg::m_rpcPrdKey
Gaudi::Property< std::string > m_rpcPrdKey
Definition: MuonHitTesterAlg.h:89
MuonValR4::MuonHitTesterAlg::m_writesTgcSim
Gaudi::Property< bool > m_writesTgcSim
Definition: MuonHitTesterAlg.h:41
MuonValR4::MuonHitTesterAlg::m_mmPrdKey
Gaudi::Property< std::string > m_mmPrdKey
Definition: MuonHitTesterAlg.h:91
MuonValR4::MuonHitTesterAlg::m_writeMmDigits
Gaudi::Property< bool > m_writeMmDigits
Definition: MuonHitTesterAlg.h:63
EventInfoBranch.h
MuonValR4::MuonHitTesterAlg::m_writeMdtDigits
Gaudi::Property< bool > m_writeMdtDigits
Definition: MuonHitTesterAlg.h:59
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
MuonValR4::MuonHitTesterAlg::m_writeDigits
Gaudi::Property< bool > m_writeDigits
Definition: MuonHitTesterAlg.h:56
ActsTrk::DetectorType::sTgc
@ sTgc
Micromegas (NSW)
MuonValR4::MuonHitTesterAlg::m_sTgcSimHitKey
Gaudi::Property< std::string > m_sTgcSimHitKey
Definition: MuonHitTesterAlg.h:51
MuonValR4::MuonHitTesterAlg::finalize
StatusCode finalize() override final
Definition: MuonHitTesterAlg.cxx:112
MuonValR4::MuonHitTesterAlg::setupPrds
StatusCode setupPrds()
Toggle whether the uncalibrated measurement collections shall be tested.
Definition: MuonHitTesterAlg.cxx:93
MuonValR4::MuonHitTesterAlg::m_rpcSimHitKey
Gaudi::Property< std::string > m_rpcSimHitKey
Definition: MuonHitTesterAlg.h:48
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
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
sTGCDigitVariables.h
AthHistogramAlgorithm
Definition: AthHistogramAlgorithm.h:32
MuonValR4::MuonHitTesterAlg::m_writeMdtPrds
Gaudi::Property< bool > m_writeMdtPrds
Definition: MuonHitTesterAlg.h:80
MmClusterVariables.h
MuonValR4::MuonHitTesterAlg::setupDigits
StatusCode setupDigits()
Toggle whether the digit collections shall be tested.
Definition: MuonHitTesterAlg.cxx:72
MdtDriftCircleVariables.h
MuonValR4
Lightweight algorithm to read xAOD MDT sim hits and (fast-digitised) drift circles from SG and fill a...
Definition: IPatternVisualizationTool.h:23
MuonValR4::MuonHitTesterAlg::m_tgcPrdKey
Gaudi::Property< std::string > m_tgcPrdKey
Definition: MuonHitTesterAlg.h:90
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:62
MuonValR4::MuonHitTesterAlg::execute
StatusCode execute() override final
Definition: MuonHitTesterAlg.cxx:116
MuonValR4::MuonHitTesterAlg::m_mdtTwinPrdKey
Gaudi::Property< std::string > m_mdtTwinPrdKey
Definition: MuonHitTesterAlg.h:88
MuonValR4::MuonHitTesterAlg::m_evtKey
SG::ReadHandleKey< xAOD::EventInfo > m_evtKey
Definition: MuonHitTesterAlg.h:29
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:71
MuonValR4::MuonHitTesterAlg::m_writeTgcSim
Gaudi::Property< bool > m_writeTgcSim
Definition: MuonHitTesterAlg.h:40
MuonValR4::MuonHitTesterAlg::m_writeSimHits
Gaudi::Property< bool > m_writeSimHits
Definition: MuonHitTesterAlg.h:36
SimHitTester.h
MuonValR4::MuonHitTesterAlg::m_writeMdtSim
Gaudi::Property< bool > m_writeMdtSim
Definition: MuonHitTesterAlg.h:38
MuonValR4::MuonHitTesterAlg::m_writeRpcSim
Gaudi::Property< bool > m_writeRpcSim
Definition: MuonHitTesterAlg.h:39
MuonValR4::MuonHitTesterAlg::m_tgcSimHitKey
Gaudi::Property< std::string > m_tgcSimHitKey
Definition: MuonHitTesterAlg.h:49
MuonHitTesterAlg.h
RpcMeasurementVariables.h
MuonPRDTest
Definition: CSCDigitVariables.h:10
MuonValR4::MuonHitTesterAlg::m_writeMmSim
Gaudi::Property< bool > m_writeMmSim
Definition: MuonHitTesterAlg.h:42
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_writeTgcPrds
Gaudi::Property< bool > m_writeTgcPrds
Definition: MuonHitTesterAlg.h:82
MuonValR4::MuonHitTesterAlg::m_rpcDigitKey
Gaudi::Property< std::string > m_rpcDigitKey
Definition: MuonHitTesterAlg.h:69
MuonValR4::MuonHitTesterAlg::m_writeTgcDigits
Gaudi::Property< bool > m_writeTgcDigits
Definition: MuonHitTesterAlg.h:61
MuonValR4::MuonHitTesterAlg::m_mmSimHitKey
Gaudi::Property< std::string > m_mmSimHitKey
Definition: MuonHitTesterAlg.h:50
MuonValR4::MuonHitTesterAlg::m_tgcDigitKey
Gaudi::Property< std::string > m_tgcDigitKey
Definition: MuonHitTesterAlg.h:70
MuonValR4::MuonHitTesterAlg::m_writePrds
Gaudi::Property< bool > m_writePrds
Definition: MuonHitTesterAlg.h:77
MdtTwinDriftCircleVariables.h
MuonValR4::MuonHitTesterAlg::m_writeRpcDigits
Gaudi::Property< bool > m_writeRpcDigits
Definition: MuonHitTesterAlg.h:60
MuonVal::MuonTesterTree::addBranch
bool addBranch(std::shared_ptr< IMuonTesterBranch > branch)
Branch is added to the tree without transferring the ownership.
Definition: MuonTesterTree.cxx:61