ATLAS Offline Software
Loading...
Searching...
No Matches
PhotonBDTCalculator.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
26
27#ifndef ELECTRONPHOTONSELECTORTOOLS_PHOTONBDTCALCULATOR_H
28#define ELECTRONPHOTONSELECTORTOOLS_PHOTONBDTCALCULATOR_H
29
30#include "AsgTools/AsgTool.h"
31#include "AsgTools/ToolHandle.h"
33#include "xAODEgamma/Photon.h"
35#include <string>
36
37namespace PhotonIDBDT {
38
40{
42
43public:
44 PhotonBDTCalculator(const std::string& name);
45 virtual ~PhotonBDTCalculator() override;
46
47 virtual StatusCode initialize() override;
48
52 virtual double evaluate(const xAOD::Photon* photon) const override;
53
55 StatusCode decorate(const xAOD::Photon& ph) const;
56
58 StatusCode getScore(const xAOD::Photon& ph, float& score) const;
59
60private:
61 // Helpers to compute input variables for converted and unconverted photons
62 StatusCode fillVariablesConv(const xAOD::Photon& ph, std::vector<float>& vars) const;
63 StatusCode fillVariablesUnconv(const xAOD::Photon& ph, std::vector<float>& vars) const;
64
65 // Reserve size for input features vector for converted and unconverted photons
66 Gaudi::Property<unsigned> m_reserveVarsConv {this, "ReserveVarsConv", 16, "Reserve size for input vector (converted photons)"};
67 Gaudi::Property<unsigned> m_reserveVarsUnconv {this, "ReserveVarsUnconv", 16, "Reserve size for input vector (unconverted photons)"};
68
69 // Sub-tools for the evaluation of the BDT score for converted and unconverted photons.
70 ToolHandle<PhotonSingleBDTCalculator> m_toolConv {this, "ToolConv", "", "BDT calculator for converted photons"};
71 ToolHandle<PhotonSingleBDTCalculator> m_toolUnconv {this, "ToolUnconv", "", "BDT calculator for unconverted photons"};
72
73 // Properties
74 Gaudi::Property<std::string> m_decorationName {this, "DecorationName", "PhotonBDTScore", "Aux decoration name for BDT score"};
75 Gaudi::Property<bool> m_excludeTRT {this, "ExcludeTRT", true, "Exclude TRT conversions (for Run 3 conversion definition)"};
76 Gaudi::Property<bool> m_forceRecompute {this, "ForceRecompute", false, "If true, recompute even if decoration exists"};
77
78 bool isConverted(const xAOD::Photon& ph) const;
79};
80
81} // namespace PhotonIDBDT
82
83#endif
#define ASG_TOOL_CLASS2(CLASSNAME, INT1, INT2)
virtual double evaluate(const xAOD::Photon *photon) const =0
StatusCode getScore(const xAOD::Photon &ph, float &score) const
Return the score (computes if needed if m_forceRecompute is true)
Gaudi::Property< bool > m_excludeTRT
StatusCode fillVariablesConv(const xAOD::Photon &ph, std::vector< float > &vars) const
virtual double evaluate(const xAOD::Photon *photon) const override
virtual ~PhotonBDTCalculator() override
Gaudi::Property< bool > m_forceRecompute
bool isConverted(const xAOD::Photon &ph) const
Gaudi::Property< unsigned > m_reserveVarsConv
StatusCode fillVariablesUnconv(const xAOD::Photon &ph, std::vector< float > &vars) const
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Gaudi::Property< std::string > m_decorationName
ToolHandle< PhotonSingleBDTCalculator > m_toolConv
ToolHandle< PhotonSingleBDTCalculator > m_toolUnconv
StatusCode decorate(const xAOD::Photon &ph) const
Compute and decorate the photon with the BDT score.
Gaudi::Property< unsigned > m_reserveVarsUnconv
PhotonBDTCalculator(const std::string &name)
Base class for the dual-use tool implementation classes.
Definition AsgTool.h:47
Base class for the dual-use tool interface classes.
Definition IAsgTool.h:41
Photon_v1 Photon
Definition of the current "egamma version".