ATLAS Offline Software
MMPRDVariables.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 
9 
10 namespace MuonPRDTest {
11  MMPRDVariables::MMPRDVariables(MuonTesterTree& tree, const std::string& prd_container_name, MSG::Level msglvl) :
12  PrdTesterModule(tree, "PRD_MM", msglvl), m_key{prd_container_name} {}
13 
15 
16  bool MMPRDVariables::fill(const EventContext& ctx) {
17  m_externalPush = false;
18  ATH_MSG_DEBUG("do fillMMPRDVariables()");
20  if (!mmprdContainer.isValid()) {
21  ATH_MSG_FATAL("Failed to retrieve prd container " << m_key.fullKey());
22  return false;
23  }
24  ATH_MSG_DEBUG("retrieved MM PRD Container with size " << mmprdContainer->size());
25 
26 
27  unsigned int n_PRD{0};
28  for(const Muon::MMPrepDataCollection* coll : *mmprdContainer) {
29  if (m_applyFilter && !m_filteredChamb.count(coll->identify())) {
30  ATH_MSG_VERBOSE("Do not dump measurements from "<<idHelperSvc()->toStringChamber(coll->identify()));
31  continue;
32  }
33  for (const Muon::MMPrepData* prd : *coll) {
34  dump(*prd);
35  ++n_PRD;
36  }
37  }
38  m_NSWMM_nPRD = n_PRD;
39  ATH_MSG_DEBUG(" finished fillMMPRDVariables()");
40  m_filteredPRDs.clear();
41  m_filteredChamb.clear();
42  return true;
43  }
44  unsigned int MMPRDVariables::push_back(const Muon::MMPrepData& prd){
45  m_externalPush = true;
46  return dump(prd);
47  }
49  m_applyFilter = true;
50  }
52  m_applyFilter = true;
53  m_filteredChamb.insert(idHelperSvc()->chamberId(detEle.identify()));
54  }
55 
56  unsigned int MMPRDVariables::dump(const Muon::MMPrepData& prd) {
57  const Identifier Id = prd.identify();
58 
59  if (m_filteredPRDs.count(Id)) {
60  ATH_MSG_VERBOSE("The hit has already been added "<<idHelperSvc()->toString(Id));
61  return m_filteredPRDs.at(Id);
62  }
64 
66 
69  const Amg::MatrixX & cov = prd.localCovariance();
71  det->surface(Id).globalToLocal(pos, Amg::Vector3D::Zero(), loc_pos);
72 
73  ATH_MSG_DEBUG("MicroMegas PRD local pos.: "<<Amg::toString(loc_pos)
74  << ", ex=" << std::setw(6) << std::setprecision(2) << cov(0,0));
75 
79  m_NSWMM_PRD_nStrips.push_back((prd.rdoList()).size());
80 
84 
85  m_NSWMM_PRD_author.push_back(static_cast<short>(prd.author()));
86  m_NSWMM_PRD_quality.push_back(static_cast<int8_t>(prd.quality()));
87 
88  unsigned idx = m_filteredPRDs.size();
89  if (m_externalPush) {
90  m_filteredPRDs.insert(std::make_pair(Id, idx));
91  }
92  return idx;
93  }
94 }
MuonPRDTest::MMPRDVariables::dumpAllHitsInChamber
void dumpAllHitsInChamber(const MuonGM::MMReadoutElement &detEle)
Adds all hits in this particular chamber to the output n-tuple.
Definition: MMPRDVariables.cxx:51
MMPRDVariables.h
MuonPRDTest::MMPRDVariables::MMPRDVariables
MMPRDVariables(MuonTesterTree &tree, const std::string &prd_container_name, MSG::Level msglvl)
Standard constructor taking the MuonTesterTree as parent The container name under which the MicroMega...
Definition: MMPRDVariables.cxx:11
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
MuonPRDTest::MMPRDVariables::m_NSWMM_PRD_stripNumbers
MatrixBranch< short unsigned > & m_NSWMM_PRD_stripNumbers
Definition: MMPRDVariables.h:50
Muon::MMPrepData
Class to represent MM measurements.
Definition: MMPrepData.h:22
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition: EventPrimitives.h:27
Muon::MMPrepData::globalPosition
virtual const Amg::Vector3D & globalPosition() const override final
Returns the global position.
Definition: MMPrepData.h:211
MuonPRDTest::MMPRDVariables::m_NSWMM_PRD_author
VectorBranch< short > & m_NSWMM_PRD_author
Definition: MMPRDVariables.h:54
TRTCalib_Extractor.det
det
Definition: TRTCalib_Extractor.py:36
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
Trk::PrepRawData::localCovariance
const Amg::MatrixX & localCovariance() const
return const ref to the error matrix
plotBeamSpotVxVal.cov
cov
Definition: plotBeamSpotVxVal.py:201
Trk::PrepRawData::rdoList
const std::vector< Identifier > & rdoList() const
return the List of rdo identifiers (pointers)
MuonPRDTest::MMPRDVariables::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: MMPRDVariables.cxx:16
MuonVal::MmIdentifierBranch::push_back
void push_back(const Identifier &id) override final
Definition: IdentifierBranch.cxx:93
MuonPRDTest::MMPRDVariables::dump
unsigned int dump(const Muon::MMPrepData &prd)
Definition: MMPRDVariables.cxx:56
MuonPRDTest::MMPRDVariables::m_filteredChamb
std::unordered_set< Identifier > m_filteredChamb
Set of chambers to be dumped.
Definition: MMPRDVariables.h:58
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
Muon::MMPrepData::quality
Quality quality() const
Definition: MMPrepData.h:168
MuonVal::MuonTesterBranch::declare_dependency
bool declare_dependency(Key &key)
Declares the ReadHandle/ ReadCondHandleKey as data dependency of the algorithm.
MuonPRDTest::MMPRDVariables::m_filteredPRDs
std::unordered_map< Identifier, unsigned int > m_filteredPRDs
Set of particular chambers to be dumped.
Definition: MMPRDVariables.h:60
MuonVal::ThreeVectorBranch::push_back
void push_back(const Amg::Vector3D &vec)
interface using the Amg::Vector3D
Definition: ThreeVectorBranch.cxx:23
MuonVal::MatrixBranch::push_back
void push_back(size_t i, const T &value)
MMReadoutElement.h
Muon::MMPrepData::stripCharges
const std::vector< int > & stripCharges() const
returns the list of charges
Definition: MMPrepData.h:257
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
Muon::MMPrepData::detectorElement
virtual const MuonGM::MMReadoutElement * detectorElement() const override final
Returns the detector element corresponding to this PRD.
Definition: MMPrepData.h:206
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
MuonPRDTest::MMPRDVariables::m_NSWMM_PRD_globalPos
ThreeVectorBranch m_NSWMM_PRD_globalPos
Definition: MMPRDVariables.h:49
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
MuonPRDTest::MMPRDVariables::m_key
SG::ReadHandleKey< Muon::MMPrepDataContainer > m_key
Definition: MMPRDVariables.h:43
MuonPRDTest::PrdTesterModule
Definition: PrdTesterModule.h:15
MuonPRDTest::MMPRDVariables::m_NSWMM_PRD_stripCharges
MatrixBranch< int > & m_NSWMM_PRD_stripCharges
Definition: MMPRDVariables.h:52
MuonPRDTest::MMPRDVariables::m_applyFilter
bool m_applyFilter
Apply a filter to dump the prds.
Definition: MMPRDVariables.h:62
Muon::MMPrepData::stripNumbers
const std::vector< uint16_t > & stripNumbers() const
returns the list of strip numbers
Definition: MMPrepData.h:247
MMRDOVariables.h
Muon::MuonPrepDataCollection
Template to hold collections of MuonPrepRawData objects.
Definition: MuonPrepDataCollection.h:46
Muon::MMPrepData::stripTimes
const std::vector< short int > & stripTimes() const
returns the list of times
Definition: MMPrepData.h:252
MuonVal::VectorBranch::push_back
void push_back(const T &value)
Adds a new element at the end of the vector.
MuonPRDTest::MMPRDVariables::m_NSWMM_PRD_quality
VectorBranch< uint8_t > & m_NSWMM_PRD_quality
Definition: MMPRDVariables.h:55
Trk::PrepRawData::identify
Identifier identify() const
return the identifier
MuonPRDTest::MMPRDVariables::push_back
unsigned int push_back(const Muon::MMPrepData &prd)
Adds a prd to the output tree.
Definition: MMPRDVariables.cxx:44
MuonPRDTest::MMPRDVariables::m_NSWMM_nPRD
ScalarBranch< unsigned int > & m_NSWMM_nPRD
Definition: MMPRDVariables.h:44
MuonPRDTest::MMPRDVariables::m_NSWMM_PRD_stripTimes
MatrixBranch< short int > & m_NSWMM_PRD_stripTimes
Definition: MMPRDVariables.h:51
Muon::MMPrepData::time
short int time() const
Returns the time (in ns)
Definition: MMPrepData.h:222
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
MuonPRDTest::MMPRDVariables::m_NSWMM_PRD_id
MmIdentifierBranch m_NSWMM_PRD_id
Definition: MMPRDVariables.h:53
MuonPRDTest::MMPRDVariables::m_NSWMM_PRD_nStrips
VectorBranch< int > & m_NSWMM_PRD_nStrips
Definition: MMPRDVariables.h:47
MuonPRDTest::MMPRDVariables::declare_keys
bool declare_keys() override final
Definition: MMPRDVariables.cxx:14
MuonPRDTest::MMPRDVariables::m_NSWMM_PRD_localPos
TwoVectorBranch m_NSWMM_PRD_localPos
Definition: MMPRDVariables.h:48
MuonPRDTest::MMPRDVariables::m_NSWMM_PRD_covMatrix_1_1
VectorBranch< float > & m_NSWMM_PRD_covMatrix_1_1
Definition: MMPRDVariables.h:46
MuonPRDTest::MMPRDVariables::m_externalPush
bool m_externalPush
Flag telling whether an external prd has been pushed.
Definition: MMPRDVariables.h:64
MuonPRDTest::MMPRDVariables::enableSeededDump
void enableSeededDump()
Dumps only hits which are marked by the dumpAllHitsInChamber method.
Definition: MMPRDVariables.cxx:48
MuonGM::MuonReadoutElement::identify
Identifier identify() const override final
Returns the ATLAS Identifier of the MuonReadOutElement.
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonReadoutElement.h:184
MuonPRDTest
Definition: CSCDigitVariables.h:10
MuonPRDTest::PrdTesterModule::idHelperSvc
const Muon::IMuonIdHelperSvc * idHelperSvc() const
Definition: PrdTesterModule.cxx:15
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
MuonGM::MMReadoutElement
An MMReadoutElement corresponds to a single STGC module; therefore typicaly a barrel muon station con...
Definition: MMReadoutElement.h:25
Muon::MMPrepData::author
Author author() const
Definition: MMPrepData.h:272
MuonPRDTest::MMPRDVariables::m_NSWMM_PRD_time
VectorBranch< int > & m_NSWMM_PRD_time
Definition: MMPRDVariables.h:45
generate::Zero
void Zero(TH1D *hin)
Definition: generate.cxx:32
Identifier
Definition: IdentifierFieldParser.cxx:14