ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
D3PDMaker
egammaD3PDMaker
src
egammaGenParticleAssociationTool.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$
13
14
15
#include "
egammaGenParticleAssociationTool.h
"
16
#include "
xAODEgamma/Egamma.h
"
17
#include "
xAODEgamma/Electron.h
"
18
#include "
xAODEgamma/Photon.h
"
19
#include "
xAODTruth/TruthParticle.h
"
20
#include "
FourMomUtils/P4Helpers.h
"
21
#include "
AthenaKernel/errorcheck.h
"
22
#include "
AtlasHepMC/GenEvent.h
"
23
#include <cstdlib>
24
25
26
namespace
D3PD
{
27
28
35
egammaGenParticleAssociationTool::egammaGenParticleAssociationTool
36
(
const
std::string&
type
,
37
const
std::string& name,
38
const
IInterface* parent)
39
:
Base
(
type
, name, parent),
40
m_classifier
(
"MCTruthClassifier"
)
41
{
42
declareProperty (
"Classifier"
,
m_classifier
,
"Classifier tool instance."
);
43
declareProperty (
"DRVar"
,
m_drvar
,
44
"If not empty, the variable name to use for DR."
);
45
46
m_dr
= 0;
47
}
48
49
53
StatusCode
egammaGenParticleAssociationTool::initialize
()
54
{
55
CHECK
( Base::initialize() );
56
CHECK
(
m_classifier
.retrieve() );
57
return
StatusCode::SUCCESS;
58
}
59
60
64
StatusCode
egammaGenParticleAssociationTool::book
()
65
{
66
if
(!
m_drvar
.empty())
67
CHECK
(
addVariable
(
m_drvar
,
m_dr
) );
68
return
StatusCode::SUCCESS;
69
}
70
71
78
const
xAOD::TruthParticle
*
79
egammaGenParticleAssociationTool::get
(
const
xAOD::Egamma
& p)
80
{
81
const
xAOD::TruthParticle
* out =
nullptr
;
82
if
(
const
xAOD::Electron
* q =
83
dynamic_cast<
const
xAOD::Electron
*
>
(&p))
84
{
85
std::tie(std::ignore, std::ignore, out, std::ignore) =
m_classifier
->particleTruthClassifier_full (q);
86
}
87
else
if
(
const
xAOD::Photon
* q =
88
dynamic_cast<
const
xAOD::Photon
*
>
(&p))
89
{
90
std::tie(std::ignore, std::ignore, out, std::ignore) =
m_classifier
->particleTruthClassifier_full (q);
91
}
92
else
93
std::abort();
94
95
if
(!
m_drvar
.empty()) {
96
if
(out)
97
*
m_dr
= p.p4().DeltaR (out->p4());
98
else
99
*
m_dr
= -999;
100
}
101
102
return
out;
103
}
104
105
106
}
// 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
Egamma.h
Electron.h
Photon.h
TruthParticle.h
GenEvent.h
P4Helpers.h
D3PD::SingleAssociationTool< xAOD::Egamma, xAOD::TruthParticle >::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::egammaGenParticleAssociationTool::initialize
StatusCode initialize()
Standard Gaudi initialize method.
Definition
egammaGenParticleAssociationTool.cxx:53
D3PD::egammaGenParticleAssociationTool::m_drvar
std::string m_drvar
Property: If not empty, the variable name to use for DR.
Definition
egammaGenParticleAssociationTool.h:76
D3PD::egammaGenParticleAssociationTool::m_classifier
ToolHandle< IMCTruthClassifier > m_classifier
Property: classifier tool.
Definition
egammaGenParticleAssociationTool.h:73
D3PD::egammaGenParticleAssociationTool::Base
SingleAssociationTool< xAOD::Egamma, xAOD::TruthParticle > Base
Definition
egammaGenParticleAssociationTool.h:40
D3PD::egammaGenParticleAssociationTool::book
StatusCode book()
Create any needed tuple variables.
Definition
egammaGenParticleAssociationTool.cxx:64
D3PD::egammaGenParticleAssociationTool::get
virtual const xAOD::TruthParticle * get(const xAOD::Egamma &p)
Return the target object.
Definition
egammaGenParticleAssociationTool.cxx:79
D3PD::egammaGenParticleAssociationTool::m_dr
float * m_dr
Variable: DR between reco and truth.
Definition
egammaGenParticleAssociationTool.h:79
D3PD::egammaGenParticleAssociationTool::egammaGenParticleAssociationTool
egammaGenParticleAssociationTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard Gaudi tool constructor.
Definition
egammaGenParticleAssociationTool.cxx:36
egammaGenParticleAssociationTool.h
Associate from an electron to a matched GenParticle via classification tool.
D3PD
Block filler tool for noisy FEB information.
Definition
CaloCellDetailsFillerTool.cxx:29
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