CMS 3D CMS Logo

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

#include <PhotonMVAEstimatorRun2Spring15NonTrig.h>

Inheritance diagram for PhotonMVAEstimatorRun2Spring15NonTrig:
AnyMVAEstimatorRun2Base

Classes

struct  AllVariables
 

Public Types

enum  mvaCategories { UNDEFINED = -1, CAT_EB = 0, CAT_EE = 1 }
 

Public Member Functions

void constrainMVAVariables (AllVariables &) const
 
std::unique_ptr< const GBRForestcreateSingleReader (const int iCategory, const edm::FileInPath &weightFile)
 
std::vector< float > fillMVAVariables (const edm::Ptr< reco::Candidate > &particle, const edm::Event &iEvent) const override
 
int findCategory (const edm::Ptr< reco::Candidate > &particle) const override
 
virtual const std::string & getName () const overridefinal
 
virtual int getNCategories () const
 
virtual const std::string & getTag () const overridefinal
 
bool isEndcapCategory (int category) const
 
float mvaValue (const edm::Ptr< reco::Candidate > &particle, const edm::Event &) const
 
 PhotonMVAEstimatorRun2Spring15NonTrig (const edm::ParameterSet &conf)
 
void setConsumes (edm::ConsumesCollector &&) const override
 
 ~PhotonMVAEstimatorRun2Spring15NonTrig ()
 
- 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 = 2
 
- Public Attributes inherited from AnyMVAEstimatorRun2Base
const edm::ParameterSet _conf
 

Private Attributes

AllVariables _allMVAVars
 
const edm::InputTag _esEffSigmaRRMapLabel
 
const edm::InputTag _full5x5E1x3MapLabel
 
const edm::InputTag _full5x5E2x2MapLabel
 
const edm::InputTag _full5x5E2x5MaxMapLabel
 
const edm::InputTag _full5x5E5x5MapLabel
 
const edm::InputTag _full5x5SigmaIEtaIEtaMapLabel
 
const edm::InputTag _full5x5SigmaIEtaIPhiMapLabel
 
std::vector< std::unique_ptr
< const GBRForest > > 
_gbrForests
 
const std::string _MethodName
 
const std::string _name = "PhotonMVAEstimatorRun2Spring15NonTrig"
 
const edm::InputTag _phoChargedIsolationLabel
 
const edm::InputTag _phoPhotonIsolationLabel
 
const edm::InputTag _phoWorstChargedIsolationLabel
 
const edm::InputTag _rhoLabel
 
std::string _tag
 

Detailed Description

Definition at line 21 of file PhotonMVAEstimatorRun2Spring15NonTrig.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

PhotonMVAEstimatorRun2Spring15NonTrig::PhotonMVAEstimatorRun2Spring15NonTrig ( const edm::ParameterSet conf)

Definition at line 7 of file PhotonMVAEstimatorRun2Spring15NonTrig.cc.

References _gbrForests, _tag, createSingleReader(), edm::hlt::Exception, edm::ParameterSet::getParameter(), i, nCategories, and AlCaHLTBitMon_QueryRunRegistry::string.

7  :
9  _MethodName("BDTG method"),
10  _full5x5SigmaIEtaIEtaMapLabel(conf.getParameter<edm::InputTag>("full5x5SigmaIEtaIEtaMap")),
11  _full5x5SigmaIEtaIPhiMapLabel(conf.getParameter<edm::InputTag>("full5x5SigmaIEtaIPhiMap")),
12  _full5x5E1x3MapLabel(conf.getParameter<edm::InputTag>("full5x5E1x3Map")),
13  _full5x5E2x2MapLabel(conf.getParameter<edm::InputTag>("full5x5E2x2Map")),
14  _full5x5E2x5MaxMapLabel(conf.getParameter<edm::InputTag>("full5x5E2x5MaxMap")),
15  _full5x5E5x5MapLabel(conf.getParameter<edm::InputTag>("full5x5E5x5Map")),
16  _esEffSigmaRRMapLabel(conf.getParameter<edm::InputTag>("esEffSigmaRRMap")),
17  _phoChargedIsolationLabel(conf.getParameter<edm::InputTag>("phoChargedIsolation")),
18  _phoPhotonIsolationLabel(conf.getParameter<edm::InputTag>("phoPhotonIsolation")),
19  _phoWorstChargedIsolationLabel(conf.getParameter<edm::InputTag>("phoWorstChargedIsolation")),
21 {
22 
23  //
24  // Construct the MVA estimators
25  //
26  _tag = conf.getParameter<std::string>("mvaTag");
27 
28  const std::vector <std::string> weightFileNames
29  = conf.getParameter<std::vector<std::string> >("weightFileNames");
30 
31  if( (int)(weightFileNames.size()) != nCategories )
32  throw cms::Exception("MVA config failure: ")
33  << "wrong number of weightfiles" << std::endl;
34 
35  _gbrForests.clear();
36  // The method name is just a key to retrieve this method later, it is not
37  // a control parameter for a reader (the full definition of the MVA type and
38  // everything else comes from the xml weight files).
39 
40  // Create a TMVA reader object for each category
41  for(int i=0; i<nCategories; i++){
42 
43  // Use unique_ptr so that all readers are properly cleaned up
44  // when the vector clear() is called in the destructor
45 
46  edm::FileInPath weightFile( weightFileNames[i] );
47  _gbrForests.push_back( createSingleReader(i, weightFile ) );
48 
49  }
50 
51 }
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
AnyMVAEstimatorRun2Base(const edm::ParameterSet &conf)
std::unique_ptr< const GBRForest > createSingleReader(const int iCategory, const edm::FileInPath &weightFile)
std::vector< std::unique_ptr< const GBRForest > > _gbrForests
PhotonMVAEstimatorRun2Spring15NonTrig::~PhotonMVAEstimatorRun2Spring15NonTrig ( )

Definition at line 54 of file PhotonMVAEstimatorRun2Spring15NonTrig.cc.

54  {
55 }

Member Function Documentation

void PhotonMVAEstimatorRun2Spring15NonTrig::constrainMVAVariables ( AllVariables ) const

Definition at line 338 of file PhotonMVAEstimatorRun2Spring15NonTrig.cc.

Referenced by fillMVAVariables().

338  {
339 
340  // Check that variables do not have crazy values
341 
342  // This function is currently empty as this specific MVA was not
343  // developed with restricting variables to specific physical ranges.
344  return;
345 
346 }
std::unique_ptr< const GBRForest > PhotonMVAEstimatorRun2Spring15NonTrig::createSingleReader ( const int  iCategory,
const edm::FileInPath weightFile 
)

Definition at line 141 of file PhotonMVAEstimatorRun2Spring15NonTrig.cc.

References _allMVAVars, _MethodName, edm::FileInPath::fullPath(), isEndcapCategory(), groupFilesInBlocks::temp, PhotonMVAEstimatorRun2Spring15NonTrig::AllVariables::varChIsoRaw, PhotonMVAEstimatorRun2Spring15NonTrig::AllVariables::varE1x3overE5x5, PhotonMVAEstimatorRun2Spring15NonTrig::AllVariables::varE2x2overE5x5, PhotonMVAEstimatorRun2Spring15NonTrig::AllVariables::varE2x5overE5x5, PhotonMVAEstimatorRun2Spring15NonTrig::AllVariables::varESEffSigmaRR, PhotonMVAEstimatorRun2Spring15NonTrig::AllVariables::varESEnOverRawE, PhotonMVAEstimatorRun2Spring15NonTrig::AllVariables::varEta, PhotonMVAEstimatorRun2Spring15NonTrig::AllVariables::varPhi, PhotonMVAEstimatorRun2Spring15NonTrig::AllVariables::varPhoIsoRaw, PhotonMVAEstimatorRun2Spring15NonTrig::AllVariables::varPt, PhotonMVAEstimatorRun2Spring15NonTrig::AllVariables::varR9, PhotonMVAEstimatorRun2Spring15NonTrig::AllVariables::varRawE, PhotonMVAEstimatorRun2Spring15NonTrig::AllVariables::varRho, PhotonMVAEstimatorRun2Spring15NonTrig::AllVariables::varSCEta, PhotonMVAEstimatorRun2Spring15NonTrig::AllVariables::varSCEtaWidth, PhotonMVAEstimatorRun2Spring15NonTrig::AllVariables::varSCPhiWidth, PhotonMVAEstimatorRun2Spring15NonTrig::AllVariables::varSieie, PhotonMVAEstimatorRun2Spring15NonTrig::AllVariables::varSieip, and PhotonMVAEstimatorRun2Spring15NonTrig::AllVariables::varWorstChRaw.

Referenced by PhotonMVAEstimatorRun2Spring15NonTrig().

141  {
142 
143  //
144  // Create the reader
145  //
146  TMVA::Reader tmpTMVAReader( "!Color:Silent:Error" );
147 
148  //
149  // Configure all variables and spectators. Note: the order and names
150  // must match what is found in the xml weights file!
151  //
152 
153  tmpTMVAReader.AddVariable("recoPhi" , &_allMVAVars.varPhi);
154  tmpTMVAReader.AddVariable("r9" , &_allMVAVars.varR9);
155  tmpTMVAReader.AddVariable("sieieFull5x5", &_allMVAVars.varSieie);
156  tmpTMVAReader.AddVariable("sieipFull5x5", &_allMVAVars.varSieip);
157  tmpTMVAReader.AddVariable("e1x3Full5x5/e5x5Full5x5", &_allMVAVars.varE1x3overE5x5);
158  tmpTMVAReader.AddVariable("e2x2Full5x5/e5x5Full5x5", &_allMVAVars.varE2x2overE5x5);
159  tmpTMVAReader.AddVariable("e2x5Full5x5/e5x5Full5x5", &_allMVAVars.varE2x5overE5x5);
160  tmpTMVAReader.AddVariable("recoSCEta" , &_allMVAVars.varSCEta);
161  tmpTMVAReader.AddVariable("rawE" , &_allMVAVars.varRawE);
162  tmpTMVAReader.AddVariable("scEtaWidth", &_allMVAVars.varSCEtaWidth);
163  tmpTMVAReader.AddVariable("scPhiWidth", &_allMVAVars.varSCPhiWidth);
164 
165  // Endcap only variables
166  if( isEndcapCategory(iCategory) ){
167  tmpTMVAReader.AddVariable("esEn/rawE" , &_allMVAVars.varESEnOverRawE);
168  tmpTMVAReader.AddVariable("esRR" , &_allMVAVars.varESEffSigmaRR);
169  }
170 
171  // Pileup
172  tmpTMVAReader.AddVariable("rho" , &_allMVAVars.varRho);
173 
174  // Isolations
175  tmpTMVAReader.AddVariable("phoIsoRaw" , &_allMVAVars.varPhoIsoRaw);
176  tmpTMVAReader.AddVariable("chIsoRaw" , &_allMVAVars.varChIsoRaw);
177  tmpTMVAReader.AddVariable("chWorstRaw", &_allMVAVars.varWorstChRaw);
178 
179  // Spectators
180  tmpTMVAReader.AddSpectator("recoPt" , &_allMVAVars.varPt);
181  tmpTMVAReader.AddSpectator("recoEta", &_allMVAVars.varEta);
182 
183  //
184  // Book the method and set up the weights file
185  //
186  std::unique_ptr<TMVA::IMethod> temp( tmpTMVAReader.BookMVA(_MethodName , weightFile.fullPath() ) );
187 
188  return std::unique_ptr<const GBRForest>( new GBRForest( dynamic_cast<TMVA::MethodBDT*>( tmpTMVAReader.FindMVA(_MethodName) ) ) );
189 
190 }
std::string fullPath() const
Definition: FileInPath.cc:165
std::vector< float > PhotonMVAEstimatorRun2Spring15NonTrig::fillMVAVariables ( const edm::Ptr< reco::Candidate > &  particle,
const edm::Event iEvent 
) const
overridevirtual

Implements AnyMVAEstimatorRun2Base.

Definition at line 193 of file PhotonMVAEstimatorRun2Spring15NonTrig.cc.

References _esEffSigmaRRMapLabel, _full5x5E1x3MapLabel, _full5x5E2x2MapLabel, _full5x5E2x5MaxMapLabel, _full5x5E5x5MapLabel, _full5x5SigmaIEtaIEtaMapLabel, _full5x5SigmaIEtaIPhiMapLabel, _phoChargedIsolationLabel, _phoPhotonIsolationLabel, _phoWorstChargedIsolationLabel, _rhoLabel, constrainMVAVariables(), edm::hlt::Exception, findCategory(), edm::Event::getByLabel(), isEndcapCategory(), edm::Ptr< T >::isNull(), edm::HandleBase::isValid(), eostools::move(), AnyMVAEstimatorRun2Base::packMVAVariables(), rho, PhotonMVAEstimatorRun2Spring15NonTrig::AllVariables::varChIsoRaw, PhotonMVAEstimatorRun2Spring15NonTrig::AllVariables::varE1x3overE5x5, PhotonMVAEstimatorRun2Spring15NonTrig::AllVariables::varE2x2overE5x5, PhotonMVAEstimatorRun2Spring15NonTrig::AllVariables::varE2x5overE5x5, PhotonMVAEstimatorRun2Spring15NonTrig::AllVariables::varESEffSigmaRR, PhotonMVAEstimatorRun2Spring15NonTrig::AllVariables::varESEnOverRawE, PhotonMVAEstimatorRun2Spring15NonTrig::AllVariables::varEta, PhotonMVAEstimatorRun2Spring15NonTrig::AllVariables::varPhi, PhotonMVAEstimatorRun2Spring15NonTrig::AllVariables::varPhoIsoRaw, PhotonMVAEstimatorRun2Spring15NonTrig::AllVariables::varPt, PhotonMVAEstimatorRun2Spring15NonTrig::AllVariables::varR9, PhotonMVAEstimatorRun2Spring15NonTrig::AllVariables::varRawE, PhotonMVAEstimatorRun2Spring15NonTrig::AllVariables::varRho, PhotonMVAEstimatorRun2Spring15NonTrig::AllVariables::varSCEta, PhotonMVAEstimatorRun2Spring15NonTrig::AllVariables::varSCEtaWidth, PhotonMVAEstimatorRun2Spring15NonTrig::AllVariables::varSCPhiWidth, PhotonMVAEstimatorRun2Spring15NonTrig::AllVariables::varSieie, PhotonMVAEstimatorRun2Spring15NonTrig::AllVariables::varSieip, and PhotonMVAEstimatorRun2Spring15NonTrig::AllVariables::varWorstChRaw.

Referenced by mvaValue().

193  {
194 
195  //
196  // Declare all value maps corresponding to the above tokens
197  //
198  edm::Handle<edm::ValueMap<float> > full5x5SigmaIEtaIEtaMap;
199  edm::Handle<edm::ValueMap<float> > full5x5SigmaIEtaIPhiMap;
200  edm::Handle<edm::ValueMap<float> > full5x5E1x3Map;
201  edm::Handle<edm::ValueMap<float> > full5x5E2x2Map;
202  edm::Handle<edm::ValueMap<float> > full5x5E2x5MaxMap;
203  edm::Handle<edm::ValueMap<float> > full5x5E5x5Map;
204  edm::Handle<edm::ValueMap<float> > esEffSigmaRRMap;
205  //
206  edm::Handle<edm::ValueMap<float> > phoChargedIsolationMap;
207  edm::Handle<edm::ValueMap<float> > phoPhotonIsolationMap;
208  edm::Handle<edm::ValueMap<float> > phoWorstChargedIsolationMap;
209 
210  // Rho will be pulled from the event content
212 
213  // Get the full5x5 and ES maps
214  iEvent.getByLabel(_full5x5SigmaIEtaIEtaMapLabel, full5x5SigmaIEtaIEtaMap);
215  iEvent.getByLabel(_full5x5SigmaIEtaIPhiMapLabel, full5x5SigmaIEtaIPhiMap);
216  iEvent.getByLabel(_full5x5E1x3MapLabel, full5x5E1x3Map);
217  iEvent.getByLabel(_full5x5E2x2MapLabel, full5x5E2x2Map);
218  iEvent.getByLabel(_full5x5E2x5MaxMapLabel, full5x5E2x5MaxMap);
219  iEvent.getByLabel(_full5x5E5x5MapLabel, full5x5E5x5Map);
220  iEvent.getByLabel(_esEffSigmaRRMapLabel, esEffSigmaRRMap);
221 
222  // Get the isolation maps
223  iEvent.getByLabel(_phoChargedIsolationLabel, phoChargedIsolationMap);
224  iEvent.getByLabel(_phoPhotonIsolationLabel, phoPhotonIsolationMap);
225  iEvent.getByLabel(_phoWorstChargedIsolationLabel, phoWorstChargedIsolationMap);
226 
227  // Get rho
228  iEvent.getByLabel(_rhoLabel,rho);
229 
230  // Make sure everything is retrieved successfully
231  if(! (full5x5SigmaIEtaIEtaMap.isValid()
232  && full5x5SigmaIEtaIPhiMap.isValid()
233  && full5x5E1x3Map.isValid()
234  && full5x5E2x2Map.isValid()
235  && full5x5E2x5MaxMap.isValid()
236  && full5x5E5x5Map.isValid()
237  && esEffSigmaRRMap.isValid()
238  && phoChargedIsolationMap.isValid()
239  && phoPhotonIsolationMap.isValid()
240  && phoWorstChargedIsolationMap.isValid()
241  && rho.isValid() ) )
242  throw cms::Exception("MVA failure: ")
243  << "Failed to retrieve event content needed for this MVA"
244  << std::endl
245  << "Check python MVA configuration file and make sure all needed"
246  << std::endl
247  << "producers are running upstream" << std::endl;
248 
249  // Try to cast the particle into a reco particle.
250  // This should work for both reco and pat.
251  const edm::Ptr<reco::Photon> phoRecoPtr(particle);
252  if( phoRecoPtr.isNull() )
253  throw cms::Exception("MVA failure: ")
254  << " given particle is expected to be reco::Photon or pat::Photon," << std::endl
255  << " but appears to be neither" << std::endl;
256 
257  // Both pat and reco particles have exactly the same accessors.
258  auto superCluster = phoRecoPtr->superCluster();
259  // Full 5x5 cluster shapes. We could take some of this directly from
260  // the photon object, but some of these are not available.
261  const float e1x3 = (*full5x5E1x3Map )[ phoRecoPtr ];
262  const float e2x2 = (*full5x5E2x2Map )[ phoRecoPtr ];
263  const float e2x5 = (*full5x5E2x5MaxMap)[ phoRecoPtr ];
264  const float e5x5 = (*full5x5E5x5Map )[ phoRecoPtr ];
265 
266  AllVariables allMVAVars;
267 
268  allMVAVars.varPhi = phoRecoPtr->phi();
269  allMVAVars.varR9 = phoRecoPtr->r9() ;
270  allMVAVars.varSieie = (*full5x5SigmaIEtaIEtaMap)[ phoRecoPtr ]; // in principle, in the photon object as well
271  allMVAVars.varSieip = (*full5x5SigmaIEtaIPhiMap)[ phoRecoPtr ]; // not in the photon object
272  allMVAVars.varE1x3overE5x5 = e1x3/e5x5;
273  allMVAVars.varE2x2overE5x5 = e2x2/e5x5;
274  allMVAVars.varE2x5overE5x5 = e2x5/e5x5;
275  allMVAVars.varSCEta = superCluster->eta();
276  allMVAVars.varRawE = superCluster->rawEnergy();
277  allMVAVars.varSCEtaWidth = superCluster->etaWidth();
278  allMVAVars.varSCPhiWidth = superCluster->phiWidth();
279  allMVAVars.varESEnOverRawE = superCluster->preshowerEnergy() / superCluster->rawEnergy();
280  allMVAVars.varESEffSigmaRR = (*esEffSigmaRRMap)[ phoRecoPtr ];
281  allMVAVars.varRho = *rho;
282  allMVAVars.varPhoIsoRaw = (*phoPhotonIsolationMap)[phoRecoPtr];
283  allMVAVars.varChIsoRaw = (*phoChargedIsolationMap)[phoRecoPtr];
284  allMVAVars.varWorstChRaw = (*phoWorstChargedIsolationMap)[phoRecoPtr];
285  // Declare spectator vars
286  allMVAVars.varPt = phoRecoPtr->pt();
287  allMVAVars.varEta = phoRecoPtr->eta();
288 
289  constrainMVAVariables(allMVAVars);
290 
291  std::vector<float> vars;
292  if( isEndcapCategory( findCategory( particle ) ) ) {
293  vars = std::move( packMVAVariables(allMVAVars.varPhi,
294  allMVAVars.varR9,
295  allMVAVars.varSieie,
296  allMVAVars.varSieip,
297  allMVAVars.varE1x3overE5x5,
298  allMVAVars.varE2x2overE5x5,
299  allMVAVars.varE2x5overE5x5,
300  allMVAVars.varSCEta,
301  allMVAVars.varRawE,
302  allMVAVars.varSCEtaWidth,
303  allMVAVars.varSCPhiWidth,
304  allMVAVars.varESEnOverRawE,
305  allMVAVars.varESEffSigmaRR,
306  allMVAVars.varRho,
307  allMVAVars.varPhoIsoRaw,
308  allMVAVars.varChIsoRaw,
309  allMVAVars.varWorstChRaw,
310  // Declare spectator vars
311  allMVAVars.varPt,
312  allMVAVars.varEta)
313  );
314  } else {
315  vars = std::move( packMVAVariables(allMVAVars.varPhi,
316  allMVAVars.varR9,
317  allMVAVars.varSieie,
318  allMVAVars.varSieip,
319  allMVAVars.varE1x3overE5x5,
320  allMVAVars.varE2x2overE5x5,
321  allMVAVars.varE2x5overE5x5,
322  allMVAVars.varSCEta,
323  allMVAVars.varRawE,
324  allMVAVars.varSCEtaWidth,
325  allMVAVars.varSCPhiWidth,
326  allMVAVars.varRho,
327  allMVAVars.varPhoIsoRaw,
328  allMVAVars.varChIsoRaw,
329  allMVAVars.varWorstChRaw,
330  // Declare spectator vars
331  allMVAVars.varPt,
332  allMVAVars.varEta)
333  );
334  }
335  return vars;
336 }
Definition: DDAxes.h:10
std::vector< float > packMVAVariables(const Args...args) const
def move
Definition: eostools.py:508
bool isValid() const
Definition: HandleBase.h:75
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:405
int findCategory(const edm::Ptr< reco::Candidate > &particle) const override
int PhotonMVAEstimatorRun2Spring15NonTrig::findCategory ( const edm::Ptr< reco::Candidate > &  particle) const
overridevirtual

Implements AnyMVAEstimatorRun2Base.

Definition at line 100 of file PhotonMVAEstimatorRun2Spring15NonTrig.cc.

References funct::abs(), CAT_EB, CAT_EE, eta(), edm::Ptr< T >::isNull(), and UNDEFINED.

Referenced by fillMVAVariables(), and mvaValue().

100  {
101 
102  // Try to cast the particle into a reco particle.
103  // This should work for both reco and pat.
104  const edm::Ptr<reco::Photon> phoRecoPtr = ( edm::Ptr<reco::Photon> )particle;
105  if( phoRecoPtr.isNull() )
106  throw cms::Exception("MVA failure: ")
107  << " given particle is expected to be reco::Photon or pat::Photon," << std::endl
108  << " but appears to be neither" << std::endl;
109 
110  float eta = phoRecoPtr->superCluster()->eta();
111 
112  //
113  // Determine the category
114  //
115  int iCategory = UNDEFINED;
116  const float ebeeSplit = 1.479; // division between barrel and endcap
117 
118  if ( std::abs(eta) < ebeeSplit)
119  iCategory = CAT_EB;
120 
121  if (std::abs(eta) >= ebeeSplit)
122  iCategory = CAT_EE;
123 
124  return iCategory;
125 }
T eta() const
bool isNull() const
Checks for null.
Definition: Ptr.h:148
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
virtual const std::string& PhotonMVAEstimatorRun2Spring15NonTrig::getName ( void  ) const
inlinefinaloverridevirtual

Implements AnyMVAEstimatorRun2Base.

Definition at line 73 of file PhotonMVAEstimatorRun2Spring15NonTrig.h.

References _name.

virtual int PhotonMVAEstimatorRun2Spring15NonTrig::getNCategories ( ) const
inlinevirtual
virtual const std::string& PhotonMVAEstimatorRun2Spring15NonTrig::getTag ( void  ) const
inlinefinaloverridevirtual
bool PhotonMVAEstimatorRun2Spring15NonTrig::isEndcapCategory ( int  category) const

Definition at line 128 of file PhotonMVAEstimatorRun2Spring15NonTrig.cc.

References CAT_EE, and GeomDetEnumerators::isEndcap().

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

128  {
129 
130  // For this specific MVA the function is trivial, but kept for possible
131  // future evolution to an MVA with more categories in eta
132  bool isEndcap = false;
133  if( category == CAT_EE )
134  isEndcap = true;
135 
136  return isEndcap;
137 }
bool isEndcap(GeomDetEnumerators::SubDetector m)
float PhotonMVAEstimatorRun2Spring15NonTrig::mvaValue ( const edm::Ptr< reco::Candidate > &  particle,
const edm::Event iEvent 
) const
virtual

Implements AnyMVAEstimatorRun2Base.

Definition at line 58 of file PhotonMVAEstimatorRun2Spring15NonTrig.cc.

References _gbrForests, debug, fillMVAVariables(), findCategory(), isEndcapCategory(), eostools::move(), and query::result.

58  {
59 
60  const int iCategory = findCategory( particle );
61  const std::vector<float> vars = std::move( fillMVAVariables( particle, iEvent ) );
62 
63  const float result = _gbrForests.at(iCategory)->GetClassifier(vars.data());
64 
65  // DEBUG
66  const bool debug = false;
67  if( debug ){
68  printf("Printout of the photon variable inputs for MVA:\n");
69  printf(" varPhi_ %f\n", vars[0] );
70  printf(" varR9_ %f\n", vars[1] );
71  printf(" varSieie_ %f\n", vars[2] );
72  printf(" varSieip_ %f\n", vars[3] );
73  printf(" varE1x3overE5x5_ %f\n", vars[4] );
74  printf(" varE2x2overE5x5_ %f\n", vars[5] );
75  printf(" varE2x5overE5x5_ %f\n", vars[6] );
76  printf(" varSCEta_ %f\n", vars[7] );
77  printf(" varRawE_ %f\n", vars[8] );
78  printf(" varSCEtaWidth_ %f\n", vars[9] );
79  printf(" varSCPhiWidth_ %f\n", vars[10] );
80  printf(" varRho_ %f\n", vars[11] );
81  printf(" varPhoIsoRaw_ %f\n", vars[12] );
82  printf(" varChIsoRaw_ %f\n", vars[13] );
83  printf(" varWorstChRaw_ %f\n", vars[14] );
84  if( isEndcapCategory( iCategory ) ) {
85  printf(" varESEnOverRawE_ %f\n", vars[15] ); // for endcap MVA only
86  printf(" varESEffSigmaRR_ %f\n", vars[16] ); // for endcap MVA only
87  // The spectators
88  printf(" varPt_ %f\n", vars[17] );
89  printf(" varEta_ %f\n", vars[18] );
90  } else {
91  // The spectators
92  printf(" varPt_ %f\n", vars[15] );
93  printf(" varEta_ %f\n", vars[16] );
94  }
95  }
96 
97  return result;
98 }
tuple result
Definition: query.py:137
def move
Definition: eostools.py:508
#define debug
Definition: HDRShower.cc:19
std::vector< float > fillMVAVariables(const edm::Ptr< reco::Candidate > &particle, const edm::Event &iEvent) const override
int findCategory(const edm::Ptr< reco::Candidate > &particle) const override
std::vector< std::unique_ptr< const GBRForest > > _gbrForests
void PhotonMVAEstimatorRun2Spring15NonTrig::setConsumes ( edm::ConsumesCollector &&  cc) const
overridevirtual

Reimplemented from AnyMVAEstimatorRun2Base.

Definition at line 348 of file PhotonMVAEstimatorRun2Spring15NonTrig.cc.

References _esEffSigmaRRMapLabel, _full5x5E1x3MapLabel, _full5x5E2x2MapLabel, _full5x5E2x5MaxMapLabel, _full5x5E5x5MapLabel, _full5x5SigmaIEtaIEtaMapLabel, _full5x5SigmaIEtaIPhiMapLabel, _phoChargedIsolationLabel, _phoPhotonIsolationLabel, _phoWorstChargedIsolationLabel, and _rhoLabel.

348  {
359  cc.consumes<double>(_rhoLabel);
360 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)

Member Data Documentation

AllVariables PhotonMVAEstimatorRun2Spring15NonTrig::_allMVAVars
private

Definition at line 109 of file PhotonMVAEstimatorRun2Spring15NonTrig.h.

Referenced by createSingleReader().

const edm::InputTag PhotonMVAEstimatorRun2Spring15NonTrig::_esEffSigmaRRMapLabel
private

Definition at line 124 of file PhotonMVAEstimatorRun2Spring15NonTrig.h.

Referenced by fillMVAVariables(), and setConsumes().

const edm::InputTag PhotonMVAEstimatorRun2Spring15NonTrig::_full5x5E1x3MapLabel
private

Definition at line 120 of file PhotonMVAEstimatorRun2Spring15NonTrig.h.

Referenced by fillMVAVariables(), and setConsumes().

const edm::InputTag PhotonMVAEstimatorRun2Spring15NonTrig::_full5x5E2x2MapLabel
private

Definition at line 121 of file PhotonMVAEstimatorRun2Spring15NonTrig.h.

Referenced by fillMVAVariables(), and setConsumes().

const edm::InputTag PhotonMVAEstimatorRun2Spring15NonTrig::_full5x5E2x5MaxMapLabel
private

Definition at line 122 of file PhotonMVAEstimatorRun2Spring15NonTrig.h.

Referenced by fillMVAVariables(), and setConsumes().

const edm::InputTag PhotonMVAEstimatorRun2Spring15NonTrig::_full5x5E5x5MapLabel
private

Definition at line 123 of file PhotonMVAEstimatorRun2Spring15NonTrig.h.

Referenced by fillMVAVariables(), and setConsumes().

const edm::InputTag PhotonMVAEstimatorRun2Spring15NonTrig::_full5x5SigmaIEtaIEtaMapLabel
private

Definition at line 118 of file PhotonMVAEstimatorRun2Spring15NonTrig.h.

Referenced by fillMVAVariables(), and setConsumes().

const edm::InputTag PhotonMVAEstimatorRun2Spring15NonTrig::_full5x5SigmaIEtaIPhiMapLabel
private

Definition at line 119 of file PhotonMVAEstimatorRun2Spring15NonTrig.h.

Referenced by fillMVAVariables(), and setConsumes().

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

Definition at line 108 of file PhotonMVAEstimatorRun2Spring15NonTrig.h.

Referenced by createSingleReader().

const std::string PhotonMVAEstimatorRun2Spring15NonTrig::_name = "PhotonMVAEstimatorRun2Spring15NonTrig"
private

Definition at line 97 of file PhotonMVAEstimatorRun2Spring15NonTrig.h.

Referenced by getName().

const edm::InputTag PhotonMVAEstimatorRun2Spring15NonTrig::_phoChargedIsolationLabel
private

Definition at line 126 of file PhotonMVAEstimatorRun2Spring15NonTrig.h.

Referenced by fillMVAVariables(), and setConsumes().

const edm::InputTag PhotonMVAEstimatorRun2Spring15NonTrig::_phoPhotonIsolationLabel
private

Definition at line 127 of file PhotonMVAEstimatorRun2Spring15NonTrig.h.

Referenced by fillMVAVariables(), and setConsumes().

const edm::InputTag PhotonMVAEstimatorRun2Spring15NonTrig::_phoWorstChargedIsolationLabel
private

Definition at line 128 of file PhotonMVAEstimatorRun2Spring15NonTrig.h.

Referenced by fillMVAVariables(), and setConsumes().

const edm::InputTag PhotonMVAEstimatorRun2Spring15NonTrig::_rhoLabel
private

Definition at line 129 of file PhotonMVAEstimatorRun2Spring15NonTrig.h.

Referenced by fillMVAVariables(), and setConsumes().

std::string PhotonMVAEstimatorRun2Spring15NonTrig::_tag
private
const int PhotonMVAEstimatorRun2Spring15NonTrig::nCategories = 2