ATLAS Offline Software
Loading...
Searching...
No Matches
AsgForwardElectronSelectorTool.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 ASGFORWARDELECTRONSELECTORTOOL_H
6#define ASGFORWARDELECTRONSELECTORTOOL_H
7
25
26
27#include "AsgTools/AsgTool.h"
30#include "PATCore/AcceptInfo.h"
31#include "PATCore/AcceptData.h"
33
34#include "lwtnn/LightweightGraph.hh"
35
36#include <vector>
37#include <string>
38#include <memory>
39
40
41class EventContext;
42
43
45 : public asg::AsgTool
46 , virtual public IAsgElectronLikelihoodTool
47{
51
52
53
54public:
55
57 AsgForwardElectronSelectorTool(const std::string& myname);
60
61
63 virtual StatusCode initialize() override final;
64
65
70 virtual const asg::AcceptInfo& getAcceptInfo() const override;
71
72
73
74
76
78 virtual asg::AcceptData accept(const xAOD::IParticle* part) const override;
79 virtual asg::AcceptData accept(const EventContext& ctx,
80 const xAOD::IParticle* part) const override;
81
83 virtual asg::AcceptData accept(const EventContext& ctx,
84 const xAOD::Electron* eg) const override;
85 virtual asg::AcceptData accept(const EventContext& ctx,
86 const xAOD::Electron* eg,
87 double mu) const override;
88 virtual asg::AcceptData accept(const EventContext& ctx,
89 const xAOD::Egamma* eg) const override;
90 virtual asg::AcceptData accept(const EventContext& ctx,
91 const xAOD::Egamma* eg,
92 double mu) const override;
93
95 virtual double calculate(const EventContext& ctx,
96 const xAOD::IParticle* part) const override;
97 virtual double calculate(const EventContext& ctx,
98 const xAOD::Electron* eg) const override;
99 virtual double calculate(const EventContext& ctx,
100 const xAOD::Electron* eg,
101 double mu) const override;
102 virtual double calculate(const EventContext& ctx,
103 const xAOD::Egamma* eg) const override;
104 virtual double calculate(const EventContext& ctx,
105 const xAOD::Egamma* eg,
106 double mu) const override;
107
108
109
112 virtual std::vector<float> calculateMultipleOutputs(
113 const EventContext& ctx,
114 const xAOD::Electron* eg,
115 double mu = -99) const override;
116
117
118 virtual std::string getOperatingPointName() const override;
119
120
121
122
123
124 private:
125
131 int getEtaBin(double absEta) const;
132
147 int getPtBin(double calibPt) const;
148
152 bool getInputs(const xAOD::Electron* eg,
153 double calibPt,
154 int etaBin,
155 std::vector<double>& inputs) const;
156
159 bool calculateWithCalibPt(const EventContext& ctx,
160 const xAOD::Electron* eg,
161 double& score,
162 double& calibPt) const;
163
164 std::vector<std::unique_ptr<lwt::LightweightGraph>> m_graphs;
165
168
169
172 this, "CalibrationTool", "",
173 "Handle to the AsgForwardElectronCalibrationTool"};
174
179 int m_wpIndex{-1};
180
182 Gaudi::Property<std::vector<std::string>> m_modelFiles {this,"ModelFiles",{"","",""} ,"lwtnn JSON files, one per eta bin (in eta order)"};
183 Gaudi::Property<std::string> m_workingPoint {this,"WorkingPoint","Loose","Working Point: Loose(90%), Medium (80%), or Tight (70%)"};
184
187
188};
189
190#endif
#define ASG_TOOL_CLASS2(CLASSNAME, INT1, INT2)
Object to encode the result of several cuts.
Object to describe a series of cuts.
Tool to apply DNN-based pT calibration to forward electrons for Run 4 using ITk and HGTD variables.
Tool to apply DNN-based ID to forward electrons for Run 4 using ITk and HGTD variables.
Gaudi::Property< std::vector< std::string > > m_modelFiles
One lwtnn JSON file / DNN per eta bin.
std::vector< std::unique_ptr< lwt::LightweightGraph > > m_graphs
virtual double calculate(const EventContext &ctx, const xAOD::IParticle *part) const override
The main result method: the actual DNN is calculated here.
std::vector< std::string > m_variables
Input variable names.
virtual StatusCode initialize() override final
Gaudi Service Interface method implementations.
virtual const asg::AcceptInfo & getAcceptInfo() const override
Method to get the plain AcceptInfo.
Gaudi::Property< std::string > m_workingPoint
Working point: Loose = 90% | Medium = 80% | Tight = 70%.
virtual std::string getOperatingPointName() const override
Method to get the operating point.
bool getInputs(const xAOD::Electron *eg, double calibPt, int etaBin, std::vector< double > &inputs) const
Get 25 input variables Applies LR decorrelation Returns false on failure.
int getPtBin(double calibPt) const
Select the pT bin index, Bin 0: 5 GeV <= pT < 15 GeV Bin 1: 15 GeV <= pT < 20 GeV Bin 2: 20 GeV <= pT...
virtual asg::AcceptData accept(const xAOD::IParticle *part) const override
IAsgSelectionTool interface.
virtual std::vector< float > calculateMultipleOutputs(const EventContext &ctx, const xAOD::Electron *eg, double mu=-99) const override
The result method for multiple outputs: only one output is used so return vector of that output.
ToolHandle< AsgForwardElectronCalibrationTool > m_calibTool
Handle to the calibration tool.
bool calculateWithCalibPt(const EventContext &ctx, const xAOD::Electron *eg, double &score, double &calibPt) const
Runs calibration + LR + DNN in a single pass.
virtual ASG_TOOL_CLASS2(AsgForwardElectronSelectorTool, IAsgElectronLikelihoodTool, IAsgSelectionTool) public ~AsgForwardElectronSelectorTool()
Standard constructor.
int m_wpIndex
Working point index: 0 = Loose 1 = Medium 2 = Tight.
asg::AcceptInfo m_acceptInfo
AcceptInfo: defines the cut structure.
int getEtaBin(double absEta) const
Select the eta bin index for |eta|, three eta bins: Bin 0: 2.5 < |eta| <= 2.7 Bin 1: 2....
Interface to tool to select electrons.
Base class for the dual-use tool implementation classes.
Definition AsgTool.h:47
STL class.
Class describing an electron.
STL namespace.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
#define private
Definition testRead.cxx:27