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
16
17// muon includes
20
21namespace MuonValR4{
22
24 public:
26 virtual ~MuonFastRecoTester() = default;
27
28 virtual StatusCode initialize() override;
29 virtual StatusCode execute() override;
30 virtual StatusCode finalize() override;
31
32 private:
33 enum class eHitType : std::uint8_t {
34 ePrec = 0,
36 ePhi = 2,
38 };
39 using HitCounts = std::array<unsigned int, Acts::toUnderlying(eHitType::nTypes)>;
46 using simHitSet = std::unordered_set<const xAOD::MuonSimHit*>;
47 using TruthParticleMap = std::map<const xAOD::TruthParticle*, std::vector<simHitSet>>;
61 const MuonR4::GlobalPatternContainer* patternCont,
62 const TruthParticleMap& truthHits,
63 SpacePointTesterModule& spTester,
65 MuonVal::MatrixBranch<unsigned char>& spMatchedToPatternBranch,
66 MuonVal::MatrixBranch<unsigned char>& spMatchedToTruthBranch) const;
72 const TruthParticleMap& truthHits,
73 const std::vector<const MuonR4::SpacePointContainer*>& spContainers);
77 void fillTruthInfo(const TruthParticleMap& truthHits,
78 const xAOD::MuonSegmentContainer* truthSegments);
79
80 // // output tree
81 MuonVal::MuonTesterTree m_tree{"MuonFastRecoTest","FastRecoTester"};
82
83 // Space points
84 SG::ReadHandleKey<MuonR4::SpacePointContainer> m_spKey{this, "SpacePointKey", "MuonSpacePoints"};
85 SG::ReadHandleKey<MuonR4::SpacePointContainer> m_NSWspKey{this, "NswSpacePointKey", "NswSpacePoints"};
86
87 // Global patterns
88 SG::ReadHandleKey<MuonR4::GlobalPatternContainer> m_patternKey{this, "PatternKey", "R4MuonGlobalPatterns", "global pattern container"};
89
90 SG::ReadHandleKey<xAOD::MuonSegmentContainer> m_truthSegmentKey {this, "TruthSegmentKey","MuonTruthSegments", "truth segment container"};
91
92 SG::ReadHandleKey<ActsTrk::GeometryContext> m_geoCtxKey{this, "AlignmentKey", "ActsAlignment", "cond handle key"};
93 ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
94
95 Gaudi::Property<bool> m_isMC{this, "isMC", false, "Toggle whether the job is ran on MC or not"};
96
97 Gaudi::Property<bool> m_writeSpacePoints{this, "writeSpacePoints", false,
98 "Toggle whether the particular space poitns shall be written"};
99
102 std::shared_ptr<SpacePointTesterModule> m_spTester{};
103 std::shared_ptr<SpacePointTesterModule> m_NSWspTester{};
105 MuonVal::VectorBranch<unsigned char>& m_spType{m_tree.newVector<unsigned char>(m_spKey.key()+"_type")};
106 MuonVal::VectorBranch<unsigned char>& m_NSWspType{m_tree.newVector<unsigned char>(m_NSWspKey.key()+"_type")};
108 MuonVal::MatrixBranch<unsigned char>& m_spMatchedToPattern{m_tree.newMatrix<unsigned char>(m_spKey.key()+"_patternMatched")};
109 MuonVal::MatrixBranch<unsigned char>& m_NSWspMatchedToPattern{m_tree.newMatrix<unsigned char>(m_NSWspKey.key()+"_patternMatched")};
111 MuonVal::MatrixBranch<unsigned char>& m_spMatchedToTruth{m_tree.newMatrix<unsigned char>(m_spKey.key()+"_truthMatched")};
112 MuonVal::MatrixBranch<unsigned char>& m_NSWspMatchedToTruth{m_tree.newMatrix<unsigned char>(m_NSWspKey.key()+"_truthMatched")};
113
116 MuonVal::VectorBranch<short>& m_gen_Q{m_tree.newVector<short>("gen_Q", 0)};
117 MuonVal::VectorBranch<float>& m_gen_Eta{m_tree.newVector<float>("gen_Eta",-10.)};
118 MuonVal::VectorBranch<float>& m_gen_Phi{m_tree.newVector<float>("gen_Phi",-10.)};
119 MuonVal::VectorBranch<float>& m_gen_Pt{m_tree.newVector<float>("gen_Pt",-10.)};
120
122 MuonVal::MatrixBranch<unsigned char>& m_gen_nNonPrecSpacePointsPerStation{m_tree.newMatrix<unsigned char>("gen_NNonPrecMeasPerStation")};
124 MuonVal::MatrixBranch<unsigned char>& m_gen_nPrecSpacePointsPerStation{m_tree.newMatrix<unsigned char>("gen_NPrecMeasPerStation")};
126 MuonVal::MatrixBranch<unsigned char>& m_gen_nPhiSpacePointsPerStation{m_tree.newMatrix<unsigned char>("gen_NPhiMeasPerStation")};
127
128
131 MuonVal::ScalarBranch<unsigned>& m_pat_n{m_tree.newScalar<unsigned>("pat_nPatterns", 0)};
133 MuonVal::VectorBranch<float>& m_pat_Eta{m_tree.newVector<float>("pat_Eta", 0.0)};
134 MuonVal::VectorBranch<float>& m_pat_phi{m_tree.newVector<float>("pat_Phi", 0.0)};
136 MuonVal::VectorBranch<uint16_t>& m_pat_sector1{m_tree.newVector<uint16_t>("pat_Sector1", 0)};
137 MuonVal::VectorBranch<uint16_t>& m_pat_sector2{m_tree.newVector<uint16_t>("pat_Sector2", 0)};
139 MuonVal::VectorBranch<float>& m_pat_residual{m_tree.newVector<float>("pat_Residual", 0.0)};
141 MuonVal::VectorBranch<float>& m_pat_normalizedResidual{m_tree.newVector<float>("pat_NormalizedResidual", 0.0)};
143 MuonVal::VectorBranch<short>& m_pat_side{m_tree.newVector<short>("pat_Side", 0)};
145 MuonVal::VectorBranch<unsigned char>& m_pat_nStations{m_tree.newVector<unsigned char>("pat_NStations", 0)};
146
148 MuonVal::VectorBranch<unsigned char>& m_pat_nNonPrecSpacePoints{m_tree.newVector<unsigned char>("pat_NNonPrecMeas",0)};
150 MuonVal::VectorBranch<unsigned char>& m_pat_nPrecSpacePoints{m_tree.newVector<unsigned char>("pat_NPrecMeas",0)};
152 MuonVal::VectorBranch<unsigned char>& m_pat_nPhiSpacePoints{m_tree.newVector<unsigned char>("pat_NPhiMeas",0)};
153
155 MuonVal::VectorBranch<unsigned char>& m_pat_nTrueNonPrecSpacePoints{m_tree.newVector<unsigned char>("pat_NTrueNonPrecMeas",0)};
157 MuonVal::VectorBranch<unsigned char>& m_pat_nTruePrecSpacePoints{m_tree.newVector<unsigned char>("pat_NTruePrecMeas",0)};
159 MuonVal::VectorBranch<unsigned char>& m_pat_nTruePhiSpacePoints{m_tree.newVector<unsigned char>("pat_NTruePhiMeas",0)};
160
162 MuonVal::VectorBranch<unsigned char>& m_pat_nPileupNonPrecSpacePoints{m_tree.newVector<unsigned char>("pat_NPileupNonPrecMeas",0)};
164 MuonVal::VectorBranch<unsigned char>& m_pat_nPileupPrecSpacePoints{m_tree.newVector<unsigned char>("pat_NPileupPrecMeas",0)};
166 MuonVal::VectorBranch<unsigned char>& m_pat_nPileupPhiSpacePoints{m_tree.newVector<unsigned char>("pat_NPileupPhiMeas",0)};
167
169 MuonVal::VectorBranch<unsigned char>& m_pat_nAllNonPrecSpacePoints{m_tree.newVector<unsigned char>("pat_NAllNonPrecMeas",0)};
171 MuonVal::VectorBranch<unsigned char>& m_pat_nAllPrecSpacePoints{m_tree.newVector<unsigned char>("pat_NAllPrecMeas",0)};
173 MuonVal::VectorBranch<unsigned char>& m_pat_nAllPhiSpacePoints{m_tree.newVector<unsigned char>("pat_NAllPhiMeas",0)};
174
176 MuonVal::MatrixBranch<unsigned char>& m_pat_MatchedToTruth{m_tree.newMatrix<unsigned char>("pat_truthMatched")};
178 MuonVal::VectorBranch<unsigned char> & m_pat_nTruthparticles{m_tree.newVector<unsigned char>("pat_NTruthParticles", 0)};
179
180 };
181}
182
183#endif // MUONFASTDIGITEST_MUONVALR4_MuonHoughTransformTester_H
AthHistogramAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
MuonVal::VectorBranch< float > & m_gen_Phi
MuonVal::VectorBranch< unsigned char > & m_spType
Type of spacepoints: 1 for trigger eta, 2 for precision, 3 for only-phi.
SG::ReadHandleKey< MuonR4::SpacePointContainer > m_NSWspKey
SG::ReadHandleKey< MuonR4::GlobalPatternContainer > m_patternKey
MuonVal::ScalarBranch< unsigned > & m_pat_n
====== Global Pattern block ===========
void fillTruthInfo(const TruthParticleMap &truthHits, const xAOD::MuonSegmentContainer *truthSegments)
Fill the truth particleinformation into the tree.
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_pat_nPileupNonPrecSpacePoints
Number of pileup trigger eta space points in the pattern.
MuonVal::VectorBranch< unsigned char > & m_pat_nAllPrecSpacePoints
Number of precision space points in the buckets crossed by the pattern.
MuonVal::VectorBranch< unsigned char > & m_pat_nStations
Number of stations.
MuonVal::MatrixBranch< unsigned char > & m_NSWspMatchedToTruth
MuonVal::VectorBranch< uint16_t > & m_pat_sector2
MuonVal::VectorBranch< float > & m_gen_Eta
MuonVal::VectorBranch< unsigned char > & m_pat_nAllPhiSpacePoints
Number of phi space points in the buckets crossed by the pattern.
MuonVal::VectorBranch< unsigned char > & m_pat_nPhiSpacePoints
Number of phi measurements in the pattern.
Gaudi::Property< bool > m_writeSpacePoints
MuonVal::VectorBranch< float > & m_pat_phi
MuonVal::VectorBranch< float > & m_pat_normalizedResidual
pattern normalized residual
MuonVal::VectorBranch< unsigned char > & m_pat_nTrueNonPrecSpacePoints
Number of truth trigger eta space points in the pattern.
MuonVal::VectorBranch< unsigned char > & m_pat_nPileupPhiSpacePoints
Number of pileup phi space points in the pattern.
virtual ~MuonFastRecoTester()=default
virtual StatusCode execute() override
std::map< const xAOD::TruthParticle *, std::vector< simHitSet > > TruthParticleMap
MuonVal::VectorBranch< unsigned char > & m_pat_nTruePrecSpacePoints
Number of truth precision space points in the pattern.
MuonVal::VectorBranch< short > & m_gen_Q
====== Truth particle block ===========
SG::ReadHandleKey< ActsTrk::GeometryContext > m_geoCtxKey
MuonVal::MatrixBranch< unsigned char > & m_gen_nNonPrecSpacePointsPerStation
Number of trigger eta measurements per station.
virtual StatusCode finalize() override
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
MuonVal::VectorBranch< unsigned char > & m_pat_nPileupPrecSpacePoints
Number of pileup precision space points in the pattern.
MuonVal::MatrixBranch< unsigned char > & m_gen_nPhiSpacePointsPerStation
Number of phi measurements per station.
SG::ReadHandleKey< xAOD::MuonSegmentContainer > m_truthSegmentKey
std::shared_ptr< SpacePointTesterModule > m_NSWspTester
std::shared_ptr< SpacePointTesterModule > m_spTester
====== Spacepoint block ===========
std::unordered_set< const xAOD::MuonSimHit * > simHitSet
virtual StatusCode initialize() override
MuonVal::VectorBranch< unsigned char > & m_pat_nNonPrecSpacePoints
Number of trigger eta space points in the pattern.
Gaudi::Property< bool > m_isMC
MuonVal::VectorBranch< unsigned char > & m_pat_nTruthparticles
number of matched truth particles
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::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::VectorBranch< float > & m_pat_residual
pattern residual
MuonVal::MuonTesterTree m_tree
MuonVal::VectorBranch< unsigned char > & m_pat_nAllNonPrecSpacePoints
Number of trigger eta space points in the buckets crossed by the pattern.
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.
MuonVal::VectorBranch< unsigned char > & m_pat_nPrecSpacePoints
Number of precision measurements in the pattern.
MuonVal::MatrixBranch< unsigned char > & m_gen_nPrecSpacePointsPerStation
Number of precision measurements per station.
TruthParticleMap fillTruthMap(const xAOD::MuonSegmentContainer *truthSegments) const
Fill the truth particle map.
std::array< unsigned int, Acts::toUnderlying(eHitType::nTypes)> HitCounts
MuonVal::MatrixBranch< unsigned char > & m_spMatchedToTruth
Branch indicating which space points in the tree are associated to the i-th truth particle.
MuonVal::VectorBranch< float > & m_pat_Eta
pattern average theta & phi
MuonVal::VectorBranch< unsigned char > & m_pat_nTruePhiSpacePoints
Number of truth phi space points in the pattern.
SG::ReadHandleKey< MuonR4::SpacePointContainer > m_spKey
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...
MuonSegmentContainer_v1 MuonSegmentContainer
Definition of the current "MuonSegment container version".