ATLAS Offline Software
sTGCRDOVariables.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 
9 using namespace Muon;
10 namespace MuonPRDTest {
11  sTGCRDOVariables::sTGCRDOVariables(MuonTesterTree& tree, const std::string& container_name, MSG::Level msglvl) :
12  PrdTesterModule(tree, "RDO_sTGC", true, msglvl), m_key{container_name} {}
14 
15  bool sTGCRDOVariables::fill(const EventContext& ctx) {
16  ATH_MSG_DEBUG("do fillsTGCRDOVariables()");
17  const MuonGM::MuonDetectorManager* MuonDetMgr = getDetMgr(ctx);
18  if (!MuonDetMgr) { return false; }
19  SG::ReadHandle<STGC_RawDataContainer> stgcrdoContainer{m_key, ctx};
20  if (!stgcrdoContainer.isValid()) {
21  ATH_MSG_FATAL("Failed to retrieve stgc rdo container " << m_key.fullKey());
22  return false;
23  }
24  ATH_MSG_DEBUG("retrieved sTGC rdo Container with size " << stgcrdoContainer->size());
25 
26  if (stgcrdoContainer->size() == 0) ATH_MSG_DEBUG(" sTGC rdo Container empty ");
27  unsigned int n_rdo{0};
28  for (const STGC_RawDataCollection* coll : *stgcrdoContainer) {
29  for (unsigned int item=0; item<coll->size(); item++) {
30  const STGC_RawData* rdo = coll->at(item);
31  Identifier Id = rdo->identify();
32 
38 
39  const MuonGM::sTgcReadoutElement* rdoEl = MuonDetMgr->getsTgcReadoutElement(Id);
40  if (!rdoEl) {
41  ATH_MSG_ERROR("The sTGC hit "<<idHelperSvc()->toString(Id)<<" does not have a detector element attached. That should actually never happen");
42  return false;
43  }
44 
46  Amg::Vector2D localStripPos(0.,0.);
47  if ( rdoEl->stripPosition(Id,localStripPos) ) {
48  m_NSWsTGC_rdo_localPosX.push_back(localStripPos.x());
49  m_NSWsTGC_rdo_localPosY.push_back(localStripPos.y());
50  ATH_MSG_DEBUG("sTGC RDO: local pos.: x=" << localStripPos[0] << ", y=" << localStripPos[1]);
51  } else {
52  ATH_MSG_WARNING("sTGC RDO: local Strip position not defined");
53  }
54 
55  Amg::Vector3D globalStripPos(0., 0., 0.);
56  rdoEl->surface(Id).localToGlobal(localStripPos,Amg::Vector3D(0.,0.,0.),globalStripPos);
57  m_NSWsTGC_rdo_globalPos.push_back(globalStripPos);
58 
59  ++n_rdo;
60  }
61  }
62  m_NSWsTGC_nRDO = n_rdo;
63  ATH_MSG_DEBUG(" finished fillsTGCRDOVariables()");
64  return true;
65  }
66 }
MuonPRDTest::sTGCRDOVariables::m_NSWsTGC_rdo_localPosY
VectorBranch< double > & m_NSWsTGC_rdo_localPosY
Definition: sTGCRDOVariables.h:31
Muon::STGC_RawData::identify
const Identifier identify() const
Definition: STGC_RawData.h:52
MuonPRDTest::sTGCRDOVariables::m_NSWsTGC_rdo_time
VectorBranch< double > & m_NSWsTGC_rdo_time
Definition: sTGCRDOVariables.h:25
MuonPRDTest::sTGCRDOVariables::m_NSWsTGC_rdo_isDead
VectorBranch< bool > & m_NSWsTGC_rdo_isDead
Definition: sTGCRDOVariables.h:29
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
MuonPRDTest::sTGCRDOVariables::m_NSWsTGC_rdo_tdo
VectorBranch< uint16_t > & m_NSWsTGC_rdo_tdo
Definition: sTGCRDOVariables.h:27
MuonPRDTest::sTGCRDOVariables::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: sTGCRDOVariables.cxx:15
sTgcReadoutElement.h
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
MuonPRDTest::sTGCRDOVariables::m_NSWsTGC_rdo_id
sTgcIdentifierBranch m_NSWsTGC_rdo_id
Definition: sTGCRDOVariables.h:33
tree
TChain * tree
Definition: tile_monitor.h:30
MuonPRDTest::PrdTesterModule::getDetMgr
const MuonGM::MuonDetectorManager * getDetMgr(const EventContext &ctx) const
Definition: PrdTesterModule.cxx:15
MuonVal::sTgcIdentifierBranch::push_back
void push_back(const Identifier &id) override final
Definition: IdentifierBranch.cxx:79
sTGCRDOVariables.h
MuonPRDTest::sTGCRDOVariables::m_NSWsTGC_rdo_localPosX
VectorBranch< double > & m_NSWsTGC_rdo_localPosX
Definition: sTGCRDOVariables.h:30
Muon
This class provides conversion from CSC RDO data to CSC Digits.
Definition: TrackSystemController.h:49
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
MuonGM::sTgcReadoutElement::stripPosition
virtual bool stripPosition(const Identifier &id, Amg::Vector2D &pos) const override final
strip position - should be renamed to channel position If the strip number is outside the range of va...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/sTgcReadoutElement.h:323
MuonVal::MuonTesterBranch::declare_dependency
bool declare_dependency(Key &key)
Declares the ReadHandle/ ReadCondHandleKey as data dependency of the algorithm.
MuonVal::ThreeVectorBranch::push_back
void push_back(const Amg::Vector3D &vec)
interface using the Amg::Vector3D
Definition: ThreeVectorBranch.cxx:23
MuonPRDTest::sTGCRDOVariables::declare_keys
bool declare_keys() override final
Definition: sTGCRDOVariables.cxx:13
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
Muon::STGC_RawData
Definition: STGC_RawData.h:14
Muon::STGC_RawData::tdo
unsigned int tdo() const
Definition: STGC_RawData.h:56
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
MuonGM::sTgcReadoutElement
An sTgcReadoutElement corresponds to a single STGC module; therefore typicaly a barrel muon station c...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/sTgcReadoutElement.h:28
MuonPRDTest::sTGCRDOVariables::m_NSWsTGC_nRDO
ScalarBranch< unsigned int > & m_NSWsTGC_nRDO
Definition: sTGCRDOVariables.h:24
MuonPRDTest::PrdTesterModule
Definition: PrdTesterModule.h:15
MuonPRDTest::sTGCRDOVariables::m_NSWsTGC_rdo_charge
VectorBranch< uint16_t > & m_NSWsTGC_rdo_charge
Definition: sTGCRDOVariables.h:26
MuonPRDTest::sTGCRDOVariables::m_NSWsTGC_rdo_bcTag
VectorBranch< uint16_t > & m_NSWsTGC_rdo_bcTag
Definition: sTGCRDOVariables.h:28
MuonPRDTest::sTGCRDOVariables::m_NSWsTGC_rdo_globalPos
ThreeVectorBranch m_NSWsTGC_rdo_globalPos
Definition: sTGCRDOVariables.h:32
MuonVal::VectorBranch::push_back
void push_back(const T &value)
Adds a new element at the end of the vector.
Muon::STGC_RawData::isDead
bool isDead() const
Definition: STGC_RawData.h:60
MuonPRDTest::sTGCRDOVariables::m_key
SG::ReadHandleKey< Muon::STGC_RawDataContainer > m_key
Definition: sTGCRDOVariables.h:23
Muon::STGC_RawData::time
float time() const
Definition: STGC_RawData.h:55
item
Definition: ItemListSvc.h:43
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
MuonPRDTest
Definition: CSCDigitVariables.h:10
MuonPRDTest::PrdTesterModule::idHelperSvc
const Muon::IMuonIdHelperSvc * idHelperSvc() const
Definition: PrdTesterModule.cxx:14
Muon::STGC_RawDataCollection
Definition: STGC_RawDataCollection.h:18
MuonGM::MuonDetectorManager::getsTgcReadoutElement
const sTgcReadoutElement * getsTgcReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
Definition: MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx:259
Muon::STGC_RawData::charge
unsigned int charge() const
Definition: STGC_RawData.h:57
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
Muon::STGC_RawData::bcTag
uint16_t bcTag() const
Definition: STGC_RawData.h:58