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 private:
38 enum class measType {Prec, NonPrec, Phi, nTypes};
39 using simHitSet = std::unordered_set<const xAOD::MuonSimHit*>;
40 using TruthParticleMap = std::map<const xAOD::TruthParticle*, std::vector<simHitSet>>;
46 const TrigRoiDescriptorCollection* roiCollection) const;
56 const MuonR4::GlobalPatternContainer* patternCont,
57 const TruthParticleMap& truthHits,
58 SpacePointTesterModule& spTester,
60 MuonVal::MatrixBranch<unsigned char>& spMatchedToPatternBranch,
61 MuonVal::MatrixBranch<unsigned char>& spMatchedToTruthBranch) const;
67 const TruthParticleMap& truthHits,
68 const std::vector<const MuonR4::SpacePointContainer*>& spContainers);
72 void fillFastRecoMuonInfo(const xAOD::MuonContainer* muonCont,
73 const MuonR4::GlobalPatternContainer* patternCont);
77 void fillTruthInfo(const TruthParticleMap& truthHits,
78 const std::vector<const MuonR4::SpacePointContainer*>& spContainers);
81 void fillRoIInfo(const TrigRoiDescriptorCollection* roiCollection);
82
84 enum class ePatBranchType : std::uint8_t {
85 eReco, // Counts of pattern hits
86 eTruth, // Counts of pattern hits matched to truth
87 ePileup, // Counts of pattern hits matched to pileup truth
88 eMismatched, // Counts of pattern hits matched to truth but not to the main truth particle of the pattern
89 eAll, // Counts of all hits in the buckets crossed by the pattern
90 };
91
98 const std::size_t patIdx,
100 const MuonR4::SpacePoint* sp,
101 const bool isSecondaryMatched = false);
102
103 // // output tree
104 MuonVal::MuonTesterTree m_tree{"MuonFastRecoTest","FastRecoTester"};
105
106 // Space points
107 SG::ReadHandleKey<MuonR4::SpacePointContainer> m_spKey{this, "SpacePointKey", "MuonSpacePoints"};
108 SG::ReadHandleKey<MuonR4::SpacePointContainer> m_NSWspKey{this, "NswSpacePointKey", "NswSpacePoints"};
109
110 // Global patterns
111 SG::ReadHandleKey<MuonR4::GlobalPatternContainer> m_patternKey{this, "PatternKey", "R4MuonGlobalPatterns", "global pattern container"};
112
113 // Fast reco muons
114 SG::ReadHandleKey<xAOD::MuonContainer> m_fastMuonKey{this, "FastMuonKey", "R4FastRecoSAMuons", "fast reco muon container"};
115
116 // Truth segments
117 SG::ReadHandleKey<xAOD::MuonSegmentContainer> m_truthSegmentKey {this, "TruthSegmentKey","MuonTruthSegments", "truth segment container"};
118
119 // HLT seeding RoIs
120 SG::ReadHandleKey<TrigRoiDescriptorCollection> m_roiCollectionKey{this, "MuRoIs", "EFMuMSReco_RoI", "Name of the input data from HLTSeeding"};
121
122 ActsTrk::GeoContextReadKey_t m_geoCtxKey{this, "AlignmentKey", "ActsAlignment", "cond handle key"};
123 ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
124
125 BooleanProperty m_isMC{this, "isMC", false, "Toggle whether the job is ran on MC or not"};
126
127 BooleanProperty m_isSeededReco{this, "isSeededReco", false, "Toggle whether the job is ran on seeded reconstruction or not"};
128
129 BooleanProperty m_writeSpacePoints{this, "writeSpacePoints", false,
130 "Toggle whether the particular space poitns shall be written"};
131
134 std::shared_ptr<SpacePointTesterModule> m_spTester{};
135 std::shared_ptr<SpacePointTesterModule> m_NSWspTester{};
137 MuonVal::VectorBranch<unsigned char>& m_spType{m_tree.newVector<unsigned char>(m_spKey.key()+"_type")};
138 MuonVal::VectorBranch<unsigned char>& m_NSWspType{m_tree.newVector<unsigned char>(m_NSWspKey.key()+"_type")};
140 MuonVal::MatrixBranch<unsigned char>& m_spMatchedToPattern{m_tree.newMatrix<unsigned char>(m_spKey.key()+"_patternMatched")};
141 MuonVal::MatrixBranch<unsigned char>& m_NSWspMatchedToPattern{m_tree.newMatrix<unsigned char>(m_NSWspKey.key()+"_patternMatched")};
143 MuonVal::MatrixBranch<unsigned char>& m_spMatchedToTruth{m_tree.newMatrix<unsigned char>(m_spKey.key()+"_truthMatched")};
144 MuonVal::MatrixBranch<unsigned char>& m_NSWspMatchedToTruth{m_tree.newMatrix<unsigned char>(m_NSWspKey.key()+"_truthMatched")};
145
148 MuonVal::VectorBranch<short>& m_gen_Q{m_tree.newVector<short>("gen_Q", 0)};
149 MuonVal::VectorBranch<float>& m_gen_Eta{m_tree.newVector<float>("gen_Eta",-10.)};
150 MuonVal::VectorBranch<float>& m_gen_Phi{m_tree.newVector<float>("gen_Phi",-10.)};
151 MuonVal::VectorBranch<float>& m_gen_Pt{m_tree.newVector<float>("gen_Pt",-10.)};
152
154 MuonVal::MatrixBranch<unsigned char>& m_gen_nNonPrecMeas{m_tree.newMatrix<unsigned char>("gen_NNonPrecMeas", 0)};
156 MuonVal::MatrixBranch<unsigned char>& m_gen_nPrecMeas{m_tree.newMatrix<unsigned char>("gen_NPrecMeas", 0)};
158 MuonVal::MatrixBranch<unsigned char>& m_gen_nPhiMeas{m_tree.newMatrix<unsigned char>("gen_NPhiMeas", 0)};
159
160
163 MuonVal::ScalarBranch<unsigned>& m_pat_n{m_tree.newScalar<unsigned>("pat_nPatterns", 0)};
165 MuonVal::VectorBranch<float>& m_pat_Eta{m_tree.newVector<float>("pat_Eta", 0.0)};
166 MuonVal::VectorBranch<float>& m_pat_phi{m_tree.newVector<float>("pat_Phi", 0.0)};
168 MuonVal::VectorBranch<uint16_t>& m_pat_sector1{m_tree.newVector<uint16_t>("pat_Sector1", 0)};
169 MuonVal::VectorBranch<uint16_t>& m_pat_sector2{m_tree.newVector<uint16_t>("pat_Sector2", 0)};
171 MuonVal::VectorBranch<float>& m_pat_meanNormResidual2{m_tree.newVector<float>("pat_meanNormResidual2", 0.0)};
173 MuonVal::VectorBranch<short>& m_pat_side{m_tree.newVector<short>("pat_Side", 0)};
175 MuonVal::VectorBranch<unsigned char>& m_pat_nStations{m_tree.newVector<unsigned char>("pat_NStations", 0)};
176
178 MuonVal::MatrixBranch<unsigned char>& m_pat_nNonPrecMeas{m_tree.newMatrix<unsigned char>("pat_NNonPrecMeas", 0)};
180 MuonVal::MatrixBranch<unsigned char>& m_pat_nPrecMeas{m_tree.newMatrix<unsigned char>("pat_NPrecMeas", 0)};
182 MuonVal::MatrixBranch<unsigned char>& m_pat_nPhiMeas{m_tree.newMatrix<unsigned char>("pat_NPhiMeas", 0)};
183
185 MuonVal::MatrixBranch<unsigned char>& m_pat_nTruthNonPrecMeas{m_tree.newMatrix<unsigned char>("pat_NTruthNonPrecMeas", 0)};
187 MuonVal::MatrixBranch<unsigned char>& m_pat_nTruthPrecMeas{m_tree.newMatrix<unsigned char>("pat_NTruthPrecMeas", 0)};
189 MuonVal::MatrixBranch<unsigned char>& m_pat_nTruthPhiMeas{m_tree.newMatrix<unsigned char>("pat_NTruthPhiMeas", 0)};
190
192 MuonVal::MatrixBranch<unsigned char>& m_pat_nMisTruthNonPrecMeas{m_tree.newMatrix<unsigned char>("pat_NMisTruthNonPrecMeas", 0)};
194 MuonVal::MatrixBranch<unsigned char>& m_pat_nMisTruthPrecMeas{m_tree.newMatrix<unsigned char>("pat_NMisTruthPrecMeas", 0)};
196 MuonVal::MatrixBranch<unsigned char>& m_pat_nMisTruthPhiMeas{m_tree.newMatrix<unsigned char>("pat_NMisTruthPhiMeas", 0)};
197
199 MuonVal::MatrixBranch<unsigned char>& m_pat_nPileupNonPrecMeas{m_tree.newMatrix<unsigned char>("pat_NPileupNonPrecMeas", 0)};
201 MuonVal::MatrixBranch<unsigned char>& m_pat_nPileupPrecMeas{m_tree.newMatrix<unsigned char>("pat_NPileupPrecMeas", 0)};
203 MuonVal::MatrixBranch<unsigned char>& m_pat_nPileupPhiMeas{m_tree.newMatrix<unsigned char>("pat_NPileupPhiMeas", 0)};
204
206 MuonVal::MatrixBranch<unsigned char>& m_pat_nAllNonPrecMeas{m_tree.newMatrix<unsigned char>("pat_NAllNonPrecMeas", 0)};
208 MuonVal::MatrixBranch<unsigned char>& m_pat_nAllPrecMeas{m_tree.newMatrix<unsigned char>("pat_NAllPrecMeas", 0)};
210 MuonVal::MatrixBranch<unsigned char>& m_pat_nAllPhiMeas{m_tree.newMatrix<unsigned char>("pat_NAllPhiMeas", 0)};
211
214 MuonVal::MatrixBranch<unsigned char>& m_pat_MatchedToTruth{m_tree.newMatrix<unsigned char>("pat_truthMatched")};
215
217 MuonVal::VectorBranch<float>& m_roi_EtaMin{m_tree.newVector<float>("roi_EtaMin",-10.)};
218 MuonVal::VectorBranch<float>& m_roi_EtaMax{m_tree.newVector<float>("roi_EtaMax",-10.)};
219 MuonVal::VectorBranch<float>& m_roi_PhiMin{m_tree.newVector<float>("roi_PhiMin",-10.)};
220 MuonVal::VectorBranch<float>& m_roi_PhiMax{m_tree.newVector<float>("roi_PhiMax",-10.)};
221 MuonVal::VectorBranch<float>& m_roi_ZMin{m_tree.newVector<float>("roi_ZMin",-10.)};
222 MuonVal::VectorBranch<float>& m_roi_ZMax{m_tree.newVector<float>("roi_ZMax",-10.)};
223
225 MuonVal::VectorBranch<float>& m_muon_Eta{m_tree.newVector<float>("muon_Eta", -10.)};
226 MuonVal::VectorBranch<float>& m_muon_Phi{m_tree.newVector<float>("muon_Phi", -10.)};
227 MuonVal::VectorBranch<float>& m_muon_Pt{m_tree.newVector<float>("muon_Pt", -10.)};
228 MuonVal::VectorBranch<short>& m_muon_Q{m_tree.newVector<short>("muon_Q", 0)};
229 MuonVal::VectorBranch<unsigned char>& m_muon_MatchedToPattern{m_tree.newVector<unsigned char>("muon_patMatched")};
230
232
233 };
234}
235
236#endif // MUONFASTDIGITEST_MUONVALR4_MuonHoughTransformTester_H
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.
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.
std::unordered_set< const xAOD::MuonSimHit * > simHitSet
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...
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".