ATLAS Offline Software
TGCRDOVariables.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
8 #include "MuonRDO/TgcRdo.h"
9 
10 using namespace Muon;
11 namespace MuonPRDTest {
12  TGCRDOVariables::TGCRDOVariables(MuonTesterTree& tree, const std::string& container_name, MSG::Level msglvl, const ITGCcablingSvc* cabling_svc) :
13  PrdTesterModule(tree, "RDO_TGC", true, msglvl), m_key{container_name}, m_tgcCabling{cabling_svc} {}
15 
16  bool TGCRDOVariables::fill(const EventContext& ctx) {
17  ATH_MSG_DEBUG("do fillTGCRDOVariables()");
18  const MuonGM::MuonDetectorManager* MuonDetMgr = getDetMgr(ctx);
19  if (!MuonDetMgr) { return false; }
20  SG::ReadHandle<TgcRdoContainer> tgcrdoContainer{m_key, ctx};
21  if (!tgcrdoContainer.isValid()) {
22  ATH_MSG_FATAL("Failed to retrieve tgc rdo container " << m_key.fullKey());
23  return false;
24  }
25  ATH_MSG_DEBUG("retrieved TGC rdo Container with size " << tgcrdoContainer->size());
26 
27  if (tgcrdoContainer->size() == 0) ATH_MSG_DEBUG(" TGC rdo Container empty ");
28  unsigned int n_rdo{0};
29  for (const TgcRdo* coll : *tgcrdoContainer) {
30  ATH_MSG_DEBUG("processing collection with size " << coll->size());
31  for (const TgcRawData* rdo: *coll) {
32 
33  bool orFlag = m_tgcCabling->isOredChannel(rdo->subDetectorId(),
34  rdo->rodId(),
35  rdo->sswId(),
36  rdo->slbId(),
37  rdo->bitpos());
38 
39  Identifier Id;
40  bool e_found = m_tgcCabling->getElementIDfromReadoutID(Id,
41  rdo->subDetectorId(),
42  rdo->rodId(),
43  rdo->sswId(),
44  rdo->slbId(),
45  rdo->bitpos(),
46  orFlag);
47  if (!e_found) {
48  ATH_MSG_ERROR("could not find Identifier from TgcRawData");
49  return false;
50  }
51 
52  const MuonGM::TgcReadoutElement* rdoEl = MuonDetMgr->getTgcReadoutElement(Id);
53  if (!rdoEl) {
54  ATH_MSG_ERROR("The TGC hit "<<idHelperSvc()->toString(Id)<<" does not have a detector element attached. That should actually never happen");
55  return false;
56  }
57 
59  Amg::Vector2D localStripPos(0.,0.);
60  if ( rdoEl->stripPosition(Id,localStripPos) ) {
61  m_TGC_rdo_localPosX.push_back(localStripPos.x());
62  m_TGC_rdo_localPosY.push_back(localStripPos.y());
63  ATH_MSG_DEBUG("TGC RDO: local pos.: x=" << localStripPos[0] << ", y=" << localStripPos[1]);
64  } else {
65  ATH_MSG_WARNING("TGC RDO: local Strip position not defined");
66  }
67 
68  // asking the detector element to transform this local to the global position
69  Amg::Vector3D globalStripPos(0., 0., 0.);
70  rdoEl->surface(Id).localToGlobal(localStripPos,Amg::Vector3D(0.,0.,0.),globalStripPos);
71  m_TGC_rdo_globalPos.push_back(globalStripPos);
72 
73  ++n_rdo;
74  }
75  }
76  m_TGC_nRDO = n_rdo;
77  ATH_MSG_DEBUG(" finished fillTGCRDOVariables()");
78  return true;
79  }
80 }
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
ITGCcablingSvc
Definition: ITGCcablingSvc.h:31
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
tree
TChain * tree
Definition: tile_monitor.h:30
ITGCcablingSvc::isOredChannel
virtual bool isOredChannel(const int subDetectorID, const int rodID, const int sswID, const int sbLoc, const int channelID) const =0
MuonPRDTest::PrdTesterModule::getDetMgr
const MuonGM::MuonDetectorManager * getDetMgr(const EventContext &ctx) const
Definition: PrdTesterModule.cxx:15
MuonPRDTest::TGCRDOVariables::m_TGC_rdo_localPosX
VectorBranch< float > & m_TGC_rdo_localPosX
Definition: TGCRDOVariables.h:27
MuonPRDTest::TGCRDOVariables::declare_keys
bool declare_keys() override final
Definition: TGCRDOVariables.cxx:14
Muon
This class provides conversion from CSC RDO data to CSC Digits.
Definition: TrackSystemController.h:49
MuonGM::TgcReadoutElement::stripPosition
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...
Definition: MuonDetDescr/MuonReadoutGeometry/src/TgcReadoutElement.cxx:306
MuonGM::MuonClusterReadoutElement::surface
virtual const Trk::PlaneSurface & surface() const override
access to chamber surface (phi orientation), uses the first gas gap
Definition: MuonClusterReadoutElement.h:123
MuonVal::MuonTesterBranch::declare_dependency
bool declare_dependency(Key &key)
Declares the ReadHandle/ ReadCondHandleKey as data dependency of the algorithm.
MuonGM::MuonDetectorManager::getTgcReadoutElement
const TgcReadoutElement * getTgcReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
Definition: MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx:247
MuonVal::ThreeVectorBranch::push_back
void push_back(const Amg::Vector3D &vec)
interface using the Amg::Vector3D
Definition: ThreeVectorBranch.cxx:23
MuonVal::TgcIdentifierBranch::push_back
void push_back(const Identifier &id) override final
Definition: IdentifierBranch.cxx:66
Amg::toString
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Definition: GeoPrimitivesToStringConverter.h:40
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
MuonVal::MuonTesterTree
Definition: MuonTesterTree.h:30
MuonPRDTest::TGCRDOVariables::m_tgcCabling
const ITGCcablingSvc * m_tgcCabling
Definition: TGCRDOVariables.h:25
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
MuonPRDTest::TGCRDOVariables::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: TGCRDOVariables.cxx:16
MuonPRDTest::TGCRDOVariables::m_TGC_rdo_id
TgcIdentifierBranch m_TGC_rdo_id
Definition: TGCRDOVariables.h:30
MuonPRDTest::PrdTesterModule
Definition: PrdTesterModule.h:15
MuonGM::TgcReadoutElement
A TgcReadoutElement corresponds to a single TGC chamber; therefore typically a TGC station contains s...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/TgcReadoutElement.h:42
ITGCcablingSvc::getElementIDfromReadoutID
virtual bool getElementIDfromReadoutID(Identifier &elementID, const int subDetectorID, const int rodID, const int sswID, const int sbLoc, const int channelID, bool orChannel=false) const =0
TGCRDOVariables.h
TgcRdo.h
MuonPRDTest::TGCRDOVariables::m_TGC_rdo_localPosY
VectorBranch< float > & m_TGC_rdo_localPosY
Definition: TGCRDOVariables.h:28
MuonPRDTest::TGCRDOVariables::m_TGC_nRDO
ScalarBranch< unsigned int > & m_TGC_nRDO
Definition: TGCRDOVariables.h:26
MuonVal::VectorBranch::push_back
void push_back(const T &value)
Adds a new element at the end of the vector.
MuonPRDTest::TGCRDOVariables::m_TGC_rdo_globalPos
ThreeVectorBranch m_TGC_rdo_globalPos
Definition: TGCRDOVariables.h:29
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
MuonGM::MuonDetectorManager
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h:49
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
TgcRawData
An unit object of TGC ROD output.
Definition: TgcRawData.h:23
MuonPRDTest
Definition: CSCDigitVariables.h:10
MuonPRDTest::PrdTesterModule::idHelperSvc
const Muon::IMuonIdHelperSvc * idHelperSvc() const
Definition: PrdTesterModule.cxx:14
TgcReadoutElement.h
MuonPRDTest::TGCRDOVariables::m_key
SG::ReadHandleKey< TgcRdoContainer > m_key
Definition: TGCRDOVariables.h:24
TgcRdo
Definition: TgcRdo.h:22
Trk::PlaneSurface::localToGlobal
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.
Definition: PlaneSurface.cxx:204
MuonSimDataCollection.h