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, Claude Charlot
16 // Created: Mon Mar 27 13:22:06 CEST 2006
17 //
18 //
19 
39 
40 #include "CLHEP/Units/GlobalPhysicalConstants.h"
41 
42 #include "TFile.h"
43 #include "TH1F.h"
44 #include "TH1I.h"
45 #include "TH2F.h"
46 #include "TProfile.h"
47 #include "TTree.h"
48 
49 #include <iostream>
50 
52 public:
53  explicit GsfElectronDataAnalyzer(const edm::ParameterSet &conf);
54 
55  ~GsfElectronDataAnalyzer() override;
56 
57  void beginJob() override;
58  void endJob() override;
59  void analyze(const edm::Event &e, const edm::EventSetup &c) override;
60 
61 private:
62  bool trigger(const edm::Event &e);
63 
64  unsigned int nEvents_;
65  unsigned int nAfterTrigger_;
66 
69 
70  std::vector<std::string> HLTPathsByName_;
71  std::vector<unsigned int> HLTPathsByIndex_;
72 
78  bool readAOD_;
79  // matching
82  double deltaR_;
83 
87 
88  TFile *histfile_;
89  TTree *tree_;
90  float mcEnergy[10], mcEta[10], mcPhi[10], mcPt[10], mcQ[10];
92  float seedMomentum[10], seedEta[10], seedPhi[10], seedPt[10], seedQ[10];
93 
95 
102 
108 
117 
120 
127  TH1F *h_ele_Et;
142 
143  TH1F *histNum_;
144 
145  TH1F *histSclEn_;
150  TH1F *histSclEt_;
154  TH1F *histSclEta_;
155  TH1F *histSclPhi_;
171 
188  TH1F *h_ele_chi2;
194 
220 
229  TH1F *h_ele_EoP;
253 
290 
298 
300  TH1F *h_ele_eta;
305 
306  TH1F *h_ele_HoE;
313 
314  TH1F *h_ele_fbrem;
317 
330 
331  TH1F *h_ele_mva;
333 
342 
343  // electron selection
344  double minEt_;
345  double minPt_;
346  double maxAbsEta_;
347  bool isEB_;
348  bool isEE_;
370  double mvaMin_;
373  double tkIso03Max_;
379 
380  // histos limits and binning
381  double etamin;
382  double etamax;
383  double phimin;
384  double phimax;
385  double ptmax;
386  double pmax;
387  double eopmax;
388  double eopmaxsht;
389  double detamin;
390  double detamax;
391  double dphimin;
392  double dphimax;
393  double detamatchmin;
394  double detamatchmax;
395  double dphimatchmin;
396  double dphimatchmax;
397  double fhitsmax;
398  double lhitsmax;
399  double poptruemin;
400  double poptruemax;
401  double meemin;
402  double meemax;
403  double hoemin;
404  double hoemax;
405  int nbineta;
406  int nbinp;
407  int nbinpt;
409  int nbinphi;
410  int nbinp2D;
411  int nbinpt2D;
414  int nbineop;
418  int nbinxyz;
419  int nbindeta;
420  int nbindphi;
426  int nbinmee;
427  int nbinhoe;
428 };
429 
432 
433 using namespace reco;
434 
436  : beamSpot_(conf.getParameter<edm::InputTag>("beamSpot")) {
437  outputFile_ = conf.getParameter<std::string>("outputFile");
438  histfile_ = new TFile(outputFile_.c_str(), "RECREATE");
439  electronCollection_ = conf.getParameter<edm::InputTag>("electronCollection");
440  readAOD_ = conf.getParameter<bool>("readAOD");
441 
442  matchingObjectCollection_ = conf.getParameter<edm::InputTag>("matchingObjectCollection");
443  matchingCondition_ = conf.getParameter<std::string>("matchingCondition");
444  // currently only one possible matching conditions
445  assert(matchingCondition_ == "Cone");
446  maxPtMatchingObject_ = conf.getParameter<double>("MaxPtMatchingObject");
447  maxAbsEtaMatchingObject_ = conf.getParameter<double>("MaxAbsEtaMatchingObject");
448  deltaR_ = conf.getParameter<double>("DeltaR");
449 
450  triggerResults_ = conf.getParameter<edm::InputTag>("triggerResults");
451  HLTPathsByName_ = conf.getParameter<std::vector<std::string> >("hltPaths");
452  HLTPathsByIndex_.resize(HLTPathsByName_.size());
453 
454  minEt_ = conf.getParameter<double>("MinEt");
455  minPt_ = conf.getParameter<double>("MinPt");
456  maxAbsEta_ = conf.getParameter<double>("MaxAbsEta");
457  isEB_ = conf.getParameter<bool>("SelectEB");
458  isEE_ = conf.getParameter<bool>("SelectEE");
459  isNotEBEEGap_ = conf.getParameter<bool>("SelectNotEBEEGap");
460  isEcalDriven_ = conf.getParameter<bool>("SelectEcalDriven");
461  isTrackerDriven_ = conf.getParameter<bool>("SelectTrackerDriven");
462  eOverPMinBarrel_ = conf.getParameter<double>("MinEOverPBarrel");
463  eOverPMaxBarrel_ = conf.getParameter<double>("MaxEOverPBarrel");
464  eOverPMinEndcaps_ = conf.getParameter<double>("MinEOverPEndcaps");
465  eOverPMaxEndcaps_ = conf.getParameter<double>("MaxEOverPEndcaps");
466  dEtaMinBarrel_ = conf.getParameter<double>("MinDetaBarrel");
467  dEtaMaxBarrel_ = conf.getParameter<double>("MaxDetaBarrel");
468  dEtaMinEndcaps_ = conf.getParameter<double>("MinDetaEndcaps");
469  dEtaMaxEndcaps_ = conf.getParameter<double>("MaxDetaEndcaps");
470  dPhiMinBarrel_ = conf.getParameter<double>("MinDphiBarrel");
471  dPhiMaxBarrel_ = conf.getParameter<double>("MaxDphiBarrel");
472  dPhiMinEndcaps_ = conf.getParameter<double>("MinDphiEndcaps");
473  dPhiMaxEndcaps_ = conf.getParameter<double>("MaxDphiEndcaps");
474  sigIetaIetaMinBarrel_ = conf.getParameter<double>("MinSigIetaIetaBarrel");
475  sigIetaIetaMaxBarrel_ = conf.getParameter<double>("MaxSigIetaIetaBarrel");
476  sigIetaIetaMinEndcaps_ = conf.getParameter<double>("MinSigIetaIetaEndcaps");
477  sigIetaIetaMaxEndcaps_ = conf.getParameter<double>("MaxSigIetaIetaEndcaps");
478  hadronicOverEmMaxBarrel_ = conf.getParameter<double>("MaxHoEBarrel");
479  hadronicOverEmMaxEndcaps_ = conf.getParameter<double>("MaxHoEEndcaps");
480  mvaMin_ = conf.getParameter<double>("MinMVA");
481  tipMaxBarrel_ = conf.getParameter<double>("MaxTipBarrel");
482  tipMaxEndcaps_ = conf.getParameter<double>("MaxTipEndcaps");
483  tkIso03Max_ = conf.getParameter<double>("MaxTkIso03");
484  hcalIso03Depth1MaxBarrel_ = conf.getParameter<double>("MaxHcalIso03Depth1Barrel");
485  hcalIso03Depth1MaxEndcaps_ = conf.getParameter<double>("MaxHcalIso03Depth1Endcaps");
486  hcalIso03Depth2MaxEndcaps_ = conf.getParameter<double>("MaxHcalIso03Depth2Endcaps");
487  ecalIso03MaxBarrel_ = conf.getParameter<double>("MaxEcalIso03Barrel");
488  ecalIso03MaxEndcaps_ = conf.getParameter<double>("MaxEcalIso03Endcaps");
489 
490  edm::ParameterSet pset = conf.getParameter<edm::ParameterSet>("HistosConfigurationData");
491 
492  etamin = pset.getParameter<double>("Etamin");
493  etamax = pset.getParameter<double>("Etamax");
494  phimin = pset.getParameter<double>("Phimin");
495  phimax = pset.getParameter<double>("Phimax");
496  ptmax = pset.getParameter<double>("Ptmax");
497  pmax = pset.getParameter<double>("Pmax");
498  eopmax = pset.getParameter<double>("Eopmax");
499  eopmaxsht = pset.getParameter<double>("Eopmaxsht");
500  detamin = pset.getParameter<double>("Detamin");
501  detamax = pset.getParameter<double>("Detamax");
502  dphimin = pset.getParameter<double>("Dphimin");
503  dphimax = pset.getParameter<double>("Dphimax");
504  detamatchmin = pset.getParameter<double>("Detamatchmin");
505  detamatchmax = pset.getParameter<double>("Detamatchmax");
506  dphimatchmin = pset.getParameter<double>("Dphimatchmin");
507  dphimatchmax = pset.getParameter<double>("Dphimatchmax");
508  fhitsmax = pset.getParameter<double>("Fhitsmax");
509  lhitsmax = pset.getParameter<double>("Lhitsmax");
510  nbineta = pset.getParameter<int>("Nbineta");
511  nbineta2D = pset.getParameter<int>("Nbineta2D");
512  nbinp = pset.getParameter<int>("Nbinp");
513  nbinpt = pset.getParameter<int>("Nbinpt");
514  nbinp2D = pset.getParameter<int>("Nbinp2D");
515  nbinpt2D = pset.getParameter<int>("Nbinpt2D");
516  nbinpteff = pset.getParameter<int>("Nbinpteff");
517  nbinphi = pset.getParameter<int>("Nbinphi");
518  nbinphi2D = pset.getParameter<int>("Nbinphi2D");
519  nbineop = pset.getParameter<int>("Nbineop");
520  nbineop2D = pset.getParameter<int>("Nbineop2D");
521  nbinfhits = pset.getParameter<int>("Nbinfhits");
522  nbinlhits = pset.getParameter<int>("Nbinlhits");
523  nbinxyz = pset.getParameter<int>("Nbinxyz");
524  nbindeta = pset.getParameter<int>("Nbindeta");
525  nbindphi = pset.getParameter<int>("Nbindphi");
526  nbindetamatch = pset.getParameter<int>("Nbindetamatch");
527  nbindphimatch = pset.getParameter<int>("Nbindphimatch");
528  nbindetamatch2D = pset.getParameter<int>("Nbindetamatch2D");
529  nbindphimatch2D = pset.getParameter<int>("Nbindphimatch2D");
530  nbinpoptrue = pset.getParameter<int>("Nbinpoptrue");
531  poptruemin = pset.getParameter<double>("Poptruemin");
532  poptruemax = pset.getParameter<double>("Poptruemax");
533  nbinmee = pset.getParameter<int>("Nbinmee");
534  meemin = pset.getParameter<double>("Meemin");
535  meemax = pset.getParameter<double>("Meemax");
536  nbinhoe = pset.getParameter<int>("Nbinhoe");
537  hoemin = pset.getParameter<double>("Hoemin");
538  hoemax = pset.getParameter<double>("Hoemax");
539 }
540 
542  // do anything here that needs to be done at desctruction time
543  // (e.g. close files, deallocate resources etc.)
544  histfile_->Write();
545  histfile_->Close();
546 }
547 
549  histfile_->cd();
550 
551  nEvents_ = 0;
552  nAfterTrigger_ = 0;
553 
554  // matching object
555  std::string::size_type locSC = matchingObjectCollection_.label().find("SuperCluster", 0);
557  if (locSC != std::string::npos) {
558  std::cout << "Matching objects are SuperClusters " << std::endl;
559  type_ = "SC";
560  } else {
561  std::cout << "Didn't recognize input matching objects!! " << std::endl;
562  }
563 
564  std::string htitle, hlabel;
565  hlabel = "h_" + type_ + "Num";
566  htitle = "# " + type_ + "s";
567  h_matchingObjectNum = new TH1F(hlabel.c_str(), htitle.c_str(), nbinfhits, 0., fhitsmax);
568 
569  // rec event
570 
571  histNum_ = new TH1F("h_recEleNum", "# rec electrons", 20, 0., 20.);
572 
573  // matching object distributions
574  hlabel = "h_" + type_ + "_eta";
575  htitle = type_ + " #eta";
576  h_matchingObjectEta = new TH1F(hlabel.c_str(), htitle.c_str(), nbineta, etamin, etamax);
577  hlabel = "h_" + type_ + "_abseta";
578  htitle = type_ + " |#eta|";
579  h_matchingObjectAbsEta = new TH1F(hlabel.c_str(), htitle.c_str(), nbineta / 2, 0., etamax);
580  hlabel = "h_" + type_ + "_P";
581  htitle = type_ + " p";
582  h_matchingObjectP = new TH1F(hlabel.c_str(), htitle.c_str(), nbinp, 0., pmax);
583  hlabel = "h_" + type_ + "_Pt";
584  htitle = type_ + " pt";
585  h_matchingObjectPt = new TH1F(hlabel.c_str(), htitle.c_str(), nbinpteff, 5., ptmax);
586  hlabel = "h_" + type_ + "_phi";
587  htitle = type_ + " phi";
588  h_matchingObjectPhi = new TH1F(hlabel.c_str(), htitle.c_str(), nbinphi, phimin, phimax);
589  hlabel = "h_" + type_ + "_z";
590  htitle = type_ + " z";
591  h_matchingObjectZ = new TH1F(hlabel.c_str(), htitle.c_str(), nbinxyz, -25, 25);
592 
593  // mee
594  h_ele_mee_all =
595  new TH1F("h_ele_mee_all", "ele pairs invariant mass, all charge combinations", nbinmee, meemin, meemax);
596  h_ele_mee_os = new TH1F("h_ele_mee_os", "ele pairs invariant mass, opposite sign", nbinmee, meemin, meemax);
598  new TH1F("h_ele_mee_os_ebeb", "ele pairs invariant mass, opp. sign, EB-EB", nbinmee, meemin, meemax);
599  h_ele_mee_os_ebeb->Sumw2();
601  new TH1F("h_ele_mee_os_ebee", "ele pairs invariant mass, opp. sign, EB-EE", nbinmee, meemin, meemax);
602  h_ele_mee_os_ebee->Sumw2();
604  new TH1F("h_ele_mee_os_eeee", "ele pairs invariant mass, opp. sign, EE-EE", nbinmee, meemin, meemax);
605  h_ele_mee_os_eeee->Sumw2();
607  new TH1F("h_ele_mee_os_gg", "ele pairs invariant mass, opp. sign, good-good", nbinmee, meemin, meemax);
608  h_ele_mee_os_gg->Sumw2();
610  new TH1F("h_ele_mee_os_gb", "ele pairs invariant mass, opp. sign, good-bad", nbinmee, meemin, meemax);
611  h_ele_mee_os_gb->Sumw2();
613  new TH1F("h_ele_mee_os_bb", "ele pairs invariant mass, opp. sign, bad-bad", nbinmee, meemin, meemax);
614  h_ele_mee_os_bb->Sumw2();
615 
616  // duplicates
617  h_ele_E2mnE1vsMee_all = new TH2F("h_ele_E2mnE1vsMee_all",
618  "E2 - E1 vs ele pairs invariant mass, all electrons",
619  nbinmee,
620  meemin,
621  meemax,
622  100,
623  -50.,
624  50.);
625  h_ele_E2mnE1vsMee_egeg_all = new TH2F("h_ele_E2mnE1vsMee_egeg_all",
626  "E2 - E1 vs ele pairs invariant mass, ecal driven pairs, all electrons",
627  nbinmee,
628  meemin,
629  meemax,
630  100,
631  -50.,
632  50.);
633 
634  // recoed and matched electrons
635  h_ele_charge = new TH1F("h_ele_charge", "ele charge", 5, -2., 2.);
636  h_ele_chargeVsEta = new TH2F("h_ele_chargeVsEta", "ele charge vs eta", nbineta2D, etamin, etamax, 5, -2., 2.);
637  h_ele_chargeVsPhi = new TH2F("h_ele_chargeVsPhi", "ele charge vs phi", nbinphi2D, phimin, phimax, 5, -2., 2.);
638  h_ele_chargeVsPt = new TH2F("h_ele_chargeVsPt", "ele charge vs pt", nbinpt, 0., 100., 5, -2., 2.);
639  h_ele_vertexP = new TH1F("h_ele_vertexP", "ele momentum", nbinp, 0., pmax);
640  h_ele_vertexPt = new TH1F("h_ele_vertexPt", "ele transverse momentum", nbinpt, 0., ptmax);
641  h_ele_Et = new TH1F("h_ele_Et", "ele SC transverse energy", nbinpt, 0., ptmax);
643  new TH2F("h_ele_vertexPtVsEta", "ele transverse momentum vs eta", nbineta2D, etamin, etamax, nbinpt2D, 0., ptmax);
645  new TH2F("h_ele_vertexPtVsPhi", "ele transverse momentum vs phi", nbinphi2D, phimin, phimax, nbinpt2D, 0., ptmax);
647  new TH1F("h_ele_matchingObjectPt_matched", "Efficiency vs matching SC E_{T}", nbinpteff, 5., ptmax);
649  h_ele_vertexEta = new TH1F("h_ele_vertexEta", "ele momentum eta", nbineta, etamin, etamax);
651  new TH2F("h_ele_vertexEtaVsPhi", "ele momentum eta vs phi", nbineta2D, etamin, etamax, nbinphi2D, phimin, phimax);
653  new TH1F("h_ele_matchingObjectAbsEta_matched", "Efficiency vs matching SC |#eta|", nbineta / 2, 0., 2.5);
656  new TH1F("h_ele_matchingObjectEta_matched", "Efficiency vs matching SC #eta", nbineta, etamin, etamax);
659  new TH1F("h_ele_matchingObjectPhi_matched", "Efficiency vs matching SC phi", nbinphi, phimin, phimax);
661  h_ele_vertexPhi = new TH1F("h_ele_vertexPhi", "ele momentum #phi", nbinphi, phimin, phimax);
662  h_ele_vertexX = new TH1F("h_ele_vertexX", "ele vertex x", nbinxyz, -0.1, 0.1);
663  h_ele_vertexY = new TH1F("h_ele_vertexY", "ele vertex y", nbinxyz, -0.1, 0.1);
664  h_ele_vertexZ = new TH1F("h_ele_vertexZ", "ele vertex z", nbinxyz, -25, 25);
666  new TH1F("h_ele_matchingObjectZ_matched", "Efficiency vs matching SC z", nbinxyz, -25, 25);
668  h_ele_vertexTIP = new TH1F("h_ele_vertexTIP", "ele transverse impact parameter (wrt bs)", 90, 0., 0.15);
669  h_ele_vertexTIPVsEta = new TH2F("h_ele_vertexTIPVsEta",
670  "ele transverse impact parameter (wrt bs) vs eta",
671  nbineta2D,
672  etamin,
673  etamax,
674  45,
675  0.,
676  0.15);
677  h_ele_vertexTIPVsPhi = new TH2F("h_ele_vertexTIPVsPhi",
678  "ele transverse impact parameter (wrt bs) vs phi",
679  nbinphi2D,
680  phimin,
681  phimax,
682  45,
683  0.,
684  0.15);
685  h_ele_vertexTIPVsPt = new TH2F("h_ele_vertexTIPVsPt",
686  "ele transverse impact parameter (wrt bs) vs transverse momentum",
687  nbinpt2D,
688  0.,
689  ptmax,
690  45,
691  0.,
692  0.15);
694  "h_ele_PoPmatchingObject_matched", "ele momentum / matching SC energy", nbinpoptrue, poptruemin, poptruemax);
695  h_ele_PtoPtmatchingObject_matched = new TH1F("h_ele_PtoPtmatchingObject_matched",
696  "ele trans momentum / matching SC trans energy",
697  nbinpoptrue,
698  poptruemin,
699  poptruemax);
700  h_ele_PoPmatchingObjectVsEta_matched = new TH2F("h_ele_PoPmatchingObjectVsEta_matched",
701  "ele momentum / matching SC energy vs eta",
702  nbineta2D,
703  etamin,
704  etamax,
705  50,
706  poptruemin,
707  poptruemax);
708  h_ele_PoPmatchingObjectVsPhi_matched = new TH2F("h_ele_PoPmatchingObjectVsPhi_matched",
709  "ele momentum / matching SC energy vs phi",
710  nbinphi2D,
711  phimin,
712  phimax,
713  50,
714  poptruemin,
715  poptruemax);
716  h_ele_PoPmatchingObjectVsPt_matched = new TH2F("h_ele_PoPmatchingObjectVsPt_matched",
717  "ele momentum / matching SC energy vs eta",
718  nbinpt2D,
719  0.,
720  ptmax,
721  50,
722  poptruemin,
723  poptruemax);
724  h_ele_PoPmatchingObject_barrel_matched = new TH1F("h_ele_PoPmatchingObject_barrel_matched",
725  "ele momentum / matching SC energy, barrel",
726  nbinpoptrue,
727  poptruemin,
728  poptruemax);
729  h_ele_PoPmatchingObject_endcaps_matched = new TH1F("h_ele_PoPmatchingObject_endcaps_matched",
730  "ele momentum / matching SC energy, endcaps",
731  nbinpoptrue,
732  poptruemin,
733  poptruemax);
734  h_ele_PtoPtmatchingObject_barrel_matched = new TH1F("h_ele_PtoPmatchingObject_barrel_matched",
735  "ele trans momentum / matching SC trans energy, barrel",
736  nbinpoptrue,
737  poptruemin,
738  poptruemax);
739  h_ele_PtoPtmatchingObject_endcaps_matched = new TH1F("h_ele_PtoPmatchingObject_endcaps_matched",
740  "ele trans momentum / matching SC trans energy, endcaps",
741  nbinpoptrue,
742  poptruemin,
743  poptruemax);
745  "h_ele_EtaMnEtamatchingObject_matched", "ele momentum eta - matching SC eta", nbindeta, detamin, detamax);
746  h_ele_EtaMnEtamatchingObjectVsEta_matched = new TH2F("h_ele_EtaMnEtamatchingObjectVsEta_matched",
747  "ele momentum eta - matching SC eta vs eta",
748  nbineta2D,
749  etamin,
750  etamax,
751  nbindeta / 2,
752  detamin,
753  detamax);
754  h_ele_EtaMnEtamatchingObjectVsPhi_matched = new TH2F("h_ele_EtaMnEtamatchingObjectVsPhi_matched",
755  "ele momentum eta - matching SC eta vs phi",
756  nbinphi2D,
757  phimin,
758  phimax,
759  nbindeta / 2,
760  detamin,
761  detamax);
762  h_ele_EtaMnEtamatchingObjectVsPt_matched = new TH2F("h_ele_EtaMnEtamatchingObjectVsPt_matched",
763  "ele momentum eta - matching SC eta vs pt",
764  nbinpt,
765  0.,
766  ptmax,
767  nbindeta / 2,
768  detamin,
769  detamax);
771  "h_ele_PhiMnPhimatchingObject_matched", "ele momentum phi - matching SC phi", nbindphi, dphimin, dphimax);
772  h_ele_PhiMnPhimatchingObject2_matched = new TH1F("h_ele_PhiMnPhimatchingObject2_matched",
773  "ele momentum phi - matching SC phi",
775  dphimatchmin,
776  dphimatchmax);
777  h_ele_PhiMnPhimatchingObjectVsEta_matched = new TH2F("h_ele_PhiMnPhimatchingObjectVsEta_matched",
778  "ele momentum phi - matching SC phi vs eta",
779  nbineta2D,
780  etamin,
781  etamax,
782  nbindphi / 2,
783  dphimin,
784  dphimax);
785  h_ele_PhiMnPhimatchingObjectVsPhi_matched = new TH2F("h_ele_PhiMnPhimatchingObjectVsPhi_matched",
786  "ele momentum phi - matching SC phi vs phi",
787  nbinphi2D,
788  phimin,
789  phimax,
790  nbindphi / 2,
791  dphimin,
792  dphimax);
793  h_ele_PhiMnPhimatchingObjectVsPt_matched = new TH2F("h_ele_PhiMnPhimatchingObjectVsPt_matched",
794  "ele momentum phi - matching SC phi vs pt",
795  nbinpt2D,
796  0.,
797  ptmax,
798  nbindphi / 2,
799  dphimin,
800  dphimax);
801 
802  // matched electron, superclusters
803  histSclEn_ = new TH1F("h_scl_energy", "ele supercluster energy", nbinp, 0., pmax);
805  "h_scl_EoEmatchingObject_barrel_matched", "ele supercluster energy / matching SC energy, barrel", 50, 0.2, 1.2);
807  "h_scl_EoEmatchingObject_endcaps_matched", "ele supercluster energy / matching SC energy, endcaps", 50, 0.2, 1.2);
808  histSclEoEmatchingObject_barrel_new_matched = new TH1F("h_scl_EoEmatchingObject_barrel_new_matched",
809  "ele supercluster energy / matching SC energy, barrel",
810  nbinpoptrue,
811  poptruemin,
812  poptruemax);
813  histSclEoEmatchingObject_endcaps_new_matched = new TH1F("h_scl_EoEmatchingObject_endcaps_new_matched",
814  "ele supercluster energy / matching SC energy, endcaps",
815  nbinpoptrue,
816  poptruemin,
817  poptruemax);
818  histSclEt_ = new TH1F("h_scl_et", "ele supercluster transverse energy", nbinpt, 0., ptmax);
819  histSclEtVsEta_ = new TH2F(
820  "h_scl_etVsEta", "ele supercluster transverse energy vs eta", nbineta2D, etamin, etamax, nbinpt, 0., ptmax);
821  histSclEtVsPhi_ = new TH2F(
822  "h_scl_etVsPhi", "ele supercluster transverse energy vs phi", nbinphi2D, phimin, phimax, nbinpt, 0., ptmax);
824  new TH2F("h_scl_etaVsPhi", "ele supercluster eta vs phi", nbinphi2D, phimin, phimax, nbineta2D, etamin, etamax);
825  histSclEta_ = new TH1F("h_scl_eta", "ele supercluster eta", nbineta, etamin, etamax);
826  histSclPhi_ = new TH1F("h_scl_phi", "ele supercluster phi", nbinphi, phimin, phimax);
827 
828  histSclSigEtaEta_ = new TH1F("h_scl_sigetaeta", "ele supercluster sigma eta eta", 100, 0., 0.05);
830  new TH1F("h_scl_sigietaieta_barrel", "ele supercluster sigma ieta ieta, barrel", 100, 0., 0.05);
832  new TH1F("h_scl_sigietaieta_endcaps", "ele supercluster sigma ieta ieta, endcaps", 100, 0., 0.05);
833  histSclE1x5_ = new TH1F("h_scl_E1x5", "ele supercluster energy in 1x5", nbinp, 0., pmax);
834  histSclE1x5_barrel_ = new TH1F("h_scl_E1x_barrel5", "ele supercluster energy in 1x5 barrel", nbinp, 0., pmax);
835  histSclE1x5_endcaps_ = new TH1F("h_scl_E1x5_endcaps", "ele supercluster energy in 1x5 endcaps", nbinp, 0., pmax);
836  histSclE2x5max_ = new TH1F("h_scl_E2x5max", "ele supercluster energy in 2x5 max", nbinp, 0., pmax);
838  new TH1F("h_scl_E2x5max_barrel", "ele supercluster energy in 2x5 max barrel", nbinp, 0., pmax);
840  new TH1F("h_scl_E2x5max_endcaps", "ele supercluster energy in 2x5 max endcaps", nbinp, 0., pmax);
841  histSclE5x5_ = new TH1F("h_scl_E5x5", "ele supercluster energy in 5x5", nbinp, 0., pmax);
842  histSclE5x5_barrel_ = new TH1F("h_scl_E5x5_barrel", "ele supercluster energy in 5x5 barrel", nbinp, 0., pmax);
843  histSclE5x5_endcaps_ = new TH1F("h_scl_E5x5_endcaps", "ele supercluster energy in 5x5 endcaps", nbinp, 0., pmax);
844 
845  // matched electron, gsf tracks
846  h_ele_ambiguousTracks = new TH1F("h_ele_ambiguousTracks", "ele # ambiguous tracks", 5, 0., 5.);
848  new TH2F("h_ele_ambiguousTracksVsEta", "ele # ambiguous tracks vs eta", nbineta2D, etamin, etamax, 5, 0., 5.);
850  new TH2F("h_ele_ambiguousTracksVsPhi", "ele # ambiguous tracks vs phi", nbinphi2D, phimin, phimax, 5, 0., 5.);
852  new TH2F("h_ele_ambiguousTracksVsPt", "ele # ambiguous tracks vs pt", nbinpt2D, 0., ptmax, 5, 0., 5.);
853  h_ele_foundHits = new TH1F("h_ele_foundHits", "ele track # found hits", nbinfhits, 0., fhitsmax);
854  h_ele_foundHitsVsEta = new TH2F(
855  "h_ele_foundHitsVsEta", "ele track # found hits vs eta", nbineta2D, etamin, etamax, nbinfhits, 0., fhitsmax);
856  h_ele_foundHitsVsPhi = new TH2F(
857  "h_ele_foundHitsVsPhi", "ele track # found hits vs phi", nbinphi2D, phimin, phimax, nbinfhits, 0., fhitsmax);
859  new TH2F("h_ele_foundHitsVsPt", "ele track # found hits vs pt", nbinpt2D, 0., ptmax, nbinfhits, 0., fhitsmax);
860  h_ele_lostHits = new TH1F("h_ele_lostHits", "ele track # lost hits", 5, 0., 5.);
861  h_ele_lostHitsVsEta = new TH2F(
862  "h_ele_lostHitsVsEta", "ele track # lost hits vs eta", nbineta2D, etamin, etamax, nbinlhits, 0., lhitsmax);
863  h_ele_lostHitsVsPhi = new TH2F(
864  "h_ele_lostHitsVsPhi", "ele track # lost hits vs eta", nbinphi2D, phimin, phimax, nbinlhits, 0., lhitsmax);
866  new TH2F("h_ele_lostHitsVsPt", "ele track # lost hits vs eta", nbinpt2D, 0., ptmax, nbinlhits, 0., lhitsmax);
867  h_ele_chi2 = new TH1F("h_ele_chi2", "ele track #chi^{2}", 100, 0., 15.);
868  h_ele_chi2VsEta = new TH2F("h_ele_chi2VsEta", "ele track #chi^{2} vs eta", nbineta2D, etamin, etamax, 50, 0., 15.);
869  h_ele_chi2VsPhi = new TH2F("h_ele_chi2VsPhi", "ele track #chi^{2} vs phi", nbinphi2D, phimin, phimax, 50, 0., 15.);
870  h_ele_chi2VsPt = new TH2F("h_ele_chi2VsPt", "ele track #chi^{2} vs pt", nbinpt2D, 0., ptmax, 50, 0., 15.);
871  h_ele_PinMnPout = new TH1F("h_ele_PinMnPout", "ele track inner p - outer p, mean", nbinp, 0., 200.);
872  h_ele_PinMnPout_mode = new TH1F("h_ele_PinMnPout_mode", "ele track inner p - outer p, mode", nbinp, 0., 100.);
873  h_ele_PinMnPoutVsEta_mode = new TH2F("h_ele_PinMnPoutVsEta_mode",
874  "ele track inner p - outer p vs eta, mode",
875  nbineta2D,
876  etamin,
877  etamax,
878  nbinp2D,
879  0.,
880  100.);
881  h_ele_PinMnPoutVsPhi_mode = new TH2F("h_ele_PinMnPoutVsPhi_mode",
882  "ele track inner p - outer p vs phi, mode",
883  nbinphi2D,
884  phimin,
885  phimax,
886  nbinp2D,
887  0.,
888  100.);
889  h_ele_PinMnPoutVsPt_mode = new TH2F(
890  "h_ele_PinMnPoutVsPt_mode", "ele track inner p - outer p vs pt, mode", nbinpt2D, 0., ptmax, nbinp2D, 0., 100.);
891  h_ele_PinMnPoutVsE_mode = new TH2F(
892  "h_ele_PinMnPoutVsE_mode", "ele track inner p - outer p vs E, mode", nbinp2D, 0., 200., nbinp2D, 0., 100.);
893  h_ele_PinMnPoutVsChi2_mode = new TH2F(
894  "h_ele_PinMnPoutVsChi2_mode", "ele track inner p - outer p vs track chi2, mode", 50, 0., 20., nbinp2D, 0., 100.);
895  h_ele_outerP = new TH1F("h_ele_outerP", "ele track outer p, mean", nbinp, 0., pmax);
896  h_ele_outerP_mode = new TH1F("h_ele_outerP_mode", "ele track outer p, mode", nbinp, 0., pmax);
898  new TH2F("h_ele_outerPVsEta_mode", "ele track outer p vs eta mode", nbineta2D, etamin, etamax, 50, 0., pmax);
899  h_ele_outerPt = new TH1F("h_ele_outerPt", "ele track outer p_{T}, mean", nbinpt, 0., ptmax);
900  h_ele_outerPt_mode = new TH1F("h_ele_outerPt_mode", "ele track outer p_{T}, mode", nbinpt, 0., ptmax);
901  h_ele_outerPtVsEta_mode = new TH2F(
902  "h_ele_outerPtVsEta_mode", "ele track outer p_{T} vs eta, mode", nbineta2D, etamin, etamax, nbinpt2D, 0., ptmax);
903  h_ele_outerPtVsPhi_mode = new TH2F(
904  "h_ele_outerPtVsPhi_mode", "ele track outer p_{T} vs phi, mode", nbinphi2D, phimin, phimax, nbinpt2D, 0., ptmax);
906  new TH2F("h_ele_outerPtVsPt_mode", "ele track outer p_{T} vs pt, mode", nbinpt2D, 0., 100., nbinpt2D, 0., ptmax);
907 
908  // matched electrons, matching
909  h_ele_EoP = new TH1F("h_ele_EoP", "ele E/P_{vertex}", nbineop, 0., eopmax);
911  new TH2F("h_ele_EoPVsEta", "ele E/P_{vertex} vs eta", nbineta2D, etamin, etamax, nbineop2D, 0., eopmaxsht);
913  new TH2F("h_ele_EoPVsPhi", "ele E/P_{vertex} vs phi", nbinphi2D, phimin, phimax, nbineop2D, 0., eopmaxsht);
914  h_ele_EoPVsE = new TH2F("h_ele_EoPVsE", "ele E/P_{vertex} vs E", 50, 0., pmax, 50, 0., 5.);
915  h_ele_EseedOP = new TH1F("h_ele_EseedOP", "ele E_{seed}/P_{vertex}", nbineop, 0., eopmax);
916  h_ele_EseedOPVsEta = new TH2F(
917  "h_ele_EseedOPVsEta", "ele E_{seed}/P_{vertex} vs eta", nbineta2D, etamin, etamax, nbineop2D, 0., eopmaxsht);
918  h_ele_EseedOPVsPhi = new TH2F(
919  "h_ele_EseedOPVsPhi", "ele E_{seed}/P_{vertex} vs phi", nbinphi2D, phimin, phimax, nbineop2D, 0., eopmaxsht);
920  h_ele_EseedOPVsE = new TH2F("h_ele_EseedOPVsE", "ele E_{seed}/P_{vertex} vs E", 50, 0., pmax, 50, 0., 5.);
921  h_ele_EoPout = new TH1F("h_ele_EoPout", "ele E/P_{out}", nbineop, 0., eopmax);
923  new TH2F("h_ele_EoPoutVsEta", "ele E/P_{out} vs eta", nbineta2D, etamin, etamax, nbineop2D, 0., eopmaxsht);
925  new TH2F("h_ele_EoPoutVsPhi", "ele E/P_{out} vs phi", nbinphi2D, phimin, phimax, nbineop2D, 0., eopmaxsht);
926  h_ele_EoPoutVsE = new TH2F("h_ele_EoPoutVsE", "ele E/P_{out} vs E", nbinp2D, 0., pmax, nbineop2D, 0., eopmaxsht);
927  h_ele_EeleOPout = new TH1F("h_ele_EeleOPout", "ele E_{ele}/P_{out}", nbineop, 0., eopmax);
928  h_ele_EeleOPoutVsEta = new TH2F(
929  "h_ele_EeleOPoutVsEta", "ele E_{ele}/P_{out} vs eta", nbineta2D, etamin, etamax, nbineop2D, 0., eopmaxsht);
930  h_ele_EeleOPoutVsPhi = new TH2F(
931  "h_ele_EeleOPoutVsPhi", "ele E_{ele}/P_{out} vs phi", nbinphi2D, phimin, phimax, nbineop2D, 0., eopmaxsht);
933  new TH2F("h_ele_EeleOPoutVsE", "ele E_{ele}/P_{out} vs E", nbinp2D, 0., pmax, nbineop2D, 0., eopmaxsht);
934  h_ele_dEtaSc_propVtx = new TH1F(
935  "h_ele_dEtaSc_propVtx", "ele #eta_{sc} - #eta_{tr}, prop from vertex", nbindetamatch, detamatchmin, detamatchmax);
936  h_ele_dEtaScVsEta_propVtx = new TH2F("h_ele_dEtaScVsEta_propVtx",
937  "ele #eta_{sc} - #eta_{tr} vs eta, prop from vertex",
938  nbineta2D,
939  etamin,
940  etamax,
942  detamatchmin,
943  detamatchmax);
944  h_ele_dEtaScVsPhi_propVtx = new TH2F("h_ele_dEtaScVsPhi_propVtx",
945  "ele #eta_{sc} - #eta_{tr} vs phi, prop from vertex",
946  nbinphi2D,
947  phimin,
948  phimax,
950  detamatchmin,
951  detamatchmax);
952  h_ele_dEtaScVsPt_propVtx = new TH2F("h_ele_dEtaScVsPt_propVtx",
953  "ele #eta_{sc} - #eta_{tr} vs pt, prop from vertex",
954  nbinpt2D,
955  0.,
956  ptmax,
958  detamatchmin,
959  detamatchmax);
960  h_ele_dPhiSc_propVtx = new TH1F(
961  "h_ele_dPhiSc_propVtx", "ele #phi_{sc} - #phi_{tr}, prop from vertex", nbindphimatch, dphimatchmin, dphimatchmax);
962  h_ele_dPhiScVsEta_propVtx = new TH2F("h_ele_dPhiScVsEta_propVtx",
963  "ele #phi_{sc} - #phi_{tr} vs eta, prop from vertex",
964  nbineta2D,
965  etamin,
966  etamax,
968  dphimatchmin,
969  dphimatchmax);
970  h_ele_dPhiScVsPhi_propVtx = new TH2F("h_ele_dPhiScVsPhi_propVtx",
971  "ele #phi_{sc} - #phi_{tr} vs phi, prop from vertex",
972  nbinphi2D,
973  phimin,
974  phimax,
976  dphimatchmin,
977  dphimatchmax);
978  h_ele_dPhiScVsPt_propVtx = new TH2F("h_ele_dPhiScVsPt_propVtx",
979  "ele #phi_{sc} - #phi_{tr} vs pt, prop from vertex",
980  nbinpt2D,
981  0.,
982  ptmax,
984  dphimatchmin,
985  dphimatchmax);
986  h_ele_dEtaCl_propOut = new TH1F("h_ele_dEtaCl_propOut",
987  "ele #eta_{cl} - #eta_{tr}, prop from outermost",
989  detamatchmin,
990  detamatchmax);
991  h_ele_dEtaClVsEta_propOut = new TH2F("h_ele_dEtaClVsEta_propOut",
992  "ele #eta_{cl} - #eta_{tr} vs eta, prop from out",
993  nbineta2D,
994  etamin,
995  etamax,
997  detamatchmin,
998  detamatchmax);
999  h_ele_dEtaClVsPhi_propOut = new TH2F("h_ele_dEtaClVsPhi_propOut",
1000  "ele #eta_{cl} - #eta_{tr} vs phi, prop from out",
1001  nbinphi2D,
1002  phimin,
1003  phimax,
1005  detamatchmin,
1006  detamatchmax);
1007  h_ele_dEtaClVsPt_propOut = new TH2F("h_ele_dEtaScVsPt_propOut",
1008  "ele #eta_{cl} - #eta_{tr} vs pt, prop from out",
1009  nbinpt2D,
1010  0.,
1011  ptmax,
1013  detamatchmin,
1014  detamatchmax);
1015  h_ele_dPhiCl_propOut = new TH1F("h_ele_dPhiCl_propOut",
1016  "ele #phi_{cl} - #phi_{tr}, prop from outermost",
1017  nbindphimatch,
1018  dphimatchmin,
1019  dphimatchmax);
1020  h_ele_dPhiClVsEta_propOut = new TH2F("h_ele_dPhiClVsEta_propOut",
1021  "ele #phi_{cl} - #phi_{tr} vs eta, prop from out",
1022  nbineta2D,
1023  etamin,
1024  etamax,
1026  dphimatchmin,
1027  dphimatchmax);
1028  h_ele_dPhiClVsPhi_propOut = new TH2F("h_ele_dPhiClVsPhi_propOut",
1029  "ele #phi_{cl} - #phi_{tr} vs phi, prop from out",
1030  nbinphi2D,
1031  phimin,
1032  phimax,
1034  dphimatchmin,
1035  dphimatchmax);
1036  h_ele_dPhiClVsPt_propOut = new TH2F("h_ele_dPhiSClsPt_propOut",
1037  "ele #phi_{cl} - #phi_{tr} vs pt, prop from out",
1038  nbinpt2D,
1039  0.,
1040  ptmax,
1042  dphimatchmin,
1043  dphimatchmax);
1044  h_ele_dEtaEleCl_propOut = new TH1F("h_ele_dEtaEleCl_propOut",
1045  "ele #eta_{EleCl} - #eta_{tr}, prop from outermost",
1046  nbindetamatch,
1047  detamatchmin,
1048  detamatchmax);
1049  h_ele_dEtaEleClVsEta_propOut = new TH2F("h_ele_dEtaEleClVsEta_propOut",
1050  "ele #eta_{EleCl} - #eta_{tr} vs eta, prop from out",
1051  nbineta2D,
1052  etamin,
1053  etamax,
1055  detamatchmin,
1056  detamatchmax);
1057  h_ele_dEtaEleClVsPhi_propOut = new TH2F("h_ele_dEtaEleClVsPhi_propOut",
1058  "ele #eta_{EleCl} - #eta_{tr} vs phi, prop from out",
1059  nbinphi2D,
1060  phimin,
1061  phimax,
1063  detamatchmin,
1064  detamatchmax);
1065  h_ele_dEtaEleClVsPt_propOut = new TH2F("h_ele_dEtaScVsPt_propOut",
1066  "ele #eta_{EleCl} - #eta_{tr} vs pt, prop from out",
1067  nbinpt2D,
1068  0.,
1069  ptmax,
1071  detamatchmin,
1072  detamatchmax);
1073  h_ele_dPhiEleCl_propOut = new TH1F("h_ele_dPhiEleCl_propOut",
1074  "ele #phi_{EleCl} - #phi_{tr}, prop from outermost",
1075  nbindphimatch,
1076  dphimatchmin,
1077  dphimatchmax);
1078  h_ele_dPhiEleClVsEta_propOut = new TH2F("h_ele_dPhiEleClVsEta_propOut",
1079  "ele #phi_{EleCl} - #phi_{tr} vs eta, prop from out",
1080  nbineta2D,
1081  etamin,
1082  etamax,
1084  dphimatchmin,
1085  dphimatchmax);
1086  h_ele_dPhiEleClVsPhi_propOut = new TH2F("h_ele_dPhiEleClVsPhi_propOut",
1087  "ele #phi_{EleCl} - #phi_{tr} vs phi, prop from out",
1088  nbinphi2D,
1089  phimin,
1090  phimax,
1092  dphimatchmin,
1093  dphimatchmax);
1094  h_ele_dPhiEleClVsPt_propOut = new TH2F("h_ele_dPhiSEleClsPt_propOut",
1095  "ele #phi_{EleCl} - #phi_{tr} vs pt, prop from out",
1096  nbinpt2D,
1097  0.,
1098  ptmax,
1100  dphimatchmin,
1101  dphimatchmax);
1102 
1103  h_ele_HoE = new TH1F("h_ele_HoE", "ele hadronic energy / em energy", nbinhoe, hoemin, hoemax);
1105  new TH1F("h_ele_HoE_fiducial", "ele hadronic energy / em energy, fiducial region", nbinhoe, hoemin, hoemax);
1106  h_ele_HoEVsEta = new TH2F(
1107  "h_ele_HoEVsEta", "ele hadronic energy / em energy vs eta", nbineta, etamin, etamax, nbinhoe, hoemin, hoemax);
1108  h_ele_HoEVsPhi = new TH2F(
1109  "h_ele_HoEVsPhi", "ele hadronic energy / em energy vs phi", nbinphi2D, phimin, phimax, nbinhoe, hoemin, hoemax);
1110  h_ele_HoEVsE =
1111  new TH2F("h_ele_HoEVsE", "ele hadronic energy / em energy vs E", nbinp, 0., 300., nbinhoe, hoemin, hoemax);
1112 
1113  h_ele_seed_dphi2_ = new TH1F("h_ele_seedDphi2", "ele seed dphi 2nd layer", 50, -0.003, +0.003);
1115  new TH2F("h_ele_seedDphi2VsEta", "ele seed dphi 2nd layer vs eta", nbineta2D, etamin, etamax, 50, -0.003, +0.003);
1117  new TH2F("h_ele_seedDphi2VsPt", "ele seed dphi 2nd layer vs pt", nbinpt2D, 0., ptmax, 50, -0.003, +0.003);
1118  h_ele_seed_drz2_ = new TH1F("h_ele_seedDrz2", "ele seed dr/dz 2nd layer", 50, -0.03, +0.03);
1120  new TH2F("h_ele_seedDrz2VsEta", "ele seed dr/dz 2nd layer vs eta", nbineta2D, etamin, etamax, 50, -0.03, +0.03);
1122  new TH2F("h_ele_seedDrz2VsPt", "ele seed dr/dz 2nd layer vs pt", nbinpt2D, 0., ptmax, 50, -0.03, +0.03);
1123  h_ele_seed_subdet2_ = new TH1F("h_ele_seedSubdet2", "ele seed subdet 2nd layer", 10, 0., 10.);
1124 
1125  // classes
1126  h_ele_classes = new TH1F("h_ele_classes", "electron classes", 20, 0.0, 20.);
1127  h_ele_eta = new TH1F("h_ele_eta", "ele electron eta", nbineta / 2, 0.0, etamax);
1128  h_ele_eta_golden = new TH1F("h_ele_eta_golden", "ele electron eta golden", nbineta / 2, 0.0, etamax);
1129  h_ele_eta_bbrem = new TH1F("h_ele_eta_bbrem", "ele electron eta bbrem", nbineta / 2, 0.0, etamax);
1130  h_ele_eta_narrow = new TH1F("h_ele_eta_narrow", "ele electron eta narrow", nbineta / 2, 0.0, etamax);
1131  h_ele_eta_shower = new TH1F("h_ele_eta_show", "ele electron eta showering", nbineta / 2, 0.0, etamax);
1132  h_ele_PinVsPoutGolden_mode = new TH2F("h_ele_PinVsPoutGolden_mode",
1133  "ele track inner p vs outer p vs eta, golden, mode",
1134  nbinp2D,
1135  0.,
1136  pmax,
1137  50,
1138  0.,
1139  pmax);
1140  h_ele_PinVsPoutShowering_mode = new TH2F("h_ele_PinVsPoutShowering_mode",
1141  "ele track inner p vs outer p vs eta, Showering, mode",
1142  nbinp2D,
1143  0.,
1144  pmax,
1145  50,
1146  0.,
1147  pmax);
1148  h_ele_PinVsPoutGolden_mean = new TH2F("h_ele_PinVsPoutGolden_mean",
1149  "ele track inner p vs outer p vs eta, golden, mean",
1150  nbinp2D,
1151  0.,
1152  pmax,
1153  50,
1154  0.,
1155  pmax);
1156  h_ele_PinVsPoutShowering_mean = new TH2F("h_ele_PinVsPoutShowering_mean",
1157  "ele track inner p vs outer p vs eta, Showering, mean",
1158  nbinp2D,
1159  0.,
1160  pmax,
1161  50,
1162  0.,
1163  pmax);
1164  h_ele_PtinVsPtoutGolden_mode = new TH2F("h_ele_PtinVsPtoutGolden_mode",
1165  "ele track inner pt vs outer pt vs eta, golden, mode",
1166  nbinpt2D,
1167  0.,
1168  ptmax,
1169  50,
1170  0.,
1171  ptmax);
1172  h_ele_PtinVsPtoutShowering_mode = new TH2F("h_ele_PtinVsPtoutShowering_mode",
1173  "ele track inner pt vs outer pt vs eta, showering, mode",
1174  nbinpt2D,
1175  0.,
1176  ptmax,
1177  50,
1178  0.,
1179  ptmax);
1180  h_ele_PtinVsPtoutGolden_mean = new TH2F("h_ele_PtinVsPtoutGolden_mean",
1181  "ele track inner pt vs outer pt vs eta, golden, mean",
1182  nbinpt2D,
1183  0.,
1184  ptmax,
1185  50,
1186  0.,
1187  ptmax);
1188  h_ele_PtinVsPtoutShowering_mean = new TH2F("h_ele_PtinVsPtoutShowering_mean",
1189  "ele track inner pt vs outer pt vs eta, showering, mean",
1190  nbinpt2D,
1191  0.,
1192  ptmax,
1193  50,
1194  0.,
1195  ptmax);
1196  histSclEoEmatchingObjectGolden_barrel = new TH1F("h_scl_EoEmatchingObject golden, barrel",
1197  "ele supercluster energy over matchingObject energy, golden, barrel",
1198  100,
1199  0.2,
1200  1.2);
1202  new TH1F("h_scl_EoEmatchingObject golden, endcaps",
1203  "ele supercluster energy over matchingObject energy, golden, endcaps",
1204  100,
1205  0.2,
1206  1.2);
1208  new TH1F("h_scl_EoEmatchingObject Showering, barrel",
1209  "ele supercluster energy over matchingObject energy, showering, barrel",
1210  100,
1211  0.2,
1212  1.2);
1214  new TH1F("h_scl_EoEmatchingObject Showering, endcaps",
1215  "ele supercluster energy over matchingObject energy, showering, endcaps",
1216  100,
1217  0.2,
1218  1.2);
1219 
1220  // isolation
1221  h_ele_tkSumPt_dr03 = new TH1F("h_ele_tkSumPt_dr03", "tk isolation sum, dR=0.3", 100, 0.0, 20.);
1222  h_ele_ecalRecHitSumEt_dr03 = new TH1F("h_ele_ecalRecHitSumEt_dr03", "ecal isolation sum, dR=0.3", 100, 0.0, 20.);
1224  new TH1F("h_ele_hcalDepth1TowerSumEt_dr03", "hcal depth1 isolation sum, dR=0.3", 100, 0.0, 20.);
1226  new TH1F("h_ele_hcalDepth2TowerSumEt_dr03", "hcal depth2 isolation sum, dR=0.3", 100, 0.0, 20.);
1227  h_ele_tkSumPt_dr04 = new TH1F("h_ele_tkSumPt_dr04", "trk isolation sum", 100, 0.0, 20.);
1228  h_ele_ecalRecHitSumEt_dr04 = new TH1F("h_ele_ecalRecHitSumEt_dr04", "ecal isolation sum, dR=0.4", 100, 0.0, 20.);
1230  new TH1F("h_ele_hcalDepth1TowerSumEt_dr04", "hcal depth1 isolation sum, dR=0.4", 100, 0.0, 20.);
1232  new TH1F("h_ele_hcalDepth2TowerSumEt_dr04", "hcal depth2 isolation sum, dR=0.4", 100, 0.0, 20.);
1233 
1234  // fbrem
1235  h_ele_fbrem = new TH1F("h_ele_fbrem", "ele brem fraction, mode", 100, 0., 1.);
1237  new TProfile("h_ele_fbremvsEtamode", "mean ele brem fraction vs eta, mode", nbineta2D, etamin, etamax, 0., 1.);
1239  new TProfile("h_ele_fbremvsEtamean", "mean ele brem fraction vs eta, mean", nbineta2D, etamin, etamax, 0., 1.);
1240 
1241  // e/g et pflow electrons
1242  h_ele_mva = new TH1F("h_ele_mva", "ele identification mva", 100, -1., 1.);
1243  h_ele_provenance = new TH1F("h_ele_provenance", "ele provenance", 5, -2., 3.);
1244 
1245  // histos titles
1246  h_matchingObjectNum->GetXaxis()->SetTitle("N_{SC}");
1247  h_matchingObjectNum->GetYaxis()->SetTitle("Events");
1248  h_matchingObjectEta->GetXaxis()->SetTitle("#eta_{SC}");
1249  h_matchingObjectEta->GetYaxis()->SetTitle("Events");
1250  h_matchingObjectP->GetXaxis()->SetTitle("E_{SC} (GeV)");
1251  h_matchingObjectP->GetYaxis()->SetTitle("Events");
1252  h_ele_foundHits->GetXaxis()->SetTitle("N_{hits}");
1253  h_ele_foundHits->GetYaxis()->SetTitle("Events");
1254  h_ele_ambiguousTracks->GetXaxis()->SetTitle("N_{ambiguous tracks}");
1255  h_ele_ambiguousTracks->GetYaxis()->SetTitle("Events");
1256  h_ele_lostHits->GetXaxis()->SetTitle("N_{lost hits}");
1257  h_ele_lostHits->GetYaxis()->SetTitle("Events");
1258  h_ele_chi2->GetXaxis()->SetTitle("#Chi^{2}");
1259  h_ele_chi2->GetYaxis()->SetTitle("Events");
1260  h_ele_charge->GetXaxis()->SetTitle("charge");
1261  h_ele_charge->GetYaxis()->SetTitle("Events");
1262  h_ele_vertexP->GetXaxis()->SetTitle("p_{vertex} (GeV/c)");
1263  h_ele_vertexP->GetYaxis()->SetTitle("Events");
1264  h_ele_vertexPt->GetXaxis()->SetTitle("p_{T vertex} (GeV/c)");
1265  h_ele_vertexPt->GetYaxis()->SetTitle("Events");
1266  h_ele_Et->GetXaxis()->SetTitle("E_{T} (GeV)");
1267  h_ele_Et->GetYaxis()->SetTitle("Events");
1268  h_ele_vertexEta->GetXaxis()->SetTitle("#eta");
1269  h_ele_vertexEta->GetYaxis()->SetTitle("Events");
1270  h_ele_vertexPhi->GetXaxis()->SetTitle("#phi (rad)");
1271  h_ele_vertexPhi->GetYaxis()->SetTitle("Events");
1272  h_ele_PoPmatchingObject_matched->GetXaxis()->SetTitle("P/E_{SC}");
1273  h_ele_PoPmatchingObject_matched->GetYaxis()->SetTitle("Events");
1274  h_ele_PoPmatchingObject_barrel_matched->GetXaxis()->SetTitle("P/E_{SC}");
1275  h_ele_PoPmatchingObject_barrel_matched->GetYaxis()->SetTitle("Events");
1276  h_ele_PoPmatchingObject_endcaps_matched->GetXaxis()->SetTitle("P/E_{SC}");
1277  h_ele_PoPmatchingObject_endcaps_matched->GetYaxis()->SetTitle("Events");
1278  h_ele_PtoPtmatchingObject_matched->GetXaxis()->SetTitle("P_{T}/E_{T}^{SC}");
1279  h_ele_PtoPtmatchingObject_matched->GetYaxis()->SetTitle("Events");
1280  h_ele_PtoPtmatchingObject_barrel_matched->GetXaxis()->SetTitle("P_{T}/E_{T}^{SC}");
1281  h_ele_PtoPtmatchingObject_barrel_matched->GetYaxis()->SetTitle("Events");
1282  h_ele_PtoPtmatchingObject_endcaps_matched->GetXaxis()->SetTitle("P_{T}/E_{T}^{SC}");
1283  h_ele_PtoPtmatchingObject_endcaps_matched->GetYaxis()->SetTitle("Events");
1284  histSclSigEtaEta_->GetXaxis()->SetTitle("#sigma_{#eta #eta}");
1285  histSclSigEtaEta_->GetYaxis()->SetTitle("Events");
1286  histSclSigIEtaIEta_barrel_->GetXaxis()->SetTitle("#sigma_{i#eta i#eta}");
1287  histSclSigIEtaIEta_barrel_->GetYaxis()->SetTitle("Events");
1288  histSclSigIEtaIEta_endcaps_->GetXaxis()->SetTitle("#sigma_{i#eta i#eta}");
1289  histSclSigIEtaIEta_endcaps_->GetYaxis()->SetTitle("Events");
1290  histSclE1x5_->GetXaxis()->SetTitle("E1x5 (GeV)");
1291  histSclE1x5_->GetYaxis()->SetTitle("Events");
1292  histSclE1x5_barrel_->GetXaxis()->SetTitle("E1x5 (GeV)");
1293  histSclE1x5_barrel_->GetYaxis()->SetTitle("Events");
1294  histSclE1x5_endcaps_->GetXaxis()->SetTitle("E1x5 (GeV)");
1295  histSclE1x5_endcaps_->GetYaxis()->SetTitle("Events");
1296  histSclE2x5max_->GetXaxis()->SetTitle("E2x5 (GeV)");
1297  histSclE2x5max_->GetYaxis()->SetTitle("Events");
1298  histSclE2x5max_barrel_->GetXaxis()->SetTitle("E2x5 (GeV)");
1299  histSclE2x5max_barrel_->GetYaxis()->SetTitle("Events");
1300  histSclE2x5max_endcaps_->GetXaxis()->SetTitle("E2x5 (GeV)");
1301  histSclE2x5max_endcaps_->GetYaxis()->SetTitle("Events");
1302  histSclE5x5_->GetXaxis()->SetTitle("E5x5 (GeV)");
1303  histSclE5x5_->GetYaxis()->SetTitle("Events");
1304  histSclE5x5_barrel_->GetXaxis()->SetTitle("E5x5 (GeV)");
1305  histSclE5x5_barrel_->GetYaxis()->SetTitle("Events");
1306  histSclE5x5_endcaps_->GetXaxis()->SetTitle("E5x5 (GeV)");
1307  histSclE5x5_endcaps_->GetYaxis()->SetTitle("Events");
1308  h_ele_EtaMnEtamatchingObject_matched->GetXaxis()->SetTitle("#eta_{rec} - #eta_{SC}");
1309  h_ele_EtaMnEtamatchingObject_matched->GetYaxis()->SetTitle("Events");
1310  h_ele_PhiMnPhimatchingObject_matched->GetXaxis()->SetTitle("#phi_{rec} - #phi_{SC} (rad)");
1311  h_ele_PhiMnPhimatchingObject_matched->GetYaxis()->SetTitle("Events");
1312  h_ele_PinMnPout->GetXaxis()->SetTitle("P_{vertex} - P_{out} (GeV/c)");
1313  h_ele_PinMnPout->GetYaxis()->SetTitle("Events");
1314  h_ele_PinMnPout_mode->GetXaxis()->SetTitle("P_{vertex} - P_{out}, mode (GeV/c)");
1315  h_ele_PinMnPout_mode->GetYaxis()->SetTitle("Events");
1316  h_ele_outerP->GetXaxis()->SetTitle("P_{out} (GeV/c)");
1317  h_ele_outerP->GetYaxis()->SetTitle("Events");
1318  h_ele_outerP_mode->GetXaxis()->SetTitle("P_{out} (GeV/c)");
1319  h_ele_outerP_mode->GetYaxis()->SetTitle("Events");
1320  h_ele_outerPt->GetXaxis()->SetTitle("P_{T out} (GeV/c)");
1321  h_ele_outerPt->GetYaxis()->SetTitle("Events");
1322  h_ele_outerPt_mode->GetXaxis()->SetTitle("P_{T out} (GeV/c)");
1323  h_ele_outerPt_mode->GetYaxis()->SetTitle("Events");
1324  h_ele_EoP->GetXaxis()->SetTitle("E/P_{vertex}");
1325  h_ele_EoP->GetYaxis()->SetTitle("Events");
1326  h_ele_EseedOP->GetXaxis()->SetTitle("E_{seed}/P_{vertex}");
1327  h_ele_EseedOP->GetYaxis()->SetTitle("Events");
1328  h_ele_EoPout->GetXaxis()->SetTitle("E_{seed}/P_{out}");
1329  h_ele_EoPout->GetYaxis()->SetTitle("Events");
1330  h_ele_EeleOPout->GetXaxis()->SetTitle("E_{ele}/P_{out}");
1331  h_ele_EeleOPout->GetYaxis()->SetTitle("Events");
1332  h_ele_vertexX->GetXaxis()->SetTitle("x (cm)");
1333  h_ele_vertexX->GetYaxis()->SetTitle("Events");
1334  h_ele_vertexY->GetXaxis()->SetTitle("y (cm)");
1335  h_ele_vertexY->GetYaxis()->SetTitle("Events");
1336  h_ele_vertexZ->GetXaxis()->SetTitle("z (cm)");
1337  h_ele_vertexZ->GetYaxis()->SetTitle("Events");
1338  h_ele_vertexTIP->GetXaxis()->SetTitle("TIP (cm)");
1339  h_ele_vertexTIP->GetYaxis()->SetTitle("Events");
1340  h_ele_vertexTIPVsEta->GetYaxis()->SetTitle("TIP (cm)");
1341  h_ele_vertexTIPVsEta->GetXaxis()->SetTitle("#eta");
1342  h_ele_vertexTIPVsPhi->GetYaxis()->SetTitle("TIP (cm)");
1343  h_ele_vertexTIPVsPhi->GetXaxis()->SetTitle("#phi (rad)");
1344  h_ele_vertexTIPVsPt->GetYaxis()->SetTitle("TIP (cm)");
1345  h_ele_vertexTIPVsEta->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1346  h_ele_dEtaSc_propVtx->GetXaxis()->SetTitle("#eta_{sc} - #eta_{tr}");
1347  h_ele_dEtaSc_propVtx->GetYaxis()->SetTitle("Events");
1348  h_ele_dEtaCl_propOut->GetXaxis()->SetTitle("#eta_{seedcl} - #eta_{tr}");
1349  h_ele_dEtaCl_propOut->GetYaxis()->SetTitle("Events");
1350  h_ele_dEtaEleCl_propOut->GetXaxis()->SetTitle("#eta_{elecl} - #eta_{tr}");
1351  h_ele_dEtaEleCl_propOut->GetYaxis()->SetTitle("Events");
1352  h_ele_dPhiSc_propVtx->GetXaxis()->SetTitle("#phi_{sc} - #phi_{tr} (rad)");
1353  h_ele_dPhiSc_propVtx->GetYaxis()->SetTitle("Events");
1354  h_ele_dPhiCl_propOut->GetXaxis()->SetTitle("#phi_{seedcl} - #phi_{tr} (rad)");
1355  h_ele_dPhiCl_propOut->GetYaxis()->SetTitle("Events");
1356  h_ele_dPhiEleCl_propOut->GetXaxis()->SetTitle("#phi_{elecl} - #phi_{tr} (rad)");
1357  h_ele_dPhiEleCl_propOut->GetYaxis()->SetTitle("Events");
1358  h_ele_HoE->GetXaxis()->SetTitle("H/E");
1359  h_ele_HoE->GetYaxis()->SetTitle("Events");
1360  h_ele_HoE_fiducial->GetXaxis()->SetTitle("H/E");
1361  h_ele_HoE_fiducial->GetYaxis()->SetTitle("Events");
1362  h_ele_fbrem->GetXaxis()->SetTitle("P_{in} - P_{out} / P_{in}");
1363  h_ele_fbrem->GetYaxis()->SetTitle("Events");
1364  h_ele_seed_dphi2_->GetXaxis()->SetTitle("#phi_{hit}-#phi_{pred} (rad)");
1365  h_ele_seed_dphi2_->GetYaxis()->SetTitle("Events");
1366  h_ele_seed_drz2_->GetXaxis()->SetTitle("r(z)_{hit}-r(z)_{pred} (cm)");
1367  h_ele_seed_drz2_->GetYaxis()->SetTitle("Events");
1368  h_ele_seed_subdet2_->GetXaxis()->SetTitle("2nd hit subdet Id");
1369  h_ele_seed_subdet2_->GetYaxis()->SetTitle("Events");
1370  h_ele_classes->GetXaxis()->SetTitle("class Id");
1371  h_ele_classes->GetYaxis()->SetTitle("Events");
1372  h_ele_mee_all->GetXaxis()->SetTitle("m_{ee} (GeV/c^{2})");
1373  h_ele_mee_all->GetYaxis()->SetTitle("Events");
1374  h_ele_mee_os->GetXaxis()->SetTitle("m_{e^{+}e^{-}} (GeV/c^{2})");
1375  h_ele_mee_os->GetYaxis()->SetTitle("Events");
1376  h_ele_mee_os_ebeb->GetXaxis()->SetTitle("m_{e^{+}e^{-}} (GeV/c^{2})");
1377  h_ele_mee_os_ebeb->GetYaxis()->SetTitle("Events");
1378  h_ele_mee_os_ebee->GetXaxis()->SetTitle("m_{e^{+}e^{-}} (GeV/c^{2})");
1379  h_ele_mee_os_ebee->GetYaxis()->SetTitle("Events");
1380  h_ele_mee_os_eeee->GetXaxis()->SetTitle("m_{e^{+}e^{-}} (GeV/c^{2})");
1381  h_ele_mee_os_eeee->GetYaxis()->SetTitle("Events");
1382  h_ele_mee_os_gg->GetXaxis()->SetTitle("m_{e^{+}e^{-}} (GeV/c^{2})");
1383  h_ele_mee_os_gg->GetYaxis()->SetTitle("Events");
1384  h_ele_mee_os_gb->GetXaxis()->SetTitle("m_{e^{+}e^{-}} (GeV/c^{2})");
1385  h_ele_mee_os_gb->GetYaxis()->SetTitle("Events");
1386  h_ele_mee_os_bb->GetXaxis()->SetTitle("m_{e^{+}e^{-}} (GeV/c^{2})");
1387  h_ele_mee_os_bb->GetYaxis()->SetTitle("Events");
1388  h_ele_E2mnE1vsMee_all->GetXaxis()->SetTitle("m_{e^{+}e^{-}} (GeV/c^{2})");
1389  h_ele_E2mnE1vsMee_all->GetYaxis()->SetTitle("E2 - E1 (GeV)");
1390  h_ele_E2mnE1vsMee_egeg_all->GetXaxis()->SetTitle("m_{e^{+}e^{-}} (GeV/c^{2})");
1391  h_ele_E2mnE1vsMee_egeg_all->GetYaxis()->SetTitle("E2 - E1 (GeV)");
1392  histNum_->GetXaxis()->SetTitle("N_{ele}");
1393  histNum_->GetYaxis()->SetTitle("Events");
1394  h_ele_fbremVsEta_mode->GetXaxis()->SetTitle("#eta");
1395  h_ele_fbremVsEta_mean->GetXaxis()->SetTitle("#eta");
1396 }
1397 
1399  histfile_->cd();
1400  std::cout << "efficiency calculation " << std::endl;
1401  // efficiency vs eta
1402  TH1F *h_ele_etaEff = (TH1F *)h_ele_matchingObjectEta_matched->Clone("h_ele_etaEff");
1403  h_ele_etaEff->Reset();
1404  h_ele_etaEff->Divide(h_ele_matchingObjectEta_matched, h_matchingObjectEta, 1, 1, "b");
1405  h_ele_etaEff->Print();
1406  h_ele_etaEff->GetXaxis()->SetTitle("#eta");
1407  h_ele_etaEff->GetYaxis()->SetTitle("Efficiency");
1408 
1409  // efficiency vs z
1410  TH1F *h_ele_zEff = (TH1F *)h_ele_matchingObjectZ_matched->Clone("h_ele_zEff");
1411  h_ele_zEff->Reset();
1412  h_ele_zEff->Divide(h_ele_matchingObjectZ_matched, h_matchingObjectZ, 1, 1, "b");
1413  h_ele_zEff->Print();
1414  h_ele_zEff->GetXaxis()->SetTitle("z (cm)");
1415  h_ele_zEff->GetYaxis()->SetTitle("Efficiency");
1416 
1417  // efficiency vs |eta|
1418  TH1F *h_ele_absetaEff = (TH1F *)h_ele_matchingObjectAbsEta_matched->Clone("h_ele_absetaEff");
1419  h_ele_absetaEff->Reset();
1420  h_ele_absetaEff->Divide(h_ele_matchingObjectAbsEta_matched, h_matchingObjectAbsEta, 1, 1, "b");
1421  h_ele_absetaEff->GetXaxis()->SetTitle("|#eta|");
1422  h_ele_absetaEff->GetYaxis()->SetTitle("Efficiency");
1423 
1424  // efficiency vs pt
1425  TH1F *h_ele_ptEff = (TH1F *)h_ele_matchingObjectPt_matched->Clone("h_ele_ptEff");
1426  h_ele_ptEff->Reset();
1427  h_ele_ptEff->Divide(h_ele_matchingObjectPt_matched, h_matchingObjectPt, 1, 1, "b");
1428  h_ele_ptEff->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1429  h_ele_ptEff->GetYaxis()->SetTitle("Efficiency");
1430 
1431  // efficiency vs phi
1432  TH1F *h_ele_phiEff = (TH1F *)h_ele_matchingObjectPhi_matched->Clone("h_ele_phiEff");
1433  h_ele_phiEff->Reset();
1434  h_ele_phiEff->Divide(h_ele_matchingObjectPhi_matched, h_matchingObjectPhi, 1, 1, "b");
1435  h_ele_phiEff->GetXaxis()->SetTitle("#phi (rad)");
1436  h_ele_phiEff->GetYaxis()->SetTitle("Efficiency");
1437 
1438  // classes
1439  TH1F *h_ele_eta_goldenFrac = (TH1F *)h_ele_eta_golden->Clone("h_ele_eta_goldenFrac");
1440  h_ele_eta_goldenFrac->Reset();
1441  h_ele_eta_goldenFrac->Divide(h_ele_eta_golden, h_ele_eta, 1, 1);
1442  h_ele_eta_goldenFrac->GetXaxis()->SetTitle("|#eta|");
1443  h_ele_eta_goldenFrac->GetYaxis()->SetTitle("Fraction of electrons");
1444  h_ele_eta_goldenFrac->SetTitle("fraction of golden electrons vs eta");
1445  TH1F *h_ele_eta_bbremFrac = (TH1F *)h_ele_eta_bbrem->Clone("h_ele_eta_bbremFrac");
1446  h_ele_eta_bbremFrac->Reset();
1447  h_ele_eta_bbremFrac->Divide(h_ele_eta_bbrem, h_ele_eta, 1, 1);
1448  h_ele_eta_bbremFrac->GetXaxis()->SetTitle("|#eta|");
1449  h_ele_eta_bbremFrac->GetYaxis()->SetTitle("Fraction of electrons");
1450  h_ele_eta_bbremFrac->SetTitle("fraction of big brem electrons vs eta");
1451  TH1F *h_ele_eta_narrowFrac = (TH1F *)h_ele_eta_narrow->Clone("h_ele_eta_narrowFrac");
1452  h_ele_eta_narrowFrac->Reset();
1453  h_ele_eta_narrowFrac->Divide(h_ele_eta_narrow, h_ele_eta, 1, 1);
1454  h_ele_eta_narrowFrac->GetXaxis()->SetTitle("|#eta|");
1455  h_ele_eta_narrowFrac->GetYaxis()->SetTitle("Fraction of electrons");
1456  h_ele_eta_narrowFrac->SetTitle("fraction of narrow electrons vs eta");
1457  TH1F *h_ele_eta_showerFrac = (TH1F *)h_ele_eta_shower->Clone("h_ele_eta_showerFrac");
1458  h_ele_eta_showerFrac->Reset();
1459  h_ele_eta_showerFrac->Divide(h_ele_eta_shower, h_ele_eta, 1, 1);
1460  h_ele_eta_showerFrac->GetXaxis()->SetTitle("|#eta|");
1461  h_ele_eta_showerFrac->GetYaxis()->SetTitle("Fraction of electrons");
1462  h_ele_eta_showerFrac->SetTitle("fraction of showering electrons vs eta");
1463 
1464  // fbrem
1465  TH1F *h_ele_xOverX0VsEta = new TH1F("h_ele_xOverx0VsEta", "mean X/X_0 vs eta", nbineta / 2, 0.0, 2.5);
1466  for (int ibin = 1; ibin < h_ele_fbremVsEta_mean->GetNbinsX() + 1; ibin++) {
1467  double xOverX0 = 0.;
1468  if (h_ele_fbremVsEta_mean->GetBinContent(ibin) > 0.)
1469  xOverX0 = -log(h_ele_fbremVsEta_mean->GetBinContent(ibin));
1470  h_ele_xOverX0VsEta->SetBinContent(ibin, xOverX0);
1471  }
1472 
1473  //profiles from 2D histos
1474  TProfile *p_ele_PoPmatchingObjectVsEta_matched = h_ele_PoPmatchingObjectVsEta_matched->ProfileX();
1475  p_ele_PoPmatchingObjectVsEta_matched->SetTitle("mean ele momentum / matching SC energy vs eta");
1476  p_ele_PoPmatchingObjectVsEta_matched->GetXaxis()->SetTitle("#eta");
1477  p_ele_PoPmatchingObjectVsEta_matched->GetYaxis()->SetTitle("<P/E_{matching SC}>");
1478  p_ele_PoPmatchingObjectVsEta_matched->Write();
1479  TProfile *p_ele_PoPmatchingObjectVsPhi_matched = h_ele_PoPmatchingObjectVsPhi_matched->ProfileX();
1480  p_ele_PoPmatchingObjectVsPhi_matched->SetTitle("mean ele momentum / gen momentum vs phi");
1481  p_ele_PoPmatchingObjectVsPhi_matched->GetXaxis()->SetTitle("#phi (rad)");
1482  p_ele_PoPmatchingObjectVsPhi_matched->GetYaxis()->SetTitle("<P/E_{matching SC}>");
1483  p_ele_PoPmatchingObjectVsPhi_matched->Write();
1484  TProfile *p_ele_EtaMnEtamatchingObjectVsEta_matched = h_ele_EtaMnEtamatchingObjectVsEta_matched->ProfileX();
1485  p_ele_EtaMnEtamatchingObjectVsEta_matched->GetXaxis()->SetTitle("#eta");
1486  p_ele_EtaMnEtamatchingObjectVsEta_matched->GetYaxis()->SetTitle("<#eta_{rec} - #eta_{matching SC}>");
1487  p_ele_EtaMnEtamatchingObjectVsEta_matched->Write();
1488  TProfile *p_ele_EtaMnEtamatchingObjectVsPhi_matched = h_ele_EtaMnEtamatchingObjectVsPhi_matched->ProfileX();
1489  p_ele_EtaMnEtamatchingObjectVsPhi_matched->GetXaxis()->SetTitle("#phi");
1490  p_ele_EtaMnEtamatchingObjectVsPhi_matched->GetYaxis()->SetTitle("<#eta_{rec} - #eta_{matching SC}>");
1491  p_ele_EtaMnEtamatchingObjectVsPhi_matched->Write();
1492  TProfile *p_ele_PhiMnPhimatchingObjectVsEta_matched = h_ele_PhiMnPhimatchingObjectVsEta_matched->ProfileX();
1493  p_ele_PhiMnPhimatchingObjectVsEta_matched->GetXaxis()->SetTitle("#eta");
1494  p_ele_PhiMnPhimatchingObjectVsEta_matched->GetYaxis()->SetTitle("<#phi_{rec} - #phi_{matching SC}> (rad)");
1495  p_ele_PhiMnPhimatchingObjectVsEta_matched->Write();
1496  TProfile *p_ele_PhiMnPhimatchingObjectVsPhi_matched = h_ele_PhiMnPhimatchingObjectVsPhi_matched->ProfileX();
1497  p_ele_PhiMnPhimatchingObjectVsPhi_matched->GetXaxis()->SetTitle("#phi");
1498  p_ele_PhiMnPhimatchingObjectVsPhi_matched->GetYaxis()->SetTitle("<#phi_{rec} - #phi_{matching SC}> (rad)");
1499  p_ele_PhiMnPhimatchingObjectVsPhi_matched->Write();
1500  TProfile *p_ele_vertexPtVsEta = h_ele_vertexPtVsEta->ProfileX();
1501  p_ele_vertexPtVsEta->GetXaxis()->SetTitle("#eta");
1502  p_ele_vertexPtVsEta->GetYaxis()->SetTitle("<p_{T}> (GeV/c)");
1503  p_ele_vertexPtVsEta->Write();
1504  TProfile *p_ele_vertexPtVsPhi = h_ele_vertexPtVsPhi->ProfileX();
1505  p_ele_vertexPtVsPhi->GetXaxis()->SetTitle("#phi (rad)");
1506  p_ele_vertexPtVsPhi->GetYaxis()->SetTitle("<p_{T}> (GeV/c)");
1507  p_ele_vertexPtVsPhi->Write();
1508  TProfile *p_ele_EoPVsEta = h_ele_EoPVsEta->ProfileX();
1509  p_ele_EoPVsEta->GetXaxis()->SetTitle("#eta");
1510  p_ele_EoPVsEta->GetYaxis()->SetTitle("<E/P_{vertex}>");
1511  p_ele_EoPVsEta->Write();
1512  TProfile *p_ele_EoPVsPhi = h_ele_EoPVsPhi->ProfileX();
1513  p_ele_EoPVsPhi->GetXaxis()->SetTitle("#phi (rad)");
1514  p_ele_EoPVsPhi->GetYaxis()->SetTitle("<E/P_{vertex}>");
1515  p_ele_EoPVsPhi->Write();
1516  TProfile *p_ele_EoPoutVsEta = h_ele_EoPoutVsEta->ProfileX();
1517  p_ele_EoPoutVsEta->GetXaxis()->SetTitle("#eta");
1518  p_ele_EoPoutVsEta->GetYaxis()->SetTitle("<E_{seed}/P_{out}>");
1519  p_ele_EoPoutVsEta->Write();
1520  TProfile *p_ele_EoPoutVsPhi = h_ele_EoPoutVsPhi->ProfileX();
1521  p_ele_EoPoutVsPhi->GetXaxis()->SetTitle("#phi (rad)");
1522  p_ele_EoPoutVsPhi->GetYaxis()->SetTitle("<E_{seed}/P_{out}>");
1523  p_ele_EoPoutVsPhi->Write();
1524  TProfile *p_ele_EeleOPoutVsEta = h_ele_EeleOPoutVsEta->ProfileX();
1525  p_ele_EeleOPoutVsEta->SetTitle("mean ele Eele/pout vs eta");
1526  p_ele_EeleOPoutVsEta->GetXaxis()->SetTitle("#eta");
1527  p_ele_EeleOPoutVsEta->GetYaxis()->SetTitle("<E_{ele}/P_{out}>");
1528  p_ele_EeleOPoutVsEta->Write();
1529  TProfile *p_ele_EeleOPoutVsPhi = h_ele_EeleOPoutVsPhi->ProfileX();
1530  p_ele_EeleOPoutVsPhi->SetTitle("mean ele Eele/pout vs phi");
1531  p_ele_EeleOPoutVsPhi->GetXaxis()->SetTitle("#phi (rad)");
1532  p_ele_EeleOPoutVsPhi->GetYaxis()->SetTitle("<E_{ele}/P_{out}>");
1533  p_ele_EeleOPoutVsPhi->Write();
1534  TProfile *p_ele_HoEVsEta = h_ele_HoEVsEta->ProfileX();
1535  p_ele_HoEVsEta->GetXaxis()->SetTitle("#eta");
1536  p_ele_HoEVsEta->GetYaxis()->SetTitle("<H/E>");
1537  p_ele_HoEVsEta->Write();
1538  TProfile *p_ele_HoEVsPhi = h_ele_HoEVsPhi->ProfileX();
1539  p_ele_HoEVsPhi->GetXaxis()->SetTitle("#phi (rad)");
1540  p_ele_HoEVsPhi->GetYaxis()->SetTitle("<H/E>");
1541  p_ele_HoEVsPhi->Write();
1542  TProfile *p_ele_chi2VsEta = h_ele_chi2VsEta->ProfileX();
1543  p_ele_chi2VsEta->GetXaxis()->SetTitle("#eta");
1544  p_ele_chi2VsEta->GetYaxis()->SetTitle("<#Chi^{2}>");
1545  p_ele_chi2VsEta->Write();
1546  TProfile *p_ele_chi2VsPhi = h_ele_chi2VsPhi->ProfileX();
1547  p_ele_chi2VsPhi->GetXaxis()->SetTitle("#phi (rad)");
1548  p_ele_chi2VsPhi->GetYaxis()->SetTitle("<#Chi^{2}>");
1549  p_ele_chi2VsPhi->Write();
1550  TProfile *p_ele_foundHitsVsEta = h_ele_foundHitsVsEta->ProfileX();
1551  p_ele_foundHitsVsEta->GetXaxis()->SetTitle("#eta");
1552  p_ele_foundHitsVsEta->GetYaxis()->SetTitle("<N_{hits}>");
1553  p_ele_foundHitsVsEta->Write();
1554  TProfile *p_ele_foundHitsVsPhi = h_ele_foundHitsVsPhi->ProfileX();
1555  p_ele_foundHitsVsPhi->GetXaxis()->SetTitle("#phi (rad)");
1556  p_ele_foundHitsVsPhi->GetYaxis()->SetTitle("<N_{hits}>");
1557  p_ele_foundHitsVsPhi->Write();
1558  TProfile *p_ele_lostHitsVsEta = h_ele_lostHitsVsEta->ProfileX();
1559  p_ele_lostHitsVsEta->GetXaxis()->SetTitle("#eta");
1560  p_ele_lostHitsVsEta->GetYaxis()->SetTitle("<N_{hits}>");
1561  p_ele_lostHitsVsEta->Write();
1562  TProfile *p_ele_lostHitsVsPhi = h_ele_lostHitsVsPhi->ProfileX();
1563  p_ele_lostHitsVsPhi->GetXaxis()->SetTitle("#phi (rad)");
1564  p_ele_lostHitsVsPhi->GetYaxis()->SetTitle("<N_{hits}>");
1565  p_ele_lostHitsVsPhi->Write();
1566  TProfile *p_ele_vertexTIPVsEta = h_ele_vertexTIPVsEta->ProfileX();
1567  p_ele_vertexTIPVsEta->SetTitle("mean tip (wrt gen vtx) vs eta");
1568  p_ele_vertexTIPVsEta->GetXaxis()->SetTitle("#eta");
1569  p_ele_vertexTIPVsEta->GetYaxis()->SetTitle("<TIP> (cm)");
1570  p_ele_vertexTIPVsEta->Write();
1571  TProfile *p_ele_vertexTIPVsPhi = h_ele_vertexTIPVsPhi->ProfileX();
1572  p_ele_vertexTIPVsPhi->SetTitle("mean tip (wrt gen vtx) vs phi");
1573  p_ele_vertexTIPVsPhi->GetXaxis()->SetTitle("#phi");
1574  p_ele_vertexTIPVsPhi->GetYaxis()->SetTitle("<TIP> (cm)");
1575  p_ele_vertexTIPVsPhi->Write();
1576  TProfile *p_ele_vertexTIPVsPt = h_ele_vertexTIPVsPt->ProfileX();
1577  p_ele_vertexTIPVsPt->SetTitle("mean tip (wrt gen vtx) vs phi");
1578  p_ele_vertexTIPVsPt->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1579  p_ele_vertexTIPVsPt->GetYaxis()->SetTitle("<TIP> (cm)");
1580  p_ele_vertexTIPVsPt->Write();
1581 
1582  // mc truth
1583 
1584  h_matchingObjectNum->Write();
1585 
1586  // rec event
1587 
1588  histNum_->Write();
1589 
1590  // mc
1591  h_matchingObjectEta->Write();
1592  h_matchingObjectAbsEta->Write();
1593  h_matchingObjectP->Write();
1594  h_matchingObjectPt->Write();
1595  h_matchingObjectPhi->Write();
1596  h_matchingObjectZ->Write();
1597 
1598  h_ele_mee_all->Write();
1599  h_ele_mee_os->Write();
1600  h_ele_mee_os_ebeb->Write();
1601  h_ele_mee_os_ebee->Write();
1602  h_ele_mee_os_eeee->Write();
1603  h_ele_mee_os_gg->Write();
1604  h_ele_mee_os_gb->Write();
1605  h_ele_mee_os_bb->Write();
1606  h_ele_E2mnE1vsMee_all->Write();
1607  h_ele_E2mnE1vsMee_egeg_all->Write();
1608 
1609  // matched electrons
1610  h_ele_charge->Write();
1611  h_ele_chargeVsEta->Write();
1612  h_ele_chargeVsPhi->Write();
1613  h_ele_chargeVsPt->Write();
1614  h_ele_vertexP->Write();
1615  h_ele_vertexPt->Write();
1616  h_ele_Et->Write();
1617  h_ele_vertexPtVsEta->Write();
1618  h_ele_vertexPtVsPhi->Write();
1620  h_ele_vertexEta->Write();
1621  h_ele_vertexEtaVsPhi->Write();
1625  h_ele_vertexPhi->Write();
1626  h_ele_vertexX->Write();
1627  h_ele_vertexY->Write();
1628  h_ele_vertexZ->Write();
1629  h_ele_vertexTIP->Write();
1631  h_ele_vertexTIPVsEta->Write();
1632  h_ele_vertexTIPVsPhi->Write();
1633  h_ele_vertexTIPVsPt->Write();
1652 
1653  // matched electron, superclusters
1654  histSclEn_->Write();
1659  histSclEt_->Write();
1660  histSclEtVsEta_->Write();
1661  histSclEtVsPhi_->Write();
1662  histSclEtaVsPhi_->Write();
1663  histSclEta_->Write();
1664  histSclPhi_->Write();
1665  histSclSigEtaEta_->Write();
1666  histSclSigIEtaIEta_barrel_->Write();
1667  histSclSigIEtaIEta_endcaps_->Write();
1668  histSclE1x5_->Write();
1669  histSclE1x5_barrel_->Write();
1670  histSclE1x5_endcaps_->Write();
1671  histSclE2x5max_->Write();
1672  histSclE2x5max_barrel_->Write();
1673  histSclE2x5max_endcaps_->Write();
1674  histSclE5x5_->Write();
1675  histSclE5x5_barrel_->Write();
1676  histSclE5x5_endcaps_->Write();
1677 
1678  // matched electron, gsf tracks
1679  h_ele_ambiguousTracks->Write();
1680  h_ele_ambiguousTracksVsEta->Write();
1681  h_ele_ambiguousTracksVsPhi->Write();
1682  h_ele_ambiguousTracksVsPt->Write();
1683  h_ele_foundHits->Write();
1684  h_ele_foundHitsVsEta->Write();
1685  h_ele_foundHitsVsPhi->Write();
1686  h_ele_foundHitsVsPt->Write();
1687  h_ele_lostHits->Write();
1688  h_ele_lostHitsVsEta->Write();
1689  h_ele_lostHitsVsPhi->Write();
1690  h_ele_lostHitsVsPt->Write();
1691  h_ele_chi2->Write();
1692  h_ele_chi2VsEta->Write();
1693  h_ele_chi2VsPhi->Write();
1694  h_ele_chi2VsPt->Write();
1695  h_ele_PinMnPout->Write();
1696  h_ele_PinMnPout_mode->Write();
1697  h_ele_PinMnPoutVsEta_mode->Write();
1698  h_ele_PinMnPoutVsPhi_mode->Write();
1699  h_ele_PinMnPoutVsPt_mode->Write();
1700  h_ele_PinMnPoutVsE_mode->Write();
1701  h_ele_PinMnPoutVsChi2_mode->Write();
1702  h_ele_outerP->Write();
1703  h_ele_outerP_mode->Write();
1704  h_ele_outerPVsEta_mode->Write();
1705  h_ele_outerPt->Write();
1706  h_ele_outerPt_mode->Write();
1707  h_ele_outerPtVsEta_mode->Write();
1708  h_ele_outerPtVsPhi_mode->Write();
1709  h_ele_outerPtVsPt_mode->Write();
1710 
1711  // matched electrons, matching
1712  h_ele_EoP->Write();
1713  h_ele_EoPVsEta->Write();
1714  h_ele_EoPVsPhi->Write();
1715  h_ele_EoPVsE->Write();
1716  h_ele_EseedOP->Write();
1717  h_ele_EseedOPVsEta->Write();
1718  h_ele_EseedOPVsPhi->Write();
1719  h_ele_EseedOPVsE->Write();
1720  h_ele_EoPout->Write();
1721  h_ele_EoPoutVsEta->Write();
1722  h_ele_EoPoutVsPhi->Write();
1723  h_ele_EoPoutVsE->Write();
1724  h_ele_EeleOPout->Write();
1725  h_ele_EeleOPoutVsEta->Write();
1726  h_ele_EeleOPoutVsPhi->Write();
1727  h_ele_EeleOPoutVsE->Write();
1728  h_ele_dEtaSc_propVtx->Write();
1729  h_ele_dEtaScVsEta_propVtx->Write();
1730  h_ele_dEtaScVsPhi_propVtx->Write();
1731  h_ele_dEtaScVsPt_propVtx->Write();
1732  h_ele_dPhiSc_propVtx->Write();
1733  h_ele_dPhiScVsEta_propVtx->Write();
1734  h_ele_dPhiScVsPhi_propVtx->Write();
1735  h_ele_dPhiScVsPt_propVtx->Write();
1736  h_ele_dEtaCl_propOut->Write();
1737  h_ele_dEtaClVsEta_propOut->Write();
1738  h_ele_dEtaClVsPhi_propOut->Write();
1739  h_ele_dEtaClVsPt_propOut->Write();
1740  h_ele_dPhiCl_propOut->Write();
1741  h_ele_dPhiClVsEta_propOut->Write();
1742  h_ele_dPhiClVsPhi_propOut->Write();
1743  h_ele_dPhiClVsPt_propOut->Write();
1744  h_ele_dEtaEleCl_propOut->Write();
1747  h_ele_dEtaEleClVsPt_propOut->Write();
1748  h_ele_dPhiEleCl_propOut->Write();
1751  h_ele_dPhiEleClVsPt_propOut->Write();
1752  h_ele_HoE->Write();
1753  h_ele_HoE_fiducial->Write();
1754  h_ele_HoEVsEta->Write();
1755  h_ele_HoEVsPhi->Write();
1756  h_ele_HoEVsE->Write();
1757 
1758  h_ele_seed_dphi2_->Write();
1759  h_ele_seed_subdet2_->Write();
1760  TProfile *p_ele_seed_dphi2VsEta_ = h_ele_seed_dphi2VsEta_->ProfileX();
1761  p_ele_seed_dphi2VsEta_->SetTitle("mean ele seed dphi 2nd layer vs eta");
1762  p_ele_seed_dphi2VsEta_->GetXaxis()->SetTitle("#eta");
1763  p_ele_seed_dphi2VsEta_->GetYaxis()->SetTitle("<#phi_{pred} - #phi_{hit}, 2nd layer> (rad)");
1764  p_ele_seed_dphi2VsEta_->SetMinimum(-0.004);
1765  p_ele_seed_dphi2VsEta_->SetMaximum(0.004);
1766  p_ele_seed_dphi2VsEta_->Write();
1767  TProfile *p_ele_seed_dphi2VsPt_ = h_ele_seed_dphi2VsPt_->ProfileX();
1768  p_ele_seed_dphi2VsPt_->SetTitle("mean ele seed dphi 2nd layer vs pt");
1769  p_ele_seed_dphi2VsPt_->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1770  p_ele_seed_dphi2VsPt_->GetYaxis()->SetTitle("<#phi_{pred} - #phi_{hit}, 2nd layer> (rad)");
1771  p_ele_seed_dphi2VsPt_->Write();
1772  p_ele_seed_dphi2VsPt_->SetMinimum(-0.004);
1773  p_ele_seed_dphi2VsPt_->SetMaximum(0.004);
1774  h_ele_seed_drz2_->Write();
1775  TProfile *p_ele_seed_drz2VsEta_ = h_ele_seed_drz2VsEta_->ProfileX();
1776  p_ele_seed_drz2VsEta_->SetTitle("mean ele seed dr(dz) 2nd layer vs eta");
1777  p_ele_seed_drz2VsEta_->GetXaxis()->SetTitle("#eta");
1778  p_ele_seed_drz2VsEta_->GetYaxis()->SetTitle("<r(z)_{pred} - r(z)_{hit}, 2nd layer> (cm)");
1779  p_ele_seed_drz2VsEta_->SetMinimum(-0.15);
1780  p_ele_seed_drz2VsEta_->SetMaximum(0.15);
1781  p_ele_seed_drz2VsEta_->Write();
1782  TProfile *p_ele_seed_drz2VsPt_ = h_ele_seed_drz2VsPt_->ProfileX();
1783  p_ele_seed_drz2VsPt_->SetTitle("mean ele seed dr(dz) 2nd layer vs pt");
1784  p_ele_seed_drz2VsPt_->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1785  p_ele_seed_drz2VsPt_->GetYaxis()->SetTitle("<r(z)_{pred} - r(z)_{hit}, 2nd layer> (cm)");
1786  p_ele_seed_drz2VsPt_->SetMinimum(-0.15);
1787  p_ele_seed_drz2VsPt_->SetMaximum(0.15);
1788  p_ele_seed_drz2VsPt_->Write();
1789 
1790  // classes
1791  h_ele_classes->Write();
1792  h_ele_eta->Write();
1793  h_ele_eta_golden->Write();
1794  h_ele_eta_bbrem->Write();
1795  h_ele_eta_narrow->Write();
1796  h_ele_eta_shower->Write();
1797  h_ele_PinVsPoutGolden_mode->Write();
1799  h_ele_PinVsPoutGolden_mean->Write();
1809 
1810  // fbrem
1811  h_ele_fbrem->Write();
1812  h_ele_fbremVsEta_mode->Write();
1813  h_ele_fbremVsEta_mean->Write();
1814  h_ele_etaEff->Write();
1815  h_ele_zEff->Write();
1816  h_ele_phiEff->Write();
1817  h_ele_absetaEff->Write();
1818  h_ele_ptEff->Write();
1819  h_ele_eta_goldenFrac->Write();
1820  h_ele_eta_bbremFrac->Write();
1821  h_ele_eta_narrowFrac->Write();
1822  h_ele_eta_showerFrac->Write();
1823  h_ele_xOverX0VsEta->Write();
1824 
1825  // e/g et pflow electrons
1826  h_ele_mva->Write();
1827  h_ele_provenance->Write();
1828 
1829  // isolation
1830  h_ele_tkSumPt_dr03->GetXaxis()->SetTitle("TkIsoSum, cone 0.3 (GeV/c)");
1831  h_ele_tkSumPt_dr03->GetYaxis()->SetTitle("Events");
1832  h_ele_tkSumPt_dr03->Write();
1833  h_ele_ecalRecHitSumEt_dr03->GetXaxis()->SetTitle("EcalIsoSum, cone 0.3 (GeV)");
1834  h_ele_ecalRecHitSumEt_dr03->GetYaxis()->SetTitle("Events");
1835  h_ele_ecalRecHitSumEt_dr03->Write();
1836  h_ele_hcalDepth1TowerSumEt_dr03->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.3 (GeV)");
1837  h_ele_hcalDepth1TowerSumEt_dr03->GetYaxis()->SetTitle("Events");
1839  h_ele_hcalDepth2TowerSumEt_dr03->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.3 (GeV)");
1840  h_ele_hcalDepth2TowerSumEt_dr03->GetYaxis()->SetTitle("Events");
1842  h_ele_tkSumPt_dr04->GetXaxis()->SetTitle("TkIsoSum, cone 0.4 (GeV/c)");
1843  h_ele_tkSumPt_dr04->GetYaxis()->SetTitle("Events");
1844  h_ele_tkSumPt_dr04->Write();
1845  h_ele_ecalRecHitSumEt_dr04->GetXaxis()->SetTitle("EcalIsoSum, cone 0.4 (GeV)");
1846  h_ele_ecalRecHitSumEt_dr04->GetYaxis()->SetTitle("Events");
1847  h_ele_ecalRecHitSumEt_dr04->Write();
1848  h_ele_hcalDepth1TowerSumEt_dr04->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.4 (GeV)");
1849  h_ele_hcalDepth1TowerSumEt_dr04->GetYaxis()->SetTitle("Events");
1851  h_ele_hcalDepth2TowerSumEt_dr04->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.4 (GeV)");
1852  h_ele_hcalDepth2TowerSumEt_dr04->GetYaxis()->SetTitle("Events");
1854 }
1855 
1857  std::cout << "analyzing new event " << std::endl;
1858  nEvents_++;
1859 
1860  // check event pass requested triggers if any
1861  if (!trigger(iEvent))
1862  return;
1863 
1864  std::cout << "new event passing trigger " << std::endl;
1865  nAfterTrigger_++;
1866 
1867  // get reco electrons
1870  edm::LogInfo("") << "\n\n =================> Treating event " << iEvent.id() << " Number of electrons "
1871  << gsfElectrons.product()->size();
1872 
1873  // get reco supercluster collection
1875  iEvent.getByLabel(matchingObjectCollection_, recoClusters);
1876 
1877  // get the beamspot from the Event:
1878  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
1879  iEvent.getByLabel(beamSpot_, recoBeamSpotHandle);
1880  const BeamSpot bs = *recoBeamSpotHandle;
1881 
1882  histNum_->Fill((*gsfElectrons).size());
1883 
1884  // selected rec electrons
1885  for (reco::GsfElectronCollection::const_iterator gsfIter = gsfElectrons->begin(); gsfIter != gsfElectrons->end();
1886  gsfIter++) {
1887  // select electrons
1888  if (gsfIter->superCluster()->energy() / cosh(gsfIter->superCluster()->eta()) < minEt_)
1889  continue;
1890  if (std::abs(gsfIter->eta()) > maxAbsEta_)
1891  continue;
1892  if (gsfIter->pt() < minPt_)
1893  continue;
1894 
1895  if (gsfIter->isEB() && isEE_)
1896  continue;
1897  if (gsfIter->isEE() && isEB_)
1898  continue;
1899  if (gsfIter->isEBEEGap() && isNotEBEEGap_)
1900  continue;
1901 
1902  if (gsfIter->ecalDrivenSeed() && isTrackerDriven_)
1903  continue;
1904  if (gsfIter->trackerDrivenSeed() && isEcalDriven_)
1905  continue;
1906 
1907  if (gsfIter->isEB() && gsfIter->eSuperClusterOverP() < eOverPMinBarrel_)
1908  continue;
1909  if (gsfIter->isEB() && gsfIter->eSuperClusterOverP() > eOverPMaxBarrel_)
1910  continue;
1911  if (gsfIter->isEE() && gsfIter->eSuperClusterOverP() < eOverPMinEndcaps_)
1912  continue;
1913  if (gsfIter->isEE() && gsfIter->eSuperClusterOverP() > eOverPMaxEndcaps_)
1914  continue;
1915  if (gsfIter->isEB() && std::abs(gsfIter->deltaEtaSuperClusterTrackAtVtx()) < dEtaMinBarrel_)
1916  continue;
1917  if (gsfIter->isEB() && std::abs(gsfIter->deltaEtaSuperClusterTrackAtVtx()) > dEtaMaxBarrel_)
1918  continue;
1919  if (gsfIter->isEE() && std::abs(gsfIter->deltaEtaSuperClusterTrackAtVtx()) < dEtaMinEndcaps_)
1920  continue;
1921  if (gsfIter->isEE() && std::abs(gsfIter->deltaEtaSuperClusterTrackAtVtx()) > dEtaMaxEndcaps_)
1922  continue;
1923  if (gsfIter->isEB() && std::abs(gsfIter->deltaPhiSuperClusterTrackAtVtx()) < dPhiMinBarrel_)
1924  continue;
1925  if (gsfIter->isEB() && std::abs(gsfIter->deltaPhiSuperClusterTrackAtVtx()) > dPhiMaxBarrel_)
1926  continue;
1927  if (gsfIter->isEE() && std::abs(gsfIter->deltaPhiSuperClusterTrackAtVtx()) < dPhiMinEndcaps_)
1928  continue;
1929  if (gsfIter->isEE() && std::abs(gsfIter->deltaPhiSuperClusterTrackAtVtx()) > dPhiMaxEndcaps_)
1930  continue;
1931  if (gsfIter->isEB() && gsfIter->scSigmaIEtaIEta() < sigIetaIetaMinBarrel_)
1932  continue;
1933  if (gsfIter->isEB() && gsfIter->scSigmaIEtaIEta() > sigIetaIetaMaxBarrel_)
1934  continue;
1935  if (gsfIter->isEE() && gsfIter->scSigmaIEtaIEta() < sigIetaIetaMinEndcaps_)
1936  continue;
1937  if (gsfIter->isEE() && gsfIter->scSigmaIEtaIEta() > sigIetaIetaMaxEndcaps_)
1938  continue;
1939  if (gsfIter->isEB() && gsfIter->hadronicOverEm() > hadronicOverEmMaxBarrel_)
1940  continue;
1941  if (gsfIter->isEE() && gsfIter->hadronicOverEm() > hadronicOverEmMaxEndcaps_)
1942  continue;
1943  if (gsfIter->mva_e_pi() < mvaMin_)
1944  continue;
1945 
1946  double d = (gsfIter->vertex().x() - bs.position().x()) * (gsfIter->vertex().x() - bs.position().x()) +
1947  (gsfIter->vertex().y() - bs.position().y()) * (gsfIter->vertex().y() - bs.position().y());
1948  d = sqrt(d);
1949  if (gsfIter->isEB() && d > tipMaxBarrel_)
1950  continue;
1951  if (gsfIter->isEE() && d > tipMaxEndcaps_)
1952  continue;
1953 
1954  if (gsfIter->dr03TkSumPt() > tkIso03Max_)
1955  continue;
1956  if (gsfIter->isEB() && gsfIter->dr03HcalTowerSumEt(1) > hcalIso03Depth1MaxBarrel_)
1957  continue;
1958  if (gsfIter->isEE() && gsfIter->dr03HcalTowerSumEt(1) > hcalIso03Depth1MaxEndcaps_)
1959  continue;
1960  if (gsfIter->isEE() && gsfIter->dr03HcalTowerSumEt(2) > hcalIso03Depth2MaxEndcaps_)
1961  continue;
1962  if (gsfIter->isEB() && gsfIter->dr03EcalRecHitSumEt() > ecalIso03MaxBarrel_)
1963  continue;
1964  if (gsfIter->isEE() && gsfIter->dr03EcalRecHitSumEt() > ecalIso03MaxEndcaps_)
1965  continue;
1966 
1967  // electron related distributions
1968  h_ele_charge->Fill(gsfIter->charge());
1969  h_ele_chargeVsEta->Fill(gsfIter->eta(), gsfIter->charge());
1970  h_ele_chargeVsPhi->Fill(gsfIter->phi(), gsfIter->charge());
1971  h_ele_chargeVsPt->Fill(gsfIter->pt(), gsfIter->charge());
1972  h_ele_vertexP->Fill(gsfIter->p());
1973  h_ele_vertexPt->Fill(gsfIter->pt());
1974  h_ele_Et->Fill(gsfIter->superCluster()->energy() / cosh(gsfIter->superCluster()->eta()));
1975  h_ele_vertexPtVsEta->Fill(gsfIter->eta(), gsfIter->pt());
1976  h_ele_vertexPtVsPhi->Fill(gsfIter->phi(), gsfIter->pt());
1977  h_ele_vertexEta->Fill(gsfIter->eta());
1978 
1979  h_ele_vertexEtaVsPhi->Fill(gsfIter->phi(), gsfIter->eta());
1980  h_ele_vertexPhi->Fill(gsfIter->phi());
1981  h_ele_vertexX->Fill(gsfIter->vertex().x());
1982  h_ele_vertexY->Fill(gsfIter->vertex().y());
1983  h_ele_vertexZ->Fill(gsfIter->vertex().z());
1984  h_ele_vertexTIP->Fill(d);
1985  h_ele_vertexTIPVsEta->Fill(gsfIter->eta(), d);
1986  h_ele_vertexTIPVsPhi->Fill(gsfIter->phi(), d);
1987  h_ele_vertexTIPVsPt->Fill(gsfIter->pt(), d);
1988 
1989  // supercluster related distributions
1990  reco::SuperClusterRef sclRef = gsfIter->superCluster();
1991  if (!gsfIter->ecalDrivenSeed() && gsfIter->trackerDrivenSeed())
1992  sclRef = gsfIter->parentSuperCluster();
1993  histSclEn_->Fill(sclRef->energy());
1994  double R = std::sqrt(sclRef->x() * sclRef->x() + sclRef->y() * sclRef->y() + sclRef->z() * sclRef->z());
1995  double Rt = std::sqrt(sclRef->x() * sclRef->x() + sclRef->y() * sclRef->y());
1996  histSclEt_->Fill(sclRef->energy() * (Rt / R));
1997  histSclEtVsEta_->Fill(sclRef->eta(), sclRef->energy() * (Rt / R));
1998  histSclEtVsPhi_->Fill(sclRef->phi(), sclRef->energy() * (Rt / R));
1999  histSclEta_->Fill(sclRef->eta());
2000  histSclEtaVsPhi_->Fill(sclRef->phi(), sclRef->eta());
2001  histSclPhi_->Fill(sclRef->phi());
2002  histSclSigEtaEta_->Fill(gsfIter->scSigmaEtaEta());
2003  if (gsfIter->isEB())
2004  histSclSigIEtaIEta_barrel_->Fill(gsfIter->scSigmaIEtaIEta());
2005  if (gsfIter->isEE())
2006  histSclSigIEtaIEta_endcaps_->Fill(gsfIter->scSigmaIEtaIEta());
2007  histSclE1x5_->Fill(gsfIter->scE1x5());
2008  if (gsfIter->isEB())
2009  histSclE1x5_barrel_->Fill(gsfIter->scE1x5());
2010  if (gsfIter->isEE())
2011  histSclE1x5_endcaps_->Fill(gsfIter->scE1x5());
2012  histSclE2x5max_->Fill(gsfIter->scE2x5Max());
2013  if (gsfIter->isEB())
2014  histSclE2x5max_barrel_->Fill(gsfIter->scE2x5Max());
2015  if (gsfIter->isEE())
2016  histSclE2x5max_endcaps_->Fill(gsfIter->scE2x5Max());
2017  histSclE5x5_->Fill(gsfIter->scE5x5());
2018  if (gsfIter->isEB())
2019  histSclE5x5_barrel_->Fill(gsfIter->scE5x5());
2020  if (gsfIter->isEE())
2021  histSclE5x5_endcaps_->Fill(gsfIter->scE5x5());
2022 
2023  // track related distributions
2024  h_ele_ambiguousTracks->Fill(gsfIter->ambiguousGsfTracksSize());
2025  h_ele_ambiguousTracksVsEta->Fill(gsfIter->eta(), gsfIter->ambiguousGsfTracksSize());
2026  h_ele_ambiguousTracksVsPhi->Fill(gsfIter->phi(), gsfIter->ambiguousGsfTracksSize());
2027  h_ele_ambiguousTracksVsPt->Fill(gsfIter->pt(), gsfIter->ambiguousGsfTracksSize());
2028  if (!readAOD_) { // track extra does not exist in AOD
2029  h_ele_foundHits->Fill(gsfIter->gsfTrack()->numberOfValidHits());
2030  h_ele_foundHitsVsEta->Fill(gsfIter->eta(), gsfIter->gsfTrack()->numberOfValidHits());
2031  h_ele_foundHitsVsPhi->Fill(gsfIter->phi(), gsfIter->gsfTrack()->numberOfValidHits());
2032  h_ele_foundHitsVsPt->Fill(gsfIter->pt(), gsfIter->gsfTrack()->numberOfValidHits());
2033  h_ele_lostHits->Fill(gsfIter->gsfTrack()->numberOfLostHits());
2034  h_ele_lostHitsVsEta->Fill(gsfIter->eta(), gsfIter->gsfTrack()->numberOfLostHits());
2035  h_ele_lostHitsVsPhi->Fill(gsfIter->phi(), gsfIter->gsfTrack()->numberOfLostHits());
2036  h_ele_lostHitsVsPt->Fill(gsfIter->pt(), gsfIter->gsfTrack()->numberOfLostHits());
2037  h_ele_chi2->Fill(gsfIter->gsfTrack()->normalizedChi2());
2038  h_ele_chi2VsEta->Fill(gsfIter->eta(), gsfIter->gsfTrack()->normalizedChi2());
2039  h_ele_chi2VsPhi->Fill(gsfIter->phi(), gsfIter->gsfTrack()->normalizedChi2());
2040  h_ele_chi2VsPt->Fill(gsfIter->pt(), gsfIter->gsfTrack()->normalizedChi2());
2041  }
2042  // from gsf track interface, hence using mean
2043  if (!readAOD_) { // track extra does not exist in AOD
2044  h_ele_PinMnPout->Fill(gsfIter->gsfTrack()->innerMomentum().R() - gsfIter->gsfTrack()->outerMomentum().R());
2045  h_ele_outerP->Fill(gsfIter->gsfTrack()->outerMomentum().R());
2046  h_ele_outerPt->Fill(gsfIter->gsfTrack()->outerMomentum().Rho());
2047  }
2048  // from electron interface, hence using mode
2049  h_ele_PinMnPout_mode->Fill(gsfIter->trackMomentumAtVtx().R() - gsfIter->trackMomentumOut().R());
2050  h_ele_PinMnPoutVsEta_mode->Fill(gsfIter->eta(),
2051  gsfIter->trackMomentumAtVtx().R() - gsfIter->trackMomentumOut().R());
2052  h_ele_PinMnPoutVsPhi_mode->Fill(gsfIter->phi(),
2053  gsfIter->trackMomentumAtVtx().R() - gsfIter->trackMomentumOut().R());
2054  h_ele_PinMnPoutVsPt_mode->Fill(gsfIter->pt(), gsfIter->trackMomentumAtVtx().R() - gsfIter->trackMomentumOut().R());
2055  h_ele_PinMnPoutVsE_mode->Fill(gsfIter->caloEnergy(),
2056  gsfIter->trackMomentumAtVtx().R() - gsfIter->trackMomentumOut().R());
2057  if (!readAOD_) // track extra does not exist in AOD
2058  h_ele_PinMnPoutVsChi2_mode->Fill(gsfIter->gsfTrack()->normalizedChi2(),
2059  gsfIter->trackMomentumAtVtx().R() - gsfIter->trackMomentumOut().R());
2060  h_ele_outerP_mode->Fill(gsfIter->trackMomentumOut().R());
2061  h_ele_outerPVsEta_mode->Fill(gsfIter->eta(), gsfIter->trackMomentumOut().R());
2062  h_ele_outerPt_mode->Fill(gsfIter->trackMomentumOut().Rho());
2063  h_ele_outerPtVsEta_mode->Fill(gsfIter->eta(), gsfIter->trackMomentumOut().Rho());
2064  h_ele_outerPtVsPhi_mode->Fill(gsfIter->phi(), gsfIter->trackMomentumOut().Rho());
2065  h_ele_outerPtVsPt_mode->Fill(gsfIter->pt(), gsfIter->trackMomentumOut().Rho());
2066 
2067  if (!readAOD_) { // track extra does not exist in AOD
2068  edm::RefToBase<TrajectorySeed> seed = gsfIter->gsfTrack()->extra()->seedRef();
2069  ElectronSeedRef elseed = seed.castTo<ElectronSeedRef>();
2070  h_ele_seed_dphi2_->Fill(elseed->dPhiNeg(1));
2071  h_ele_seed_dphi2VsEta_->Fill(gsfIter->eta(), elseed->dPhiNeg(1));
2072  h_ele_seed_dphi2VsPt_->Fill(gsfIter->pt(), elseed->dPhiNeg(1));
2073  h_ele_seed_drz2_->Fill(elseed->dRZNeg(1));
2074  h_ele_seed_drz2VsEta_->Fill(gsfIter->eta(), elseed->dRZNeg(1));
2075  h_ele_seed_drz2VsPt_->Fill(gsfIter->pt(), elseed->dRZNeg(1));
2076  h_ele_seed_subdet2_->Fill(elseed->subDet(1));
2077  }
2078  // match distributions
2079  h_ele_EoP->Fill(gsfIter->eSuperClusterOverP());
2080  h_ele_EoPVsEta->Fill(gsfIter->eta(), gsfIter->eSuperClusterOverP());
2081  h_ele_EoPVsPhi->Fill(gsfIter->phi(), gsfIter->eSuperClusterOverP());
2082  h_ele_EoPVsE->Fill(gsfIter->caloEnergy(), gsfIter->eSuperClusterOverP());
2083  h_ele_EseedOP->Fill(gsfIter->eSeedClusterOverP());
2084  h_ele_EseedOPVsEta->Fill(gsfIter->eta(), gsfIter->eSeedClusterOverP());
2085  h_ele_EseedOPVsPhi->Fill(gsfIter->phi(), gsfIter->eSeedClusterOverP());
2086  h_ele_EseedOPVsE->Fill(gsfIter->caloEnergy(), gsfIter->eSeedClusterOverP());
2087  h_ele_EoPout->Fill(gsfIter->eSeedClusterOverPout());
2088  h_ele_EoPoutVsEta->Fill(gsfIter->eta(), gsfIter->eSeedClusterOverPout());
2089  h_ele_EoPoutVsPhi->Fill(gsfIter->phi(), gsfIter->eSeedClusterOverPout());
2090  h_ele_EoPoutVsE->Fill(gsfIter->caloEnergy(), gsfIter->eSeedClusterOverPout());
2091  h_ele_EeleOPout->Fill(gsfIter->eEleClusterOverPout());
2092  h_ele_EeleOPoutVsEta->Fill(gsfIter->eta(), gsfIter->eEleClusterOverPout());
2093  h_ele_EeleOPoutVsPhi->Fill(gsfIter->phi(), gsfIter->eEleClusterOverPout());
2094  h_ele_EeleOPoutVsE->Fill(gsfIter->caloEnergy(), gsfIter->eEleClusterOverPout());
2095  h_ele_dEtaSc_propVtx->Fill(gsfIter->deltaEtaSuperClusterTrackAtVtx());
2096  h_ele_dEtaScVsEta_propVtx->Fill(gsfIter->eta(), gsfIter->deltaEtaSuperClusterTrackAtVtx());
2097  h_ele_dEtaScVsPhi_propVtx->Fill(gsfIter->phi(), gsfIter->deltaEtaSuperClusterTrackAtVtx());
2098  h_ele_dEtaScVsPt_propVtx->Fill(gsfIter->pt(), gsfIter->deltaEtaSuperClusterTrackAtVtx());
2099  h_ele_dPhiSc_propVtx->Fill(gsfIter->deltaPhiSuperClusterTrackAtVtx());
2100  h_ele_dPhiScVsEta_propVtx->Fill(gsfIter->eta(), gsfIter->deltaPhiSuperClusterTrackAtVtx());
2101  h_ele_dPhiScVsPhi_propVtx->Fill(gsfIter->phi(), gsfIter->deltaPhiSuperClusterTrackAtVtx());
2102  h_ele_dPhiScVsPt_propVtx->Fill(gsfIter->pt(), gsfIter->deltaPhiSuperClusterTrackAtVtx());
2103  h_ele_dEtaCl_propOut->Fill(gsfIter->deltaEtaSeedClusterTrackAtCalo());
2104  h_ele_dEtaClVsEta_propOut->Fill(gsfIter->eta(), gsfIter->deltaEtaSeedClusterTrackAtCalo());
2105  h_ele_dEtaClVsPhi_propOut->Fill(gsfIter->phi(), gsfIter->deltaEtaSeedClusterTrackAtCalo());
2106  h_ele_dEtaClVsPt_propOut->Fill(gsfIter->pt(), gsfIter->deltaEtaSeedClusterTrackAtCalo());
2107  h_ele_dPhiCl_propOut->Fill(gsfIter->deltaPhiSeedClusterTrackAtCalo());
2108  h_ele_dPhiClVsEta_propOut->Fill(gsfIter->eta(), gsfIter->deltaPhiSeedClusterTrackAtCalo());
2109  h_ele_dPhiClVsPhi_propOut->Fill(gsfIter->phi(), gsfIter->deltaPhiSeedClusterTrackAtCalo());
2110  h_ele_dPhiClVsPt_propOut->Fill(gsfIter->pt(), gsfIter->deltaPhiSeedClusterTrackAtCalo());
2111  h_ele_dEtaEleCl_propOut->Fill(gsfIter->deltaEtaEleClusterTrackAtCalo());
2112  h_ele_dEtaEleClVsEta_propOut->Fill(gsfIter->eta(), gsfIter->deltaEtaEleClusterTrackAtCalo());
2113  h_ele_dEtaEleClVsPhi_propOut->Fill(gsfIter->phi(), gsfIter->deltaEtaEleClusterTrackAtCalo());
2114  h_ele_dEtaEleClVsPt_propOut->Fill(gsfIter->pt(), gsfIter->deltaEtaEleClusterTrackAtCalo());
2115  h_ele_dPhiEleCl_propOut->Fill(gsfIter->deltaPhiEleClusterTrackAtCalo());
2116  h_ele_dPhiEleClVsEta_propOut->Fill(gsfIter->eta(), gsfIter->deltaPhiEleClusterTrackAtCalo());
2117  h_ele_dPhiEleClVsPhi_propOut->Fill(gsfIter->phi(), gsfIter->deltaPhiEleClusterTrackAtCalo());
2118  h_ele_dPhiEleClVsPt_propOut->Fill(gsfIter->pt(), gsfIter->deltaPhiEleClusterTrackAtCalo());
2119  h_ele_HoE->Fill(gsfIter->hadronicOverEm());
2120  if (!gsfIter->isEBEtaGap() && !gsfIter->isEBPhiGap() && !gsfIter->isEBEEGap() && !gsfIter->isEERingGap() &&
2121  !gsfIter->isEEDeeGap())
2122  h_ele_HoE_fiducial->Fill(gsfIter->hadronicOverEm());
2123  h_ele_HoEVsEta->Fill(gsfIter->eta(), gsfIter->hadronicOverEm());
2124  h_ele_HoEVsPhi->Fill(gsfIter->phi(), gsfIter->hadronicOverEm());
2125  h_ele_HoEVsE->Fill(gsfIter->caloEnergy(), gsfIter->hadronicOverEm());
2126 
2127  //classes
2128  int eleClass = gsfIter->classification();
2129  if (gsfIter->isEE())
2130  eleClass += 10;
2131  h_ele_classes->Fill(eleClass);
2132 
2133  h_ele_eta->Fill(std::abs(gsfIter->eta()));
2134  if (gsfIter->classification() == GsfElectron::GOLDEN)
2135  h_ele_eta_golden->Fill(std::abs(gsfIter->eta()));
2136  if (gsfIter->classification() == GsfElectron::BIGBREM)
2137  h_ele_eta_bbrem->Fill(std::abs(gsfIter->eta()));
2138  //if (gsfIter->classification() == GsfElectron::OLDNARROW) h_ele_eta_narrow ->Fill(std::abs(gsfIter->eta()));
2139  if (gsfIter->classification() == GsfElectron::SHOWERING)
2140  h_ele_eta_shower->Fill(std::abs(gsfIter->eta()));
2141 
2142  //fbrem
2143  double fbrem_mean = 0.;
2144  if (!readAOD_) // track extra does not exist in AOD
2145  fbrem_mean = 1. - gsfIter->gsfTrack()->outerMomentum().R() / gsfIter->gsfTrack()->innerMomentum().R();
2146  double fbrem_mode = gsfIter->fbrem();
2147  h_ele_fbrem->Fill(fbrem_mode);
2148  h_ele_fbremVsEta_mode->Fill(gsfIter->eta(), fbrem_mode);
2149  if (!readAOD_) // track extra does not exist in AOD
2150  h_ele_fbremVsEta_mean->Fill(gsfIter->eta(), fbrem_mean);
2151 
2152  if (gsfIter->classification() == GsfElectron::GOLDEN)
2153  h_ele_PinVsPoutGolden_mode->Fill(gsfIter->trackMomentumOut().R(), gsfIter->trackMomentumAtVtx().R());
2154  if (gsfIter->classification() == GsfElectron::SHOWERING)
2155  h_ele_PinVsPoutShowering_mode->Fill(gsfIter->trackMomentumOut().R(), gsfIter->trackMomentumAtVtx().R());
2156  if (!readAOD_) // track extra does not exist in AOD
2157  if (gsfIter->classification() == GsfElectron::GOLDEN)
2158  h_ele_PinVsPoutGolden_mean->Fill(gsfIter->gsfTrack()->outerMomentum().R(),
2159  gsfIter->gsfTrack()->innerMomentum().R());
2160  if (!readAOD_) // track extra does not exist in AOD
2161  if (gsfIter->classification() == GsfElectron::SHOWERING)
2162  h_ele_PinVsPoutShowering_mean->Fill(gsfIter->gsfTrack()->outerMomentum().R(),
2163  gsfIter->gsfTrack()->innerMomentum().R());
2164  if (gsfIter->classification() == GsfElectron::GOLDEN)
2165  h_ele_PtinVsPtoutGolden_mode->Fill(gsfIter->trackMomentumOut().Rho(), gsfIter->trackMomentumAtVtx().Rho());
2166  if (gsfIter->classification() == GsfElectron::SHOWERING)
2167  h_ele_PtinVsPtoutShowering_mode->Fill(gsfIter->trackMomentumOut().Rho(), gsfIter->trackMomentumAtVtx().Rho());
2168  if (!readAOD_) // track extra does not exist in AOD
2169  if (gsfIter->classification() == GsfElectron::GOLDEN)
2170  h_ele_PtinVsPtoutGolden_mean->Fill(gsfIter->gsfTrack()->outerMomentum().Rho(),
2171  gsfIter->gsfTrack()->innerMomentum().Rho());
2172  if (!readAOD_) // track extra does not exist in AOD
2173  if (gsfIter->classification() == GsfElectron::SHOWERING)
2174  h_ele_PtinVsPtoutShowering_mean->Fill(gsfIter->gsfTrack()->outerMomentum().Rho(),
2175  gsfIter->gsfTrack()->innerMomentum().Rho());
2176 
2177  h_ele_mva->Fill(gsfIter->mva_e_pi());
2178  if (gsfIter->ecalDrivenSeed())
2179  h_ele_provenance->Fill(1.);
2180  if (gsfIter->trackerDrivenSeed())
2181  h_ele_provenance->Fill(-1.);
2182  if (gsfIter->trackerDrivenSeed() || gsfIter->ecalDrivenSeed())
2183  h_ele_provenance->Fill(0.);
2184  if (gsfIter->trackerDrivenSeed() && !gsfIter->ecalDrivenSeed())
2185  h_ele_provenance->Fill(-2.);
2186  if (!gsfIter->trackerDrivenSeed() && gsfIter->ecalDrivenSeed())
2187  h_ele_provenance->Fill(2.);
2188 
2189  h_ele_tkSumPt_dr03->Fill(gsfIter->dr03TkSumPt());
2190  h_ele_ecalRecHitSumEt_dr03->Fill(gsfIter->dr03EcalRecHitSumEt());
2191  h_ele_hcalDepth1TowerSumEt_dr03->Fill(gsfIter->dr03HcalTowerSumEt(1));
2192  h_ele_hcalDepth2TowerSumEt_dr03->Fill(gsfIter->dr03HcalTowerSumEt(2));
2193  h_ele_tkSumPt_dr04->Fill(gsfIter->dr04TkSumPt());
2194  h_ele_ecalRecHitSumEt_dr04->Fill(gsfIter->dr04EcalRecHitSumEt());
2195  h_ele_hcalDepth1TowerSumEt_dr04->Fill(gsfIter->dr04HcalTowerSumEt(1));
2196  h_ele_hcalDepth2TowerSumEt_dr04->Fill(gsfIter->dr04HcalTowerSumEt(2));
2197 
2198  float enrj1 = gsfIter->superCluster()->energy();
2199  // mee
2200  for (reco::GsfElectronCollection::const_iterator gsfIter2 = gsfIter + 1; gsfIter2 != gsfElectrons->end();
2201  gsfIter2++) {
2202  math::XYZTLorentzVector p12 = (*gsfIter).p4() + (*gsfIter2).p4();
2203  float mee2 = p12.Dot(p12);
2204  float enrj2 = gsfIter2->superCluster()->energy();
2205  h_ele_mee_all->Fill(sqrt(mee2));
2206  h_ele_E2mnE1vsMee_all->Fill(sqrt(mee2), enrj2 - enrj1);
2207  if (gsfIter->ecalDrivenSeed() && gsfIter2->ecalDrivenSeed())
2208  h_ele_E2mnE1vsMee_egeg_all->Fill(sqrt(mee2), enrj2 - enrj1);
2209  if (gsfIter->charge() * gsfIter2->charge() < 0.) {
2210  h_ele_mee_os->Fill(sqrt(mee2));
2211  if (gsfIter->isEB() && gsfIter2->isEB())
2212  h_ele_mee_os_ebeb->Fill(sqrt(mee2));
2213  if ((gsfIter->isEB() && gsfIter2->isEE()) || (gsfIter->isEE() && gsfIter2->isEB()))
2214  h_ele_mee_os_ebee->Fill(sqrt(mee2));
2215  if (gsfIter->isEE() && gsfIter2->isEE())
2216  h_ele_mee_os_eeee->Fill(sqrt(mee2));
2217  if ((gsfIter->classification()==GsfElectron::GOLDEN && gsfIter2->classification()==GsfElectron::GOLDEN) ||
2218  (gsfIter->classification()==GsfElectron::GOLDEN && gsfIter2->classification()==GsfElectron::BIGBREM) ||
2219  //(gsfIter->classification()==GsfElectron::GOLDEN && gsfIter2->classification()==GsfElectron::OLDNARROW) ||
2220  (gsfIter->classification()==GsfElectron::BIGBREM && gsfIter2->classification()==GsfElectron::GOLDEN) ||
2221  (gsfIter->classification()==GsfElectron::BIGBREM && gsfIter2->classification()==GsfElectron::BIGBREM)/* ||
2222  (gsfIter->classification()==GsfElectron::BIGBREM && gsfIter2->classification()==GsfElectron::OLDNARROW) ||
2223  (gsfIter->classification()==GsfElectron::OLDNARROW && gsfIter2->classification()==GsfElectron::GOLDEN) ||
2224  (gsfIter->classification()==GsfElectron::OLDNARROW && gsfIter2->classification()==GsfElectron::BIGBREM) ||
2225  (gsfIter->classification()==GsfElectron::OLDNARROW && gsfIter2->classification()==GsfElectron::OLDNARROW)*/)
2226  {
2227  h_ele_mee_os_gg->Fill(sqrt(mee2));
2228  } else if ((gsfIter->classification() == GsfElectron::SHOWERING &&
2229  gsfIter2->classification() == GsfElectron::SHOWERING) ||
2230  (gsfIter->classification() == GsfElectron::SHOWERING && gsfIter2->isGap()) ||
2231  (gsfIter->isGap() && gsfIter2->classification() == GsfElectron::SHOWERING) ||
2232  (gsfIter->isGap() && gsfIter2->isGap())) {
2233  h_ele_mee_os_bb->Fill(sqrt(mee2));
2234  } else {
2235  h_ele_mee_os_gb->Fill(sqrt(mee2));
2236  }
2237  }
2238  }
2239  }
2240 
2241  // association matching object-reco electrons
2242  int matchingObjectNum = 0;
2243 
2244  for (reco::SuperClusterCollection::const_iterator moIter = recoClusters->begin(); moIter != recoClusters->end();
2245  moIter++) {
2246  // number of matching objects
2247  matchingObjectNum++;
2248 
2249  if (moIter->energy() / cosh(moIter->eta()) > maxPtMatchingObject_ ||
2250  std::abs(moIter->eta()) > maxAbsEtaMatchingObject_)
2251  continue;
2252 
2253  // suppress the endcaps
2254  //if (std::abs(moIter->eta()) > 1.5) continue;
2255  // select central z
2256  //if ( std::abs((*mcIter)->production_vertex()->position().z())>50.) continue;
2257 
2258  h_matchingObjectEta->Fill(moIter->eta());
2259  h_matchingObjectAbsEta->Fill(std::abs(moIter->eta()));
2260  h_matchingObjectP->Fill(moIter->energy());
2261  h_matchingObjectPt->Fill(moIter->energy() / cosh(moIter->eta()));
2262  h_matchingObjectPhi->Fill(moIter->phi());
2263  h_matchingObjectZ->Fill(moIter->z());
2264 
2265  // looking for the best matching gsf electron
2266  bool okGsfFound = false;
2267  double gsfOkRatio = 999999.;
2268 
2269  // find matching electron
2270  reco::GsfElectron bestGsfElectron;
2271  for (reco::GsfElectronCollection::const_iterator gsfIter = gsfElectrons->begin(); gsfIter != gsfElectrons->end();
2272  gsfIter++) {
2273  // matching with a cone in eta phi
2274  if (matchingCondition_ == "Cone") {
2275  double dphi = gsfIter->phi() - moIter->phi();
2276  if (std::abs(dphi) > CLHEP::pi)
2277  dphi = dphi < 0 ? (CLHEP::twopi) + dphi : dphi - CLHEP::twopi;
2278  double deltaR = sqrt(std::pow((moIter->eta() - gsfIter->eta()), 2) + std::pow(dphi, 2));
2279  if (deltaR < deltaR_) {
2280  //if ( (genPc->pdg_id() == 11) && (gsfIter->charge() < 0.) || (genPc->pdg_id() == -11) &&
2281  //(gsfIter->charge() > 0.) ){
2282  double tmpGsfRatio = gsfIter->p() / moIter->energy();
2283  if (std::abs(tmpGsfRatio - 1) < std::abs(gsfOkRatio - 1)) {
2284  gsfOkRatio = tmpGsfRatio;
2285  bestGsfElectron = *gsfIter;
2286  okGsfFound = true;
2287  }
2288  //}
2289  }
2290  }
2291  } // loop over rec ele to look for the best one
2292 
2293  // analysis when the matching object is matched by a rec electron
2294  if (okGsfFound) {
2295  // generated distributions for matched electrons
2296  h_ele_matchingObjectPt_matched->Fill(moIter->energy() / cosh(moIter->eta()));
2297  h_ele_matchingObjectPhi_matched->Fill(moIter->phi());
2298  h_ele_matchingObjectAbsEta_matched->Fill(std::abs(moIter->eta()));
2299  h_ele_matchingObjectEta_matched->Fill(moIter->eta());
2300  h_ele_matchingObjectZ_matched->Fill(moIter->z());
2301 
2302  // comparison electron vs matching object
2303  h_ele_EtaMnEtamatchingObject_matched->Fill(bestGsfElectron.eta() - moIter->eta());
2304  h_ele_EtaMnEtamatchingObjectVsEta_matched->Fill(bestGsfElectron.eta(), bestGsfElectron.eta() - moIter->eta());
2305  h_ele_EtaMnEtamatchingObjectVsPhi_matched->Fill(bestGsfElectron.phi(), bestGsfElectron.eta() - moIter->eta());
2306  h_ele_EtaMnEtamatchingObjectVsPt_matched->Fill(bestGsfElectron.pt(), bestGsfElectron.eta() - moIter->eta());
2307  h_ele_PhiMnPhimatchingObject_matched->Fill(bestGsfElectron.phi() - moIter->phi());
2308  h_ele_PhiMnPhimatchingObject2_matched->Fill(bestGsfElectron.phi() - moIter->phi());
2309  h_ele_PhiMnPhimatchingObjectVsEta_matched->Fill(bestGsfElectron.eta(), bestGsfElectron.phi() - moIter->phi());
2310  h_ele_PhiMnPhimatchingObjectVsPhi_matched->Fill(bestGsfElectron.phi(), bestGsfElectron.phi() - moIter->phi());
2311  h_ele_PhiMnPhimatchingObjectVsPt_matched->Fill(bestGsfElectron.pt(), bestGsfElectron.phi() - moIter->phi());
2312  h_ele_PoPmatchingObject_matched->Fill(bestGsfElectron.p() / moIter->energy());
2313  h_ele_PtoPtmatchingObject_matched->Fill(bestGsfElectron.pt() / moIter->energy() / cosh(moIter->eta()));
2314  h_ele_PoPmatchingObjectVsEta_matched->Fill(bestGsfElectron.eta(), bestGsfElectron.p() / moIter->energy());
2315  h_ele_PoPmatchingObjectVsPhi_matched->Fill(bestGsfElectron.phi(), bestGsfElectron.p() / moIter->energy());
2316  h_ele_PoPmatchingObjectVsPt_matched->Fill(bestGsfElectron.py(), bestGsfElectron.p() / moIter->energy());
2317  if (bestGsfElectron.isEB())
2318  h_ele_PoPmatchingObject_barrel_matched->Fill(bestGsfElectron.p() / moIter->energy());
2319  if (bestGsfElectron.isEE())
2320  h_ele_PoPmatchingObject_endcaps_matched->Fill(bestGsfElectron.p() / moIter->energy());
2321  if (bestGsfElectron.isEB())
2322  h_ele_PtoPtmatchingObject_barrel_matched->Fill(bestGsfElectron.pt() / moIter->energy() / cosh(moIter->eta()));
2323  if (bestGsfElectron.isEE())
2324  h_ele_PtoPtmatchingObject_endcaps_matched->Fill(bestGsfElectron.pt() / moIter->energy() / cosh(moIter->eta()));
2325 
2326  reco::SuperClusterRef sclRef = bestGsfElectron.superCluster();
2327  if (bestGsfElectron.isEB())
2328  histSclEoEmatchingObject_barrel_matched->Fill(sclRef->energy() / moIter->energy());
2329  if (bestGsfElectron.isEE())
2330  histSclEoEmatchingObject_endcaps_matched->Fill(sclRef->energy() / moIter->energy());
2331  if (bestGsfElectron.isEB())
2332  histSclEoEmatchingObject_barrel_new_matched->Fill(sclRef->energy() / moIter->energy());
2333  if (bestGsfElectron.isEE())
2334  histSclEoEmatchingObject_endcaps_new_matched->Fill(sclRef->energy() / moIter->energy());
2335 
2336  // add here distributions for matched electrons as for all electrons
2337  //..
2338 
2339  } // gsf electron found
2340 
2341  } // loop overmatching object
2342 
2343  h_matchingObjectNum->Fill(matchingObjectNum);
2344 }
2345 
2347  // retreive TriggerResults from the event
2349  e.getByLabel(triggerResults_, triggerResults);
2350 
2351  bool accept = false;
2352 
2353  if (triggerResults.isValid()) {
2354  //std::cout << "TriggerResults found, number of HLT paths: " << triggerResults->size() << std::endl;
2355 
2356  // get trigger names
2357  const edm::TriggerNames &triggerNames = e.triggerNames(*triggerResults);
2358  if (nEvents_ == 1) {
2359  for (unsigned int i = 0; i < triggerNames.size(); i++) {
2360  std::cout << "trigger path= " << triggerNames.triggerName(i) << std::endl;
2361  }
2362  }
2363 
2364  unsigned int n = HLTPathsByName_.size();
2365  for (unsigned int i = 0; i != n; i++) {
2366  HLTPathsByIndex_[i] = triggerNames.triggerIndex(HLTPathsByName_[i]);
2367  }
2368 
2369  // empty input vectors (n==0) means any trigger paths
2370  if (n == 0) {
2371  n = triggerResults->size();
2372  HLTPathsByName_.resize(n);
2373  HLTPathsByIndex_.resize(n);
2374  for (unsigned int i = 0; i != n; i++) {
2375  HLTPathsByName_[i] = triggerNames.triggerName(i);
2376  HLTPathsByIndex_[i] = i;
2377  }
2378  }
2379 
2380  if (nEvents_ == 1) {
2381  if (n > 0) {
2382  std::cout << "HLT trigger paths requested: index, name and valididty:" << std::endl;
2383  for (unsigned int i = 0; i != n; i++) {
2384  bool validity = HLTPathsByIndex_[i] < triggerResults->size();
2385  std::cout << " " << HLTPathsByIndex_[i] << " " << HLTPathsByName_[i] << " " << validity << std::endl;
2386  }
2387  }
2388  }
2389 
2390  // count number of requested HLT paths which have fired
2391  unsigned int fired = 0;
2392  for (unsigned int i = 0; i != n; i++) {
2393  if (HLTPathsByIndex_[i] < triggerResults->size()) {
2394  if (triggerResults->accept(HLTPathsByIndex_[i])) {
2395  fired++;
2396  std::cout << "Fired HLT path= " << HLTPathsByName_[i] << std::endl;
2397  accept = true;
2398  }
2399  }
2400  }
2401  }
2402 
2403  return accept;
2404 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::vector< unsigned int > HLTPathsByIndex_
double pt() const final
transverse momentum
void analyze(const edm::Event &e, const edm::EventSetup &c) override
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
std::vector< std::string > HLTPathsByName_
std::string const & label() const
Definition: InputTag.h:36
assert(be >=bs)
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:31
uint16_t size_type
edm::ESHandle< TrackerGeometry > pDD
const Double_t pi
bool isEB() const
Definition: GsfElectron.h:328
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
int iEvent
Definition: GenABIO.cc:224
double p() const final
magnitude of momentum vector
TrajectoryStateTransform transformer_
T sqrt(T t)
Definition: SSEVec.h:19
GsfElectronDataAnalyzer(const edm::ParameterSet &conf)
bool trigger(const edm::Event &e)
edm::ESHandle< MagneticField > theMagField
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static std::string const triggerResults
Definition: EdmProvDump.cc:44
double py() const final
y coordinate of momentum vector
d
Definition: ztail.py:151
Log< level::Info, false > LogInfo
bool isEE() const
Definition: GsfElectron.h:329
fixed size matrix
HLT enums.
double phi() const final
momentum azimuthal angle
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:155
double eta() const final
momentum pseudorapidity