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-2024 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
for
(
const
auto
& sys :
m_systematicsVector
)
59
{
60
ANA_CHECK
(
m_uncertaintiesTool
->applySystematicVariation (sys));
61
xAOD::JetContainer
*jets =
nullptr
;
62
ANA_CHECK
(
m_jetHandle
.getCopy (jets, sys, ctx));
63
for
(
xAOD::Jet
*
jet
: *jets)
64
{
65
// we need to tell the JES flavour uncertainty tool whether each jet is b-tagged at truth-level
66
if
(
m_decIsJESbtag
) {
67
(*m_decIsJESbtag)(*jet) = (*m_accTruthLabel)(*jet) == 5 ;
68
}
69
if
(
m_preselection
.getBool (*
jet
, sys))
70
{
71
ANA_CHECK_CORRECTION
(
m_outOfValidity
, *
jet
,
m_uncertaintiesTool
->applyCorrection (*
jet
));
72
}
73
}
74
}
75
for
(
const
auto
& sys :
m_systematicsVectorOnlyJERPseudoData
)
76
{
77
ANA_CHECK
(
m_uncertaintiesToolPD
->applySystematicVariation (sys));
78
xAOD::JetContainer
*jets =
nullptr
;
79
ANA_CHECK
(
m_jetHandle
.getCopy (jets, sys, ctx));
80
for
(
xAOD::Jet
*
jet
: *jets)
81
{
82
if
(
m_preselection
.getBool (*
jet
, sys))
83
{
84
ANA_CHECK_CORRECTION
(
m_outOfValidity
, *
jet
,
m_uncertaintiesToolPD
->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:324
JetUncertaintiesAlg.h
ANA_CHECK_CORRECTION
#define ANA_CHECK_CORRECTION(helper, object, expr)
a helper check macro to work with OutOfValidityHelper
Definition
OutOfValidityHelper.h:132
CP::JetUncertaintiesAlg::m_outOfValidity
OutOfValidityHelper m_outOfValidity
the helper for OutOfValidity results
Definition
JetUncertaintiesAlg.h:59
CP::JetUncertaintiesAlg::m_jetHandle
SysCopyHandle< xAOD::JetContainer > m_jetHandle
the jet collection we run on
Definition
JetUncertaintiesAlg.h:49
CP::JetUncertaintiesAlg::m_uncertaintiesToolPD
ToolHandle< ICPJetUncertaintiesTool > m_uncertaintiesToolPD
the secondary jet uncertainties tool, for pseudo-data JER smearing
Definition
JetUncertaintiesAlg.h:41
CP::JetUncertaintiesAlg::m_isJESbtag
Gaudi::Property< std::string > m_isJESbtag
Definition
JetUncertaintiesAlg.h:70
CP::JetUncertaintiesAlg::m_accTruthLabel
std::optional< SG::Accessor< int > > m_accTruthLabel
Definition
JetUncertaintiesAlg.h:72
CP::JetUncertaintiesAlg::m_preselection
SysReadSelectionHandle m_preselection
the preselection we apply to our input
Definition
JetUncertaintiesAlg.h:54
CP::JetUncertaintiesAlg::m_systematicsList
SysListHandle m_systematicsList
the systematics list we run
Definition
JetUncertaintiesAlg.h:45
CP::JetUncertaintiesAlg::m_systematicsVector
std::vector< CP::SystematicSet > m_systematicsVector
the vector of systematics (for CPU-optimisation)
Definition
JetUncertaintiesAlg.h:63
CP::JetUncertaintiesAlg::m_uncertaintiesTool
ToolHandle< ICPJetUncertaintiesTool > m_uncertaintiesTool
the main jet uncertainties tool
Definition
JetUncertaintiesAlg.h:37
CP::JetUncertaintiesAlg::m_systematicsVectorOnlyJERPseudoData
std::vector< CP::SystematicSet > m_systematicsVectorOnlyJERPseudoData
the vector of pseudo-data JER systematics (for CPU-optimisation)
Definition
JetUncertaintiesAlg.h:67
CP::JetUncertaintiesAlg::m_decIsJESbtag
std::optional< SG::Decorator< char > > m_decIsJESbtag
Definition
JetUncertaintiesAlg.h:71
CP
Select isolated Photons, Electrons and Muons.
Definition
Control/xAODRootAccess/xAODRootAccess/TEvent.h:27
SG::AllowEmpty
@ AllowEmpty
Definition
StoreGate/StoreGate/VarHandleKey.h:27
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