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