ATLAS Offline Software
Loading...
Searching...
No Matches
TGCSDOVariables.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
6namespace MuonPRDTest {
7 TgcSDOVariables::TgcSDOVariables(MuonTesterTree& tree, const std::string& container_name, MSG::Level msglvl) :
8 PrdTesterModule(tree, "TGC_SDO", msglvl), m_key{container_name} {}
9
11
12 bool TgcSDOVariables::fill(const EventContext& ctx) {
13 ATH_MSG_DEBUG("do fill TgcSDOVariable()");
14 SG::ReadHandle<MuonSimDataCollection> tgcSdoContainer{m_key, ctx};
15 if (!tgcSdoContainer.isValid()) {
16 ATH_MSG_FATAL("Failed to retrieve digit container " << m_key.fullKey());
17 return false;
18 }
19 unsigned int n_sdo{0};
20 for (const auto& coll : *tgcSdoContainer) {
21 const Identifier& id = coll.first;
22 const MuonSimData& tgc_sdo = coll.second;
23 m_tgc_sdo_id.push_back(id);
24 m_tgc_sdo_globaltime.push_back(tgc_sdo.getTime());
25 m_tgc_sdo_word.push_back(tgc_sdo.word());
26
27 ATH_MSG_DEBUG("TGC SDO: " << idHelperSvc()->toString(id));
28
29 ATH_MSG_DEBUG("Get the truth deposits from the SDO.");
30 std::vector<MuonSimData::Deposit> deposits;
31 tgc_sdo.deposits(deposits);
32 m_TGC_dig_globalPos.push_back(tgc_sdo.globalPosition());
33
34 // use the information of the first deposit
35 int barcode = deposits[0].first.barcode();
36 double MuonMCdata_firstentry = deposits[0].second.firstEntry();
37 double MuonMCdata_secondentry = deposits[0].second.secondEntry();
38
39 ATH_MSG_DEBUG("TGC SDO barcode=" << barcode);
40 ATH_MSG_DEBUG("TGC SDO localPosX=" << std::setw(9) << std::setprecision(2) << MuonMCdata_firstentry
41 << ", localPosY=" << std::setw(9) << std::setprecision(2) << MuonMCdata_secondentry);
42
43 m_tgc_sdo_barcode.push_back(barcode);
44 m_tgc_sdo_localPosX.push_back(MuonMCdata_firstentry);
45 m_tgc_sdo_localPosY.push_back(MuonMCdata_secondentry);
46 ++n_sdo;
47 }
48 m_tgc_nsdo = n_sdo;
49
50 ATH_MSG_DEBUG("Processed " << n_sdo << " TGC SDOs");
51 return true;
52 }
53}
#define ATH_MSG_FATAL(x)
#define ATH_MSG_DEBUG(x)
const Muon::IMuonIdHelperSvc * idHelperSvc() const
PrdTesterModule(MuonTesterTree &tree, const std::string &grp_name, MSG::Level msglvl)
ThreeVectorBranch m_TGC_dig_globalPos
VectorBranch< float > & m_tgc_sdo_localPosY
bool fill(const EventContext &ctx) override final
The fill method checks if enough information is provided such that the branch is cleared from the inf...
ScalarBranch< unsigned int > & m_tgc_nsdo
bool declare_keys() override final
VectorBranch< int > & m_tgc_sdo_word
VectorBranch< int > & m_tgc_sdo_barcode
SG::ReadHandleKey< MuonSimDataCollection > m_key
VectorBranch< float > & m_tgc_sdo_localPosX
TgcIdentifierBranch m_tgc_sdo_id
TgcSDOVariables(MuonTesterTree &tree, const std::string &container_name, MSG::Level msglvl)
VectorBranch< float > & m_tgc_sdo_globaltime
int word() const
Definition MuonSimData.h:89
void deposits(std::vector< Deposit > &deposits) const
Definition MuonSimData.h:99
const Amg::Vector3D globalPosition() const
float getTime() const
bool declare_dependency(Key &key)
Declares the ReadHandle/ ReadCondHandleKey as data dependency of the algorithm.
TTree * tree() override final
Returns the underlying TTree object.
virtual bool isValid() override final
Can the handle be successfully dereferenced?