ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
AnalysisCommon
ParticleJetTools
Root
ParticleJetGhostLabelTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
ParticleJetTools/ParticleJetGhostLabelTool.h
"
6
#include "
ParticleJetTools/ParticleJetLabelCommon.h
"
7
#include "
xAODJet/JetContainer.h
"
8
#include "
AsgMessaging/Check.h
"
9
#include "
AsgDataHandles/ReadHandle.h
"
10
11
using namespace
std
;
12
using namespace
xAOD
;
13
14
ParticleJetGhostLabelTool::ParticleJetGhostLabelTool
(
const
std::string&
name
)
15
:
AsgTool
(
name
) {
16
declareProperties(*
this
, &
m_labelnames
);
17
declareProperty
(
"GhostBName"
,
m_ghostbname
=
"GhostBHadronsFinal"
,
"Name of attribute for matched B hadrons."
);
18
declareProperty
(
"GhostCName"
,
m_ghostcname
=
"GhostCHadronsFinal"
,
"Name of attribute for matched C hadrons."
);
19
declareProperty
(
"GhostTauName"
,
m_ghosttauname
=
"GhostTausFinal"
,
"Name of attribute for matched Taus."
);
20
declareProperty
(
"PartPtMin"
,
m_partptmin
=5000,
"Minimum pT of particles for labeling (MeV)"
);
21
}
22
23
StatusCode
ParticleJetGhostLabelTool::initialize
()
24
{
25
m_labelnames
.check();
26
ATH_CHECK
(
m_truthEventsKey
.initialize());
27
return
StatusCode::SUCCESS;
28
}
29
30
StatusCode
ParticleJetGhostLabelTool::decorate
(
const
JetContainer
& jets)
const
31
{
32
33
using namespace
std
;
34
using namespace
xAOD
;
35
namespace
pjt =
ParticleJetTools
;
36
37
ATH_MSG_VERBOSE
(
"In "
<<
name
() <<
"::modify()"
);
38
39
40
SG::ReadHandle<xAOD::TruthEventContainer>
truthEventsHandle(
m_truthEventsKey
);
41
if
(!truthEventsHandle.
isValid
()){
42
ATH_MSG_ERROR
(
" Invalid ReadHandle for TruthEvents with key: "
<< truthEventsHandle.
key
());
43
return
StatusCode::FAILURE;
44
}
45
46
Amg::Vector3D
origin = pjt::signalProcessP3(*truthEventsHandle);
47
48
for
(
const
xAOD::Jet
* jetptr: jets) {
49
50
const
Jet
&
jet
= *jetptr;
51
vector<const TruthParticle*> jetlabelpartsb =
match
(
jet
,
m_ghostbname
);
52
vector<const TruthParticle*> jetlabelpartsc =
match
(
jet
,
m_ghostcname
);
53
vector<const TruthParticle*> jetlabelpartstau =
match
(
jet
,
m_ghosttauname
);
54
55
// remove children whose parent hadrons are also in the jet.
56
// don't care about double tau jets
57
// so leave them for now.
58
59
using
ParticleJetTools::childrenRemoved
;
60
childrenRemoved(jetlabelpartsb, jetlabelpartsb);
61
childrenRemoved(jetlabelpartsb, jetlabelpartsc);
62
childrenRemoved(jetlabelpartsc, jetlabelpartsc);
63
64
// set truth label for jets above pt threshold
65
// hierarchy: b > c > tau > light
66
ParticleJetTools::Particles
particles {
67
.b = std::move(jetlabelpartsb),
68
.c = std::move(jetlabelpartsc),
69
.tau = std::move(jetlabelpartstau),
70
.origin = origin
71
};
72
ParticleJetTools::setJetLabels
(
jet
, particles,
m_labelnames
);
73
}
74
75
return
StatusCode::SUCCESS;
76
}
77
78
79
std::vector<const TruthParticle*>
80
ParticleJetGhostLabelTool::match
(
81
const
xAOD::Jet
&
jet
,
const
std::string& ghostname)
const
{
82
83
ATH_MSG_VERBOSE
(
"In "
<<
name
() <<
"::match()"
);
84
85
std::vector<const xAOD::TruthParticle*> parton_links
86
=
jet
.getAssociatedObjects<
const
xAOD::TruthParticle
>(ghostname);
87
88
std::vector<const xAOD::TruthParticle*> selected_partons;
89
for
(
const
xAOD::TruthParticle
* part: parton_links) {
90
if
(part->pt() >
m_partptmin
) {
91
selected_partons.push_back(part);
92
}
93
}
94
return
selected_partons;
95
}
96
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
ReadHandle.h
Handle class for reading from StoreGate.
Check.h
JetContainer.h
ParticleJetGhostLabelTool.h
ParticleJetLabelCommon.h
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
Jet
Definition
Reconstruction/Jet/JetEvent/JetEvent/Jet.h:47
ParticleJetGhostLabelTool::m_ghostcname
std::string m_ghostcname
Definition
ParticleJetGhostLabelTool.h:40
ParticleJetGhostLabelTool::m_labelnames
ParticleJetTools::LabelNames m_labelnames
Name of jet label attributes.
Definition
ParticleJetGhostLabelTool.h:38
ParticleJetGhostLabelTool::m_ghostbname
std::string m_ghostbname
Definition
ParticleJetGhostLabelTool.h:41
ParticleJetGhostLabelTool::m_partptmin
double m_partptmin
Minimum pT for particle selection (in MeV).
Definition
ParticleJetGhostLabelTool.h:44
ParticleJetGhostLabelTool::initialize
StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition
ParticleJetGhostLabelTool.cxx:23
ParticleJetGhostLabelTool::m_truthEventsKey
SG::ReadHandleKey< xAOD::TruthEventContainer > m_truthEventsKey
Definition
ParticleJetGhostLabelTool.h:28
ParticleJetGhostLabelTool::ParticleJetGhostLabelTool
ParticleJetGhostLabelTool(const std::string &name)
Constructor.
Definition
ParticleJetGhostLabelTool.cxx:14
ParticleJetGhostLabelTool::m_ghosttauname
std::string m_ghosttauname
Definition
ParticleJetGhostLabelTool.h:39
ParticleJetGhostLabelTool::decorate
StatusCode decorate(const xAOD::JetContainer &jets) const override
Decorate a jet collection without otherwise modifying it.
Definition
ParticleJetGhostLabelTool.cxx:30
ParticleJetGhostLabelTool::match
std::vector< const xAOD::TruthParticle * > match(const xAOD::Jet &, const std::string &ghostname) const
Definition
ParticleJetGhostLabelTool.cxx:80
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::VarHandleBase::key
virtual const std::string & key() const override final
Return the StoreGate ID for the referenced object.
Definition
AthToolSupport/AsgDataHandles/Root/VarHandleBase.cxx:64
asg::AsgTool::AsgTool
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition
AsgTool.cxx:58
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition
GeoPrimitives.h:47
ParticleJetTools
Definition
FatVertex.h:15
ParticleJetTools::setJetLabels
void setJetLabels(const xAOD::Jet &jet, const Particles &particles, const LabelNames &names)
Definition
ParticleJetLabelCommon.cxx:283
ParticleJetTools::childrenRemoved
void childrenRemoved(const std::vector< const xAOD::TruthParticle * > &parents, std::vector< const xAOD::TruthParticle * > &children)
Definition
ParticleJetLabelCommon.cxx:64
jet
Definition
JetCalibTools_PlotJESFactors.cxx:23
std
STL namespace.
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition
ICaloAffectedTool.h:24
xAOD::Jet
Jet_v1 Jet
Definition of the current "jet version".
Definition
Event/xAOD/xAODJet/xAODJet/Jet.h:17
xAOD::name
name
Definition
TriggerMenuJson_v1.cxx:29
xAOD::TruthParticle
TruthParticle_v1 TruthParticle
Typedef to implementation.
Definition
Event/xAOD/xAODTruth/xAODTruth/TruthParticle.h:15
xAOD::JetContainer
JetContainer_v1 JetContainer
Definition of the current "jet container version".
Definition
JetContainer.h:17
ParticleJetTools::Particles
Definition
ParticleJetLabelCommon.h:108
Generated on
for ATLAS Offline Software by
1.17.0