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
17
18// muon includes
22
23namespace MuonValR4{
24
26 public:
28 virtual ~MuonFastRecoTester() = default;
29
30 virtual StatusCode initialize() override;
31 virtual StatusCode execute() override;
32 virtual StatusCode finalize() override;
33
34 private:
36 enum class measType {Prec, NonPrec, Phi, nTypes};
37 using simHitSet = std::unordered_set<const xAOD::MuonSimHit*>;
38 using TruthParticleMap = std::map<const xAOD::TruthParticle*, std::vector<simHitSet>>;
44 const TrigRoiDescriptorCollection* roiCollection) const;
54 const MuonR4::GlobalPatternContainer* patternCont,
55 const TruthParticleMap& truthHits,
56 SpacePointTesterModule& spTester,
58 MuonVal::MatrixBranch<unsigned char>& spMatchedToPatternBranch,
59 MuonVal::MatrixBranch<unsigned char>& spMatchedToTruthBranch) const;
65 const TruthParticleMap& truthHits,
66 const std::vector<const MuonR4::SpacePointContainer*>& spContainers);
70 void fillTruthInfo(const TruthParticleMap& truthHits,
71 const std::vector<const MuonR4::SpacePointContainer*>& spContainers);
74 void fillRoIInfo(const TrigRoiDescriptorCollection* roiCollection);
75
77 enum class ePatBranchType : std::uint8_t {
78 eReco, // Counts of pattern hits
79 eTruth, // Counts of pattern hits matched to truth
80 ePileup, // Counts of pattern hits matched to pileup truth
81 eMismatched, // Counts of pattern hits matched to truth but not to the main truth particle of the pattern
82 eAll, // Counts of all hits in the buckets crossed by the pattern
83 };
84
91 const std::size_t patIdx,
94 const bool isSecondaryMatched = false);
95
96 // // output tree
97 MuonVal::MuonTesterTree m_tree{"MuonFastRecoTest","FastRecoTester"};
98
99 // Space points
100 SG::ReadHandleKey<MuonR4::SpacePointContainer> m_spKey{this, "SpacePointKey", "MuonSpacePoints"};
101 SG::ReadHandleKey<MuonR4::SpacePointContainer> m_NSWspKey{this, "NswSpacePointKey", "NswSpacePoints"};
102
103 // Global patterns
104 SG::ReadHandleKey<MuonR4::GlobalPatternContainer> m_patternKey{this, "PatternKey", "R4MuonGlobalPatterns", "global pattern container"};
105
106 // Truth segments
107 SG::ReadHandleKey<xAOD::MuonSegmentContainer> m_truthSegmentKey {this, "TruthSegmentKey","MuonTruthSegments", "truth segment container"};
108
109 // HLT seeding RoIs
110 SG::ReadHandleKey<TrigRoiDescriptorCollection> m_roiCollectionKey{this, "MuRoIs", "EFMuMSReco_RoI", "Name of the input data from HLTSeeding"};
111
112 SG::ReadHandleKey<ActsTrk::GeometryContext> m_geoCtxKey{this, "AlignmentKey", "ActsAlignment", "cond handle key"};
113 ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
114
115 BooleanProperty m_isMC{this, "isMC", false, "Toggle whether the job is ran on MC or not"};
116
117 BooleanProperty m_isSeededReco{this, "isSeededReco", false, "Toggle whether the job is ran on seeded reconstruction or not"};
118
119 BooleanProperty m_writeSpacePoints{this, "writeSpacePoints", false,
120 "Toggle whether the particular space poitns shall be written"};
121
124 std::shared_ptr<SpacePointTesterModule> m_spTester{};
125 std::shared_ptr<SpacePointTesterModule> m_NSWspTester{};
127 MuonVal::VectorBranch<unsigned char>& m_spType{m_tree.newVector<unsigned char>(m_spKey.key()+"_type")};
128 MuonVal::VectorBranch<unsigned char>& m_NSWspType{m_tree.newVector<unsigned char>(m_NSWspKey.key()+"_type")};
130 MuonVal::MatrixBranch<unsigned char>& m_spMatchedToPattern{m_tree.newMatrix<unsigned char>(m_spKey.key()+"_patternMatched")};
131 MuonVal::MatrixBranch<unsigned char>& m_NSWspMatchedToPattern{m_tree.newMatrix<unsigned char>(m_NSWspKey.key()+"_patternMatched")};
133 MuonVal::MatrixBranch<unsigned char>& m_spMatchedToTruth{m_tree.newMatrix<unsigned char>(m_spKey.key()+"_truthMatched")};
134 MuonVal::MatrixBranch<unsigned char>& m_NSWspMatchedToTruth{m_tree.newMatrix<unsigned char>(m_NSWspKey.key()+"_truthMatched")};
135
138 MuonVal::VectorBranch<short>& m_gen_Q{m_tree.newVector<short>("gen_Q", 0)};
139 MuonVal::VectorBranch<float>& m_gen_Eta{m_tree.newVector<float>("gen_Eta",-10.)};
140 MuonVal::VectorBranch<float>& m_gen_Phi{m_tree.newVector<float>("gen_Phi",-10.)};
141 MuonVal::VectorBranch<float>& m_gen_Pt{m_tree.newVector<float>("gen_Pt",-10.)};
142
144 MuonVal::MatrixBranch<unsigned char>& m_gen_nNonPrecMeas{m_tree.newMatrix<unsigned char>("gen_NNonPrecMeas", 0)};
146 MuonVal::MatrixBranch<unsigned char>& m_gen_nPrecMeas{m_tree.newMatrix<unsigned char>("gen_NPrecMeas", 0)};
148 MuonVal::MatrixBranch<unsigned char>& m_gen_nPhiMeas{m_tree.newMatrix<unsigned char>("gen_NPhiMeas", 0)};
149
150
153 MuonVal::ScalarBranch<unsigned>& m_pat_n{m_tree.newScalar<unsigned>("pat_nPatterns", 0)};
155 MuonVal::VectorBranch<float>& m_pat_Eta{m_tree.newVector<float>("pat_Eta", 0.0)};
156 MuonVal::VectorBranch<float>& m_pat_phi{m_tree.newVector<float>("pat_Phi", 0.0)};
158 MuonVal::VectorBranch<uint16_t>& m_pat_sector1{m_tree.newVector<uint16_t>("pat_Sector1", 0)};
159 MuonVal::VectorBranch<uint16_t>& m_pat_sector2{m_tree.newVector<uint16_t>("pat_Sector2", 0)};
161 MuonVal::VectorBranch<float>& m_pat_meanNormResidual2{m_tree.newVector<float>("pat_meanNormResidual2", 0.0)};
163 MuonVal::VectorBranch<short>& m_pat_side{m_tree.newVector<short>("pat_Side", 0)};
165 MuonVal::VectorBranch<unsigned char>& m_pat_nStations{m_tree.newVector<unsigned char>("pat_NStations", 0)};
166
168 MuonVal::MatrixBranch<unsigned char>& m_pat_nNonPrecMeas{m_tree.newMatrix<unsigned char>("pat_NNonPrecMeas", 0)};
170 MuonVal::MatrixBranch<unsigned char>& m_pat_nPrecMeas{m_tree.newMatrix<unsigned char>("pat_NPrecMeas", 0)};
172 MuonVal::MatrixBranch<unsigned char>& m_pat_nPhiMeas{m_tree.newMatrix<unsigned char>("pat_NPhiMeas", 0)};
173
175 MuonVal::MatrixBranch<unsigned char>& m_pat_nTruthNonPrecMeas{m_tree.newMatrix<unsigned char>("pat_NTruthNonPrecMeas", 0)};
177 MuonVal::MatrixBranch<unsigned char>& m_pat_nTruthPrecMeas{m_tree.newMatrix<unsigned char>("pat_NTruthPrecMeas", 0)};
179 MuonVal::MatrixBranch<unsigned char>& m_pat_nTruthPhiMeas{m_tree.newMatrix<unsigned char>("pat_NTruthPhiMeas", 0)};
180
182 MuonVal::MatrixBranch<unsigned char>& m_pat_nMisTruthNonPrecMeas{m_tree.newMatrix<unsigned char>("pat_NMisTruthNonPrecMeas", 0)};
184 MuonVal::MatrixBranch<unsigned char>& m_pat_nMisTruthPrecMeas{m_tree.newMatrix<unsigned char>("pat_NMisTruthPrecMeas", 0)};
186 MuonVal::MatrixBranch<unsigned char>& m_pat_nMisTruthPhiMeas{m_tree.newMatrix<unsigned char>("pat_NMisTruthPhiMeas", 0)};
187
189 MuonVal::MatrixBranch<unsigned char>& m_pat_nPileupNonPrecMeas{m_tree.newMatrix<unsigned char>("pat_NPileupNonPrecMeas", 0)};
191 MuonVal::MatrixBranch<unsigned char>& m_pat_nPileupPrecMeas{m_tree.newMatrix<unsigned char>("pat_NPileupPrecMeas", 0)};
193 MuonVal::MatrixBranch<unsigned char>& m_pat_nPileupPhiMeas{m_tree.newMatrix<unsigned char>("pat_NPileupPhiMeas", 0)};
194
196 MuonVal::MatrixBranch<unsigned char>& m_pat_nAllNonPrecMeas{m_tree.newMatrix<unsigned char>("pat_NAllNonPrecMeas", 0)};
198 MuonVal::MatrixBranch<unsigned char>& m_pat_nAllPrecMeas{m_tree.newMatrix<unsigned char>("pat_NAllPrecMeas", 0)};
200 MuonVal::MatrixBranch<unsigned char>& m_pat_nAllPhiMeas{m_tree.newMatrix<unsigned char>("pat_NAllPhiMeas", 0)};
201
204 MuonVal::MatrixBranch<unsigned char>& m_pat_MatchedToTruth{m_tree.newMatrix<unsigned char>("pat_truthMatched")};
205
207 MuonVal::VectorBranch<float>& m_roi_EtaMin{m_tree.newVector<float>("roi_EtaMin",-10.)};
208 MuonVal::VectorBranch<float>& m_roi_EtaMax{m_tree.newVector<float>("roi_EtaMax",-10.)};
209 MuonVal::VectorBranch<float>& m_roi_PhiMin{m_tree.newVector<float>("roi_PhiMin",-10.)};
210 MuonVal::VectorBranch<float>& m_roi_PhiMax{m_tree.newVector<float>("roi_PhiMax",-10.)};
211 MuonVal::VectorBranch<float>& m_roi_ZMin{m_tree.newVector<float>("roi_ZMin",-10.)};
212 MuonVal::VectorBranch<float>& m_roi_ZMax{m_tree.newVector<float>("roi_ZMax",-10.)};
213
215
216 };
217}
218
219#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
MuonVal::MatrixBranch< unsigned char > & m_pat_nNonPrecMeas
Number of trigger eta measurements per station.
measType
Enum for measurement types.
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::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_pat_phi
virtual ~MuonFastRecoTester()=default
virtual StatusCode execute() override
SG::ReadHandleKey< TrigRoiDescriptorCollection > m_roiCollectionKey
std::map< const xAOD::TruthParticle *, std::vector< simHitSet > > TruthParticleMap
MuonVal::VectorBranch< short > & m_gen_Q
====== Truth particle block ===========
SG::ReadHandleKey< ActsTrk::GeometryContext > m_geoCtxKey
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.
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_roi_EtaMax
MuonVal::VectorBranch< float > & m_pat_meanNormResidual2
mean square normalized pattern residual
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< 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.
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".