ATLAS Offline Software
PhysicsAnalysis
D3PDMaker
MuonD3PDMaker
src
MuonGenParticleAssociationTool.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 "
MuonGenParticleAssociationTool.h
"
16
#include "
xAODMuon/Muon.h
"
17
#include "
xAODTruth/TruthParticle.h
"
18
#include "
FourMomUtils/P4Helpers.h
"
19
#include "
AthenaKernel/errorcheck.h
"
20
#include <cstdlib>
21
22
23
namespace
D3PD
{
24
25
32
MuonGenParticleAssociationTool::MuonGenParticleAssociationTool
33
(
const
std::string&
type
,
34
const
std::string&
name
,
35
const
IInterface*
parent
)
36
:
Base
(
type
,
name
,
parent
),
37
m_classifier (
"MCTruthClassifier"
)
38
{
39
declareProperty (
"Classifier"
,
m_classifier
,
"Classifier tool instance."
);
40
declareProperty (
"DRVar"
,
m_drvar
,
41
"If not empty, the variable name to use for DR."
);
42
43
m_dr
=
nullptr
;
44
}
45
46
50
StatusCode
MuonGenParticleAssociationTool::initialize
()
51
{
52
CHECK
(
Base::initialize
() );
53
CHECK
(
m_classifier
.retrieve() );
54
return
StatusCode::SUCCESS;
55
}
56
57
61
StatusCode
MuonGenParticleAssociationTool::book
()
62
{
63
if
(!
m_drvar
.empty())
64
CHECK
(
addVariable
(
m_drvar
,
m_dr
) );
65
return
StatusCode::SUCCESS;
66
}
67
68
75
const
xAOD::TruthParticle
*
76
MuonGenParticleAssociationTool::get
(
const
xAOD::Muon
&
p
)
77
{
78
MCTruthPartClassifier::Info
info
;
79
const
xAOD::TruthParticle
*
out
=
nullptr
;
80
if
(
m_classifier
->particleTruthClassifier (&
p
, &
info
).first !=
81
MCTruthPartClassifier::Unknown)
82
{
83
out
=
info
.genPart;
84
}
85
86
if
(!
m_drvar
.empty()) {
87
if
(
out
)
88
*
m_dr
=
p
.p4().DeltaR(
out
->p4());
89
else
90
*
m_dr
= -999;
91
}
92
93
return
out
;
94
}
95
96
97
}
// namespace D3PD
grepfile.info
info
Definition:
grepfile.py:38
Muon.h
D3PD::MuonGenParticleAssociationTool::m_dr
float * m_dr
Variable: DR between reco and truth.
Definition:
MuonGenParticleAssociationTool.h:78
initialize
void initialize()
Definition:
run_EoverP.cxx:894
python.AthDsoLogger.out
out
Definition:
AthDsoLogger.py:71
D3PD::SingleAssociationTool< xAOD::Muon, xAOD::TruthParticle >
D3PD::MuonGenParticleAssociationTool::get
virtual const xAOD::TruthParticle * get(const xAOD::Muon &p)
Return the target object.
Definition:
MuonGenParticleAssociationTool.cxx:76
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
D3PD::MuonGenParticleAssociationTool::initialize
StatusCode initialize()
Standard Gaudi initialize method.
Definition:
MuonGenParticleAssociationTool.cxx:50
xAOD::Muon_v1
Class describing a Muon.
Definition:
Muon_v1.h:38
D3PD::MuonGenParticleAssociationTool::book
StatusCode book()
Create any needed tuple variables.
Definition:
MuonGenParticleAssociationTool.cxx:61
D3PD
Block filler tool for noisy FEB information.
Definition:
CaloCellDetailsFillerTool.cxx:29
python.utils.AtlRunQueryDQUtils.p
p
Definition:
AtlRunQueryDQUtils.py:210
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
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition:
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
D3PD::MuonGenParticleAssociationTool::MuonGenParticleAssociationTool
MuonGenParticleAssociationTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard Gaudi tool constructor.
Definition:
MuonGenParticleAssociationTool.cxx:33
P4Helpers.h
name
std::string name
Definition:
Control/AthContainers/Root/debug.cxx:228
D3PD::MuonGenParticleAssociationTool::m_drvar
std::string m_drvar
Property: If not empty, the variable name to use for DR.
Definition:
MuonGenParticleAssociationTool.h:75
errorcheck.h
Helpers for checking error return status codes and reporting errors.
python.CaloScaleNoiseConfig.type
type
Definition:
CaloScaleNoiseConfig.py:78
TruthParticle.h
MCTruthPartClassifier::Info
Definition:
IMCTruthClassifier.h:49
MuonGenParticleAssociationTool.h
Associate from a muon to a matched GenParticle via classification tool.
D3PD::MuonGenParticleAssociationTool::m_classifier
ToolHandle< IMCTruthClassifier > m_classifier
Property: classifier tool.
Definition:
MuonGenParticleAssociationTool.h:72
Generated on Sun Dec 22 2024 21:15:06 for ATLAS Offline Software by
1.8.18