ATLAS Offline Software
Loading...
Searching...
No Matches
TGCRDOVariables.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
9#include "MuonRDO/TgcRdo.h"
10
11using namespace Muon;
12namespace MuonPRDTest {
14 const std::string& container_name,
15 const std::string& cabling_key,
16 MSG::Level msglvl) :
17 PrdTesterModule(tree, "RDO_TGC", msglvl),
18 m_key{container_name},
19 m_tgcCablingKey{cabling_key} {}
24
25 bool TGCRDOVariables::fill(const EventContext& ctx) {
26 ATH_MSG_DEBUG("do fillTGCRDOVariables()");
27 const MuonGM::MuonDetectorManager* MuonDetMgr = getDetMgr(ctx);
28 if (!MuonDetMgr) { return false; }
29 const TgcRdoContainer* tgcrdoContainer{};
30 if (!SG::get(tgcrdoContainer, m_key, ctx).isSuccess()) {
31 return false;
32 }
33 const Muon::TgcCablingMap* cabling{nullptr};
34 if (!SG::get(cabling, m_tgcCablingKey, ctx).isSuccess()) {
35 return false;
36 }
37 ATH_MSG_DEBUG("retrieved TGC rdo Container with size " << tgcrdoContainer->size());
38
39 if (tgcrdoContainer->size() == 0) ATH_MSG_DEBUG(" TGC rdo Container empty ");
40 unsigned int n_rdo{0};
41 for (const TgcRdo* coll : *tgcrdoContainer) {
42 ATH_MSG_DEBUG("processing collection with size " << coll->size());
43 for (const TgcRawData* rdo: *coll) {
44
45 bool orFlag = cabling->isOredChannel(rdo->subDetectorId(),
46 rdo->rodId(),
47 rdo->sswId(),
48 rdo->slbId(),
49 rdo->bitpos());
50
51 Identifier Id;
52 bool e_found = cabling->getElementIDfromReadoutID(Id,
53 rdo->subDetectorId(),
54 rdo->rodId(),
55 rdo->sswId(),
56 rdo->slbId(),
57 rdo->bitpos(),
58 orFlag);
59 if (!e_found) {
60 ATH_MSG_ERROR("could not find Identifier from TgcRawData");
61 return false;
62 }
63
64 const MuonGM::TgcReadoutElement* rdoEl = MuonDetMgr->getTgcReadoutElement(Id);
65 if (!rdoEl) {
66 ATH_MSG_ERROR("The TGC hit "<<idHelperSvc()->toString(Id)<<" does not have a detector element attached. That should actually never happen");
67 return false;
68 }
69
70 m_TGC_rdo_id.push_back(Id);
71 Amg::Vector2D localStripPos(0.,0.);
72 if ( rdoEl->stripPosition(Id,localStripPos) ) {
73 m_TGC_rdo_localPosX.push_back(localStripPos.x());
74 m_TGC_rdo_localPosY.push_back(localStripPos.y());
75 ATH_MSG_DEBUG("TGC RDO: local pos.: x=" << localStripPos[0] << ", y=" << localStripPos[1]);
76 } else {
77 ATH_MSG_WARNING("TGC RDO: local Strip position not defined");
78 }
79
80 // asking the detector element to transform this local to the global position
81 Amg::Vector3D globalStripPos(0., 0., 0.);
82 rdoEl->surface(Id).localToGlobal(localStripPos,Amg::Vector3D(0.,0.,0.),globalStripPos);
83 m_TGC_rdo_globalPos.push_back(globalStripPos);
84
85 ++n_rdo;
86 }
87 }
88 m_TGC_nRDO = n_rdo;
89 ATH_MSG_DEBUG(" finished fillTGCRDOVariables()");
90 return true;
91 }
92}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
size_t size() const
Duplicate of fullSize for backwards compatability.
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 TgcReadoutElement * getTgcReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
A TgcReadoutElement corresponds to a single TGC chamber; therefore typically a TGC station contains s...
virtual bool stripPosition(const Identifier &id, Amg::Vector2D &pos) const override
strip position If the strip number is outside the range of valid strips, the function will return fal...
const MuonGM::MuonDetectorManager * getDetMgr(const EventContext &ctx) const
const Muon::IMuonIdHelperSvc * idHelperSvc() const
PrdTesterModule(MuonTesterTree &tree, const std::string &grp_name, MSG::Level msglvl)
SG::ReadHandleKey< TgcRdoContainer > m_key
ThreeVectorBranch m_TGC_rdo_globalPos
SG::ReadCondHandleKey< Muon::TgcCablingMap > m_tgcCablingKey
VectorBranch< float > & m_TGC_rdo_localPosX
bool declare_keys() override final
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...
TGCRDOVariables(MuonTesterTree &tree, const std::string &container_name, const std::string &cabling, MSG::Level msglvl)
VectorBranch< float > & m_TGC_rdo_localPosY
ScalarBranch< unsigned int > & m_TGC_nRDO
TgcIdentifierBranch m_TGC_rdo_id
bool declare_dependency(Key &key)
Declares the ReadHandle/ ReadCondHandleKey as data dependency of the algorithm.
TTree * tree() override final
Returns the underlying TTree object.
An unit object of TGC ROD output.
Definition TgcRawData.h:23
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
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
std::string toString(CscStripStatus cstat)
Return a string description of a CSC cluster status flag.
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.