ATLAS Offline Software
Loading...
Searching...
No Matches
egammaTruthAssociationAlg.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 EGAMMAALGS_EGAMMATRUTHASSOCIATIONALG_H
6#define EGAMMAALGS_EGAMMATRUTHASSOCIATIONALG_H
7
9#include "GaudiKernel/EventContext.h"
10#include "GaudiKernel/ToolHandle.h"
14
21
23
29
30#include <string>
31
39
41{
42
43public:
44
46 egammaTruthAssociationAlg(const std::string& name, ISvcLocator* pSvcLocator);
47
49 virtual ~egammaTruthAssociationAlg() = default;
50
52 virtual StatusCode initialize() override final;
54 virtual StatusCode finalize() override final;
55
57 virtual StatusCode execute(const EventContext& ctx) const override final;
58
66
69 template<class T>
71 const std::string& name);
72
74 template<class T>
76 {
78 const EventContext& ctx); // constructor
79
84
85 // any of the handles should function as a read handle, choice is arbitrary
87 };
88
92 template<class T, class L>
93 StatusCode match(const EventContext& ctx,
94 const xAOD::TruthParticleContainer& truthParticles,
96 const SG::AuxElement::Accessor<L>& linkAccess,
97 xAOD::TruthParticleContainer* egammaTruthContainer) const;
98
102 template<class T>
103 MCTruthInfo_t particleTruthClassifier(const EventContext& ctx,
104 const T*) const;
105
109 const EventContext& ctx,
110 xAOD::TruthParticleContainer& egammaTruthContainer,
111 const xAOD::TruthParticle* truth,
112 const xAOD::TruthParticleContainer* oldContainer) const;
113
116 bool isPromptEgammaParticle(const EventContext& ctx,
117 const xAOD::TruthParticle* truth) const;
118
120 Gaudi::Property<bool> m_doEgammaTruthContainer{
121 this,
122 "CreateEgammaTruthContainer",
123 true,
124 "Create egammaTruthContainer?"
125 };
126
128 Gaudi::Property<bool> m_matchElectrons{ this,
129 "MatchElectrons",
130 true,
131 "Match (central) electrons?" };
132
134 Gaudi::Property<bool> m_matchPhotons{ this,
135 "MatchPhotons",
136 true,
137 "Match photons?" };
138
140 Gaudi::Property<bool> m_matchForwardElectrons{ this,
141 "MatchForwardElectrons",
142 true,
143 "Match forward electrons?" };
144
146 Gaudi::Property<bool> m_matchClusters{ this,
147 "MatchClusters",
148 false,
149 "Match clusters?" };
150
153 this,
154 "DoNotSet_ClusterContainerName",
155 {},
156 "Do not set; configuration via the string property"
157 };
158
161 Gaudi::Property<std::string> m_clusterDecName{
162 this,
163 "ClusterContainerName",
164 "",
165 "Name of the egamma cluster container"
166 };
167
170 this,
171 "DoNotSet_ElectronContainerName",
172 {},
173 "Do not set; configuration via the string property"
174 };
175
178 Gaudi::Property<std::string> m_electronDecName{
179 this,
180 "ElectronContainerName",
181 "",
182 "Name of the input electron container"
183 };
184
187 this,
188 "DoNotSet_FwdElectronContainerName",
189 {},
190 "Do not set; configuration via the string property"
191 };
192
195 Gaudi::Property<std::string> m_fwdElectronDecName{
196 this,
197 "FwdElectronContainerName",
198 "",
199 "Name of the input fwd electron container"
200 };
201
204 this,
205 "DoNotSet_PhotonContainerName",
206 {},
207 "Do not set; configuration via the string property"
208 };
209
212 Gaudi::Property<std::string> m_photonDecName{
213 this,
214 "PhotonContainerName",
215 "",
216 "Name of the input photon container"
217 };
218
221 this,
222 "TruthEventContainerName",
223 "",
224 "Name of the truth event container"
225 };
226
229 this,
230 "TruthParticleContainerName",
231 "",
232 "Name of the truth particle container"
233 };
234
238 this,
239 "EgammaTruthContainerName",
240 "",
241 "Name of the output egamma truth particle container"
242 };
243
245 Gaudi::Property<float> m_minPt{
246 this,
247 "MinPtEgammaTruth",
248 10,
249 "Minimum Pt to enter egamma truth particle container"
250 };
251
253 Gaudi::Property<float> m_minPtFSR{
254 this,
255 "MinPtEgammaTruthFSR",
256 1e3,
257 "Minimum Pt for FSR to enter egamma truth particle container"
258 };
259
261 Gaudi::Property<bool> m_UPCmode{
262 this,
263 "UPCmode",
264 false,
265 "Allow electron from photon in egamma truth particle container"
266 };
267
268
270 ToolHandle<IMCTruthClassifier> m_mcTruthClassifier{
271 this,
272 "MCTruthClassifier",
273 "EMMCTruthClassifier",
274 "Handle of MCTruthClassifier"
275 };
276};
277
278#endif // EGAMMAALGS_EGAMMATRUTHASSOCIATIONALG_H
Property holding a SG store/key/clid from which a ReadHandle is made.
Handle class for reading from StoreGate.
Handle class for adding a decoration to an object.
Property holding a SG store/key/clid from which a WriteHandle is made.
An algorithm that can be simultaneously executed in multiple threads.
SG::Accessor< T, ALLOC > Accessor
Definition AuxElement.h:573
Property holding a SG store/key/clid from which a ReadHandle is made.
Handle class for adding a decoration to an object.
Property holding a SG store/key/clid from which a WriteHandle is made.
Gaudi::Property< bool > m_doEgammaTruthContainer
Create egamma truth container?
virtual ~egammaTruthAssociationAlg()=default
destructor
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthParticleContainerKey
Name of the truth particle container.
Gaudi::Property< std::string > m_electronDecName
The electron container name property used to initialize the WriteDecorHandleKeyArray.
Gaudi::Property< bool > m_matchElectrons
Match electrons?
SG::WriteDecorHandleKeyArray< xAOD::ElectronContainer > m_fwdElectronDecKeys
The fwd electron container decor handle key array.
SG::WriteDecorHandleKeyArray< xAOD::PhotonContainer > m_photonDecKeys
The photon container decor handle key array.
StatusCode initializeDecorKeys(SG::WriteDecorHandleKeyArray< T > &keys, const std::string &name)
A function that initializes the decor handles, but also checks the naming convention.
Gaudi::Property< bool > m_matchClusters
Match clusters?
StatusCode match(const EventContext &ctx, const xAOD::TruthParticleContainer &truthParticles, const SG::WriteDecorHandleKeyArray< T > &hkeys, const SG::AuxElement::Accessor< L > &linkAccess, xAOD::TruthParticleContainer *egammaTruthContainer) const
Loop over elements in the reco container, decorate them with truth info and decorate the truth partic...
Gaudi::Property< bool > m_matchPhotons
Match photons?
SG::WriteHandleKey< xAOD::TruthParticleContainer > m_egammaTruthParticleContainerKey
Name of the output egamma truth container.
virtual StatusCode execute(const EventContext &ctx) const override final
execute on container
SG::WriteDecorHandleKeyArray< xAOD::ElectronContainer > m_electronDecKeys
The electron container decor handle key array.
Gaudi::Property< std::string > m_photonDecName
The photon container name property used to initialize the WriteDecorHandleKeyArray.
void getNewTruthParticle(const EventContext &ctx, xAOD::TruthParticleContainer &egammaTruthContainer, const xAOD::TruthParticle *truth, const xAOD::TruthParticleContainer *oldContainer) const
Create a copy a truth particle, add it to the new getNewTruthParticle container and decorate it with ...
Gaudi::Property< float > m_minPt
Minimum Pt to enter egamma truth particle container.
Gaudi::Property< std::string > m_fwdElectronDecName
The fwd electron name property used to initialize the WriteDecorHandleKeyArray.
bool isPromptEgammaParticle(const EventContext &ctx, const xAOD::TruthParticle *truth) const
Return true if the truth particle is a prompt electron or photon.
Gaudi::Property< bool > m_matchForwardElectrons
Match fwd electrons?
Gaudi::Property< float > m_minPtFSR
Minimum Pt for FSR to enter egamma truth particle container.
Gaudi::Property< std::string > m_clusterDecName
The egamma cluster name property used to initialize the WriteDecorHandleKeyArray.
MCTruthInfo_t particleTruthClassifier(const EventContext &ctx, const T *) const
return the result of MCTruthClassifier::particleTruthClassifier or do a second pass for electrons bas...
SG::WriteDecorHandleKeyArray< xAOD::CaloClusterContainer > m_clusterDecKeys
The egamma cluster decor handle key array.
egammaTruthAssociationAlg(const std::string &name, ISvcLocator *pSvcLocator)
constructor
Gaudi::Property< bool > m_UPCmode
Allow electron from photon in egamma truth particle container.
ToolHandle< IMCTruthClassifier > m_mcTruthClassifier
MCTruthClassifier.
virtual StatusCode finalize() override final
finalize method
virtual StatusCode initialize() override final
initialize method
SG::ReadHandleKey< xAOD::TruthEventContainer > m_truthEventContainerKey
Name of the truth event container.
DecorHandleKeyArray< WriteDecorHandle< T, S >, WriteDecorHandleKey< T >, Gaudi::DataHandle::Writer > WriteDecorHandleKeyArray
TruthParticle_v1 TruthParticle
Typedef to implementation.
TruthParticleContainer_v1 TruthParticleContainer
Declare the latest version of the truth particle container.
MCTruthPartClassifier::ParticleType first
MCTruthPartClassifier::ParticleOrigin second
writeDecorHandles(const SG::WriteDecorHandleKeyArray< T > &keys, const EventContext &ctx)
SG::WriteDecorHandle< T, unsigned int > classification
SG::WriteDecorHandle< T, ElementLink< xAOD::TruthParticleContainer > > el
#define private