ATLAS Offline Software
Loading...
Searching...
No Matches
ElectronPhotonVariableNFCorrectionTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef ElectronPhotonVariableNFCorrectionTool_H
6#define ElectronPhotonVariableNFCorrectionTool_H
7
8
22 * @author Katerina Kazakova <katerina.kazakova@cern.ch>
23 * @date February 2026
24 */
25
26
40//EDM includes
41#include "xAODEgamma/Electron.h"
42#include "xAODEgamma/Photon.h"
43
44#include <memory>
45#include <vector>
46#include <string>
47
48// ===========================================================================
49// Class ElectronPhotonVariableNFCorrectionTool
50// ===========================================================================
51
53{
54
56
57public:
61 ElectronPhotonVariableNFCorrectionTool(const std::string& name);
62
65
77 virtual StatusCode initialize() override;
78
85 virtual const CP::CorrectionCode applyCorrection(xAOD::Photon& photon) const override;
86
88 virtual const CP::CorrectionCode applyCorrection(xAOD::Electron& electron) const override;
89
94 virtual const CP::CorrectionCode correctedCopy(const xAOD::Photon& in_photon,
95 xAOD::Photon*& out_photon) const override;
96
98 virtual const CP::CorrectionCode correctedCopy(const xAOD::Electron& in_electron,
99 xAOD::Electron*& out_electron) const override;
100
101
102private:
104 Gaudi::Property<std::string> m_configFile {this, "ConfigFile", "", "The configuration file for Normalizing Flows to use"};
105 Gaudi::Property<std::string> m_applyToStr {this, "ApplyTo", "TruthPhotons", "TruthPhotons or All"};
106 Gaudi::Property<float> m_pTcutMeV {this, "pTcut", 10000.f, "Min photon pT in MeV"};
107
109 int m_nFolds{0};
110
112 std::string m_onnxPattern;
113
115 SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey{this, "EventInfoKey", "EventInfo", "EventInfo key"};
116
118 enum class ApplyToMode { TruthPhotons, All };
120
123
125 bool passSelectionCuts(const xAOD::Photon& photon, const std::vector<float>& ss) const;
126
133
136
142 int selectFold(unsigned long long eventNumber, float phi) const;
143
145 FoldStrategy parseFoldStrategy(const std::string& s) const;
146
148 ToolHandleArray<AthOnnx::IOnnxRuntimeInferenceTool> m_onnxToolsForward{this, "OnnxInferenceToolsForward", {}, "Forward ONNX tools per fold"};
150 ToolHandleArray<AthOnnx::IOnnxRuntimeInferenceTool> m_onnxToolsBackward{this, "OnnxInferenceToolsBackward", {}, "Backward ONNX tools per fold"};
151
153 static const std::vector<std::string> s_ssVarNames;
154
156 static const std::vector<xAOD::EgammaParameters::ShowerShapeType> s_ssEnums;
157
159 struct SSAccessors {
160 std::unique_ptr<SG::AuxElement::Accessor<float>> original;
161 };
162
164 std::vector<SSAccessors> m_accessors;
165
166}; // end class ElectronPhotonVariableNFCorrectionTool
167
168#endif
169
Scalar phi() const
phi method
#define ASG_TOOL_CLASS(CLASSNAME, INT1)
Property holding a SG store/key/clid from which a ReadHandle is made.
Handle class for reading from StoreGate.
Base class for elements of a container that can have aux data.
static Double_t ss
Return value from object correction CP tools.
std::vector< SSAccessors > m_accessors
Per-variable accessors aligned with s_ssVarNames.
ToolHandleArray< AthOnnx::IOnnxRuntimeInferenceTool > m_onnxToolsForward
ToolHandleArray for forward ONNX models (one tool per fold)
static const std::vector< std::string > s_ssVarNames
List of shower shape variable names (order must match model I/O)
FoldStrategy parseFoldStrategy(const std::string &s) const
Parse fold strategy string from config.
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
ReadHandleKey for EventInfo used for fold selection.
int selectFold(unsigned long long eventNumber, float phi) const
Select fold index for the current event/photon.
virtual const CP::CorrectionCode correctedCopy(const xAOD::Photon &in_photon, xAOD::Photon *&out_photon) const override
Make a corrected copy of the passed photon.
std::string m_onnxPattern
Models path pattern string from config.
ToolHandleArray< AthOnnx::IOnnxRuntimeInferenceTool > m_onnxToolsBackward
ToolHandleArray for backward ONNX models (one tool per fold)
bool passSelectionCuts(const xAOD::Photon &photon, const std::vector< float > &ss) const
Returns true if NF correction should be applied to this photon.
bool m_applyShowerShapeCuts
Cuts applied to remove default values of shower shapes.
ElectronPhotonVariableNFCorrectionTool(const std::string &name)
Standard constructor.
static const std::vector< xAOD::EgammaParameters::ShowerShapeType > s_ssEnums
Egamma shower shape enum mapping for reading/writing values (order matches s_ssVarNames)
int m_nFolds
Number of model folds configured (must match tool handle array sizes)
virtual const CP::CorrectionCode applyCorrection(xAOD::Photon &photon) const override
Apply the Normalizing Flow correction to the passed photon.
virtual StatusCode initialize() override
Initialize the class instance.
Gaudi::Property< std::string > m_configFile
The configuration file for the tool, application mode and minimum photon pT cut in MeV.
FoldStrategy m_foldStrategy
Selected fold strategy (configured via FoldStrategy in the config)
ApplyToMode
NF will be applied only for TruthPhotons, or for All photons.
Property holding a SG store/key/clid from which a ReadHandle is made.
Base class for the dual-use tool implementation classes.
Definition AsgTool.h:47
Photon_v1 Photon
Definition of the current "egamma version".
Electron_v1 Electron
Definition of the current "egamma version".
Accessor used to decorate photons per shower shape variable.
std::unique_ptr< SG::AuxElement::Accessor< float > > original