ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
D3PDMaker
egammaD3PDAnalysis
src
PhotonTruthAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// $Id$
12
13
14
#include "
PhotonTruthAlg.h
"
15
#include "
PhotonTruthTool.h
"
16
#include "
D3PDMakerInterfaces/ICollectionGetterTool.h
"
17
#include "
xAODEgamma/Photon.h
"
18
#include "
AthenaKernel/errorcheck.h
"
19
20
21
namespace
D3PD
{
22
23
24
PhotonTruthAlg::PhotonTruthAlg
(
const
std::string& name,
25
ISvcLocator* svcloc)
26
:
AthAlgorithm
(name, svcloc),
27
m_truthTool
(
"D3PD::PhotonTruthTool"
, this),
28
m_photonGetter
(this)
29
{
30
declareProperty
(
"AuxPrefix"
,
m_auxPrefix
,
31
"Prefix to add to aux data items."
);
32
declareProperty
(
"TruthTool"
,
m_truthTool
,
33
"Photon truth analysis tool instance."
);
34
declareProperty
(
"PhotonGetter"
,
m_photonGetter
,
35
"Getter instance for the input photon objects."
);
36
declareProperty
(
"AllowMissing"
,
m_allowMissing
=
false
,
37
"If true, don't complain if input objects are missing."
);
38
}
39
40
44
StatusCode
PhotonTruthAlg::initialize
()
45
{
46
CHECK
( AthAlgorithm::initialize() );
47
CHECK
(
m_truthTool
.retrieve() );
48
CHECK
(
m_photonGetter
.retrieve() );
49
CHECK
(
m_photonGetter
->configureD3PD<
xAOD::Photon
>() );
50
return
StatusCode::SUCCESS;
51
}
52
53
57
StatusCode
PhotonTruthAlg::execute
(
const
EventContext&
/*ctx*/
)
58
{
59
#define DECOR(TYPE,N) xAOD::Photon::Decorator<TYPE> N (m_auxPrefix + #N)
60
DECOR
(
bool
, truth_isConv);
61
DECOR
(
float
, truth_Rconv);
62
DECOR
(
float
, truth_zconv);
63
DECOR
(
bool
, truth_isPhotonFromHardProc);
64
DECOR
(
bool
, truth_isFromHardProc);
65
DECOR
(
bool
, truth_isBrem);
66
#undef DECOR
67
68
CHECK
(
m_photonGetter
->reset (
m_allowMissing
) );
69
while
(
const
xAOD::Photon
* g =
70
m_photonGetter
->next<
xAOD::Photon
>())
71
{
72
const
xAOD::TruthParticle
* p =
m_truthTool
->toTruthParticle (*g);
73
74
truth_isConv(*g) =
m_truthTool
->getMCConv (p,
75
truth_Rconv(*g),
76
truth_zconv(*g));
77
78
truth_isPhotonFromHardProc(*g) =
m_truthTool
->isPromptPhotonMC(p);
79
truth_isFromHardProc(*g) =
m_truthTool
->isPromptParticleMC(p);
80
81
truth_isBrem(*g) = !truth_isPhotonFromHardProc(*g) &&
m_truthTool
->isQuarkBremMC(p) ;
82
83
m_photonGetter
->releaseElement (g);
84
}
85
86
return
StatusCode::SUCCESS;
87
}
88
89
90
}
// namespace D3PD
errorcheck.h
Helpers for checking error return status codes and reporting errors.
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
Photon.h
ICollectionGetterTool.h
Abstract interface to get a collection of objects and iterate over it.
PhotonTruthAlg.h
Analyze GenParticle's matching photons and make UD decorations.
PhotonTruthTool.h
Helpers to categorize photon TruthParticle's.
AthAlgorithm::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
AthCommonAlgorithm< Gaudi::Algorithm >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
D3PD::PhotonTruthAlg::m_photonGetter
ToolHandle< ICollectionGetterTool > m_photonGetter
Property: Getter for input photon objects.
Definition
PhotonTruthAlg.h:63
D3PD::PhotonTruthAlg::m_allowMissing
bool m_allowMissing
Property: If true, don't complain if input objects are missing.
Definition
PhotonTruthAlg.h:66
D3PD::PhotonTruthAlg::execute
virtual StatusCode execute(const EventContext &ctx)
Standard Gaudi execute method.
Definition
PhotonTruthAlg.cxx:57
D3PD::PhotonTruthAlg::PhotonTruthAlg
PhotonTruthAlg(const std::string &name, ISvcLocator *svcloc)
Standard Gaudi algorithm constructor.
Definition
PhotonTruthAlg.cxx:24
D3PD::PhotonTruthAlg::m_truthTool
ToolHandle< PhotonTruthTool > m_truthTool
Property: Truth analysis tool.
Definition
PhotonTruthAlg.h:60
D3PD::PhotonTruthAlg::initialize
virtual StatusCode initialize()
Standard Gaudi initialize method.
Definition
PhotonTruthAlg.cxx:44
D3PD::PhotonTruthAlg::m_auxPrefix
std::string m_auxPrefix
Property: Prefix to add to aux data items.
Definition
PhotonTruthAlg.h:57
DECOR
#define DECOR(TYPE, N)
D3PD
Block filler tool for noisy FEB information.
Definition
CaloCellDetailsFillerTool.cxx:29
xAOD::TruthParticle
TruthParticle_v1 TruthParticle
Typedef to implementation.
Definition
Event/xAOD/xAODTruth/xAODTruth/TruthParticle.h:15
xAOD::Photon
Photon_v1 Photon
Definition of the current "egamma version".
Definition
Event/xAOD/xAODEgamma/xAODEgamma/Photon.h:17
Generated on
for ATLAS Offline Software by
1.17.0