CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/RecoEgamma/ElectronIdentification/plugins/ElectronIDSelectorCutBased.cc

Go to the documentation of this file.
00001 #include "RecoEgamma/ElectronIdentification/plugins/ElectronIDSelectorCutBased.h"
00002 
00003 ElectronIDSelectorCutBased::ElectronIDSelectorCutBased (const edm::ParameterSet& conf) : conf_ (conf) 
00004 {
00005   std::string algorithm_ = conf.getParameter<std::string> ("algorithm") ;
00006   
00007   if ( algorithm_ == "eIDClassBased" )
00008      electronIDAlgo_ = new ClassBasedElectronID ();
00009   else if ( algorithm_ == "eIDCBClasses" )
00010      electronIDAlgo_ = new PTDRElectronID ();
00011   else if ( algorithm_ == "eIDCB" )
00012      electronIDAlgo_ = new CutBasedElectronID ();
00013   else { 
00014     throw cms::Exception("Configuration")
00015       << "Invalid algorithm parameter in ElectronIDSelectorCutBased: must be eIDCBClasses or eIDCB." ;
00016   }
00017 }
00018 
00019 ElectronIDSelectorCutBased::~ElectronIDSelectorCutBased () 
00020 {
00021   delete electronIDAlgo_ ;
00022 }
00023 
00024 void ElectronIDSelectorCutBased::newEvent (const edm::Event& e, const edm::EventSetup& es)
00025 {
00026   electronIDAlgo_->setup (conf_);
00027 }
00028 
00029 double ElectronIDSelectorCutBased::operator () (const reco::GsfElectron & ele, const edm::Event& e, const edm::EventSetup& es) 
00030 {
00031   return electronIDAlgo_->result (& (ele), e, es) ;
00032 }