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
30
31#ifndef ELECTRONPHOTONSELECTORTOOLS_ASGPHOTONBDTSELECTOR_H
32#define ELECTRONPHOTONSELECTORTOOLS_ASGPHOTONBDTSELECTOR_H
33
34#include "AsgTools/AsgTool.h"
35#include "AsgTools/ToolHandle.h"
40#include "xAODBase/IParticle.h"
41
43#include "PhotonBDTCalculator.h"
44
45
46#include <string>
47#include <vector>
48
49class EventContext;
50
51namespace PhotonIDBDT {
52
54{
56
57public:
58 AsgPhotonBDTSelector(const std::string& name);
59 virtual ~AsgPhotonBDTSelector() override = default;
60
61 virtual StatusCode initialize() override;
62
63 // Accept methods
64 virtual asg::AcceptData accept(const xAOD::IParticle* part) const override;
65 virtual asg::AcceptData accept(const EventContext& ctx, const xAOD::IParticle* part) const override;
66 virtual asg::AcceptData accept(const EventContext& ctx, const xAOD::Egamma* part) const override;
67 virtual asg::AcceptData accept(const EventContext& ctx, const xAOD::Photon* part) const override;
68 virtual asg::AcceptData accept(const EventContext& ctx, const xAOD::Electron* part) const override;
69
70 virtual StatusCode execute(const EventContext& ctx, const xAOD::Egamma* eg, unsigned int& isEM) const override;
71
72 virtual std::string getOperatingPointName() const override;
73
74private:
75 StatusCode loadConfig();
76 // Core accept method (BDT-based selection)
77 asg::AcceptData acceptBDT(const EventContext& ctx, const xAOD::Photon& ph, unsigned int* isEM = nullptr) const;
78 virtual const asg::AcceptInfo& getAcceptInfo() const override;
79
80 // Tool to compute and decorate score
81 ToolHandle<PhotonBDTCalculator> m_bdtTool {this, "BDTTool", "", "Photon BDT calculator tool"};
82
83 // Properties
84 Gaudi::Property<std::string> m_workingPoint {this, "WorkingPoint", "", "Name of the Photon ID BDT Working point"};
85 Gaudi::Property<std::string> m_scoreDecoration {this, "ScoreDecoration", "BDTScore", "Name of the float decoration containing the score"};
86 Gaudi::Property<bool> m_computeIfMissing {this, "ComputeIfMissing", true, "Compute score with BDTTool if decoration missing"};
87 Gaudi::Property<bool> m_excludeTRT {this, "ExcludeTRT", true, "Conversion definition for Run 3"};
88 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!) "};
89 Gaudi::Property<std::string> m_isEMDecoration {this, "IsEMDecoration", "BDTIsEM", "Name of the int decoration containing the isEM word (used if ReapplyWPIfNoShowerShapes is true)"};
90
91 // Config file with binning and cuts
92 std::string m_configFile;
93
94 // Binning and cuts
95 std::vector<float> m_etaBins;
96 std::vector<float> m_etBinsGeV;
97 // Preselection values on f1 and e277 variables
98 std::vector<float> m_cutF1Conv;
99 std::vector<float> m_cutF1Unconv;
100 std::vector<float> m_cutE277Conv;
101 std::vector<float> m_cutE277Unconv;
102
103 // BDT score cuts for converted and unconverted photons
104 std::vector<float> m_cutConv;
105 std::vector<float> m_cutUnconv;
106
107 // Accept machinery
115
116 // helpers
117 bool isConverted(const xAOD::Photon& ph) const;
118 bool findBin(const float absEta, const float etGeV, size_t& iEta, size_t& iEt) const;
119 float getCut(const bool converted, const size_t iEta, const size_t iEt) const;
120 asg::AcceptData makeReject(const asg::AcceptInfo& info) const;
121 float getShowerShape(const xAOD::Photon& ph, xAOD::EgammaParameters::ShowerShapeType t, const char *name = "") const;
122
123};
124
125} // namespace PhotonIDBDT
126
127#endif
#define ASG_TOOL_CLASS2(CLASSNAME, INT1, INT2)
Interface to tool to select photons.
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.
virtual ~AsgPhotonBDTSelector() override=default
Gaudi::Property< bool > m_reapplyWPIfNoShowerShapes
bool isConverted(const xAOD::Photon &ph) const
AsgPhotonBDTSelector(const std::string &name)
virtual const asg::AcceptInfo & getAcceptInfo() const override
Declare the interface ID for this pure-virtual interface class to the Athena framework.
ToolHandle< PhotonBDTCalculator > m_bdtTool
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.
Gaudi::Property< std::string > m_scoreDecoration
asg::AcceptData makeReject(const asg::AcceptInfo &info) const
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
Gaudi::Property< bool > m_computeIfMissing
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
Base class for the dual-use tool implementation classes.
Definition AsgTool.h:47
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".