ATLAS Offline Software
MDTDigitVariables.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
5 
9 namespace MuonPRDTest {
10  MdtDigitVariables::MdtDigitVariables(MuonTesterTree& tree, const std::string& container_name, MSG::Level msglvl) :
11  PrdTesterModule(tree, "Digits_MDT", msglvl), m_digitKey{container_name} {}
12 
13  bool MdtDigitVariables::fill(const EventContext& ctx) {
14  ATH_MSG_DEBUG("do fill Mdt digit variables ");
15  const MuonGM::MuonDetectorManager* MuonDetMgr = getDetMgr(ctx);
16  if (!MuonDetMgr) { return false; }
18  if (!MdtDigitContainer.isValid()) {
19  ATH_MSG_FATAL("Failed to retrieve digit container " << m_digitKey.fullKey());
20  return false;
21  }
22  ATH_MSG_DEBUG("retrieved MDT Digit Container with size " << MdtDigitContainer->digit_size());
23 
24  if (MdtDigitContainer->size() == 0) ATH_MSG_DEBUG(" MDT Digit Container empty ");
25  unsigned int n_digits{0};
26 
27  for (const MdtDigitCollection* coll : *MdtDigitContainer) {
28  ATH_MSG_DEBUG("processing collection with size " << coll->size());
29  for (unsigned int digitNum = 0; digitNum < coll->size(); ++digitNum) {
30  const MdtDigit* digit = coll->at(digitNum);
31 
32  Identifier Id = digit->identify();
33  const MuonGM::MdtReadoutElement* rdoEl = MuonDetMgr->getMdtReadoutElement(Id);
34  if (!rdoEl) {
35  ATH_MSG_ERROR("MDTDigitVariables::fillVariables() - Failed to retrieve MDTReadoutElement for "<<idHelperSvc()->mdtIdHelper().print_to_string(Id).c_str());
36  return false;
37  }
38 
39  const Identifier first_ml = idHelperSvc()->mdtIdHelper().channelID(
40  idHelperSvc()->stationName(Id), idHelperSvc()->stationEta(Id), idHelperSvc()->stationPhi(Id), 1, 1, 1);
41  const MuonGM::MdtReadoutElement* firstEl = MuonDetMgr->getMdtReadoutElement(first_ml);
42 
43  int NofMultilayers = idHelperSvc()->mdtIdHelper().numberOfMultilayers(Id);
44 
45  ATH_MSG_DEBUG("MDT Digit Offline id: " << idHelperSvc()->toString(Id));
46 
50 
52  const Amg::Vector3D globalpos = rdoEl->tubePos(Id);
54  const Amg::Vector3D localTubePos = firstEl->transform().inverse() * globalpos;
55 
56  m_MDT_dig_globalPos.push_back(globalpos);
57  m_MDT_dig_localTubePos.push_back(localTubePos);
59  ++n_digits;
60  }
61  }
62  m_MDT_nDigits = n_digits;
63  ATH_MSG_DEBUG(" finished fillMdtDigitVariables()");
64  return true;
65  }
67 } // namespace MuonPRDTest
MuonPRDTest::MdtDigitVariables::m_MDT_digit_id
MdtIdentifierBranch m_MDT_digit_id
Definition: MDTDigitVariables.h:25
MdtReadoutElement.h
MdtDigitCollection.h
MuonPRDTest::MdtDigitVariables::m_MDT_dig_localTubePos
ThreeVectorBranch m_MDT_dig_localTubePos
Definition: MDTDigitVariables.h:32
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
MuonVal::MdtIdentifierBranch::push_back
void push_back(const Identifier &id) override final
Definition: IdentifierBranch.cxx:24
MuonPRDTest::MdtDigitVariables::m_MDT_dig_charge
VectorBranch< float > & m_MDT_dig_charge
Definition: MDTDigitVariables.h:28
MdtIdHelper::numberOfMultilayers
int numberOfMultilayers(const Identifier &id) const
Definition: MdtIdHelper.cxx:496
MuonPRDTest::MdtDigitVariables::m_MDT_dig_globalPos
ThreeVectorBranch m_MDT_dig_globalPos
Definition: MDTDigitVariables.h:31
dumpTgcDigiDeadChambers.stationName
dictionary stationName
Definition: dumpTgcDigiDeadChambers.py:30
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
MdtDigit
Definition: MdtDigit.h:19
MuonPRDTest::MdtDigitVariables::m_MDT_dig_time
VectorBranch< float > & m_MDT_dig_time
Definition: MDTDigitVariables.h:27
tree
TChain * tree
Definition: tile_monitor.h:30
IdentifiableContainerMT::size
size_t size() const
Duplicate of fullSize for backwards compatability.
Definition: IdentifiableContainerMT.h:209
MuonPRDTest::PrdTesterModule::getDetMgr
const MuonGM::MuonDetectorManager * getDetMgr(const EventContext &ctx) const
Definition: PrdTesterModule.cxx:16
MuonPRDTest::MdtDigitVariables::m_MDT_nDigits
ScalarBranch< int > & m_MDT_nDigits
Definition: MDTDigitVariables.h:24
MuonPRDTest::MdtDigitVariables::MdtDigitVariables
MdtDigitVariables(MuonTesterTree &tree, const std::string &container_name, MSG::Level msglvl)
Definition: MDTDigitVariables.cxx:10
MdtDigit.h
MuonPRDTest::MdtDigitVariables::m_digitKey
SG::ReadHandleKey< MdtDigitContainer > m_digitKey
Definition: MDTDigitVariables.h:22
checkRpcDigits.digit
digit
Definition: checkRpcDigits.py:186
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
MDTDigitVariables.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
MdtDigitContainer::digit_size
size_type digit_size() const
Definition: MdtDigitContainer.cxx:53
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
MuonGM::MuonDetectorManager::getMdtReadoutElement
const MdtReadoutElement * getMdtReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
Definition: MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx:204
MuonVal::MuonTesterTree
Definition: MuonTesterTree.h:30
MuonPRDTest::MdtDigitVariables::declare_keys
bool declare_keys() override final
Definition: MDTDigitVariables.cxx:66
MuonGM::MdtReadoutElement
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MdtReadoutElement.h:51
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
MuonPRDTest::PrdTesterModule
Definition: PrdTesterModule.h:15
MuonPRDTest::MdtDigitVariables::m_MDT_dig_numberOfMultilayers
VectorBranch< int > & m_MDT_dig_numberOfMultilayers
Definition: MDTDigitVariables.h:29
MuonVal::VectorBranch::push_back
void push_back(const T &value)
Adds a new element at the end of the vector.
MdtDigitContainer
Use IdentifiableContainer with MdtDigitCollection.
Definition: MdtDigitContainer.h:50
MdtIdHelper::channelID
Identifier channelID(int stationName, int stationEta, int stationPhi, int multilayer, int tubeLayer, int tube) const
Definition: MdtIdHelper.cxx:659
MdtDigitCollection
Definition: MdtDigitCollection.h:18
Muon::IMuonIdHelperSvc::mdtIdHelper
virtual const MdtIdHelper & mdtIdHelper() const =0
access to MdtIdHelper
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
MuonGM::MdtReadoutElement::tubePos
Amg::Vector3D tubePos(const Identifier &id) const
Returns the global position of the given tube.
MuonGM::MuonDetectorManager
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h:50
MuonPRDTest
Definition: CSCDigitVariables.h:10
MuonPRDTest::PrdTesterModule::idHelperSvc
const Muon::IMuonIdHelperSvc * idHelperSvc() const
Definition: PrdTesterModule.cxx:15
MuonGM::MdtReadoutElement::transform
virtual const Amg::Transform3D & transform(const Identifier &id) const override final
Return local to global transform associated with this identifier.
MuonPRDTest::MdtDigitVariables::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: MDTDigitVariables.cxx:13
Identifier
Definition: IdentifierFieldParser.cxx:14