ATLAS Offline Software
Loading...
Searching...
No Matches
RpcMeasurementVariables.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
7namespace MuonValR4{
8
10 const std::string& inContainer,
11 MSG::Level msgLvl,
12 const std::string& collName):
13 TesterModuleBase{tree, inContainer + collName, msgLvl},
14 m_key{inContainer},
15 m_collName{collName}{
16 }
20 bool RpcMeasurementVariables::fill(const EventContext& ctx){
21 const ActsTrk::GeometryContext& gctx{getGeoCtx(ctx)};
22
23 SG::ReadHandle inContainer{m_key, ctx};
24 if (!inContainer.isPresent()) {
25 ATH_MSG_FATAL("Failed to retrieve "<<m_key.fullKey());
26 return false;
27 }
30 dump(gctx, *strip);
31 }
33 for (const xAOD::RpcMeasurement* strip : *inContainer) {
34 const MuonGMR4::RpcReadoutElement* re = strip->readoutElement();
35 const Identifier id{re->measurementId(strip->measurementHash())};
36 if ((m_applyFilter && !m_filteredChamb.count(idHelperSvc()->chamberId(id))) ||
37 m_idOutIdxMap.find(id) != m_idOutIdxMap.end()){
38 ATH_MSG_VERBOSE("Skip "<<idHelperSvc()->toString(id));
39 continue;
40 }
41 dump(gctx, *strip);
42 }
43
44 m_filteredChamb.clear();
45 m_idOutIdxMap.clear();
46 m_dumpedPRDS.clear();
47 return true;
48 }
53 m_applyFilter = true;
54 m_filteredChamb.insert(idHelperSvc()->chamberId(chamberId));
55 }
57 m_applyFilter = true;
58 const MuonGMR4::RpcReadoutElement* re = strip.readoutElement();
59 const Identifier id{re->measurementId(strip.measurementHash())};
60
61 const auto insert_itr = m_idOutIdxMap.insert(std::make_pair(id, m_idOutIdxMap.size()));
62 if (insert_itr.second) {
63 m_dumpedPRDS.push_back(&strip);
64 }
65 return insert_itr.first->second;
66 }
69 const MuonGMR4::RpcReadoutElement* re = strip.readoutElement();
70 const Identifier id{re->measurementId(strip.measurementHash())};
71
72
73 ATH_MSG_VERBOSE("Filling information for "<<idHelperSvc()->toString(id));
74
75
76 m_id.push_back(id);
77 Amg::Vector3D locPos{strip.localMeasurementPos()};
78 AmgSymMatrix(2) locCov{AmgSymMatrix(2)::Identity()};
79 if (strip.numDimensions() == 1) {
80 locCov(0,0) = strip.localCovariance<1>()(0,0);
81 } else {
82 locCov = xAOD::toEigen(strip.localCovariance<2>());
83 }
84 const Amg::Vector3D globPos{re->localToGlobalTrans(gctx, strip.layerHash()) *locPos};
85 m_globPos.push_back(globPos);
86 m_locPos.push_back(locPos.block<2,1>(0,0));
87 m_locCov.push_back(locCov(0,0), locCov(1,1));
88 m_time.push_back(strip.time());
89 m_toT.push_back(strip.timeOverThreshold());
90
91 }
92
93}
const boost::regex re(r_e)
#define ATH_MSG_FATAL(x)
#define ATH_MSG_VERBOSE(x)
#define AmgSymMatrix(dim)
Handle class for reading from StoreGate.
bool msgLvl(const MSG::Level lvl) const
Test the output level.
std::unordered_map< Identifier, unsigned int > m_idOutIdxMap
Map of Identifiers to the position index inside the vector.
TwoVectorBranch m_locCov
local covariance of the measurement
SG::ReadHandleKey< xAOD::RpcMeasurementContainer > m_key
VectorBranch< float > & m_time
Time of the measurement.
std::vector< const xAOD::RpcMeasurement * > m_dumpedPRDS
Vector of PRDs parsed via the external mechanism. These measurements are parsed first.
void dumpAllHitsInChamber(const Identifier &chamberId)
All hits from this particular chamber identifier are dumped to the output including the ones from the...
bool m_applyFilter
Apply a filter to dump the prds.
std::unordered_set< Identifier > m_filteredChamb
Set of chambers to be dumped.
TwoVectorBranch m_locPos
Local strip position of the measurement.
RpcIdentifierBranch m_id
Identifier of the Mdt.
VectorBranch< float > & m_toT
Time over threshold.
RpcMeasurementVariables(MuonTesterTree &tree, const std::string &inContainer, MSG::Level msgLvl=MSG::Level::INFO, const std::string &collName="RpcPrd")
void dump(const ActsTrk::GeometryContext &gctx, const xAOD::RpcMeasurement &dc)
ThreeVectorBranch m_globPos
Position of the Mdt drift circle in the global frame.
void enableSeededDump()
Activates the seeded dump of the branch.
unsigned int push_back(const xAOD::RpcMeasurement &measurement)
Push back the drift circle measurement to the output.
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...
const Muon::IMuonIdHelperSvc * idHelperSvc() const
TesterModuleBase(MuonTesterTree &tree, const std::string &grp_name, MSG::Level msglvl=MSG::Level::INFO)
const ActsTrk::GeometryContext & getGeoCtx(const EventContext &ctx) const
bool declare_dependency(Key &key)
Declares the ReadHandle/ ReadCondHandleKey as data dependency of the algorithm.
TTree * tree() override final
Returns the underlying TTree object.
bool isPresent() const
Is the referenced object present in SG?
Eigen::Matrix< double, 3, 1 > Vector3D
std::string toString(const Parameters &pars)
Dumps the parameters into a string with labels in front of each number.
Lightweight algorithm to read xAOD MDT sim hits and (fast-digitised) drift circles from SG and fill a...
-event-from-file
RpcMeasurement_v1 RpcMeasurement