ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
Algorithms
JetAnalysisAlgorithms
Root
JetUncertaintiesAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
7
8
//
9
// includes
10
//
11
12
#include <
JetAnalysisAlgorithms/JetUncertaintiesAlg.h
>
13
14
//
15
// method implementations
16
//
17
18
namespace
CP
19
{
20
21
StatusCode JetUncertaintiesAlg ::
22
initialize ()
23
{
24
ANA_CHECK
(
m_uncertaintiesTool
.retrieve());
25
ANA_CHECK
(
m_jetHandle
.initialize (
m_systematicsList
));
26
ANA_CHECK
(
m_preselection
.initialize (
m_systematicsList
,
m_jetHandle
,
SG::AllowEmpty
));
27
ANA_CHECK
(
m_systematicsList
.addSystematics (*
m_uncertaintiesTool
));
28
if
(!
m_uncertaintiesToolPD
.empty()) {
29
ANA_CHECK
(
m_uncertaintiesToolPD
.retrieve());
30
ANA_CHECK
(
m_systematicsList
.addSystematics (*
m_uncertaintiesToolPD
));
31
}
32
ANA_CHECK
(
m_systematicsList
.initialize());
33
ANA_CHECK
(
m_outOfValidity
.initialize());
34
35
if
(!
m_isJESbtag
.empty())
m_decIsJESbtag
.emplace(
m_isJESbtag
);
36
const
std::string labelB =
"PartonTruthLabelID"
;
37
m_accTruthLabel
.emplace(labelB);
38
39
// CPU-optimisation: differentiate the systematics for the two tools
40
// in initialisation rather than execution
41
for
(
const
auto
&sys :
m_systematicsList
.systematicsVector())
42
{
43
if
(sys.name().find(
"PseudoData"
) != std::string::npos) {
44
m_systematicsVectorOnlyJERPseudoData
.push_back(sys);
45
}
46
else
{
47
m_systematicsVector
.push_back(sys);
48
}
49
}
50
return
StatusCode::SUCCESS;
51
}
52
53
54
55
StatusCode JetUncertaintiesAlg ::
56
execute (
const
EventContext& ctx)
57
{
58
ANA_CHECK
(
applyTool
(
m_uncertaintiesTool
,
m_systematicsVector
,
true
, ctx));
59
ANA_CHECK
(
applyTool
(
m_uncertaintiesToolPD
,
m_systematicsVectorOnlyJERPseudoData
,
false
, ctx));
60
61
return
StatusCode::SUCCESS;
62
}
63
64
65
66
StatusCode JetUncertaintiesAlg ::
67
applyTool (ToolHandle<ICPJetUncertaintiesTool>& tool,
68
const
std::vector<CP::SystematicSet>&
systematics
,
69
bool
decorateBtag,
const
EventContext& ctx)
70
{
71
for
(
const
auto
& sys :
systematics
)
72
{
73
ANA_CHECK
(tool->applySystematicVariation (sys));
74
xAOD::JetContainer
*jets =
nullptr
;
75
ANA_CHECK
(
m_jetHandle
.getCopy (jets, sys, ctx));
76
for
(
xAOD::Jet
*
jet
: *jets)
77
{
78
// we need to tell the JES flavour uncertainty tool whether each jet is b-tagged at truth-level
79
if
(decorateBtag &&
m_decIsJESbtag
) {
80
(*m_decIsJESbtag)(*jet) =
m_accTruthLabel
->isAvailable (*
jet
) && (*m_accTruthLabel)(*jet) == 5;
81
}
82
if
(
m_preselection
.getBool (*
jet
, sys))
83
{
84
ANA_CHECK_CORRECTION
(
m_outOfValidity
, *
jet
, tool->applyCorrection (*
jet
));
85
}
86
}
87
}
88
89
return
StatusCode::SUCCESS;
90
}
91
}
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:325
JetUncertaintiesAlg.h
systematics
static const std::vector< std::string > systematics
Definition
MuonTriggerSFFilesTest.cxx:23
ANA_CHECK_CORRECTION
#define ANA_CHECK_CORRECTION(helper, object, expr)
a helper check macro to work with OutOfValidityHelper
Definition
OutOfValidityHelper.h:131
CP::JetUncertaintiesAlg::m_outOfValidity
OutOfValidityHelper m_outOfValidity
the helper for OutOfValidity results
Definition
JetUncertaintiesAlg.h:65
CP::JetUncertaintiesAlg::m_jetHandle
SysCopyHandle< xAOD::JetContainer > m_jetHandle
the jet collection we run on
Definition
JetUncertaintiesAlg.h:55
CP::JetUncertaintiesAlg::m_uncertaintiesToolPD
ToolHandle< ICPJetUncertaintiesTool > m_uncertaintiesToolPD
the secondary jet uncertainties tool, for pseudo-data JER smearing
Definition
JetUncertaintiesAlg.h:47
CP::JetUncertaintiesAlg::m_isJESbtag
Gaudi::Property< std::string > m_isJESbtag
Definition
JetUncertaintiesAlg.h:76
CP::JetUncertaintiesAlg::m_accTruthLabel
std::optional< SG::ConstAccessor< int > > m_accTruthLabel
Definition
JetUncertaintiesAlg.h:78
CP::JetUncertaintiesAlg::m_preselection
SysReadSelectionHandle m_preselection
the preselection we apply to our input
Definition
JetUncertaintiesAlg.h:60
CP::JetUncertaintiesAlg::m_systematicsList
SysListHandle m_systematicsList
the systematics list we run
Definition
JetUncertaintiesAlg.h:51
CP::JetUncertaintiesAlg::m_systematicsVector
std::vector< CP::SystematicSet > m_systematicsVector
the vector of systematics (for CPU-optimisation)
Definition
JetUncertaintiesAlg.h:69
CP::JetUncertaintiesAlg::m_uncertaintiesTool
ToolHandle< ICPJetUncertaintiesTool > m_uncertaintiesTool
the main jet uncertainties tool
Definition
JetUncertaintiesAlg.h:43
CP::JetUncertaintiesAlg::m_systematicsVectorOnlyJERPseudoData
std::vector< CP::SystematicSet > m_systematicsVectorOnlyJERPseudoData
the vector of pseudo-data JER systematics (for CPU-optimisation)
Definition
JetUncertaintiesAlg.h:73
CP::JetUncertaintiesAlg::m_decIsJESbtag
std::optional< SG::Decorator< char > > m_decIsJESbtag
Definition
JetUncertaintiesAlg.h:77
CP::JetUncertaintiesAlg::applyTool
StatusCode applyTool(ToolHandle< ICPJetUncertaintiesTool > &tool, const std::vector< CP::SystematicSet > &systematics, bool decorateBtag, const EventContext &ctx)
apply the given tool for the given systematics
Definition
JetUncertaintiesAlg.cxx:67
CP
Select isolated Photons, Electrons and Muons.
Definition
Control/xAODRootAccess/xAODRootAccess/TEvent.h:27
SG::AllowEmpty
@ AllowEmpty
Definition
StoreGate/StoreGate/VarHandleKey.h:29
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::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