ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
AnalysisCommon
ParticleJetTools
Root
JetQuarkChargeLabelingTool.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/JetQuarkChargeLabelingTool.h
"
6
#include "
ParticleJetTools/ParticleJetLabelCommon.h
"
7
#include "
xAODJet/JetContainer.h
"
8
#include "
AsgMessaging/Check.h
"
9
#include "
AsgDataHandles/ReadDecorHandle.h
"
10
#include "
AsgDataHandles/WriteDecorHandle.h
"
11
12
using namespace
std
;
13
using namespace
xAOD
;
14
15
JetQuarkChargeLabelingTool::JetQuarkChargeLabelingTool
(
const
std::string&
name
)
16
:
AsgTool
(
name
) {
17
}
18
19
StatusCode
JetQuarkChargeLabelingTool::initialize
()
20
{
21
22
// Initialize output handles
23
ATH_MSG_DEBUG
(
"Initializing JetQuarkChargeLabelingTool"
);
24
m_map
=
m_mapOption
.value();
25
26
return
StatusCode::SUCCESS;
27
}
28
29
StatusCode
JetQuarkChargeLabelingTool::decorate
(
const
JetContainer
& jets)
const
30
{
31
32
ATH_MSG_VERBOSE
(
"In "
<<
name
() <<
"::decorate()"
);
33
34
SG::AuxElement::Accessor<int> hadronAccessorHandle(
m_hadronAccessor
.value());
35
SG::AuxElement::Accessor<int> partonAccessorHandle(
m_partonAccessor
.value());
36
SG::AuxElement::Decorator<int> chargeDecoratorHandle(
m_chargeDecorator
.value());
37
38
for
(
const
xAOD::Jet
*
jet
: jets) {
39
int
final_pdgId = -999 ;
40
41
//get hadron pdgId and parton label :
42
43
int
hadron_pdgId = hadronAccessorHandle(*
jet
);
44
int
parton_pdgId = partonAccessorHandle(*
jet
);
45
int
negative_pdgId = (-1)*hadron_pdgId;
46
47
if
( hadron_pdgId == 0 ){
48
final_pdgId = parton_pdgId;
49
ATH_MSG_DEBUG
(
"Jet is a light-jet. Associating to the jet the value of the "
<<
m_partonAccessor
);
50
}
else
{
51
if
(
m_map
.count(hadron_pdgId) >0){
52
final_pdgId =
m_map
.at(hadron_pdgId);
53
ATH_MSG_DEBUG
(
"Found associated hadron. Assigning "
<< final_pdgId <<
" to jet"
);
54
}
else
if
(
m_map
.count(negative_pdgId) >0 ){
55
final_pdgId = (-1)*
m_map
.at(negative_pdgId);
56
ATH_MSG_DEBUG
(
"Found associated hadron. Assigning "
<< final_pdgId <<
" to jet"
);
57
}
else
{
58
ATH_MSG_DEBUG
(
"Couldn't find the hadron with pdgId "
<< hadron_pdgId <<
" in current map. Assigning default "
<< final_pdgId <<
" to jet"
);
59
};
60
};
61
62
// Decorate the jet with the charge too
63
chargeDecoratorHandle(*
jet
) = final_pdgId;
64
};
65
66
return
StatusCode::SUCCESS;
67
}
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
ReadDecorHandle.h
Handle class for reading a decoration on an object.
WriteDecorHandle.h
Handle class for adding a decoration to an object.
Check.h
JetContainer.h
JetQuarkChargeLabelingTool.h
ParticleJetLabelCommon.h
JetQuarkChargeLabelingTool::m_map
std::map< int, int > m_map
Definition
JetQuarkChargeLabelingTool.h:37
JetQuarkChargeLabelingTool::m_chargeDecorator
Gaudi::Property< std::string > m_chargeDecorator
Definition
JetQuarkChargeLabelingTool.h:34
JetQuarkChargeLabelingTool::m_partonAccessor
Gaudi::Property< std::string > m_partonAccessor
Definition
JetQuarkChargeLabelingTool.h:33
JetQuarkChargeLabelingTool::initialize
StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition
JetQuarkChargeLabelingTool.cxx:19
JetQuarkChargeLabelingTool::m_hadronAccessor
Gaudi::Property< std::string > m_hadronAccessor
Definition
JetQuarkChargeLabelingTool.h:32
JetQuarkChargeLabelingTool::m_mapOption
Gaudi::Property< std::map< int, int > > m_mapOption
Definition
JetQuarkChargeLabelingTool.h:35
JetQuarkChargeLabelingTool::JetQuarkChargeLabelingTool
JetQuarkChargeLabelingTool(const std::string &name)
Constructor.
Definition
JetQuarkChargeLabelingTool.cxx:15
JetQuarkChargeLabelingTool::decorate
StatusCode decorate(const xAOD::JetContainer &jets) const override
Decorate a jet collection without otherwise modifying it.
Definition
JetQuarkChargeLabelingTool.cxx:29
asg::AsgTool::AsgTool
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition
AsgTool.cxx:58
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::JetContainer
JetContainer_v1 JetContainer
Definition of the current "jet container version".
Definition
JetContainer.h:17
Generated on
for ATLAS Offline Software by
1.17.0