ATLAS Offline Software
egammaTruthAssociationAlg.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 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 
24 #include "StoreGate/ReadHandle.h"
29 
30 #include <string>
31 
41 {
42 
43 public:
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 
59 private:
61  {
65  };
66 
69  template<class T>
71  const std::string& name);
72 
74  template<class T>
76  {
78  const EventContext& ctx); // constructor
79 
83 
84  // any of the handles should function as a read handle, choice is arbitrary
86  };
87 
91  template<class T, class L>
92  StatusCode match(const EventContext& ctx,
93  const xAOD::TruthParticleContainer& truthParticles,
95  const SG::AuxElement::Accessor<L>& linkAccess,
96  xAOD::TruthParticleContainer* egammaTruthContainer) const;
97 
101  template<class T>
102  MCTruthInfo_t particleTruthClassifier(const EventContext& ctx,
103  const T*) const;
104 
107  void getNewTruthParticle(
108  const EventContext& ctx,
109  xAOD::TruthParticleContainer& egammaTruthContainer,
110  const xAOD::TruthParticle* truth,
111  const xAOD::TruthParticleContainer* oldContainer) const;
112 
115  bool isPromptEgammaParticle(const EventContext& ctx,
116  const xAOD::TruthParticle* truth) const;
117 
119  Gaudi::Property<bool> m_doEgammaTruthContainer{
120  this,
121  "CreateEgammaTruthContainer",
122  true,
123  "Create egammaTruthContainer?"
124  };
125 
127  Gaudi::Property<bool> m_matchElectrons{ this,
128  "MatchElectrons",
129  true,
130  "Match (central) electrons?" };
131 
133  Gaudi::Property<bool> m_matchPhotons{ this,
134  "MatchPhotons",
135  true,
136  "Match photons?" };
137 
139  Gaudi::Property<bool> m_matchForwardElectrons{ this,
140  "MatchForwardElectrons",
141  true,
142  "Match forward electrons?" };
143 
145  Gaudi::Property<bool> m_matchClusters{ this,
146  "MatchClusters",
147  false,
148  "Match clusters?" };
149 
152  this,
153  "DoNotSet_ClusterContainerName",
154  {},
155  "Do not set; configuration via the string property"
156  };
157 
160  Gaudi::Property<std::string> m_clusterDecName{
161  this,
162  "ClusterContainerName",
163  "",
164  "Name of the egamma cluster container"
165  };
166 
169  this,
170  "DoNotSet_ElectronContainerName",
171  {},
172  "Do not set; configuration via the string property"
173  };
174 
177  Gaudi::Property<std::string> m_electronDecName{
178  this,
179  "ElectronContainerName",
180  "",
181  "Name of the input electron container"
182  };
183 
186  this,
187  "DoNotSet_FwdElectronContainerName",
188  {},
189  "Do not set; configuration via the string property"
190  };
191 
194  Gaudi::Property<std::string> m_fwdElectronDecName{
195  this,
196  "FwdElectronContainerName",
197  "",
198  "Name of the input fwd electron container"
199  };
200 
203  this,
204  "DoNotSet_PhotonContainerName",
205  {},
206  "Do not set; configuration via the string property"
207  };
208 
211  Gaudi::Property<std::string> m_photonDecName{
212  this,
213  "PhotonContainerName",
214  "",
215  "Name of the input photon container"
216  };
217 
220  this,
221  "TruthEventContainerName",
222  "",
223  "Name of the truth event container"
224  };
225 
228  this,
229  "TruthParticleContainerName",
230  "",
231  "Name of the truth particle container"
232  };
233 
237  this,
238  "EgammaTruthContainerName",
239  "",
240  "Name of the output egamma truth particle container"
241  };
242 
244  Gaudi::Property<float> m_minPt{
245  this,
246  "MinPtEgammaTruth",
247  10,
248  "Minimum Pt to enter egamma truth particle container"
249  };
250 
252  Gaudi::Property<float> m_minPtFSR{
253  this,
254  "MinPtEgammaTruthFSR",
255  1e3,
256  "Minimum Pt for FSR to enter egamma truth particle container"
257  };
258 
260  ToolHandle<IMCTruthClassifier> m_mcTruthClassifier{
261  this,
262  "MCTruthClassifier",
263  "EMMCTruthClassifier",
264  "Handle of MCTruthClassifier"
265  };
266 };
267 
268 #endif // EGAMMAALGS_EGAMMATRUTHASSOCIATIONALG_H
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
egammaTruthAssociationAlg::particleTruthClassifier
MCTruthInfo_t particleTruthClassifier(const EventContext &ctx, const T *) const
return the result of MCTruthClassifier::particleTruthClassifier or do a second pass for electrons bas...
Definition: egammaTruthAssociationAlg.cxx:310
egammaTruthAssociationAlg::m_egammaTruthParticleContainerKey
SG::WriteHandleKey< xAOD::TruthParticleContainer > m_egammaTruthParticleContainerKey
Name of the output egamma truth container.
Definition: egammaTruthAssociationAlg.h:236
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:68
egammaTruthAssociationAlg::getNewTruthParticle
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 ...
Definition: egammaTruthAssociationAlg.cxx:236
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
TruthParticleContainer.h
egammaTruthAssociationAlg::m_matchClusters
Gaudi::Property< bool > m_matchClusters
Match clusters?
Definition: egammaTruthAssociationAlg.h:145
egammaTruthAssociationAlg::match
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...
Definition: egammaTruthAssociationAlg.cxx:348
egammaTruthAssociationAlg::m_minPtFSR
Gaudi::Property< float > m_minPtFSR
Minimum Pt for FSR to enter egamma truth particle container.
Definition: egammaTruthAssociationAlg.h:252
egammaTruthAssociationAlg::m_matchPhotons
Gaudi::Property< bool > m_matchPhotons
Match photons?
Definition: egammaTruthAssociationAlg.h:133
SG::HandleKeyArray
Definition: StoreGate/StoreGate/HandleKeyArray.h:38
egammaTruthAssociationAlg::writeDecorHandles::writeDecorHandles
writeDecorHandles(const SG::WriteDecorHandleKeyArray< T > &keys, const EventContext &ctx)
Definition: egammaTruthAssociationAlg.cxx:300
egammaTruthAssociationAlg::MCTruthInfo_t
Definition: egammaTruthAssociationAlg.h:61
egammaTruthAssociationAlg::m_electronDecKeys
SG::WriteDecorHandleKeyArray< xAOD::ElectronContainer > m_electronDecKeys
The electron container decor handle key array.
Definition: egammaTruthAssociationAlg.h:168
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
SG::ReadHandleKey
Property holding a SG store/key/clid from which a ReadHandle is made.
Definition: StoreGate/StoreGate/ReadHandleKey.h:39
egammaTruthAssociationAlg::m_truthEventContainerKey
SG::ReadHandleKey< xAOD::TruthEventContainer > m_truthEventContainerKey
Name of the truth event container.
Definition: egammaTruthAssociationAlg.h:219
egammaTruthAssociationAlg::MCTruthInfo_t::first
MCTruthPartClassifier::ParticleType first
Definition: egammaTruthAssociationAlg.h:62
egammaTruthAssociationAlg::m_matchElectrons
Gaudi::Property< bool > m_matchElectrons
Match electrons?
Definition: egammaTruthAssociationAlg.h:127
egammaTruthAssociationAlg::writeDecorHandles::type
SG::WriteDecorHandle< T, int > type
Definition: egammaTruthAssociationAlg.h:81
egammaTruthAssociationAlg::m_fwdElectronDecKeys
SG::WriteDecorHandleKeyArray< xAOD::ElectronContainer > m_fwdElectronDecKeys
The fwd electron container decor handle key array.
Definition: egammaTruthAssociationAlg.h:185
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
egammaTruthAssociationAlg::m_fwdElectronDecName
Gaudi::Property< std::string > m_fwdElectronDecName
The fwd electron name property used to initialize the WriteDecorHandleKeyArray.
Definition: egammaTruthAssociationAlg.h:194
EgammaContainer.h
TruthParticleAuxContainer.h
egammaTruthAssociationAlg::m_clusterDecName
Gaudi::Property< std::string > m_clusterDecName
The egamma cluster name property used to initialize the WriteDecorHandleKeyArray.
Definition: egammaTruthAssociationAlg.h:160
egammaTruthAssociationAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override final
execute on container
Definition: egammaTruthAssociationAlg.cxx:112
egammaTruthAssociationAlg::initialize
virtual StatusCode initialize() override final
initialize method
Definition: egammaTruthAssociationAlg.cxx:63
MCTruthClassifierDefs.h
egammaTruthAssociationAlg::~egammaTruthAssociationAlg
virtual ~egammaTruthAssociationAlg()=default
destructor
IMCTruthClassifier.h
egammaTruthAssociationAlg::m_truthParticleContainerKey
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthParticleContainerKey
Name of the truth particle container.
Definition: egammaTruthAssociationAlg.h:227
SG::WriteHandleKey
Property holding a SG store/key/clid from which a WriteHandle is made.
Definition: StoreGate/StoreGate/WriteHandleKey.h:40
CheckAppliedSFs.e3
e3
Definition: CheckAppliedSFs.py:264
egammaTruthAssociationAlg
Definition: egammaTruthAssociationAlg.h:41
ElectronContainer.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ParticleOrigin
ParticleOrigin
Definition: TruthClasses.h:51
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:37
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition: StoreGate/StoreGate/WriteDecorHandle.h:100
egammaTruthAssociationAlg::MCTruthInfo_t::second
MCTruthPartClassifier::ParticleOrigin second
Definition: egammaTruthAssociationAlg.h:63
WriteDecorHandle.h
Handle class for adding a decoration to an object.
egammaTruthAssociationAlg::writeDecorHandles::origin
SG::WriteDecorHandle< T, int > origin
Definition: egammaTruthAssociationAlg.h:82
egammaTruthAssociationAlg::m_mcTruthClassifier
ToolHandle< IMCTruthClassifier > m_mcTruthClassifier
MCTruthClassifier.
Definition: egammaTruthAssociationAlg.h:260
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
egammaTruthAssociationAlg::egammaTruthAssociationAlg
egammaTruthAssociationAlg(const std::string &name, ISvcLocator *pSvcLocator)
constructor
Definition: egammaTruthAssociationAlg.cxx:57
egammaTruthAssociationAlg::writeDecorHandles
helper class to contain write decoration handles
Definition: egammaTruthAssociationAlg.h:76
egammaTruthAssociationAlg::m_doEgammaTruthContainer
Gaudi::Property< bool > m_doEgammaTruthContainer
Create egamma truth container?
Definition: egammaTruthAssociationAlg.h:119
egammaTruthAssociationAlg::m_electronDecName
Gaudi::Property< std::string > m_electronDecName
The electron container name property used to initialize the WriteDecorHandleKeyArray.
Definition: egammaTruthAssociationAlg.h:177
egammaTruthAssociationAlg::initializeDecorKeys
StatusCode initializeDecorKeys(SG::WriteDecorHandleKeyArray< T > &keys, const std::string &name)
A function that initializes the decor handles, but also checks the naming convention.
Definition: egammaTruthAssociationAlg.cxx:282
AthReentrantAlgorithm.h
WriteHandleKey.h
Property holding a SG store/key/clid from which a WriteHandle is made.
egammaTruthAssociationAlg::m_matchForwardElectrons
Gaudi::Property< bool > m_matchForwardElectrons
Match fwd electrons?
Definition: egammaTruthAssociationAlg.h:139
egammaTruthAssociationAlg::writeDecorHandles::el
SG::WriteDecorHandle< T, ElementLink< xAOD::TruthParticleContainer > > el
Definition: egammaTruthAssociationAlg.h:80
egammaTruthAssociationAlg::m_minPt
Gaudi::Property< float > m_minPt
Minimum Pt to enter egamma truth particle container.
Definition: egammaTruthAssociationAlg.h:244
private
#define private
Definition: DetDescrConditionsDict_dict_fixes.cxx:13
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
egammaTruthAssociationAlg::m_photonDecKeys
SG::WriteDecorHandleKeyArray< xAOD::PhotonContainer > m_photonDecKeys
The photon container decor handle key array.
Definition: egammaTruthAssociationAlg.h:202
egammaTruthAssociationAlg::finalize
virtual StatusCode finalize() override final
finalize method
Definition: egammaTruthAssociationAlg.cxx:106
egammaTruthAssociationAlg::m_clusterDecKeys
SG::WriteDecorHandleKeyArray< xAOD::CaloClusterContainer > m_clusterDecKeys
The egamma cluster decor handle key array.
Definition: egammaTruthAssociationAlg.h:151
egammaTruthAssociationAlg::isPromptEgammaParticle
bool isPromptEgammaParticle(const EventContext &ctx, const xAOD::TruthParticle *truth) const
Return true if the truth particle is a prompt electron or photon.
Definition: egammaTruthAssociationAlg.cxx:206
egammaTruthAssociationAlg::writeDecorHandles::readHandle
SG::ReadHandle< T > & readHandle()
Definition: egammaTruthAssociationAlg.h:85
IParticleCaloExtensionTool.h
WriteDecorHandleKeyArray.h
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
egammaTruthAssociationAlg::MCTruthInfo_t::genPart
const xAOD::TruthParticle * genPart
Definition: egammaTruthAssociationAlg.h:64
ReadHandle.h
Handle class for reading from StoreGate.
TruthParticle.h
egammaTruthAssociationAlg::m_photonDecName
Gaudi::Property< std::string > m_photonDecName
The photon container name property used to initialize the WriteDecorHandleKeyArray.
Definition: egammaTruthAssociationAlg.h:211
TruthEventContainer.h
ParticleType
ParticleType
Definition: TruthClasses.h:8
PhotonContainer.h
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35