ATLAS Offline Software
MsTrackTester.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 #ifndef MUONTRACKFINDINGTEST_MSTRACKTESTER_H
5 #define MUONTRACKFINDINGTEST_MSTRACKTESTER_H
6 
9 
12 
13 
15 
23 
24 
27 
28 namespace MuonValR4{
30  public:
32 
33  StatusCode initialize() override final;
34  StatusCode execute() override final;
35  StatusCode finalize() override final;
36  private:
43  std::optional<MuonR4::MsTrackSeed> makeSeedFromTruth(const ActsTrk::GeometryContext& gctx,
44  const xAOD::TruthParticle& truthMuon) const;
46  std::pair<double, double> calcSeedLength(const ActsTrk::GeometryContext& gctx,
47  const MuonR4::MsTrackSeed& seed) const;
48 
50  MuonVal::MuonTesterTree m_tree{"MsTrackValidTest", "MuonTrackTester"};
53 
54  Gaudi::Property<bool> m_isMC{this, "isMC", false};
55 
56 
57  using TruthHitCol = std::unordered_set<const xAOD::MuonSimHit*>;
58 
61  SegmentKey_t m_truthSegmentKey{this, "TruthSegmentKey", "MuonTruthSegments"};
63  SegmentKey_t m_recoSegmentKey{this, "SegmentKey", "MuonSegmentsFromR4"};
65  SG::ReadHandleKey<xAOD::TruthParticleContainer> m_truthKey{this, "TruthKey", "MuonTruthParticles"};
69  SG::ReadHandleKey<MuonR4::MsTrackSeedContainer> m_msTrkSeedKey{this, "MsTrkSeedKey", "MsTrackSeeds"};
71  SG::ReadHandleKey<ActsTrk::GeometryContext> m_geoCtxKey{this, "AlignmentKey", "ActsAlignment", "cond handle key"};
73  SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCacheKey{this, "MagFieldKey", "fieldCondObj", "Name of the Magnetic Field conditions object key"};
74 
75 
76  std::unique_ptr<MuonR4::MsTrackSeeder> m_seeder{};
77  using ParticleBranchPtr_t = std::shared_ptr<MuonVal::IParticleFourMomBranch>;
79 
80  using SegmentBranchPtr_t = std::shared_ptr<MuonPRDTest::SegmentVariables>;
83 
93  MuonVal::VectorBranch<float>& m_seedQP{m_tree.newVector<float>("MsTrkSeed_qTimesP")};
94 
96  MuonVal::MatrixBranch<unsigned short>& m_seedRecoSegMatch{m_tree.newMatrix<unsigned short>("MsTrkSeed_segmentLinks")};
98  MuonVal::MatrixBranch<unsigned short>& m_truthSegToRecoLink{m_tree.newMatrix<unsigned short>("TruthSegments_recoSegLinks",-1)};
100  MuonVal::MatrixBranch<unsigned short>& m_truthMuToSeedIdx{m_tree.newMatrix<unsigned short>("TruthMuons_seedLinks", -1)};
104  MuonVal::MatrixBranch<unsigned short>& m_truthMuTruthSegLinks{m_tree.newMatrix<unsigned short>("TruthMuons_truthSegLinks")};
106  MuonVal::VectorBranch<unsigned short>& m_truthMuTruthNSegs{m_tree.newVector<unsigned short>("TruthMuons_nTruthSegments")};
108  MuonVal::MatrixBranch<unsigned short>& m_truthMuRecoSegLinks{m_tree.newMatrix<unsigned short>("TruthMuons_recoSegLinks")};
109  /*** @brief Length of the true segment seed */
116  ToolHandle<MuonR4::ISegmentSelectionTool> m_segSelector{this, "SegmentSelectionTool" , "" };
118  SG::ReadHandleKey<xAOD::TrackParticleContainer> m_legacyTrackKey{this,"LegacyTrackKey", "MuonSpectrometerTrackParticles"};
120  };
121 }
122 
123 
124 #endif
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
MuonValR4::MsTrackTester
Definition: MsTrackTester.h:29
MuonValR4::MsTrackTester::m_legacyTrks
ParticleBranchPtr_t m_legacyTrks
Definition: MsTrackTester.h:119
AthHistogramAlgorithm::AthHistogramAlgorithm
AthHistogramAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Definition: AthHistogramAlgorithm.cxx:31
MuonValR4::MsTrackTester::m_seedType
MuonVal::VectorBranch< char > & m_seedType
Is the seed in the encap or in the barrel chambers.
Definition: MsTrackTester.h:87
MuonGMR4::MuonDetectorManager
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonDetectorManager.h:62
MuonValR4::MsTrackTester::m_seedQP
MuonVal::VectorBranch< float > & m_seedQP
Estimated momentum times charge from the track seed.
Definition: MsTrackTester.h:93
MuonR4::MsTrackSeed
Definition: MsTrackSeed.h:18
MuonValR4::MsTrackTester::m_truthMuonsSeedLength
MuonVal::VectorBranch< float > & m_truthMuonsSeedLength
Definition: MsTrackTester.h:110
TruthParticleContainer.h
MsTrackSeeder.h
MuonTesterTreeDict.h
SG::HandleKeyArray
Definition: StoreGate/StoreGate/HandleKeyArray.h:45
MuonValR4::MsTrackTester::m_seedThetaCone
MuonVal::VectorBranch< float > & m_seedThetaCone
Maximum angular difference between the segments part of the seed.
Definition: MsTrackTester.h:91
MuonValR4::MsTrackTester::execute
StatusCode execute() override final
Definition: MsTrackTester.cxx:214
MuonVal::VectorBranch< char >
SG::ReadHandleKey< xAOD::MuonSegmentContainer >
MuonValR4::MsTrackTester::m_geoCtxKey
SG::ReadHandleKey< ActsTrk::GeometryContext > m_geoCtxKey
Dependency on the geometry alignment.
Definition: MsTrackTester.h:71
MuonVal::ThreeVectorBranch
Definition: ThreeVectorBranch.h:19
MuonR4::MsTrackSeed::Location
Location
Enum defining whether the seed is made in the endcap / barrel.
Definition: MsTrackSeed.h:21
MuonSegmentContainer.h
AthHistogramAlgorithm.h
MuonValR4::MsTrackTester::m_seedPos
MuonVal::ThreeVectorBranch m_seedPos
Simple seed information.
Definition: MsTrackTester.h:85
MuonValR4::MsTrackTester::m_tree
MuonVal::MuonTesterTree m_tree
Definition: MsTrackTester.h:50
MuonValR4::MsTrackTester::TruthHitCol
std::unordered_set< const xAOD::MuonSimHit * > TruthHitCol
Definition: MsTrackTester.h:57
MuonVal::MuonTesterTree
Definition: MuonTesterTree.h:30
MuonValR4::MsTrackTester::m_truthSegs
SegmentBranchPtr_t m_truthSegs
Definition: MsTrackTester.h:81
MuonValR4::MsTrackTester::m_seeder
std::unique_ptr< MuonR4::MsTrackSeeder > m_seeder
Definition: MsTrackTester.h:76
MuonValR4::MsTrackTester::m_truthSegmentKey
SegmentKey_t m_truthSegmentKey
Segment from the truth hits.
Definition: MsTrackTester.h:61
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
MuonValR4::MsTrackTester::m_segSelector
ToolHandle< MuonR4::ISegmentSelectionTool > m_segSelector
Segment selection tool to pick the good quality segments.
Definition: MsTrackTester.h:116
MuonValR4::MsTrackTester::makeSeedFromTruth
std::optional< MuonR4::MsTrackSeed > makeSeedFromTruth(const ActsTrk::GeometryContext &gctx, const xAOD::TruthParticle &truthMuon) const
Construct MS track seed from the truth associated segments.
Definition: MsTrackTester.cxx:42
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:37
ISegmentSelectionTool.h
MuonPatternContainer.h
MuonValR4::MsTrackTester::m_truthSegToRecoLink
MuonVal::MatrixBranch< unsigned short > & m_truthSegToRecoLink
Link of the truth segments to the matchin reco segments.
Definition: MsTrackTester.h:98
MsTrackSeed.h
MuonDetectorManager.h
MuonValR4::MsTrackTester::m_detMgr
const MuonGMR4::MuonDetectorManager * m_detMgr
Definition: MsTrackTester.h:52
MuonSimHitContainer.h
MuonValR4::MsTrackTester::m_isMC
Gaudi::Property< bool > m_isMC
Definition: MsTrackTester.h:54
MuonValR4::MsTrackTester::m_truthKey
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthKey
Key to the truth particle collection.
Definition: MsTrackTester.h:65
ActsTrk::GeometryContext
Definition: GeometryContext.h:28
MuonVal::MuonTesterTree::newVector
VectorBranch< T > & newVector(const std::string &name)
Creates new branches and returns their reference.
AthHistogramAlgorithm
Definition: AthHistogramAlgorithm.h:32
MuonValR4::MsTrackTester::m_fieldCacheKey
SG::ReadCondHandleKey< AtlasFieldCacheCondObj > m_fieldCacheKey
Dependency on the magnetic field.
Definition: MsTrackTester.h:73
MuonValR4::MsTrackTester::finalize
StatusCode finalize() override final
Definition: MsTrackTester.cxx:329
MuonValR4::MsTrackTester::calcSeedLength
std::pair< double, double > calcSeedLength(const ActsTrk::GeometryContext &gctx, const MuonR4::MsTrackSeed &seed) const
Definition: MsTrackTester.cxx:79
MuonValR4::MsTrackTester::ParticleBranchPtr_t
std::shared_ptr< MuonVal::IParticleFourMomBranch > ParticleBranchPtr_t
Definition: MsTrackTester.h:77
MuonValR4
Lightweight algorithm to read xAOD MDT sim hits and (fast-digitised) drift circles from SG and fill a...
Definition: IPatternVisualizationTool.h:23
MuonValR4::MsTrackTester::m_recoSegs
SegmentBranchPtr_t m_recoSegs
Definition: MsTrackTester.h:82
MuonValR4::MsTrackTester::m_truthMuRecoSegLinks
MuonVal::MatrixBranch< unsigned short > & m_truthMuRecoSegLinks
Links from the truth muon to the segments
Definition: MsTrackTester.h:108
MuonValR4::MsTrackTester::m_legacyTrackKey
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_legacyTrackKey
Legacy track reconstruction chain.
Definition: MsTrackTester.h:118
python.TruthMuonD3PDObject.truthMuon
truthMuon
Definition: TruthMuonD3PDObject.py:51
SG::ReadCondHandleKey< AtlasFieldCacheCondObj >
MuonValR4::MsTrackTester::m_msTrkSeedKey
SG::ReadHandleKey< MuonR4::MsTrackSeedContainer > m_msTrkSeedKey
Temporary container write handle to push the seeds to store gate for later efficiency analysis.
Definition: MsTrackTester.h:69
MuonValR4::MsTrackTester::m_truthMuonQP
MuonVal::VectorBranch< float > & m_truthMuonQP
Estimated Q x P from the seeder algorithm class
Definition: MsTrackTester.h:114
MuonValR4::MsTrackTester::m_seedRecoSegMatch
MuonVal::MatrixBranch< unsigned short > & m_seedRecoSegMatch
Link of the track seed to the building segment
Definition: MsTrackTester.h:96
MuonValR4::MsTrackTester::m_truthMuToSeedIdx
MuonVal::MatrixBranch< unsigned short > & m_truthMuToSeedIdx
Links to all MsTrkSeeds that could be matched to the truthMuon, i.e.
Definition: MsTrackTester.h:100
MuonVal::MatrixBranch< unsigned short >
MuonValR4::MsTrackTester::m_truthMuToSeedCounter
MuonVal::MatrixBranch< unsigned short > & m_truthMuToSeedCounter
Corresponding matching counter of reconstructed segments.
Definition: MsTrackTester.h:102
MuonValR4::MsTrackTester::m_recoSegmentKey
SegmentKey_t m_recoSegmentKey
Primary segment container.
Definition: MsTrackTester.h:63
MuonValR4::MsTrackTester::m_trkTruthLinks
SG::ReadDecorHandleKeyArray< SG::AuxVectorBase > m_trkTruthLinks
Decoration dependency to the MS truth track links.
Definition: MsTrackTester.h:67
MuonR4::MsTrackSeeder::SectorProjector
SectorProjector
Enumeration to select the sector projection.
Definition: MsTrackSeeder.h:60
SegmentVariables.h
MuonValR4::MsTrackTester::SegmentBranchPtr_t
std::shared_ptr< MuonPRDTest::SegmentVariables > SegmentBranchPtr_t
Definition: MsTrackTester.h:80
MuonVal::MuonTesterTree::newMatrix
MatrixBranch< T > & newMatrix(const std::string &name)
MuonValR4::MsTrackTester::m_truthTrks
ParticleBranchPtr_t m_truthTrks
Definition: MsTrackTester.h:78
MuonValR4::MsTrackTester::m_truthMuonsSeedCone
MuonVal::VectorBranch< float > & m_truthMuonsSeedCone
Angular deviation of the true segment seed.
Definition: MsTrackTester.h:112
ReadDecorHandleKeyArray.h
TrackParticleContainer.h
MuonValR4::MsTrackTester::m_seedLength
MuonVal::VectorBranch< float > & m_seedLength
Maximum separation between the segments on the reference plane.
Definition: MsTrackTester.h:89
MuonValR4::MsTrackTester::m_truthMuTruthNSegs
MuonVal::VectorBranch< unsigned short > & m_truthMuTruthNSegs
Number of associated truth muon segments.
Definition: MsTrackTester.h:106
MuonValR4::MsTrackTester::initialize
StatusCode initialize() override final
Definition: MsTrackTester.cxx:98
MuonValR4::MsTrackTester::m_truthMuTruthSegLinks
MuonVal::MatrixBranch< unsigned short > & m_truthMuTruthSegLinks
Links from the truth muon to the segments
Definition: MsTrackTester.h:104