ATLAS Offline Software
Loading...
Searching...
No Matches
BuildTruthTaus.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 TAUANALYSISTOOLS_BUILDTRUTHTAUS_H
6#define TAUANALYSISTOOLS_BUILDTRUTHTAUS_H
7
8/*
9 author: Dirk Duschinger
10 documentation: https://gitlab.cern.ch/atlas/athena/-/blob/main/PhysicsAnalysis/TauID/TauAnalysisTools/doc/README-TauTruthMatchingTool.rst
11*/
12
13// Framework include(s):
21// dummy EventContext for AnalysisBase
23
24// Core include(s):
26
27// EDM include(s):
29
30// Local include(s):
32
33namespace TauAnalysisTools
34{
35
39{
43
44public:
45
46 struct TruthTausEvent
47 : public ITruthTausEvent
48 {
49 const xAOD::TruthParticleContainer* m_xTruthTauContainerConst = nullptr;
50 const xAOD::TruthParticleContainer* m_xTruthMuonContainerConst = nullptr;
51 const xAOD::TruthParticleContainer* m_xTruthElectronContainerConst = nullptr;
52 const xAOD::JetContainer* m_xTruthJetContainerConst = nullptr;
53 xAOD::TruthParticleContainer* m_xTruthTauContainer = nullptr;
54 xAOD::TruthParticleAuxContainer* m_xTruthTauAuxContainer = nullptr;
55 const xAOD::TruthParticleContainer* m_xTruthParticleContainer = nullptr;
56 };
57
58 BuildTruthTaus( const std::string& name );
59
60 virtual ~BuildTruthTaus() = default;
61
62 // initialize the tool
63 virtual StatusCode initialize() override;
64
65 virtual void setTruthMatchingMode() override {
67 };
68
69 virtual StatusCode retrieveTruthTaus() override;
70 virtual StatusCode retrieveTruthTaus(ITruthTausEvent& truthTausEvent, const EventContext& ctx) const override;
71
72
73protected:
74 StatusCode retrieveTruthTaus(TruthTausEvent& truthTausEvent, const EventContext& ctx) const;
75
76
77private:
78
80 {
81 size_t m_iNChargedPions = 0;
82 size_t m_iNNeutralPions = 0;
86 std::vector<int> m_vDecayMode;
87 // default false, if there is a hadron in decay products, it is switched to true
88 bool m_bIsHadronicTau = false;
89
90 // truth visible kinematic variables
91 TLorentzVector m_vTruthVisTLV;
92 TLorentzVector m_vTruthVisTLVCharged;
93 TLorentzVector m_vTruthVisTLVNeutral;
94
95 // truth vertices
97 TVector3 m_vProdVertex;
98
99 };
100
101
102 StatusCode buildTruthTausFromTruthParticles(TruthTausEvent& truthTausEvent, const EventContext& ctx) const;
103 StatusCode examineTruthTau(const xAOD::TruthParticle& xTruthParticle) const;
104 StatusCode examineTruthTauDecay(const xAOD::TruthParticle& xTruthParticle,
105 TauTruthInfo& truthInfo) const;
106 void printDecay(const xAOD::TruthParticle& xTruthParticle, int depth = 0) const;
107
108protected:
109
110 TruthTausEvent m_truthTausEvent;
111
112 // temporary, drop at the first occasion
114
115private:
116
117 // properties
118 Gaudi::Property<bool> m_bWriteInvisibleFourMomentum{ this, "WriteInvisibleFourMomentum", false};
119 Gaudi::Property<bool> m_bWriteVisibleChargedFourMomentum{ this, "WriteVisibleChargedFourMomentum", false};
120 Gaudi::Property<bool> m_bWriteVisibleNeutralFourMomentum{ this, "WriteVisibleNeutralFourMomentum", false};
121 Gaudi::Property<bool> m_bWriteDecayModeVector{ this, "WriteDecayModeVector", true};
122 Gaudi::Property<bool> m_bWriteVertices{ this, "WriteVertices", true};
123
124 // input containers
125 SG::ReadHandleKey<xAOD::TruthParticleContainer> m_truthTauInputContainer { this, "TruthTauContainerName", "TruthTaus", "Truth tau input container name (truth matching mode)" };
126 SG::ReadHandleKey<xAOD::TruthParticleContainer> m_truthParticleContainer { this, "TruthParticleContainerName", "TruthParticles", "Truth particles input container name" };
127 SG::ReadHandleKey<xAOD::TruthParticleContainer> m_truthElectronContainer { this, "TruthElectronContainerName", "TruthElectrons", "Truth electrons input container name" };
128 SG::ReadHandleKey<xAOD::TruthParticleContainer> m_truthMuonContainer { this, "TruthMuonContainerName", "TruthMuons", "Truth muons input container name" };
129 SG::ReadHandleKey<xAOD::JetContainer> m_truthJetContainer { this, "TruthJetContainerName", "AntiKt4TruthDressedWZJets", "Truth jets input container name" };
130 // output container
131 SG::WriteHandleKey<xAOD::TruthParticleContainer> m_truthTauOutputContainer { this, "NewTruthTauContainerName", "TruthTaus", "Truth tau output container name" };
132
133 // decorations to be read from TruthParticles and copied onto TruthTaus
134 SG::ReadDecorHandleKey<xAOD::TruthParticleContainer> m_originReadDecorKey {this, "inputClassifierParticleOrigin", "TruthParticles.classifierParticleOrigin", "Particle origin"};
135 SG::ReadDecorHandleKey<xAOD::TruthParticleContainer> m_typeReadDecorKey {this, "inputClassifierParticleType", "TruthParticles.classifierParticleType", "Particle type"};
136 SG::ReadDecorHandleKey<xAOD::TruthParticleContainer> m_outcomeReadDecorKey {this, "inputClassifierParticleOutCome", "TruthParticles.classifierParticleOutCome", "Particle outcome"};
137 SG::ReadDecorHandleKey<xAOD::TruthParticleContainer> m_classificationReadDecorKey {this, "inputClassification", "TruthParticles.Classification", "Classification code"};
138
139 SG::WriteDecorHandleKey<xAOD::TruthParticleContainer> m_linkDecoratorKey {this, "originalTruthParticle", "TruthTaus.originalTruthParticle", "Name of the decoration linking to the original truth particle"};
140 SG::WriteDecorHandleKey<xAOD::TruthParticleContainer> m_originDecoratorKey {this, "classifierParticleOrigin", "TruthTaus.classifierParticleOrigin", "Name of the decoration which records the particle origin"};
141 SG::WriteDecorHandleKey<xAOD::TruthParticleContainer> m_typeDecoratorKey {this, "classifierParticleType", "TruthTaus.classifierParticleType", "Name of the decoration which records the particle type"};
142 SG::WriteDecorHandleKey<xAOD::TruthParticleContainer> m_outcomeDecoratorKey {this, "classifierParticleOutCome", "TruthTaus.classifierParticleOutCome", "Name of the decoration which records the particle outcome"};
143 SG::WriteDecorHandleKey<xAOD::TruthParticleContainer> m_classificationDecoratorKey {this, "Classification", "TruthTaus.Classification", "Name of the decoration which records the particle classification"};
144
146
147}; // class BuildTruthTaus
148
149}
150#endif // TAUANALYSISTOOLS_BUILDTRUTHTAUS_H
#define ASG_TOOL_CLASS(CLASSNAME, INT1)
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid from which a WriteHandle is made.
ATLAS-specific HepMC functions.
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
Property holding a SG store/key/clid from which a WriteHandle is made.
virtual void setTruthMatchingMode() override
Gaudi::Property< bool > m_bWriteDecayModeVector
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthElectronContainer
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthMuonContainer
void printDecay(const xAOD::TruthParticle &xTruthParticle, int depth=0) const
SG::ReadDecorHandleKey< xAOD::TruthParticleContainer > m_outcomeReadDecorKey
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthParticleContainer
SG::ReadDecorHandleKey< xAOD::TruthParticleContainer > m_originReadDecorKey
SG::ReadHandleKey< xAOD::JetContainer > m_truthJetContainer
Gaudi::Property< bool > m_bWriteVisibleChargedFourMomentum
ASG_TOOL_CLASS(BuildTruthTaus, TauAnalysisTools::IBuildTruthTaus) public BuildTruthTaus(const std::string &name)
Create a proper constructor for Athena.
Gaudi::Property< bool > m_bWriteVertices
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > m_originDecoratorKey
SG::ReadDecorHandleKey< xAOD::TruthParticleContainer > m_classificationReadDecorKey
virtual ~BuildTruthTaus()=default
SG::ReadDecorHandleKey< xAOD::TruthParticleContainer > m_typeReadDecorKey
virtual StatusCode retrieveTruthTaus() override
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > m_linkDecoratorKey
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > m_typeDecoratorKey
Gaudi::Property< bool > m_bWriteInvisibleFourMomentum
Gaudi::Property< bool > m_bWriteVisibleNeutralFourMomentum
StatusCode examineTruthTauDecay(const xAOD::TruthParticle &xTruthParticle, TauTruthInfo &truthInfo) const
SG::WriteHandleKey< xAOD::TruthParticleContainer > m_truthTauOutputContainer
virtual StatusCode initialize() override
StatusCode examineTruthTau(const xAOD::TruthParticle &xTruthParticle) const
StatusCode buildTruthTausFromTruthParticles(TruthTausEvent &truthTausEvent, const EventContext &ctx) const
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthTauInputContainer
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > m_classificationDecoratorKey
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > m_outcomeDecoratorKey
Declare the interface that the class provides.
Base class for dual-use tools that provide file metadata access.
std::string depth
tag string for intendation
Definition fastadd.cxx:46
TruthParticleAuxContainer_v2 TruthParticleAuxContainer
Declare the latest version of the truth particle auxiliary container.
TruthParticle_v1 TruthParticle
Typedef to implementation.
JetContainer_v1 JetContainer
Definition of the current "jet container version".
TruthParticleContainer_v1 TruthParticleContainer
Declare the latest version of the truth particle container.