CMS 3D CMS Logo

ElectronIDAnalyzer.cc
Go to the documentation of this file.
8 
10 public:
11  explicit ElectronIDAnalyzer(const edm::ParameterSet& conf);
12  ~ElectronIDAnalyzer() override{};
13 
14  void analyze(const edm::Event& e, const edm::EventSetup& c) override;
15 
16 private:
18 
20 
25 };
26 
29 
31  electronProducer_ = conf.getParameter<std::string>("electronProducer");
32  electronLabelRobustLoose_ = conf.getParameter<std::string>("electronLabelRobustLoose");
33  electronLabelRobustTight_ = conf.getParameter<std::string>("electronLabelRobustTight");
34  electronLabelLoose_ = conf.getParameter<std::string>("electronLabelLoose");
35  electronLabelTight_ = conf.getParameter<std::string>("electronLabelTight");
36 }
37 
39  //Read selectrons
41  e.getByLabel(electronProducer_, electrons);
42 
43  //Read eID results
44  std::vector<edm::Handle<edm::ValueMap<float> > > eIDValueMap(4);
45  //Robust-Loose
46  e.getByLabel(electronLabelRobustLoose_, eIDValueMap[0]);
47  const edm::ValueMap<float>& eIDmapRL = *eIDValueMap[0];
48  //Robust-Tight
49  e.getByLabel(electronLabelRobustTight_, eIDValueMap[1]);
50  const edm::ValueMap<float>& eIDmapRT = *eIDValueMap[1];
51  //Loose
52  e.getByLabel(electronLabelLoose_, eIDValueMap[2]);
53  const edm::ValueMap<float>& eIDmapL = *eIDValueMap[2];
54  //Tight
55  e.getByLabel(electronLabelTight_, eIDValueMap[3]);
56  const edm::ValueMap<float>& eIDmapT = *eIDValueMap[3];
57 
58  // Loop over electrons
59  for (unsigned int i = 0; i < electrons->size(); i++) {
61  std::cout << "Event " << e.id() << " , electron " << i + 1 << " , Robust Loose = " << eIDmapRL[electronRef]
62  << " , Robust Tight = " << eIDmapRT[electronRef] << " , Loose = " << eIDmapL[electronRef]
63  << " , Tight = " << eIDmapT[electronRef] << std::endl;
64  }
65 }
std::string electronLabelRobustTight_
std::string electronLabelTight_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
~ElectronIDAnalyzer() override
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
std::string electronLabelLoose_
ElectronIDAnalyzer(const edm::ParameterSet &conf)
std::string electronProducer_
std::string electronLabelRobustLoose_
void analyze(const edm::Event &e, const edm::EventSetup &c) override
edm::ParameterSet conf_