ATLAS Offline Software
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$
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
MCTruthPartClassifier::Info
info
;
82
if
(
const
xAOD::Electron
*
q
=
83
dynamic_cast<
const
xAOD::Electron
*
>
(&
p
))
84
{
85
m_classifier
->particleTruthClassifier (
q
, &
info
);
86
}
87
else
if
(
const
xAOD::Photon
*
q
=
88
dynamic_cast<
const
xAOD::Photon
*
>
(&
p
))
89
{
90
m_classifier
->particleTruthClassifier (
q
, &
info
);
91
}
92
else
93
std::abort();
94
95
const
xAOD::TruthParticle
*
out
=
info
.genPart;
96
97
if
(!
m_drvar
.empty()) {
98
if
(
out
)
99
*
m_dr
=
p
.p4().DeltaR (
out
->p4());
100
else
101
*
m_dr
= -999;
102
}
103
104
return
out
;
105
}
106
107
108
}
// namespace D3PD
grepfile.info
info
Definition:
grepfile.py:38
GenEvent.h
D3PD::egammaGenParticleAssociationTool::egammaGenParticleAssociationTool
egammaGenParticleAssociationTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard Gaudi tool constructor.
Definition:
egammaGenParticleAssociationTool.cxx:36
D3PD::egammaGenParticleAssociationTool::get
virtual const xAOD::TruthParticle * get(const xAOD::Egamma &p)
Return the target object.
Definition:
egammaGenParticleAssociationTool.cxx:79
egammaGenParticleAssociationTool.h
Associate from an electron to a matched GenParticle via classification tool.
initialize
void initialize()
Definition:
run_EoverP.cxx:894
python.AthDsoLogger.out
out
Definition:
AthDsoLogger.py:71
D3PD::SingleAssociationTool< xAOD::Egamma, xAOD::TruthParticle >
D3PD::AddVariable::addVariable
virtual StatusCode addVariable(const std::string &name, const std::type_info &ti, void *&ptr, const std::string &docstring="", const void *defval=0)
Add a variable to the tuple.
Definition:
AddVariable.cxx:85
xAOD::Egamma_v1
Definition:
Egamma_v1.h:56
Egamma.h
D3PD
Block filler tool for noisy FEB information.
Definition:
CaloCellDetailsFillerTool.cxx:29
python.utils.AtlRunQueryDQUtils.p
p
Definition:
AtlRunQueryDQUtils.py:210
Photon.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition:
PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition:
TruthParticle_v1.h:37
test_pyathena.parent
parent
Definition:
test_pyathena.py:15
D3PD::egammaGenParticleAssociationTool::m_dr
float * m_dr
Variable: DR between reco and truth.
Definition:
egammaGenParticleAssociationTool.h:79
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition:
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
D3PD::egammaGenParticleAssociationTool::book
StatusCode book()
Create any needed tuple variables.
Definition:
egammaGenParticleAssociationTool.cxx:64
P4Helpers.h
name
std::string name
Definition:
Control/AthContainers/Root/debug.cxx:221
errorcheck.h
Helpers for checking error return status codes and reporting errors.
D3PD::egammaGenParticleAssociationTool::m_drvar
std::string m_drvar
Property: If not empty, the variable name to use for DR.
Definition:
egammaGenParticleAssociationTool.h:76
xAOD::Electron_v1
Definition:
Electron_v1.h:34
D3PD::egammaGenParticleAssociationTool::m_classifier
ToolHandle< IMCTruthClassifier > m_classifier
Property: classifier tool.
Definition:
egammaGenParticleAssociationTool.h:73
xAOD::Photon_v1
Definition:
Photon_v1.h:37
python.CaloScaleNoiseConfig.type
type
Definition:
CaloScaleNoiseConfig.py:78
extractSporadic.q
list q
Definition:
extractSporadic.py:98
Electron.h
TruthParticle.h
D3PD::egammaGenParticleAssociationTool::initialize
StatusCode initialize()
Standard Gaudi initialize method.
Definition:
egammaGenParticleAssociationTool.cxx:53
MCTruthPartClassifier::Info
Definition:
IMCTruthClassifier.h:49
Generated on Thu Nov 7 2024 21:14:15 for ATLAS Offline Software by
1.8.18