ATLAS Offline Software
Loading...
Searching...
No Matches
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
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 ()
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));
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 {
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));
80 for (xAOD::Jet *jet : *jets)
81 {
82 if (m_preselection.getBool (*jet, sys))
83 {
85 }
86 }
87 }
88
89 return StatusCode::SUCCESS;
90 }
91}
#define ANA_CHECK(EXP)
check whether the given expression was successful
#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::Accessor< 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
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".