ATLAS Offline Software
MMSDOVariables.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 
7 namespace MuonPRDTest {
8  MMSDOVariables::MMSDOVariables(MuonTesterTree& tree, const std::string& container_name, MSG::Level msglvl) :
9  PrdTesterModule(tree, "SDO_MM", msglvl), m_key{container_name} {}
10 
12 
13  bool MMSDOVariables::fill(const EventContext& ctx) {
14  ATH_MSG_DEBUG("do fill MMSDOVariables()");
15  SG::ReadHandle<MuonSimDataCollection> mmSdoContainer{m_key, ctx};
16  if (!mmSdoContainer.isValid()) {
17  ATH_MSG_FATAL("Failed to retrieve digit container " << m_key.fullKey());
18  return false;
19  }
20  unsigned int n_sdo{0};
21  for (const auto& coll : *mmSdoContainer) {
22  const Identifier& id = coll.first;
23  const MuonSimData& mm_sdo = coll.second;
24 
27 
28  ATH_MSG_DEBUG("Get the truth deposits from the SDO.");
29  std::vector<MuonSimData::Deposit> deposits;
30  mm_sdo.deposits(deposits);
31 
33  const Amg::Vector3D hit_gpos = mm_sdo.globalPosition();
35 
36  // use the information of the first deposit
37  int barcode = deposits[0].first.barcode();
38  double MuonMCdata_firstentry = deposits[0].second.firstEntry();
39  double MuonMCdata_secondentry = deposits[0].second.secondEntry();
40 
41  ATH_MSG_DEBUG("MM SDO barcode=" << barcode);
42  ATH_MSG_DEBUG("MM SDO local position X=" << std::setw(9) << std::setprecision(2) << MuonMCdata_firstentry
43  << ", local position Y=" << std::setw(9) << std::setprecision(2) << MuonMCdata_secondentry);
44 
46 
47  m_NSWMM_sdo_localPosX.push_back(MuonMCdata_firstentry);
48  m_NSWMM_sdo_localPosY.push_back(MuonMCdata_secondentry);
49 
50  ++n_sdo;
51  }
52  m_NSWMM_nsdo = n_sdo;
53 
54  ATH_MSG_DEBUG("Processed " << n_sdo << "MM SDOs");
55  return true;
56  }
57 }
MuonPRDTest::MMSDOVariables::m_NSWMM_dig_globalPos
ThreeVectorBranch m_NSWMM_dig_globalPos
Definition: MMSDOVariables.h:31
MuonPRDTest::MMSDOVariables::m_NSWMM_sdo_localPosY
VectorBranch< float > & m_NSWMM_sdo_localPosY
Definition: MMSDOVariables.h:33
MuonSimData::word
int word() const
Definition: MuonSimData.h:89
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
MuonPRDTest::MMSDOVariables::m_NSWMM_sdo_id
MmIdentifierBranch m_NSWMM_sdo_id
Definition: MMSDOVariables.h:26
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
tree
TChain * tree
Definition: tile_monitor.h:30
MuonVal::MmIdentifierBranch::push_back
void push_back(const Identifier &id) override final
Definition: IdentifierBranch.cxx:93
MuonPRDTest::MMSDOVariables::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: MMSDOVariables.cxx:13
MuonPRDTest::MMSDOVariables::m_NSWMM_nsdo
ScalarBranch< unsigned int > & m_NSWMM_nsdo
Definition: MMSDOVariables.h:25
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
MuonSimData::deposits
void deposits(std::vector< Deposit > &deposits) const
Definition: MuonSimData.h:99
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
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
MuonPRDTest::MMSDOVariables::declare_keys
bool declare_keys() override final
Definition: MMSDOVariables.cxx:11
MuonPRDTest::MMSDOVariables::m_NSWMM_sdo_localPosX
VectorBranch< float > & m_NSWMM_sdo_localPosX
Definition: MMSDOVariables.h:32
MuonPRDTest::MMSDOVariables::m_NSWMM_sdo_barcode
VectorBranch< int > & m_NSWMM_sdo_barcode
Definition: MMSDOVariables.h:28
MMSDOVariables.h
MuonPRDTest::MMSDOVariables::m_key
SG::ReadHandleKey< MuonSimDataCollection > m_key
Definition: MMSDOVariables.h:23
MuonVal::VectorBranch::push_back
void push_back(const T &value)
Adds a new element at the end of the vector.
MuonPRDTest::MMSDOVariables::m_NSWMM_sdo_globaltime
VectorBranch< float > & m_NSWMM_sdo_globaltime
Definition: MMSDOVariables.h:29
MuonSimData
Definition: MuonSimData.h:62
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
MuonPRDTest
Definition: CSCDigitVariables.h:10
MuonPRDTest::MMSDOVariables::m_NSWMM_sdo_word
VectorBranch< int > & m_NSWMM_sdo_word
Definition: MMSDOVariables.h:27
MuonPRDTest::MMSDOVariables::MMSDOVariables
MMSDOVariables(MuonTesterTree &tree, const std::string &container_name, MSG::Level msglvl)
Definition: MMSDOVariables.cxx:8
MuonSimData::globalPosition
const Amg::Vector3D globalPosition() const
Definition: MuonSimData.h:113
MuonSimData::getTime
float getTime() const
Definition: MuonSimData.h:124
Identifier
Definition: IdentifierFieldParser.cxx:14