CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ElectronIDAnalyzer.cc
Go to the documentation of this file.
5 
7  electronProducer_=conf.getParameter<std::string>("electronProducer") ;
8  electronLabelRobustLoose_=conf.getParameter<std::string>("electronLabelRobustLoose") ;
9  electronLabelRobustTight_=conf.getParameter<std::string>("electronLabelRobustTight") ;
10  electronLabelLoose_=conf.getParameter<std::string>("electronLabelLoose") ;
11  electronLabelTight_=conf.getParameter<std::string>("electronLabelTight") ;
12 }
13 
15 
16  //Read selectrons
18  e.getByLabel(electronProducer_,electrons) ;
19 
20  //Read eID results
21  std::vector<edm::Handle<edm::ValueMap<float> > > eIDValueMap(4);
22  //Robust-Loose
23  e.getByLabel( electronLabelRobustLoose_ , eIDValueMap[0] );
24  const edm::ValueMap<float> & eIDmapRL = * eIDValueMap[0] ;
25  //Robust-Tight
26  e.getByLabel( electronLabelRobustTight_ , eIDValueMap[1] );
27  const edm::ValueMap<float> & eIDmapRT = * eIDValueMap[1] ;
28  //Loose
29  e.getByLabel( electronLabelLoose_ , eIDValueMap[2] );
30  const edm::ValueMap<float> & eIDmapL = * eIDValueMap[2] ;
31  //Tight
32  e.getByLabel( electronLabelTight_ , eIDValueMap[3] );
33  const edm::ValueMap<float> & eIDmapT = * eIDValueMap[3] ;
34 
35  // Loop over electrons
36  for (unsigned int i = 0; i < electrons->size(); i++){
37  edm::Ref<reco::GsfElectronCollection> electronRef(electrons,i);
38  std::cout << "Event " << e.id()
39  << " , electron " << i+1
40  << " , Robust Loose = " << eIDmapRL[electronRef]
41  << " , Robust Tight = " << eIDmapRT[electronRef]
42  << " , Loose = " << eIDmapL[electronRef]
43  << " , Tight = " << eIDmapT[electronRef]
44  << std::endl;
45  }
46 
47 }
std::string electronLabelRobustTight_
std::string electronLabelTight_
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
std::string electronLabelLoose_
ElectronIDAnalyzer(const edm::ParameterSet &conf)
std::string electronProducer_
virtual void analyze(const edm::Event &e, const edm::EventSetup &c)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:420
tuple conf
Definition: dbtoconf.py:185
edm::EventID id() const
Definition: EventBase.h:60
tuple cout
Definition: gather_cfg.py:121
std::string electronLabelRobustLoose_