ATLAS Offline Software
Loading...
Searching...
No Matches
egammaTransformerCalibTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4#ifndef XAOD_ANALYSIS
5
6#ifndef EGAMMATRANSFORMERCALIB_EGAMMATRANSFORMERCALIBTOOL_H
7#define EGAMMATRANSFORMERCALIB_EGAMMATRANSFORMERCALIBTOOL_H
8
9// Package includes
16
17// Framework includes
18#include "AsgTools/AsgTool.h"
20
21// Root includes
22#include "TFormula.h"
23#include "TH2Poly.h"
24#include "TObject.h"
25#include "TString.h"
26
27// STL includes
28#include <functional>
29#include <memory>
30#include <string>
31
49
51 virtual public IegammaMVACalibTool {
53 public:
54 egammaTransformerCalibTool(const std::string& type);
55 virtual ~egammaTransformerCalibTool() override;
56
57 virtual StatusCode initialize() override;
58
60 float getEnergy(const xAOD::CaloCluster& clus, const xAOD::Egamma* eg,
62 egammaMVACalib::GlobalEventInfo()) const override final;
63
64 private:
65 Gaudi::Property<int> m_particleType{
67 "What type of particle do we use"};
68
69 Gaudi::Property<bool> m_clusterEif0{
70 this, "useClusterIf0", true, "Use cluster energy if MVA response is 0"};
71
73 Gaudi::Property<std::string> m_folder{this, "folder", "",
74 "string with folder for weight files"};
75
77 Gaudi::Property<bool> m_isMC{this, "isMC", false, "Whether the input file is MC or data"};
78
79 Gaudi::Property<bool> m_useLayerCorrected{this, "useLayerCorrection", true,
80 "whether to use layer corrections"};
81
82 Gaudi::Property<std::string> m_layerCalibTune{this, "layerRecalibrationTune", "es2025_run3_extrapolate_gnn_v0",
83 "layer to use for layer corrections"};
84
85 Gaudi::Property<bool> m_useSaccCorrection{this, "useSaccCorrection", true,
86 "whether to use SACC correction for layer recalibration"};
87
88 Gaudi::Property<bool> m_useFixForMissingCells{this, "useFixForMissingCells", true,
89 "whether to apply fix for missing cells in layer recalibration, this is applied by default, this must be set to true whenever the timing cut fix is applied. Otherwise the layer calibration will not have correct scale factors for cell energies after timing cut fix"};
90
91 Gaudi::Property<bool> m_useExtraLayerScales{this, "useExtraLayerScales", false,
92 "whether to apply extra layer scales, this is for systematics studies, by default it is false and the extra layer scales are set to 1.0"};
93
94 Gaudi::Property<std::string> m_electronModelFile{
95 this, "ElectronModelFile", "electron_model_calibration.onnx",
96 "ONNX file for electron transformer model"};
97
98 Gaudi::Property<std::string> m_unconvertedPhotonModelFile{
99 this, "UnconvertedPhotonModelFile",
100 "unconverted_photon_model_calibration.onnx",
101 "ONNX file for unconverted photon transformer model"};
102
103 Gaudi::Property<std::string> m_convertedPhotonModelFile{
104 this, "ConvertedPhotonModelFile",
105 "converted_photon_model_calibration.onnx",
106 "ONNX file for converted photon transformer model"};
107
108 Gaudi::Property<std::string> m_forwardElectronModelFile{
109 this, "ForwardElectronModelFile",
110 "",
111 "ONNX file for forward electron transformer model, this is NOT "
112 "implemented yet"};
113
114 // Transformer model utils
115 std::unique_ptr<const FlavorTagInference::SaltModel> m_saltModel;
118 static constexpr double m_timeCut = 12.;
119
120 std::unique_ptr<egammaLayerRecalibTool> m_layerRecalibTool = nullptr;
121
122 // LG: scale for MG and LG need to be added later since the amount of work is not small.
123
125 ToolHandle<IegammaCellRecoveryTool> m_egammaCellRecoveryTool{
126 this,
127 "egammaCellRecoveryTool",
128 "egammaCellRecoveryTool/egammaCellRecoveryTool",
129 "Optional tool that adds cells in L2 or L3 "
130 "that could have been rejected by timing cut"
131 };
132
135 StatusCode setupTransformerModel(const std::string& fileName);
136
137};
138
139#endif
140
141#endif
#define ASG_TOOL_CLASS(CLASSNAME, INT1)
A tool used by the egammaMVASvc to help manage the MVAs.
Base class for the dual-use tool implementation classes.
Definition AsgTool.h:47
std::unique_ptr< const FlavorTagInference::SaltModel > m_saltModel
Gaudi::Property< bool > m_isMC
Layer calibration related properties.
Gaudi::Property< std::string > m_unconvertedPhotonModelFile
StatusCode setupTransformerModel(const std::string &fileName)
a utility to set up the transformer model, separated from initialize for better readability
Gaudi::Property< std::string > m_layerCalibTune
Gaudi::Property< bool > m_useLayerCorrected
Gaudi::Property< bool > m_useFixForMissingCells
Gaudi::Property< std::string > m_convertedPhotonModelFile
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Gaudi::Property< std::string > m_folder
string with folder for weight files
Gaudi::Property< bool > m_useExtraLayerScales
egammaTransformerCalibTool(const std::string &type)
Gaudi::Property< std::string > m_electronModelFile
Gaudi::Property< bool > m_useSaccCorrection
std::unique_ptr< egammaLayerRecalibTool > m_layerRecalibTool
float getEnergy(const xAOD::CaloCluster &clus, const xAOD::Egamma *eg, const egammaMVACalib::GlobalEventInfo &gei=egammaMVACalib::GlobalEventInfo()) const override final
returns the calibrated energy
ToolHandle< IegammaCellRecoveryTool > m_egammaCellRecoveryTool
Pointer to the egammaCellRecoveryTool.
Gaudi::Property< bool > m_clusterEif0
Gaudi::Property< std::string > m_forwardElectronModelFile
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Egamma_v1 Egamma
Definition of the current "egamma version".
Definition Egamma.h:17
A structure holding some global event information.