ATLAS Offline Software
Loading...
Searching...
No Matches
MMDigitVariables.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
6
8
9namespace MuonPRDTest {
10 MMDigitVariables::MMDigitVariables(MuonTesterTree& tree, const std::string& container_name, MSG::Level msglvl) :
11 PrdTesterModule(tree, "Digits_MM", msglvl), m_key{container_name} {}
12
14 bool MMDigitVariables::fill(const EventContext& ctx) {
15 ATH_MSG_DEBUG("do fillMMDigitHitVariables()");
16 const MuonGM::MuonDetectorManager* MuonDetMgr = getDetMgr(ctx);
17 if (!MuonDetMgr) { return false; }
18 SG::ReadHandle<MmDigitContainer> MMDigitContainer{m_key, ctx};
19 if (!MMDigitContainer.isValid()) {
20 ATH_MSG_FATAL("Failed to retrieve digit container " << m_key.fullKey());
21 return false;
22 }
23
24 ATH_MSG_DEBUG("retrieved MM Digit Container with size " << MMDigitContainer->digit_size());
25
26 if (MMDigitContainer->size() == 0) ATH_MSG_DEBUG(" MM Digit Container empty ");
27 unsigned int n_digits{0};
28 for (const MmDigitCollection* coll : *MMDigitContainer) {
29 ATH_MSG_DEBUG("processing collection with size " << coll->size());
30 for (const MmDigit* digit : *coll) {
31 Identifier Id = digit->identify();
32
33 const MuonGM::MMReadoutElement* rdoEl = MuonDetMgr->getMMReadoutElement(Id);
34 if (!rdoEl) {
35 ATH_MSG_ERROR("MMDigitVariables::fillVariables() - Failed to retrieve MMReadoutElement for "<<idHelperSvc()->mmIdHelper().print_to_string(Id).c_str());
36 return false;
37 }
38 m_NSWMM_dig_id.push_back(Id);
39
40 Amg::Vector2D cr_strip_pos{Amg::Vector2D::Zero()};
41 if ( !rdoEl->stripPosition(Id, cr_strip_pos) ) {
42 ATH_MSG_WARNING("MMDigitVariables: failed to associate a valid local position for (chip response) strip n. "
43 << "; associated positions will be set to 0.0.");
44 continue;
45 }
46 m_NSWMM_dig_stripLpos.push_back(cr_strip_pos);
47 // asking the detector element to transform this local to the global position
48 Amg::Vector3D cr_strip_gpos(Amg::Vector3D::Zero());
49 rdoEl->surface(Id).localToGlobal(cr_strip_pos, Amg::Vector3D::Zero(), cr_strip_gpos);
50 m_NSWMM_dig_stripGpos.push_back(cr_strip_gpos);
51 ++n_digits;
52 }
53 }
54 m_NSWMM_nDigits = n_digits;
55 ATH_MSG_DEBUG(" finished fillMMDigitVariables()");
56 return true;
57 }
58}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_FATAL(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
An MMReadoutElement corresponds to a single STGC module; therefore typicaly a barrel muon station con...
virtual bool stripPosition(const Identifier &id, Amg::Vector2D &pos) const override final
strip position – local or global If the strip number is outside the range of valid strips,...
virtual const Trk::PlaneSurface & surface() const override
access to chamber surface (phi orientation), uses the first gas gap
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
const MMReadoutElement * getMMReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
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...
ThreeVectorBranch m_NSWMM_dig_stripGpos
MmIdentifierBranch m_NSWMM_dig_id
ScalarBranch< unsigned int > & m_NSWMM_nDigits
bool declare_keys() override final
MMDigitVariables(MuonTesterTree &tree, const std::string &container_name, MSG::Level msglvl)
SG::ReadHandleKey< MmDigitContainer > m_key
const MuonGM::MuonDetectorManager * getDetMgr(const EventContext &ctx) const
const Muon::IMuonIdHelperSvc * idHelperSvc() const
PrdTesterModule(MuonTesterTree &tree, const std::string &grp_name, MSG::Level msglvl)
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?
virtual void localToGlobal(const Amg::Vector2D &locp, const Amg::Vector3D &mom, Amg::Vector3D &glob) const override final
Specified for PlaneSurface: LocalToGlobal method without dynamic memory allocation.
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D