ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
Jet
JetUncertainties
Root
ConstantUncertaintyComponent.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
JetUncertainties/ConstantUncertaintyComponent.h
"
6
#include "
JetUncertainties/Helpers.h
"
7
8
#include <cmath>
9
10
namespace
jet
11
{
12
14
// //
15
// Constructor/destructor/initialization //
16
// //
18
19
ConstantUncertaintyComponent::ConstantUncertaintyComponent
(
const
std::string& name)
20
:
UncertaintyComponent
(
ComponentHelper
(name))
21
,
m_name
(
""
)
22
,
m_value
(0)
23
,
m_histSpecified
(false)
24
{
25
JESUNC_NO_DEFAULT_CONSTRUCTOR
;
26
}
27
28
ConstantUncertaintyComponent::ConstantUncertaintyComponent
(
const
ComponentHelper
& component)
29
:
UncertaintyComponent
(component,0)
30
,
m_name
(component.name)
31
,
m_value
(component.constantValue)
32
,
m_histSpecified
(!component.uncNames.
empty
())
33
{
34
ATH_MSG_DEBUG
(Form(
"Creating ConstantUncertaintyComponent named %s"
,
m_name
.Data()));
35
}
36
37
ConstantUncertaintyComponent::ConstantUncertaintyComponent
(
const
ConstantUncertaintyComponent
& toCopy)
38
:
UncertaintyComponent
(toCopy)
39
,
m_name
(toCopy.
m_name
)
40
,
m_value
(toCopy.
m_value
)
41
,
m_histSpecified
(toCopy.
m_histSpecified
)
42
{
43
ATH_MSG_DEBUG
(Form(
"Creating copy of ConstantUncertaintyComponent named %s"
,
m_name
.Data()));
44
}
45
46
ConstantUncertaintyComponent
*
ConstantUncertaintyComponent::clone
()
const
47
{
48
return
new
ConstantUncertaintyComponent
(*
this
);
49
}
50
51
StatusCode
ConstantUncertaintyComponent::initialize
(TFile*
/*histFile*/
)
52
{
53
// Prevent double-initialization
54
if
(
m_isInit
)
55
{
56
ATH_MSG_ERROR
(
"Component is already initialized: "
<<
getName
().
Data
());
57
return
StatusCode::FAILURE;
58
}
59
60
// Fail loudly rather than silently ignoring a histogram the config asked for
61
if
(
m_histSpecified
)
62
{
63
ATH_MSG_ERROR
(
"Constant component specifies a Hists key, which it cannot use: "
<<
getName
().
Data
());
64
return
StatusCode::FAILURE;
65
}
66
if
(
m_validHistName
!=
""
)
67
{
68
ATH_MSG_ERROR
(
"Constant component specifies a VHist key, which it cannot use: "
<<
getName
().
Data
());
69
return
StatusCode::FAILURE;
70
}
71
72
if
(!std::isfinite(
m_value
))
73
{
74
ATH_MSG_ERROR
(
"Constant component has a non-finite Value: "
<<
getName
().
Data
());
75
return
StatusCode::FAILURE;
76
}
77
if
(
m_value
< 0)
78
{
79
ATH_MSG_ERROR
(
"Constant component has a negative Value, use a positive fraction and let the "
80
"systematic sign come from the requested variation: "
<<
getName
().
Data
());
81
return
StatusCode::FAILURE;
82
}
83
84
ATH_MSG_DEBUG
(
"Successfully initialized ConstantUncertaintyComponent named "
<<
getName
().
Data
()
85
<<
" with a flat fractional uncertainty of "
<<
m_value
);
86
87
m_isInit
=
true
;
88
return
StatusCode::SUCCESS;
89
}
90
91
93
// //
94
// Methods to test for special cases //
95
// //
97
98
bool
ConstantUncertaintyComponent::isAlwaysZero
()
const
99
{
100
if
(!
m_isInit
)
101
{
102
ATH_MSG_ERROR
(
"Cannot call method before initialization, component: "
<<
getName
().
Data
());
103
return
false
;
104
}
105
return
std::fabs(
m_value
) < 1.e-8;
106
}
107
108
110
// //
111
// Uncertainty/validity retrieval methods //
112
// //
114
115
bool
ConstantUncertaintyComponent::getValidityImpl
(
const
xAOD::Jet
&,
const
xAOD::EventInfo
&)
const
116
{
117
// A flat uncertainty has no parametrisation, so it has no validity range either.
118
return
true
;
119
}
120
121
double
ConstantUncertaintyComponent::getUncertaintyImpl
(
const
xAOD::Jet
&,
const
xAOD::EventInfo
&)
const
122
{
123
return
m_value
;
124
}
125
126
}
// end jet namespace
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x,...)
Definition
AthMsgStreamMacros.h:43
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x,...)
Definition
AthMsgStreamMacros.h:47
Data
@ Data
Definition
BaseObject.h:11
ConstantUncertaintyComponent.h
Helpers.h
JESUNC_NO_DEFAULT_CONSTRUCTOR
#define JESUNC_NO_DEFAULT_CONSTRUCTOR
Definition
Reconstruction/Jet/JetUncertainties/JetUncertainties/Helpers.h:23
empty
static const Attributes_t empty
Definition
XmlStreamer.cxx:16
jet::ComponentHelper
Definition
ConfigHelper.h:24
jet::ConstantUncertaintyComponent::clone
virtual ConstantUncertaintyComponent * clone() const
Definition
ConstantUncertaintyComponent.cxx:46
jet::ConstantUncertaintyComponent::getUncertaintyImpl
virtual double getUncertaintyImpl(const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const
Definition
ConstantUncertaintyComponent.cxx:121
jet::ConstantUncertaintyComponent::m_value
const double m_value
Definition
ConstantUncertaintyComponent.h:55
jet::ConstantUncertaintyComponent::isAlwaysZero
virtual bool isAlwaysZero() const
Definition
ConstantUncertaintyComponent.cxx:98
jet::ConstantUncertaintyComponent::initialize
virtual StatusCode initialize(TFile *histFile)
Deliberately does not touch the histogram file: there is no histogram.
Definition
ConstantUncertaintyComponent.cxx:51
jet::ConstantUncertaintyComponent::getValidityImpl
virtual bool getValidityImpl(const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const
Definition
ConstantUncertaintyComponent.cxx:115
jet::ConstantUncertaintyComponent::m_histSpecified
const bool m_histSpecified
Set if the config also asked for a histogram, which is a configuration error.
Definition
ConstantUncertaintyComponent.h:57
jet::ConstantUncertaintyComponent::m_name
const TString m_name
Definition
ConstantUncertaintyComponent.h:54
jet::ConstantUncertaintyComponent::getName
virtual TString getName() const
The base class reports the histogram name, which this component does not have.
Definition
ConstantUncertaintyComponent.h:41
jet::ConstantUncertaintyComponent::ConstantUncertaintyComponent
ConstantUncertaintyComponent(const ComponentHelper &component)
Definition
ConstantUncertaintyComponent.cxx:28
jet::UncertaintyComponent::UncertaintyComponent
UncertaintyComponent(const ComponentHelper &component, const size_t numHist=1)
Definition
UncertaintyComponent.cxx:47
jet::UncertaintyComponent::m_isInit
bool m_isInit
Definition
UncertaintyComponent.h:50
jet::UncertaintyComponent::m_validHistName
const TString m_validHistName
Definition
UncertaintyComponent.h:52
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