ATLAS Offline Software
MMRDOVariables.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  MMRDOVariables::MMRDOVariables(MuonTesterTree& tree, const std::string& container_name, MSG::Level msglvl) :
12  PrdTesterModule(tree, "RDO_MM", msglvl), m_rdokey{container_name} {}
14 
15  bool MMRDOVariables::fill(const EventContext& ctx) {
16  ATH_MSG_DEBUG("do fillMMRDOVariables()");
17  const MuonGM::MuonDetectorManager* MuonDetMgr = getDetMgr(ctx);
18  if (!MuonDetMgr) { return false; }
19  SG::ReadHandle<MM_RawDataContainer> mmrdoContainer{m_rdokey, ctx};
20  if (!mmrdoContainer.isValid()) {
21  ATH_MSG_FATAL("Failed to retrieve MM rdo container " << m_rdokey.fullKey());
22  return false;
23  }
24  ATH_MSG_DEBUG("retrieved MM rdo Container with size " << mmrdoContainer->size());
25 
26  if (mmrdoContainer->size() == 0) ATH_MSG_DEBUG(" MM rdo Container empty ");
27  unsigned int n_rdo{0};
28  for (const MM_RawDataCollection* coll : *mmrdoContainer) {
29  for (unsigned int item=0; item<coll->size(); item++) {
30  const MM_RawData* rdo = coll->at(item);
31  Identifier Id = rdo->identify();
32 
36 
37  const MuonGM::MMReadoutElement* rdoEl = MuonDetMgr->getMMReadoutElement(Id);
38  if (!rdoEl) {
39  ATH_MSG_ERROR("The micromega hit "<<idHelperSvc()->toString(Id)<<" does not have a detector element attached. That should actually never happen");
40  return false;
41  }
42 
44  Amg::Vector2D localStripPos(0.,0.);
45  if ( rdoEl->stripPosition(Id,localStripPos) ) {
46  m_NSWMM_rdo_localPosX.push_back(localStripPos.x());
47  m_NSWMM_rdo_localPosY.push_back(localStripPos.y());
48  ATH_MSG_DEBUG("MM RDO: local pos.: x=" << localStripPos[0] << ", y=" << localStripPos[1]);
49  } else {
50  ATH_MSG_WARNING("MM RDO: local Strip position not defined");
51  }
52 
53  Amg::Vector3D globalStripPos(0., 0., 0.);
54  rdoEl->surface(Id).localToGlobal(localStripPos,Amg::Vector3D(0.,0.,0.),globalStripPos);
55  m_NSWMM_rdo_globalPos.push_back(globalStripPos);
56 
57  ++n_rdo;
58  }
59  }
60  m_NSWMM_nRDO = n_rdo;
61  ATH_MSG_DEBUG(" finished fillMMRDOVariables()");
62  return true;
63  }
64 }
MuonGM::MMReadoutElement::stripPosition
virtual bool stripPosition(const Identifier &id, Amg::Vector2D &pos) const override final
strip position – local or global If the strip number is outside the range of valid strips,...
Definition: MMReadoutElement.h:207
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
Muon::MM_RawData::relBcid
uint16_t relBcid() const
Definition: MM_RawData.h:63
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
Muon::MM_RawData::identify
const Identifier & identify() const
Definition: MM_RawData.h:58
tree
TChain * tree
Definition: tile_monitor.h:30
Muon::MM_RawData::time
int time() const
Definition: MM_RawData.h:62
MuonPRDTest::PrdTesterModule::getDetMgr
const MuonGM::MuonDetectorManager * getDetMgr(const EventContext &ctx) const
Definition: PrdTesterModule.cxx:16
MuonVal::MmIdentifierBranch::push_back
void push_back(const Identifier &id) override final
Definition: IdentifierBranch.cxx:93
Muon
This class provides conversion from CSC RDO data to CSC Digits.
Definition: TrackSystemController.h:45
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
Muon::MM_RawDataCollection
Definition: MM_RawDataCollection.h:15
MuonPRDTest::MMRDOVariables::m_NSWMM_rdo_charge
VectorBranch< int > & m_NSWMM_rdo_charge
Definition: MMRDOVariables.h:26
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
MMReadoutElement.h
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::MMRDOVariables::m_NSWMM_rdo_localPosY
VectorBranch< double > & m_NSWMM_rdo_localPosY
Definition: MMRDOVariables.h:29
MuonPRDTest::MMRDOVariables::m_NSWMM_rdo_localPosX
VectorBranch< double > & m_NSWMM_rdo_localPosX
Definition: MMRDOVariables.h:28
Muon::MM_RawData
Temporary class to hold the MM RDO.
Definition: MM_RawData.h:20
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
MuonPRDTest::MMRDOVariables::m_rdokey
SG::ReadHandleKey< Muon::MM_RawDataContainer > m_rdokey
Definition: MMRDOVariables.h:23
MuonPRDTest::PrdTesterModule
Definition: PrdTesterModule.h:15
MMRDOVariables.h
MuonVal::VectorBranch::push_back
void push_back(const T &value)
Adds a new element at the end of the vector.
MuonPRDTest::MMRDOVariables::m_NSWMM_rdo_globalPos
ThreeVectorBranch m_NSWMM_rdo_globalPos
Definition: MMRDOVariables.h:30
Muon::MM_RawData::charge
int charge() const
Definition: MM_RawData.h:64
MuonPRDTest::MMRDOVariables::m_NSWMM_rdo_relBcid
VectorBranch< uint16_t > & m_NSWMM_rdo_relBcid
Definition: MMRDOVariables.h:27
MuonPRDTest::MMRDOVariables::declare_keys
bool declare_keys() override final
Definition: MMRDOVariables.cxx:13
MuonPRDTest::MMRDOVariables::m_NSWMM_rdo_id
MmIdentifierBranch m_NSWMM_rdo_id
Definition: MMRDOVariables.h:31
item
Definition: ItemListSvc.h:43
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
MuonPRDTest::MMRDOVariables::m_NSWMM_rdo_time
VectorBranch< int > & m_NSWMM_rdo_time
Definition: MMRDOVariables.h:25
MuonPRDTest::MMRDOVariables::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: MMRDOVariables.cxx:15
MuonGM::MuonDetectorManager
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h:50
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
MuonGM::MuonDetectorManager::getMMReadoutElement
const MMReadoutElement * getMMReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
Definition: MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx:255
MuonPRDTest
Definition: CSCDigitVariables.h:10
MuonPRDTest::PrdTesterModule::idHelperSvc
const Muon::IMuonIdHelperSvc * idHelperSvc() const
Definition: PrdTesterModule.cxx:15
MuonGM::MMReadoutElement
An MMReadoutElement corresponds to a single STGC module; therefore typicaly a barrel muon station con...
Definition: MMReadoutElement.h:25
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
MuonPRDTest::MMRDOVariables::m_NSWMM_nRDO
ScalarBranch< unsigned int > & m_NSWMM_nRDO
Definition: MMRDOVariables.h:24
Identifier
Definition: IdentifierFieldParser.cxx:14