CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Public Attributes | Private Attributes
ElectronMVAEstimatorRun2Spring15Trig Class Reference

#include <ElectronMVAEstimatorRun2Spring15Trig.h>

Inheritance diagram for ElectronMVAEstimatorRun2Spring15Trig:
AnyMVAEstimatorRun2Base

Classes

struct  AllVariables
 

Public Types

enum  mvaCategories { UNDEFINED = -1, CAT_EB1 = 0, CAT_EB2 = 1, CAT_EE = 2 }
 

Public Member Functions

void constrainMVAVariables (AllVariables &) const
 
 ElectronMVAEstimatorRun2Spring15Trig (const edm::ParameterSet &conf)
 
std::vector< float > fillMVAVariables (const edm::Ptr< reco::Candidate > &particle, const edm::Event &) const override
 
int findCategory (const edm::Ptr< reco::Candidate > &particle) const override
 
const std::string & getName () const final
 
int getNCategories () const override
 
const std::string & getTag () const final
 
bool isEndcapCategory (int category) const
 
float mvaValue (const edm::Ptr< reco::Candidate > &particle, const edm::Event &) const override
 
void setConsumes (edm::ConsumesCollector &&) const final
 
 ~ElectronMVAEstimatorRun2Spring15Trig () override
 
- Public Member Functions inherited from AnyMVAEstimatorRun2Base
 AnyMVAEstimatorRun2Base (const edm::ParameterSet &conf)
 
virtual void getEventContent (const edm::Event &iEvent) const final
 
template<typename... Args>
std::vector< float > packMVAVariables (const Args...args) const
 
virtual ~AnyMVAEstimatorRun2Base ()
 

Public Attributes

const int nCategories = 3
 
- Public Attributes inherited from AnyMVAEstimatorRun2Base
const edm::ParameterSet _conf
 

Private Attributes

AllVariables _allMVAVars
 
const edm::InputTag _beamSpotLabel
 
const edm::InputTag _conversionsLabelAOD
 
const edm::InputTag _conversionsLabelMiniAOD
 
std::vector< std::unique_ptr< const GBRForest > > _gbrForests
 
const std::string _MethodName
 
const std::string _name = "ElectronMVAEstimatorRun2Spring15Trig"
 
const std::string _tag
 

Detailed Description

Definition at line 19 of file ElectronMVAEstimatorRun2Spring15Trig.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

ElectronMVAEstimatorRun2Spring15Trig::ElectronMVAEstimatorRun2Spring15Trig ( const edm::ParameterSet conf)

Definition at line 13 of file ElectronMVAEstimatorRun2Spring15Trig.cc.

References _gbrForests, GBRForestTools::createGBRForest(), Exception, edm::ParameterSet::getParameter(), mps_fire::i, nCategories, electrons_cff::weightFile, mvaElectronID_Fall17_iso_V1_cff::weightFileNames, and ~ElectronMVAEstimatorRun2Spring15Trig().

13  :
15  _tag(conf.getParameter<std::string>("mvaTag")),
16  _MethodName("BDTG method"),
17  _beamSpotLabel(conf.getParameter<edm::InputTag>("beamSpot")),
18  _conversionsLabelAOD(conf.getParameter<edm::InputTag>("conversionsAOD")),
19  _conversionsLabelMiniAOD(conf.getParameter<edm::InputTag>("conversionsMiniAOD")) {
20 
21  const std::vector <std::string> weightFileNames
22  = conf.getParameter<std::vector<std::string> >("weightFileNames");
23 
24  if( (int)(weightFileNames.size()) != nCategories )
25  throw cms::Exception("MVA config failure: ")
26  << "wrong number of weightfiles" << std::endl;
27 
28  _gbrForests.clear();
29  // Create a TMVA reader object for each category
30  for(int i=0; i<nCategories; i++){
31 
32  // Use unique_ptr so that all readers are properly cleaned up
33  // when the vector clear() is called in the destructor
34 
35  edm::FileInPath weightFile( weightFileNames[i] );
37 
38  }
39 
40 }
T getParameter(std::string const &) const
AnyMVAEstimatorRun2Base(const edm::ParameterSet &conf)
std::vector< std::unique_ptr< const GBRForest > > _gbrForests
static std::unique_ptr< const GBRForest > createGBRForest(const std::string &weightFile)
ElectronMVAEstimatorRun2Spring15Trig::~ElectronMVAEstimatorRun2Spring15Trig ( )
override

Definition at line 43 of file ElectronMVAEstimatorRun2Spring15Trig.cc.

Referenced by ElectronMVAEstimatorRun2Spring15Trig().

43  {
44 }

Member Function Documentation

void ElectronMVAEstimatorRun2Spring15Trig::constrainMVAVariables ( AllVariables allMVAVars) const

Definition at line 307 of file ElectronMVAEstimatorRun2Spring15Trig.cc.

References DEFINE_EDM_PLUGIN, ElectronMVAEstimatorRun2Spring15Trig::AllVariables::deta, ElectronMVAEstimatorRun2Spring15Trig::AllVariables::detacalo, ElectronMVAEstimatorRun2Spring15Trig::AllVariables::dphi, ElectronMVAEstimatorRun2Spring15Trig::AllVariables::eleEoPout, ElectronMVAEstimatorRun2Spring15Trig::AllVariables::EoP, ElectronMVAEstimatorRun2Spring15Trig::AllVariables::fbrem, ElectronMVAEstimatorRun2Spring15Trig::AllVariables::gsfchi2, ElectronMVAEstimatorRun2Spring15Trig::AllVariables::kfchi2, ElectronMVAEstimatorRun2Spring15Trig::AllVariables::OneMinusE1x5E5x5, and ElectronMVAEstimatorRun2Spring15Trig::AllVariables::R9.

Referenced by fillMVAVariables(), and getTag().

307  {
308 
309  // Check that variables do not have crazy values
310 
311  if(allMVAVars.fbrem < -1.)
312  allMVAVars.fbrem = -1.;
313 
314  allMVAVars.deta = fabs(allMVAVars.deta);
315  if(allMVAVars.deta > 0.06)
316  allMVAVars.deta = 0.06;
317 
318 
319  allMVAVars.dphi = fabs(allMVAVars.dphi);
320  if(allMVAVars.dphi > 0.6)
321  allMVAVars.dphi = 0.6;
322 
323 
324  if(allMVAVars.EoP > 20.)
325  allMVAVars.EoP = 20.;
326 
327  if(allMVAVars.eleEoPout > 20.)
328  allMVAVars.eleEoPout = 20.;
329 
330 
331  allMVAVars.detacalo = fabs(allMVAVars.detacalo);
332  if(allMVAVars.detacalo > 0.2)
333  allMVAVars.detacalo = 0.2;
334 
335  if(allMVAVars.OneMinusE1x5E5x5 < -1.)
336  allMVAVars.OneMinusE1x5E5x5 = -1;
337 
338  if(allMVAVars.OneMinusE1x5E5x5 > 2.)
339  allMVAVars.OneMinusE1x5E5x5 = 2.;
340 
341 
342 
343  if(allMVAVars.R9 > 5)
344  allMVAVars.R9 = 5;
345 
346  if(allMVAVars.gsfchi2 > 200.)
347  allMVAVars.gsfchi2 = 200;
348 
349 
350  if(allMVAVars.kfchi2 > 10.)
351  allMVAVars.kfchi2 = 10.;
352 
353 
354 }
std::vector< float > ElectronMVAEstimatorRun2Spring15Trig::fillMVAVariables ( const edm::Ptr< reco::Candidate > &  particle,
const edm::Event iEvent 
) const
overridevirtual

Implements AnyMVAEstimatorRun2Base.

Definition at line 140 of file ElectronMVAEstimatorRun2Spring15Trig.cc.

References _beamSpotLabel, _conversionsLabelAOD, _conversionsLabelMiniAOD, reco::Vertex::chi2(), pat::Electron::closestCtfTrackRef(), reco::GsfElectron::closestCtfTrackRef(), constrainMVAVariables(), conversions_cfi::conversions, ElectronMVAEstimatorRun2Spring15Trig::AllVariables::convVtxFitProbability, reco::GsfElectron::deltaEtaSeedClusterTrackAtCalo(), reco::GsfElectron::deltaEtaSuperClusterTrackAtVtx(), reco::GsfElectron::deltaPhiSuperClusterTrackAtVtx(), ElectronMVAEstimatorRun2Spring15Trig::AllVariables::deta, ElectronMVAEstimatorRun2Spring15Trig::AllVariables::detacalo, ElectronMVAEstimatorRun2Spring15Trig::AllVariables::dphi, reco::GsfElectron::ecalEnergy(), reco::GsfElectron::eEleClusterOverPout(), ElectronMVAEstimatorRun2Spring15Trig::AllVariables::eleEoPout, ElectronMVAEstimatorRun2Spring15Trig::AllVariables::EoP, reco::GsfElectron::eSuperClusterOverP(), ElectronMVAEstimatorRun2Spring15Trig::AllVariables::etawidth, Exception, ElectronMVAEstimatorRun2Spring15Trig::AllVariables::expectedMissingInnerHits, ElectronMVAEstimatorRun2Spring15Trig::AllVariables::fbrem, reco::GsfElectron::fbrem(), findCategory(), reco::GsfElectron::full5x5_e1x5(), reco::GsfElectron::full5x5_e5x5(), reco::GsfElectron::full5x5_r9(), reco::GsfElectron::full5x5_sigmaIetaIeta(), reco::GsfElectron::full5x5_sigmaIphiIphi(), edm::Ptr< T >::get(), edm::Ref< C, T, F >::get(), edm::Event::getByLabel(), ElectronMVAEstimatorRun2Spring15Trig::AllVariables::gsfchi2, ElectronMVAEstimatorRun2Spring15Trig::AllVariables::gsfhits, reco::GsfElectron::gsfTrack(), reco::GsfElectron::hadronicOverEm(), ElectronMVAEstimatorRun2Spring15Trig::AllVariables::HoE, ElectronMVAEstimatorRun2Spring15Trig::AllVariables::IoEmIoP, edm::Ref< C, T, F >::isAvailable(), isEndcapCategory(), edm::Ref< C, T, F >::isNonnull(), edm::Ref< C, T, F >::isNull(), reco::Vertex::isValid(), edm::HandleBase::isValid(), ElectronMVAEstimatorRun2Spring15Trig::AllVariables::kfchi2, ElectronMVAEstimatorRun2Spring15Trig::AllVariables::kfhits, ConversionTools::matchedConversion(), reco::HitPattern::MISSING_INNER_HITS, reco::Vertex::ndof(), nullptr, ElectronMVAEstimatorRun2Spring15Trig::AllVariables::OneMinusE1x5E5x5, AnyMVAEstimatorRun2Base::packMVAVariables(), ElectronMVAEstimatorRun2Spring15Trig::AllVariables::phiwidth, reco::BeamSpot::position(), ElectronMVAEstimatorRun2Spring15Trig::AllVariables::PreShowerOverRaw, ElectronMVAEstimatorRun2Spring15Trig::AllVariables::pt, reco::LeafCandidate::pt(), ElectronMVAEstimatorRun2Spring15Trig::AllVariables::R9, ElectronMVAEstimatorRun2Spring15Trig::AllVariables::SCeta, ElectronMVAEstimatorRun2Spring15Trig::AllVariables::see, ElectronMVAEstimatorRun2Spring15Trig::AllVariables::spp, reco::GsfElectron::superCluster(), reco::GsfElectron::trackMomentumAtVtx(), and badGlobalMuonTaggersAOD_cff::vtx.

Referenced by getTag(), isEndcapCategory(), and mvaValue().

141  {
142 
143  //
144  // Declare all value maps corresponding to the products we defined earlier
145  //
146  edm::Handle<reco::BeamSpot> theBeamSpot;
148 
149  // Get data needed for conversion rejection
150  iEvent.getByLabel(_beamSpotLabel, theBeamSpot);
151 
152  // Conversions in miniAOD and AOD have different names,
153  // but the same type, so we use the same handle with different tokens.
154  iEvent.getByLabel(_conversionsLabelAOD, conversions);
155  if( !conversions.isValid() )
156  iEvent.getByLabel(_conversionsLabelMiniAOD, conversions);
157 
158  // Make sure everything is retrieved successfully
159  if(! (theBeamSpot.isValid()
160  && conversions.isValid() )
161  )
162  throw cms::Exception("MVA failure: ")
163  << "Failed to retrieve event content needed for this MVA"
164  << std::endl
165  << "Check python MVA configuration file."
166  << std::endl;
167 
168  // Try to cast the particle into a reco particle.
169  // This should work for both reco and pat.
170  const edm::Ptr<reco::GsfElectron> eleRecoPtr = ( edm::Ptr<reco::GsfElectron> )particle;
171  if( eleRecoPtr.get() == nullptr )
172  throw cms::Exception("MVA failure: ")
173  << " given particle is expected to be reco::GsfElectron or pat::Electron," << std::endl
174  << " but appears to be neither" << std::endl;
175 
176  // Both pat and reco particles have exactly the same accessors, so we use a reco ptr
177  // throughout the code, with a single exception as of this writing, handled separately below.
178  auto superCluster = eleRecoPtr->superCluster();
179 
180  AllVariables allMVAVars;
181 
182  // Pure ECAL -> shower shapes
183  allMVAVars.see = eleRecoPtr->full5x5_sigmaIetaIeta();
184  allMVAVars.spp = eleRecoPtr->full5x5_sigmaIphiIphi();
185  allMVAVars.OneMinusE1x5E5x5 = 1. - eleRecoPtr->full5x5_e1x5() / eleRecoPtr->full5x5_e5x5();
186  allMVAVars.R9 = eleRecoPtr->full5x5_r9();
187  allMVAVars.etawidth = superCluster->etaWidth();
188  allMVAVars.phiwidth = superCluster->phiWidth();
189  allMVAVars.HoE = eleRecoPtr->hadronicOverEm();
190  // Endcap only variables
191  allMVAVars.PreShowerOverRaw = superCluster->preshowerEnergy() / superCluster->rawEnergy();
192 
193  // To get to CTF track information in pat::Electron, we have to have the pointer
194  // to pat::Electron, it is not accessible from the pointer to reco::GsfElectron.
195  // This behavior is reported and is expected to change in the future (post-7.4.5 some time).
196  bool validKF= false;
197  reco::TrackRef myTrackRef = eleRecoPtr->closestCtfTrackRef();
198  const edm::Ptr<pat::Electron> elePatPtr(eleRecoPtr);
199  // Check if this is really a pat::Electron, and if yes, get the track ref from this new
200  // pointer instead
201  if( elePatPtr.get() != nullptr )
202  myTrackRef = elePatPtr->closestCtfTrackRef();
203  validKF = (myTrackRef.isAvailable() && (myTrackRef.isNonnull()) );
204 
205  //Pure tracking variables
206  allMVAVars.kfhits = (validKF) ? myTrackRef->hitPattern().trackerLayersWithMeasurement() : -1. ;
207  allMVAVars.kfchi2 = (validKF) ? myTrackRef->normalizedChi2() : 0;
208  allMVAVars.gsfchi2 = eleRecoPtr->gsfTrack()->normalizedChi2();
209 
210  // Energy matching
211  allMVAVars.fbrem = eleRecoPtr->fbrem();
212 
213  allMVAVars.gsfhits = eleRecoPtr->gsfTrack()->hitPattern().trackerLayersWithMeasurement();
214  allMVAVars.expectedMissingInnerHits = eleRecoPtr->gsfTrack()
215  ->hitPattern().numberOfLostHits(reco::HitPattern::MISSING_INNER_HITS);
216 
218  conversions,
219  theBeamSpot->position());
220  double vertexFitProbability = -1.;
221  if(!conv_ref.isNull()) {
222  const reco::Vertex &vtx = conv_ref.get()->conversionVertex(); if (vtx.isValid()) {
223  vertexFitProbability = TMath::Prob( vtx.chi2(), vtx.ndof());
224  }
225  }
226  allMVAVars.convVtxFitProbability = vertexFitProbability;
227 
228  allMVAVars.EoP = eleRecoPtr->eSuperClusterOverP();
229  allMVAVars.eleEoPout = eleRecoPtr->eEleClusterOverPout();
230  float pAtVertex = eleRecoPtr->trackMomentumAtVtx().R();
231  allMVAVars.IoEmIoP = (1.0/eleRecoPtr->ecalEnergy()) - (1.0 / pAtVertex );
232 
233  // Geometrical matchings
234  allMVAVars.deta = eleRecoPtr->deltaEtaSuperClusterTrackAtVtx();
235  allMVAVars.dphi = eleRecoPtr->deltaPhiSuperClusterTrackAtVtx();
236  allMVAVars.detacalo = eleRecoPtr->deltaEtaSeedClusterTrackAtCalo();
237 
238  // Spectator variables
239  allMVAVars.pt = eleRecoPtr->pt();
240  float scEta = superCluster->eta();
241  allMVAVars.SCeta = scEta;
242 
243  constrainMVAVariables(allMVAVars);
244 
245  std::vector<float> vars;
246 
247  if( isEndcapCategory( findCategory( particle ) ) ) {
248  vars = packMVAVariables(allMVAVars.see,
249  allMVAVars.spp,
250  allMVAVars.OneMinusE1x5E5x5,
251  allMVAVars.R9,
252  allMVAVars.etawidth,
253  allMVAVars.phiwidth,
254  allMVAVars.HoE,
255  // Endcap only variables
256  allMVAVars.PreShowerOverRaw,
257  //Pure tracking variables
258  allMVAVars.kfhits,
259  allMVAVars.kfchi2,
260  allMVAVars.gsfchi2,
261  // Energy matching
262  allMVAVars.fbrem,
263  allMVAVars.gsfhits,
264  allMVAVars.expectedMissingInnerHits,
265  allMVAVars.convVtxFitProbability,
266  allMVAVars.EoP,
267  allMVAVars.eleEoPout,
268  allMVAVars.IoEmIoP,
269  // Geometrical matchings
270  allMVAVars.deta,
271  allMVAVars.dphi,
272  allMVAVars.detacalo,
273  // Spectator variables
274  allMVAVars.pt,
275  allMVAVars.SCeta);
276  } else {
277  vars = packMVAVariables(allMVAVars.see,
278  allMVAVars.spp,
279  allMVAVars.OneMinusE1x5E5x5,
280  allMVAVars.R9,
281  allMVAVars.etawidth,
282  allMVAVars.phiwidth,
283  allMVAVars.HoE,
284  //Pure tracking variables
285  allMVAVars.kfhits,
286  allMVAVars.kfchi2,
287  allMVAVars.gsfchi2,
288  // Energy matching
289  allMVAVars.fbrem,
290  allMVAVars.gsfhits,
291  allMVAVars.expectedMissingInnerHits,
292  allMVAVars.convVtxFitProbability,
293  allMVAVars.EoP,
294  allMVAVars.eleEoPout,
295  allMVAVars.IoEmIoP,
296  // Geometrical matchings
297  allMVAVars.deta,
298  allMVAVars.dphi,
299  allMVAVars.detacalo,
300  // Spectator variables
301  allMVAVars.pt,
302  allMVAVars.SCeta);
303  }
304  return vars;
305 }
bool isAvailable() const
Definition: Ref.h:577
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
Definition: GsfElectron.h:185
virtual TrackRef closestCtfTrackRef() const
Definition: GsfElectron.h:201
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:253
float eSuperClusterOverP() const
Definition: GsfElectron.h:245
float full5x5_e5x5() const
Definition: GsfElectron.h:459
float full5x5_e1x5() const
Definition: GsfElectron.h:457
T const * get() const
Returns C++ pointer to the item.
Definition: Ptr.h:159
bool isValid() const
Tells whether the vertex is valid.
Definition: Vertex.h:68
math::XYZVectorF trackMomentumAtVtx() const
Definition: GsfElectron.h:291
float full5x5_sigmaIphiIphi() const
Definition: GsfElectron.h:456
double pt() const final
transverse momentum
float fbrem() const
Definition: GsfElectron.h:757
#define nullptr
float full5x5_sigmaIetaIeta() const
Definition: GsfElectron.h:455
std::vector< float > packMVAVariables(const Args...args) const
float deltaEtaSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:249
float hadronicOverEm() const
Definition: GsfElectron.h:487
float deltaPhiSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:252
double chi2() const
chi-squares
Definition: Vertex.h:98
float eEleClusterOverPout() const
Definition: GsfElectron.h:248
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:245
bool isValid() const
Definition: HandleBase.h:74
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:475
bool isNull() const
Checks for null.
Definition: Ref.h:250
double ndof() const
Definition: Vertex.h:105
float ecalEnergy() const
Definition: GsfElectron.h:844
float full5x5_r9() const
Definition: GsfElectron.h:460
float deltaEtaSeedClusterTrackAtCalo() const
Definition: GsfElectron.h:250
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:184
const Point & position() const
position
Definition: BeamSpot.h:62
int findCategory(const edm::Ptr< reco::Candidate > &particle) const override
static reco::ConversionRef matchedConversion(const reco::GsfElectron &ele, const edm::Handle< reco::ConversionCollection > &convCol, const math::XYZPoint &beamspot, bool allowCkfMatch=true, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=0)
int ElectronMVAEstimatorRun2Spring15Trig::findCategory ( const edm::Ptr< reco::Candidate > &  particle) const
overridevirtual

Implements AnyMVAEstimatorRun2Base.

Definition at line 97 of file ElectronMVAEstimatorRun2Spring15Trig.cc.

References funct::abs(), CAT_EB1, CAT_EB2, CAT_EE, mvaElectronID_Fall17_iso_V1_cff::ebeeSplit, mvaElectronID_Fall17_iso_V1_cff::ebSplit, PVValHelper::eta, edm::Ptr< T >::get(), isEndcapCategory(), nullptr, reco::GsfElectron::superCluster(), and UNDEFINED.

Referenced by fillMVAVariables(), getTag(), and mvaValue().

97  {
98 
99  // Try to cast the particle into a reco particle.
100  // This should work for both reco and pat.
101  const edm::Ptr<reco::GsfElectron> eleRecoPtr = ( edm::Ptr<reco::GsfElectron> )particle;
102  if( eleRecoPtr.get() == nullptr )
103  throw cms::Exception("MVA failure: ")
104  << " given particle is expected to be reco::GsfElectron or pat::Electron," << std::endl
105  << " but appears to be neither" << std::endl;
106 
107  float eta = eleRecoPtr->superCluster()->eta();
108 
109  //
110  // Determine the category
111  //
112  int iCategory = UNDEFINED;
113  const float ebSplit = 0.800;// barrel is split into two regions
114  const float ebeeSplit = 1.479; // division between barrel and endcap
115 
116  if (std::abs(eta) < ebSplit)
117  iCategory = CAT_EB1;
118 
119  if (std::abs(eta) >= ebSplit && std::abs(eta) < ebeeSplit)
120  iCategory = CAT_EB2;
121 
122  if (std::abs(eta) >= ebeeSplit)
123  iCategory = CAT_EE;
124 
125  return iCategory;
126 }
T const * get() const
Returns C++ pointer to the item.
Definition: Ptr.h:159
#define nullptr
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:184
const std::string& ElectronMVAEstimatorRun2Spring15Trig::getName ( void  ) const
inlinefinalvirtual

Implements AnyMVAEstimatorRun2Base.

Definition at line 89 of file ElectronMVAEstimatorRun2Spring15Trig.h.

References _name.

Referenced by plotting.Plot::draw().

int ElectronMVAEstimatorRun2Spring15Trig::getNCategories ( ) const
inlineoverridevirtual
const std::string& ElectronMVAEstimatorRun2Spring15Trig::getTag ( ) const
inlinefinalvirtual
bool ElectronMVAEstimatorRun2Spring15Trig::isEndcapCategory ( int  category) const

Definition at line 129 of file ElectronMVAEstimatorRun2Spring15Trig.cc.

References CAT_EE, fillMVAVariables(), and GeomDetEnumerators::isEndcap().

Referenced by fillMVAVariables(), findCategory(), and getNCategories().

129  {
130 
131  bool isEndcap = false;
132  if( category == CAT_EE )
133  isEndcap = true;
134 
135  return isEndcap;
136 }
bool isEndcap(GeomDetEnumerators::SubDetector m)
float ElectronMVAEstimatorRun2Spring15Trig::mvaValue ( const edm::Ptr< reco::Candidate > &  particle,
const edm::Event iEvent 
) const
overridevirtual

Implements AnyMVAEstimatorRun2Base.

Definition at line 62 of file ElectronMVAEstimatorRun2Spring15Trig.cc.

References _gbrForests, _MethodName, gather_cfg::cout, debug, fillMVAVariables(), findCategory(), and mps_fire::result.

Referenced by setConsumes().

62  {
63 
64  const int iCategory = findCategory( particle );
65  const std::vector<float> vars = fillMVAVariables( particle, iEvent );
66  const float result = _gbrForests.at(iCategory)->GetClassifier(vars.data());
67 
68  const bool debug = false;
69  if(debug) {
70  std::cout << " *** Inside the class _MethodName " << _MethodName << std::endl;
71  std::cout << " bin " << iCategory
72  << " fbrem " << vars[11]
73  << " kfchi2 " << vars[9]
74  << " mykfhits " << vars[8]
75  << " gsfchi2 " << vars[10]
76  << " deta " << vars[18]
77  << " dphi " << vars[19]
78  << " detacalo " << vars[20]
79  << " see " << vars[0]
80  << " spp " << vars[1]
81  << " etawidth " << vars[4]
82  << " phiwidth " << vars[5]
83  << " OneMinusE1x5E5x5 " << vars[2]
84  << " R9 " << vars[3]
85  << " HoE " << vars[6]
86  << " EoP " << vars[15]
87  << " IoEmIoP " << vars[17]
88  << " eleEoPout " << vars[16]
89  << " eta " << vars[22]
90  << " pt " << vars[21] << std::endl;
91  std::cout << " ### MVA " << result << std::endl;
92  }
93 
94  return result;
95 }
std::vector< float > fillMVAVariables(const edm::Ptr< reco::Candidate > &particle, const edm::Event &) const override
std::vector< std::unique_ptr< const GBRForest > > _gbrForests
#define debug
Definition: HDRShower.cc:19
int findCategory(const edm::Ptr< reco::Candidate > &particle) const override
void ElectronMVAEstimatorRun2Spring15Trig::setConsumes ( edm::ConsumesCollector &&  cc) const
finalvirtual

Reimplemented from AnyMVAEstimatorRun2Base.

Definition at line 47 of file ElectronMVAEstimatorRun2Spring15Trig.cc.

References _beamSpotLabel, _conversionsLabelAOD, _conversionsLabelMiniAOD, and mvaValue().

Referenced by getTag().

47  {
48 
49  // All tokens for event content needed by this MVA
50 
51  // Beam spot (same for AOD and miniAOD)
53 
54  // Conversions collection (different names in AOD and miniAOD)
57 
58 
59 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
std::vector< Conversion > ConversionCollection
collectin of Conversion objects
Definition: ConversionFwd.h:9

Member Data Documentation

AllVariables ElectronMVAEstimatorRun2Spring15Trig::_allMVAVars
private

Definition at line 122 of file ElectronMVAEstimatorRun2Spring15Trig.h.

const edm::InputTag ElectronMVAEstimatorRun2Spring15Trig::_beamSpotLabel
private

Definition at line 128 of file ElectronMVAEstimatorRun2Spring15Trig.h.

Referenced by fillMVAVariables(), and setConsumes().

const edm::InputTag ElectronMVAEstimatorRun2Spring15Trig::_conversionsLabelAOD
private

Definition at line 130 of file ElectronMVAEstimatorRun2Spring15Trig.h.

Referenced by fillMVAVariables(), and setConsumes().

const edm::InputTag ElectronMVAEstimatorRun2Spring15Trig::_conversionsLabelMiniAOD
private

Definition at line 131 of file ElectronMVAEstimatorRun2Spring15Trig.h.

Referenced by fillMVAVariables(), and setConsumes().

std::vector< std::unique_ptr<const GBRForest> > ElectronMVAEstimatorRun2Spring15Trig::_gbrForests
private
const std::string ElectronMVAEstimatorRun2Spring15Trig::_MethodName
private

Definition at line 121 of file ElectronMVAEstimatorRun2Spring15Trig.h.

Referenced by mvaValue().

const std::string ElectronMVAEstimatorRun2Spring15Trig::_name = "ElectronMVAEstimatorRun2Spring15Trig"
private
const std::string ElectronMVAEstimatorRun2Spring15Trig::_tag
private

Definition at line 115 of file ElectronMVAEstimatorRun2Spring15Trig.h.

Referenced by getTag().

const int ElectronMVAEstimatorRun2Spring15Trig::nCategories = 3