ATLAS Offline Software
Loading...
Searching...
No Matches
TGCPRDVariables.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
9namespace MuonPRDTest {
10 TGCPRDVariables::TGCPRDVariables(MuonTesterTree& tree, const std::string& container_name, MSG::Level msglvl) :
11 PrdTesterModule(tree, "PRD_TGC", msglvl), m_key{container_name} {}
13
14 bool TGCPRDVariables::fill(const EventContext& ctx) {
15 ATH_MSG_DEBUG("do fillTGCPRDVariables()");
16 const MuonGM::MuonDetectorManager* MuonDetMgr = getDetMgr(ctx);
17 if (!MuonDetMgr) { return false; }
19 if (!tgcprdContainer.isValid()) {
20 ATH_MSG_FATAL("Failed to retrieve prd container " << m_key.fullKey());
21 return false;
22 }
23
24 ATH_MSG_DEBUG("retrieved TGC PRD Container with size " << tgcprdContainer->size());
25
26 unsigned int n_PRD{0};
27 for(const Muon::TgcPrepDataCollection* coll : *tgcprdContainer ) {
28 for (const Muon::TgcPrepData* prd: *coll) {
29 Identifier Id = prd->identify();
30 const MuonGM::TgcReadoutElement* det = MuonDetMgr->getTgcReadoutElement(Id);
31 if (!det) {
32 ATH_MSG_ERROR("The TGC hit "<<idHelperSvc()->toString(Id)<<" does not have a detector element attached. That should actually never happen");
33 return false;
34 }
35
36 m_TGC_PRD_id.push_back(Id);
37 Amg::Vector3D pos = prd->globalPosition();
38 Amg::Vector2D loc_pos{Amg::Vector2D::Zero()};
39 det->surface(Id).globalToLocal(pos, Amg::Vector3D::Zero(), loc_pos);
40 m_TGC_PRD_globalPos.push_back(pos);
41 m_TGC_PRD_localPos.push_back(loc_pos);
42 m_TGC_PRD_bcId.push_back(prd->getBcBitMap());
43 m_TGC_PRD_error.push_back(Amg::error(prd->localCovariance(), Trk::locX));
44 ++n_PRD;
45 }
46 }
47 m_TGC_nPRD = n_PRD;
48 ATH_MSG_DEBUG(" finished fillTGCPRDVariables()");
49 return true;
50 }
51}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_FATAL(x)
#define ATH_MSG_DEBUG(x)
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...
const MuonGM::MuonDetectorManager * getDetMgr(const EventContext &ctx) const
const Muon::IMuonIdHelperSvc * idHelperSvc() const
PrdTesterModule(MuonTesterTree &tree, const std::string &grp_name, MSG::Level msglvl)
ThreeVectorBranch m_TGC_PRD_globalPos
VectorBranch< float > & m_TGC_PRD_error
bool declare_keys() override final
ScalarBranch< unsigned int > & m_TGC_nPRD
TGCPRDVariables(MuonTesterTree &tree, const std::string &container_name, MSG::Level msglvl)
SG::ReadHandleKey< Muon::TgcPrepDataContainer > m_key
TgcIdentifierBranch m_TGC_PRD_id
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...
VectorBranch< uint8_t > & m_TGC_PRD_bcId
bool declare_dependency(Key &key)
Declares the ReadHandle/ ReadCondHandleKey as data dependency of the algorithm.
TTree * tree() override final
Returns the underlying TTree object.
Class to represent TGC measurements.
Definition TgcPrepData.h:32
virtual bool isValid() override final
Can the handle be successfully dereferenced?
double error(const Amg::MatrixX &mat, int index)
return diagonal error of the matrix caller should ensure the matrix is symmetric and the index is in ...
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D
MuonPrepDataCollection< TgcPrepData > TgcPrepDataCollection
@ locX
Definition ParamDefs.h:37