ATLAS Offline Software
RecoToTruthAssociationAlg.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TRUTHPARTICLEALGS_RecoToTruthAssociationAlg_H
6 #define TRUTHPARTICLEALGS_RecoToTruthAssociationAlg_H
7 
9 #include "GaudiKernel/ServiceHandle.h"
13 #include "xAODMuon/MuonContainer.h"
15 
16 
17 namespace Muon {
19 public:
20  // Constructor with parameters:
21  using AthReentrantAlgorithm::AthReentrantAlgorithm;
22 
23  // Basic algorithm methods:
24  StatusCode initialize() override;
25  StatusCode execute(const EventContext& ctx) const override;
26 
27 private:
30  this, "MuonTruthParticleContainerName", "MuonTruthParticles"};
31 
33  this, "MuonContainerName", "Muons",
34  "container name for muon truth particles; the full handle name, including the reco muon link auxdata, is set in initialize()"};
35 
37  this, "MuonTruthParticleRecoLink", m_truthMuKey, "",
38  "container name for muon truth particles; the full handle name, including the reco muon link auxdata, is set in initialize()"};
40  this, "MuonTruthParticleLink", m_recoMuKey, "truthParticleLink",
41  "muon truth particle link auxdata name; name will be reset in initialize() based on m_muonName"};
43  this, "MuonTruthParticleType", m_recoMuKey, "truthType",
44  "muon truth type auxdata name; name will be reset in initialize() based on m_muonName"};
46  this, "MuonTruthParticleOrigin", m_recoMuKey, "truthOrigin",
47  "muon truth origin auxdata name; name will be reset in initialize() based on m_muonName"};
49  this, "MuonTruthParticleNPrecMatched", m_recoMuKey, "nprecMatchedHitsPerChamberLayer",
50  "muon vector of number of precision matched hits per chamber layer auxdata name; name will be reset in initialize() based on "
51  "m_muonName"};
53  this, "MuonTruthParticleNPhiMatched", m_recoMuKey, "nphiMatchedHitsPerChamberLayer",
54  "muon vector of number of phi matched hits per chamber layer auxdata name; name will be reset in initialize() based on m_muonName"};
56  this, "MuonTruthParticleNTrigEtaMatched", m_recoMuKey, "ntrigEtaMatchedHitsPerChamberLayer",
57  "muon vector of number of phi matched hits per chamber layer auxdata name; name will be reset in initialize() based on m_muonName"};
58 
59 
61  this, "TrkTruthLinkKeys", {},
62  "Declare the decoration dependencies of this algorithm. Steer via TrackContainers property"};
63  Gaudi::Property<std::vector<std::string>> m_assocTrkContainers{this, "TrackContainers", {"CombinedMuonTrackParticles",
64  "ExtrapolatedMuonTrackParticles",
65  "MSOnlyExtrapolatedMuonTrackParticles"},
66  "Collection of track containers to be decorated before this alg can be scheduled. truthLink decoration exploited "};
67  Gaudi::Property<std::string> m_recoLink{this, "RecoLinkName", "recoMuonLink" , "Decoration to the truth particle pointing to the muon"};
68  Gaudi::Property<bool> m_associateWithInDetTP{this, "AssociateWithInDetTP", false, "force use of ID track particles for association"};
69 
70  ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
71 
72  void count_chamber_layers(const xAOD::IParticle* truth_particle, const Trk::Track* ptrk,
73  std::vector<unsigned int>& nprecHitsPerChamberLayer, std::vector<unsigned int>& nphiHitsPerChamberLayer,
74  std::vector<unsigned int>& ntrigEtaHitsPerChamberLayer) const;
75  void clear_dummys(const std::vector<unsigned long long>& identifiers, std::vector<unsigned int>& vec) const;
76 
77 };
78 }
79 #endif // TRUTHPARTICLEALGS_MUONTRUTHDECORATIONALG_H
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer >
Muon::RecoToTruthAssociationAlg::m_muonTruthParticleNPhiMatched
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_muonTruthParticleNPhiMatched
Definition: RecoToTruthAssociationAlg.h:52
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
TruthParticleContainer.h
Muon::RecoToTruthAssociationAlg::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: RecoToTruthAssociationAlg.h:70
SG::HandleKeyArray
Definition: StoreGate/StoreGate/HandleKeyArray.h:38
Muon::RecoToTruthAssociationAlg::m_muonTruthParticleNPrecMatched
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_muonTruthParticleNPrecMatched
Definition: RecoToTruthAssociationAlg.h:48
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:9
SG::ReadHandleKey< xAOD::TruthParticleContainer >
Muon
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
Definition: TrackSystemController.h:45
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:41
Muon::RecoToTruthAssociationAlg::count_chamber_layers
void count_chamber_layers(const xAOD::IParticle *truth_particle, const Trk::Track *ptrk, std::vector< unsigned int > &nprecHitsPerChamberLayer, std::vector< unsigned int > &nphiHitsPerChamberLayer, std::vector< unsigned int > &ntrigEtaHitsPerChamberLayer) const
Definition: RecoToTruthAssociationAlg.cxx:253
Muon::RecoToTruthAssociationAlg::m_assocTrkContainers
Gaudi::Property< std::vector< std::string > > m_assocTrkContainers
Definition: RecoToTruthAssociationAlg.h:63
Muon::RecoToTruthAssociationAlg::m_associateWithInDetTP
Gaudi::Property< bool > m_associateWithInDetTP
Definition: RecoToTruthAssociationAlg.h:68
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:74
Muon::RecoToTruthAssociationAlg::m_muonTruthParticleType
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_muonTruthParticleType
Definition: RecoToTruthAssociationAlg.h:42
WriteDecorHandleKey.h
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Muon::RecoToTruthAssociationAlg::m_truthMuKey
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthMuKey
Key to the filtered muon truth particles
Definition: RecoToTruthAssociationAlg.h:29
Muon::RecoToTruthAssociationAlg::initialize
StatusCode initialize() override
Definition: RecoToTruthAssociationAlg.cxx:47
AthReentrantAlgorithm.h
Muon::RecoToTruthAssociationAlg::execute
StatusCode execute(const EventContext &ctx) const override
Definition: RecoToTruthAssociationAlg.cxx:78
Muon::RecoToTruthAssociationAlg::m_recoMuKey
SG::ReadHandleKey< xAOD::MuonContainer > m_recoMuKey
Definition: RecoToTruthAssociationAlg.h:32
Muon::RecoToTruthAssociationAlg::clear_dummys
void clear_dummys(const std::vector< unsigned long long > &identifiers, std::vector< unsigned int > &vec) const
Definition: RecoToTruthAssociationAlg.cxx:353
Muon::RecoToTruthAssociationAlg::m_muonTruthRecoLink
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > m_muonTruthRecoLink
Definition: RecoToTruthAssociationAlg.h:36
Muon::RecoToTruthAssociationAlg::m_muonTruthParticleNTrigEtaMatched
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_muonTruthParticleNTrigEtaMatched
Definition: RecoToTruthAssociationAlg.h:55
MuonContainer.h
InDetSimDataHelpers::identifiers
std::vector< Identifier > identifiers(const InDetSimDataCollection &coll)
Definition: InDetSimDataDict.h:15
Muon::RecoToTruthAssociationAlg::m_muonTruthParticleLink
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_muonTruthParticleLink
Definition: RecoToTruthAssociationAlg.h:39
Muon::RecoToTruthAssociationAlg
Definition: RecoToTruthAssociationAlg.h:18
Muon::RecoToTruthAssociationAlg::m_inputDecorKey
SG::ReadDecorHandleKeyArray< xAOD::IParticleContainer > m_inputDecorKey
Definition: RecoToTruthAssociationAlg.h:60
Muon::RecoToTruthAssociationAlg::m_muonTruthParticleOrigin
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_muonTruthParticleOrigin
Definition: RecoToTruthAssociationAlg.h:45
Muon::RecoToTruthAssociationAlg::m_recoLink
Gaudi::Property< std::string > m_recoLink
Definition: RecoToTruthAssociationAlg.h:67
ReadDecorHandleKeyArray.h
IMuonIdHelperSvc.h
ServiceHandle< Muon::IMuonIdHelperSvc >