ATLAS Offline Software
Loading...
Searching...
No Matches
AsgPhotonBDTSelector.h
Go to the documentation of this file.
1
2/*
3 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
4*/
5
28
29#ifndef ELECTRONPHOTONSELECTORTOOLS_ASGPHOTONBDTSELECTOR_H
30#define ELECTRONPHOTONSELECTORTOOLS_ASGPHOTONBDTSELECTOR_H
31
32#include "AsgTools/AsgTool.h"
33#include "AsgTools/ToolHandle.h"
36
39
40#include "xAODEgamma/Photon.h"
41#include "xAODEgamma/Egamma.h"
42#include "xAODEgamma/Electron.h"
45#include "xAODBase/IParticle.h"
46
48
49
50#include <string>
51#include <vector>
52
53class EventContext;
54
55namespace PhotonIDBDT {
56
58{
60
61public:
63
64 virtual StatusCode initialize() override;
65
66 // Accept methods
67 virtual asg::AcceptData accept(const xAOD::IParticle* part) const override;
68 virtual asg::AcceptData accept(const EventContext& ctx, const xAOD::IParticle* part) const override;
69 virtual asg::AcceptData accept(const EventContext& ctx, const xAOD::Egamma* part) const override;
70 virtual asg::AcceptData accept(const EventContext& ctx, const xAOD::Photon* part) const override;
71 virtual asg::AcceptData accept(const EventContext& ctx, const xAOD::Electron* part) const override;
72
73 virtual StatusCode execute(const EventContext& ctx, const xAOD::Egamma* eg, unsigned int& isEM) const override;
74
75 virtual std::string getOperatingPointName() const override;
76
77private:
78 StatusCode loadConfig();
79 // Core accept method (BDT-based selection)
80 asg::AcceptData acceptBDT(const EventContext& ctx, const xAOD::Photon& ph, unsigned int* isEM = nullptr) const;
81 virtual const asg::AcceptInfo& getAcceptInfo() const override;
82
83 // Properties
84 Gaudi::Property<std::string> m_workingPoint {this, "WorkingPoint", "", "Name of the Photon ID BDT Working point"};
85 Gaudi::Property<bool> m_excludeTRT {this, "ExcludeTRT", true, "Conversion definition for Run 3"};
86 Gaudi::Property<bool> m_reapplyWPIfNoShowerShapes {this, "ReapplyWPIfNoShowerShapes", true, "Reapply the WP calculation, based on the BDT score and isEM word (works only if these are available!) "};
87 Gaudi::Property<std::string> m_isEMDecoration {this, "IsEMDecoration", "BDTIsEM", "Name of the int decoration containing the isEM word (used if ReapplyWPIfNoShowerShapes is true)"};
88
89 // Config file with binning and cuts
90 std::string m_configFile = "";
91
92 // Binning and cuts
93 std::vector<float> m_etaBins;
94 std::vector<float> m_etBinsGeV;
95 // Preselection values on f1 and e277 variables
96 std::vector<float> m_cutF1Conv;
97 std::vector<float> m_cutF1Unconv;
98 std::vector<float> m_cutE277Conv;
99 std::vector<float> m_cutE277Unconv;
100
101 // BDT score cuts for converted and unconverted photons
102 std::vector<float> m_cutConv;
103 std::vector<float> m_cutUnconv;
104
105 // Accept machinery
113
114 // helpers
115 bool isConverted(const xAOD::Photon& ph) const;
116 bool findBin(const float absEta, const float etGeV, size_t& iEta, size_t& iEt) const;
117 float getCut(const bool converted, const size_t iEta, const size_t iEt) const;
118 static asg::AcceptData makeReject(const asg::AcceptInfo& info) ;
119 float getShowerShape(const xAOD::Photon& ph, xAOD::EgammaParameters::ShowerShapeType t, const char *name = "") const;
120
121 SG::ReadHandleKey<xAOD::EgammaContainer> m_ContainerName{ this, "ContainerName", "", "Input" };
124
125 Gaudi::Property<bool> m_suppressInputDeps{this, "SuppressInputDependence", false, "Will BDT score be created in the same algorithm that uses this tool?"};
126
127
128};
129
130} // namespace PhotonIDBDT
131
132#endif
#define ASG_TOOL_CLASS2(CLASSNAME, INT1, INT2)
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Property holding a SG store/key/clid from which a ReadHandle is made.
Interface to tool to select photons.
Gaudi::Property< bool > m_suppressInputDeps
Gaudi::Property< std::string > m_workingPoint
float getShowerShape(const xAOD::Photon &ph, xAOD::EgammaParameters::ShowerShapeType t, const char *name="") const
virtual std::string getOperatingPointName() const override
Report the current operating point.
Gaudi::Property< bool > m_reapplyWPIfNoShowerShapes
static asg::AcceptData makeReject(const asg::AcceptInfo &info)
bool isConverted(const xAOD::Photon &ph) const
virtual const asg::AcceptInfo & getAcceptInfo() const override
Declare the interface ID for this pure-virtual interface class to the Athena framework.
asg::AcceptData acceptBDT(const EventContext &ctx, const xAOD::Photon &ph, unsigned int *isEM=nullptr) const
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
SG::ReadDecorHandleKey< xAOD::EgammaContainer > m_decoratorScore
float getCut(const bool converted, const size_t iEta, const size_t iEt) const
virtual asg::AcceptData accept(const xAOD::IParticle *part) const override
accept with pointer to IParticle so as to not hide the IAsgSelectionTool one
SG::ReadHandleKey< xAOD::EgammaContainer > m_ContainerName
virtual StatusCode execute(const EventContext &ctx, const xAOD::Egamma *eg, unsigned int &isEM) const override
Add a legacy execute method - return isEM value.
Gaudi::Property< std::string > m_isEMDecoration
bool findBin(const float absEta, const float etGeV, size_t &iEta, size_t &iEt) const
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
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
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition AsgTool.cxx:58
Class providing the definition of the 4-vector interface.
Egamma_v1 Egamma
Definition of the current "egamma version".
Definition Egamma.h:17
Photon_v1 Photon
Definition of the current "egamma version".
Electron_v1 Electron
Definition of the current "egamma version".