ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
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$
13
14
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
const
xAOD::TruthParticle
* out =
nullptr
;
79
auto
res
=
m_classifier
->particleTruthClassifier_full (&p);
80
if
(std::get<0>(
res
) !=
81
MCTruthPartClassifier::Unknown
)
82
{
83
out = std::get<2>(
res
);
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
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
Muon.h
TruthParticle.h
res
std::pair< std::vector< unsigned int >, bool > res
Definition
JetGroupProductTest.cxx:11
MuonGenParticleAssociationTool.h
Associate from a muon to a matched GenParticle via classification tool.
P4Helpers.h
D3PD::SingleAssociationTool< xAOD::Muon, 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::MuonGenParticleAssociationTool::Base
SingleAssociationTool< xAOD::Muon, xAOD::TruthParticle > Base
Definition
MuonGenParticleAssociationTool.h:39
D3PD::MuonGenParticleAssociationTool::MuonGenParticleAssociationTool
MuonGenParticleAssociationTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard Gaudi tool constructor.
Definition
MuonGenParticleAssociationTool.cxx:33
D3PD::MuonGenParticleAssociationTool::m_drvar
std::string m_drvar
Property: If not empty, the variable name to use for DR.
Definition
MuonGenParticleAssociationTool.h:75
D3PD::MuonGenParticleAssociationTool::initialize
StatusCode initialize()
Standard Gaudi initialize method.
Definition
MuonGenParticleAssociationTool.cxx:50
D3PD::MuonGenParticleAssociationTool::m_classifier
ToolHandle< IMCTruthClassifier > m_classifier
Property: classifier tool.
Definition
MuonGenParticleAssociationTool.h:72
D3PD::MuonGenParticleAssociationTool::get
virtual const xAOD::TruthParticle * get(const xAOD::Muon &p)
Return the target object.
Definition
MuonGenParticleAssociationTool.cxx:76
D3PD::MuonGenParticleAssociationTool::m_dr
float * m_dr
Variable: DR between reco and truth.
Definition
MuonGenParticleAssociationTool.h:78
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
MCTruthPartClassifier::Unknown
@ Unknown
Definition
TruthClasses.h:11
xAOD::TruthParticle
TruthParticle_v1 TruthParticle
Typedef to implementation.
Definition
Event/xAOD/xAODTruth/xAODTruth/TruthParticle.h:15
xAOD::Muon
Muon_v1 Muon
Reference the current persistent version:
Definition
Event/xAOD/xAODMuon/xAODMuon/Muon.h:13
type
Generated on
for ATLAS Offline Software by
1.17.0