ATLAS Offline Software
Loading...
Searching...
No Matches
MsTrackTester.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4#ifndef MUONTRACKFINDINGTEST_MSTRACKTESTER_H
5#define MUONTRACKFINDINGTEST_MSTRACKTESTER_H
6
9
13
18
28
32
35
36
37namespace MuonValR4{
39 public:
41
42 StatusCode initialize() override final;
43 StatusCode execute(const EventContext& ctx) override final;
44 StatusCode finalize() override final;
45 private:
52 std::optional<MuonR4::MsTrackSeed> makeSeedFromTruth(const Acts::GeometryContext& tgContext,
53 const xAOD::TruthParticle& truthMuon) const;
60 std::pair<double, double> calcSeedLength(const Acts::GeometryContext& tgContext,
61 const MuonR4::MsTrackSeed& seed) const;
62
63
74 std::vector<const xAOD::MuonSegment*> getAssociatedSegments(const xAOD::TrackParticle& idTrack,
75 const EventContext& ctx) const;
76
82 const EventContext& ctx) const;
83
85 const EventContext& ctx) const;
86
87
89
90
95 std::vector<std::uint8_t> recoSegs{};
97 std::vector<float> matchScores{};
99 std::vector<float> deltaTheta{};
101 std::vector<float> deltaPhi{};
103 std::vector<float> deltaY0{};
105 std::vector<float> deltaX0{};
107 std::vector<std::uint8_t> goodExtp{};
109 std::vector<std::uint8_t> taggedSeg{};
110
111 };
112
113 SegmentTagVariables calcSegTagVariables(const xAOD::TrackParticle& idTrack,
114 const EventContext& ctx);
115
117 StatusCode dumpLegacyTracks(const EventContext& ctx);
119 StatusCode dumpTruthContent(const EventContext& ctx);
121 StatusCode dumpRecoContent(const EventContext& ctx);
122
124 MuonVal::MuonTesterTree m_tree{"MsTrackValidTest", "MuonTrackTester"};
128 Gaudi::Property<bool> m_isMC{this, "isMC", false};
130 Gaudi::Property<bool> m_storeID{this, "storeIdTrks", true};
131
132 using TruthHitCol = std::unordered_set<const xAOD::MuonSimHit*>;
142 SegmentKey_t m_truthSegmentKey{this, "TruthSegmentKey", "MuonTruthSegments"};
144 SegmentKey_t m_recoSegmentKey{this, "SegmentKey", "MuonSegmentsFromR4"};
146 SegmentKey_t m_legacySegmentKey{this, "LegacySegmentKey", "MuonSegments"};
148 SG::ReadHandleKey<xAOD::TruthParticleContainer> m_truthKey{this, "TruthKey", "MuonTruthParticles"};
153
157 MuonKey_t m_muonKey{this, "MuonKey", "MuonsR4"};
159 ToolHandle<MuonR4::ITrackSummaryTool> m_summaryTool{this, "SummaryTool" ,""};
161 ToolHandle<MuonR4::ITrackSeedingDiagnosticsTool> m_seedingTool{this, "SeedingTool", ""};
163 ToolHandle<MuonR4::ISegmentSelectionTool> m_segSelector{this, "SegmentSelectionTool" , "" };
165 ToolHandle<ActsTrk::IExtrapolationTool> m_extrapolationTool{this, "ExtrapolationTool" ,"" };
167 TrackKey_t m_legacyTrackKey{this,"LegacyTrackKey", "MuonSpectrometerTrackParticles"};
169 TrackKey_t m_idTrackKey{this, "IdTrackKey", "InDetTrackParticles"};
171 MuonTagKey_t m_idTagKey{this, "IdTagKey", "MuonInDetCandidates"};
173 MuonTagKey_t m_segTagKey{this, "SegTagKey", "SegmentTags"};
174
177 Gaudi::Property<double> m_toleranceX0{this, "toleranceX0", 20.*Gaudi::Units::cm};
180 Gaudi::Property<double> m_toleranceY0{this, "toleranceY0", 5.*Gaudi::Units::cm};
183 Gaudi::Property<double> m_toleranceTheta{this, "toleranceTheta", 1.*Gaudi::Units::deg};
186 Gaudi::Property<double> m_tolerancePhi{this, "tolerancePhi", 2.*Gaudi::Units::deg};
187
189 MuonKey_t m_legacyMuonKey{this,"LegacyMuonKey", "Muons"};
190
192 std::unique_ptr<const Acts::Logger> m_logger{};
194 const Acts::Logger& logger() const { return *m_logger; }
195
196
197 using ParticleBranchPtr_t = std::shared_ptr<MuonVal::IParticleFourMomBranch>;
203
205 using SegmentBranchPtr_t = std::shared_ptr<MuonPRDTest::SegmentVariables>;
210 MuonVal::ScalarBranch<std::uint16_t>& m_nIdTracks{m_tree.newScalar<std::uint16_t>("nIdTracks", 0)};
212 MuonVal::ScalarBranch<std::uint16_t>& m_nIdTags{m_tree.newScalar<std::uint16_t>("nIdTags", 0)};
218 MuonVal::VectorBranch<char>& m_seedType{m_tree.newVector<char>("TrkSeed_type")};
220 MuonVal::VectorBranch<int>& m_seedSector{m_tree.newVector<int>("TrkSeed_sector")};
222 MuonVal::VectorBranch<float>& m_seedLength{m_tree.newVector<float>("TrkSeed_length")};
224 MuonVal::VectorBranch<float>& m_seedThetaCone{m_tree.newVector<float>("TrkSeed_thetaCone")};
226 MuonVal::VectorBranch<char>& m_seedGood{m_tree.newVector<char>("TrkSeed_goodSeed")};
228 MuonVal::VectorBranch<float>& m_seedQP{m_tree.newVector<float>("TrkSeed_qTimesP")};
230 MuonVal::VectorBranch<unsigned short>& m_seedTruthLink{m_tree.newVector<unsigned short>("TrkSeed_truthLink", -1)};
232 std::shared_ptr<TrackSummaryModule> m_seedSummary{};
234 MuonVal::MatrixBranch<unsigned short>& m_seedRecoSegMatch{m_tree.newMatrix<unsigned short>("TrkSeed_segmentLinks")};
236 MuonVal::MatrixBranch<unsigned short>& m_truthSegToRecoLink{m_tree.newMatrix<unsigned short>("TruthSegments_recoSegLinks",-1)};
237
239 MuonVal::VectorBranch<unsigned short>& m_legacySegToTrkLinks{m_tree.newVector<unsigned short>("LegacyRecoSegments_trkLinks", -1)};
240
242 MuonVal::MatrixBranch<unsigned short>& m_truthMuToSeedIdx{m_tree.newMatrix<unsigned short>("TruthMuons_seedLinks", -1)};
244 MuonVal::MatrixBranch<unsigned short>& m_truthMuToSeedCounter{m_tree.newMatrix<unsigned short>("TruthMuons_seedNSeg")};
246 MuonVal::MatrixBranch<unsigned short>& m_truthMuRecoSegLinks{m_tree.newMatrix<unsigned short>("TruthMuons_recoSegLinks")};
247
250 };
251}
252
253
254#endif
Property holding a SG store/key/clid from which a ReadHandle is made.
Utility class to handle the three contexts neeeded in an ACTS reconstruction job 1) GeometryContext -...
AthHistogramAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
A spectrometer sector forms the envelope of all chambers that are placed in the same MS sector & laye...
SectorProjector
Enumeration to select the sector projection of the regular MS sector.
Location
Enum defining whether the seed is made in the endcap / barrel.
Definition MsTrackSeed.h:25
Baseline EDM object to gather all relevant information about a reconstructed muon candidate which can...
Definition MuonTag.h:25
ToolHandle< MuonR4::ITrackSeedingDiagnosticsTool > m_seedingTool
The track seeding tool to construct the seed candidates and to estimate the initial parameters.
const MuonGMR4::MuonDetectorManager * m_detMgr
The detector manager to fetch the segment surfaces.
MuonVal::ScalarBranch< std::uint16_t > & m_nIdTags
The number of selected ID tracks in the event.
std::shared_ptr< MuonPRDTest::SegmentVariables > SegmentBranchPtr_t
Abrivation of the branches containing sement information.
ToolHandle< MuonR4::ITrackSummaryTool > m_summaryTool
Hit summary tool.
StatusCode dumpLegacyTracks(const EventContext &ctx)
Dumps the legacy containers to the TTree.
SG::ReadHandleKey< xAOD::MuonContainer > MuonKey_t
Abrivate the key type for the muon container.
SegmentKey_t m_legacySegmentKey
Legacy segment container.
const MuonR4::MuonTag * findBaseIdTag(const xAOD::TrackParticle &idTrack, const EventContext &ctx) const
Searches the Id track in the basline collection of all ID tracks selected for the combined muon recon...
MuonR4::MsTrackSeed::Location Location
const MuonGMR4::SpectrometerSector * getEnvelope(const xAOD::MuonSegment &segment) const
MuonTagKey_t m_idTagKey
The collection of all ID tracks that are selected for combined reconstruction.
TrackKey_t m_idTrackKey
The collection of ID tracks associated with the truth particle.
MuonVal::VectorBranch< unsigned short > & m_legacySegToTrkLinks
Link of the legacy track to the legacy segment.
ParticleBranchPtr_t m_truthTrks
MuonVal::VectorBranch< int > & m_seedSector
Sector of the seed, even center, odd overlap regions, for details see:
MuonVal::VectorBranch< float > & m_seedThetaCone
Maximum angular difference between the segments part of the seed.
ParticleBranchPtr_t m_legacyTrks
Output branches of the legacy MS tracks.
SegmentBranchPtr_t m_truthSegs
SegmentBranchPtr_t m_legacyRecoSegs
std::unordered_set< const xAOD::MuonSimHit * > TruthHitCol
MuonVal::ScalarBranch< std::uint16_t > & m_nIdTracks
The number of ID tracks in the event.
MuonVal::MatrixBranch< unsigned short > & m_truthMuRecoSegLinks
Links from the truth muon to the segments.
std::unique_ptr< const Acts::Logger > m_logger
Instance to the Acts logger.
MuonVal::MatrixBranch< unsigned short > & m_truthMuToSeedIdx
Links to all MsTrkSeeds that could be matched to the truthMuon, i.e.
TrackKey_t m_legacyTrackKey
Legacy track reconstruction chain.
MuonR4::ExpandedSector::SectorProjector SectorProjector
std::pair< double, double > calcSeedLength(const Acts::GeometryContext &tgContext, const MuonR4::MsTrackSeed &seed) const
Calculate the length of the seed and the theta deflection angle The length is defined as the spread o...
StatusCode execute(const EventContext &ctx) override final
Execute method.
SegmentTagVariables calcSegTagVariables(const xAOD::TrackParticle &idTrack, const EventContext &ctx)
MuonTagKey_t m_segTagKey
The collection of the original segment tags.
std::shared_ptr< MuonVal::IParticleFourMomBranch > ParticleBranchPtr_t
MuonVal::VectorBranch< char > & m_seedType
Is the seed in the encap or in the barrel chambers.
StatusCode dumpRecoContent(const EventContext &ctx)
Dump the reconstructed information.
SG::ReadHandleKey< MuonR4::MuonTagContainer > MuonTagKey_t
Abrivate the muon tag container.
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthKey
Key to the truth particle collection.
SG::ReadHandleKey< xAOD::TrackParticleContainer > TrackKey_t
Abrivate the key type for the track particle container.
Gaudi::Property< double > m_toleranceTheta
Extra tolerance applied on the bending direction when calculating the matching score.
Gaudi::Property< bool > m_isMC
Toggle whether the job runs on MC or not.
ParticleBranchPtr_t m_muonTrks
Stored muon information from the Acts muon reco chain.
MuonVal::MatrixBranch< unsigned short > & m_truthSegToRecoLink
Link of the truth segments to the matchin reco segments.
Gaudi::Property< double > m_toleranceX0
Extra tolerance applied on the non-bending intercept when calculating the matching score.
SegmentBranchPtr_t m_recoSegs
StatusCode dumpTruthContent(const EventContext &ctx)
Dump truth information.
SG::ReadHandleKey< MuonR4::MsTrackSeedContainer > m_msTrkSeedKey
Temporary container write handle to push the seeds to store gate for later efficiency analysis.
Gaudi::Property< bool > m_storeID
Toggle whether to process ID tracks or not.
SG::ReadDecorHandleKeyArray< SG::AuxVectorBase > m_trkTruthLinks
Decoration dependency to the MS truth track links.
ToolHandle< ActsTrk::IExtrapolationTool > m_extrapolationTool
Track extrapolation tool.
const MuonR4::MuonTag * findMuTagIMO(const xAOD::TrackParticle &idTrack, const EventContext &ctx) const
ParticleBranchPtr_t m_idTracks
Stored ID track information.
StatusCode initialize() override final
MuonVal::MatrixBranch< unsigned short > & m_seedRecoSegMatch
Link of the track seed to the building segment.
const xAOD::TruthParticle * truthTreeParticle(const xAOD::IParticle &part) const
Returns the matched truth particle that is dumped in the tree.
MuonVal::VectorBranch< float > & m_seedQP
Estimated momentum times charge from the track seed.
MuonVal::MatrixBranch< unsigned short > & m_truthMuToSeedCounter
Number of matched segments in the seed.
MuonVal::ThreeVectorBranch m_seedPos
Simple seed information.
Gaudi::Property< double > m_tolerancePhi
Extra tolerance applied on the bending direction when calculating the matching score.
SG::ReadHandleKey< xAOD::MuonSegmentContainer > SegmentKey_t
Abrivate the ReadHandleKey_t for the segment container.
MuonKey_t m_legacyMuonKey
Legacy muons.
MuonVal::VectorBranch< float > & m_seedLength
Maximum separation between the segments on the reference plane.
MuonVal::UnitThreeVectorBranch m_seedDir
Seed direction vector.
ToolHandle< MuonR4::ISegmentSelectionTool > m_segSelector
Selection tool to quantify the segment candidate quality.
SegmentKey_t m_recoSegmentKey
Primary segment container.
MuonVal::MuonTesterTree m_tree
The output tree object.
std::vector< const xAOD::MuonSegment * > getAssociatedSegments(const xAOD::TrackParticle &idTrack, const EventContext &ctx) const
Returns the collection of reconstructed segments that can be associated to the id track If the track ...
ActsTrk::ContextUtility m_ctxProvider
Context provider for geometry, magnetic field and calibration contexts.
AthHistogramAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
SegmentKey_t m_truthSegmentKey
Segment from the truth hits.
MuonVal::VectorBranch< char > & m_seedGood
Does the seeding tool construct valid parameters from the seed.
const Acts::Logger & logger() const
Return the reference to the Acts logger.
std::optional< MuonR4::MsTrackSeed > makeSeedFromTruth(const Acts::GeometryContext &tgContext, const xAOD::TruthParticle &truthMuon) const
Construct MS track seed from the truth associated segments.
StatusCode finalize() override final
std::shared_ptr< TrackSummaryModule > m_seedSummary
Hit summary on the track seed.
Gaudi::Property< double > m_toleranceY0
Extra tolerance applied on the bending intercept when calculating the matching score.
MuonVal::VectorBranch< unsigned short > & m_seedTruthLink
Link to the truth muon.
MuonKey_t m_muonKey
Dependency on the R4 muon container.
Property holding a SG store/key/clid from which a ReadHandle is made.
Class providing the definition of the 4-vector interface.
Lightweight algorithm to read xAOD MDT sim hits and (fast-digitised) drift circles from SG and fill a...
DecorHandleKeyArray< ReadDecorHandle< T, S >, ReadDecorHandleKey< T >, Gaudi::DataHandle::Reader > ReadDecorHandleKeyArray
TrackParticle_v1 TrackParticle
Reference the current persistent version:
TruthParticle_v1 TruthParticle
Typedef to implementation.
MuonSegment_v1 MuonSegment
Reference the current persistent version:
std::vector< float > matchScores
chi2 scores of the matching procedure
std::vector< std::uint8_t > recoSegs
Indices of the matched segments in the tree.
std::vector< std::uint8_t > taggedSeg
Flags indicating whether the segment made it onto MuTagIMO.
std::vector< float > deltaTheta
Difference in theta between ID and segment parameters.
std::vector< float > deltaX0
Difference in x0 between ID and segment parameters.
std::vector< float > deltaPhi
Difference in phi between ID and segment parameters.
std::vector< std::uint8_t > goodExtp
Is the extrapolation to the surface good.
std::vector< float > deltaY0
Difference in y0 between ID and segment parameters.