ATLAS Offline Software
TGCSDOVariables.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 namespace 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 retrive 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;
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);
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 
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 }
MuonSimData::word
int word() const
Definition: MuonSimData.h:89
MuonPRDTest::TgcSDOVariables::m_tgc_sdo_id
TgcIdentifierBranch m_tgc_sdo_id
Definition: TGCSDOVariables.h:25
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
tree
TChain * tree
Definition: tile_monitor.h:30
MuonPRDTest::TgcSDOVariables::m_tgc_sdo_word
VectorBranch< int > & m_tgc_sdo_word
Definition: TGCSDOVariables.h:26
MuonPRDTest::TgcSDOVariables::m_key
SG::ReadHandleKey< MuonSimDataCollection > m_key
Definition: TGCSDOVariables.h:22
MuonPRDTest::TgcSDOVariables::m_tgc_sdo_localPosX
VectorBranch< float > & m_tgc_sdo_localPosX
Definition: TGCSDOVariables.h:31
MuonPRDTest::TgcSDOVariables::m_TGC_dig_globalPos
ThreeVectorBranch m_TGC_dig_globalPos
Definition: TGCSDOVariables.h:30
MuonVal::MuonTesterBranch::declare_dependency
bool declare_dependency(Key &key)
Declares the ReadHandle/ ReadCondHandleKey as data dependency of the algorithm.
MuonVal::ThreeVectorBranch::push_back
void push_back(const Amg::Vector3D &vec)
interface using the Amg::Vector3D
Definition: ThreeVectorBranch.cxx:23
MuonVal::TgcIdentifierBranch::push_back
void push_back(const Identifier &id) override final
Definition: IdentifierBranch.cxx:66
MuonSimData::deposits
void deposits(std::vector< Deposit > &deposits) const
Definition: MuonSimData.h:99
Amg::toString
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Definition: GeoPrimitivesToStringConverter.h:40
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
MuonPRDTest::TgcSDOVariables::m_tgc_sdo_localPosY
VectorBranch< float > & m_tgc_sdo_localPosY
Definition: TGCSDOVariables.h:32
MuonVal::MuonTesterTree
Definition: MuonTesterTree.h:30
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
HepMC::barcode
int barcode(const T *p)
Definition: Barcode.h:16
MuonPRDTest::PrdTesterModule
Definition: PrdTesterModule.h:15
TGCSDOVariables.h
MuonPRDTest::TgcSDOVariables::fill
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...
Definition: TGCSDOVariables.cxx:12
MuonVal::VectorBranch::push_back
void push_back(const T &value)
Adds a new element at the end of the vector.
MuonPRDTest::TgcSDOVariables::m_tgc_nsdo
ScalarBranch< unsigned int > & m_tgc_nsdo
Definition: TGCSDOVariables.h:24
MuonSimData
Definition: MuonSimData.h:62
MuonPRDTest::TgcSDOVariables::declare_keys
bool declare_keys() override final
Definition: TGCSDOVariables.cxx:10
MuonPRDTest::TgcSDOVariables::m_tgc_sdo_globaltime
VectorBranch< float > & m_tgc_sdo_globaltime
Definition: TGCSDOVariables.h:28
MuonPRDTest
Definition: CSCDigitVariables.h:10
MuonPRDTest::PrdTesterModule::idHelperSvc
const Muon::IMuonIdHelperSvc * idHelperSvc() const
Definition: PrdTesterModule.cxx:15
MuonPRDTest::TgcSDOVariables::m_tgc_sdo_barcode
VectorBranch< int > & m_tgc_sdo_barcode
Definition: TGCSDOVariables.h:27
MuonSimData::globalPosition
const Amg::Vector3D globalPosition() const
Definition: MuonSimData.h:113
MuonSimData::getTime
float getTime() const
Definition: MuonSimData.h:124
MuonPRDTest::TgcSDOVariables::TgcSDOVariables
TgcSDOVariables(MuonTesterTree &tree, const std::string &container_name, MSG::Level msglvl)
Definition: TGCSDOVariables.cxx:7
Identifier
Definition: IdentifierFieldParser.cxx:14