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
PhotonMVAEstimatorRun2Phys14NonTrig Class Reference

#include <PhotonMVAEstimatorRun2Phys14NonTrig.h>

Inheritance diagram for PhotonMVAEstimatorRun2Phys14NonTrig:
AnyMVAEstimatorRun2Base

Classes

struct  AllVariables
 

Public Types

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

Public Member Functions

void constrainMVAVariables ()
 
TMVA::Reader * createSingleReader (const int iCategory, const edm::FileInPath &weightFile)
 
void fillMVAVariables (const edm::Ptr< reco::Candidate > &particle)
 
int findCategory (const edm::Ptr< reco::Candidate > &particle)
 
void getEventContent (const edm::Event &iEvent) override
 
const std::string getName ()
 
int getNCategories ()
 
bool isEndcapCategory (int category)
 
float mvaValue (const edm::Ptr< reco::Candidate > &particle)
 
 PhotonMVAEstimatorRun2Phys14NonTrig (const edm::ParameterSet &conf)
 
void setConsumes (edm::ConsumesCollector &&) override
 
 ~PhotonMVAEstimatorRun2Phys14NonTrig ()
 
- Public Member Functions inherited from AnyMVAEstimatorRun2Base
 AnyMVAEstimatorRun2Base (const edm::ParameterSet &conf)
 
virtual ~AnyMVAEstimatorRun2Base ()
 

Public Attributes

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

Private Attributes

AllVariables _allMVAVars
 
edm::Handle< edm::ValueMap
< float > > 
_esEffSigmaRRMap
 
edm::EDGetTokenT
< edm::ValueMap< float > > 
_esEffSigmaRRMapToken
 
edm::Handle< edm::ValueMap
< float > > 
_full5x5E1x3Map
 
edm::EDGetTokenT
< edm::ValueMap< float > > 
_full5x5E1x3MapToken
 
edm::Handle< edm::ValueMap
< float > > 
_full5x5E2x2Map
 
edm::EDGetTokenT
< edm::ValueMap< float > > 
_full5x5E2x2MapToken
 
edm::Handle< edm::ValueMap
< float > > 
_full5x5E2x5MaxMap
 
edm::EDGetTokenT
< edm::ValueMap< float > > 
_full5x5E2x5MaxMapToken
 
edm::Handle< edm::ValueMap
< float > > 
_full5x5E5x5Map
 
edm::EDGetTokenT
< edm::ValueMap< float > > 
_full5x5E5x5MapToken
 
edm::Handle< edm::ValueMap
< float > > 
_full5x5SigmaIEtaIEtaMap
 
edm::EDGetTokenT
< edm::ValueMap< float > > 
_full5x5SigmaIEtaIEtaMapToken
 
edm::Handle< edm::ValueMap
< float > > 
_full5x5SigmaIEtaIPhiMap
 
edm::EDGetTokenT
< edm::ValueMap< float > > 
_full5x5SigmaIEtaIPhiMapToken
 
std::string _MethodName
 
edm::Handle< edm::ValueMap
< float > > 
_phoChargedIsolationMap
 
edm::EDGetTokenT
< edm::ValueMap< float > > 
_phoChargedIsolationToken
 
edm::Handle< edm::ValueMap
< float > > 
_phoPhotonIsolationMap
 
edm::EDGetTokenT
< edm::ValueMap< float > > 
_phoPhotonIsolationToken
 
edm::Handle< edm::ValueMap
< float > > 
_phoWorstChargedIsolationMap
 
edm::EDGetTokenT
< edm::ValueMap< float > > 
_phoWorstChargedIsolationToken
 
edm::Handle< double > _rho
 
edm::EDGetTokenT< double > _rhoToken
 
std::vector< std::unique_ptr
< TMVA::Reader > > 
_tmvaReaders
 
const std::string name_ = "PhotonMVAEstimatorRun2Phys14NonTrig"
 

Detailed Description

Definition at line 19 of file PhotonMVAEstimatorRun2Phys14NonTrig.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

PhotonMVAEstimatorRun2Phys14NonTrig::PhotonMVAEstimatorRun2Phys14NonTrig ( const edm::ParameterSet conf)

Definition at line 5 of file PhotonMVAEstimatorRun2Phys14NonTrig.cc.

References _MethodName, _tmvaReaders, createSingleReader(), edm::hlt::Exception, edm::ParameterSet::getParameter(), i, and nCategories.

5  :
7 {
8 
9  //
10  // Construct the MVA estimators
11  //
12  const std::vector <std::string> weightFileNames
13  = conf.getParameter<std::vector<std::string> >("weightFileNames");
14 
15  if( (int)(weightFileNames.size()) != nCategories )
16  throw cms::Exception("MVA config failure: ")
17  << "wrong number of weightfiles" << std::endl;
18 
19  _tmvaReaders.clear();
20  // The method name is just a key to retrieve this method later, it is not
21  // a control parameter for a reader (the full definition of the MVA type and
22  // everything else comes from the xml weight files).
23  _MethodName = "BDTG method";
24  // Create a TMVA reader object for each category
25  for(int i=0; i<nCategories; i++){
26 
27  // Use unique_ptr so that all readers are properly cleaned up
28  // when the vector clear() is called in the destructor
29 
30  edm::FileInPath weightFile( weightFileNames[i] );
31  _tmvaReaders.push_back( std::unique_ptr<TMVA::Reader>
32  ( createSingleReader(i, weightFile ) ) );
33 
34  }
35 
36 }
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
AnyMVAEstimatorRun2Base(const edm::ParameterSet &conf)
TMVA::Reader * createSingleReader(const int iCategory, const edm::FileInPath &weightFile)
std::vector< std::unique_ptr< TMVA::Reader > > _tmvaReaders
PhotonMVAEstimatorRun2Phys14NonTrig::~PhotonMVAEstimatorRun2Phys14NonTrig ( )

Definition at line 39 of file PhotonMVAEstimatorRun2Phys14NonTrig.cc.

References _tmvaReaders.

39  {
40 
41  _tmvaReaders.clear();
42 }
std::vector< std::unique_ptr< TMVA::Reader > > _tmvaReaders

Member Function Documentation

void PhotonMVAEstimatorRun2Phys14NonTrig::constrainMVAVariables ( )

Definition at line 295 of file PhotonMVAEstimatorRun2Phys14NonTrig.cc.

Referenced by mvaValue().

295  {
296 
297  // Check that variables do not have crazy values
298 
299  // This function is currently empty as this specific MVA was not
300  // developed with restricting variables to specific physical ranges.
301  return;
302 
303 }
TMVA::Reader * PhotonMVAEstimatorRun2Phys14NonTrig::createSingleReader ( const int  iCategory,
const edm::FileInPath weightFile 
)

Definition at line 202 of file PhotonMVAEstimatorRun2Phys14NonTrig.cc.

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

Referenced by PhotonMVAEstimatorRun2Phys14NonTrig().

202  {
203 
204  //
205  // Create the reader
206  //
207  TMVA::Reader *tmpTMVAReader = new TMVA::Reader( "!Color:Silent:Error" );
208 
209  //
210  // Configure all variables and spectators. Note: the order and names
211  // must match what is found in the xml weights file!
212  //
213 
214  tmpTMVAReader->AddVariable("recoPhi" , &_allMVAVars.varPhi);
215  tmpTMVAReader->AddVariable("r9" , &_allMVAVars.varR9);
216  tmpTMVAReader->AddVariable("sieie_2012", &_allMVAVars.varSieie);
217  tmpTMVAReader->AddVariable("sieip_2012", &_allMVAVars.varSieip);
218  tmpTMVAReader->AddVariable("e1x3_2012/e5x5_2012" , &_allMVAVars.varE1x3overE5x5);
219  tmpTMVAReader->AddVariable("e2x2_2012/e5x5_2012" , &_allMVAVars.varE2x2overE5x5);
220  tmpTMVAReader->AddVariable("e2x5_2012/e5x5_2012" , &_allMVAVars.varE2x5overE5x5);
221  tmpTMVAReader->AddVariable("recoSCEta" , &_allMVAVars.varSCEta);
222  tmpTMVAReader->AddVariable("rawE" , &_allMVAVars.varRawE);
223  tmpTMVAReader->AddVariable("scEtaWidth", &_allMVAVars.varSCEtaWidth);
224  tmpTMVAReader->AddVariable("scPhiWidth", &_allMVAVars.varSCPhiWidth);
225 
226  // Endcap only variables
227  if( isEndcapCategory(iCategory) ){
228  tmpTMVAReader->AddVariable("esEn/rawE" , &_allMVAVars.varESEnOverRawE);
229  tmpTMVAReader->AddVariable("esRR" , &_allMVAVars.varESEffSigmaRR);
230  }
231 
232  // Pileup
233  tmpTMVAReader->AddVariable("rho" , &_allMVAVars.varRho);
234 
235  // Isolations
236  tmpTMVAReader->AddVariable("phoIsoRaw" , &_allMVAVars.varPhoIsoRaw);
237  tmpTMVAReader->AddVariable("chIsoRaw" , &_allMVAVars.varChIsoRaw);
238  tmpTMVAReader->AddVariable("chWorstRaw", &_allMVAVars.varWorstChRaw);
239 
240  // Spectators
241  tmpTMVAReader->AddSpectator("recoPt" , &_allMVAVars.varPt);
242  tmpTMVAReader->AddSpectator("recoEta", &_allMVAVars.varEta);
243 
244  //
245  // Book the method and set up the weights file
246  //
247  tmpTMVAReader->BookMVA(_MethodName , weightFile.fullPath() );
248 
249  return tmpTMVAReader;
250 }
std::string fullPath() const
Definition: FileInPath.cc:165
void PhotonMVAEstimatorRun2Phys14NonTrig::fillMVAVariables ( const edm::Ptr< reco::Candidate > &  particle)
virtual

Implements AnyMVAEstimatorRun2Base.

Definition at line 253 of file PhotonMVAEstimatorRun2Phys14NonTrig.cc.

References _allMVAVars, _rho, edm::Ptr< T >::isNull(), PhotonMVAEstimatorRun2Phys14NonTrig::AllVariables::varChIsoRaw, PhotonMVAEstimatorRun2Phys14NonTrig::AllVariables::varE1x3overE5x5, PhotonMVAEstimatorRun2Phys14NonTrig::AllVariables::varE2x2overE5x5, PhotonMVAEstimatorRun2Phys14NonTrig::AllVariables::varE2x5overE5x5, PhotonMVAEstimatorRun2Phys14NonTrig::AllVariables::varESEffSigmaRR, PhotonMVAEstimatorRun2Phys14NonTrig::AllVariables::varESEnOverRawE, PhotonMVAEstimatorRun2Phys14NonTrig::AllVariables::varEta, PhotonMVAEstimatorRun2Phys14NonTrig::AllVariables::varPhi, PhotonMVAEstimatorRun2Phys14NonTrig::AllVariables::varPhoIsoRaw, PhotonMVAEstimatorRun2Phys14NonTrig::AllVariables::varPt, PhotonMVAEstimatorRun2Phys14NonTrig::AllVariables::varR9, PhotonMVAEstimatorRun2Phys14NonTrig::AllVariables::varRawE, PhotonMVAEstimatorRun2Phys14NonTrig::AllVariables::varRho, PhotonMVAEstimatorRun2Phys14NonTrig::AllVariables::varSCEta, PhotonMVAEstimatorRun2Phys14NonTrig::AllVariables::varSCEtaWidth, PhotonMVAEstimatorRun2Phys14NonTrig::AllVariables::varSCPhiWidth, PhotonMVAEstimatorRun2Phys14NonTrig::AllVariables::varSieie, PhotonMVAEstimatorRun2Phys14NonTrig::AllVariables::varSieip, and PhotonMVAEstimatorRun2Phys14NonTrig::AllVariables::varWorstChRaw.

Referenced by mvaValue().

253  {
254 
255  // Try to cast the particle into a reco particle.
256  // This should work for both reco and pat.
257  const edm::Ptr<reco::Photon> phoRecoPtr = ( edm::Ptr<reco::Photon> )particle;
258  if( phoRecoPtr.isNull() )
259  throw cms::Exception("MVA failure: ")
260  << " given particle is expected to be reco::Photon or pat::Photon," << std::endl
261  << " but appears to be neither" << std::endl;
262 
263  // Both pat and reco particles have exactly the same accessors.
264  auto superCluster = phoRecoPtr->superCluster();
265  // Full 5x5 cluster shapes. We could take some of this directly from
266  // the photon object, but some of these are not available.
267  float e1x3 = (*_full5x5E1x3Map )[ phoRecoPtr ];
268  float e2x2 = (*_full5x5E2x2Map )[ phoRecoPtr ];
269  float e2x5 = (*_full5x5E2x5MaxMap)[ phoRecoPtr ];
270  float e5x5 = (*_full5x5E5x5Map )[ phoRecoPtr ];
271 
272  _allMVAVars.varPhi = phoRecoPtr->phi();
273  _allMVAVars.varR9 = phoRecoPtr->r9() ;
274  _allMVAVars.varSieie = (*_full5x5SigmaIEtaIEtaMap)[ phoRecoPtr ]; // in principle, in the photon object as well
275  _allMVAVars.varSieip = (*_full5x5SigmaIEtaIPhiMap)[ phoRecoPtr ]; // not in the photon object
276  _allMVAVars.varE1x3overE5x5 = e1x3/e5x5;
277  _allMVAVars.varE2x2overE5x5 = e2x2/e5x5;
278  _allMVAVars.varE2x5overE5x5 = e2x5/e5x5;
279  _allMVAVars.varSCEta = superCluster->eta();
280  _allMVAVars.varRawE = superCluster->rawEnergy();
281  _allMVAVars.varSCEtaWidth = superCluster->etaWidth();
282  _allMVAVars.varSCPhiWidth = superCluster->phiWidth();
283  _allMVAVars.varESEnOverRawE = superCluster->preshowerEnergy() / superCluster->rawEnergy();
284  _allMVAVars.varESEffSigmaRR = (*_esEffSigmaRRMap)[ phoRecoPtr ];
285  _allMVAVars.varRho = *_rho;
286  _allMVAVars.varPhoIsoRaw = (*_phoPhotonIsolationMap)[phoRecoPtr];
287  _allMVAVars.varChIsoRaw = (*_phoChargedIsolationMap)[phoRecoPtr];
288  _allMVAVars.varWorstChRaw = (*_phoWorstChargedIsolationMap)[phoRecoPtr];
289  // Declare spectator vars
290  _allMVAVars.varPt = phoRecoPtr->pt();
291  _allMVAVars.varEta = phoRecoPtr->eta();
292 
293 }
bool isNull() const
Checks for null.
Definition: Ptr.h:148
int PhotonMVAEstimatorRun2Phys14NonTrig::findCategory ( const edm::Ptr< reco::Candidate > &  particle)
virtual

Implements AnyMVAEstimatorRun2Base.

Definition at line 161 of file PhotonMVAEstimatorRun2Phys14NonTrig.cc.

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

Referenced by mvaValue().

161  {
162 
163  // Try to cast the particle into a reco particle.
164  // This should work for both reco and pat.
165  const edm::Ptr<reco::Photon> phoRecoPtr = ( edm::Ptr<reco::Photon> )particle;
166  if( phoRecoPtr.isNull() )
167  throw cms::Exception("MVA failure: ")
168  << " given particle is expected to be reco::Photon or pat::Photon," << std::endl
169  << " but appears to be neither" << std::endl;
170 
171  float eta = phoRecoPtr->superCluster()->eta();
172 
173  //
174  // Determine the category
175  //
176  int iCategory = UNDEFINED;
177  const float ebeeSplit = 1.479; // division between barrel and endcap
178 
179  if ( std::abs(eta) < ebeeSplit)
180  iCategory = CAT_EB;
181 
182  if (std::abs(eta) >= ebeeSplit)
183  iCategory = CAT_EE;
184 
185  return iCategory;
186 }
T eta() const
bool isNull() const
Checks for null.
Definition: Ptr.h:148
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void PhotonMVAEstimatorRun2Phys14NonTrig::getEventContent ( const edm::Event iEvent)
overridevirtual

Reimplemented from AnyMVAEstimatorRun2Base.

Definition at line 84 of file PhotonMVAEstimatorRun2Phys14NonTrig.cc.

References _esEffSigmaRRMap, _esEffSigmaRRMapToken, _full5x5E1x3Map, _full5x5E1x3MapToken, _full5x5E2x2Map, _full5x5E2x2MapToken, _full5x5E2x5MaxMap, _full5x5E2x5MaxMapToken, _full5x5E5x5Map, _full5x5E5x5MapToken, _full5x5SigmaIEtaIEtaMap, _full5x5SigmaIEtaIEtaMapToken, _full5x5SigmaIEtaIPhiMap, _full5x5SigmaIEtaIPhiMapToken, _phoChargedIsolationMap, _phoChargedIsolationToken, _phoPhotonIsolationMap, _phoPhotonIsolationToken, _phoWorstChargedIsolationMap, _phoWorstChargedIsolationToken, _rho, _rhoToken, edm::hlt::Exception, edm::Event::getByToken(), and edm::HandleBase::isValid().

84  {
85 
86  // Get the full5x5 and ES maps
94 
95  // Get the isolation maps
99 
100  // Get rho
101  iEvent.getByToken(_rhoToken,_rho);
102 
103  // Make sure everything is retrieved successfully
114  && _rho.isValid() ) )
115  throw cms::Exception("MVA failure: ")
116  << "Failed to retrieve event content needed for this MVA"
117  << std::endl
118  << "Check python MVA configuration file and make sure all needed"
119  << std::endl
120  << "producers are running upstream" << std::endl;
121 }
edm::EDGetTokenT< edm::ValueMap< float > > _full5x5E5x5MapToken
edm::Handle< edm::ValueMap< float > > _phoChargedIsolationMap
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
edm::Handle< edm::ValueMap< float > > _esEffSigmaRRMap
edm::Handle< edm::ValueMap< float > > _full5x5E5x5Map
edm::EDGetTokenT< edm::ValueMap< float > > _phoChargedIsolationToken
edm::EDGetTokenT< edm::ValueMap< float > > _phoWorstChargedIsolationToken
edm::EDGetTokenT< edm::ValueMap< float > > _esEffSigmaRRMapToken
edm::EDGetTokenT< edm::ValueMap< float > > _full5x5SigmaIEtaIPhiMapToken
edm::Handle< edm::ValueMap< float > > _full5x5SigmaIEtaIPhiMap
edm::Handle< edm::ValueMap< float > > _phoPhotonIsolationMap
bool isValid() const
Definition: HandleBase.h:75
edm::Handle< edm::ValueMap< float > > _full5x5E2x2Map
edm::Handle< edm::ValueMap< float > > _phoWorstChargedIsolationMap
edm::Handle< edm::ValueMap< float > > _full5x5SigmaIEtaIEtaMap
edm::Handle< edm::ValueMap< float > > _full5x5E1x3Map
edm::EDGetTokenT< edm::ValueMap< float > > _full5x5SigmaIEtaIEtaMapToken
edm::EDGetTokenT< edm::ValueMap< float > > _full5x5E2x5MaxMapToken
edm::EDGetTokenT< edm::ValueMap< float > > _full5x5E1x3MapToken
edm::Handle< edm::ValueMap< float > > _full5x5E2x5MaxMap
edm::EDGetTokenT< edm::ValueMap< float > > _phoPhotonIsolationToken
edm::EDGetTokenT< edm::ValueMap< float > > _full5x5E2x2MapToken
const std::string PhotonMVAEstimatorRun2Phys14NonTrig::getName ( void  )
inlinevirtual

Implements AnyMVAEstimatorRun2Base.

Definition at line 72 of file PhotonMVAEstimatorRun2Phys14NonTrig.h.

References name_.

int PhotonMVAEstimatorRun2Phys14NonTrig::getNCategories ( )
inlinevirtual
bool PhotonMVAEstimatorRun2Phys14NonTrig::isEndcapCategory ( int  category)

Definition at line 189 of file PhotonMVAEstimatorRun2Phys14NonTrig.cc.

References CAT_EE, and GeomDetEnumerators::isEndcap().

Referenced by createSingleReader().

189  {
190 
191  // For this specific MVA the function is trivial, but kept for possible
192  // future evolution to an MVA with more categories in eta
193  bool isEndcap = false;
194  if( category == CAT_EE )
195  isEndcap = true;
196 
197  return isEndcap;
198 }
bool isEndcap(GeomDetEnumerators::SubDetector m)
float PhotonMVAEstimatorRun2Phys14NonTrig::mvaValue ( const edm::Ptr< reco::Candidate > &  particle)
virtual

Implements AnyMVAEstimatorRun2Base.

Definition at line 125 of file PhotonMVAEstimatorRun2Phys14NonTrig.cc.

References _allMVAVars, _MethodName, _tmvaReaders, constrainMVAVariables(), debug, fillMVAVariables(), findCategory(), query::result, PhotonMVAEstimatorRun2Phys14NonTrig::AllVariables::varChIsoRaw, PhotonMVAEstimatorRun2Phys14NonTrig::AllVariables::varE1x3overE5x5, PhotonMVAEstimatorRun2Phys14NonTrig::AllVariables::varE2x2overE5x5, PhotonMVAEstimatorRun2Phys14NonTrig::AllVariables::varE2x5overE5x5, PhotonMVAEstimatorRun2Phys14NonTrig::AllVariables::varESEffSigmaRR, PhotonMVAEstimatorRun2Phys14NonTrig::AllVariables::varESEnOverRawE, PhotonMVAEstimatorRun2Phys14NonTrig::AllVariables::varEta, PhotonMVAEstimatorRun2Phys14NonTrig::AllVariables::varPhi, PhotonMVAEstimatorRun2Phys14NonTrig::AllVariables::varPhoIsoRaw, PhotonMVAEstimatorRun2Phys14NonTrig::AllVariables::varPt, PhotonMVAEstimatorRun2Phys14NonTrig::AllVariables::varR9, PhotonMVAEstimatorRun2Phys14NonTrig::AllVariables::varRawE, PhotonMVAEstimatorRun2Phys14NonTrig::AllVariables::varRho, PhotonMVAEstimatorRun2Phys14NonTrig::AllVariables::varSCEta, PhotonMVAEstimatorRun2Phys14NonTrig::AllVariables::varSCEtaWidth, PhotonMVAEstimatorRun2Phys14NonTrig::AllVariables::varSCPhiWidth, PhotonMVAEstimatorRun2Phys14NonTrig::AllVariables::varSieie, PhotonMVAEstimatorRun2Phys14NonTrig::AllVariables::varSieip, and PhotonMVAEstimatorRun2Phys14NonTrig::AllVariables::varWorstChRaw.

125  {
126 
127  int iCategory = findCategory( particle );
128  fillMVAVariables( particle );
130  float result = _tmvaReaders.at(iCategory)->EvaluateMVA(_MethodName);
131 
132  // DEBUG
133  const bool debug = false;
134  if( debug ){
135  printf("Printout of the photon variable inputs for MVA:\n");
136  printf(" varPhi_ %f\n", _allMVAVars.varPhi );
137  printf(" varR9_ %f\n", _allMVAVars.varR9 );
138  printf(" varSieie_ %f\n", _allMVAVars.varSieie );
139  printf(" varSieip_ %f\n", _allMVAVars.varSieip );
140  printf(" varE1x3overE5x5_ %f\n", _allMVAVars.varE1x3overE5x5);
141  printf(" varE2x2overE5x5_ %f\n", _allMVAVars.varE2x2overE5x5);
142  printf(" varE2x5overE5x5_ %f\n", _allMVAVars.varE2x5overE5x5);
143  printf(" varSCEta_ %f\n", _allMVAVars.varSCEta );
144  printf(" varRawE_ %f\n", _allMVAVars.varRawE );
145  printf(" varSCEtaWidth_ %f\n", _allMVAVars.varSCEtaWidth );
146  printf(" varSCPhiWidth_ %f\n", _allMVAVars.varSCPhiWidth );
147  printf(" varRho_ %f\n", _allMVAVars.varRho );
148  printf(" varPhoIsoRaw_ %f\n", _allMVAVars.varPhoIsoRaw );
149  printf(" varChIsoRaw_ %f\n", _allMVAVars.varChIsoRaw );
150  printf(" varWorstChRaw_ %f\n", _allMVAVars.varWorstChRaw );
151  printf(" varESEnOverRawE_ %f\n", _allMVAVars.varESEnOverRawE); // for endcap MVA only
152  printf(" varESEffSigmaRR_ %f\n", _allMVAVars.varESEffSigmaRR); // for endcap MVA only
153  // The spectators
154  printf(" varPt_ %f\n", _allMVAVars.varPt );
155  printf(" varEta_ %f\n", _allMVAVars.varEta );
156  }
157 
158  return result;
159 }
void fillMVAVariables(const edm::Ptr< reco::Candidate > &particle)
int findCategory(const edm::Ptr< reco::Candidate > &particle)
tuple result
Definition: query.py:137
#define debug
Definition: HDRShower.cc:19
std::vector< std::unique_ptr< TMVA::Reader > > _tmvaReaders
void PhotonMVAEstimatorRun2Phys14NonTrig::setConsumes ( edm::ConsumesCollector &&  cc)
overridevirtual

Reimplemented from AnyMVAEstimatorRun2Base.

Definition at line 44 of file PhotonMVAEstimatorRun2Phys14NonTrig.cc.

References AnyMVAEstimatorRun2Base::_conf, _esEffSigmaRRMapToken, _full5x5E1x3MapToken, _full5x5E2x2MapToken, _full5x5E2x5MaxMapToken, _full5x5E5x5MapToken, _full5x5SigmaIEtaIEtaMapToken, _full5x5SigmaIEtaIPhiMapToken, _phoChargedIsolationToken, _phoPhotonIsolationToken, _phoWorstChargedIsolationToken, _rhoToken, and edm::ParameterSet::getParameter().

44  {
45 
46  // All tokens for event content needed by this MVA
47  // Cluster shapes
49  (_conf.getParameter<edm::InputTag>("full5x5SigmaIEtaIEtaMap"));
50 
52  (_conf.getParameter<edm::InputTag>("full5x5SigmaIEtaIPhiMap"));
53 
55  (_conf.getParameter<edm::InputTag>("full5x5E1x3Map"));
56 
58  (_conf.getParameter<edm::InputTag>("full5x5E2x2Map"));
59 
61  (_conf.getParameter<edm::InputTag>("full5x5E2x5MaxMap"));
62 
64  (_conf.getParameter<edm::InputTag>("full5x5E5x5Map"));
65 
67  (_conf.getParameter<edm::InputTag>("esEffSigmaRRMap"));
68 
69  // Isolations
71  (_conf.getParameter<edm::InputTag>("phoChargedIsolation"));
72 
74  (_conf.getParameter<edm::InputTag>("phoPhotonIsolation"));
75 
77  (_conf.getParameter<edm::InputTag>("phoWorstChargedIsolation"));
78 
79  // Pileup
80  _rhoToken = cc.consumes<double> (_conf.getParameter<edm::InputTag>("rho"));
81 
82 }
edm::EDGetTokenT< edm::ValueMap< float > > _full5x5E5x5MapToken
const edm::ParameterSet _conf
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::ValueMap< float > > _phoChargedIsolationToken
edm::EDGetTokenT< edm::ValueMap< float > > _phoWorstChargedIsolationToken
edm::EDGetTokenT< edm::ValueMap< float > > _esEffSigmaRRMapToken
edm::EDGetTokenT< edm::ValueMap< float > > _full5x5SigmaIEtaIPhiMapToken
edm::EDGetTokenT< edm::ValueMap< float > > _full5x5SigmaIEtaIEtaMapToken
edm::EDGetTokenT< edm::ValueMap< float > > _full5x5E2x5MaxMapToken
edm::EDGetTokenT< edm::ValueMap< float > > _full5x5E1x3MapToken
edm::EDGetTokenT< edm::ValueMap< float > > _phoPhotonIsolationToken
edm::EDGetTokenT< edm::ValueMap< float > > _full5x5E2x2MapToken

Member Data Documentation

AllVariables PhotonMVAEstimatorRun2Phys14NonTrig::_allMVAVars
private
edm::Handle<edm::ValueMap<float> > PhotonMVAEstimatorRun2Phys14NonTrig::_esEffSigmaRRMap
private

Definition at line 132 of file PhotonMVAEstimatorRun2Phys14NonTrig.h.

Referenced by getEventContent().

edm::EDGetTokenT<edm::ValueMap<float> > PhotonMVAEstimatorRun2Phys14NonTrig::_esEffSigmaRRMapToken
private

Definition at line 117 of file PhotonMVAEstimatorRun2Phys14NonTrig.h.

Referenced by getEventContent(), and setConsumes().

edm::Handle<edm::ValueMap<float> > PhotonMVAEstimatorRun2Phys14NonTrig::_full5x5E1x3Map
private

Definition at line 128 of file PhotonMVAEstimatorRun2Phys14NonTrig.h.

Referenced by getEventContent().

edm::EDGetTokenT<edm::ValueMap<float> > PhotonMVAEstimatorRun2Phys14NonTrig::_full5x5E1x3MapToken
private

Definition at line 113 of file PhotonMVAEstimatorRun2Phys14NonTrig.h.

Referenced by getEventContent(), and setConsumes().

edm::Handle<edm::ValueMap<float> > PhotonMVAEstimatorRun2Phys14NonTrig::_full5x5E2x2Map
private

Definition at line 129 of file PhotonMVAEstimatorRun2Phys14NonTrig.h.

Referenced by getEventContent().

edm::EDGetTokenT<edm::ValueMap<float> > PhotonMVAEstimatorRun2Phys14NonTrig::_full5x5E2x2MapToken
private

Definition at line 114 of file PhotonMVAEstimatorRun2Phys14NonTrig.h.

Referenced by getEventContent(), and setConsumes().

edm::Handle<edm::ValueMap<float> > PhotonMVAEstimatorRun2Phys14NonTrig::_full5x5E2x5MaxMap
private

Definition at line 130 of file PhotonMVAEstimatorRun2Phys14NonTrig.h.

Referenced by getEventContent().

edm::EDGetTokenT<edm::ValueMap<float> > PhotonMVAEstimatorRun2Phys14NonTrig::_full5x5E2x5MaxMapToken
private

Definition at line 115 of file PhotonMVAEstimatorRun2Phys14NonTrig.h.

Referenced by getEventContent(), and setConsumes().

edm::Handle<edm::ValueMap<float> > PhotonMVAEstimatorRun2Phys14NonTrig::_full5x5E5x5Map
private

Definition at line 131 of file PhotonMVAEstimatorRun2Phys14NonTrig.h.

Referenced by getEventContent().

edm::EDGetTokenT<edm::ValueMap<float> > PhotonMVAEstimatorRun2Phys14NonTrig::_full5x5E5x5MapToken
private

Definition at line 116 of file PhotonMVAEstimatorRun2Phys14NonTrig.h.

Referenced by getEventContent(), and setConsumes().

edm::Handle<edm::ValueMap<float> > PhotonMVAEstimatorRun2Phys14NonTrig::_full5x5SigmaIEtaIEtaMap
private

Definition at line 126 of file PhotonMVAEstimatorRun2Phys14NonTrig.h.

Referenced by getEventContent().

edm::EDGetTokenT<edm::ValueMap<float> > PhotonMVAEstimatorRun2Phys14NonTrig::_full5x5SigmaIEtaIEtaMapToken
private

Definition at line 111 of file PhotonMVAEstimatorRun2Phys14NonTrig.h.

Referenced by getEventContent(), and setConsumes().

edm::Handle<edm::ValueMap<float> > PhotonMVAEstimatorRun2Phys14NonTrig::_full5x5SigmaIEtaIPhiMap
private

Definition at line 127 of file PhotonMVAEstimatorRun2Phys14NonTrig.h.

Referenced by getEventContent().

edm::EDGetTokenT<edm::ValueMap<float> > PhotonMVAEstimatorRun2Phys14NonTrig::_full5x5SigmaIEtaIPhiMapToken
private

Definition at line 112 of file PhotonMVAEstimatorRun2Phys14NonTrig.h.

Referenced by getEventContent(), and setConsumes().

std::string PhotonMVAEstimatorRun2Phys14NonTrig::_MethodName
private
edm::Handle<edm::ValueMap<float> > PhotonMVAEstimatorRun2Phys14NonTrig::_phoChargedIsolationMap
private

Definition at line 134 of file PhotonMVAEstimatorRun2Phys14NonTrig.h.

Referenced by getEventContent().

edm::EDGetTokenT<edm::ValueMap<float> > PhotonMVAEstimatorRun2Phys14NonTrig::_phoChargedIsolationToken
private

Definition at line 119 of file PhotonMVAEstimatorRun2Phys14NonTrig.h.

Referenced by getEventContent(), and setConsumes().

edm::Handle<edm::ValueMap<float> > PhotonMVAEstimatorRun2Phys14NonTrig::_phoPhotonIsolationMap
private

Definition at line 135 of file PhotonMVAEstimatorRun2Phys14NonTrig.h.

Referenced by getEventContent().

edm::EDGetTokenT<edm::ValueMap<float> > PhotonMVAEstimatorRun2Phys14NonTrig::_phoPhotonIsolationToken
private

Definition at line 120 of file PhotonMVAEstimatorRun2Phys14NonTrig.h.

Referenced by getEventContent(), and setConsumes().

edm::Handle<edm::ValueMap<float> > PhotonMVAEstimatorRun2Phys14NonTrig::_phoWorstChargedIsolationMap
private

Definition at line 136 of file PhotonMVAEstimatorRun2Phys14NonTrig.h.

Referenced by getEventContent().

edm::EDGetTokenT<edm::ValueMap<float> > PhotonMVAEstimatorRun2Phys14NonTrig::_phoWorstChargedIsolationToken
private

Definition at line 121 of file PhotonMVAEstimatorRun2Phys14NonTrig.h.

Referenced by getEventContent(), and setConsumes().

edm::Handle<double> PhotonMVAEstimatorRun2Phys14NonTrig::_rho
private

Definition at line 140 of file PhotonMVAEstimatorRun2Phys14NonTrig.h.

Referenced by fillMVAVariables(), and getEventContent().

edm::EDGetTokenT<double> PhotonMVAEstimatorRun2Phys14NonTrig::_rhoToken
private

Definition at line 139 of file PhotonMVAEstimatorRun2Phys14NonTrig.h.

Referenced by getEventContent(), and setConsumes().

std::vector< std::unique_ptr<TMVA::Reader> > PhotonMVAEstimatorRun2Phys14NonTrig::_tmvaReaders
private
const std::string PhotonMVAEstimatorRun2Phys14NonTrig::name_ = "PhotonMVAEstimatorRun2Phys14NonTrig"
private

Definition at line 95 of file PhotonMVAEstimatorRun2Phys14NonTrig.h.

Referenced by getName().

const int PhotonMVAEstimatorRun2Phys14NonTrig::nCategories = 2