ATLAS Offline Software
Loading...
Searching...
No Matches
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
13
14//
15// method implementations
16//
17
18namespace CP
19{
20
21 StatusCode JetUncertaintiesAlg ::
22 initialize ()
23 {
24 ANA_CHECK (m_uncertaintiesTool.retrieve());
28 if (!m_uncertaintiesToolPD.empty()) {
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) {
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 {
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}
#define ANA_CHECK(EXP)
check whether the given expression was successful
static const std::vector< std::string > systematics
#define ANA_CHECK_CORRECTION(helper, object, expr)
a helper check macro to work with OutOfValidityHelper
OutOfValidityHelper m_outOfValidity
the helper for OutOfValidity results
SysCopyHandle< xAOD::JetContainer > m_jetHandle
the jet collection we run on
ToolHandle< ICPJetUncertaintiesTool > m_uncertaintiesToolPD
the secondary jet uncertainties tool, for pseudo-data JER smearing
Gaudi::Property< std::string > m_isJESbtag
std::optional< SG::ConstAccessor< int > > m_accTruthLabel
SysReadSelectionHandle m_preselection
the preselection we apply to our input
SysListHandle m_systematicsList
the systematics list we run
std::vector< CP::SystematicSet > m_systematicsVector
the vector of systematics (for CPU-optimisation)
ToolHandle< ICPJetUncertaintiesTool > m_uncertaintiesTool
the main jet uncertainties tool
std::vector< CP::SystematicSet > m_systematicsVectorOnlyJERPseudoData
the vector of pseudo-data JER systematics (for CPU-optimisation)
std::optional< SG::Decorator< char > > m_decIsJESbtag
StatusCode applyTool(ToolHandle< ICPJetUncertaintiesTool > &tool, const std::vector< CP::SystematicSet > &systematics, bool decorateBtag, const EventContext &ctx)
apply the given tool for the given systematics
Select isolated Photons, Electrons and Muons.
Jet_v1 Jet
Definition of the current "jet version".
JetContainer_v1 JetContainer
Definition of the current "jet container version".