ATLAS Offline Software
MdtTwinDriftCircleVariables.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include "StoreGate/ReadHandle.h"
7 namespace 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  }
18  return declare_dependency(m_key);
19  }
20  bool MdtTwinDriftCircleVariables::fill(const EventContext& ctx){
21  const ActsGeometryContext& 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::MdtTwinDriftCircle* dc : m_dumpedPRDS){
30  dump(gctx, *dc);
31  }
33  for (const xAOD::MdtTwinDriftCircle* dc : *inContainer) {
34  const MuonGMR4::MdtReadoutElement* re = dc->readoutElement();
35  const Identifier id{re->measurementId(dc->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, *dc);
42  }
43 
44  m_filteredChamb.clear();
45  m_idOutIdxMap.clear();
46  m_dumpedPRDS.clear();
47  return true;
48  }
50  m_applyFilter = true;
51  }
53  m_applyFilter = true;
54  m_filteredChamb.insert(idHelperSvc()->chamberId(chamberId));
55  }
57  m_applyFilter = true;
59  const Identifier id{re->measurementId(dc.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(&dc);
64  }
65  return insert_itr.first->second;
66  }
68  const xAOD::MdtTwinDriftCircle& dc) {
70  const Identifier id{re->measurementId(dc.measurementHash())};
71 
72 
73  ATH_MSG_VERBOSE("Filling information for "<<idHelperSvc()->toString(id));
74 
75 
76  const Amg::Vector3D tubePos{re->center(gctx, dc.measurementHash())};
77  m_id.push_back(id);
78  m_globPos.push_back(tubePos);
85 
90  }
91 }
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
xAOD::MdtDriftCircle_v1::tdc
int16_t tdc() const
Returns the TDC (typically range is 0 to 2500)
MuonValR4::MdtTwinDriftCircleVariables::push_back
unsigned int push_back(const xAOD::MdtTwinDriftCircle &dc)
Push back the drift circle measurement to the output.
Definition: MdtTwinDriftCircleVariables.cxx:56
xAOD::MdtTwinDriftCircle_v1::posAlongWire
float posAlongWire() const
Returns the coordinate along the wire.
Definition: MdtTwinDriftCircle_v1.cxx:26
MuonValR4::MdtTwinDriftCircleVariables::m_filteredChamb
std::unordered_set< Identifier > m_filteredChamb
Set of chambers to be dumped.
Definition: MdtTwinDriftCircleVariables.h:77
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
MuonValR4::MdtTwinDriftCircleVariables::m_tdcCounts
VectorBranch< uint16_t > & m_tdcCounts
tdc counts of the measurement
Definition: MdtTwinDriftCircleVariables.h:64
MuonValR4::MdtTwinDriftCircleVariables::m_id
MdtIdentifierBranch m_id
Identifier of the Mdt.
Definition: MdtTwinDriftCircleVariables.h:52
xAOD::MdtDriftCircle_v1::measurementHash
IdentifierHash measurementHash() const
Returns the hash of the measurement channel (tube (x) layer)
Definition: MdtDriftCircle_v1.cxx:29
tree
TChain * tree
Definition: tile_monitor.h:30
MuonValR4::MdtTwinDriftCircleVariables::m_twinTdcCounts
VectorBranch< uint16_t > & m_twinTdcCounts
Tdc counts of the twin measurement.
Definition: MdtTwinDriftCircleVariables.h:68
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
MuonValR4::MdtTwinDriftCircleVariables::enableSeededDump
void enableSeededDump()
Activates the seeded dump of the branch.
Definition: MdtTwinDriftCircleVariables.cxx:49
MuonValR4::MdtTwinDriftCircleVariables::m_key
SG::ReadHandleKey< xAOD::MdtTwinDriftCircleContainer > m_key
Definition: MdtTwinDriftCircleVariables.h:48
MuonVal::MuonTesterBranch::tree
TTree * tree() override final
Returns the underlying TTree object.
Definition: MuonTesterBranch.cxx:53
MuonValR4::MdtTwinDriftCircleVariables::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: MdtTwinDriftCircleVariables.cxx:20
xAOD::MdtDriftCircle_v1::readoutElement
const MuonGMR4::MdtReadoutElement * readoutElement() const
Retrieve the associated MdtReadoutElement.
MuonVal::MuonTesterBranch::declare_dependency
bool declare_dependency(Key &key)
Declares the ReadHandle/ ReadCondHandleKey as data dependency of the algorithm.
MuonValR4::MdtTwinDriftCircleVariables::m_adcCounts
VectorBranch< uint16_t > & m_adcCounts
Adc counts of the measurement.
Definition: MdtTwinDriftCircleVariables.h:66
xAOD::MdtTwinDriftCircle_v1::twinLayer
uint8_t twinLayer() const
Returns the layer number of the associated twin channel (1-4)
MuonValR4::MdtTwinDriftCircleVariables::MdtTwinDriftCircleVariables
MdtTwinDriftCircleVariables(MuonTesterTree &tree, const std::string &inContainer, MSG::Level msgLvl=MSG::Level::INFO, const std::string &collName="MdtTwinPrd")
Definition: MdtTwinDriftCircleVariables.cxx:9
MuonValR4::TesterModuleBase::getGeoCtx
const ActsGeometryContext & getGeoCtx(const EventContext &ctx) const
Definition: TesterModuleBase.cxx:22
MuonVal::ThreeVectorBranch::push_back
void push_back(const Amg::Vector3D &vec)
interface using the Amg::Vector3D
Definition: ThreeVectorBranch.cxx:23
xAOD::MdtDriftCircle_v1::driftRadius
float driftRadius() const
Returns the drift radius.
Definition: MdtDriftCircle_v1.cxx:42
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
AthMessaging::msgLvl
bool msgLvl(const MSG::Level lvl) const
Test the output level.
Definition: AthMessaging.h:151
MuonValR4::MdtTwinDriftCircleVariables::m_driftRadiusUncert
VectorBranch< float > & m_driftRadiusUncert
Uncertainty on the drift radius measurement.
Definition: MdtTwinDriftCircleVariables.h:58
MuonVal::MuonTesterTree
Definition: MuonTesterTree.h:30
MuonValR4::MdtTwinDriftCircleVariables::m_twinUncertLocZ
VectorBranch< float > & m_twinUncertLocZ
Uncertainty on the local z measurement along the wire.
Definition: MdtTwinDriftCircleVariables.h:62
MuonValR4::MdtTwinDriftCircleVariables::m_dumpedPRDS
std::vector< const xAOD::MdtTwinDriftCircle * > m_dumpedPRDS
Vector of PRDs parsed via the external mechanism. These measurements are parsed first.
Definition: MdtTwinDriftCircleVariables.h:81
xAOD::MdtTwinDriftCircle_v1::twinTdc
int16_t twinTdc() const
Returns the TDC (typically range is 0 to 2500)
MuonValR4::MdtTwinDriftCircleVariables::m_twinAdcCounts
VectorBranch< uint16_t > & m_twinAdcCounts
Adc counts of the twin measurement.
Definition: MdtTwinDriftCircleVariables.h:70
xAOD::MdtTwinDriftCircle_v1
Definition: MdtTwinDriftCircle_v1.h:12
MuonValR4::TesterModuleBase::idHelperSvc
const Muon::IMuonIdHelperSvc * idHelperSvc() const
Definition: TesterModuleBase.cxx:18
MuonValR4::MdtTwinDriftCircleVariables::m_globPos
ThreeVectorBranch m_globPos
Position of the Mdt drift circle in the global frame.
Definition: MdtTwinDriftCircleVariables.h:54
ActsGeometryContext
Include the GeoPrimitives which need to be put first.
Definition: ActsGeometryContext.h:27
MuonValR4::TesterModuleBase
Definition: TesterModuleBase.h:15
MuonVal::VectorBranch::push_back
void push_back(const T &value)
Adds a new element at the end of the vector.
xAOD::MdtTwinDriftCircle_v1::twinTube
uint16_t twinTube() const
Returns the tube number of the associated twin channel (1-120)
MuonValR4
Lightweight algorithm to read xAOD MDT sim hits and (fast-digitised) drift circles from SG and fill a...
Definition: IPatternVisualizationTool.h:23
xAOD::MdtDriftCircle_v1::adc
int16_t adc() const
Returns the ADC (typically range is 0 to 250)
MuonGMR4::MdtReadoutElement
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MdtReadoutElement.h:22
xAOD::MdtTwinDriftCircle_v1::twinAdc
int16_t twinAdc() const
Returns the ADC (typically range is 0 to 250)
MuonValR4::MdtTwinDriftCircleVariables::m_driftRadius
VectorBranch< float > & m_driftRadius
Dirft radius of the associated drit circle.
Definition: MdtTwinDriftCircleVariables.h:56
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
MuonValR4::MdtTwinDriftCircleVariables::dump
void dump(const ActsGeometryContext &gctx, const xAOD::MdtTwinDriftCircle &dc)
Definition: MdtTwinDriftCircleVariables.cxx:67
xAOD::MdtTwinDriftCircle_v1::posAlongWireUncert
float posAlongWireUncert() const
Returns the uncertainty on the coordinate along the wire.
Definition: MdtTwinDriftCircle_v1.cxx:32
re
const boost::regex re(r_e)
MuonValR4::MdtTwinDriftCircleVariables::m_twinLayer
VectorBranch< uint8_t > & m_twinLayer
Tube layer of the twin.
Definition: MdtTwinDriftCircleVariables.h:74
MuonValR4::MdtTwinDriftCircleVariables::declare_keys
bool declare_keys() override final
Definition: MdtTwinDriftCircleVariables.cxx:17
MuonValR4::MdtTwinDriftCircleVariables::m_twinTube
VectorBranch< uint16_t > & m_twinTube
Tube number of the twin.
Definition: MdtTwinDriftCircleVariables.h:72
ReadHandle.h
Handle class for reading from StoreGate.
MuonValR4::MdtTwinDriftCircleVariables::m_idOutIdxMap
std::unordered_map< Identifier, unsigned int > m_idOutIdxMap
Map of Identifiers to the position index inside the vector.
Definition: MdtTwinDriftCircleVariables.h:79
MuonValR4::MdtTwinDriftCircleVariables::m_twinLocZ
VectorBranch< float > & m_twinLocZ
Local z coordinate along the drift tube.
Definition: MdtTwinDriftCircleVariables.h:60
MuonValR4::MdtTwinDriftCircleVariables::dumpAllHitsInChamber
void dumpAllHitsInChamber(const Identifier &chamberId)
All hits from this particular chamber identifier are dumped to the output including the ones from the...
Definition: MdtTwinDriftCircleVariables.cxx:52
MuonValR4::MdtTwinDriftCircleVariables::m_applyFilter
bool m_applyFilter
Apply a filter to dump the prds.
Definition: MdtTwinDriftCircleVariables.h:83
MdtTwinDriftCircleVariables.h
xAOD::MdtDriftCircle_v1::driftRadiusUncert
float driftRadiusUncert() const
Returns the uncertainty on the drift radius.
Definition: MdtDriftCircle_v1.cxx:52
Identifier
Definition: IdentifierFieldParser.cxx:14