CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Attributes | Private Attributes
PhotonDNNEstimator Class Reference

#include <PhotonDNNEstimator.h>

Public Member Functions

std::vector< std::vector< float > > evaluate (const reco::PhotonCollection &ele, const std::vector< tensorflow::Session * > &sessions) const
 
std::map< std::string, float > getInputsVars (const reco::Photon &ele) const
 
std::vector
< tensorflow::Session * > 
getSessions () const
 
 PhotonDNNEstimator (const egammaTools::DNNConfiguration &, const bool useEBModelInGap)
 

Static Public Attributes

static const std::vector
< std::string > 
dnnAvaibleInputs
 
static constexpr float ecalBarrelMaxEtaNoGap = 1.485
 
static constexpr float ecalBarrelMaxEtaWithGap = 1.566
 

Private Attributes

const egammaTools::EgammaDNNHelper dnnHelper_
 
const bool useEBModelInGap_
 

Detailed Description

Definition at line 13 of file PhotonDNNEstimator.h.

Constructor & Destructor Documentation

PhotonDNNEstimator::PhotonDNNEstimator ( const egammaTools::DNNConfiguration cfg,
const bool  useEBModelInGap 
)

Definition at line 23 of file PhotonDNNEstimator.cc.

24  : dnnHelper_(cfg,
25  std::bind(photonModelSelector,
26  _1,
30  useEBModelInGap_(useEBModelInGap) {}
uint photonModelSelector(const std::map< std::string, float > &vars, float etaThr)
static constexpr float ecalBarrelMaxEtaWithGap
static constexpr float ecalBarrelMaxEtaNoGap
const egammaTools::EgammaDNNHelper dnnHelper_
static const std::vector< std::string > dnnAvaibleInputs

Member Function Documentation

std::vector< std::vector< float > > PhotonDNNEstimator::evaluate ( const reco::PhotonCollection ele,
const std::vector< tensorflow::Session * > &  sessions 
) const

Definition at line 69 of file PhotonDNNEstimator.cc.

References dnnHelper_, egammaTools::EgammaDNNHelper::evaluate(), getInputsVars(), and PixelMapPlotter::inputs.

70  {
71  // Collect the map of variables for each candidate and call the dnnHelper
72  // Scaling, model selection and running is performed in the helper
73  std::vector<std::map<std::string, float>> inputs;
74  for (const auto& photon : photons) {
75  inputs.push_back(getInputsVars(photon));
76  }
77  return dnnHelper_.evaluate(inputs, sessions);
78 }
std::vector< std::vector< float > > evaluate(const std::vector< std::map< std::string, float >> &candidates, const std::vector< tensorflow::Session * > &sessions) const
std::map< std::string, float > getInputsVars(const reco::Photon &ele) const
const egammaTools::EgammaDNNHelper dnnHelper_
std::map< std::string, float > PhotonDNNEstimator::getInputsVars ( const reco::Photon ele) const

Definition at line 48 of file PhotonDNNEstimator.cc.

References reco::Photon::ecalPFClusterIso(), reco::Photon::ecalRecHitSumEtConeDR03(), reco::LeafCandidate::eta(), reco::Photon::full5x5_r9(), reco::Photon::full5x5_showerShapeVariables(), reco::Photon::full5x5_sigmaIetaIeta(), reco::Photon::hadTowOverEm(), reco::Photon::hadTowOverEmValid(), reco::Photon::hasPixelSeed(), reco::Photon::hcalPFClusterIso(), reco::Photon::hcalTowerSumEtConeDR03(), reco::LeafCandidate::pt(), reco::Photon::sigmaIetaIeta(), reco::Photon::ShowerShape::sigmaIetaIphi, reco::Photon::trkSumPtHollowConeDR03(), and L1TEGammaDiff_cfi::variables.

Referenced by evaluate().

48  {
49  // Prepare a map with all the defined variables
50  std::map<std::string, float> variables;
51  variables["pt"] = photon.pt();
52  variables["eta"] = photon.eta();
53  variables["hadTowOverEm"] = photon.hadTowOverEmValid() ? photon.hadTowOverEm() : 0;
54  variables["trkSumPtHollowConeDR03"] = photon.trkSumPtHollowConeDR03();
55  variables["EcalRecHit"] = photon.ecalRecHitSumEtConeDR03();
56  variables["SigmaIetaIeta"] = photon.sigmaIetaIeta();
57  variables["SigmaIetaIetaFull5x5"] = photon.full5x5_sigmaIetaIeta();
58  variables["SigmaIEtaIPhiFull5x5"] = photon.full5x5_showerShapeVariables().sigmaIetaIphi;
59  variables["EcalPFClusterIso"] = photon.ecalPFClusterIso();
60  variables["HcalPFClusterIso"] = photon.hcalPFClusterIso();
61  variables["HasPixelSeed"] = (Int_t)photon.hasPixelSeed();
62  variables["R9Full5x5"] = photon.full5x5_r9();
63  variables["hcalTower"] = photon.hcalTowerSumEtConeDR03();
64  variables["R9Full5x5"] = photon.full5x5_r9();
65  // Define more variables here and use them directly in the model config!
66  return variables;
67 }
std::vector< tensorflow::Session * > PhotonDNNEstimator::getSessions ( ) const

Definition at line 32 of file PhotonDNNEstimator.cc.

References dnnHelper_, and egammaTools::EgammaDNNHelper::getSessions().

32 { return dnnHelper_.getSessions(); };
std::vector< tensorflow::Session * > getSessions() const
const egammaTools::EgammaDNNHelper dnnHelper_

Member Data Documentation

const std::vector< std::string > PhotonDNNEstimator::dnnAvaibleInputs
static
Initial value:
= {{"pt",
"eta",
"hadTowOverEm",
"trkSumPtHollowConeDR03",
"EcalRecHit",
"SigmaIetaIeta",
"SigmaIetaIetaFull5x5",
"SigmaIEtaIPhiFull5x5",
"EcalPFClusterIso",
"HcalPFClusterIso",
"HasPixelSeed",
"R9Full5x5",
"hcalTower"}}

Definition at line 30 of file PhotonDNNEstimator.h.

const egammaTools::EgammaDNNHelper PhotonDNNEstimator::dnnHelper_
private

Definition at line 36 of file PhotonDNNEstimator.h.

Referenced by evaluate(), and getSessions().

constexpr float PhotonDNNEstimator::ecalBarrelMaxEtaNoGap = 1.485
static

Definition at line 33 of file PhotonDNNEstimator.h.

constexpr float PhotonDNNEstimator::ecalBarrelMaxEtaWithGap = 1.566
static

Definition at line 32 of file PhotonDNNEstimator.h.

const bool PhotonDNNEstimator::useEBModelInGap_
private

Definition at line 38 of file PhotonDNNEstimator.h.