ATLAS Offline Software
JetCalibrationTool.h
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // JetCalibrationTool.h
8 // Header file for class JetCalibrationTool
9 // Author: Joe Taenzer <joseph.taenzer@cern.ch>
11 #ifndef JETCALIBTOOLS_APPLYJETCALIBRATION_H
12 #define JETCALIBTOOLS_APPLYJETCALIBRATION_H 1
13 
14 #include <string.h>
15 
16 #include <TString.h>
17 #include <TEnv.h>
18 
19 #include "AsgTools/AsgTool.h"
20 #include "AsgTools/AsgToolMacros.h"
21 
26 
30 
31 
33  : public asg::AsgTool,
34  virtual public IJetCalibrationTool {
35 
37 
38 public:
40  JetCalibrationTool(const std::string& name = "JetCalibrationTool");
41 
44 
45  enum jetScale { EM, LC, PFLOW };
46 
47  StatusCode initialize() override;
48 
50 
51  // Get the nominal resolution
52  StatusCode getNominalResolutionData(const xAOD::Jet& jet, double& resolution) const override;
53  StatusCode getNominalResolutionMC( const xAOD::Jet& jet, double& resolution) const override;
54 
55 private:
56  StatusCode calibrate(xAOD::Jet& jet, JetEventInfo& jetEventInfo) const;
57  //Set event by event info like rho, mu, NPV
58  StatusCode initializeEvent(JetEventInfo& jetEventInfo) const;
59  //Add an item to the vector of calibration steps
60  StatusCode getCalibClass(const TString& calibration);
61 
62 //Private members
63 private:
64  SG::ReadHandleKey<xAOD::EventInfo> m_evtInfoKey{this, "EventInfoKey", "EventInfo"};
66  SG::ReadHandleKey<xAOD::VertexContainer> m_pvKey{this, "PrimaryVerticesContainerName", "PrimaryVertices"};
67  SG::ReadDecorHandleKey<xAOD::EventInfo> m_muKey {this, "averageInteractionsPerCrossingKey",
68  "EventInfo.averageInteractionsPerCrossing","Decoration for Average Interaction Per Crossing"};
69  SG::ReadDecorHandleKey<xAOD::EventInfo> m_actualMuKey {this, "actualInteractionsPerCrossing",
70  "EventInfo.actualInteractionsPerCrossing","Decoration for Actual Number of Interactions Per Crossing"};
71 
72  //Variables for configuration
73  std::string m_jetAlgo;
74  std::string m_config;
75  std::string m_calibSeq;
76  std::string m_calibAreaTag;
77  std::string m_originScale;
78  bool m_devMode{};
79  bool m_isData{true};
83  float m_nJetThreshold{};
84  std::string m_nJetContainerName;
85  std::string m_dir;
86  std::string m_eInfoName;
87  std::vector<TString> m_timeDependentInsituConfigs;
88  std::vector<double> m_runBins;
91  std::vector<TString> m_insituCombMassConfig;
92 
93  //TEnv to hold the global text config
94  TEnv * m_globalConfig{};
95  std::vector<TEnv*> m_globalTimeDependentConfigs;
96  std::vector<TEnv*> m_globalInsituCombMassConfig;
97 
98  //Bools/enums to avoid string comparisons at run time
100  bool m_doBcid{true};
101  bool m_doJetArea{true};
102  bool m_doResidual{true};
103  bool m_doOrigin{true};
104  bool m_doGSC{true};
105  bool m_doDNNCal{};
106 
107  std::string m_gscDepth{"auto"}; // if not set then use the one defined in the config
108 
109  std::vector<std::unique_ptr<JetCalibrationStep> > m_calibSteps;
110  int m_smearIndex{-1};
111 
112  // Try to use jet-attribute-specified origin vertex for calibration
114 };
115 
116 #endif //> !JETCALIBTOOLS_APPLYJETCALIBRATION_H
JetCalibrationTool::m_doResidual
bool m_doResidual
Definition: JetCalibrationTool.h:102
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
JetCalibrationTool::m_smearIndex
int m_smearIndex
Definition: JetCalibrationTool.h:110
JetCalibrationTool::m_originCorrectedClusters
bool m_originCorrectedClusters
Definition: JetCalibrationTool.h:81
JetCalibrationTool::m_jetAlgo
std::string m_jetAlgo
Definition: JetCalibrationTool.h:73
JetCalibrationTool::LC
@ LC
Definition: JetCalibrationTool.h:45
EventShape.h
ASG_TOOL_CLASS2
#define ASG_TOOL_CLASS2(CLASSNAME, INT1, INT2)
Definition: AsgToolMacros.h:77
JetCalibrationTool::m_timeDependentInsituConfigs
std::vector< TString > m_timeDependentInsituConfigs
Definition: JetCalibrationTool.h:87
JetCalibrationTool::m_muKey
SG::ReadDecorHandleKey< xAOD::EventInfo > m_muKey
Definition: JetCalibrationTool.h:67
JetCalibrationTool::m_isData
bool m_isData
Definition: JetCalibrationTool.h:79
JetCalibrationTool::EM
@ EM
Definition: JetCalibrationTool.h:45
JetCalibrationTool::m_gscDepth
std::string m_gscDepth
Definition: JetCalibrationTool.h:107
JetCalibrationTool::initialize
StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: JetCalibrationTool.cxx:54
JetCalibrationTool::getCalibClass
StatusCode getCalibClass(const TString &calibration)
Definition: JetCalibrationTool.cxx:227
JetCalibrationTool::m_rhoKey
SG::ReadHandleKey< xAOD::EventShape > m_rhoKey
Definition: JetCalibrationTool.h:65
JetCalibrationTool::calibrate
StatusCode calibrate(xAOD::Jet &jet, JetEventInfo &jetEventInfo) const
Definition: JetCalibrationTool.cxx:558
JetCalibrationTool::m_devMode
bool m_devMode
Definition: JetCalibrationTool.h:78
SG::ReadHandleKey< xAOD::EventInfo >
Dedxcorrection::resolution
double resolution[nGasTypes][nParametersResolution]
Definition: TRT_ToT_Corrections.h:46
JetCalibrationTool::m_runBins
std::vector< double > m_runBins
Definition: JetCalibrationTool.h:88
IJetCalibrationTool.h
JetCalibrationTool::m_doJetArea
bool m_doJetArea
Definition: JetCalibrationTool.h:101
JetCalibrationTool::m_pvKey
SG::ReadHandleKey< xAOD::VertexContainer > m_pvKey
Definition: JetCalibrationTool.h:66
JetCalibrationTool::initializeEvent
StatusCode initializeEvent(JetEventInfo &jetEventInfo) const
Definition: JetCalibrationTool.cxx:347
JetCalibrationTool::m_globalConfig
TEnv * m_globalConfig
Definition: JetCalibrationTool.h:94
JetCalibrationTool::m_insituCombMassConfig
std::vector< TString > m_insituCombMassConfig
Definition: JetCalibrationTool.h:91
ReadDecorHandleKey.h
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
JetEventInfo
Definition: JetEventInfo.h:8
IJetCalibrationTool
class IJetCalibrationTool
Definition: IJetCalibrationTool.h:26
JetCalibrationTool::PFLOW
@ PFLOW
Definition: JetCalibrationTool.h:45
JetCalibrationTool::m_nJetThreshold
float m_nJetThreshold
Definition: JetCalibrationTool.h:83
JetCalibrationTool::getNominalResolutionMC
StatusCode getNominalResolutionMC(const xAOD::Jet &jet, double &resolution) const override
Definition: JetCalibrationTool.cxx:588
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
Ringer::EM
@ EM
Definition: CaloRingsDefs.h:19
JetCalibrationTool::m_dir
std::string m_dir
Definition: JetCalibrationTool.h:85
JetCalibrationTool::m_calibAreaTag
std::string m_calibAreaTag
Definition: JetCalibrationTool.h:76
JetCalibrationTool::m_eInfoName
std::string m_eInfoName
Definition: JetCalibrationTool.h:86
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
JetCalibrationTool::m_nJetContainerName
std::string m_nJetContainerName
Definition: JetCalibrationTool.h:84
JetCalibrationTool
Definition: JetCalibrationTool.h:34
JetCalibrationTool::m_evtInfoKey
SG::ReadHandleKey< xAOD::EventInfo > m_evtInfoKey
Definition: JetCalibrationTool.h:64
JetCalibrationTool::jetScale
jetScale
Definition: JetCalibrationTool.h:45
JetCalibrationTool::m_doSetDetectorEta
bool m_doSetDetectorEta
Definition: JetCalibrationTool.h:89
JetCalibrationTool::m_originScale
std::string m_originScale
Definition: JetCalibrationTool.h:77
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
JetCalibrationTool::m_actualMuKey
SG::ReadDecorHandleKey< xAOD::EventInfo > m_actualMuKey
Definition: JetCalibrationTool.h:69
JetCalibrationTool::m_jetScale
jetScale m_jetScale
Definition: JetCalibrationTool.h:99
JetEventInfo.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
JetCalibrationTool::JetCalibrationTool
JetCalibrationTool(const std::string &name="JetCalibrationTool")
Constructor with parameters:
Definition: JetCalibrationTool.cxx:27
JetCalibrationTool::m_config
std::string m_config
Definition: JetCalibrationTool.h:74
JetCalibrationTool::getNominalResolutionData
StatusCode getNominalResolutionData(const xAOD::Jet &jet, double &resolution) const override
Definition: JetCalibrationTool.cxx:579
JetCalibrationTool::m_globalTimeDependentConfigs
std::vector< TEnv * > m_globalTimeDependentConfigs
Definition: JetCalibrationTool.h:95
EventInfo.h
JetCalibrationTool::applyCalibration
StatusCode applyCalibration(xAOD::JetContainer &) const override
Apply calibration to a jet container.
Definition: JetCalibrationTool.cxx:335
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
VertexContainer.h
JetCalibrationTool::m_globalInsituCombMassConfig
std::vector< TEnv * > m_globalInsituCombMassConfig
Definition: JetCalibrationTool.h:96
JetCalibrationTool::m_doGSC
bool m_doGSC
Definition: JetCalibrationTool.h:104
JetCalibrationTool::m_doBcid
bool m_doBcid
Definition: JetCalibrationTool.h:100
JetCalibrationTool::m_timeDependentCalib
bool m_timeDependentCalib
Definition: JetCalibrationTool.h:80
AsgToolMacros.h
JetCalibrationTool::m_calibSeq
std::string m_calibSeq
Definition: JetCalibrationTool.h:75
JetCalibrationTool::m_useNjetInResidual
bool m_useNjetInResidual
Definition: JetCalibrationTool.h:82
JetCalibrationStep.h
SG::ReadDecorHandleKey
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Definition: StoreGate/StoreGate/ReadDecorHandleKey.h:85
AsgTool.h
JetCalibrationTool::m_useOriginVertex
bool m_useOriginVertex
Definition: JetCalibrationTool.h:113
JetCalibrationTool::m_doDNNCal
bool m_doDNNCal
Definition: JetCalibrationTool.h:105
JetCalibrationTool::m_doOrigin
bool m_doOrigin
Definition: JetCalibrationTool.h:103
JetCalibrationTool::~JetCalibrationTool
~JetCalibrationTool()
Destructor:
Definition: JetCalibrationTool.cxx:43
IJetModifier
IJetModifier is a dual-use tool interface for a tool that modifies a jet collection.
Definition: IJetModifier.h:20
JetCalibrationTool::m_calibSteps
std::vector< std::unique_ptr< JetCalibrationStep > > m_calibSteps
Definition: JetCalibrationTool.h:109
JetCalibrationTool::m_insituCombMassCalib
bool m_insituCombMassCalib
Definition: JetCalibrationTool.h:90