ATLAS Offline Software
Loading...
Searching...
No Matches
CSCRDOVariables.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
9
10using namespace Muon;
11namespace MuonPRDTest {
12 CSCRDOVariables::CSCRDOVariables(MuonTesterTree& tree, const std::string& container_name, MSG::Level msglvl, const MuonIdHelper* idhelper, const Muon::ICSC_RDO_Decoder* rdo_decoder) :
13 PrdTesterModule(tree, "RDO_CSC", msglvl), m_key{container_name}, m_rdo_decoder{rdo_decoder} {setHelper(idhelper);}
15
16 bool CSCRDOVariables::fill(const EventContext& ctx) {
17 ATH_MSG_DEBUG("do fillCSCRDOVariables()");
18 const MuonGM::MuonDetectorManager* MuonDetMgr = getDetMgr(ctx);
19 if (!MuonDetMgr) { return false; }
20 SG::ReadHandle<CscRawDataContainer> cscrdoContainer{m_key, ctx};
21 if (!cscrdoContainer.isValid()) {
22 ATH_MSG_FATAL("Failed to retrieve csc rdo container " << m_key.fullKey());
23 return false;
24 }
25 ATH_MSG_DEBUG("retrieved CSC rdo Container with size " << cscrdoContainer->size());
26
27 if (cscrdoContainer->size() == 0) ATH_MSG_DEBUG(" CSC rdo Container empty ");
28 unsigned int n_rdo{0};
29 for (const CscRawDataCollection* coll : *cscrdoContainer) {
30 ATH_MSG_DEBUG("processing collection with size " << coll->size());
31 int strip_num{0};
32 for (const CscRawData* rdo: *coll) {
33 const Identifier Id { m_rdo_decoder->channelIdentifier(rdo,m_CscIdHelper,strip_num) };
34 ++strip_num;
35
36 const MuonGM::CscReadoutElement* rdoEl = MuonDetMgr->getCscReadoutElement(Id);
37 if (!rdoEl) {
38 ATH_MSG_ERROR("The CSC hit "<<idHelperSvc()->toString(Id)<<" does not have a detector element attached. That should actually never happen");
39 return false;
40 }
41
42 m_CSC_rdo_time.push_back(rdo->time());
43
44 Amg::Vector3D gpos{0., 0., 0.};
45 Amg::Vector2D lpos(0., 0.);
46
47 rdoEl->surface(Id).localToGlobal(lpos, gpos, gpos);
48 m_CSC_rdo_globalPos.push_back(gpos);
49 m_CSC_rdo_id.push_back(Id);
50
51 ++n_rdo;
52 }
53 // Local RDO position information loss after localToGlobal transformation, fill the local positions in another loop for retrieving the local positions
54 for (const CscRawData* rdo: *coll) {
55 const Identifier Id { m_rdo_decoder->channelIdentifier(rdo,m_CscIdHelper,strip_num) };
56 ++strip_num;
57
58 const MuonGM::CscReadoutElement* rdoEl = MuonDetMgr->getCscReadoutElement(Id);
59 if (!rdoEl) return false;
60
61 Amg::Vector2D loPos(0.,0.);
62 Amg::Vector3D glPos(0., 0., 0.);
63
64 rdoEl->surface(Id).globalToLocal(glPos,glPos,loPos);
65 m_CSC_rdo_localPosX.push_back(loPos.x());
66 m_CSC_rdo_localPosY.push_back(loPos.y());
67 }
68 }
69 m_CSC_nRDO = n_rdo;
70 ATH_MSG_DEBUG(" finished fillCSCRDOVariables()");
71 return true;
72 }
73}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_FATAL(x)
#define ATH_MSG_DEBUG(x)
Collection of CSC Raw Hits, arranged according to CSC Detector Elements Author: Ketevi A.
Class to hold the electronic output for a single CSC readout channel: n sampling ADC data + the addre...
Definition CscRawData.h:21
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 CscReadoutElement * getCscReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
ThreeVectorBranch m_CSC_rdo_globalPos
bool declare_keys() override final
void setHelper(const MuonIdHelper *idhelper)
SG::ReadHandleKey< CscRawDataContainer > m_key
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...
CSCRDOVariables(MuonTesterTree &tree, const std::string &container_name, MSG::Level msglvl, const MuonIdHelper *idhelper, const Muon::ICSC_RDO_Decoder *rdo_decoder)
ScalarBranch< unsigned int > & m_CSC_nRDO
VectorBranch< float > & m_CSC_rdo_localPosX
CscIdentifierBranch m_CSC_rdo_id
VectorBranch< float > & m_CSC_rdo_localPosY
const Muon::ICSC_RDO_Decoder * m_rdo_decoder
VectorBranch< int > & m_CSC_rdo_time
const CscIdHelper * m_CscIdHelper
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.
This class provides conversion from RDO data to CSC RDO Author: Ketevi A.
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.
virtual bool globalToLocal(const Amg::Vector3D &glob, const Amg::Vector3D &mom, Amg::Vector2D &loc) const override final
Specified for PlaneSurface: GlobalToLocal method without dynamic memory allocation - boolean checks i...
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.