ATLAS Offline Software
Loading...
Searching...
No Matches
MdtDriftCircleVariables.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 MdtDriftCircleVariables::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 }
29 for (const xAOD::MdtDriftCircle* dc : m_dumpedPRDS){
30 dump(gctx, *dc);
31 }
33 for (const xAOD::MdtDriftCircle* dc : *inContainer) {
34 const Identifier id{dc->identify()};
35 if ((m_applyFilter && !m_filteredChamb.count(idHelperSvc()->chamberId(id))) ||
36 m_idOutIdxMap.find(id) != m_idOutIdxMap.end()){
37 ATH_MSG_VERBOSE("Skip "<<idHelperSvc()->toString(id));
38 continue;
39 }
40 dump(gctx, *dc);
41 }
42
43 m_filteredChamb.clear();
44 m_idOutIdxMap.clear();
45 m_dumpedPRDS.clear();
46 return true;
47 }
52 m_applyFilter = true;
53 m_filteredChamb.insert(idHelperSvc()->chamberId(chamberId));
54 }
56 m_applyFilter = true;
57 const Identifier id{dc.identify()};
58
59 const auto insert_itr = m_idOutIdxMap.insert(std::make_pair(id, m_idOutIdxMap.size()));
60 if (insert_itr.second) {
61 m_dumpedPRDS.push_back(&dc);
62 }
63 return insert_itr.first->second;
64 }
66 const xAOD::MdtDriftCircle& dc) {
68 const Identifier id{dc.identify()};
69
70
71 ATH_MSG_VERBOSE("Filling information for "<<idHelperSvc()->toString(id));
72
73
74 const Amg::Vector3D tubePos{re->center(gctx, dc.measurementHash())};
75 m_id.push_back(id);
76 m_globPos.push_back(tubePos);
77 m_driftRadius.push_back(dc.driftRadius());
79 m_tdcCounts.push_back(dc.tdc());
80 m_adcCounts.push_back(dc.adc());
81 }
82
83}
const boost::regex re(r_e)
#define ATH_MSG_FATAL(x)
#define ATH_MSG_VERBOSE(x)
Handle class for reading from StoreGate.
bool msgLvl(const MSG::Level lvl) const
Test the output level.
Readout element to describe the Monitored Drift Tube (Mdt) chambers Mdt chambers usually comrpise out...
ThreeVectorBranch m_globPos
Position of the Mdt drift circle in the global frame.
std::vector< const xAOD::MdtDriftCircle * > m_dumpedPRDS
Vector of PRDs parsed via the external mechanism. These measurements are parsed first.
bool m_applyFilter
Apply a filter to dump the prds.
void dump(const ActsTrk::GeometryContext &gctx, const xAOD::MdtDriftCircle &dc)
VectorBranch< float > & m_driftRadius
Dirft radius of the associated drit circle.
VectorBranch< float > & m_driftRadiusUncert
Uncertainty on the drift radius measurement.
void enableSeededDump()
Activates the seeded dump of the branch.
void dumpAllHitsInChamber(const Identifier &chamberId)
All hits from this particular chamber identifier are dumped to the output including the ones from the...
VectorBranch< uint16_t > & m_adcCounts
Adc counts of the measurement.
MdtIdentifierBranch m_id
Identifier of the Mdt.
unsigned int push_back(const xAOD::MdtDriftCircle &dc)
Push back the drift circle measurement to the output.
VectorBranch< uint16_t > & m_tdcCounts
tdc counts of the measurement
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...
std::unordered_set< Identifier > m_filteredChamb
Set of chambers to be dumped.
std::unordered_map< Identifier, unsigned int > m_idOutIdxMap
Map of Identifiers to the position index inside the vector.
SG::ReadHandleKey< xAOD::MdtDriftCircleContainer > m_key
MdtDriftCircleVariables(MuonTesterTree &tree, const std::string &inContainer, MSG::Level msgLvl=MSG::Level::INFO, const std::string &collName="MdtPrd")
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?
virtual const MuonGMR4::MdtReadoutElement * readoutElement() const override final
Retrieve the associated MdtReadoutElement.
std::int16_t tdc() const
Returns the TDC (typically range is 0 to 2500).
float driftRadiusUncert() const
Returns the uncertainty on the drift radius.
IdentifierHash measurementHash() const override final
Returns the hash of the measurement channel (tube (x) layer).
float driftRadius() const
Returns the drift radius.
std::int16_t adc() const
Returns the ADC (typically range is 0 to 250).
const Identifier & identify() const
Returns the Athena identifier of the measurement.
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
MdtDriftCircle_v1 MdtDriftCircle