CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes
SoftElectronMVAEstimator Class Reference

#include <SoftElectronMVAEstimator.h>

Classes

struct  Configuration
 

Public Member Functions

double mva (const reco::GsfElectron &myElectron, const reco::VertexCollection &) const
 
 SoftElectronMVAEstimator (const Configuration &)
 
 ~SoftElectronMVAEstimator ()
 

Static Public Attributes

constexpr static unsigned int ExpectedNBins = 1
 

Private Member Functions

void bindVariables (float vars[25]) const
 
void init ()
 

Private Attributes

const Configuration cfg_
 
std::vector< std::unique_ptr< const GBRForest > > gbr_
 

Detailed Description

Definition at line 12 of file SoftElectronMVAEstimator.h.

Constructor & Destructor Documentation

◆ SoftElectronMVAEstimator()

SoftElectronMVAEstimator::SoftElectronMVAEstimator ( const Configuration cfg)

Definition at line 9 of file SoftElectronMVAEstimator.cc.

9  : cfg_(cfg) {
10  //Check number of weight files given
11  if (ExpectedNBins != cfg_.vweightsfiles.size()) {
12  edm::LogError("Soft Electron MVA Error")
13  << "Expected Number of bins = " << ExpectedNBins
14  << " does not equal to weightsfiles.size() = " << cfg_.vweightsfiles.size() << std::endl;
15  }
16 
17  for (auto& weightsfile : cfg_.vweightsfiles) {
18  // Taken from Daniele (his mail from the 30/11)
19  // training of the 7/12 with Nvtx added
20  gbr_.push_back(createGBRForest(weightsfile));
21  }
22 }

References cfg_, createGBRForest(), ExpectedNBins, gbr_, and SoftElectronMVAEstimator::Configuration::vweightsfiles.

◆ ~SoftElectronMVAEstimator()

SoftElectronMVAEstimator::~SoftElectronMVAEstimator ( )

Definition at line 24 of file SoftElectronMVAEstimator.cc.

24 {}

Member Function Documentation

◆ bindVariables()

void SoftElectronMVAEstimator::bindVariables ( float  vars[25]) const
private

Definition at line 95 of file SoftElectronMVAEstimator.cc.

95  {
96  if (vars[0] < -1.) //fbrem
97  vars[0] = -1.;
98 
99  vars[11] = std::abs(vars[11]); // deta
100  if (vars[11] > 0.06)
101  vars[11] = 0.06;
102 
103  vars[12] = std::abs(vars[12]);
104  if (vars[12] > 0.6)
105  vars[12] = 0.6;
106 
107  //if(EoP > 20.)
108  // EoP = 20.;
109 
110  if (vars[2] > 20.) //eleEoPout
111  vars[2] = 20.;
112 
113  vars[13] = std::abs(vars[13]); //detacalo
114  if (vars[13] > 0.2)
115  vars[13] = 0.2;
116 
117  if (vars[19] < -1.) //OneMinusE1x5E5x5
118  vars[19] = -1;
119 
120  if (vars[19] > 2.) //OneMinusE1x5E5x5
121  vars[19] = 2.;
122 
123  if (vars[7] > 200.) //gsfchi2
124  vars[7] = 200;
125 
126  if (vars[8] > 10.) //kfchi2
127  vars[8] = 10.;
128 }

References funct::abs().

Referenced by mva().

◆ init()

void SoftElectronMVAEstimator::init ( )
private

◆ mva()

double SoftElectronMVAEstimator::mva ( const reco::GsfElectron myElectron,
const reco::VertexCollection pvc 
) const

Definition at line 26 of file SoftElectronMVAEstimator.cc.

26  {
27  float vars[25];
28 
29  vars[0] = myElectron.fbrem(); // fbrem
30  vars[1] = myElectron.eSuperClusterOverP(); //EtotOvePin
31  vars[2] = myElectron.eEleClusterOverPout(); //eleEoPout
32 
33  float etot = myElectron.eSuperClusterOverP() * myElectron.trackMomentumAtVtx().R();
34  float eEcal = myElectron.eEleClusterOverPout() * myElectron.trackMomentumAtEleClus().R();
35  float dP = myElectron.trackMomentumAtVtx().R() - myElectron.trackMomentumAtEleClus().R();
36  vars[3] = (etot - eEcal) / dP; //EBremOverDeltaP
37  vars[4] = std::log(myElectron.sigmaEtaEta()); //logSigmaEtaEta
38  vars[5] = myElectron.deltaEtaEleClusterTrackAtCalo(); //DeltaEtaTrackEcalSeed
39  vars[6] = myElectron.hcalOverEcalBc(); //HoE
40 
41  bool validKF = false;
42  reco::TrackRef myTrackRef = myElectron.closestCtfTrackRef();
43  validKF = (myTrackRef.isAvailable() && myTrackRef.isNonnull());
44  vars[7] = myElectron.gsfTrack()->normalizedChi2(); //gsfchi2
45  vars[8] = (validKF) ? myTrackRef->normalizedChi2() : 0; //kfchi2
46  vars[9] = (validKF) ? myTrackRef->hitPattern().trackerLayersWithMeasurement() : -1.; //kfhits
47 
48  vars[10] = myElectron.gsfTrack().get()->ptModeError() / myElectron.gsfTrack().get()->ptMode(); //SigmaPtOverPt
49  vars[11] = myElectron.deltaEtaSuperClusterTrackAtVtx(); //deta
50  vars[12] = myElectron.deltaPhiSuperClusterTrackAtVtx(); //dphi
51  vars[13] = myElectron.deltaEtaSeedClusterTrackAtCalo(); //detacalo
52  vars[14] = myElectron.sigmaIetaIeta(); //see
53  vars[15] = myElectron.sigmaIphiIphi(); //spp
54  vars[16] = myElectron.r9(); //R9
55  vars[17] = myElectron.superCluster()->etaWidth(); //etawidth
56  vars[18] = myElectron.superCluster()->phiWidth(); //phiwidth
57  vars[19] = (myElectron.e5x5()) != 0. ? 1. - (myElectron.e1x5() / myElectron.e5x5()) : -1.; //OneMinusE1x5E5x5
58  vars[20] = (1.0 / myElectron.ecalEnergy()) - (1.0 / myElectron.p()); // IoEmIoP
59  vars[21] = myElectron.superCluster()->preshowerEnergy() / myElectron.superCluster()->rawEnergy(); //PreShowerOverRaw
60  vars[22] = pvc.size(); // nPV
61  vars[23] = myElectron.pt(); //pt
62  vars[24] = myElectron.eta(); //eta
63 
64  /*
65  std::cout<<"fbrem "<<fbrem<<std::endl;
66  std::cout<<"EtotOvePin "<<EtotOvePin<<std::endl;
67  std::cout<<"eleEoPout "<<eleEoPout<<std::endl;
68  std::cout<<"EBremOverDeltaP "<<EBremOverDeltaP<<std::endl;
69  std::cout<<"logSigmaEtaEta "<<logSigmaEtaEta<<std::endl;
70  std::cout<<"DeltaEtaTrackEcalSeed "<<DeltaEtaTrackEcalSeed<<std::endl;
71  std::cout<<"HoE "<<HoE<<std::endl;
72  std::cout<<"kfchi2 "<<kfchi2<<std::endl;
73  std::cout<<"kfhits "<<kfhits<<std::endl;
74  std::cout<<"gsfchi2 "<<gsfchi2<<std::endl;
75  std::cout<<"SigmaPtOverPt "<<SigmaPtOverPt<<std::endl;
76  std::cout<<"deta "<<deta<<std::endl;
77  std::cout<<"dphi "<<dphi<<std::endl;
78  std::cout<<"detacalo "<<detacalo<<std::endl;
79  std::cout<<"see "<<see<<std::endl;
80  std::cout<< "spp " << spp<< std::endl;
81  std::cout<< "R9 " << R9<< std::endl;
82  std::cout<< "IoEmIoP " << IoEmIoP<< std::endl;
83  std::cout<<"etawidth "<<etawidth<<std::endl;
84  std::cout<<"phiwidth "<<phiwidth<<std::endl;
85  std::cout<<"OneMinusE1x5E5x5 "<<OneMinusE1x5E5x5<<std::endl;
86  std::cout<<"PreShowerOverRaw "<<PreShowerOverRaw<<std::endl;
87 */
89 
90  double result = gbr_[0]->GetClassifier(vars);
91 
92  return result;
93 }

References bindVariables(), reco::GsfElectron::closestCtfTrackRef(), reco::GsfElectron::deltaEtaEleClusterTrackAtCalo(), reco::GsfElectron::deltaEtaSeedClusterTrackAtCalo(), reco::GsfElectron::deltaEtaSuperClusterTrackAtVtx(), reco::GsfElectron::deltaPhiSuperClusterTrackAtVtx(), reco::GsfElectron::e1x5(), reco::GsfElectron::e5x5(), reco::GsfElectron::ecalEnergy(), reco::GsfElectron::eEleClusterOverPout(), reco::GsfElectron::eSuperClusterOverP(), reco::LeafCandidate::eta(), reco::GsfElectron::fbrem(), gbr_, edm::Ref< C, T, F >::get(), reco::GsfElectron::gsfTrack(), reco::GsfElectron::hcalOverEcalBc(), edm::Ref< C, T, F >::isAvailable(), edm::Ref< C, T, F >::isNonnull(), dqm-mbProfile::log, reco::LeafCandidate::p(), reco::LeafCandidate::pt(), reco::GsfElectron::r9(), mps_fire::result, reco::GsfElectron::sigmaEtaEta(), reco::GsfElectron::sigmaIetaIeta(), reco::GsfElectron::sigmaIphiIphi(), reco::GsfElectron::superCluster(), reco::GsfElectron::trackMomentumAtEleClus(), and reco::GsfElectron::trackMomentumAtVtx().

Member Data Documentation

◆ cfg_

const Configuration SoftElectronMVAEstimator::cfg_
private

Definition at line 28 of file SoftElectronMVAEstimator.h.

Referenced by SoftElectronMVAEstimator().

◆ ExpectedNBins

constexpr static unsigned int SoftElectronMVAEstimator::ExpectedNBins = 1
staticconstexpr

Definition at line 14 of file SoftElectronMVAEstimator.h.

Referenced by SoftElectronMVAEstimator().

◆ gbr_

std::vector<std::unique_ptr<const GBRForest> > SoftElectronMVAEstimator::gbr_
private

Definition at line 29 of file SoftElectronMVAEstimator.h.

Referenced by mva(), and SoftElectronMVAEstimator().

reco::GsfElectron::deltaEtaSeedClusterTrackAtCalo
float deltaEtaSeedClusterTrackAtCalo() const
Definition: GsfElectron.h:233
reco::GsfElectron::gsfTrack
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
Definition: GsfElectron.h:163
reco::GsfElectron::deltaPhiSuperClusterTrackAtVtx
float deltaPhiSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:235
edm::Ref::isAvailable
bool isAvailable() const
Definition: Ref.h:537
SoftElectronMVAEstimator::ExpectedNBins
constexpr static unsigned int ExpectedNBins
Definition: SoftElectronMVAEstimator.h:14
edm::Ref::get
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:232
createGBRForest
std::unique_ptr< const GBRForest > createGBRForest(const std::string &weightsFile)
Definition: GBRForestTools.cc:257
reco::LeafCandidate::pt
double pt() const final
transverse momentum
Definition: LeafCandidate.h:146
reco::GsfElectron::fbrem
float fbrem() const
Definition: GsfElectron.h:732
edm::Ref< TrackCollection >
SoftElectronMVAEstimator::Configuration::vweightsfiles
std::vector< std::string > vweightsfiles
Definition: SoftElectronMVAEstimator.h:17
vars
vars
Definition: DeepTauId.cc:164
reco::GsfElectron::trackMomentumAtVtx
math::XYZVectorF trackMomentumAtVtx() const
Definition: GsfElectron.h:275
SoftElectronMVAEstimator::cfg_
const Configuration cfg_
Definition: SoftElectronMVAEstimator.h:28
SoftElectronMVAEstimator::bindVariables
void bindVariables(float vars[25]) const
Definition: SoftElectronMVAEstimator.cc:95
reco::GsfElectron::sigmaIphiIphi
float sigmaIphiIphi() const
Definition: GsfElectron.h:419
reco::GsfElectron::deltaEtaSuperClusterTrackAtVtx
float deltaEtaSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:232
reco::LeafCandidate::eta
double eta() const final
momentum pseudorapidity
Definition: LeafCandidate.h:152
edm::Ref::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
reco::GsfElectron::hcalOverEcalBc
float hcalOverEcalBc() const
Definition: GsfElectron.h:432
reco::GsfElectron::e1x5
float e1x5() const
Definition: GsfElectron.h:420
reco::GsfElectron::closestCtfTrackRef
virtual TrackRef closestCtfTrackRef() const
Definition: GsfElectron.h:187
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
reco::GsfElectron::trackMomentumAtEleClus
math::XYZVectorF trackMomentumAtEleClus() const
Definition: GsfElectron.h:278
reco::GsfElectron::r9
float r9() const
Definition: GsfElectron.h:423
reco::GsfElectron::sigmaEtaEta
float sigmaEtaEta() const
Definition: GsfElectron.h:417
SoftElectronMVAEstimator::gbr_
std::vector< std::unique_ptr< const GBRForest > > gbr_
Definition: SoftElectronMVAEstimator.h:29
looper.cfg
cfg
Definition: looper.py:297
reco::GsfElectron::sigmaIetaIeta
float sigmaIetaIeta() const
Definition: GsfElectron.h:418
reco::GsfElectron::e5x5
float e5x5() const
Definition: GsfElectron.h:422
reco::LeafCandidate::p
double p() const final
magnitude of momentum vector
Definition: LeafCandidate.h:123
reco::GsfElectron::deltaEtaEleClusterTrackAtCalo
float deltaEtaEleClusterTrackAtCalo() const
Definition: GsfElectron.h:234
reco::GsfElectron::eSuperClusterOverP
float eSuperClusterOverP() const
Definition: GsfElectron.h:228
reco::GsfElectron::eEleClusterOverPout
float eEleClusterOverPout() const
Definition: GsfElectron.h:231
reco::GsfElectron::superCluster
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:162
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
mps_fire.result
result
Definition: mps_fire.py:311
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
reco::GsfElectron::ecalEnergy
float ecalEnergy() const
Definition: GsfElectron.h:818