ATLAS Offline Software
TrackTruthDecoratorAlg.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 TRACK_TRUTH_DECORATOR_ALG_HH
6 #define TRACK_TRUTH_DECORATOR_ALG_HH
7 
9 #include "GaudiKernel/ToolHandle.h"
13 
16 #include "xAODMuon/MuonContainer.h"
19 
20 
21 namespace FlavorTagDiscriminants {
22 
24  public:
25  TrackTruthDecoratorAlg(const std::string& name,
26  ISvcLocator* pSvcLocator );
27 
28  virtual StatusCode initialize() override;
29  virtual StatusCode execute(const EventContext& ) const override;
30 
31  private:
32  // Input Containers
34  this, "trackContainer", "InDetTrackParticles",
35  "Key for the input track collection"};
37  this, "muonContainer", "Muons",
38  "Key for the input muon collection"};
39 
40  // Accessors for truth particles
43  this, "acc_ftagTruthTypeLabel", "ftagTruthTypeLabel",
44  "Accessor for the truth type label of the truth particle"};
46  this, "acc_ftagTruthSourceLabel", "ftagTruthSourceLabel",
47  "Accessor for the truth label for the source of secondary particles"};
49  this, "acc_ftagTruthVertexIndex", "ftagTruthVertexIndex",
50  "Accessor for the vertex index of the truth particle"};
52  this, "acc_ftagTruthParentBarcode", "ftagTruthParentBarcode",
53  "Accessor for the uniqueID of the parent of linked truth particle"};
54 
55  // Decorators for tracks
58  this, "dec_ftagTruthOriginLabel", "ftagTruthOriginLabel",
59  "Exclusive origin label of the track"};
61  this, "dec_ftagTruthTypeLabel", "ftagTruthTypeLabel",
62  "Exclusive truth type label of the track"};
64  this, "dec_ftagTruthSourceLabel", "ftagTruthSourceLabel",
65  "Exclusive truth label for the source of secondary tracks"};
67  this, "dec_ftagTruthVertexIndex", "ftagTruthVertexIndex",
68  "ftagTruth vertex index of the track"};
70  this, "dec_ftagTruthBarcode", "ftagTruthBarcode",
71  "UniqueID of linked truth particle"};
73  this, "dec_ftagTruthParentBarcode", "ftagTruthParentBarcode",
74  "UniqueID of parent of linked truth particle"};
76  this, "dec_ftagTruthMuonOriginLabel", "ftagTruthMuonOriginLabel",
77  "Exclusive origin label of the muon"};
78 
79 
80  // Truth origin tool
81  ToolHandle<InDet::InDetTrackTruthOriginTool> m_trackTruthOriginTool {
82  this, "trackTruthOriginTool", "InDet::InDetTrackTruthOriginTool",
83  "track truth origin tool"};
84  // Truth Lepton Origin tool (https://gitlab.cern.ch/atlas/athena/-/tree/main/PhysicsAnalysis/AnalysisCommon/TruthClassification)
85  ToolHandle<CP::IClassificationTool> m_truthLeptonTool{
86  this, "truthLeptonTool", "",
87  "Lepton truth classification tool"};
88 
89  // Defining a map for proper muon origin labels
90  std::unordered_map<Truth::Type,unsigned int> m_muTruthMap = {
91  {Truth::Type::Unknown, 0}, //Fake(Uknown) muon
92  {Truth::Type::KnownUnknown, 1}, //KnownUknown muon
93  {Truth::Type::PromptMuon, 2}, //Prompt muon
94  {Truth::Type::BHadronDecay, 3}, //From B muon
95  // FromBC and FromC decay label are handled in the implementation since FromBC is not directly available for TruthClassificationTool
96  // FromBC and FromC decay label are handled in the implementation since FromBC is not directly available for TruthClassificationTool
97  {Truth::Type::LightFlavorDecay, 6}, //From light muon
98  {Truth::Type::TauDecay, 7}, //From tau muon
99  {Truth::Type::TauDecayLike, 8}, //4-like muons
100  {Truth::Type::BHadronDecayLike, 8}, //4-like muons
101  {Truth::Type::CHadronDecayLike, 8}, //4-like muons
102  {Truth::Type::NonMuonlike, 8}, //Non-muons like muons
103  // There are also cases where the muon has the truth particle associated to the ID track that is not a muon. Those muons are labelled as 9 (NotInnerDetector muons)
104  };
105  };
106 }
107 
108 #endif
TruthParticleContainerFwd.h
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer >
FlavorTagDiscriminants::TrackTruthDecoratorAlg::m_dec_source_label
WDHK m_dec_source_label
Definition: TrackTruthDecoratorAlg.h:63
FlavorTagDiscriminants::TrackTruthDecoratorAlg::m_acc_vertex_index
RDHK m_acc_vertex_index
Definition: TrackTruthDecoratorAlg.h:48
ReadDecorHandleKey.h
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
FlavorTagDiscriminants
Definition: BacklinkAlg.h:15
Truth::Type::LightFlavorDecay
@ LightFlavorDecay
FlavorTagDiscriminants::TrackTruthDecoratorAlg::m_TrackContainerKey
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_TrackContainerKey
Definition: TrackTruthDecoratorAlg.h:33
FlavorTagDiscriminants::TrackTruthDecoratorAlg::m_acc_parent_uniqueID
RDHK m_acc_parent_uniqueID
Definition: TrackTruthDecoratorAlg.h:51
Truth::Type::TauDecayLike
@ TauDecayLike
FlavorTagDiscriminants::TrackTruthDecoratorAlg::m_truthLeptonTool
ToolHandle< CP::IClassificationTool > m_truthLeptonTool
Definition: TrackTruthDecoratorAlg.h:85
FlavorTagDiscriminants::TrackTruthDecoratorAlg
Definition: TrackTruthDecoratorAlg.h:23
SG::ReadHandleKey< xAOD::TrackParticleContainer >
FlavorTagDiscriminants::TrackTruthDecoratorAlg::m_muTruthMap
std::unordered_map< Truth::Type, unsigned int > m_muTruthMap
Definition: TrackTruthDecoratorAlg.h:90
Truth::Type::BHadronDecayLike
@ BHadronDecayLike
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:74
FlavorTagDiscriminants::TrackTruthDecoratorAlg::m_dec_type_label
WDHK m_dec_type_label
Definition: TrackTruthDecoratorAlg.h:60
WriteDecorHandleKey.h
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
Truth::Type::TauDecay
@ TauDecay
Truth::Type::Unknown
@ Unknown
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
FlavorTagDiscriminants::TrackTruthDecoratorAlg::m_trackTruthOriginTool
ToolHandle< InDet::InDetTrackTruthOriginTool > m_trackTruthOriginTool
Definition: TrackTruthDecoratorAlg.h:81
Truth::Type::BHadronDecay
@ BHadronDecay
AthReentrantAlgorithm.h
FlavorTagDiscriminants::TrackTruthDecoratorAlg::m_acc_type_label
RDHK m_acc_type_label
Definition: TrackTruthDecoratorAlg.h:42
Truth::Type::NonMuonlike
@ NonMuonlike
Truth::Type::KnownUnknown
@ KnownUnknown
FlavorTagDiscriminants::TrackTruthDecoratorAlg::m_MuonContainerKey
SG::ReadHandleKey< xAOD::MuonContainer > m_MuonContainerKey
Definition: TrackTruthDecoratorAlg.h:36
FlavorTagDiscriminants::TrackTruthDecoratorAlg::TrackTruthDecoratorAlg
TrackTruthDecoratorAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: TrackTruthDecoratorAlg.cxx:25
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
FlavorTagDiscriminants::TrackTruthDecoratorAlg::m_dec_vertex_index
WDHK m_dec_vertex_index
Definition: TrackTruthDecoratorAlg.h:66
TruthClassificationTool.h
FlavorTagDiscriminants::TrackTruthDecoratorAlg::m_dec_parent_uniqueID
WDHK m_dec_parent_uniqueID
Definition: TrackTruthDecoratorAlg.h:72
InDetTrackTruthOriginTool.h
MuonContainer.h
FlavorTagDiscriminants::TrackTruthDecoratorAlg::m_dec_muon_origin_label
WDHK m_dec_muon_origin_label
Definition: TrackTruthDecoratorAlg.h:75
FlavorTagDiscriminants::TrackTruthDecoratorAlg::execute
virtual StatusCode execute(const EventContext &) const override
Definition: TrackTruthDecoratorAlg.cxx:74
FlavorTagDiscriminants::TrackTruthDecoratorAlg::m_acc_source_label
RDHK m_acc_source_label
Definition: TrackTruthDecoratorAlg.h:45
Truth::Type::CHadronDecayLike
@ CHadronDecayLike
FlavorTagDiscriminants::TrackTruthDecoratorAlg::initialize
virtual StatusCode initialize() override
Definition: TrackTruthDecoratorAlg.cxx:29
SG::ReadDecorHandleKey< xAOD::TruthParticleContainer >
TruthEventContainer.h
Truth::Type::PromptMuon
@ PromptMuon
AuxElement.h
Base class for elements of a container that can have aux data.
FlavorTagDiscriminants::TrackTruthDecoratorAlg::m_dec_uniqueID
WDHK m_dec_uniqueID
Definition: TrackTruthDecoratorAlg.h:69
FlavorTagDiscriminants::TrackTruthDecoratorAlg::m_dec_origin_label
WDHK m_dec_origin_label
Definition: TrackTruthDecoratorAlg.h:57