ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
Jet
JetUncertainties
Root
PtAbsMassUncertaintyComponent.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 "
JetUncertainties/PtAbsMassUncertaintyComponent.h
"
6
#include "
JetUncertainties/Helpers.h
"
7
8
namespace
jet
9
{
10
12
// //
13
// Constructor/destructor/initialization //
14
// //
16
17
PtAbsMassUncertaintyComponent::PtAbsMassUncertaintyComponent
(
const
std::string& name)
18
:
UncertaintyComponent
(
ComponentHelper
(name))
19
,
m_massDef
(
CompMassDef
::UNKNOWN)
20
,
m_truthLabelName
(
""
)
21
,
m_truthLabels
()
22
{
23
JESUNC_NO_DEFAULT_CONSTRUCTOR
;
24
}
25
26
PtAbsMassUncertaintyComponent::PtAbsMassUncertaintyComponent
(
const
ComponentHelper
& component)
27
:
UncertaintyComponent
(component)
28
,
m_massDef
(component.massDef)
29
,
m_truthLabelName
(component.LargeRJetTruthLabelName)
30
,
m_truthLabels
(component.LargeRJetTruthLabels)
31
{
32
ATH_MSG_DEBUG
(Form(
"Creating PtAbsMassUncertaintyComponent named %s"
,
m_uncHistName
.Data()));
33
}
34
35
PtAbsMassUncertaintyComponent::PtAbsMassUncertaintyComponent
(
const
PtAbsMassUncertaintyComponent
& toCopy)
36
:
UncertaintyComponent
(toCopy)
37
,
m_massDef
(toCopy.
m_massDef
)
38
,
m_truthLabelName
(toCopy.
m_truthLabelName
)
39
,
m_truthLabels
(toCopy.
m_truthLabels
)
40
{
41
ATH_MSG_DEBUG
(Form(
"Creating copy of PtAbsMassUncertaintyComponent named %s"
,
m_uncHistName
.Data()));
42
}
43
44
PtAbsMassUncertaintyComponent
*
PtAbsMassUncertaintyComponent::clone
()
const
45
{
46
return
new
PtAbsMassUncertaintyComponent
(*
this
);
47
}
48
49
51
// //
52
// Validity and uncertainty retrieval //
53
// //
55
56
bool
PtAbsMassUncertaintyComponent::getValidityImpl
(
const
xAOD::Jet
&
jet
,
const
xAOD::EventInfo
&)
const
57
{
58
return
!
m_validHist
? true :
getValidBool
(
m_validHist
->getValue(
jet
.pt()*
m_energyScale
,
getAbsMass
(
jet
,
m_massDef
)*
m_energyScale
));
59
}
60
61
double
PtAbsMassUncertaintyComponent::getUncertaintyImpl
(
const
xAOD::Jet
&
jet
,
const
xAOD::EventInfo
&)
const
62
{
63
// Check if we need to do anything at all - this uncertainty may be zero based on the jet truth label
64
// Truth labels are usually not expected for this component, so check if we need to do this
65
if
(!
m_truthLabels
.empty())
66
{
67
// Truth labels are specified, so we need to check if this jet is labelled appropriately or not
68
const
SG::AuxElement::ConstAccessor<int> accTruthLabel(
m_truthLabelName
);
69
if
(!accTruthLabel.isAvailable(
jet
) || accTruthLabel(
jet
) ==
LargeRJetTruthLabel::UNKNOWN
)
70
{
71
ATH_MSG_ERROR
(
"Unable to retrieve the LargeRJetTruthLabel: "
<<
m_truthLabelName
<<
" from the jet. Please use JetTruthLabelingTool before calling this function."
);
72
return
JESUNC_ERROR_CODE
;
73
}
74
const
LargeRJetTruthLabel::TypeEnum
jetTruthLabel =
LargeRJetTruthLabel::intToEnum
(accTruthLabel(
jet
));
75
76
// We now have the truth jet label, check if it matches one of the label(s) assigned to this component
77
// The uncertainty is only applied to same-labelled jets (zero otherwise)
78
bool
labelApplies =
false
;
79
for
(
const
LargeRJetTruthLabel::TypeEnum
aLabel :
m_truthLabels
)
80
{
81
if
(aLabel == jetTruthLabel)
82
{
83
labelApplies =
true
;
84
break
;
85
}
86
}
87
// If the jet is not of the relevant label, then there is no uncertainty for this jet
88
if
(!labelApplies)
89
return
0;
90
}
91
92
return
m_uncHist
->getValue(
jet
.pt()*
m_energyScale
,
getAbsMass
(
jet
,
m_massDef
)*
m_energyScale
);
93
}
94
95
}
// end jet namespace
96
97
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
PtAbsMassUncertaintyComponent.h
Helpers.h
JESUNC_ERROR_CODE
#define JESUNC_ERROR_CODE
Definition
Reconstruction/Jet/JetUncertainties/JetUncertainties/Helpers.h:23
JESUNC_NO_DEFAULT_CONSTRUCTOR
#define JESUNC_NO_DEFAULT_CONSTRUCTOR
Definition
Reconstruction/Jet/JetUncertainties/JetUncertainties/Helpers.h:24
jet::ComponentHelper
Definition
ConfigHelper.h:24
jet::PtAbsMassUncertaintyComponent::m_massDef
const CompMassDef::TypeEnum m_massDef
Definition
PtAbsMassUncertaintyComponent.h:30
jet::PtAbsMassUncertaintyComponent::m_truthLabelName
std::string m_truthLabelName
Definition
PtAbsMassUncertaintyComponent.h:33
jet::PtAbsMassUncertaintyComponent::m_truthLabels
std::vector< LargeRJetTruthLabel::TypeEnum > m_truthLabels
Definition
PtAbsMassUncertaintyComponent.h:34
jet::PtAbsMassUncertaintyComponent::PtAbsMassUncertaintyComponent
PtAbsMassUncertaintyComponent(const ComponentHelper &component)
Definition
PtAbsMassUncertaintyComponent.cxx:26
jet::PtAbsMassUncertaintyComponent::clone
virtual PtAbsMassUncertaintyComponent * clone() const
Definition
PtAbsMassUncertaintyComponent.cxx:44
jet::PtAbsMassUncertaintyComponent::getValidityImpl
virtual bool getValidityImpl(const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const
Definition
PtAbsMassUncertaintyComponent.cxx:56
jet::PtAbsMassUncertaintyComponent::getUncertaintyImpl
virtual double getUncertaintyImpl(const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const
Definition
PtAbsMassUncertaintyComponent.cxx:61
jet::UncertaintyComponent::m_energyScale
const float m_energyScale
Definition
UncertaintyComponent.h:55
jet::UncertaintyComponent::UncertaintyComponent
UncertaintyComponent(const ComponentHelper &component, const size_t numHist=1)
Definition
UncertaintyComponent.cxx:47
jet::UncertaintyComponent::getAbsMass
virtual double getAbsMass(const xAOD::Jet &jet, const CompMassDef::TypeEnum massDef) const
Definition
UncertaintyComponent.cxx:309
jet::UncertaintyComponent::getValidBool
virtual bool getValidBool(const double validity) const
Definition
UncertaintyComponent.cxx:301
jet::UncertaintyComponent::m_uncHistName
const TString m_uncHistName
Definition
UncertaintyComponent.h:51
jet::UncertaintyComponent::m_validHist
UncertaintyHistogram * m_validHist
Definition
UncertaintyComponent.h:61
jet::UncertaintyComponent::m_uncHist
UncertaintyHistogram * m_uncHist
Definition
UncertaintyComponent.h:60
LargeRJetTruthLabel::intToEnum
TypeEnum intToEnum(const int type)
Definition
LargeRJetLabelEnum.h:63
LargeRJetTruthLabel::TypeEnum
TypeEnum
Definition
LargeRJetLabelEnum.h:14
LargeRJetTruthLabel::UNKNOWN
@ UNKNOWN
Definition
LargeRJetLabelEnum.h:15
jet::CompMassDef
Definition
UncertaintyEnum.h:69
jet
Definition
JetCalibTools_PlotJESFactors.cxx:23
xAOD::Jet
Jet_v1 Jet
Definition of the current "jet version".
Definition
Event/xAOD/xAODJet/xAODJet/Jet.h:17
xAOD::EventInfo
EventInfo_v1 EventInfo
Definition of the latest event info version.
Definition
IEventInfoCnvTool.h:16
Generated on
for ATLAS Offline Software by
1.17.0