ATLAS Offline Software
GlobalLargeRDNNCalibration.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /* ***********************************************************************************\
6  * *
7  * Name: GlobalLargeRDNNCalibration *
8  * Purpose: Perform the DNN JES and JMS step of the large-R jets' calibration *
9  * *
10  * # Date Comments By *
11  * -- -------- -------------------------- ------------------------------------------ *
12  * 1 31/01/23 First Version G. Albouy, P.-A. Delsart *
13 \*************************************************************************************/
14 
15 
16 #ifndef JetCalibTools_GlobalLargeRDNNCalibration_H
17 #define JetCalibTools_GlobalLargeRDNNCalibration_H
18 
19 
20 // Other packages includes
21 #include "AthOnnxInterfaces/IOnnxRuntimeSvc.h" //Ort::Session
22 
23 // Local includes
25 
26 #include <string>
27 #include <vector>
28 
29 class EventInfo;
30 class TEnv;
31 
33 
34 public:
35  // Constructor/destructor/init
40 
45  GlobalLargeRDNNCalibration(const std::string& name);
46 
55  GlobalLargeRDNNCalibration(const std::string& name, TEnv * config, const TString& calibArea, bool dev);
56 
60  virtual ~GlobalLargeRDNNCalibration() ;
61 
66  virtual StatusCode initialize() override;
67 
68 
71  struct VarRetriever;
72 
73  protected:
74  // @brief Calibrates the jet, and decorates it with the calibration using the name "JetGNNCScaleMomentum"
75  // @param jet_reco The jet
76  // @param jetEventInfo A set of information about the event and jet
77  virtual StatusCode calibrate(xAOD::Jet& jet, JetEventInfo&) const override;
78 
79  private:
80 
86  std::vector<float> getJetFeatures( xAOD::Jet& jet_reco, JetEventInfo& jetEventInfo) const;
87 
88  std::vector<TString> m_NNInputs;
89  std::vector<double> m_eScales;
90  std::vector<double> m_NormOffsets;
91  std::vector<double> m_NormScales;
92  std::string m_modelFileName;
93 
94  std::vector<VarRetriever*> m_varretrievers;
95 
96  std::unique_ptr< Ort::Session > m_session;
97  std::vector<int64_t> m_input_node_dims;
98  std::vector<const char*> m_input_node_names;
99  std::vector<int64_t> m_output_node_dims;
100  std::vector<const char*> m_output_node_names;
101 
102  TEnv * m_config{};
103  std::string m_calibArea;
104  bool m_devMode{};
105 
106 
107 }; // Class GlobalLargeRDNNCalibration
108 
109 
110 #endif
GlobalLargeRDNNCalibration::m_varretrievers
std::vector< VarRetriever * > m_varretrievers
Definition: GlobalLargeRDNNCalibration.h:94
GlobalLargeRDNNCalibration::m_eScales
std::vector< double > m_eScales
Definition: GlobalLargeRDNNCalibration.h:89
GlobalLargeRDNNCalibration
Definition: GlobalLargeRDNNCalibration.h:32
GlobalLargeRDNNCalibration::getJetFeatures
std::vector< float > getJetFeatures(xAOD::Jet &jet_reco, JetEventInfo &jetEventInfo) const
Returns a vector of input features for the NN.
Definition: GlobalLargeRDNNCalibration.cxx:426
GlobalLargeRDNNCalibration::VarRetriever
VarRetriever is a generic class to access Jet and/or JetEventInfo variables.
Definition: GlobalLargeRDNNCalibration.cxx:94
GlobalLargeRDNNCalibration::m_output_node_dims
std::vector< int64_t > m_output_node_dims
Definition: GlobalLargeRDNNCalibration.h:99
GlobalLargeRDNNCalibration::m_NormScales
std::vector< double > m_NormScales
Definition: GlobalLargeRDNNCalibration.h:91
GlobalLargeRDNNCalibration::~GlobalLargeRDNNCalibration
virtual ~GlobalLargeRDNNCalibration()
The destructor.
Definition: GlobalLargeRDNNCalibration.cxx:205
GlobalLargeRDNNCalibration::m_output_node_names
std::vector< const char * > m_output_node_names
Definition: GlobalLargeRDNNCalibration.h:100
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
GlobalLargeRDNNCalibration::m_input_node_dims
std::vector< int64_t > m_input_node_dims
Definition: GlobalLargeRDNNCalibration.h:97
GlobalLargeRDNNCalibration::m_NormOffsets
std::vector< double > m_NormOffsets
Definition: GlobalLargeRDNNCalibration.h:90
JetEventInfo
Definition: JetEventInfo.h:8
GlobalLargeRDNNCalibration::m_config
TEnv * m_config
Definition: GlobalLargeRDNNCalibration.h:102
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
GlobalLargeRDNNCalibration::initialize
virtual StatusCode initialize() override
Returns the charged fraction of a jet.
Definition: GlobalLargeRDNNCalibration.cxx:210
GlobalLargeRDNNCalibration::m_NNInputs
std::vector< TString > m_NNInputs
Definition: GlobalLargeRDNNCalibration.h:88
GlobalLargeRDNNCalibration::GlobalLargeRDNNCalibration
GlobalLargeRDNNCalibration()
The constructor.
Definition: GlobalLargeRDNNCalibration.cxx:186
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
GlobalLargeRDNNCalibration::calibrate
virtual StatusCode calibrate(xAOD::Jet &jet, JetEventInfo &) const override
Definition: GlobalLargeRDNNCalibration.cxx:322
EventInfo
This class provides general information about an event. Event information is provided by the accessor...
Definition: EventInfo/EventInfo/EventInfo.h:43
IOnnxRuntimeSvc.h
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
GlobalLargeRDNNCalibration::m_calibArea
std::string m_calibArea
Definition: GlobalLargeRDNNCalibration.h:103
GlobalLargeRDNNCalibration::m_session
std::unique_ptr< Ort::Session > m_session
Definition: GlobalLargeRDNNCalibration.h:96
GlobalLargeRDNNCalibration::m_modelFileName
std::string m_modelFileName
Definition: GlobalLargeRDNNCalibration.h:92
GlobalLargeRDNNCalibration::m_devMode
bool m_devMode
Definition: GlobalLargeRDNNCalibration.h:104
JetCalibrationStep.h
GlobalLargeRDNNCalibration::m_input_node_names
std::vector< const char * > m_input_node_names
Definition: GlobalLargeRDNNCalibration.h:98
JetCalibrationStep
Definition: JetCalibrationStep.h:20