22 enum PhotonBDTIsEMBits :
unsigned int {
24 FailOutOfRange = 1u << 0,
27 FailPreselectionF1 = 1u << 1,
28 FailPreselectionE277 = 1u << 2,
31 FailBDTScore = 1u << 3,
34 FailMissingScore = 1u << 4
58 return StatusCode::FAILURE;
64#ifndef XAOD_STANDALONE
72 return StatusCode::SUCCESS;
89 return StatusCode::FAILURE;
95 return StatusCode::FAILURE;
120 if (nEta == 0 || nEt == 0) {
121 ATH_MSG_ERROR(
"Need at least 2 edges for eta and Et binning.");
122 return StatusCode::FAILURE;
125 const unsigned nExpected = nEta * nEt;
127 ATH_MSG_ERROR(
"Size mismatch between eta and Et binning and BDT cut maps: expected " << nExpected
128 <<
" (= " << nEta <<
"*" << nEt <<
")"
129 <<
" got BDTCutConv=" <<
m_cutConv.size()
131 return StatusCode::FAILURE;
134 return StatusCode::SUCCESS;
158 return accept(Gaudi::Hive::currentContext(), part);
166 if (
const auto* ph =
dynamic_cast<const xAOD::Photon*
>(part)) {
169 if (
const auto* eg =
dynamic_cast<const xAOD::Egamma*
>(part)) {
203 unsigned int& isEM)
const
206 if (!eg)
return StatusCode::SUCCESS;;
211 return StatusCode::SUCCESS;
215 return StatusCode::SUCCESS;
227 size_t& iEta,
size_t& iEt)
const {
244 const size_t nEta =
m_etaBins.size() - 1;
245 const size_t idx = iEt * nEta + iEta;
252 for (
unsigned i = 0; i < info.getNCuts(); ++i) acc.setCutResult(i,
false);
259 ATH_MSG_ERROR(
"AsgPhotonBDTSelector: missing shower shape variable '" << name);
261 throw std::runtime_error(std::string(
"AsgPhotonBDTSelector: missing shower shape ") + name);
271 auto setBit = [&](
unsigned int bit) {
272 if (isEM) *isEM |= bit;
282 const float score = decoratorScore(ph);
288 setBit(FailOutOfRange);
291 const float absEta = std::abs(cluster->
eta());
292 const float etGeV = cluster->
pt() * 1e-3f;
294 size_t iEta=0, iEt=0;
295 if (!
findBin(absEta, etGeV, iEta, iEt)) {
296 setBit(FailOutOfRange);
306 bool passF1 =
false, passE277 =
false, passPre =
false;
313 if (!hasF1 || !hasE277) {
316 if (accIsEM.isAvailable(ph)) {
317 const int previousIsEM = accIsEM(ph);
318 passF1 = !(previousIsEM & FailPreselectionF1);
319 passE277 = !(previousIsEM & FailPreselectionE277);
320 passPre = passF1 && passE277;
323 ATH_MSG_ERROR(
"Missing f1 and e277 shower shapes and isEM decoration, cannot reapply WP. Rejecting photon.");
327 setBit(FailPreselectionF1);
328 setBit(FailPreselectionE277);
335 float f1 = 0.f, e277 = 0.f;
341 passF1 = (f1 > cutF1);
342 passE277 = (e277 > cutE277);
343 passPre = passF1 && passE277;
352 if (!passF1) setBit(FailPreselectionF1);
353 if (!passE277) setBit(FailPreselectionE277);
355 if (!passPre)
return acc;
358 const float cut =
getCut(conv, iEta, iEt);
359 const bool passBDT = (score > cut);
361 if (!passBDT) setBit(FailBDTScore);
#define ATH_CHECK
Evaluate an expression and check for errors.
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)
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
std::vector< float > m_cutF1Unconv
std::vector< float > m_cutE277Conv
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
std::vector< float > m_etaBins
std::vector< float > m_etBinsGeV
virtual const asg::AcceptInfo & getAcceptInfo() const override
Declare the interface ID for this pure-virtual interface class to the Athena framework.
std::vector< float > m_cutConv
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
Gaudi::Property< bool > m_excludeTRT
float getCut(const bool converted, const size_t iEta, const size_t iEt) const
int m_cutPosPassPreselection
std::vector< float > m_cutE277Unconv
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.
std::vector< float > m_cutF1Conv
asg::AcceptInfo m_acceptInfo
Gaudi::Property< std::string > m_isEMDecoration
bool findBin(const float absEta, const float etGeV, size_t &iEta, size_t &iEt) const
std::vector< float > m_cutUnconv
Handle class for reading a decoration on an object.
virtual double pt() const
The transverse momentum ( ) of the particle (negative for negative-energy clusters).
virtual double eta() const
The pseudorapidity ( ) of the particle.
bool showerShapeValue(float &value, const EgammaParameters::ShowerShapeType information) const
Accessor for ShowerShape values.
const xAOD::CaloCluster * caloCluster(size_t index=0) const
Pointer to the xAOD::CaloCluster/s that define the electron candidate.
Class providing the definition of the 4-vector interface.
std::string findConfigFile(const std::string &input, const std::map< std::string, std::string > &configmap)
std::vector< float > HelperFloat(const std::string &input, TEnv &env)
const std::map< std::string, std::string > PhotonBDTPointToConfFile
bool isConvertedPhoton(const xAOD::Egamma *eg, bool excludeTRT=false)
is the object a converted photon
@ e277
uncalibrated energy (sum of cells) of the middle sampling in a rectangle of size 7x7
@ f1
E1/E = fraction of energy reconstructed in the first sampling, where E1 is energy in all strips belon...
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Egamma_v1 Egamma
Definition of the current "egamma version".
Photon_v1 Photon
Definition of the current "egamma version".
Electron_v1 Electron
Definition of the current "egamma version".