ATLAS Offline Software
Loading...
Searching...
No Matches
MuonFastRecoTester.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef MUONFASTRECONSTRUCTIONTEST_MUONFASTRECOTESTER_H
6#define MUONFASTRECONSTRUCTIONTEST_MUONFASTRECOTESTER_H
7
8// Framework includes
10
11// EDM includes
13#include <xAODMuon/Muon.h>
19
20// muon includes
24
25namespace MuonValR4{
26
28 public:
30 virtual ~MuonFastRecoTester() = default;
31
32 virtual StatusCode initialize() override;
33 virtual StatusCode execute(const EventContext& ctx) override;
34 virtual StatusCode finalize() override;
35
36 using simHitSet = std::vector<const xAOD::MuonSimHit*>;
37 using TruthParticleMap = std::map<const xAOD::TruthParticle*, std::vector<simHitSet>>;
38
39 private:
41 enum class measType {Prec, NonPrec, Phi, nTypes};
47 const TrigRoiDescriptorCollection* roiCollection) const;
57 const MuonR4::GlobalPatternContainer* patternCont,
58 const TruthParticleMap& truthHits,
59 SpacePointTesterModule& spTester,
61 MuonVal::MatrixBranch<unsigned char>& spMatchedToPatternBranch,
62 MuonVal::MatrixBranch<unsigned char>& spMatchedToTruthBranch) const;
68 const TruthParticleMap& truthHits,
69 const std::vector<const MuonR4::SpacePointContainer*>& spContainers);
73 void fillFastRecoMuonInfo(const xAOD::MuonContainer* muonCont,
74 const MuonR4::GlobalPatternContainer* patternCont);
78 void fillTruthInfo(const TruthParticleMap& truthHits,
79 const std::vector<const MuonR4::SpacePointContainer*>& spContainers);
82 void fillRoIInfo(const TrigRoiDescriptorCollection* roiCollection);
83
85 enum class ePatBranchType : std::uint8_t {
86 eReco, // Counts of pattern hits
87 eTruth, // Counts of pattern hits matched to truth
88 ePileup, // Counts of pattern hits matched to pileup truth
89 eMismatched, // Counts of pattern hits matched to truth but not to the main truth particle of the pattern
90 eAll, // Counts of all hits in the buckets crossed by the pattern
91 };
92
99 const std::size_t patIdx,
101 const MuonR4::SpacePoint* sp,
102 const bool isSecondaryMatched = false);
103
104 // // output tree
105 MuonVal::MuonTesterTree m_tree{"MuonFastRecoTest","FastRecoTester"};
106
107 // Space points
108 SG::ReadHandleKey<MuonR4::SpacePointContainer> m_spKey{this, "SpacePointKey", "MuonSpacePoints"};
109 SG::ReadHandleKey<MuonR4::SpacePointContainer> m_NSWspKey{this, "NswSpacePointKey", "NswSpacePoints"};
110
111 // Global patterns
112 SG::ReadHandleKey<MuonR4::GlobalPatternContainer> m_patternKey{this, "PatternKey", "MuonR4GlobalPatterns", "global pattern container"};
113
114 // Fast reco muons
115 SG::ReadHandleKey<xAOD::MuonContainer> m_fastMuonKey{this, "FastMuonKey", "FastRecoSAMuons", "fast reco muon container"};
116
117 // Truth segments
118 SG::ReadHandleKey<xAOD::MuonSegmentContainer> m_truthSegmentKey {this, "TruthSegmentKey","MuonTruthSegments", "truth segment container"};
119
120 // HLT seeding RoIs
121 SG::ReadHandleKey<TrigRoiDescriptorCollection> m_roiCollectionKey{this, "MuRoIs", "EFMuMSReco_RoI", "Name of the input data from HLTSeeding"};
122
123 ActsTrk::GeoContextReadKey_t m_geoCtxKey{this, "AlignmentKey", "ActsAlignment", "cond handle key"};
124 ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
125
126 BooleanProperty m_isMC{this, "isMC", false, "Toggle whether the job is ran on MC or not"};
127
128 BooleanProperty m_isSeededReco{this, "isSeededReco", false, "Toggle whether the job is ran on seeded reconstruction or not"};
129
130 BooleanProperty m_writeSpacePoints{this, "writeSpacePoints", false,
131 "Toggle whether the particular space poitns shall be written"};
132
135 std::shared_ptr<SpacePointTesterModule> m_spTester{};
136 std::shared_ptr<SpacePointTesterModule> m_NSWspTester{};
138 MuonVal::VectorBranch<unsigned char>& m_spType{m_tree.newVector<unsigned char>(m_spKey.key()+"_type")};
139 MuonVal::VectorBranch<unsigned char>& m_NSWspType{m_tree.newVector<unsigned char>(m_NSWspKey.key()+"_type")};
141 MuonVal::MatrixBranch<unsigned char>& m_spMatchedToPattern{m_tree.newMatrix<unsigned char>(m_spKey.key()+"_patternMatched")};
142 MuonVal::MatrixBranch<unsigned char>& m_NSWspMatchedToPattern{m_tree.newMatrix<unsigned char>(m_NSWspKey.key()+"_patternMatched")};
144 MuonVal::MatrixBranch<unsigned char>& m_spMatchedToTruth{m_tree.newMatrix<unsigned char>(m_spKey.key()+"_truthMatched")};
145 MuonVal::MatrixBranch<unsigned char>& m_NSWspMatchedToTruth{m_tree.newMatrix<unsigned char>(m_NSWspKey.key()+"_truthMatched")};
146
149 MuonVal::VectorBranch<short>& m_gen_Q{m_tree.newVector<short>("gen_Q", 0)};
150 MuonVal::VectorBranch<float>& m_gen_Eta{m_tree.newVector<float>("gen_Eta",-10.)};
151 MuonVal::VectorBranch<float>& m_gen_Phi{m_tree.newVector<float>("gen_Phi",-10.)};
152 MuonVal::VectorBranch<float>& m_gen_Pt{m_tree.newVector<float>("gen_Pt",-10.)};
153
155 MuonVal::MatrixBranch<unsigned char>& m_gen_nNonPrecMeas{m_tree.newMatrix<unsigned char>("gen_NNonPrecMeas", 0)};
157 MuonVal::MatrixBranch<unsigned char>& m_gen_nPrecMeas{m_tree.newMatrix<unsigned char>("gen_NPrecMeas", 0)};
159 MuonVal::MatrixBranch<unsigned char>& m_gen_nPhiMeas{m_tree.newMatrix<unsigned char>("gen_NPhiMeas", 0)};
160
161
164 MuonVal::ScalarBranch<unsigned>& m_pat_n{m_tree.newScalar<unsigned>("pat_nPatterns", 0)};
166 MuonVal::VectorBranch<float>& m_pat_Eta{m_tree.newVector<float>("pat_Eta", 0.0)};
167 MuonVal::VectorBranch<float>& m_pat_phi{m_tree.newVector<float>("pat_Phi", 0.0)};
169 MuonVal::VectorBranch<uint16_t>& m_pat_sector1{m_tree.newVector<uint16_t>("pat_Sector1", 0)};
170 MuonVal::VectorBranch<uint16_t>& m_pat_sector2{m_tree.newVector<uint16_t>("pat_Sector2", 0)};
172 MuonVal::VectorBranch<float>& m_pat_meanNormResidual2{m_tree.newVector<float>("pat_meanNormResidual2", 0.0)};
174 MuonVal::VectorBranch<short>& m_pat_side{m_tree.newVector<short>("pat_Side", 0)};
176 MuonVal::VectorBranch<unsigned char>& m_pat_nStations{m_tree.newVector<unsigned char>("pat_NStations", 0)};
177
179 MuonVal::MatrixBranch<unsigned char>& m_pat_nNonPrecMeas{m_tree.newMatrix<unsigned char>("pat_NNonPrecMeas", 0)};
181 MuonVal::MatrixBranch<unsigned char>& m_pat_nPrecMeas{m_tree.newMatrix<unsigned char>("pat_NPrecMeas", 0)};
183 MuonVal::MatrixBranch<unsigned char>& m_pat_nPhiMeas{m_tree.newMatrix<unsigned char>("pat_NPhiMeas", 0)};
184
186 MuonVal::MatrixBranch<unsigned char>& m_pat_nTruthNonPrecMeas{m_tree.newMatrix<unsigned char>("pat_NTruthNonPrecMeas", 0)};
188 MuonVal::MatrixBranch<unsigned char>& m_pat_nTruthPrecMeas{m_tree.newMatrix<unsigned char>("pat_NTruthPrecMeas", 0)};
190 MuonVal::MatrixBranch<unsigned char>& m_pat_nTruthPhiMeas{m_tree.newMatrix<unsigned char>("pat_NTruthPhiMeas", 0)};
191
193 MuonVal::MatrixBranch<unsigned char>& m_pat_nMisTruthNonPrecMeas{m_tree.newMatrix<unsigned char>("pat_NMisTruthNonPrecMeas", 0)};
195 MuonVal::MatrixBranch<unsigned char>& m_pat_nMisTruthPrecMeas{m_tree.newMatrix<unsigned char>("pat_NMisTruthPrecMeas", 0)};
197 MuonVal::MatrixBranch<unsigned char>& m_pat_nMisTruthPhiMeas{m_tree.newMatrix<unsigned char>("pat_NMisTruthPhiMeas", 0)};
198
200 MuonVal::MatrixBranch<unsigned char>& m_pat_nPileupNonPrecMeas{m_tree.newMatrix<unsigned char>("pat_NPileupNonPrecMeas", 0)};
202 MuonVal::MatrixBranch<unsigned char>& m_pat_nPileupPrecMeas{m_tree.newMatrix<unsigned char>("pat_NPileupPrecMeas", 0)};
204 MuonVal::MatrixBranch<unsigned char>& m_pat_nPileupPhiMeas{m_tree.newMatrix<unsigned char>("pat_NPileupPhiMeas", 0)};
205
207 MuonVal::MatrixBranch<unsigned char>& m_pat_nAllNonPrecMeas{m_tree.newMatrix<unsigned char>("pat_NAllNonPrecMeas", 0)};
209 MuonVal::MatrixBranch<unsigned char>& m_pat_nAllPrecMeas{m_tree.newMatrix<unsigned char>("pat_NAllPrecMeas", 0)};
211 MuonVal::MatrixBranch<unsigned char>& m_pat_nAllPhiMeas{m_tree.newMatrix<unsigned char>("pat_NAllPhiMeas", 0)};
212
215 MuonVal::MatrixBranch<unsigned char>& m_pat_MatchedToTruth{m_tree.newMatrix<unsigned char>("pat_truthMatched")};
216
218 MuonVal::VectorBranch<float>& m_roi_EtaMin{m_tree.newVector<float>("roi_EtaMin",-10.)};
219 MuonVal::VectorBranch<float>& m_roi_EtaMax{m_tree.newVector<float>("roi_EtaMax",-10.)};
220 MuonVal::VectorBranch<float>& m_roi_PhiMin{m_tree.newVector<float>("roi_PhiMin",-10.)};
221 MuonVal::VectorBranch<float>& m_roi_PhiMax{m_tree.newVector<float>("roi_PhiMax",-10.)};
222 MuonVal::VectorBranch<float>& m_roi_ZMin{m_tree.newVector<float>("roi_ZMin",-10.)};
223 MuonVal::VectorBranch<float>& m_roi_ZMax{m_tree.newVector<float>("roi_ZMax",-10.)};
224
226 MuonVal::VectorBranch<float>& m_muon_Eta{m_tree.newVector<float>("muon_Eta", -10.)};
227 MuonVal::VectorBranch<float>& m_muon_Phi{m_tree.newVector<float>("muon_Phi", -10.)};
228 MuonVal::VectorBranch<float>& m_muon_Pt{m_tree.newVector<float>("muon_Pt", -10.)};
229 MuonVal::VectorBranch<short>& m_muon_Q{m_tree.newVector<short>("muon_Q", 0)};
230 MuonVal::VectorBranch<unsigned char>& m_muon_MatchedToPattern{m_tree.newVector<unsigned char>("muon_patMatched")};
231
233
234 };
235}
236
237#endif
static Double_t sp
AthHistogramAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
The SpacePointPerLayerSorter sort two given space points by their layer Identifier.
The muon space point is the combination of two uncalibrated measurements one of them measures the eta...
void fillTruthInfo(const TruthParticleMap &truthHits, const std::vector< const MuonR4::SpacePointContainer * > &spContainers)
Fill the truth particle information into the tree.
MuonVal::VectorBranch< float > & m_gen_Phi
MuonVal::MatrixBranch< unsigned char > & m_pat_nAllNonPrecMeas
Number of trigger eta measurements in the buckets crossed by the pattern, grouped by station.
MuonVal::VectorBranch< unsigned char > & m_spType
Type of spacepoints: 1 for trigger eta, 2 for precision, 3 for only-phi.
MuonVal::VectorBranch< float > & m_roi_ZMax
SG::ReadHandleKey< MuonR4::SpacePointContainer > m_NSWspKey
ActsTrk::GeoContextReadKey_t m_geoCtxKey
MuonVal::MatrixBranch< unsigned char > & m_pat_nNonPrecMeas
Number of trigger eta measurements per station.
measType
Enum for measurement types.
SG::ReadHandleKey< xAOD::MuonContainer > m_fastMuonKey
MuonVal::MatrixBranch< unsigned char > & m_pat_nAllPhiMeas
Number of phi measurements in the buckets crossed by the pattern, grouped by station.
MuonVal::MatrixBranch< unsigned char > & m_pat_nTruthPrecMeas
Number of truth precision measurements per station.
SG::ReadHandleKey< MuonR4::GlobalPatternContainer > m_patternKey
MuonVal::ScalarBranch< unsigned > & m_pat_n
====== Global Pattern block ===========
MuonVal::MatrixBranch< unsigned char > & m_spMatchedToPattern
Branch indicating which space points in the tree are associated to the i-th pattern.
std::vector< const xAOD::MuonSimHit * > simHitSet
MuonVal::VectorBranch< unsigned char > & m_muon_MatchedToPattern
MuonVal::MatrixBranch< unsigned char > & m_pat_nMisTruthPhiMeas
Number of mismatched truth phi measurements per station.
MuonVal::VectorBranch< unsigned char > & m_pat_nStations
Number of stations.
MuonVal::MatrixBranch< unsigned char > & m_NSWspMatchedToTruth
MuonVal::MatrixBranch< unsigned char > & m_pat_nPileupPhiMeas
Number of pileup phi measurements per station.
void fillRoIInfo(const TrigRoiDescriptorCollection *roiCollection)
Fill the RoI information into the tree.
MuonVal::VectorBranch< uint16_t > & m_pat_sector2
MuonVal::VectorBranch< float > & m_gen_Eta
MuonVal::MatrixBranch< unsigned char > & m_pat_nAllPrecMeas
Number of precision measurements in the buckets crossed by the pattern, grouped by station.
MuonVal::MatrixBranch< unsigned char > & m_pat_nPileupPrecMeas
Number of pileup precision measurements per station.
MuonVal::VectorBranch< float > & m_muon_Pt
MuonVal::VectorBranch< float > & m_pat_phi
MuonVal::VectorBranch< short > & m_muon_Q
virtual ~MuonFastRecoTester()=default
SG::ReadHandleKey< TrigRoiDescriptorCollection > m_roiCollectionKey
std::map< const xAOD::TruthParticle *, std::vector< simHitSet > > TruthParticleMap
MuonVal::VectorBranch< short > & m_gen_Q
====== Truth particle block ===========
virtual StatusCode finalize() override
MuonVal::MatrixBranch< unsigned char > & m_gen_nPrecMeas
Number of precision measurements per station.
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
void updatePatHitInfo(const ePatBranchType type, const std::size_t patIdx, const Muon::MuonStationIndex::StIndex hitSt, const MuonR4::SpacePoint *sp, const bool isSecondaryMatched=false)
Update the hit counts for a given pattern branch type.
ePatBranchType
Enum for different types of pattern hit content branches.
SG::ReadHandleKey< xAOD::MuonSegmentContainer > m_truthSegmentKey
MuonVal::VectorBranch< float > & m_roi_EtaMin
====== RoI info ===========
MuonVal::MatrixBranch< unsigned char > & m_pat_nTruthPhiMeas
Number of truth phi measurements per station.
void fillFastRecoMuonInfo(const xAOD::MuonContainer *muonCont, const MuonR4::GlobalPatternContainer *patternCont)
Fill the info associated to fast reco muons.
std::shared_ptr< SpacePointTesterModule > m_NSWspTester
MuonVal::VectorBranch< float > & m_roi_PhiMin
MuonVal::VectorBranch< float > & m_roi_PhiMax
std::shared_ptr< SpacePointTesterModule > m_spTester
====== Spacepoint block ===========
MuonVal::MatrixBranch< unsigned char > & m_pat_nTruthNonPrecMeas
Number of truth trigger eta measurements per station.
virtual StatusCode initialize() override
MuonVal::MatrixBranch< unsigned char > & m_pat_nPhiMeas
Number of phi measurements per station.
MuonVal::MatrixBranch< unsigned char > & m_pat_nPrecMeas
Number of precision measurements per station.
MuonVal::VectorBranch< float > & m_muon_Phi
MuonVal::VectorBranch< float > & m_roi_EtaMax
MuonVal::VectorBranch< float > & m_pat_meanNormResidual2
mean square normalized pattern residual
virtual StatusCode execute(const EventContext &ctx) override
Execute method.
MuonVal::VectorBranch< float > & m_gen_Pt
void fillSpacePointInfo(const MuonR4::SpacePointContainer *spc, const MuonR4::GlobalPatternContainer *patternCont, const TruthParticleMap &truthHits, SpacePointTesterModule &spTester, MuonVal::VectorBranch< unsigned char > &spTypeBranch, MuonVal::MatrixBranch< unsigned char > &spMatchedToPatternBranch, MuonVal::MatrixBranch< unsigned char > &spMatchedToTruthBranch) const
Fill the space point information into the tree.
MuonVal::MatrixBranch< unsigned char > & m_pat_nMisTruthNonPrecMeas
Number of mismatched truth trigger eta measurements per station.
MuonVal::VectorBranch< unsigned char > & m_NSWspType
void fillGlobPatternInfo(const MuonR4::GlobalPatternContainer *patternCont, const TruthParticleMap &truthHits, const std::vector< const MuonR4::SpacePointContainer * > &spContainers)
Fill the info associated to the global patterns into the tree.
MuonVal::VectorBranch< uint16_t > & m_pat_sector1
pattern primary & secondary sectors (different if the pattern is in the sector overlap)
AthHistogramAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
MuonVal::MatrixBranch< unsigned char > & m_NSWspMatchedToPattern
MuonVal::MatrixBranch< unsigned char > & m_pat_nMisTruthPrecMeas
Number of mismatched truth precision measurements per station.
MuonVal::MuonTesterTree m_tree
MuonVal::VectorBranch< float > & m_muon_Eta
====== Fast Reco Muon info ===========
MuonVal::VectorBranch< short > & m_pat_side
+1 for A-, -1 of C-side
MuonVal::MatrixBranch< unsigned char > & m_pat_MatchedToTruth
Branch indicating which truth particles in the tree are associated to the i-th pattern.
MuonR4::SpacePointPerLayerSorter m_spSorter
MuonVal::MatrixBranch< unsigned char > & m_spMatchedToTruth
Branch indicating which space points in the tree are associated to the i-th truth particle.
MuonVal::MatrixBranch< unsigned char > & m_gen_nPhiMeas
Number of phi measurements per station.
MuonVal::MatrixBranch< unsigned char > & m_pat_nPileupNonPrecMeas
Number of pileup trigger eta measurements per station.
MuonVal::VectorBranch< float > & m_pat_Eta
pattern average theta & phi
MuonVal::MatrixBranch< unsigned char > & m_gen_nNonPrecMeas
Number of trigger eta measurements per station.
SG::ReadHandleKey< MuonR4::SpacePointContainer > m_spKey
TruthParticleMap fillTruthMap(const xAOD::MuonSegmentContainer *truthSegments, const TrigRoiDescriptorCollection *roiCollection) const
Fill the truth particle map.
MuonVal::VectorBranch< float > & m_roi_ZMin
Property holding a SG store/key/clid from which a ReadHandle is made.
SG::ReadHandleKey< GeometryContext > GeoContextReadKey_t
Abrivate the ReadHandleKey to declare the data dependency on the Geometry context.
DataVector< GlobalPattern > GlobalPatternContainer
Abrivation of the GlobalPattern container type.
DataVector< SpacePointBucket > SpacePointContainer
Abrivation of the space point container type.
Lightweight algorithm to read xAOD MDT sim hits and (fast-digitised) drift circles from SG and fill a...
MuonFastRecoTester::TruthParticleMap TruthParticleMap
StIndex
enum to classify the different station layers in the muon spectrometer
MuonSegmentContainer_v1 MuonSegmentContainer
Definition of the current "MuonSegment container version".
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".