CMS 3D CMS Logo

GsfElectronDataAnalyzer.cc
Go to the documentation of this file.
1 
2 // -*- C++ -*-
3 //
4 // Package: RecoEgamma/Examples
5 // Class: GsfElectronDataAnalyzer
6 //
14 //
15 // Original Author: Ursula Berthon
16 // Created: Mon Mar 27 13:22:06 CEST 2006
17 //
18 //
19 
20 // user include files
22 
29 
41 
42 #include "CLHEP/Units/GlobalPhysicalConstants.h"
43 #include <iostream>
44 #include "TMath.h"
45 #include "TFile.h"
46 #include "TH1F.h"
47 #include "TH1I.h"
48 #include "TH2F.h"
49 #include "TProfile.h"
50 #include "TTree.h"
51 #include <iostream>
52 
53 using namespace reco;
54 
56  : beamSpot_(conf.getParameter<edm::InputTag>("beamSpot")) {
57  outputFile_ = conf.getParameter<std::string>("outputFile");
58  histfile_ = new TFile(outputFile_.c_str(), "RECREATE");
59  electronCollection_ = conf.getParameter<edm::InputTag>("electronCollection");
60  readAOD_ = conf.getParameter<bool>("readAOD");
61 
62  matchingObjectCollection_ = conf.getParameter<edm::InputTag>("matchingObjectCollection");
63  matchingCondition_ = conf.getParameter<std::string>("matchingCondition");
64  // currently only one possible matching conditions
65  assert(matchingCondition_ == "Cone");
66  maxPtMatchingObject_ = conf.getParameter<double>("MaxPtMatchingObject");
67  maxAbsEtaMatchingObject_ = conf.getParameter<double>("MaxAbsEtaMatchingObject");
68  deltaR_ = conf.getParameter<double>("DeltaR");
69 
70  triggerResults_ = conf.getParameter<edm::InputTag>("triggerResults");
71  HLTPathsByName_ = conf.getParameter<std::vector<std::string> >("hltPaths");
72  HLTPathsByIndex_.resize(HLTPathsByName_.size());
73 
74  minEt_ = conf.getParameter<double>("MinEt");
75  minPt_ = conf.getParameter<double>("MinPt");
76  maxAbsEta_ = conf.getParameter<double>("MaxAbsEta");
77  isEB_ = conf.getParameter<bool>("SelectEB");
78  isEE_ = conf.getParameter<bool>("SelectEE");
79  isNotEBEEGap_ = conf.getParameter<bool>("SelectNotEBEEGap");
80  isEcalDriven_ = conf.getParameter<bool>("SelectEcalDriven");
81  isTrackerDriven_ = conf.getParameter<bool>("SelectTrackerDriven");
82  eOverPMinBarrel_ = conf.getParameter<double>("MinEOverPBarrel");
83  eOverPMaxBarrel_ = conf.getParameter<double>("MaxEOverPBarrel");
84  eOverPMinEndcaps_ = conf.getParameter<double>("MinEOverPEndcaps");
85  eOverPMaxEndcaps_ = conf.getParameter<double>("MaxEOverPEndcaps");
86  dEtaMinBarrel_ = conf.getParameter<double>("MinDetaBarrel");
87  dEtaMaxBarrel_ = conf.getParameter<double>("MaxDetaBarrel");
88  dEtaMinEndcaps_ = conf.getParameter<double>("MinDetaEndcaps");
89  dEtaMaxEndcaps_ = conf.getParameter<double>("MaxDetaEndcaps");
90  dPhiMinBarrel_ = conf.getParameter<double>("MinDphiBarrel");
91  dPhiMaxBarrel_ = conf.getParameter<double>("MaxDphiBarrel");
92  dPhiMinEndcaps_ = conf.getParameter<double>("MinDphiEndcaps");
93  dPhiMaxEndcaps_ = conf.getParameter<double>("MaxDphiEndcaps");
94  sigIetaIetaMinBarrel_ = conf.getParameter<double>("MinSigIetaIetaBarrel");
95  sigIetaIetaMaxBarrel_ = conf.getParameter<double>("MaxSigIetaIetaBarrel");
96  sigIetaIetaMinEndcaps_ = conf.getParameter<double>("MinSigIetaIetaEndcaps");
97  sigIetaIetaMaxEndcaps_ = conf.getParameter<double>("MaxSigIetaIetaEndcaps");
98  hadronicOverEmMaxBarrel_ = conf.getParameter<double>("MaxHoEBarrel");
99  hadronicOverEmMaxEndcaps_ = conf.getParameter<double>("MaxHoEEndcaps");
100  mvaMin_ = conf.getParameter<double>("MinMVA");
101  tipMaxBarrel_ = conf.getParameter<double>("MaxTipBarrel");
102  tipMaxEndcaps_ = conf.getParameter<double>("MaxTipEndcaps");
103  tkIso03Max_ = conf.getParameter<double>("MaxTkIso03");
104  hcalIso03Depth1MaxBarrel_ = conf.getParameter<double>("MaxHcalIso03Depth1Barrel");
105  hcalIso03Depth1MaxEndcaps_ = conf.getParameter<double>("MaxHcalIso03Depth1Endcaps");
106  hcalIso03Depth2MaxEndcaps_ = conf.getParameter<double>("MaxHcalIso03Depth2Endcaps");
107  ecalIso03MaxBarrel_ = conf.getParameter<double>("MaxEcalIso03Barrel");
108  ecalIso03MaxEndcaps_ = conf.getParameter<double>("MaxEcalIso03Endcaps");
109 
110  edm::ParameterSet pset = conf.getParameter<edm::ParameterSet>("HistosConfigurationData");
111 
112  etamin = pset.getParameter<double>("Etamin");
113  etamax = pset.getParameter<double>("Etamax");
114  phimin = pset.getParameter<double>("Phimin");
115  phimax = pset.getParameter<double>("Phimax");
116  ptmax = pset.getParameter<double>("Ptmax");
117  pmax = pset.getParameter<double>("Pmax");
118  eopmax = pset.getParameter<double>("Eopmax");
119  eopmaxsht = pset.getParameter<double>("Eopmaxsht");
120  detamin = pset.getParameter<double>("Detamin");
121  detamax = pset.getParameter<double>("Detamax");
122  dphimin = pset.getParameter<double>("Dphimin");
123  dphimax = pset.getParameter<double>("Dphimax");
124  detamatchmin = pset.getParameter<double>("Detamatchmin");
125  detamatchmax = pset.getParameter<double>("Detamatchmax");
126  dphimatchmin = pset.getParameter<double>("Dphimatchmin");
127  dphimatchmax = pset.getParameter<double>("Dphimatchmax");
128  fhitsmax = pset.getParameter<double>("Fhitsmax");
129  lhitsmax = pset.getParameter<double>("Lhitsmax");
130  nbineta = pset.getParameter<int>("Nbineta");
131  nbineta2D = pset.getParameter<int>("Nbineta2D");
132  nbinp = pset.getParameter<int>("Nbinp");
133  nbinpt = pset.getParameter<int>("Nbinpt");
134  nbinp2D = pset.getParameter<int>("Nbinp2D");
135  nbinpt2D = pset.getParameter<int>("Nbinpt2D");
136  nbinpteff = pset.getParameter<int>("Nbinpteff");
137  nbinphi = pset.getParameter<int>("Nbinphi");
138  nbinphi2D = pset.getParameter<int>("Nbinphi2D");
139  nbineop = pset.getParameter<int>("Nbineop");
140  nbineop2D = pset.getParameter<int>("Nbineop2D");
141  nbinfhits = pset.getParameter<int>("Nbinfhits");
142  nbinlhits = pset.getParameter<int>("Nbinlhits");
143  nbinxyz = pset.getParameter<int>("Nbinxyz");
144  nbindeta = pset.getParameter<int>("Nbindeta");
145  nbindphi = pset.getParameter<int>("Nbindphi");
146  nbindetamatch = pset.getParameter<int>("Nbindetamatch");
147  nbindphimatch = pset.getParameter<int>("Nbindphimatch");
148  nbindetamatch2D = pset.getParameter<int>("Nbindetamatch2D");
149  nbindphimatch2D = pset.getParameter<int>("Nbindphimatch2D");
150  nbinpoptrue = pset.getParameter<int>("Nbinpoptrue");
151  poptruemin = pset.getParameter<double>("Poptruemin");
152  poptruemax = pset.getParameter<double>("Poptruemax");
153  nbinmee = pset.getParameter<int>("Nbinmee");
154  meemin = pset.getParameter<double>("Meemin");
155  meemax = pset.getParameter<double>("Meemax");
156  nbinhoe = pset.getParameter<int>("Nbinhoe");
157  hoemin = pset.getParameter<double>("Hoemin");
158  hoemax = pset.getParameter<double>("Hoemax");
159 }
160 
162  // do anything here that needs to be done at desctruction time
163  // (e.g. close files, deallocate resources etc.)
164  histfile_->Write();
165  histfile_->Close();
166 }
167 
169  histfile_->cd();
170 
171  nEvents_ = 0;
172  nAfterTrigger_ = 0;
173 
174  // matching object
175  std::string::size_type locSC = matchingObjectCollection_.label().find("SuperCluster", 0);
177  if (locSC != std::string::npos) {
178  std::cout << "Matching objects are SuperClusters " << std::endl;
179  type_ = "SC";
180  } else {
181  std::cout << "Didn't recognize input matching objects!! " << std::endl;
182  }
183 
184  std::string htitle, hlabel;
185  hlabel = "h_" + type_ + "Num";
186  htitle = "# " + type_ + "s";
187  h_matchingObjectNum = new TH1F(hlabel.c_str(), htitle.c_str(), nbinfhits, 0., fhitsmax);
188 
189  // rec event
190 
191  histNum_ = new TH1F("h_recEleNum", "# rec electrons", 20, 0., 20.);
192 
193  // matching object distributions
194  hlabel = "h_" + type_ + "_eta";
195  htitle = type_ + " #eta";
196  h_matchingObjectEta = new TH1F(hlabel.c_str(), htitle.c_str(), nbineta, etamin, etamax);
197  hlabel = "h_" + type_ + "_abseta";
198  htitle = type_ + " |#eta|";
199  h_matchingObjectAbsEta = new TH1F(hlabel.c_str(), htitle.c_str(), nbineta / 2, 0., etamax);
200  hlabel = "h_" + type_ + "_P";
201  htitle = type_ + " p";
202  h_matchingObjectP = new TH1F(hlabel.c_str(), htitle.c_str(), nbinp, 0., pmax);
203  hlabel = "h_" + type_ + "_Pt";
204  htitle = type_ + " pt";
205  h_matchingObjectPt = new TH1F(hlabel.c_str(), htitle.c_str(), nbinpteff, 5., ptmax);
206  hlabel = "h_" + type_ + "_phi";
207  htitle = type_ + " phi";
208  h_matchingObjectPhi = new TH1F(hlabel.c_str(), htitle.c_str(), nbinphi, phimin, phimax);
209  hlabel = "h_" + type_ + "_z";
210  htitle = type_ + " z";
211  h_matchingObjectZ = new TH1F(hlabel.c_str(), htitle.c_str(), nbinxyz, -25, 25);
212 
213  // mee
214  h_ele_mee_all =
215  new TH1F("h_ele_mee_all", "ele pairs invariant mass, all charge combinations", nbinmee, meemin, meemax);
216  h_ele_mee_os = new TH1F("h_ele_mee_os", "ele pairs invariant mass, opposite sign", nbinmee, meemin, meemax);
218  new TH1F("h_ele_mee_os_ebeb", "ele pairs invariant mass, opp. sign, EB-EB", nbinmee, meemin, meemax);
219  h_ele_mee_os_ebeb->Sumw2();
221  new TH1F("h_ele_mee_os_ebee", "ele pairs invariant mass, opp. sign, EB-EE", nbinmee, meemin, meemax);
222  h_ele_mee_os_ebee->Sumw2();
224  new TH1F("h_ele_mee_os_eeee", "ele pairs invariant mass, opp. sign, EE-EE", nbinmee, meemin, meemax);
225  h_ele_mee_os_eeee->Sumw2();
227  new TH1F("h_ele_mee_os_gg", "ele pairs invariant mass, opp. sign, good-good", nbinmee, meemin, meemax);
228  h_ele_mee_os_gg->Sumw2();
230  new TH1F("h_ele_mee_os_gb", "ele pairs invariant mass, opp. sign, good-bad", nbinmee, meemin, meemax);
231  h_ele_mee_os_gb->Sumw2();
233  new TH1F("h_ele_mee_os_bb", "ele pairs invariant mass, opp. sign, bad-bad", nbinmee, meemin, meemax);
234  h_ele_mee_os_bb->Sumw2();
235 
236  // duplicates
237  h_ele_E2mnE1vsMee_all = new TH2F("h_ele_E2mnE1vsMee_all",
238  "E2 - E1 vs ele pairs invariant mass, all electrons",
239  nbinmee,
240  meemin,
241  meemax,
242  100,
243  -50.,
244  50.);
245  h_ele_E2mnE1vsMee_egeg_all = new TH2F("h_ele_E2mnE1vsMee_egeg_all",
246  "E2 - E1 vs ele pairs invariant mass, ecal driven pairs, all electrons",
247  nbinmee,
248  meemin,
249  meemax,
250  100,
251  -50.,
252  50.);
253 
254  // recoed and matched electrons
255  h_ele_charge = new TH1F("h_ele_charge", "ele charge", 5, -2., 2.);
256  h_ele_chargeVsEta = new TH2F("h_ele_chargeVsEta", "ele charge vs eta", nbineta2D, etamin, etamax, 5, -2., 2.);
257  h_ele_chargeVsPhi = new TH2F("h_ele_chargeVsPhi", "ele charge vs phi", nbinphi2D, phimin, phimax, 5, -2., 2.);
258  h_ele_chargeVsPt = new TH2F("h_ele_chargeVsPt", "ele charge vs pt", nbinpt, 0., 100., 5, -2., 2.);
259  h_ele_vertexP = new TH1F("h_ele_vertexP", "ele momentum", nbinp, 0., pmax);
260  h_ele_vertexPt = new TH1F("h_ele_vertexPt", "ele transverse momentum", nbinpt, 0., ptmax);
261  h_ele_Et = new TH1F("h_ele_Et", "ele SC transverse energy", nbinpt, 0., ptmax);
263  new TH2F("h_ele_vertexPtVsEta", "ele transverse momentum vs eta", nbineta2D, etamin, etamax, nbinpt2D, 0., ptmax);
265  new TH2F("h_ele_vertexPtVsPhi", "ele transverse momentum vs phi", nbinphi2D, phimin, phimax, nbinpt2D, 0., ptmax);
267  new TH1F("h_ele_matchingObjectPt_matched", "Efficiency vs matching SC E_{T}", nbinpteff, 5., ptmax);
269  h_ele_vertexEta = new TH1F("h_ele_vertexEta", "ele momentum eta", nbineta, etamin, etamax);
271  new TH2F("h_ele_vertexEtaVsPhi", "ele momentum eta vs phi", nbineta2D, etamin, etamax, nbinphi2D, phimin, phimax);
273  new TH1F("h_ele_matchingObjectAbsEta_matched", "Efficiency vs matching SC |#eta|", nbineta / 2, 0., 2.5);
276  new TH1F("h_ele_matchingObjectEta_matched", "Efficiency vs matching SC #eta", nbineta, etamin, etamax);
279  new TH1F("h_ele_matchingObjectPhi_matched", "Efficiency vs matching SC phi", nbinphi, phimin, phimax);
281  h_ele_vertexPhi = new TH1F("h_ele_vertexPhi", "ele momentum #phi", nbinphi, phimin, phimax);
282  h_ele_vertexX = new TH1F("h_ele_vertexX", "ele vertex x", nbinxyz, -0.1, 0.1);
283  h_ele_vertexY = new TH1F("h_ele_vertexY", "ele vertex y", nbinxyz, -0.1, 0.1);
284  h_ele_vertexZ = new TH1F("h_ele_vertexZ", "ele vertex z", nbinxyz, -25, 25);
286  new TH1F("h_ele_matchingObjectZ_matched", "Efficiency vs matching SC z", nbinxyz, -25, 25);
288  h_ele_vertexTIP = new TH1F("h_ele_vertexTIP", "ele transverse impact parameter (wrt bs)", 90, 0., 0.15);
289  h_ele_vertexTIPVsEta = new TH2F("h_ele_vertexTIPVsEta",
290  "ele transverse impact parameter (wrt bs) vs eta",
291  nbineta2D,
292  etamin,
293  etamax,
294  45,
295  0.,
296  0.15);
297  h_ele_vertexTIPVsPhi = new TH2F("h_ele_vertexTIPVsPhi",
298  "ele transverse impact parameter (wrt bs) vs phi",
299  nbinphi2D,
300  phimin,
301  phimax,
302  45,
303  0.,
304  0.15);
305  h_ele_vertexTIPVsPt = new TH2F("h_ele_vertexTIPVsPt",
306  "ele transverse impact parameter (wrt bs) vs transverse momentum",
307  nbinpt2D,
308  0.,
309  ptmax,
310  45,
311  0.,
312  0.15);
314  "h_ele_PoPmatchingObject_matched", "ele momentum / matching SC energy", nbinpoptrue, poptruemin, poptruemax);
315  h_ele_PtoPtmatchingObject_matched = new TH1F("h_ele_PtoPtmatchingObject_matched",
316  "ele trans momentum / matching SC trans energy",
317  nbinpoptrue,
318  poptruemin,
319  poptruemax);
320  h_ele_PoPmatchingObjectVsEta_matched = new TH2F("h_ele_PoPmatchingObjectVsEta_matched",
321  "ele momentum / matching SC energy vs eta",
322  nbineta2D,
323  etamin,
324  etamax,
325  50,
326  poptruemin,
327  poptruemax);
328  h_ele_PoPmatchingObjectVsPhi_matched = new TH2F("h_ele_PoPmatchingObjectVsPhi_matched",
329  "ele momentum / matching SC energy vs phi",
330  nbinphi2D,
331  phimin,
332  phimax,
333  50,
334  poptruemin,
335  poptruemax);
336  h_ele_PoPmatchingObjectVsPt_matched = new TH2F("h_ele_PoPmatchingObjectVsPt_matched",
337  "ele momentum / matching SC energy vs eta",
338  nbinpt2D,
339  0.,
340  ptmax,
341  50,
342  poptruemin,
343  poptruemax);
344  h_ele_PoPmatchingObject_barrel_matched = new TH1F("h_ele_PoPmatchingObject_barrel_matched",
345  "ele momentum / matching SC energy, barrel",
346  nbinpoptrue,
347  poptruemin,
348  poptruemax);
349  h_ele_PoPmatchingObject_endcaps_matched = new TH1F("h_ele_PoPmatchingObject_endcaps_matched",
350  "ele momentum / matching SC energy, endcaps",
351  nbinpoptrue,
352  poptruemin,
353  poptruemax);
354  h_ele_PtoPtmatchingObject_barrel_matched = new TH1F("h_ele_PtoPmatchingObject_barrel_matched",
355  "ele trans momentum / matching SC trans energy, barrel",
356  nbinpoptrue,
357  poptruemin,
358  poptruemax);
359  h_ele_PtoPtmatchingObject_endcaps_matched = new TH1F("h_ele_PtoPmatchingObject_endcaps_matched",
360  "ele trans momentum / matching SC trans energy, endcaps",
361  nbinpoptrue,
362  poptruemin,
363  poptruemax);
365  "h_ele_EtaMnEtamatchingObject_matched", "ele momentum eta - matching SC eta", nbindeta, detamin, detamax);
366  h_ele_EtaMnEtamatchingObjectVsEta_matched = new TH2F("h_ele_EtaMnEtamatchingObjectVsEta_matched",
367  "ele momentum eta - matching SC eta vs eta",
368  nbineta2D,
369  etamin,
370  etamax,
371  nbindeta / 2,
372  detamin,
373  detamax);
374  h_ele_EtaMnEtamatchingObjectVsPhi_matched = new TH2F("h_ele_EtaMnEtamatchingObjectVsPhi_matched",
375  "ele momentum eta - matching SC eta vs phi",
376  nbinphi2D,
377  phimin,
378  phimax,
379  nbindeta / 2,
380  detamin,
381  detamax);
382  h_ele_EtaMnEtamatchingObjectVsPt_matched = new TH2F("h_ele_EtaMnEtamatchingObjectVsPt_matched",
383  "ele momentum eta - matching SC eta vs pt",
384  nbinpt,
385  0.,
386  ptmax,
387  nbindeta / 2,
388  detamin,
389  detamax);
391  "h_ele_PhiMnPhimatchingObject_matched", "ele momentum phi - matching SC phi", nbindphi, dphimin, dphimax);
392  h_ele_PhiMnPhimatchingObject2_matched = new TH1F("h_ele_PhiMnPhimatchingObject2_matched",
393  "ele momentum phi - matching SC phi",
395  dphimatchmin,
396  dphimatchmax);
397  h_ele_PhiMnPhimatchingObjectVsEta_matched = new TH2F("h_ele_PhiMnPhimatchingObjectVsEta_matched",
398  "ele momentum phi - matching SC phi vs eta",
399  nbineta2D,
400  etamin,
401  etamax,
402  nbindphi / 2,
403  dphimin,
404  dphimax);
405  h_ele_PhiMnPhimatchingObjectVsPhi_matched = new TH2F("h_ele_PhiMnPhimatchingObjectVsPhi_matched",
406  "ele momentum phi - matching SC phi vs phi",
407  nbinphi2D,
408  phimin,
409  phimax,
410  nbindphi / 2,
411  dphimin,
412  dphimax);
413  h_ele_PhiMnPhimatchingObjectVsPt_matched = new TH2F("h_ele_PhiMnPhimatchingObjectVsPt_matched",
414  "ele momentum phi - matching SC phi vs pt",
415  nbinpt2D,
416  0.,
417  ptmax,
418  nbindphi / 2,
419  dphimin,
420  dphimax);
421 
422  // matched electron, superclusters
423  histSclEn_ = new TH1F("h_scl_energy", "ele supercluster energy", nbinp, 0., pmax);
425  "h_scl_EoEmatchingObject_barrel_matched", "ele supercluster energy / matching SC energy, barrel", 50, 0.2, 1.2);
427  "h_scl_EoEmatchingObject_endcaps_matched", "ele supercluster energy / matching SC energy, endcaps", 50, 0.2, 1.2);
428  histSclEoEmatchingObject_barrel_new_matched = new TH1F("h_scl_EoEmatchingObject_barrel_new_matched",
429  "ele supercluster energy / matching SC energy, barrel",
430  nbinpoptrue,
431  poptruemin,
432  poptruemax);
433  histSclEoEmatchingObject_endcaps_new_matched = new TH1F("h_scl_EoEmatchingObject_endcaps_new_matched",
434  "ele supercluster energy / matching SC energy, endcaps",
435  nbinpoptrue,
436  poptruemin,
437  poptruemax);
438  histSclEt_ = new TH1F("h_scl_et", "ele supercluster transverse energy", nbinpt, 0., ptmax);
439  histSclEtVsEta_ = new TH2F(
440  "h_scl_etVsEta", "ele supercluster transverse energy vs eta", nbineta2D, etamin, etamax, nbinpt, 0., ptmax);
441  histSclEtVsPhi_ = new TH2F(
442  "h_scl_etVsPhi", "ele supercluster transverse energy vs phi", nbinphi2D, phimin, phimax, nbinpt, 0., ptmax);
444  new TH2F("h_scl_etaVsPhi", "ele supercluster eta vs phi", nbinphi2D, phimin, phimax, nbineta2D, etamin, etamax);
445  histSclEta_ = new TH1F("h_scl_eta", "ele supercluster eta", nbineta, etamin, etamax);
446  histSclPhi_ = new TH1F("h_scl_phi", "ele supercluster phi", nbinphi, phimin, phimax);
447 
448  histSclSigEtaEta_ = new TH1F("h_scl_sigetaeta", "ele supercluster sigma eta eta", 100, 0., 0.05);
450  new TH1F("h_scl_sigietaieta_barrel", "ele supercluster sigma ieta ieta, barrel", 100, 0., 0.05);
452  new TH1F("h_scl_sigietaieta_endcaps", "ele supercluster sigma ieta ieta, endcaps", 100, 0., 0.05);
453  histSclE1x5_ = new TH1F("h_scl_E1x5", "ele supercluster energy in 1x5", nbinp, 0., pmax);
454  histSclE1x5_barrel_ = new TH1F("h_scl_E1x_barrel5", "ele supercluster energy in 1x5 barrel", nbinp, 0., pmax);
455  histSclE1x5_endcaps_ = new TH1F("h_scl_E1x5_endcaps", "ele supercluster energy in 1x5 endcaps", nbinp, 0., pmax);
456  histSclE2x5max_ = new TH1F("h_scl_E2x5max", "ele supercluster energy in 2x5 max", nbinp, 0., pmax);
458  new TH1F("h_scl_E2x5max_barrel", "ele supercluster energy in 2x5 max barrel", nbinp, 0., pmax);
460  new TH1F("h_scl_E2x5max_endcaps", "ele supercluster energy in 2x5 max endcaps", nbinp, 0., pmax);
461  histSclE5x5_ = new TH1F("h_scl_E5x5", "ele supercluster energy in 5x5", nbinp, 0., pmax);
462  histSclE5x5_barrel_ = new TH1F("h_scl_E5x5_barrel", "ele supercluster energy in 5x5 barrel", nbinp, 0., pmax);
463  histSclE5x5_endcaps_ = new TH1F("h_scl_E5x5_endcaps", "ele supercluster energy in 5x5 endcaps", nbinp, 0., pmax);
464 
465  // matched electron, gsf tracks
466  h_ele_ambiguousTracks = new TH1F("h_ele_ambiguousTracks", "ele # ambiguous tracks", 5, 0., 5.);
468  new TH2F("h_ele_ambiguousTracksVsEta", "ele # ambiguous tracks vs eta", nbineta2D, etamin, etamax, 5, 0., 5.);
470  new TH2F("h_ele_ambiguousTracksVsPhi", "ele # ambiguous tracks vs phi", nbinphi2D, phimin, phimax, 5, 0., 5.);
472  new TH2F("h_ele_ambiguousTracksVsPt", "ele # ambiguous tracks vs pt", nbinpt2D, 0., ptmax, 5, 0., 5.);
473  h_ele_foundHits = new TH1F("h_ele_foundHits", "ele track # found hits", nbinfhits, 0., fhitsmax);
474  h_ele_foundHitsVsEta = new TH2F(
475  "h_ele_foundHitsVsEta", "ele track # found hits vs eta", nbineta2D, etamin, etamax, nbinfhits, 0., fhitsmax);
476  h_ele_foundHitsVsPhi = new TH2F(
477  "h_ele_foundHitsVsPhi", "ele track # found hits vs phi", nbinphi2D, phimin, phimax, nbinfhits, 0., fhitsmax);
479  new TH2F("h_ele_foundHitsVsPt", "ele track # found hits vs pt", nbinpt2D, 0., ptmax, nbinfhits, 0., fhitsmax);
480  h_ele_lostHits = new TH1F("h_ele_lostHits", "ele track # lost hits", 5, 0., 5.);
481  h_ele_lostHitsVsEta = new TH2F(
482  "h_ele_lostHitsVsEta", "ele track # lost hits vs eta", nbineta2D, etamin, etamax, nbinlhits, 0., lhitsmax);
483  h_ele_lostHitsVsPhi = new TH2F(
484  "h_ele_lostHitsVsPhi", "ele track # lost hits vs eta", nbinphi2D, phimin, phimax, nbinlhits, 0., lhitsmax);
486  new TH2F("h_ele_lostHitsVsPt", "ele track # lost hits vs eta", nbinpt2D, 0., ptmax, nbinlhits, 0., lhitsmax);
487  h_ele_chi2 = new TH1F("h_ele_chi2", "ele track #chi^{2}", 100, 0., 15.);
488  h_ele_chi2VsEta = new TH2F("h_ele_chi2VsEta", "ele track #chi^{2} vs eta", nbineta2D, etamin, etamax, 50, 0., 15.);
489  h_ele_chi2VsPhi = new TH2F("h_ele_chi2VsPhi", "ele track #chi^{2} vs phi", nbinphi2D, phimin, phimax, 50, 0., 15.);
490  h_ele_chi2VsPt = new TH2F("h_ele_chi2VsPt", "ele track #chi^{2} vs pt", nbinpt2D, 0., ptmax, 50, 0., 15.);
491  h_ele_PinMnPout = new TH1F("h_ele_PinMnPout", "ele track inner p - outer p, mean", nbinp, 0., 200.);
492  h_ele_PinMnPout_mode = new TH1F("h_ele_PinMnPout_mode", "ele track inner p - outer p, mode", nbinp, 0., 100.);
493  h_ele_PinMnPoutVsEta_mode = new TH2F("h_ele_PinMnPoutVsEta_mode",
494  "ele track inner p - outer p vs eta, mode",
495  nbineta2D,
496  etamin,
497  etamax,
498  nbinp2D,
499  0.,
500  100.);
501  h_ele_PinMnPoutVsPhi_mode = new TH2F("h_ele_PinMnPoutVsPhi_mode",
502  "ele track inner p - outer p vs phi, mode",
503  nbinphi2D,
504  phimin,
505  phimax,
506  nbinp2D,
507  0.,
508  100.);
509  h_ele_PinMnPoutVsPt_mode = new TH2F(
510  "h_ele_PinMnPoutVsPt_mode", "ele track inner p - outer p vs pt, mode", nbinpt2D, 0., ptmax, nbinp2D, 0., 100.);
511  h_ele_PinMnPoutVsE_mode = new TH2F(
512  "h_ele_PinMnPoutVsE_mode", "ele track inner p - outer p vs E, mode", nbinp2D, 0., 200., nbinp2D, 0., 100.);
513  h_ele_PinMnPoutVsChi2_mode = new TH2F(
514  "h_ele_PinMnPoutVsChi2_mode", "ele track inner p - outer p vs track chi2, mode", 50, 0., 20., nbinp2D, 0., 100.);
515  h_ele_outerP = new TH1F("h_ele_outerP", "ele track outer p, mean", nbinp, 0., pmax);
516  h_ele_outerP_mode = new TH1F("h_ele_outerP_mode", "ele track outer p, mode", nbinp, 0., pmax);
518  new TH2F("h_ele_outerPVsEta_mode", "ele track outer p vs eta mode", nbineta2D, etamin, etamax, 50, 0., pmax);
519  h_ele_outerPt = new TH1F("h_ele_outerPt", "ele track outer p_{T}, mean", nbinpt, 0., ptmax);
520  h_ele_outerPt_mode = new TH1F("h_ele_outerPt_mode", "ele track outer p_{T}, mode", nbinpt, 0., ptmax);
521  h_ele_outerPtVsEta_mode = new TH2F(
522  "h_ele_outerPtVsEta_mode", "ele track outer p_{T} vs eta, mode", nbineta2D, etamin, etamax, nbinpt2D, 0., ptmax);
523  h_ele_outerPtVsPhi_mode = new TH2F(
524  "h_ele_outerPtVsPhi_mode", "ele track outer p_{T} vs phi, mode", nbinphi2D, phimin, phimax, nbinpt2D, 0., ptmax);
526  new TH2F("h_ele_outerPtVsPt_mode", "ele track outer p_{T} vs pt, mode", nbinpt2D, 0., 100., nbinpt2D, 0., ptmax);
527 
528  // matched electrons, matching
529  h_ele_EoP = new TH1F("h_ele_EoP", "ele E/P_{vertex}", nbineop, 0., eopmax);
531  new TH2F("h_ele_EoPVsEta", "ele E/P_{vertex} vs eta", nbineta2D, etamin, etamax, nbineop2D, 0., eopmaxsht);
533  new TH2F("h_ele_EoPVsPhi", "ele E/P_{vertex} vs phi", nbinphi2D, phimin, phimax, nbineop2D, 0., eopmaxsht);
534  h_ele_EoPVsE = new TH2F("h_ele_EoPVsE", "ele E/P_{vertex} vs E", 50, 0., pmax, 50, 0., 5.);
535  h_ele_EseedOP = new TH1F("h_ele_EseedOP", "ele E_{seed}/P_{vertex}", nbineop, 0., eopmax);
536  h_ele_EseedOPVsEta = new TH2F(
537  "h_ele_EseedOPVsEta", "ele E_{seed}/P_{vertex} vs eta", nbineta2D, etamin, etamax, nbineop2D, 0., eopmaxsht);
538  h_ele_EseedOPVsPhi = new TH2F(
539  "h_ele_EseedOPVsPhi", "ele E_{seed}/P_{vertex} vs phi", nbinphi2D, phimin, phimax, nbineop2D, 0., eopmaxsht);
540  h_ele_EseedOPVsE = new TH2F("h_ele_EseedOPVsE", "ele E_{seed}/P_{vertex} vs E", 50, 0., pmax, 50, 0., 5.);
541  h_ele_EoPout = new TH1F("h_ele_EoPout", "ele E/P_{out}", nbineop, 0., eopmax);
543  new TH2F("h_ele_EoPoutVsEta", "ele E/P_{out} vs eta", nbineta2D, etamin, etamax, nbineop2D, 0., eopmaxsht);
545  new TH2F("h_ele_EoPoutVsPhi", "ele E/P_{out} vs phi", nbinphi2D, phimin, phimax, nbineop2D, 0., eopmaxsht);
546  h_ele_EoPoutVsE = new TH2F("h_ele_EoPoutVsE", "ele E/P_{out} vs E", nbinp2D, 0., pmax, nbineop2D, 0., eopmaxsht);
547  h_ele_EeleOPout = new TH1F("h_ele_EeleOPout", "ele E_{ele}/P_{out}", nbineop, 0., eopmax);
548  h_ele_EeleOPoutVsEta = new TH2F(
549  "h_ele_EeleOPoutVsEta", "ele E_{ele}/P_{out} vs eta", nbineta2D, etamin, etamax, nbineop2D, 0., eopmaxsht);
550  h_ele_EeleOPoutVsPhi = new TH2F(
551  "h_ele_EeleOPoutVsPhi", "ele E_{ele}/P_{out} vs phi", nbinphi2D, phimin, phimax, nbineop2D, 0., eopmaxsht);
553  new TH2F("h_ele_EeleOPoutVsE", "ele E_{ele}/P_{out} vs E", nbinp2D, 0., pmax, nbineop2D, 0., eopmaxsht);
554  h_ele_dEtaSc_propVtx = new TH1F(
555  "h_ele_dEtaSc_propVtx", "ele #eta_{sc} - #eta_{tr}, prop from vertex", nbindetamatch, detamatchmin, detamatchmax);
556  h_ele_dEtaScVsEta_propVtx = new TH2F("h_ele_dEtaScVsEta_propVtx",
557  "ele #eta_{sc} - #eta_{tr} vs eta, prop from vertex",
558  nbineta2D,
559  etamin,
560  etamax,
562  detamatchmin,
563  detamatchmax);
564  h_ele_dEtaScVsPhi_propVtx = new TH2F("h_ele_dEtaScVsPhi_propVtx",
565  "ele #eta_{sc} - #eta_{tr} vs phi, prop from vertex",
566  nbinphi2D,
567  phimin,
568  phimax,
570  detamatchmin,
571  detamatchmax);
572  h_ele_dEtaScVsPt_propVtx = new TH2F("h_ele_dEtaScVsPt_propVtx",
573  "ele #eta_{sc} - #eta_{tr} vs pt, prop from vertex",
574  nbinpt2D,
575  0.,
576  ptmax,
578  detamatchmin,
579  detamatchmax);
580  h_ele_dPhiSc_propVtx = new TH1F(
581  "h_ele_dPhiSc_propVtx", "ele #phi_{sc} - #phi_{tr}, prop from vertex", nbindphimatch, dphimatchmin, dphimatchmax);
582  h_ele_dPhiScVsEta_propVtx = new TH2F("h_ele_dPhiScVsEta_propVtx",
583  "ele #phi_{sc} - #phi_{tr} vs eta, prop from vertex",
584  nbineta2D,
585  etamin,
586  etamax,
588  dphimatchmin,
589  dphimatchmax);
590  h_ele_dPhiScVsPhi_propVtx = new TH2F("h_ele_dPhiScVsPhi_propVtx",
591  "ele #phi_{sc} - #phi_{tr} vs phi, prop from vertex",
592  nbinphi2D,
593  phimin,
594  phimax,
596  dphimatchmin,
597  dphimatchmax);
598  h_ele_dPhiScVsPt_propVtx = new TH2F("h_ele_dPhiScVsPt_propVtx",
599  "ele #phi_{sc} - #phi_{tr} vs pt, prop from vertex",
600  nbinpt2D,
601  0.,
602  ptmax,
604  dphimatchmin,
605  dphimatchmax);
606  h_ele_dEtaCl_propOut = new TH1F("h_ele_dEtaCl_propOut",
607  "ele #eta_{cl} - #eta_{tr}, prop from outermost",
609  detamatchmin,
610  detamatchmax);
611  h_ele_dEtaClVsEta_propOut = new TH2F("h_ele_dEtaClVsEta_propOut",
612  "ele #eta_{cl} - #eta_{tr} vs eta, prop from out",
613  nbineta2D,
614  etamin,
615  etamax,
617  detamatchmin,
618  detamatchmax);
619  h_ele_dEtaClVsPhi_propOut = new TH2F("h_ele_dEtaClVsPhi_propOut",
620  "ele #eta_{cl} - #eta_{tr} vs phi, prop from out",
621  nbinphi2D,
622  phimin,
623  phimax,
625  detamatchmin,
626  detamatchmax);
627  h_ele_dEtaClVsPt_propOut = new TH2F("h_ele_dEtaScVsPt_propOut",
628  "ele #eta_{cl} - #eta_{tr} vs pt, prop from out",
629  nbinpt2D,
630  0.,
631  ptmax,
633  detamatchmin,
634  detamatchmax);
635  h_ele_dPhiCl_propOut = new TH1F("h_ele_dPhiCl_propOut",
636  "ele #phi_{cl} - #phi_{tr}, prop from outermost",
638  dphimatchmin,
639  dphimatchmax);
640  h_ele_dPhiClVsEta_propOut = new TH2F("h_ele_dPhiClVsEta_propOut",
641  "ele #phi_{cl} - #phi_{tr} vs eta, prop from out",
642  nbineta2D,
643  etamin,
644  etamax,
646  dphimatchmin,
647  dphimatchmax);
648  h_ele_dPhiClVsPhi_propOut = new TH2F("h_ele_dPhiClVsPhi_propOut",
649  "ele #phi_{cl} - #phi_{tr} vs phi, prop from out",
650  nbinphi2D,
651  phimin,
652  phimax,
654  dphimatchmin,
655  dphimatchmax);
656  h_ele_dPhiClVsPt_propOut = new TH2F("h_ele_dPhiSClsPt_propOut",
657  "ele #phi_{cl} - #phi_{tr} vs pt, prop from out",
658  nbinpt2D,
659  0.,
660  ptmax,
662  dphimatchmin,
663  dphimatchmax);
664  h_ele_dEtaEleCl_propOut = new TH1F("h_ele_dEtaEleCl_propOut",
665  "ele #eta_{EleCl} - #eta_{tr}, prop from outermost",
667  detamatchmin,
668  detamatchmax);
669  h_ele_dEtaEleClVsEta_propOut = new TH2F("h_ele_dEtaEleClVsEta_propOut",
670  "ele #eta_{EleCl} - #eta_{tr} vs eta, prop from out",
671  nbineta2D,
672  etamin,
673  etamax,
675  detamatchmin,
676  detamatchmax);
677  h_ele_dEtaEleClVsPhi_propOut = new TH2F("h_ele_dEtaEleClVsPhi_propOut",
678  "ele #eta_{EleCl} - #eta_{tr} vs phi, prop from out",
679  nbinphi2D,
680  phimin,
681  phimax,
683  detamatchmin,
684  detamatchmax);
685  h_ele_dEtaEleClVsPt_propOut = new TH2F("h_ele_dEtaScVsPt_propOut",
686  "ele #eta_{EleCl} - #eta_{tr} vs pt, prop from out",
687  nbinpt2D,
688  0.,
689  ptmax,
691  detamatchmin,
692  detamatchmax);
693  h_ele_dPhiEleCl_propOut = new TH1F("h_ele_dPhiEleCl_propOut",
694  "ele #phi_{EleCl} - #phi_{tr}, prop from outermost",
696  dphimatchmin,
697  dphimatchmax);
698  h_ele_dPhiEleClVsEta_propOut = new TH2F("h_ele_dPhiEleClVsEta_propOut",
699  "ele #phi_{EleCl} - #phi_{tr} vs eta, prop from out",
700  nbineta2D,
701  etamin,
702  etamax,
704  dphimatchmin,
705  dphimatchmax);
706  h_ele_dPhiEleClVsPhi_propOut = new TH2F("h_ele_dPhiEleClVsPhi_propOut",
707  "ele #phi_{EleCl} - #phi_{tr} vs phi, prop from out",
708  nbinphi2D,
709  phimin,
710  phimax,
712  dphimatchmin,
713  dphimatchmax);
714  h_ele_dPhiEleClVsPt_propOut = new TH2F("h_ele_dPhiSEleClsPt_propOut",
715  "ele #phi_{EleCl} - #phi_{tr} vs pt, prop from out",
716  nbinpt2D,
717  0.,
718  ptmax,
720  dphimatchmin,
721  dphimatchmax);
722 
723  h_ele_HoE = new TH1F("h_ele_HoE", "ele hadronic energy / em energy", nbinhoe, hoemin, hoemax);
725  new TH1F("h_ele_HoE_fiducial", "ele hadronic energy / em energy, fiducial region", nbinhoe, hoemin, hoemax);
726  h_ele_HoEVsEta = new TH2F(
727  "h_ele_HoEVsEta", "ele hadronic energy / em energy vs eta", nbineta, etamin, etamax, nbinhoe, hoemin, hoemax);
728  h_ele_HoEVsPhi = new TH2F(
729  "h_ele_HoEVsPhi", "ele hadronic energy / em energy vs phi", nbinphi2D, phimin, phimax, nbinhoe, hoemin, hoemax);
730  h_ele_HoEVsE =
731  new TH2F("h_ele_HoEVsE", "ele hadronic energy / em energy vs E", nbinp, 0., 300., nbinhoe, hoemin, hoemax);
732 
733  h_ele_seed_dphi2_ = new TH1F("h_ele_seedDphi2", "ele seed dphi 2nd layer", 50, -0.003, +0.003);
735  new TH2F("h_ele_seedDphi2VsEta", "ele seed dphi 2nd layer vs eta", nbineta2D, etamin, etamax, 50, -0.003, +0.003);
737  new TH2F("h_ele_seedDphi2VsPt", "ele seed dphi 2nd layer vs pt", nbinpt2D, 0., ptmax, 50, -0.003, +0.003);
738  h_ele_seed_drz2_ = new TH1F("h_ele_seedDrz2", "ele seed dr/dz 2nd layer", 50, -0.03, +0.03);
740  new TH2F("h_ele_seedDrz2VsEta", "ele seed dr/dz 2nd layer vs eta", nbineta2D, etamin, etamax, 50, -0.03, +0.03);
742  new TH2F("h_ele_seedDrz2VsPt", "ele seed dr/dz 2nd layer vs pt", nbinpt2D, 0., ptmax, 50, -0.03, +0.03);
743  h_ele_seed_subdet2_ = new TH1F("h_ele_seedSubdet2", "ele seed subdet 2nd layer", 10, 0., 10.);
744 
745  // classes
746  h_ele_classes = new TH1F("h_ele_classes", "electron classes", 20, 0.0, 20.);
747  h_ele_eta = new TH1F("h_ele_eta", "ele electron eta", nbineta / 2, 0.0, etamax);
748  h_ele_eta_golden = new TH1F("h_ele_eta_golden", "ele electron eta golden", nbineta / 2, 0.0, etamax);
749  h_ele_eta_bbrem = new TH1F("h_ele_eta_bbrem", "ele electron eta bbrem", nbineta / 2, 0.0, etamax);
750  h_ele_eta_narrow = new TH1F("h_ele_eta_narrow", "ele electron eta narrow", nbineta / 2, 0.0, etamax);
751  h_ele_eta_shower = new TH1F("h_ele_eta_show", "ele electron eta showering", nbineta / 2, 0.0, etamax);
752  h_ele_PinVsPoutGolden_mode = new TH2F("h_ele_PinVsPoutGolden_mode",
753  "ele track inner p vs outer p vs eta, golden, mode",
754  nbinp2D,
755  0.,
756  pmax,
757  50,
758  0.,
759  pmax);
760  h_ele_PinVsPoutShowering_mode = new TH2F("h_ele_PinVsPoutShowering_mode",
761  "ele track inner p vs outer p vs eta, Showering, mode",
762  nbinp2D,
763  0.,
764  pmax,
765  50,
766  0.,
767  pmax);
768  h_ele_PinVsPoutGolden_mean = new TH2F("h_ele_PinVsPoutGolden_mean",
769  "ele track inner p vs outer p vs eta, golden, mean",
770  nbinp2D,
771  0.,
772  pmax,
773  50,
774  0.,
775  pmax);
776  h_ele_PinVsPoutShowering_mean = new TH2F("h_ele_PinVsPoutShowering_mean",
777  "ele track inner p vs outer p vs eta, Showering, mean",
778  nbinp2D,
779  0.,
780  pmax,
781  50,
782  0.,
783  pmax);
784  h_ele_PtinVsPtoutGolden_mode = new TH2F("h_ele_PtinVsPtoutGolden_mode",
785  "ele track inner pt vs outer pt vs eta, golden, mode",
786  nbinpt2D,
787  0.,
788  ptmax,
789  50,
790  0.,
791  ptmax);
792  h_ele_PtinVsPtoutShowering_mode = new TH2F("h_ele_PtinVsPtoutShowering_mode",
793  "ele track inner pt vs outer pt vs eta, showering, mode",
794  nbinpt2D,
795  0.,
796  ptmax,
797  50,
798  0.,
799  ptmax);
800  h_ele_PtinVsPtoutGolden_mean = new TH2F("h_ele_PtinVsPtoutGolden_mean",
801  "ele track inner pt vs outer pt vs eta, golden, mean",
802  nbinpt2D,
803  0.,
804  ptmax,
805  50,
806  0.,
807  ptmax);
808  h_ele_PtinVsPtoutShowering_mean = new TH2F("h_ele_PtinVsPtoutShowering_mean",
809  "ele track inner pt vs outer pt vs eta, showering, mean",
810  nbinpt2D,
811  0.,
812  ptmax,
813  50,
814  0.,
815  ptmax);
816  histSclEoEmatchingObjectGolden_barrel = new TH1F("h_scl_EoEmatchingObject golden, barrel",
817  "ele supercluster energy over matchingObject energy, golden, barrel",
818  100,
819  0.2,
820  1.2);
822  new TH1F("h_scl_EoEmatchingObject golden, endcaps",
823  "ele supercluster energy over matchingObject energy, golden, endcaps",
824  100,
825  0.2,
826  1.2);
828  new TH1F("h_scl_EoEmatchingObject Showering, barrel",
829  "ele supercluster energy over matchingObject energy, showering, barrel",
830  100,
831  0.2,
832  1.2);
834  new TH1F("h_scl_EoEmatchingObject Showering, endcaps",
835  "ele supercluster energy over matchingObject energy, showering, endcaps",
836  100,
837  0.2,
838  1.2);
839 
840  // isolation
841  h_ele_tkSumPt_dr03 = new TH1F("h_ele_tkSumPt_dr03", "tk isolation sum, dR=0.3", 100, 0.0, 20.);
842  h_ele_ecalRecHitSumEt_dr03 = new TH1F("h_ele_ecalRecHitSumEt_dr03", "ecal isolation sum, dR=0.3", 100, 0.0, 20.);
844  new TH1F("h_ele_hcalDepth1TowerSumEt_dr03", "hcal depth1 isolation sum, dR=0.3", 100, 0.0, 20.);
846  new TH1F("h_ele_hcalDepth2TowerSumEt_dr03", "hcal depth2 isolation sum, dR=0.3", 100, 0.0, 20.);
847  h_ele_tkSumPt_dr04 = new TH1F("h_ele_tkSumPt_dr04", "hcal isolation sum", 100, 0.0, 20.);
848  h_ele_ecalRecHitSumEt_dr04 = new TH1F("h_ele_ecalRecHitSumEt_dr04", "ecal isolation sum, dR=0.4", 100, 0.0, 20.);
850  new TH1F("h_ele_hcalDepth1TowerSumEt_dr04", "hcal depth1 isolation sum, dR=0.4", 100, 0.0, 20.);
852  new TH1F("h_ele_hcalDepth2TowerSumEt_dr04", "hcal depth2 isolation sum, dR=0.4", 100, 0.0, 20.);
853 
854  // fbrem
855  h_ele_fbrem = new TH1F("h_ele_fbrem", "ele brem fraction, mode", 100, 0., 1.);
857  new TProfile("h_ele_fbremvsEtamode", "mean ele brem fraction vs eta, mode", nbineta2D, etamin, etamax, 0., 1.);
859  new TProfile("h_ele_fbremvsEtamean", "mean ele brem fraction vs eta, mean", nbineta2D, etamin, etamax, 0., 1.);
860 
861  // e/g et pflow electrons
862  h_ele_mva = new TH1F("h_ele_mva", "ele identification mva", 100, -1., 1.);
863  h_ele_provenance = new TH1F("h_ele_provenance", "ele provenance", 5, -2., 3.);
864 
865  // histos titles
866  h_matchingObjectNum->GetXaxis()->SetTitle("N_{SC}");
867  h_matchingObjectNum->GetYaxis()->SetTitle("Events");
868  h_matchingObjectEta->GetXaxis()->SetTitle("#eta_{SC}");
869  h_matchingObjectEta->GetYaxis()->SetTitle("Events");
870  h_matchingObjectP->GetXaxis()->SetTitle("E_{SC} (GeV)");
871  h_matchingObjectP->GetYaxis()->SetTitle("Events");
872  h_ele_foundHits->GetXaxis()->SetTitle("N_{hits}");
873  h_ele_foundHits->GetYaxis()->SetTitle("Events");
874  h_ele_ambiguousTracks->GetXaxis()->SetTitle("N_{ambiguous tracks}");
875  h_ele_ambiguousTracks->GetYaxis()->SetTitle("Events");
876  h_ele_lostHits->GetXaxis()->SetTitle("N_{lost hits}");
877  h_ele_lostHits->GetYaxis()->SetTitle("Events");
878  h_ele_chi2->GetXaxis()->SetTitle("#Chi^{2}");
879  h_ele_chi2->GetYaxis()->SetTitle("Events");
880  h_ele_charge->GetXaxis()->SetTitle("charge");
881  h_ele_charge->GetYaxis()->SetTitle("Events");
882  h_ele_vertexP->GetXaxis()->SetTitle("p_{vertex} (GeV/c)");
883  h_ele_vertexP->GetYaxis()->SetTitle("Events");
884  h_ele_vertexPt->GetXaxis()->SetTitle("p_{T vertex} (GeV/c)");
885  h_ele_vertexPt->GetYaxis()->SetTitle("Events");
886  h_ele_Et->GetXaxis()->SetTitle("E_{T} (GeV)");
887  h_ele_Et->GetYaxis()->SetTitle("Events");
888  h_ele_vertexEta->GetXaxis()->SetTitle("#eta");
889  h_ele_vertexEta->GetYaxis()->SetTitle("Events");
890  h_ele_vertexPhi->GetXaxis()->SetTitle("#phi (rad)");
891  h_ele_vertexPhi->GetYaxis()->SetTitle("Events");
892  h_ele_PoPmatchingObject_matched->GetXaxis()->SetTitle("P/E_{SC}");
893  h_ele_PoPmatchingObject_matched->GetYaxis()->SetTitle("Events");
894  h_ele_PoPmatchingObject_barrel_matched->GetXaxis()->SetTitle("P/E_{SC}");
895  h_ele_PoPmatchingObject_barrel_matched->GetYaxis()->SetTitle("Events");
896  h_ele_PoPmatchingObject_endcaps_matched->GetXaxis()->SetTitle("P/E_{SC}");
897  h_ele_PoPmatchingObject_endcaps_matched->GetYaxis()->SetTitle("Events");
898  h_ele_PtoPtmatchingObject_matched->GetXaxis()->SetTitle("P_{T}/E_{T}^{SC}");
899  h_ele_PtoPtmatchingObject_matched->GetYaxis()->SetTitle("Events");
900  h_ele_PtoPtmatchingObject_barrel_matched->GetXaxis()->SetTitle("P_{T}/E_{T}^{SC}");
901  h_ele_PtoPtmatchingObject_barrel_matched->GetYaxis()->SetTitle("Events");
902  h_ele_PtoPtmatchingObject_endcaps_matched->GetXaxis()->SetTitle("P_{T}/E_{T}^{SC}");
903  h_ele_PtoPtmatchingObject_endcaps_matched->GetYaxis()->SetTitle("Events");
904  histSclSigEtaEta_->GetXaxis()->SetTitle("#sigma_{#eta #eta}");
905  histSclSigEtaEta_->GetYaxis()->SetTitle("Events");
906  histSclSigIEtaIEta_barrel_->GetXaxis()->SetTitle("#sigma_{i#eta i#eta}");
907  histSclSigIEtaIEta_barrel_->GetYaxis()->SetTitle("Events");
908  histSclSigIEtaIEta_endcaps_->GetXaxis()->SetTitle("#sigma_{i#eta i#eta}");
909  histSclSigIEtaIEta_endcaps_->GetYaxis()->SetTitle("Events");
910  histSclE1x5_->GetXaxis()->SetTitle("E1x5 (GeV)");
911  histSclE1x5_->GetYaxis()->SetTitle("Events");
912  histSclE1x5_barrel_->GetXaxis()->SetTitle("E1x5 (GeV)");
913  histSclE1x5_barrel_->GetYaxis()->SetTitle("Events");
914  histSclE1x5_endcaps_->GetXaxis()->SetTitle("E1x5 (GeV)");
915  histSclE1x5_endcaps_->GetYaxis()->SetTitle("Events");
916  histSclE2x5max_->GetXaxis()->SetTitle("E2x5 (GeV)");
917  histSclE2x5max_->GetYaxis()->SetTitle("Events");
918  histSclE2x5max_barrel_->GetXaxis()->SetTitle("E2x5 (GeV)");
919  histSclE2x5max_barrel_->GetYaxis()->SetTitle("Events");
920  histSclE2x5max_endcaps_->GetXaxis()->SetTitle("E2x5 (GeV)");
921  histSclE2x5max_endcaps_->GetYaxis()->SetTitle("Events");
922  histSclE5x5_->GetXaxis()->SetTitle("E5x5 (GeV)");
923  histSclE5x5_->GetYaxis()->SetTitle("Events");
924  histSclE5x5_barrel_->GetXaxis()->SetTitle("E5x5 (GeV)");
925  histSclE5x5_barrel_->GetYaxis()->SetTitle("Events");
926  histSclE5x5_endcaps_->GetXaxis()->SetTitle("E5x5 (GeV)");
927  histSclE5x5_endcaps_->GetYaxis()->SetTitle("Events");
928  h_ele_EtaMnEtamatchingObject_matched->GetXaxis()->SetTitle("#eta_{rec} - #eta_{SC}");
929  h_ele_EtaMnEtamatchingObject_matched->GetYaxis()->SetTitle("Events");
930  h_ele_PhiMnPhimatchingObject_matched->GetXaxis()->SetTitle("#phi_{rec} - #phi_{SC} (rad)");
931  h_ele_PhiMnPhimatchingObject_matched->GetYaxis()->SetTitle("Events");
932  h_ele_PinMnPout->GetXaxis()->SetTitle("P_{vertex} - P_{out} (GeV/c)");
933  h_ele_PinMnPout->GetYaxis()->SetTitle("Events");
934  h_ele_PinMnPout_mode->GetXaxis()->SetTitle("P_{vertex} - P_{out}, mode (GeV/c)");
935  h_ele_PinMnPout_mode->GetYaxis()->SetTitle("Events");
936  h_ele_outerP->GetXaxis()->SetTitle("P_{out} (GeV/c)");
937  h_ele_outerP->GetYaxis()->SetTitle("Events");
938  h_ele_outerP_mode->GetXaxis()->SetTitle("P_{out} (GeV/c)");
939  h_ele_outerP_mode->GetYaxis()->SetTitle("Events");
940  h_ele_outerPt->GetXaxis()->SetTitle("P_{T out} (GeV/c)");
941  h_ele_outerPt->GetYaxis()->SetTitle("Events");
942  h_ele_outerPt_mode->GetXaxis()->SetTitle("P_{T out} (GeV/c)");
943  h_ele_outerPt_mode->GetYaxis()->SetTitle("Events");
944  h_ele_EoP->GetXaxis()->SetTitle("E/P_{vertex}");
945  h_ele_EoP->GetYaxis()->SetTitle("Events");
946  h_ele_EseedOP->GetXaxis()->SetTitle("E_{seed}/P_{vertex}");
947  h_ele_EseedOP->GetYaxis()->SetTitle("Events");
948  h_ele_EoPout->GetXaxis()->SetTitle("E_{seed}/P_{out}");
949  h_ele_EoPout->GetYaxis()->SetTitle("Events");
950  h_ele_EeleOPout->GetXaxis()->SetTitle("E_{ele}/P_{out}");
951  h_ele_EeleOPout->GetYaxis()->SetTitle("Events");
952  h_ele_vertexX->GetXaxis()->SetTitle("x (cm)");
953  h_ele_vertexX->GetYaxis()->SetTitle("Events");
954  h_ele_vertexY->GetXaxis()->SetTitle("y (cm)");
955  h_ele_vertexY->GetYaxis()->SetTitle("Events");
956  h_ele_vertexZ->GetXaxis()->SetTitle("z (cm)");
957  h_ele_vertexZ->GetYaxis()->SetTitle("Events");
958  h_ele_vertexTIP->GetXaxis()->SetTitle("TIP (cm)");
959  h_ele_vertexTIP->GetYaxis()->SetTitle("Events");
960  h_ele_vertexTIPVsEta->GetYaxis()->SetTitle("TIP (cm)");
961  h_ele_vertexTIPVsEta->GetXaxis()->SetTitle("#eta");
962  h_ele_vertexTIPVsPhi->GetYaxis()->SetTitle("TIP (cm)");
963  h_ele_vertexTIPVsPhi->GetXaxis()->SetTitle("#phi (rad)");
964  h_ele_vertexTIPVsPt->GetYaxis()->SetTitle("TIP (cm)");
965  h_ele_vertexTIPVsEta->GetXaxis()->SetTitle("p_{T} (GeV/c)");
966  h_ele_dEtaSc_propVtx->GetXaxis()->SetTitle("#eta_{sc} - #eta_{tr}");
967  h_ele_dEtaSc_propVtx->GetYaxis()->SetTitle("Events");
968  h_ele_dEtaCl_propOut->GetXaxis()->SetTitle("#eta_{seedcl} - #eta_{tr}");
969  h_ele_dEtaCl_propOut->GetYaxis()->SetTitle("Events");
970  h_ele_dEtaEleCl_propOut->GetXaxis()->SetTitle("#eta_{elecl} - #eta_{tr}");
971  h_ele_dEtaEleCl_propOut->GetYaxis()->SetTitle("Events");
972  h_ele_dPhiSc_propVtx->GetXaxis()->SetTitle("#phi_{sc} - #phi_{tr} (rad)");
973  h_ele_dPhiSc_propVtx->GetYaxis()->SetTitle("Events");
974  h_ele_dPhiCl_propOut->GetXaxis()->SetTitle("#phi_{seedcl} - #phi_{tr} (rad)");
975  h_ele_dPhiCl_propOut->GetYaxis()->SetTitle("Events");
976  h_ele_dPhiEleCl_propOut->GetXaxis()->SetTitle("#phi_{elecl} - #phi_{tr} (rad)");
977  h_ele_dPhiEleCl_propOut->GetYaxis()->SetTitle("Events");
978  h_ele_HoE->GetXaxis()->SetTitle("H/E");
979  h_ele_HoE->GetYaxis()->SetTitle("Events");
980  h_ele_HoE_fiducial->GetXaxis()->SetTitle("H/E");
981  h_ele_HoE_fiducial->GetYaxis()->SetTitle("Events");
982  h_ele_fbrem->GetXaxis()->SetTitle("P_{in} - P_{out} / P_{in}");
983  h_ele_fbrem->GetYaxis()->SetTitle("Events");
984  h_ele_seed_dphi2_->GetXaxis()->SetTitle("#phi_{hit}-#phi_{pred} (rad)");
985  h_ele_seed_dphi2_->GetYaxis()->SetTitle("Events");
986  h_ele_seed_drz2_->GetXaxis()->SetTitle("r(z)_{hit}-r(z)_{pred} (cm)");
987  h_ele_seed_drz2_->GetYaxis()->SetTitle("Events");
988  h_ele_seed_subdet2_->GetXaxis()->SetTitle("2nd hit subdet Id");
989  h_ele_seed_subdet2_->GetYaxis()->SetTitle("Events");
990  h_ele_classes->GetXaxis()->SetTitle("class Id");
991  h_ele_classes->GetYaxis()->SetTitle("Events");
992  h_ele_mee_all->GetXaxis()->SetTitle("m_{ee} (GeV/c^{2})");
993  h_ele_mee_all->GetYaxis()->SetTitle("Events");
994  h_ele_mee_os->GetXaxis()->SetTitle("m_{e^{+}e^{-}} (GeV/c^{2})");
995  h_ele_mee_os->GetYaxis()->SetTitle("Events");
996  h_ele_mee_os_ebeb->GetXaxis()->SetTitle("m_{e^{+}e^{-}} (GeV/c^{2})");
997  h_ele_mee_os_ebeb->GetYaxis()->SetTitle("Events");
998  h_ele_mee_os_ebee->GetXaxis()->SetTitle("m_{e^{+}e^{-}} (GeV/c^{2})");
999  h_ele_mee_os_ebee->GetYaxis()->SetTitle("Events");
1000  h_ele_mee_os_eeee->GetXaxis()->SetTitle("m_{e^{+}e^{-}} (GeV/c^{2})");
1001  h_ele_mee_os_eeee->GetYaxis()->SetTitle("Events");
1002  h_ele_mee_os_gg->GetXaxis()->SetTitle("m_{e^{+}e^{-}} (GeV/c^{2})");
1003  h_ele_mee_os_gg->GetYaxis()->SetTitle("Events");
1004  h_ele_mee_os_gb->GetXaxis()->SetTitle("m_{e^{+}e^{-}} (GeV/c^{2})");
1005  h_ele_mee_os_gb->GetYaxis()->SetTitle("Events");
1006  h_ele_mee_os_bb->GetXaxis()->SetTitle("m_{e^{+}e^{-}} (GeV/c^{2})");
1007  h_ele_mee_os_bb->GetYaxis()->SetTitle("Events");
1008  h_ele_E2mnE1vsMee_all->GetXaxis()->SetTitle("m_{e^{+}e^{-}} (GeV/c^{2})");
1009  h_ele_E2mnE1vsMee_all->GetYaxis()->SetTitle("E2 - E1 (GeV)");
1010  h_ele_E2mnE1vsMee_egeg_all->GetXaxis()->SetTitle("m_{e^{+}e^{-}} (GeV/c^{2})");
1011  h_ele_E2mnE1vsMee_egeg_all->GetYaxis()->SetTitle("E2 - E1 (GeV)");
1012  histNum_->GetXaxis()->SetTitle("N_{ele}");
1013  histNum_->GetYaxis()->SetTitle("Events");
1014  h_ele_fbremVsEta_mode->GetXaxis()->SetTitle("#eta");
1015  h_ele_fbremVsEta_mean->GetXaxis()->SetTitle("#eta");
1016 }
1017 
1019  histfile_->cd();
1020  std::cout << "efficiency calculation " << std::endl;
1021  // efficiency vs eta
1022  TH1F *h_ele_etaEff = (TH1F *)h_ele_matchingObjectEta_matched->Clone("h_ele_etaEff");
1023  h_ele_etaEff->Reset();
1024  h_ele_etaEff->Divide(h_ele_matchingObjectEta_matched, h_matchingObjectEta, 1, 1, "b");
1025  h_ele_etaEff->Print();
1026  h_ele_etaEff->GetXaxis()->SetTitle("#eta");
1027  h_ele_etaEff->GetYaxis()->SetTitle("Efficiency");
1028 
1029  // efficiency vs z
1030  TH1F *h_ele_zEff = (TH1F *)h_ele_matchingObjectZ_matched->Clone("h_ele_zEff");
1031  h_ele_zEff->Reset();
1032  h_ele_zEff->Divide(h_ele_matchingObjectZ_matched, h_matchingObjectZ, 1, 1, "b");
1033  h_ele_zEff->Print();
1034  h_ele_zEff->GetXaxis()->SetTitle("z (cm)");
1035  h_ele_zEff->GetYaxis()->SetTitle("Efficiency");
1036 
1037  // efficiency vs |eta|
1038  TH1F *h_ele_absetaEff = (TH1F *)h_ele_matchingObjectAbsEta_matched->Clone("h_ele_absetaEff");
1039  h_ele_absetaEff->Reset();
1040  h_ele_absetaEff->Divide(h_ele_matchingObjectAbsEta_matched, h_matchingObjectAbsEta, 1, 1, "b");
1041  h_ele_absetaEff->GetXaxis()->SetTitle("|#eta|");
1042  h_ele_absetaEff->GetYaxis()->SetTitle("Efficiency");
1043 
1044  // efficiency vs pt
1045  TH1F *h_ele_ptEff = (TH1F *)h_ele_matchingObjectPt_matched->Clone("h_ele_ptEff");
1046  h_ele_ptEff->Reset();
1047  h_ele_ptEff->Divide(h_ele_matchingObjectPt_matched, h_matchingObjectPt, 1, 1, "b");
1048  h_ele_ptEff->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1049  h_ele_ptEff->GetYaxis()->SetTitle("Efficiency");
1050 
1051  // efficiency vs phi
1052  TH1F *h_ele_phiEff = (TH1F *)h_ele_matchingObjectPhi_matched->Clone("h_ele_phiEff");
1053  h_ele_phiEff->Reset();
1054  h_ele_phiEff->Divide(h_ele_matchingObjectPhi_matched, h_matchingObjectPhi, 1, 1, "b");
1055  h_ele_phiEff->GetXaxis()->SetTitle("#phi (rad)");
1056  h_ele_phiEff->GetYaxis()->SetTitle("Efficiency");
1057 
1058  // classes
1059  TH1F *h_ele_eta_goldenFrac = (TH1F *)h_ele_eta_golden->Clone("h_ele_eta_goldenFrac");
1060  h_ele_eta_goldenFrac->Reset();
1061  h_ele_eta_goldenFrac->Divide(h_ele_eta_golden, h_ele_eta, 1, 1);
1062  h_ele_eta_goldenFrac->GetXaxis()->SetTitle("|#eta|");
1063  h_ele_eta_goldenFrac->GetYaxis()->SetTitle("Fraction of electrons");
1064  h_ele_eta_goldenFrac->SetTitle("fraction of golden electrons vs eta");
1065  TH1F *h_ele_eta_bbremFrac = (TH1F *)h_ele_eta_bbrem->Clone("h_ele_eta_bbremFrac");
1066  h_ele_eta_bbremFrac->Reset();
1067  h_ele_eta_bbremFrac->Divide(h_ele_eta_bbrem, h_ele_eta, 1, 1);
1068  h_ele_eta_bbremFrac->GetXaxis()->SetTitle("|#eta|");
1069  h_ele_eta_bbremFrac->GetYaxis()->SetTitle("Fraction of electrons");
1070  h_ele_eta_bbremFrac->SetTitle("fraction of big brem electrons vs eta");
1071  TH1F *h_ele_eta_narrowFrac = (TH1F *)h_ele_eta_narrow->Clone("h_ele_eta_narrowFrac");
1072  h_ele_eta_narrowFrac->Reset();
1073  h_ele_eta_narrowFrac->Divide(h_ele_eta_narrow, h_ele_eta, 1, 1);
1074  h_ele_eta_narrowFrac->GetXaxis()->SetTitle("|#eta|");
1075  h_ele_eta_narrowFrac->GetYaxis()->SetTitle("Fraction of electrons");
1076  h_ele_eta_narrowFrac->SetTitle("fraction of narrow electrons vs eta");
1077  TH1F *h_ele_eta_showerFrac = (TH1F *)h_ele_eta_shower->Clone("h_ele_eta_showerFrac");
1078  h_ele_eta_showerFrac->Reset();
1079  h_ele_eta_showerFrac->Divide(h_ele_eta_shower, h_ele_eta, 1, 1);
1080  h_ele_eta_showerFrac->GetXaxis()->SetTitle("|#eta|");
1081  h_ele_eta_showerFrac->GetYaxis()->SetTitle("Fraction of electrons");
1082  h_ele_eta_showerFrac->SetTitle("fraction of showering electrons vs eta");
1083 
1084  // fbrem
1085  TH1F *h_ele_xOverX0VsEta = new TH1F("h_ele_xOverx0VsEta", "mean X/X_0 vs eta", nbineta / 2, 0.0, 2.5);
1086  for (int ibin = 1; ibin < h_ele_fbremVsEta_mean->GetNbinsX() + 1; ibin++) {
1087  double xOverX0 = 0.;
1088  if (h_ele_fbremVsEta_mean->GetBinContent(ibin) > 0.)
1089  xOverX0 = -log(h_ele_fbremVsEta_mean->GetBinContent(ibin));
1090  h_ele_xOverX0VsEta->SetBinContent(ibin, xOverX0);
1091  }
1092 
1093  //profiles from 2D histos
1094  TProfile *p_ele_PoPmatchingObjectVsEta_matched = h_ele_PoPmatchingObjectVsEta_matched->ProfileX();
1095  p_ele_PoPmatchingObjectVsEta_matched->SetTitle("mean ele momentum / matching SC energy vs eta");
1096  p_ele_PoPmatchingObjectVsEta_matched->GetXaxis()->SetTitle("#eta");
1097  p_ele_PoPmatchingObjectVsEta_matched->GetYaxis()->SetTitle("<P/E_{matching SC}>");
1098  p_ele_PoPmatchingObjectVsEta_matched->Write();
1099  TProfile *p_ele_PoPmatchingObjectVsPhi_matched = h_ele_PoPmatchingObjectVsPhi_matched->ProfileX();
1100  p_ele_PoPmatchingObjectVsPhi_matched->SetTitle("mean ele momentum / gen momentum vs phi");
1101  p_ele_PoPmatchingObjectVsPhi_matched->GetXaxis()->SetTitle("#phi (rad)");
1102  p_ele_PoPmatchingObjectVsPhi_matched->GetYaxis()->SetTitle("<P/E_{matching SC}>");
1103  p_ele_PoPmatchingObjectVsPhi_matched->Write();
1104  TProfile *p_ele_EtaMnEtamatchingObjectVsEta_matched = h_ele_EtaMnEtamatchingObjectVsEta_matched->ProfileX();
1105  p_ele_EtaMnEtamatchingObjectVsEta_matched->GetXaxis()->SetTitle("#eta");
1106  p_ele_EtaMnEtamatchingObjectVsEta_matched->GetYaxis()->SetTitle("<#eta_{rec} - #eta_{matching SC}>");
1107  p_ele_EtaMnEtamatchingObjectVsEta_matched->Write();
1108  TProfile *p_ele_EtaMnEtamatchingObjectVsPhi_matched = h_ele_EtaMnEtamatchingObjectVsPhi_matched->ProfileX();
1109  p_ele_EtaMnEtamatchingObjectVsPhi_matched->GetXaxis()->SetTitle("#phi");
1110  p_ele_EtaMnEtamatchingObjectVsPhi_matched->GetYaxis()->SetTitle("<#eta_{rec} - #eta_{matching SC}>");
1111  p_ele_EtaMnEtamatchingObjectVsPhi_matched->Write();
1112  TProfile *p_ele_PhiMnPhimatchingObjectVsEta_matched = h_ele_PhiMnPhimatchingObjectVsEta_matched->ProfileX();
1113  p_ele_PhiMnPhimatchingObjectVsEta_matched->GetXaxis()->SetTitle("#eta");
1114  p_ele_PhiMnPhimatchingObjectVsEta_matched->GetYaxis()->SetTitle("<#phi_{rec} - #phi_{matching SC}> (rad)");
1115  p_ele_PhiMnPhimatchingObjectVsEta_matched->Write();
1116  TProfile *p_ele_PhiMnPhimatchingObjectVsPhi_matched = h_ele_PhiMnPhimatchingObjectVsPhi_matched->ProfileX();
1117  p_ele_PhiMnPhimatchingObjectVsPhi_matched->GetXaxis()->SetTitle("#phi");
1118  p_ele_PhiMnPhimatchingObjectVsPhi_matched->GetYaxis()->SetTitle("<#phi_{rec} - #phi_{matching SC}> (rad)");
1119  p_ele_PhiMnPhimatchingObjectVsPhi_matched->Write();
1120  TProfile *p_ele_vertexPtVsEta = h_ele_vertexPtVsEta->ProfileX();
1121  p_ele_vertexPtVsEta->GetXaxis()->SetTitle("#eta");
1122  p_ele_vertexPtVsEta->GetYaxis()->SetTitle("<p_{T}> (GeV/c)");
1123  p_ele_vertexPtVsEta->Write();
1124  TProfile *p_ele_vertexPtVsPhi = h_ele_vertexPtVsPhi->ProfileX();
1125  p_ele_vertexPtVsPhi->GetXaxis()->SetTitle("#phi (rad)");
1126  p_ele_vertexPtVsPhi->GetYaxis()->SetTitle("<p_{T}> (GeV/c)");
1127  p_ele_vertexPtVsPhi->Write();
1128  TProfile *p_ele_EoPVsEta = h_ele_EoPVsEta->ProfileX();
1129  p_ele_EoPVsEta->GetXaxis()->SetTitle("#eta");
1130  p_ele_EoPVsEta->GetYaxis()->SetTitle("<E/P_{vertex}>");
1131  p_ele_EoPVsEta->Write();
1132  TProfile *p_ele_EoPVsPhi = h_ele_EoPVsPhi->ProfileX();
1133  p_ele_EoPVsPhi->GetXaxis()->SetTitle("#phi (rad)");
1134  p_ele_EoPVsPhi->GetYaxis()->SetTitle("<E/P_{vertex}>");
1135  p_ele_EoPVsPhi->Write();
1136  TProfile *p_ele_EoPoutVsEta = h_ele_EoPoutVsEta->ProfileX();
1137  p_ele_EoPoutVsEta->GetXaxis()->SetTitle("#eta");
1138  p_ele_EoPoutVsEta->GetYaxis()->SetTitle("<E_{seed}/P_{out}>");
1139  p_ele_EoPoutVsEta->Write();
1140  TProfile *p_ele_EoPoutVsPhi = h_ele_EoPoutVsPhi->ProfileX();
1141  p_ele_EoPoutVsPhi->GetXaxis()->SetTitle("#phi (rad)");
1142  p_ele_EoPoutVsPhi->GetYaxis()->SetTitle("<E_{seed}/P_{out}>");
1143  p_ele_EoPoutVsPhi->Write();
1144  TProfile *p_ele_EeleOPoutVsEta = h_ele_EeleOPoutVsEta->ProfileX();
1145  p_ele_EeleOPoutVsEta->SetTitle("mean ele Eele/pout vs eta");
1146  p_ele_EeleOPoutVsEta->GetXaxis()->SetTitle("#eta");
1147  p_ele_EeleOPoutVsEta->GetYaxis()->SetTitle("<E_{ele}/P_{out}>");
1148  p_ele_EeleOPoutVsEta->Write();
1149  TProfile *p_ele_EeleOPoutVsPhi = h_ele_EeleOPoutVsPhi->ProfileX();
1150  p_ele_EeleOPoutVsPhi->SetTitle("mean ele Eele/pout vs phi");
1151  p_ele_EeleOPoutVsPhi->GetXaxis()->SetTitle("#phi (rad)");
1152  p_ele_EeleOPoutVsPhi->GetYaxis()->SetTitle("<E_{ele}/P_{out}>");
1153  p_ele_EeleOPoutVsPhi->Write();
1154  TProfile *p_ele_HoEVsEta = h_ele_HoEVsEta->ProfileX();
1155  p_ele_HoEVsEta->GetXaxis()->SetTitle("#eta");
1156  p_ele_HoEVsEta->GetYaxis()->SetTitle("<H/E>");
1157  p_ele_HoEVsEta->Write();
1158  TProfile *p_ele_HoEVsPhi = h_ele_HoEVsPhi->ProfileX();
1159  p_ele_HoEVsPhi->GetXaxis()->SetTitle("#phi (rad)");
1160  p_ele_HoEVsPhi->GetYaxis()->SetTitle("<H/E>");
1161  p_ele_HoEVsPhi->Write();
1162  TProfile *p_ele_chi2VsEta = h_ele_chi2VsEta->ProfileX();
1163  p_ele_chi2VsEta->GetXaxis()->SetTitle("#eta");
1164  p_ele_chi2VsEta->GetYaxis()->SetTitle("<#Chi^{2}>");
1165  p_ele_chi2VsEta->Write();
1166  TProfile *p_ele_chi2VsPhi = h_ele_chi2VsPhi->ProfileX();
1167  p_ele_chi2VsPhi->GetXaxis()->SetTitle("#phi (rad)");
1168  p_ele_chi2VsPhi->GetYaxis()->SetTitle("<#Chi^{2}>");
1169  p_ele_chi2VsPhi->Write();
1170  TProfile *p_ele_foundHitsVsEta = h_ele_foundHitsVsEta->ProfileX();
1171  p_ele_foundHitsVsEta->GetXaxis()->SetTitle("#eta");
1172  p_ele_foundHitsVsEta->GetYaxis()->SetTitle("<N_{hits}>");
1173  p_ele_foundHitsVsEta->Write();
1174  TProfile *p_ele_foundHitsVsPhi = h_ele_foundHitsVsPhi->ProfileX();
1175  p_ele_foundHitsVsPhi->GetXaxis()->SetTitle("#phi (rad)");
1176  p_ele_foundHitsVsPhi->GetYaxis()->SetTitle("<N_{hits}>");
1177  p_ele_foundHitsVsPhi->Write();
1178  TProfile *p_ele_lostHitsVsEta = h_ele_lostHitsVsEta->ProfileX();
1179  p_ele_lostHitsVsEta->GetXaxis()->SetTitle("#eta");
1180  p_ele_lostHitsVsEta->GetYaxis()->SetTitle("<N_{hits}>");
1181  p_ele_lostHitsVsEta->Write();
1182  TProfile *p_ele_lostHitsVsPhi = h_ele_lostHitsVsPhi->ProfileX();
1183  p_ele_lostHitsVsPhi->GetXaxis()->SetTitle("#phi (rad)");
1184  p_ele_lostHitsVsPhi->GetYaxis()->SetTitle("<N_{hits}>");
1185  p_ele_lostHitsVsPhi->Write();
1186  TProfile *p_ele_vertexTIPVsEta = h_ele_vertexTIPVsEta->ProfileX();
1187  p_ele_vertexTIPVsEta->SetTitle("mean tip (wrt gen vtx) vs eta");
1188  p_ele_vertexTIPVsEta->GetXaxis()->SetTitle("#eta");
1189  p_ele_vertexTIPVsEta->GetYaxis()->SetTitle("<TIP> (cm)");
1190  p_ele_vertexTIPVsEta->Write();
1191  TProfile *p_ele_vertexTIPVsPhi = h_ele_vertexTIPVsPhi->ProfileX();
1192  p_ele_vertexTIPVsPhi->SetTitle("mean tip (wrt gen vtx) vs phi");
1193  p_ele_vertexTIPVsPhi->GetXaxis()->SetTitle("#phi");
1194  p_ele_vertexTIPVsPhi->GetYaxis()->SetTitle("<TIP> (cm)");
1195  p_ele_vertexTIPVsPhi->Write();
1196  TProfile *p_ele_vertexTIPVsPt = h_ele_vertexTIPVsPt->ProfileX();
1197  p_ele_vertexTIPVsPt->SetTitle("mean tip (wrt gen vtx) vs phi");
1198  p_ele_vertexTIPVsPt->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1199  p_ele_vertexTIPVsPt->GetYaxis()->SetTitle("<TIP> (cm)");
1200  p_ele_vertexTIPVsPt->Write();
1201 
1202  // mc truth
1203 
1204  h_matchingObjectNum->Write();
1205 
1206  // rec event
1207 
1208  histNum_->Write();
1209 
1210  // mc
1211  h_matchingObjectEta->Write();
1212  h_matchingObjectAbsEta->Write();
1213  h_matchingObjectP->Write();
1214  h_matchingObjectPt->Write();
1215  h_matchingObjectPhi->Write();
1216  h_matchingObjectZ->Write();
1217 
1218  h_ele_mee_all->Write();
1219  h_ele_mee_os->Write();
1220  h_ele_mee_os_ebeb->Write();
1221  h_ele_mee_os_ebee->Write();
1222  h_ele_mee_os_eeee->Write();
1223  h_ele_mee_os_gg->Write();
1224  h_ele_mee_os_gb->Write();
1225  h_ele_mee_os_bb->Write();
1226  h_ele_E2mnE1vsMee_all->Write();
1227  h_ele_E2mnE1vsMee_egeg_all->Write();
1228 
1229  // matched electrons
1230  h_ele_charge->Write();
1231  h_ele_chargeVsEta->Write();
1232  h_ele_chargeVsPhi->Write();
1233  h_ele_chargeVsPt->Write();
1234  h_ele_vertexP->Write();
1235  h_ele_vertexPt->Write();
1236  h_ele_Et->Write();
1237  h_ele_vertexPtVsEta->Write();
1238  h_ele_vertexPtVsPhi->Write();
1240  h_ele_vertexEta->Write();
1241  h_ele_vertexEtaVsPhi->Write();
1245  h_ele_vertexPhi->Write();
1246  h_ele_vertexX->Write();
1247  h_ele_vertexY->Write();
1248  h_ele_vertexZ->Write();
1249  h_ele_vertexTIP->Write();
1251  h_ele_vertexTIPVsEta->Write();
1252  h_ele_vertexTIPVsPhi->Write();
1253  h_ele_vertexTIPVsPt->Write();
1272 
1273  // matched electron, superclusters
1274  histSclEn_->Write();
1279  histSclEt_->Write();
1280  histSclEtVsEta_->Write();
1281  histSclEtVsPhi_->Write();
1282  histSclEtaVsPhi_->Write();
1283  histSclEta_->Write();
1284  histSclPhi_->Write();
1285  histSclSigEtaEta_->Write();
1286  histSclSigIEtaIEta_barrel_->Write();
1287  histSclSigIEtaIEta_endcaps_->Write();
1288  histSclE1x5_->Write();
1289  histSclE1x5_barrel_->Write();
1290  histSclE1x5_endcaps_->Write();
1291  histSclE2x5max_->Write();
1292  histSclE2x5max_barrel_->Write();
1293  histSclE2x5max_endcaps_->Write();
1294  histSclE5x5_->Write();
1295  histSclE5x5_barrel_->Write();
1296  histSclE5x5_endcaps_->Write();
1297 
1298  // matched electron, gsf tracks
1299  h_ele_ambiguousTracks->Write();
1300  h_ele_ambiguousTracksVsEta->Write();
1301  h_ele_ambiguousTracksVsPhi->Write();
1302  h_ele_ambiguousTracksVsPt->Write();
1303  h_ele_foundHits->Write();
1304  h_ele_foundHitsVsEta->Write();
1305  h_ele_foundHitsVsPhi->Write();
1306  h_ele_foundHitsVsPt->Write();
1307  h_ele_lostHits->Write();
1308  h_ele_lostHitsVsEta->Write();
1309  h_ele_lostHitsVsPhi->Write();
1310  h_ele_lostHitsVsPt->Write();
1311  h_ele_chi2->Write();
1312  h_ele_chi2VsEta->Write();
1313  h_ele_chi2VsPhi->Write();
1314  h_ele_chi2VsPt->Write();
1315  h_ele_PinMnPout->Write();
1316  h_ele_PinMnPout_mode->Write();
1317  h_ele_PinMnPoutVsEta_mode->Write();
1318  h_ele_PinMnPoutVsPhi_mode->Write();
1319  h_ele_PinMnPoutVsPt_mode->Write();
1320  h_ele_PinMnPoutVsE_mode->Write();
1321  h_ele_PinMnPoutVsChi2_mode->Write();
1322  h_ele_outerP->Write();
1323  h_ele_outerP_mode->Write();
1324  h_ele_outerPVsEta_mode->Write();
1325  h_ele_outerPt->Write();
1326  h_ele_outerPt_mode->Write();
1327  h_ele_outerPtVsEta_mode->Write();
1328  h_ele_outerPtVsPhi_mode->Write();
1329  h_ele_outerPtVsPt_mode->Write();
1330 
1331  // matched electrons, matching
1332  h_ele_EoP->Write();
1333  h_ele_EoPVsEta->Write();
1334  h_ele_EoPVsPhi->Write();
1335  h_ele_EoPVsE->Write();
1336  h_ele_EseedOP->Write();
1337  h_ele_EseedOPVsEta->Write();
1338  h_ele_EseedOPVsPhi->Write();
1339  h_ele_EseedOPVsE->Write();
1340  h_ele_EoPout->Write();
1341  h_ele_EoPoutVsEta->Write();
1342  h_ele_EoPoutVsPhi->Write();
1343  h_ele_EoPoutVsE->Write();
1344  h_ele_EeleOPout->Write();
1345  h_ele_EeleOPoutVsEta->Write();
1346  h_ele_EeleOPoutVsPhi->Write();
1347  h_ele_EeleOPoutVsE->Write();
1348  h_ele_dEtaSc_propVtx->Write();
1349  h_ele_dEtaScVsEta_propVtx->Write();
1350  h_ele_dEtaScVsPhi_propVtx->Write();
1351  h_ele_dEtaScVsPt_propVtx->Write();
1352  h_ele_dPhiSc_propVtx->Write();
1353  h_ele_dPhiScVsEta_propVtx->Write();
1354  h_ele_dPhiScVsPhi_propVtx->Write();
1355  h_ele_dPhiScVsPt_propVtx->Write();
1356  h_ele_dEtaCl_propOut->Write();
1357  h_ele_dEtaClVsEta_propOut->Write();
1358  h_ele_dEtaClVsPhi_propOut->Write();
1359  h_ele_dEtaClVsPt_propOut->Write();
1360  h_ele_dPhiCl_propOut->Write();
1361  h_ele_dPhiClVsEta_propOut->Write();
1362  h_ele_dPhiClVsPhi_propOut->Write();
1363  h_ele_dPhiClVsPt_propOut->Write();
1364  h_ele_dEtaEleCl_propOut->Write();
1367  h_ele_dEtaEleClVsPt_propOut->Write();
1368  h_ele_dPhiEleCl_propOut->Write();
1371  h_ele_dPhiEleClVsPt_propOut->Write();
1372  h_ele_HoE->Write();
1373  h_ele_HoE_fiducial->Write();
1374  h_ele_HoEVsEta->Write();
1375  h_ele_HoEVsPhi->Write();
1376  h_ele_HoEVsE->Write();
1377 
1378  h_ele_seed_dphi2_->Write();
1379  h_ele_seed_subdet2_->Write();
1380  TProfile *p_ele_seed_dphi2VsEta_ = h_ele_seed_dphi2VsEta_->ProfileX();
1381  p_ele_seed_dphi2VsEta_->SetTitle("mean ele seed dphi 2nd layer vs eta");
1382  p_ele_seed_dphi2VsEta_->GetXaxis()->SetTitle("#eta");
1383  p_ele_seed_dphi2VsEta_->GetYaxis()->SetTitle("<#phi_{pred} - #phi_{hit}, 2nd layer> (rad)");
1384  p_ele_seed_dphi2VsEta_->SetMinimum(-0.004);
1385  p_ele_seed_dphi2VsEta_->SetMaximum(0.004);
1386  p_ele_seed_dphi2VsEta_->Write();
1387  TProfile *p_ele_seed_dphi2VsPt_ = h_ele_seed_dphi2VsPt_->ProfileX();
1388  p_ele_seed_dphi2VsPt_->SetTitle("mean ele seed dphi 2nd layer vs pt");
1389  p_ele_seed_dphi2VsPt_->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1390  p_ele_seed_dphi2VsPt_->GetYaxis()->SetTitle("<#phi_{pred} - #phi_{hit}, 2nd layer> (rad)");
1391  p_ele_seed_dphi2VsPt_->Write();
1392  p_ele_seed_dphi2VsPt_->SetMinimum(-0.004);
1393  p_ele_seed_dphi2VsPt_->SetMaximum(0.004);
1394  h_ele_seed_drz2_->Write();
1395  TProfile *p_ele_seed_drz2VsEta_ = h_ele_seed_drz2VsEta_->ProfileX();
1396  p_ele_seed_drz2VsEta_->SetTitle("mean ele seed dr(dz) 2nd layer vs eta");
1397  p_ele_seed_drz2VsEta_->GetXaxis()->SetTitle("#eta");
1398  p_ele_seed_drz2VsEta_->GetYaxis()->SetTitle("<r(z)_{pred} - r(z)_{hit}, 2nd layer> (cm)");
1399  p_ele_seed_drz2VsEta_->SetMinimum(-0.15);
1400  p_ele_seed_drz2VsEta_->SetMaximum(0.15);
1401  p_ele_seed_drz2VsEta_->Write();
1402  TProfile *p_ele_seed_drz2VsPt_ = h_ele_seed_drz2VsPt_->ProfileX();
1403  p_ele_seed_drz2VsPt_->SetTitle("mean ele seed dr(dz) 2nd layer vs pt");
1404  p_ele_seed_drz2VsPt_->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1405  p_ele_seed_drz2VsPt_->GetYaxis()->SetTitle("<r(z)_{pred} - r(z)_{hit}, 2nd layer> (cm)");
1406  p_ele_seed_drz2VsPt_->SetMinimum(-0.15);
1407  p_ele_seed_drz2VsPt_->SetMaximum(0.15);
1408  p_ele_seed_drz2VsPt_->Write();
1409 
1410  // classes
1411  h_ele_classes->Write();
1412  h_ele_eta->Write();
1413  h_ele_eta_golden->Write();
1414  h_ele_eta_bbrem->Write();
1415  h_ele_eta_narrow->Write();
1416  h_ele_eta_shower->Write();
1417  h_ele_PinVsPoutGolden_mode->Write();
1419  h_ele_PinVsPoutGolden_mean->Write();
1429 
1430  // fbrem
1431  h_ele_fbrem->Write();
1432  h_ele_fbremVsEta_mode->Write();
1433  h_ele_fbremVsEta_mean->Write();
1434  h_ele_etaEff->Write();
1435  h_ele_zEff->Write();
1436  h_ele_phiEff->Write();
1437  h_ele_absetaEff->Write();
1438  h_ele_ptEff->Write();
1439  h_ele_eta_goldenFrac->Write();
1440  h_ele_eta_bbremFrac->Write();
1441  h_ele_eta_narrowFrac->Write();
1442  h_ele_eta_showerFrac->Write();
1443  h_ele_xOverX0VsEta->Write();
1444 
1445  // e/g et pflow electrons
1446  h_ele_mva->Write();
1447  h_ele_provenance->Write();
1448 
1449  // isolation
1450  h_ele_tkSumPt_dr03->GetXaxis()->SetTitle("TkIsoSum, cone 0.3 (GeV/c)");
1451  h_ele_tkSumPt_dr03->GetYaxis()->SetTitle("Events");
1452  h_ele_tkSumPt_dr03->Write();
1453  h_ele_ecalRecHitSumEt_dr03->GetXaxis()->SetTitle("EcalIsoSum, cone 0.3 (GeV)");
1454  h_ele_ecalRecHitSumEt_dr03->GetYaxis()->SetTitle("Events");
1455  h_ele_ecalRecHitSumEt_dr03->Write();
1456  h_ele_hcalDepth1TowerSumEt_dr03->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.3 (GeV)");
1457  h_ele_hcalDepth1TowerSumEt_dr03->GetYaxis()->SetTitle("Events");
1459  h_ele_hcalDepth2TowerSumEt_dr03->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.3 (GeV)");
1460  h_ele_hcalDepth2TowerSumEt_dr03->GetYaxis()->SetTitle("Events");
1462  h_ele_tkSumPt_dr04->GetXaxis()->SetTitle("TkIsoSum, cone 0.4 (GeV/c)");
1463  h_ele_tkSumPt_dr04->GetYaxis()->SetTitle("Events");
1464  h_ele_tkSumPt_dr04->Write();
1465  h_ele_ecalRecHitSumEt_dr04->GetXaxis()->SetTitle("EcalIsoSum, cone 0.4 (GeV)");
1466  h_ele_ecalRecHitSumEt_dr04->GetYaxis()->SetTitle("Events");
1467  h_ele_ecalRecHitSumEt_dr04->Write();
1468  h_ele_hcalDepth1TowerSumEt_dr04->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.4 (GeV)");
1469  h_ele_hcalDepth1TowerSumEt_dr04->GetYaxis()->SetTitle("Events");
1471  h_ele_hcalDepth2TowerSumEt_dr04->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.4 (GeV)");
1472  h_ele_hcalDepth2TowerSumEt_dr04->GetYaxis()->SetTitle("Events");
1474 }
1475 
1477  std::cout << "analyzing new event " << std::endl;
1478  nEvents_++;
1479 
1480  // check event pass requested triggers if any
1481  if (!trigger(iEvent))
1482  return;
1483 
1484  std::cout << "new event passing trigger " << std::endl;
1485  nAfterTrigger_++;
1486 
1487  // get reco electrons
1489  iEvent.getByLabel(electronCollection_, gsfElectrons);
1490  edm::LogInfo("") << "\n\n =================> Treating event " << iEvent.id() << " Number of electrons "
1491  << gsfElectrons.product()->size();
1492 
1493  // get reco supercluster collection
1495  iEvent.getByLabel(matchingObjectCollection_, recoClusters);
1496 
1497  // get the beamspot from the Event:
1498  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
1499  iEvent.getByLabel(beamSpot_, recoBeamSpotHandle);
1500  const BeamSpot bs = *recoBeamSpotHandle;
1501 
1502  histNum_->Fill((*gsfElectrons).size());
1503 
1504  // selected rec electrons
1505  for (reco::GsfElectronCollection::const_iterator gsfIter = gsfElectrons->begin(); gsfIter != gsfElectrons->end();
1506  gsfIter++) {
1507  // select electrons
1508  if (gsfIter->superCluster()->energy() / cosh(gsfIter->superCluster()->eta()) < minEt_)
1509  continue;
1510  if (std::abs(gsfIter->eta()) > maxAbsEta_)
1511  continue;
1512  if (gsfIter->pt() < minPt_)
1513  continue;
1514 
1515  if (gsfIter->isEB() && isEE_)
1516  continue;
1517  if (gsfIter->isEE() && isEB_)
1518  continue;
1519  if (gsfIter->isEBEEGap() && isNotEBEEGap_)
1520  continue;
1521 
1522  if (gsfIter->ecalDrivenSeed() && isTrackerDriven_)
1523  continue;
1524  if (gsfIter->trackerDrivenSeed() && isEcalDriven_)
1525  continue;
1526 
1527  if (gsfIter->isEB() && gsfIter->eSuperClusterOverP() < eOverPMinBarrel_)
1528  continue;
1529  if (gsfIter->isEB() && gsfIter->eSuperClusterOverP() > eOverPMaxBarrel_)
1530  continue;
1531  if (gsfIter->isEE() && gsfIter->eSuperClusterOverP() < eOverPMinEndcaps_)
1532  continue;
1533  if (gsfIter->isEE() && gsfIter->eSuperClusterOverP() > eOverPMaxEndcaps_)
1534  continue;
1535  if (gsfIter->isEB() && std::abs(gsfIter->deltaEtaSuperClusterTrackAtVtx()) < dEtaMinBarrel_)
1536  continue;
1537  if (gsfIter->isEB() && std::abs(gsfIter->deltaEtaSuperClusterTrackAtVtx()) > dEtaMaxBarrel_)
1538  continue;
1539  if (gsfIter->isEE() && std::abs(gsfIter->deltaEtaSuperClusterTrackAtVtx()) < dEtaMinEndcaps_)
1540  continue;
1541  if (gsfIter->isEE() && std::abs(gsfIter->deltaEtaSuperClusterTrackAtVtx()) > dEtaMaxEndcaps_)
1542  continue;
1543  if (gsfIter->isEB() && std::abs(gsfIter->deltaPhiSuperClusterTrackAtVtx()) < dPhiMinBarrel_)
1544  continue;
1545  if (gsfIter->isEB() && std::abs(gsfIter->deltaPhiSuperClusterTrackAtVtx()) > dPhiMaxBarrel_)
1546  continue;
1547  if (gsfIter->isEE() && std::abs(gsfIter->deltaPhiSuperClusterTrackAtVtx()) < dPhiMinEndcaps_)
1548  continue;
1549  if (gsfIter->isEE() && std::abs(gsfIter->deltaPhiSuperClusterTrackAtVtx()) > dPhiMaxEndcaps_)
1550  continue;
1551  if (gsfIter->isEB() && gsfIter->scSigmaIEtaIEta() < sigIetaIetaMinBarrel_)
1552  continue;
1553  if (gsfIter->isEB() && gsfIter->scSigmaIEtaIEta() > sigIetaIetaMaxBarrel_)
1554  continue;
1555  if (gsfIter->isEE() && gsfIter->scSigmaIEtaIEta() < sigIetaIetaMinEndcaps_)
1556  continue;
1557  if (gsfIter->isEE() && gsfIter->scSigmaIEtaIEta() > sigIetaIetaMaxEndcaps_)
1558  continue;
1559  if (gsfIter->isEB() && gsfIter->hadronicOverEm() > hadronicOverEmMaxBarrel_)
1560  continue;
1561  if (gsfIter->isEE() && gsfIter->hadronicOverEm() > hadronicOverEmMaxEndcaps_)
1562  continue;
1563  if (gsfIter->mva_e_pi() < mvaMin_)
1564  continue;
1565 
1566  double d = (gsfIter->vertex().x() - bs.position().x()) * (gsfIter->vertex().x() - bs.position().x()) +
1567  (gsfIter->vertex().y() - bs.position().y()) * (gsfIter->vertex().y() - bs.position().y());
1568  d = sqrt(d);
1569  if (gsfIter->isEB() && d > tipMaxBarrel_)
1570  continue;
1571  if (gsfIter->isEE() && d > tipMaxEndcaps_)
1572  continue;
1573 
1574  if (gsfIter->dr03TkSumPt() > tkIso03Max_)
1575  continue;
1576  if (gsfIter->isEB() && gsfIter->dr03HcalDepth1TowerSumEt() > hcalIso03Depth1MaxBarrel_)
1577  continue;
1578  if (gsfIter->isEE() && gsfIter->dr03HcalDepth1TowerSumEt() > hcalIso03Depth1MaxEndcaps_)
1579  continue;
1580  if (gsfIter->isEE() && gsfIter->dr03HcalDepth2TowerSumEt() > hcalIso03Depth2MaxEndcaps_)
1581  continue;
1582  if (gsfIter->isEB() && gsfIter->dr03EcalRecHitSumEt() > ecalIso03MaxBarrel_)
1583  continue;
1584  if (gsfIter->isEE() && gsfIter->dr03EcalRecHitSumEt() > ecalIso03MaxEndcaps_)
1585  continue;
1586 
1587  // electron related distributions
1588  h_ele_charge->Fill(gsfIter->charge());
1589  h_ele_chargeVsEta->Fill(gsfIter->eta(), gsfIter->charge());
1590  h_ele_chargeVsPhi->Fill(gsfIter->phi(), gsfIter->charge());
1591  h_ele_chargeVsPt->Fill(gsfIter->pt(), gsfIter->charge());
1592  h_ele_vertexP->Fill(gsfIter->p());
1593  h_ele_vertexPt->Fill(gsfIter->pt());
1594  h_ele_Et->Fill(gsfIter->superCluster()->energy() / cosh(gsfIter->superCluster()->eta()));
1595  h_ele_vertexPtVsEta->Fill(gsfIter->eta(), gsfIter->pt());
1596  h_ele_vertexPtVsPhi->Fill(gsfIter->phi(), gsfIter->pt());
1597  h_ele_vertexEta->Fill(gsfIter->eta());
1598 
1599  h_ele_vertexEtaVsPhi->Fill(gsfIter->phi(), gsfIter->eta());
1600  h_ele_vertexPhi->Fill(gsfIter->phi());
1601  h_ele_vertexX->Fill(gsfIter->vertex().x());
1602  h_ele_vertexY->Fill(gsfIter->vertex().y());
1603  h_ele_vertexZ->Fill(gsfIter->vertex().z());
1604  h_ele_vertexTIP->Fill(d);
1605  h_ele_vertexTIPVsEta->Fill(gsfIter->eta(), d);
1606  h_ele_vertexTIPVsPhi->Fill(gsfIter->phi(), d);
1607  h_ele_vertexTIPVsPt->Fill(gsfIter->pt(), d);
1608 
1609  // supercluster related distributions
1610  reco::SuperClusterRef sclRef = gsfIter->superCluster();
1611  if (!gsfIter->ecalDrivenSeed() && gsfIter->trackerDrivenSeed())
1612  sclRef = gsfIter->parentSuperCluster();
1613  histSclEn_->Fill(sclRef->energy());
1614  double R = TMath::Sqrt(sclRef->x() * sclRef->x() + sclRef->y() * sclRef->y() + sclRef->z() * sclRef->z());
1615  double Rt = TMath::Sqrt(sclRef->x() * sclRef->x() + sclRef->y() * sclRef->y());
1616  histSclEt_->Fill(sclRef->energy() * (Rt / R));
1617  histSclEtVsEta_->Fill(sclRef->eta(), sclRef->energy() * (Rt / R));
1618  histSclEtVsPhi_->Fill(sclRef->phi(), sclRef->energy() * (Rt / R));
1619  histSclEta_->Fill(sclRef->eta());
1620  histSclEtaVsPhi_->Fill(sclRef->phi(), sclRef->eta());
1621  histSclPhi_->Fill(sclRef->phi());
1622  histSclSigEtaEta_->Fill(gsfIter->scSigmaEtaEta());
1623  if (gsfIter->isEB())
1624  histSclSigIEtaIEta_barrel_->Fill(gsfIter->scSigmaIEtaIEta());
1625  if (gsfIter->isEE())
1626  histSclSigIEtaIEta_endcaps_->Fill(gsfIter->scSigmaIEtaIEta());
1627  histSclE1x5_->Fill(gsfIter->scE1x5());
1628  if (gsfIter->isEB())
1629  histSclE1x5_barrel_->Fill(gsfIter->scE1x5());
1630  if (gsfIter->isEE())
1631  histSclE1x5_endcaps_->Fill(gsfIter->scE1x5());
1632  histSclE2x5max_->Fill(gsfIter->scE2x5Max());
1633  if (gsfIter->isEB())
1634  histSclE2x5max_barrel_->Fill(gsfIter->scE2x5Max());
1635  if (gsfIter->isEE())
1636  histSclE2x5max_endcaps_->Fill(gsfIter->scE2x5Max());
1637  histSclE5x5_->Fill(gsfIter->scE5x5());
1638  if (gsfIter->isEB())
1639  histSclE5x5_barrel_->Fill(gsfIter->scE5x5());
1640  if (gsfIter->isEE())
1641  histSclE5x5_endcaps_->Fill(gsfIter->scE5x5());
1642 
1643  // track related distributions
1644  h_ele_ambiguousTracks->Fill(gsfIter->ambiguousGsfTracksSize());
1645  h_ele_ambiguousTracksVsEta->Fill(gsfIter->eta(), gsfIter->ambiguousGsfTracksSize());
1646  h_ele_ambiguousTracksVsPhi->Fill(gsfIter->phi(), gsfIter->ambiguousGsfTracksSize());
1647  h_ele_ambiguousTracksVsPt->Fill(gsfIter->pt(), gsfIter->ambiguousGsfTracksSize());
1648  if (!readAOD_) { // track extra does not exist in AOD
1649  h_ele_foundHits->Fill(gsfIter->gsfTrack()->numberOfValidHits());
1650  h_ele_foundHitsVsEta->Fill(gsfIter->eta(), gsfIter->gsfTrack()->numberOfValidHits());
1651  h_ele_foundHitsVsPhi->Fill(gsfIter->phi(), gsfIter->gsfTrack()->numberOfValidHits());
1652  h_ele_foundHitsVsPt->Fill(gsfIter->pt(), gsfIter->gsfTrack()->numberOfValidHits());
1653  h_ele_lostHits->Fill(gsfIter->gsfTrack()->numberOfLostHits());
1654  h_ele_lostHitsVsEta->Fill(gsfIter->eta(), gsfIter->gsfTrack()->numberOfLostHits());
1655  h_ele_lostHitsVsPhi->Fill(gsfIter->phi(), gsfIter->gsfTrack()->numberOfLostHits());
1656  h_ele_lostHitsVsPt->Fill(gsfIter->pt(), gsfIter->gsfTrack()->numberOfLostHits());
1657  h_ele_chi2->Fill(gsfIter->gsfTrack()->normalizedChi2());
1658  h_ele_chi2VsEta->Fill(gsfIter->eta(), gsfIter->gsfTrack()->normalizedChi2());
1659  h_ele_chi2VsPhi->Fill(gsfIter->phi(), gsfIter->gsfTrack()->normalizedChi2());
1660  h_ele_chi2VsPt->Fill(gsfIter->pt(), gsfIter->gsfTrack()->normalizedChi2());
1661  }
1662  // from gsf track interface, hence using mean
1663  if (!readAOD_) { // track extra does not exist in AOD
1664  h_ele_PinMnPout->Fill(gsfIter->gsfTrack()->innerMomentum().R() - gsfIter->gsfTrack()->outerMomentum().R());
1665  h_ele_outerP->Fill(gsfIter->gsfTrack()->outerMomentum().R());
1666  h_ele_outerPt->Fill(gsfIter->gsfTrack()->outerMomentum().Rho());
1667  }
1668  // from electron interface, hence using mode
1669  h_ele_PinMnPout_mode->Fill(gsfIter->trackMomentumAtVtx().R() - gsfIter->trackMomentumOut().R());
1670  h_ele_PinMnPoutVsEta_mode->Fill(gsfIter->eta(),
1671  gsfIter->trackMomentumAtVtx().R() - gsfIter->trackMomentumOut().R());
1672  h_ele_PinMnPoutVsPhi_mode->Fill(gsfIter->phi(),
1673  gsfIter->trackMomentumAtVtx().R() - gsfIter->trackMomentumOut().R());
1674  h_ele_PinMnPoutVsPt_mode->Fill(gsfIter->pt(), gsfIter->trackMomentumAtVtx().R() - gsfIter->trackMomentumOut().R());
1675  h_ele_PinMnPoutVsE_mode->Fill(gsfIter->caloEnergy(),
1676  gsfIter->trackMomentumAtVtx().R() - gsfIter->trackMomentumOut().R());
1677  if (!readAOD_) // track extra does not exist in AOD
1678  h_ele_PinMnPoutVsChi2_mode->Fill(gsfIter->gsfTrack()->normalizedChi2(),
1679  gsfIter->trackMomentumAtVtx().R() - gsfIter->trackMomentumOut().R());
1680  h_ele_outerP_mode->Fill(gsfIter->trackMomentumOut().R());
1681  h_ele_outerPVsEta_mode->Fill(gsfIter->eta(), gsfIter->trackMomentumOut().R());
1682  h_ele_outerPt_mode->Fill(gsfIter->trackMomentumOut().Rho());
1683  h_ele_outerPtVsEta_mode->Fill(gsfIter->eta(), gsfIter->trackMomentumOut().Rho());
1684  h_ele_outerPtVsPhi_mode->Fill(gsfIter->phi(), gsfIter->trackMomentumOut().Rho());
1685  h_ele_outerPtVsPt_mode->Fill(gsfIter->pt(), gsfIter->trackMomentumOut().Rho());
1686 
1687  if (!readAOD_) { // track extra does not exist in AOD
1688  edm::RefToBase<TrajectorySeed> seed = gsfIter->gsfTrack()->extra()->seedRef();
1689  ElectronSeedRef elseed = seed.castTo<ElectronSeedRef>();
1690  h_ele_seed_dphi2_->Fill(elseed->dPhiNeg(1));
1691  h_ele_seed_dphi2VsEta_->Fill(gsfIter->eta(), elseed->dPhiNeg(1));
1692  h_ele_seed_dphi2VsPt_->Fill(gsfIter->pt(), elseed->dPhiNeg(1));
1693  h_ele_seed_drz2_->Fill(elseed->dRZNeg(1));
1694  h_ele_seed_drz2VsEta_->Fill(gsfIter->eta(), elseed->dRZNeg(1));
1695  h_ele_seed_drz2VsPt_->Fill(gsfIter->pt(), elseed->dRZNeg(1));
1696  h_ele_seed_subdet2_->Fill(elseed->subDet(1));
1697  }
1698  // match distributions
1699  h_ele_EoP->Fill(gsfIter->eSuperClusterOverP());
1700  h_ele_EoPVsEta->Fill(gsfIter->eta(), gsfIter->eSuperClusterOverP());
1701  h_ele_EoPVsPhi->Fill(gsfIter->phi(), gsfIter->eSuperClusterOverP());
1702  h_ele_EoPVsE->Fill(gsfIter->caloEnergy(), gsfIter->eSuperClusterOverP());
1703  h_ele_EseedOP->Fill(gsfIter->eSeedClusterOverP());
1704  h_ele_EseedOPVsEta->Fill(gsfIter->eta(), gsfIter->eSeedClusterOverP());
1705  h_ele_EseedOPVsPhi->Fill(gsfIter->phi(), gsfIter->eSeedClusterOverP());
1706  h_ele_EseedOPVsE->Fill(gsfIter->caloEnergy(), gsfIter->eSeedClusterOverP());
1707  h_ele_EoPout->Fill(gsfIter->eSeedClusterOverPout());
1708  h_ele_EoPoutVsEta->Fill(gsfIter->eta(), gsfIter->eSeedClusterOverPout());
1709  h_ele_EoPoutVsPhi->Fill(gsfIter->phi(), gsfIter->eSeedClusterOverPout());
1710  h_ele_EoPoutVsE->Fill(gsfIter->caloEnergy(), gsfIter->eSeedClusterOverPout());
1711  h_ele_EeleOPout->Fill(gsfIter->eEleClusterOverPout());
1712  h_ele_EeleOPoutVsEta->Fill(gsfIter->eta(), gsfIter->eEleClusterOverPout());
1713  h_ele_EeleOPoutVsPhi->Fill(gsfIter->phi(), gsfIter->eEleClusterOverPout());
1714  h_ele_EeleOPoutVsE->Fill(gsfIter->caloEnergy(), gsfIter->eEleClusterOverPout());
1715  h_ele_dEtaSc_propVtx->Fill(gsfIter->deltaEtaSuperClusterTrackAtVtx());
1716  h_ele_dEtaScVsEta_propVtx->Fill(gsfIter->eta(), gsfIter->deltaEtaSuperClusterTrackAtVtx());
1717  h_ele_dEtaScVsPhi_propVtx->Fill(gsfIter->phi(), gsfIter->deltaEtaSuperClusterTrackAtVtx());
1718  h_ele_dEtaScVsPt_propVtx->Fill(gsfIter->pt(), gsfIter->deltaEtaSuperClusterTrackAtVtx());
1719  h_ele_dPhiSc_propVtx->Fill(gsfIter->deltaPhiSuperClusterTrackAtVtx());
1720  h_ele_dPhiScVsEta_propVtx->Fill(gsfIter->eta(), gsfIter->deltaPhiSuperClusterTrackAtVtx());
1721  h_ele_dPhiScVsPhi_propVtx->Fill(gsfIter->phi(), gsfIter->deltaPhiSuperClusterTrackAtVtx());
1722  h_ele_dPhiScVsPt_propVtx->Fill(gsfIter->pt(), gsfIter->deltaPhiSuperClusterTrackAtVtx());
1723  h_ele_dEtaCl_propOut->Fill(gsfIter->deltaEtaSeedClusterTrackAtCalo());
1724  h_ele_dEtaClVsEta_propOut->Fill(gsfIter->eta(), gsfIter->deltaEtaSeedClusterTrackAtCalo());
1725  h_ele_dEtaClVsPhi_propOut->Fill(gsfIter->phi(), gsfIter->deltaEtaSeedClusterTrackAtCalo());
1726  h_ele_dEtaClVsPt_propOut->Fill(gsfIter->pt(), gsfIter->deltaEtaSeedClusterTrackAtCalo());
1727  h_ele_dPhiCl_propOut->Fill(gsfIter->deltaPhiSeedClusterTrackAtCalo());
1728  h_ele_dPhiClVsEta_propOut->Fill(gsfIter->eta(), gsfIter->deltaPhiSeedClusterTrackAtCalo());
1729  h_ele_dPhiClVsPhi_propOut->Fill(gsfIter->phi(), gsfIter->deltaPhiSeedClusterTrackAtCalo());
1730  h_ele_dPhiClVsPt_propOut->Fill(gsfIter->pt(), gsfIter->deltaPhiSeedClusterTrackAtCalo());
1731  h_ele_dEtaEleCl_propOut->Fill(gsfIter->deltaEtaEleClusterTrackAtCalo());
1732  h_ele_dEtaEleClVsEta_propOut->Fill(gsfIter->eta(), gsfIter->deltaEtaEleClusterTrackAtCalo());
1733  h_ele_dEtaEleClVsPhi_propOut->Fill(gsfIter->phi(), gsfIter->deltaEtaEleClusterTrackAtCalo());
1734  h_ele_dEtaEleClVsPt_propOut->Fill(gsfIter->pt(), gsfIter->deltaEtaEleClusterTrackAtCalo());
1735  h_ele_dPhiEleCl_propOut->Fill(gsfIter->deltaPhiEleClusterTrackAtCalo());
1736  h_ele_dPhiEleClVsEta_propOut->Fill(gsfIter->eta(), gsfIter->deltaPhiEleClusterTrackAtCalo());
1737  h_ele_dPhiEleClVsPhi_propOut->Fill(gsfIter->phi(), gsfIter->deltaPhiEleClusterTrackAtCalo());
1738  h_ele_dPhiEleClVsPt_propOut->Fill(gsfIter->pt(), gsfIter->deltaPhiEleClusterTrackAtCalo());
1739  h_ele_HoE->Fill(gsfIter->hadronicOverEm());
1740  if (!gsfIter->isEBEtaGap() && !gsfIter->isEBPhiGap() && !gsfIter->isEBEEGap() && !gsfIter->isEERingGap() &&
1741  !gsfIter->isEEDeeGap())
1742  h_ele_HoE_fiducial->Fill(gsfIter->hadronicOverEm());
1743  h_ele_HoEVsEta->Fill(gsfIter->eta(), gsfIter->hadronicOverEm());
1744  h_ele_HoEVsPhi->Fill(gsfIter->phi(), gsfIter->hadronicOverEm());
1745  h_ele_HoEVsE->Fill(gsfIter->caloEnergy(), gsfIter->hadronicOverEm());
1746 
1747  //classes
1748  int eleClass = gsfIter->classification();
1749  if (gsfIter->isEE())
1750  eleClass += 10;
1751  h_ele_classes->Fill(eleClass);
1752 
1753  h_ele_eta->Fill(std::abs(gsfIter->eta()));
1754  if (gsfIter->classification() == GsfElectron::GOLDEN)
1755  h_ele_eta_golden->Fill(std::abs(gsfIter->eta()));
1756  if (gsfIter->classification() == GsfElectron::BIGBREM)
1757  h_ele_eta_bbrem->Fill(std::abs(gsfIter->eta()));
1758  //if (gsfIter->classification() == GsfElectron::OLDNARROW) h_ele_eta_narrow ->Fill(std::abs(gsfIter->eta()));
1759  if (gsfIter->classification() == GsfElectron::SHOWERING)
1760  h_ele_eta_shower->Fill(std::abs(gsfIter->eta()));
1761 
1762  //fbrem
1763  double fbrem_mean = 0.;
1764  if (!readAOD_) // track extra does not exist in AOD
1765  fbrem_mean = 1. - gsfIter->gsfTrack()->outerMomentum().R() / gsfIter->gsfTrack()->innerMomentum().R();
1766  double fbrem_mode = gsfIter->fbrem();
1767  h_ele_fbrem->Fill(fbrem_mode);
1768  h_ele_fbremVsEta_mode->Fill(gsfIter->eta(), fbrem_mode);
1769  if (!readAOD_) // track extra does not exist in AOD
1770  h_ele_fbremVsEta_mean->Fill(gsfIter->eta(), fbrem_mean);
1771 
1772  if (gsfIter->classification() == GsfElectron::GOLDEN)
1773  h_ele_PinVsPoutGolden_mode->Fill(gsfIter->trackMomentumOut().R(), gsfIter->trackMomentumAtVtx().R());
1774  if (gsfIter->classification() == GsfElectron::SHOWERING)
1775  h_ele_PinVsPoutShowering_mode->Fill(gsfIter->trackMomentumOut().R(), gsfIter->trackMomentumAtVtx().R());
1776  if (!readAOD_) // track extra does not exist in AOD
1777  if (gsfIter->classification() == GsfElectron::GOLDEN)
1778  h_ele_PinVsPoutGolden_mean->Fill(gsfIter->gsfTrack()->outerMomentum().R(),
1779  gsfIter->gsfTrack()->innerMomentum().R());
1780  if (!readAOD_) // track extra does not exist in AOD
1781  if (gsfIter->classification() == GsfElectron::SHOWERING)
1782  h_ele_PinVsPoutShowering_mean->Fill(gsfIter->gsfTrack()->outerMomentum().R(),
1783  gsfIter->gsfTrack()->innerMomentum().R());
1784  if (gsfIter->classification() == GsfElectron::GOLDEN)
1785  h_ele_PtinVsPtoutGolden_mode->Fill(gsfIter->trackMomentumOut().Rho(), gsfIter->trackMomentumAtVtx().Rho());
1786  if (gsfIter->classification() == GsfElectron::SHOWERING)
1787  h_ele_PtinVsPtoutShowering_mode->Fill(gsfIter->trackMomentumOut().Rho(), gsfIter->trackMomentumAtVtx().Rho());
1788  if (!readAOD_) // track extra does not exist in AOD
1789  if (gsfIter->classification() == GsfElectron::GOLDEN)
1790  h_ele_PtinVsPtoutGolden_mean->Fill(gsfIter->gsfTrack()->outerMomentum().Rho(),
1791  gsfIter->gsfTrack()->innerMomentum().Rho());
1792  if (!readAOD_) // track extra does not exist in AOD
1793  if (gsfIter->classification() == GsfElectron::SHOWERING)
1794  h_ele_PtinVsPtoutShowering_mean->Fill(gsfIter->gsfTrack()->outerMomentum().Rho(),
1795  gsfIter->gsfTrack()->innerMomentum().Rho());
1796 
1797  h_ele_mva->Fill(gsfIter->mva_e_pi());
1798  if (gsfIter->ecalDrivenSeed())
1799  h_ele_provenance->Fill(1.);
1800  if (gsfIter->trackerDrivenSeed())
1801  h_ele_provenance->Fill(-1.);
1802  if (gsfIter->trackerDrivenSeed() || gsfIter->ecalDrivenSeed())
1803  h_ele_provenance->Fill(0.);
1804  if (gsfIter->trackerDrivenSeed() && !gsfIter->ecalDrivenSeed())
1805  h_ele_provenance->Fill(-2.);
1806  if (!gsfIter->trackerDrivenSeed() && gsfIter->ecalDrivenSeed())
1807  h_ele_provenance->Fill(2.);
1808 
1809  h_ele_tkSumPt_dr03->Fill(gsfIter->dr03TkSumPt());
1810  h_ele_ecalRecHitSumEt_dr03->Fill(gsfIter->dr03EcalRecHitSumEt());
1811  h_ele_hcalDepth1TowerSumEt_dr03->Fill(gsfIter->dr03HcalDepth1TowerSumEt());
1812  h_ele_hcalDepth2TowerSumEt_dr03->Fill(gsfIter->dr03HcalDepth2TowerSumEt());
1813  h_ele_tkSumPt_dr04->Fill(gsfIter->dr04TkSumPt());
1814  h_ele_ecalRecHitSumEt_dr04->Fill(gsfIter->dr04EcalRecHitSumEt());
1815  h_ele_hcalDepth1TowerSumEt_dr04->Fill(gsfIter->dr04HcalDepth1TowerSumEt());
1816  h_ele_hcalDepth2TowerSumEt_dr04->Fill(gsfIter->dr04HcalDepth2TowerSumEt());
1817 
1818  float enrj1 = gsfIter->superCluster()->energy();
1819  // mee
1820  for (reco::GsfElectronCollection::const_iterator gsfIter2 = gsfIter + 1; gsfIter2 != gsfElectrons->end();
1821  gsfIter2++) {
1822  math::XYZTLorentzVector p12 = (*gsfIter).p4() + (*gsfIter2).p4();
1823  float mee2 = p12.Dot(p12);
1824  float enrj2 = gsfIter2->superCluster()->energy();
1825  h_ele_mee_all->Fill(sqrt(mee2));
1826  h_ele_E2mnE1vsMee_all->Fill(sqrt(mee2), enrj2 - enrj1);
1827  if (gsfIter->ecalDrivenSeed() && gsfIter2->ecalDrivenSeed())
1828  h_ele_E2mnE1vsMee_egeg_all->Fill(sqrt(mee2), enrj2 - enrj1);
1829  if (gsfIter->charge() * gsfIter2->charge() < 0.) {
1830  h_ele_mee_os->Fill(sqrt(mee2));
1831  if (gsfIter->isEB() && gsfIter2->isEB())
1832  h_ele_mee_os_ebeb->Fill(sqrt(mee2));
1833  if ((gsfIter->isEB() && gsfIter2->isEE()) || (gsfIter->isEE() && gsfIter2->isEB()))
1834  h_ele_mee_os_ebee->Fill(sqrt(mee2));
1835  if (gsfIter->isEE() && gsfIter2->isEE())
1836  h_ele_mee_os_eeee->Fill(sqrt(mee2));
1837  if ((gsfIter->classification()==GsfElectron::GOLDEN && gsfIter2->classification()==GsfElectron::GOLDEN) ||
1838  (gsfIter->classification()==GsfElectron::GOLDEN && gsfIter2->classification()==GsfElectron::BIGBREM) ||
1839  //(gsfIter->classification()==GsfElectron::GOLDEN && gsfIter2->classification()==GsfElectron::OLDNARROW) ||
1840  (gsfIter->classification()==GsfElectron::BIGBREM && gsfIter2->classification()==GsfElectron::GOLDEN) ||
1841  (gsfIter->classification()==GsfElectron::BIGBREM && gsfIter2->classification()==GsfElectron::BIGBREM)/* ||
1842  (gsfIter->classification()==GsfElectron::BIGBREM && gsfIter2->classification()==GsfElectron::OLDNARROW) ||
1843  (gsfIter->classification()==GsfElectron::OLDNARROW && gsfIter2->classification()==GsfElectron::GOLDEN) ||
1844  (gsfIter->classification()==GsfElectron::OLDNARROW && gsfIter2->classification()==GsfElectron::BIGBREM) ||
1845  (gsfIter->classification()==GsfElectron::OLDNARROW && gsfIter2->classification()==GsfElectron::OLDNARROW)*/)
1846  {
1847  h_ele_mee_os_gg->Fill(sqrt(mee2));
1848  } else if ((gsfIter->classification() == GsfElectron::SHOWERING &&
1849  gsfIter2->classification() == GsfElectron::SHOWERING) ||
1850  (gsfIter->classification() == GsfElectron::SHOWERING && gsfIter2->isGap()) ||
1851  (gsfIter->isGap() && gsfIter2->classification() == GsfElectron::SHOWERING) ||
1852  (gsfIter->isGap() && gsfIter2->isGap())) {
1853  h_ele_mee_os_bb->Fill(sqrt(mee2));
1854  } else {
1855  h_ele_mee_os_gb->Fill(sqrt(mee2));
1856  }
1857  }
1858  }
1859  }
1860 
1861  // association matching object-reco electrons
1862  int matchingObjectNum = 0;
1863 
1864  for (reco::SuperClusterCollection::const_iterator moIter = recoClusters->begin(); moIter != recoClusters->end();
1865  moIter++) {
1866  // number of matching objects
1867  matchingObjectNum++;
1868 
1869  if (moIter->energy() / cosh(moIter->eta()) > maxPtMatchingObject_ ||
1870  std::abs(moIter->eta()) > maxAbsEtaMatchingObject_)
1871  continue;
1872 
1873  // suppress the endcaps
1874  //if (std::abs(moIter->eta()) > 1.5) continue;
1875  // select central z
1876  //if ( std::abs((*mcIter)->production_vertex()->position().z())>50.) continue;
1877 
1878  h_matchingObjectEta->Fill(moIter->eta());
1879  h_matchingObjectAbsEta->Fill(std::abs(moIter->eta()));
1880  h_matchingObjectP->Fill(moIter->energy());
1881  h_matchingObjectPt->Fill(moIter->energy() / cosh(moIter->eta()));
1882  h_matchingObjectPhi->Fill(moIter->phi());
1883  h_matchingObjectZ->Fill(moIter->z());
1884 
1885  // looking for the best matching gsf electron
1886  bool okGsfFound = false;
1887  double gsfOkRatio = 999999.;
1888 
1889  // find matching electron
1890  reco::GsfElectron bestGsfElectron;
1891  for (reco::GsfElectronCollection::const_iterator gsfIter = gsfElectrons->begin(); gsfIter != gsfElectrons->end();
1892  gsfIter++) {
1893  // matching with a cone in eta phi
1894  if (matchingCondition_ == "Cone") {
1895  double dphi = gsfIter->phi() - moIter->phi();
1896  if (std::abs(dphi) > CLHEP::pi)
1897  dphi = dphi < 0 ? (CLHEP::twopi) + dphi : dphi - CLHEP::twopi;
1898  double deltaR = sqrt(std::pow((moIter->eta() - gsfIter->eta()), 2) + std::pow(dphi, 2));
1899  if (deltaR < deltaR_) {
1900  //if ( (genPc->pdg_id() == 11) && (gsfIter->charge() < 0.) || (genPc->pdg_id() == -11) &&
1901  //(gsfIter->charge() > 0.) ){
1902  double tmpGsfRatio = gsfIter->p() / moIter->energy();
1903  if (std::abs(tmpGsfRatio - 1) < std::abs(gsfOkRatio - 1)) {
1904  gsfOkRatio = tmpGsfRatio;
1905  bestGsfElectron = *gsfIter;
1906  okGsfFound = true;
1907  }
1908  //}
1909  }
1910  }
1911  } // loop over rec ele to look for the best one
1912 
1913  // analysis when the matching object is matched by a rec electron
1914  if (okGsfFound) {
1915  // generated distributions for matched electrons
1916  h_ele_matchingObjectPt_matched->Fill(moIter->energy() / cosh(moIter->eta()));
1917  h_ele_matchingObjectPhi_matched->Fill(moIter->phi());
1918  h_ele_matchingObjectAbsEta_matched->Fill(std::abs(moIter->eta()));
1919  h_ele_matchingObjectEta_matched->Fill(moIter->eta());
1920  h_ele_matchingObjectZ_matched->Fill(moIter->z());
1921 
1922  // comparison electron vs matching object
1923  h_ele_EtaMnEtamatchingObject_matched->Fill(bestGsfElectron.eta() - moIter->eta());
1924  h_ele_EtaMnEtamatchingObjectVsEta_matched->Fill(bestGsfElectron.eta(), bestGsfElectron.eta() - moIter->eta());
1925  h_ele_EtaMnEtamatchingObjectVsPhi_matched->Fill(bestGsfElectron.phi(), bestGsfElectron.eta() - moIter->eta());
1926  h_ele_EtaMnEtamatchingObjectVsPt_matched->Fill(bestGsfElectron.pt(), bestGsfElectron.eta() - moIter->eta());
1927  h_ele_PhiMnPhimatchingObject_matched->Fill(bestGsfElectron.phi() - moIter->phi());
1928  h_ele_PhiMnPhimatchingObject2_matched->Fill(bestGsfElectron.phi() - moIter->phi());
1929  h_ele_PhiMnPhimatchingObjectVsEta_matched->Fill(bestGsfElectron.eta(), bestGsfElectron.phi() - moIter->phi());
1930  h_ele_PhiMnPhimatchingObjectVsPhi_matched->Fill(bestGsfElectron.phi(), bestGsfElectron.phi() - moIter->phi());
1931  h_ele_PhiMnPhimatchingObjectVsPt_matched->Fill(bestGsfElectron.pt(), bestGsfElectron.phi() - moIter->phi());
1932  h_ele_PoPmatchingObject_matched->Fill(bestGsfElectron.p() / moIter->energy());
1933  h_ele_PtoPtmatchingObject_matched->Fill(bestGsfElectron.pt() / moIter->energy() / cosh(moIter->eta()));
1934  h_ele_PoPmatchingObjectVsEta_matched->Fill(bestGsfElectron.eta(), bestGsfElectron.p() / moIter->energy());
1935  h_ele_PoPmatchingObjectVsPhi_matched->Fill(bestGsfElectron.phi(), bestGsfElectron.p() / moIter->energy());
1936  h_ele_PoPmatchingObjectVsPt_matched->Fill(bestGsfElectron.py(), bestGsfElectron.p() / moIter->energy());
1937  if (bestGsfElectron.isEB())
1938  h_ele_PoPmatchingObject_barrel_matched->Fill(bestGsfElectron.p() / moIter->energy());
1939  if (bestGsfElectron.isEE())
1940  h_ele_PoPmatchingObject_endcaps_matched->Fill(bestGsfElectron.p() / moIter->energy());
1941  if (bestGsfElectron.isEB())
1942  h_ele_PtoPtmatchingObject_barrel_matched->Fill(bestGsfElectron.pt() / moIter->energy() / cosh(moIter->eta()));
1943  if (bestGsfElectron.isEE())
1944  h_ele_PtoPtmatchingObject_endcaps_matched->Fill(bestGsfElectron.pt() / moIter->energy() / cosh(moIter->eta()));
1945 
1946  reco::SuperClusterRef sclRef = bestGsfElectron.superCluster();
1947  if (bestGsfElectron.isEB())
1948  histSclEoEmatchingObject_barrel_matched->Fill(sclRef->energy() / moIter->energy());
1949  if (bestGsfElectron.isEE())
1950  histSclEoEmatchingObject_endcaps_matched->Fill(sclRef->energy() / moIter->energy());
1951  if (bestGsfElectron.isEB())
1952  histSclEoEmatchingObject_barrel_new_matched->Fill(sclRef->energy() / moIter->energy());
1953  if (bestGsfElectron.isEE())
1954  histSclEoEmatchingObject_endcaps_new_matched->Fill(sclRef->energy() / moIter->energy());
1955 
1956  // add here distributions for matched electrons as for all electrons
1957  //..
1958 
1959  } // gsf electron found
1960 
1961  } // loop overmatching object
1962 
1963  h_matchingObjectNum->Fill(matchingObjectNum);
1964 }
1965 
1967  // retreive TriggerResults from the event
1969  e.getByLabel(triggerResults_, triggerResults);
1970 
1971  bool accept = false;
1972 
1973  if (triggerResults.isValid()) {
1974  //std::cout << "TriggerResults found, number of HLT paths: " << triggerResults->size() << std::endl;
1975 
1976  // get trigger names
1977  const edm::TriggerNames &triggerNames = e.triggerNames(*triggerResults);
1978  if (nEvents_ == 1) {
1979  for (unsigned int i = 0; i < triggerNames.size(); i++) {
1980  std::cout << "trigger path= " << triggerNames.triggerName(i) << std::endl;
1981  }
1982  }
1983 
1984  unsigned int n = HLTPathsByName_.size();
1985  for (unsigned int i = 0; i != n; i++) {
1986  HLTPathsByIndex_[i] = triggerNames.triggerIndex(HLTPathsByName_[i]);
1987  }
1988 
1989  // empty input vectors (n==0) means any trigger paths
1990  if (n == 0) {
1991  n = triggerResults->size();
1992  HLTPathsByName_.resize(n);
1993  HLTPathsByIndex_.resize(n);
1994  for (unsigned int i = 0; i != n; i++) {
1995  HLTPathsByName_[i] = triggerNames.triggerName(i);
1996  HLTPathsByIndex_[i] = i;
1997  }
1998  }
1999 
2000  if (nEvents_ == 1) {
2001  if (n > 0) {
2002  std::cout << "HLT trigger paths requested: index, name and valididty:" << std::endl;
2003  for (unsigned int i = 0; i != n; i++) {
2004  bool validity = HLTPathsByIndex_[i] < triggerResults->size();
2005  std::cout << " " << HLTPathsByIndex_[i] << " " << HLTPathsByName_[i] << " " << validity << std::endl;
2006  }
2007  }
2008  }
2009 
2010  // count number of requested HLT paths which have fired
2011  unsigned int fired = 0;
2012  for (unsigned int i = 0; i != n; i++) {
2013  if (HLTPathsByIndex_[i] < triggerResults->size()) {
2014  if (triggerResults->accept(HLTPathsByIndex_[i])) {
2015  fired++;
2016  std::cout << "Fired HLT path= " << HLTPathsByName_[i] << std::endl;
2017  accept = true;
2018  }
2019  }
2020  }
2021  }
2022 
2023  return accept;
2024 }
T getParameter(std::string const &) const
double eta() const final
momentum pseudorapidity
std::vector< unsigned int > HLTPathsByIndex_
void analyze(const edm::Event &e, const edm::EventSetup &c) override
bool accept() const
Has at least one path accepted the event?
double pt() const final
transverse momentum
std::vector< std::string > HLTPathsByName_
Strings::size_type size() const
Definition: TriggerNames.cc:31
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:30
uint16_t size_type
bool isEE() const
Definition: GsfElectron.h:329
bool isEB() const
Definition: GsfElectron.h:328
const Double_t pi
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
int iEvent
Definition: GenABIO.cc:224
unsigned int triggerIndex(std::string const &name) const
Definition: TriggerNames.cc:24
T sqrt(T t)
Definition: SSEVec.h:19
unsigned int size() const
Get number of paths stored.
GsfElectronDataAnalyzer(const edm::ParameterSet &conf)
bool trigger(const edm::Event &e)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static std::string const triggerResults
Definition: EdmProvDump.cc:45
bool isValid() const
Definition: HandleBase.h:70
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:488
d
Definition: ztail.py:151
double p() const final
magnitude of momentum vector
T const * product() const
Definition: Handle.h:69
std::string const & triggerName(unsigned int index) const
Definition: TriggerNames.cc:22
REF castTo() const
Definition: RefToBase.h:257
double py() const final
y coordinate of momentum vector
std::string const & label() const
Definition: InputTag.h:36
edm::EventID id() const
Definition: EventBase.h:59
fixed size matrix
HLT enums.
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:155
const Point & position() const
position
Definition: BeamSpot.h:59
double phi() const final
momentum azimuthal angle
edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
Definition: Event.cc:265
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30