ATLAS Offline Software
MMDigitVariables.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 namespace MuonPRDTest {
10  MMDigitVariables::MMDigitVariables(MuonTesterTree& tree, const std::string& container_name, MSG::Level msglvl) :
11  PrdTesterModule(tree, "Digits_MM", true, msglvl), m_key{container_name} {}
12 
14  bool MMDigitVariables::fill(const EventContext& ctx) {
15  ATH_MSG_DEBUG("do fillMMDigitHitVariables()");
16  const MuonGM::MuonDetectorManager* MuonDetMgr = getDetMgr(ctx);
17  if (!MuonDetMgr) { return false; }
18  SG::ReadHandle<MmDigitContainer> MMDigitContainer{m_key, ctx};
19  if (!MMDigitContainer.isValid()) {
20  ATH_MSG_FATAL("Failed to retrieve digit container " << m_key.fullKey());
21  return false;
22  }
23 
24  ATH_MSG_DEBUG("retrieved MM Digit Container with size " << MMDigitContainer->digit_size());
25 
26  if (MMDigitContainer->size() == 0) ATH_MSG_DEBUG(" MM Digit Container empty ");
27  unsigned int n_digits{0};
28  for (const MmDigitCollection* coll : *MMDigitContainer) {
29  ATH_MSG_DEBUG("processing collection with size " << coll->size());
30  for (const MmDigit* digit : *coll) {
31  Identifier Id = digit->identify();
32  const MuonGM::MMReadoutElement* rdoEl = MuonDetMgr->getMMReadoutElement(Id);
33  if (!rdoEl) {
34  ATH_MSG_ERROR("MMDigitVariables::fillVariables() - Failed to retrieve MMReadoutElement for "<<idHelperSvc()->mmIdHelper().print_to_string(Id).c_str());
35  return false;
36  }
37  Amg::Vector2D cr_strip_pos{Amg::Vector2D::Zero()};
38  if ( !rdoEl->stripPosition(Id, cr_strip_pos) ) {
39  ATH_MSG_WARNING("MMDigitVariables: failed to associate a valid local position for (chip response) strip n. "
40  << "; associated positions will be set to 0.0.");
41  continue;
42  }
43  m_NSWMM_dig_stripLpos.push_back(cr_strip_pos);
44  // asking the detector element to transform this local to the global position
45  Amg::Vector3D cr_strip_gpos(Amg::Vector3D::Zero());
46  rdoEl->surface(Id).localToGlobal(cr_strip_pos, Amg::Vector3D::Zero(), cr_strip_gpos);
47  m_NSWMM_dig_stripGpos.push_back(cr_strip_gpos);
48  ++n_digits;
49  }
50  }
51  m_NSWMM_nDigits = n_digits;
52  ATH_MSG_DEBUG(" finished fillMMDigitVariables()");
53  return true;
54  }
55 }
MmDigitCollection
Definition: MmDigitCollection.h:18
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:209
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
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
MuonPRDTest::MMDigitVariables::MMDigitVariables
MMDigitVariables(MuonTesterTree &tree, const std::string &container_name, MSG::Level msglvl)
Definition: MMDigitVariables.cxx:10
MuonPRDTest::PrdTesterModule::getDetMgr
const MuonGM::MuonDetectorManager * getDetMgr(const EventContext &ctx) const
Definition: PrdTesterModule.cxx:15
MmDigit
Definition: MmDigit.h:20
checkRpcDigits.digit
digit
Definition: checkRpcDigits.py:186
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
MuonPRDTest::MMDigitVariables::m_NSWMM_dig_stripLpos
TwoVectorBranch m_NSWMM_dig_stripLpos
Definition: MMDigitVariables.h:28
MuonPRDTest::MMDigitVariables::m_NSWMM_nDigits
ScalarBranch< unsigned int > & m_NSWMM_nDigits
Definition: MMDigitVariables.h:25
MuonVal::MuonTesterBranch::declare_dependency
bool declare_dependency(Key &key)
Declares the ReadHandle/ ReadCondHandleKey as data dependency of the algorithm.
MuonPRDTest::MMDigitVariables::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: MMDigitVariables.cxx:14
MuonVal::ThreeVectorBranch::push_back
void push_back(const Amg::Vector3D &vec)
interface using the Amg::Vector3D
Definition: ThreeVectorBranch.cxx:23
MMReadoutElement.h
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
MuonVal::TwoVectorBranch::push_back
void push_back(const Amg::Vector2D &vec)
interface using the Amg::Vector3D
Definition: TwoVectorBranch.cxx:21
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
MuonPRDTest::PrdTesterModule
Definition: PrdTesterModule.h:15
MuonPRDTest::MMDigitVariables::m_key
SG::ReadHandleKey< MmDigitContainer > m_key
Definition: MMDigitVariables.h:24
MuonPRDTest::MMDigitVariables::m_NSWMM_dig_stripGpos
ThreeVectorBranch m_NSWMM_dig_stripGpos
Definition: MMDigitVariables.h:29
MuonPRDTest::MMDigitVariables::declare_keys
bool declare_keys() override final
Definition: MMDigitVariables.cxx:13
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
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:14
MuonGM::MMReadoutElement
An MMReadoutElement corresponds to a single STGC module; therefore typicaly a barrel muon station con...
Definition: MMReadoutElement.h:23
MMDigitVariables.h
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
generate::Zero
void Zero(TH1D *hin)
Definition: generate.cxx:32