Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:25:07

0001 #include "RecoEgamma/ElectronIdentification/plugins/ElectronIDSelectorCutBased.h"
0002 
0003 ElectronIDSelectorCutBased::ElectronIDSelectorCutBased(const edm::ParameterSet& conf, edm::ConsumesCollector& iC)
0004     : conf_(conf) {
0005   std::string algorithm_ = conf.getParameter<std::string>("algorithm");
0006 
0007   if (algorithm_ == "eIDClassBased")
0008     electronIDAlgo_ = new ClassBasedElectronID();
0009   else if (algorithm_ == "eIDCBClasses")
0010     electronIDAlgo_ = new PTDRElectronID();
0011   else if (algorithm_ == "eIDCB")
0012     electronIDAlgo_ = new CutBasedElectronID(conf, iC);
0013   else {
0014     throw cms::Exception("Configuration")
0015         << "Invalid algorithm parameter in ElectronIDSelectorCutBased: must be eIDCBClasses or eIDCB.";
0016   }
0017 }
0018 
0019 ElectronIDSelectorCutBased::~ElectronIDSelectorCutBased() { delete electronIDAlgo_; }
0020 
0021 void ElectronIDSelectorCutBased::newEvent(const edm::Event& e, const edm::EventSetup& es) {
0022   electronIDAlgo_->setup(conf_);
0023 }
0024 
0025 double ElectronIDSelectorCutBased::operator()(const reco::GsfElectron& ele,
0026                                               const edm::Event& e,
0027                                               const edm::EventSetup& es) {
0028   return electronIDAlgo_->result(&(ele), e, es);
0029 }