ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
D3PDMaker
egammaD3PDMaker
src
egammaTruthClassificationFillerTool.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 "
egammaTruthClassificationFillerTool.h
"
15
#include "
xAODEgamma/Egamma.h
"
16
#include "
xAODEgamma/Electron.h
"
17
#include "
xAODEgamma/Photon.h
"
18
#include "
xAODEgamma/EgammaTruthxAODHelpers.h
"
19
#include "
AthenaKernel/errorcheck.h
"
20
#include <cstdlib>
21
22
23
namespace
D3PD
{
24
25
32
egammaTruthClassificationFillerTool::egammaTruthClassificationFillerTool
33
(
const
std::string&
type
,
34
const
std::string& name,
35
const
IInterface* parent)
36
:
BlockFillerTool
<
xAOD
::
Egamma
> (
type
, name, parent),
37
m_classifier
(
"MCTruthClassifier"
)
38
{
39
declareProperty (
"Classifier"
,
m_classifier
,
"Classifier tool instance."
);
40
41
declareProperty (
"DoBkgElecOrigin"
,
m_doBkgElecOrigin
=
false
,
42
"If true, fill in variables for the origin and type "
43
" of a photon for background electrons from conversions."
);
44
45
book
().ignore();
// Avoid coverity warnings.
46
}
47
48
52
StatusCode
egammaTruthClassificationFillerTool::initialize
()
53
{
54
CHECK
(
BlockFillerTool<xAOD::Egamma>::initialize
() );
55
CHECK
(
m_classifier
.retrieve() );
56
return
StatusCode::SUCCESS;
57
}
58
59
63
StatusCode
egammaTruthClassificationFillerTool::book
()
64
{
65
CHECK
(
addVariable
(
"type"
,
m_type
,
66
"MC particle type, from classifier tool."
) );
67
CHECK
(
addVariable
(
"origin"
,
m_origin
,
68
"MC particle origin, from classifier tool."
) );
69
70
if
(
m_doBkgElecOrigin
) {
71
CHECK
(
addVariable
(
"typebkg"
,
m_typebkg
,
72
"Type of photon for background electron "
73
"from conversions, from classifier tool"
) );
74
CHECK
(
addVariable
(
"originbkg"
,
m_originbkg
,
75
"Origin of photon for background electron "
76
"from conversions, from classifier tool."
) );
77
}
78
79
return
StatusCode::SUCCESS;
80
}
81
82
91
StatusCode
egammaTruthClassificationFillerTool::fill
(
const
xAOD::Egamma
& p)
92
{
93
std::tuple<MCTruthPartClassifier::ParticleType, MCTruthPartClassifier::ParticleOrigin, const xAOD::TruthParticle*,MCTruthPartClassifier::ParticleOutCome>
res
;
94
95
if
(
const
xAOD::Electron
* q =
96
dynamic_cast<
const
xAOD::Electron
*
>
(&p))
97
{
98
res
=
m_classifier
->particleTruthClassifier_full (q);
99
}
100
else
if
(
const
xAOD::Photon
* q =
101
dynamic_cast<
const
xAOD::Photon
*
>
(&p))
102
{
103
res
=
m_classifier
->particleTruthClassifier_full (q);
104
}
105
else
106
std::abort();
107
108
std::tie(*
m_type
, *
m_origin
, std::ignore, std::ignore) =
res
;
109
110
if
(
m_doBkgElecOrigin
) {
111
if
(std::get<0>(
res
) ==
MCTruthPartClassifier::BkgElectron
&&
112
std::get<1>(
res
) ==
MCTruthPartClassifier::PhotonConv
&&
113
std::get<2>(
res
))
114
{
115
const
xAOD::TruthParticle
* last =
xAOD::EgammaHelpers::getBkgElectronMother
(std::get<2>(
res
));
116
if
(last){
117
std::tie(*
m_typebkg
, *
m_originbkg
, std::ignore, std::ignore) =
m_classifier
->particleTruthClassifier_full(last);
118
}
119
}
120
}
121
122
return
StatusCode::SUCCESS;
123
}
124
125
126
}
// 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
EgammaTruthxAODHelpers.h
Egamma.h
Electron.h
Photon.h
res
std::pair< std::vector< unsigned int >, bool > res
Definition
JetGroupProductTest.cxx:11
D3PD::BlockFillerTool< xAOD::Egamma >::addVariable
virtual StatusCode addVariable(const std::string &name, const std::type_info &ti, void *&ptr, const std::string &docstring="", const void *defval=0)
Definition
AddVariable.cxx:85
D3PD::BlockFillerTool
Type-safe wrapper for block filler tools.
Definition
BlockFillerTool.h:65
D3PD::egammaTruthClassificationFillerTool::m_classifier
ToolHandle< IMCTruthClassifier > m_classifier
Property: classifier tool.
Definition
egammaTruthClassificationFillerTool.h:71
D3PD::egammaTruthClassificationFillerTool::fill
virtual StatusCode fill(const xAOD::Egamma &p) override
Fill one block — type-safe version.
Definition
egammaTruthClassificationFillerTool.cxx:91
D3PD::egammaTruthClassificationFillerTool::m_origin
int * m_origin
Variable: Particle origin.
Definition
egammaTruthClassificationFillerTool.h:83
D3PD::egammaTruthClassificationFillerTool::egammaTruthClassificationFillerTool
egammaTruthClassificationFillerTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard Gaudi tool constructor.
Definition
egammaTruthClassificationFillerTool.cxx:33
D3PD::egammaTruthClassificationFillerTool::m_type
int * m_type
Variable: Particle type.
Definition
egammaTruthClassificationFillerTool.h:79
D3PD::egammaTruthClassificationFillerTool::m_originbkg
int * m_originbkg
Variable: Origin of photon for background electron from conversions.
Definition
egammaTruthClassificationFillerTool.h:91
D3PD::egammaTruthClassificationFillerTool::initialize
virtual StatusCode initialize() override
Standard Gaudi initialize method.
Definition
egammaTruthClassificationFillerTool.cxx:52
D3PD::egammaTruthClassificationFillerTool::book
virtual StatusCode book() final
Book variables for this block.
Definition
egammaTruthClassificationFillerTool.cxx:63
D3PD::egammaTruthClassificationFillerTool::m_doBkgElecOrigin
bool m_doBkgElecOrigin
Property: Should we fill origin of background electrons?
Definition
egammaTruthClassificationFillerTool.h:75
D3PD::egammaTruthClassificationFillerTool::m_typebkg
int * m_typebkg
Variable: Type of photon for background electron from conversions.
Definition
egammaTruthClassificationFillerTool.h:87
egammaTruthClassificationFillerTool.h
Fill in type/origin from MC classifier tool for an egamma.
D3PD
Block filler tool for noisy FEB information.
Definition
CaloCellDetailsFillerTool.cxx:29
Egamma
Definition
ClusMomentumPlots.cxx:11
MCTruthPartClassifier::PhotonConv
@ PhotonConv
Definition
TruthClasses.h:61
MCTruthPartClassifier::BkgElectron
@ BkgElectron
Definition
TruthClasses.h:15
xAOD::EgammaHelpers::getBkgElectronMother
const xAOD::TruthParticle * getBkgElectronMother(const xAOD::Electron *el, const bool allTheWayBack=true)
Helper wrapper function for calling the function above extracting the truth from a reco electron.
Definition
EgammaTruthxAODHelpers.cxx:137
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition
ICaloAffectedTool.h:24
xAOD::Egamma
Egamma_v1 Egamma
Definition of the current "egamma version".
Definition
Egamma.h:17
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
xAOD::Electron
Electron_v1 Electron
Definition of the current "egamma version".
Definition
Event/xAOD/xAODEgamma/xAODEgamma/Electron.h:17
type
Generated on
for ATLAS Offline Software by
1.17.0