CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GsfElectronDataAnalyzer.cc
Go to the documentation of this file.
1 
2 // -*- C++ -*-
3 //
4 // Package: RecoEgamma/Examples
5 // Class: GsfElectronDataAnalyzer
6 //
14 //
15 // Original Author: Ursula Berthon
16 // Created: Mon Mar 27 13:22:06 CEST 2006
17 //
18 //
19 
20 // user include files
22 
29 
41 
43 
44 #include "CLHEP/Units/GlobalPhysicalConstants.h"
45 #include <iostream>
46 #include "TMath.h"
47 #include "TFile.h"
48 #include "TH1F.h"
49 #include "TH1I.h"
50 #include "TH2F.h"
51 #include "TProfile.h"
52 #include "TTree.h"
53 #include <iostream>
54 
55 using namespace reco;
56 
58  beamSpot_(conf.getParameter<edm::InputTag>("beamSpot"))
59 {
60 
61  outputFile_ = conf.getParameter<std::string>("outputFile");
62  histfile_ = new TFile(outputFile_.c_str(),"RECREATE");
63  electronCollection_=conf.getParameter<edm::InputTag>("electronCollection");
64  readAOD_ = conf.getParameter<bool>("readAOD");
65 
66  matchingObjectCollection_ = conf.getParameter<edm::InputTag>("matchingObjectCollection");
67  matchingCondition_ = conf.getParameter<std::string>("matchingCondition");
68  // currently only one possible matching conditions
69  assert (matchingCondition_ == "Cone");
70  maxPtMatchingObject_ = conf.getParameter<double>("MaxPtMatchingObject");
71  maxAbsEtaMatchingObject_ = conf.getParameter<double>("MaxAbsEtaMatchingObject");
72  deltaR_ = conf.getParameter<double>("DeltaR");
73 
74  triggerResults_ = conf.getParameter<edm::InputTag>("triggerResults");
75  HLTPathsByName_= conf.getParameter<std::vector<std::string > >("hltPaths");
76  HLTPathsByIndex_.resize(HLTPathsByName_.size());
77 
78  minEt_ = conf.getParameter<double>("MinEt");
79  minPt_ = conf.getParameter<double>("MinPt");
80  maxAbsEta_ = conf.getParameter<double>("MaxAbsEta");
81  isEB_ = conf.getParameter<bool>("SelectEB");
82  isEE_ = conf.getParameter<bool>("SelectEE");
83  isNotEBEEGap_ = conf.getParameter<bool>("SelectNotEBEEGap");
84  isEcalDriven_ = conf.getParameter<bool>("SelectEcalDriven");
85  isTrackerDriven_ = conf.getParameter<bool>("SelectTrackerDriven");
86  eOverPMinBarrel_ = conf.getParameter<double>("MinEOverPBarrel");
87  eOverPMaxBarrel_ = conf.getParameter<double>("MaxEOverPBarrel");
88  eOverPMinEndcaps_ = conf.getParameter<double>("MinEOverPEndcaps");
89  eOverPMaxEndcaps_ = conf.getParameter<double>("MaxEOverPEndcaps");
90  dEtaMinBarrel_ = conf.getParameter<double>("MinDetaBarrel");
91  dEtaMaxBarrel_ = conf.getParameter<double>("MaxDetaBarrel");
92  dEtaMinEndcaps_ = conf.getParameter<double>("MinDetaEndcaps");
93  dEtaMaxEndcaps_ = conf.getParameter<double>("MaxDetaEndcaps");
94  dPhiMinBarrel_ = conf.getParameter<double>("MinDphiBarrel");
95  dPhiMaxBarrel_ = conf.getParameter<double>("MaxDphiBarrel");
96  dPhiMinEndcaps_ = conf.getParameter<double>("MinDphiEndcaps");
97  dPhiMaxEndcaps_ = conf.getParameter<double>("MaxDphiEndcaps");
98  sigIetaIetaMinBarrel_ = conf.getParameter<double>("MinSigIetaIetaBarrel");
99  sigIetaIetaMaxBarrel_ = conf.getParameter<double>("MaxSigIetaIetaBarrel");
100  sigIetaIetaMinEndcaps_ = conf.getParameter<double>("MinSigIetaIetaEndcaps");
101  sigIetaIetaMaxEndcaps_ = conf.getParameter<double>("MaxSigIetaIetaEndcaps");
102  hadronicOverEmMaxBarrel_ = conf.getParameter<double>("MaxHoEBarrel");
103  hadronicOverEmMaxEndcaps_ = conf.getParameter<double>("MaxHoEEndcaps");
104  mvaMin_ = conf.getParameter<double>("MinMVA");
105  tipMaxBarrel_ = conf.getParameter<double>("MaxTipBarrel");
106  tipMaxEndcaps_ = conf.getParameter<double>("MaxTipEndcaps");
107  tkIso03Max_ = conf.getParameter<double>("MaxTkIso03");
108  hcalIso03Depth1MaxBarrel_ = conf.getParameter<double>("MaxHcalIso03Depth1Barrel");
109  hcalIso03Depth1MaxEndcaps_ = conf.getParameter<double>("MaxHcalIso03Depth1Endcaps");
110  hcalIso03Depth2MaxEndcaps_ = conf.getParameter<double>("MaxHcalIso03Depth2Endcaps");
111  ecalIso03MaxBarrel_ = conf.getParameter<double>("MaxEcalIso03Barrel");
112  ecalIso03MaxEndcaps_ = conf.getParameter<double>("MaxEcalIso03Endcaps");
113 
114  edm::ParameterSet pset =
115  conf.getParameter<edm::ParameterSet>("HistosConfigurationData") ;
116 
117  etamin=pset.getParameter<double>("Etamin");
118  etamax=pset.getParameter<double>("Etamax");
119  phimin=pset.getParameter<double>("Phimin");
120  phimax=pset.getParameter<double>("Phimax");
121  ptmax=pset.getParameter<double>("Ptmax");
122  pmax=pset.getParameter<double>("Pmax");
123  eopmax=pset.getParameter<double>("Eopmax");
124  eopmaxsht=pset.getParameter<double>("Eopmaxsht");
125  detamin=pset.getParameter<double>("Detamin");
126  detamax=pset.getParameter<double>("Detamax");
127  dphimin=pset.getParameter<double>("Dphimin");
128  dphimax=pset.getParameter<double>("Dphimax");
129  detamatchmin=pset.getParameter<double>("Detamatchmin");
130  detamatchmax=pset.getParameter<double>("Detamatchmax");
131  dphimatchmin=pset.getParameter<double>("Dphimatchmin");
132  dphimatchmax=pset.getParameter<double>("Dphimatchmax");
133  fhitsmax=pset.getParameter<double>("Fhitsmax");
134  lhitsmax=pset.getParameter<double>("Lhitsmax");
135  nbineta=pset.getParameter<int>("Nbineta");
136  nbineta2D=pset.getParameter<int>("Nbineta2D");
137  nbinp=pset.getParameter<int>("Nbinp");
138  nbinpt=pset.getParameter<int>("Nbinpt");
139  nbinp2D=pset.getParameter<int>("Nbinp2D");
140  nbinpt2D=pset.getParameter<int>("Nbinpt2D");
141  nbinpteff=pset.getParameter<int>("Nbinpteff");
142  nbinphi=pset.getParameter<int>("Nbinphi");
143  nbinphi2D=pset.getParameter<int>("Nbinphi2D");
144  nbineop=pset.getParameter<int>("Nbineop");
145  nbineop2D=pset.getParameter<int>("Nbineop2D");
146  nbinfhits=pset.getParameter<int>("Nbinfhits");
147  nbinlhits=pset.getParameter<int>("Nbinlhits");
148  nbinxyz=pset.getParameter<int>("Nbinxyz");
149  nbindeta=pset.getParameter<int>("Nbindeta");
150  nbindphi=pset.getParameter<int>("Nbindphi");
151  nbindetamatch=pset.getParameter<int>("Nbindetamatch");
152  nbindphimatch=pset.getParameter<int>("Nbindphimatch");
153  nbindetamatch2D=pset.getParameter<int>("Nbindetamatch2D");
154  nbindphimatch2D=pset.getParameter<int>("Nbindphimatch2D");
155  nbinpoptrue= pset.getParameter<int>("Nbinpoptrue");
156  poptruemin=pset.getParameter<double>("Poptruemin");
157  poptruemax=pset.getParameter<double>("Poptruemax");
158  nbinmee= pset.getParameter<int>("Nbinmee");
159  meemin=pset.getParameter<double>("Meemin");
160  meemax=pset.getParameter<double>("Meemax");
161  nbinhoe= pset.getParameter<int>("Nbinhoe");
162  hoemin=pset.getParameter<double>("Hoemin");
163  hoemax=pset.getParameter<double>("Hoemax");
164 
165 }
166 
168 {
169 
170  // do anything here that needs to be done at desctruction time
171  // (e.g. close files, deallocate resources etc.)
172  histfile_->Write();
173  histfile_->Close();
174 }
175 
177 
178  histfile_->cd();
179 
180  nEvents_ = 0;
181  nAfterTrigger_ = 0;
182 
183  // matching object
184  std::string::size_type locSC = matchingObjectCollection_.label().find( "SuperCluster", 0 );
186  if ( locSC != std::string::npos ) {
187  std::cout << "Matching objects are SuperClusters "<< std::endl;
188  type_ = "SC";
189  } else {
190  std::cout << "Didn't recognize input matching objects!! " << std::endl;
191  }
192 
193  std::string htitle, hlabel;
194  hlabel="h_"+type_+"Num"; htitle="# "+type_+"s";
195  h_matchingObjectNum = new TH1F( hlabel.c_str(), htitle.c_str(), nbinfhits,0.,fhitsmax );
196 
197  // rec event
198 
199  histNum_= new TH1F("h_recEleNum","# rec electrons",20, 0.,20.);
200 
201  // matching object distributions
202  hlabel="h_"+type_+"_eta"; htitle=type_+" #eta";
203  h_matchingObjectEta = new TH1F( hlabel.c_str(), htitle.c_str(), nbineta,etamin,etamax);
204  hlabel="h_"+type_+"_abseta"; htitle=type_+" |#eta|";
205  h_matchingObjectAbsEta = new TH1F( hlabel.c_str(), htitle.c_str(), nbineta/2,0.,etamax);
206  hlabel="h_"+type_+"_P"; htitle=type_+" p";
207  h_matchingObjectP = new TH1F( hlabel.c_str(), htitle.c_str(), nbinp,0.,pmax);
208  hlabel="h_"+type_+"_Pt"; htitle=type_+" pt";
209  h_matchingObjectPt = new TH1F( hlabel.c_str(),htitle.c_str(), nbinpteff,5.,ptmax);
210  hlabel="h_"+type_+"_phi"; htitle=type_+" phi";
211  h_matchingObjectPhi = new TH1F( hlabel.c_str(), htitle.c_str(), nbinphi,phimin,phimax);
212  hlabel="h_"+type_+"_z"; htitle=type_+" z";
213  h_matchingObjectZ = new TH1F( hlabel.c_str(), htitle.c_str(), nbinxyz , -25, 25 );
214 
215  // mee
216  h_ele_mee_all = new TH1F( "h_ele_mee_all", "ele pairs invariant mass, all charge combinations", nbinmee, meemin, meemax );
217  h_ele_mee_os = new TH1F( "h_ele_mee_os", "ele pairs invariant mass, opposite sign", nbinmee, meemin, meemax );
218  h_ele_mee_os_ebeb = new TH1F( "h_ele_mee_os_ebeb", "ele pairs invariant mass, opp. sign, EB-EB", nbinmee, meemin, meemax );
219  h_ele_mee_os_ebeb->Sumw2();
220  h_ele_mee_os_ebee = new TH1F( "h_ele_mee_os_ebee", "ele pairs invariant mass, opp. sign, EB-EE", nbinmee, meemin, meemax );
221  h_ele_mee_os_ebee->Sumw2();
222  h_ele_mee_os_eeee = new TH1F( "h_ele_mee_os_eeee", "ele pairs invariant mass, opp. sign, EE-EE", nbinmee, meemin, meemax );
223  h_ele_mee_os_eeee->Sumw2();
224  h_ele_mee_os_gg = new TH1F( "h_ele_mee_os_gg", "ele pairs invariant mass, opp. sign, good-good", nbinmee, meemin, meemax );
225  h_ele_mee_os_gg->Sumw2();
226  h_ele_mee_os_gb = new TH1F( "h_ele_mee_os_gb", "ele pairs invariant mass, opp. sign, good-bad", nbinmee, meemin, meemax );
227  h_ele_mee_os_gb->Sumw2();
228  h_ele_mee_os_bb = new TH1F( "h_ele_mee_os_bb", "ele pairs invariant mass, opp. sign, bad-bad", nbinmee, meemin, meemax );
229  h_ele_mee_os_bb->Sumw2();
230 
231  // duplicates
232  h_ele_E2mnE1vsMee_all = new TH2F("h_ele_E2mnE1vsMee_all", "E2 - E1 vs ele pairs invariant mass, all electrons", nbinmee, meemin, meemax, 100, -50., 50. );
233  h_ele_E2mnE1vsMee_egeg_all = new TH2F("h_ele_E2mnE1vsMee_egeg_all", "E2 - E1 vs ele pairs invariant mass, ecal driven pairs, all electrons", nbinmee, meemin, meemax, 100, -50., 50. );
234 
235  // recoed and matched electrons
236  h_ele_charge = new TH1F( "h_ele_charge", "ele charge", 5,-2.,2.);
237  h_ele_chargeVsEta = new TH2F( "h_ele_chargeVsEta", "ele charge vs eta", nbineta2D,etamin,etamax,5,-2.,2.);
238  h_ele_chargeVsPhi = new TH2F( "h_ele_chargeVsPhi", "ele charge vs phi", nbinphi2D,phimin,phimax,5,-2.,2.);
239  h_ele_chargeVsPt = new TH2F( "h_ele_chargeVsPt", "ele charge vs pt", nbinpt,0.,100.,5,-2.,2.);
240  h_ele_vertexP = new TH1F( "h_ele_vertexP", "ele momentum", nbinp,0.,pmax);
241  h_ele_vertexPt = new TH1F( "h_ele_vertexPt", "ele transverse momentum", nbinpt,0.,ptmax);
242  h_ele_Et = new TH1F( "h_ele_Et", "ele SC transverse energy", nbinpt,0.,ptmax);
243  h_ele_vertexPtVsEta = new TH2F( "h_ele_vertexPtVsEta", "ele transverse momentum vs eta",nbineta2D,etamin,etamax,nbinpt2D,0.,ptmax);
244  h_ele_vertexPtVsPhi = new TH2F( "h_ele_vertexPtVsPhi", "ele transverse momentum vs phi",nbinphi2D,phimin,phimax,nbinpt2D,0.,ptmax);
245  h_ele_matchingObjectPt_matched = new TH1F( "h_ele_matchingObjectPt_matched", "Efficiency vs matching SC E_{T}", nbinpteff,5.,ptmax);
247  h_ele_vertexEta = new TH1F( "h_ele_vertexEta", "ele momentum eta", nbineta,etamin,etamax);
248  h_ele_vertexEtaVsPhi = new TH2F( "h_ele_vertexEtaVsPhi", "ele momentum eta vs phi",nbineta2D,etamin,etamax,nbinphi2D,phimin,phimax );
249  h_ele_matchingObjectAbsEta_matched = new TH1F( "h_ele_matchingObjectAbsEta_matched", "Efficiency vs matching SC |#eta|", nbineta/2,0.,2.5);
251  h_ele_matchingObjectEta_matched = new TH1F( "h_ele_matchingObjectEta_matched", "Efficiency vs matching SC #eta", nbineta,etamin,etamax);
253  h_ele_matchingObjectPhi_matched = new TH1F( "h_ele_matchingObjectPhi_matched", "Efficiency vs matching SC phi", nbinphi,phimin,phimax);
255  h_ele_vertexPhi = new TH1F( "h_ele_vertexPhi", "ele momentum #phi", nbinphi,phimin,phimax);
256  h_ele_vertexX = new TH1F( "h_ele_vertexX", "ele vertex x", nbinxyz,-0.1,0.1 );
257  h_ele_vertexY = new TH1F( "h_ele_vertexY", "ele vertex y", nbinxyz,-0.1,0.1 );
258  h_ele_vertexZ = new TH1F( "h_ele_vertexZ", "ele vertex z", nbinxyz,-25, 25 );
259  h_ele_matchingObjectZ_matched = new TH1F( "h_ele_matchingObjectZ_matched", "Efficiency vs matching SC z", nbinxyz,-25,25);
261  h_ele_vertexTIP = new TH1F( "h_ele_vertexTIP", "ele transverse impact parameter (wrt bs)", 90,0.,0.15);
262  h_ele_vertexTIPVsEta = new TH2F( "h_ele_vertexTIPVsEta", "ele transverse impact parameter (wrt bs) vs eta", nbineta2D,etamin,etamax,45,0.,0.15);
263  h_ele_vertexTIPVsPhi = new TH2F( "h_ele_vertexTIPVsPhi", "ele transverse impact parameter (wrt bs) vs phi", nbinphi2D,phimin,phimax,45,0.,0.15);
264  h_ele_vertexTIPVsPt = new TH2F( "h_ele_vertexTIPVsPt", "ele transverse impact parameter (wrt bs) vs transverse momentum", nbinpt2D,0.,ptmax,45,0.,0.15);
265  h_ele_PoPmatchingObject_matched = new TH1F( "h_ele_PoPmatchingObject_matched", "ele momentum / matching SC energy", nbinpoptrue,poptruemin,poptruemax);
266  h_ele_PtoPtmatchingObject_matched = new TH1F( "h_ele_PtoPtmatchingObject_matched", "ele trans momentum / matching SC trans energy", nbinpoptrue,poptruemin,poptruemax);
267  h_ele_PoPmatchingObjectVsEta_matched = new TH2F( "h_ele_PoPmatchingObjectVsEta_matched", "ele momentum / matching SC energy vs eta", nbineta2D,etamin,etamax,50,poptruemin,poptruemax);
268  h_ele_PoPmatchingObjectVsPhi_matched = new TH2F( "h_ele_PoPmatchingObjectVsPhi_matched", "ele momentum / matching SC energy vs phi", nbinphi2D,phimin,phimax,50,poptruemin,poptruemax);
269  h_ele_PoPmatchingObjectVsPt_matched = new TH2F( "h_ele_PoPmatchingObjectVsPt_matched", "ele momentum / matching SC energy vs eta", nbinpt2D,0.,ptmax,50,poptruemin,poptruemax);
270  h_ele_PoPmatchingObject_barrel_matched = new TH1F( "h_ele_PoPmatchingObject_barrel_matched", "ele momentum / matching SC energy, barrel",nbinpoptrue,poptruemin,poptruemax);
271  h_ele_PoPmatchingObject_endcaps_matched = new TH1F( "h_ele_PoPmatchingObject_endcaps_matched", "ele momentum / matching SC energy, endcaps",nbinpoptrue,poptruemin,poptruemax);
272  h_ele_PtoPtmatchingObject_barrel_matched = new TH1F( "h_ele_PtoPmatchingObject_barrel_matched", "ele trans momentum / matching SC trans energy, barrel",nbinpoptrue,poptruemin,poptruemax);
273  h_ele_PtoPtmatchingObject_endcaps_matched = new TH1F( "h_ele_PtoPmatchingObject_endcaps_matched", "ele trans momentum / matching SC trans energy, endcaps",nbinpoptrue,poptruemin,poptruemax);
274  h_ele_EtaMnEtamatchingObject_matched = new TH1F( "h_ele_EtaMnEtamatchingObject_matched", "ele momentum eta - matching SC eta",nbindeta,detamin,detamax);
275  h_ele_EtaMnEtamatchingObjectVsEta_matched = new TH2F( "h_ele_EtaMnEtamatchingObjectVsEta_matched", "ele momentum eta - matching SC eta vs eta",nbineta2D,etamin,etamax,nbindeta/2,detamin,detamax);
276  h_ele_EtaMnEtamatchingObjectVsPhi_matched = new TH2F( "h_ele_EtaMnEtamatchingObjectVsPhi_matched", "ele momentum eta - matching SC eta vs phi",nbinphi2D,phimin,phimax,nbindeta/2,detamin,detamax);
277  h_ele_EtaMnEtamatchingObjectVsPt_matched = new TH2F( "h_ele_EtaMnEtamatchingObjectVsPt_matched", "ele momentum eta - matching SC eta vs pt",nbinpt,0.,ptmax,nbindeta/2,detamin,detamax);
278  h_ele_PhiMnPhimatchingObject_matched = new TH1F( "h_ele_PhiMnPhimatchingObject_matched", "ele momentum phi - matching SC phi",nbindphi,dphimin,dphimax);
279  h_ele_PhiMnPhimatchingObject2_matched = new TH1F( "h_ele_PhiMnPhimatchingObject2_matched", "ele momentum phi - matching SC phi",nbindphimatch2D,dphimatchmin,dphimatchmax);
280  h_ele_PhiMnPhimatchingObjectVsEta_matched = new TH2F( "h_ele_PhiMnPhimatchingObjectVsEta_matched", "ele momentum phi - matching SC phi vs eta",nbineta2D,etamin,etamax,nbindphi/2,dphimin,dphimax);
281  h_ele_PhiMnPhimatchingObjectVsPhi_matched = new TH2F( "h_ele_PhiMnPhimatchingObjectVsPhi_matched", "ele momentum phi - matching SC phi vs phi",nbinphi2D,phimin,phimax,nbindphi/2,dphimin,dphimax);
282  h_ele_PhiMnPhimatchingObjectVsPt_matched = new TH2F( "h_ele_PhiMnPhimatchingObjectVsPt_matched", "ele momentum phi - matching SC phi vs pt",nbinpt2D,0.,ptmax,nbindphi/2,dphimin,dphimax);
283 
284  // matched electron, superclusters
285  histSclEn_ = new TH1F("h_scl_energy","ele supercluster energy",nbinp,0.,pmax);
286  histSclEoEmatchingObject_barrel_matched = new TH1F("h_scl_EoEmatchingObject_barrel_matched","ele supercluster energy / matching SC energy, barrel",50,0.2,1.2);
287  histSclEoEmatchingObject_endcaps_matched = new TH1F("h_scl_EoEmatchingObject_endcaps_matched","ele supercluster energy / matching SC energy, endcaps",50,0.2,1.2);
288  histSclEoEmatchingObject_barrel_new_matched = new TH1F("h_scl_EoEmatchingObject_barrel_new_matched","ele supercluster energy / matching SC energy, barrel",nbinpoptrue,poptruemin,poptruemax);
289  histSclEoEmatchingObject_endcaps_new_matched = new TH1F("h_scl_EoEmatchingObject_endcaps_new_matched","ele supercluster energy / matching SC energy, endcaps",nbinpoptrue,poptruemin,poptruemax);
290  histSclEt_ = new TH1F("h_scl_et","ele supercluster transverse energy",nbinpt,0.,ptmax);
291  histSclEtVsEta_ = new TH2F("h_scl_etVsEta","ele supercluster transverse energy vs eta",nbineta2D,etamin,etamax,nbinpt,0.,ptmax);
292  histSclEtVsPhi_ = new TH2F("h_scl_etVsPhi","ele supercluster transverse energy vs phi",nbinphi2D,phimin,phimax,nbinpt,0.,ptmax);
293  histSclEtaVsPhi_ = new TH2F("h_scl_etaVsPhi","ele supercluster eta vs phi",nbinphi2D,phimin,phimax,nbineta2D,etamin,etamax);
294  histSclEta_ = new TH1F("h_scl_eta","ele supercluster eta",nbineta,etamin,etamax);
295  histSclPhi_ = new TH1F("h_scl_phi","ele supercluster phi",nbinphi,phimin,phimax);
296 
297  histSclSigEtaEta_ = new TH1F("h_scl_sigetaeta","ele supercluster sigma eta eta",100,0.,0.05);
298  histSclSigIEtaIEta_barrel_ = new TH1F("h_scl_sigietaieta_barrel","ele supercluster sigma ieta ieta, barrel",100,0.,0.05);
299  histSclSigIEtaIEta_endcaps_ = new TH1F("h_scl_sigietaieta_endcaps","ele supercluster sigma ieta ieta, endcaps",100,0.,0.05);
300  histSclE1x5_ = new TH1F("h_scl_E1x5","ele supercluster energy in 1x5",nbinp,0.,pmax);
301  histSclE1x5_barrel_ = new TH1F("h_scl_E1x_barrel5","ele supercluster energy in 1x5 barrel",nbinp,0.,pmax);
302  histSclE1x5_endcaps_ = new TH1F("h_scl_E1x5_endcaps","ele supercluster energy in 1x5 endcaps",nbinp,0.,pmax);
303  histSclE2x5max_ = new TH1F("h_scl_E2x5max","ele supercluster energy in 2x5 max",nbinp,0.,pmax);
304  histSclE2x5max_barrel_ = new TH1F("h_scl_E2x5max_barrel","ele supercluster energy in 2x5 max barrel",nbinp,0.,pmax);
305  histSclE2x5max_endcaps_ = new TH1F("h_scl_E2x5max_endcaps","ele supercluster energy in 2x5 max endcaps",nbinp,0.,pmax);
306  histSclE5x5_ = new TH1F("h_scl_E5x5","ele supercluster energy in 5x5",nbinp,0.,pmax);
307  histSclE5x5_barrel_ = new TH1F("h_scl_E5x5_barrel","ele supercluster energy in 5x5 barrel",nbinp,0.,pmax);
308  histSclE5x5_endcaps_ = new TH1F("h_scl_E5x5_endcaps","ele supercluster energy in 5x5 endcaps",nbinp,0.,pmax);
309 
310  // matched electron, gsf tracks
311  h_ele_ambiguousTracks = new TH1F( "h_ele_ambiguousTracks", "ele # ambiguous tracks", 5,0.,5.);
312  h_ele_ambiguousTracksVsEta = new TH2F( "h_ele_ambiguousTracksVsEta","ele # ambiguous tracks vs eta", nbineta2D,etamin,etamax,5,0.,5.);
313  h_ele_ambiguousTracksVsPhi = new TH2F( "h_ele_ambiguousTracksVsPhi", "ele # ambiguous tracks vs phi", nbinphi2D,phimin,phimax,5,0.,5.);
314  h_ele_ambiguousTracksVsPt = new TH2F( "h_ele_ambiguousTracksVsPt", "ele # ambiguous tracks vs pt", nbinpt2D,0.,ptmax,5,0.,5.);
315  h_ele_foundHits = new TH1F( "h_ele_foundHits", "ele track # found hits", nbinfhits,0.,fhitsmax);
316  h_ele_foundHitsVsEta = new TH2F( "h_ele_foundHitsVsEta", "ele track # found hits vs eta", nbineta2D,etamin,etamax,nbinfhits,0.,fhitsmax);
317  h_ele_foundHitsVsPhi = new TH2F( "h_ele_foundHitsVsPhi", "ele track # found hits vs phi", nbinphi2D,phimin,phimax,nbinfhits,0.,fhitsmax);
318  h_ele_foundHitsVsPt = new TH2F( "h_ele_foundHitsVsPt", "ele track # found hits vs pt", nbinpt2D,0.,ptmax,nbinfhits,0.,fhitsmax);
319  h_ele_lostHits = new TH1F( "h_ele_lostHits", "ele track # lost hits", 5,0.,5.);
320  h_ele_lostHitsVsEta = new TH2F( "h_ele_lostHitsVsEta", "ele track # lost hits vs eta", nbineta2D,etamin,etamax,nbinlhits,0.,lhitsmax);
321  h_ele_lostHitsVsPhi = new TH2F( "h_ele_lostHitsVsPhi", "ele track # lost hits vs eta", nbinphi2D,phimin,phimax,nbinlhits,0.,lhitsmax);
322  h_ele_lostHitsVsPt = new TH2F( "h_ele_lostHitsVsPt", "ele track # lost hits vs eta", nbinpt2D,0.,ptmax,nbinlhits,0.,lhitsmax);
323  h_ele_chi2 = new TH1F( "h_ele_chi2", "ele track #chi^{2}", 100,0.,15.);
324  h_ele_chi2VsEta = new TH2F( "h_ele_chi2VsEta", "ele track #chi^{2} vs eta", nbineta2D,etamin,etamax,50,0.,15.);
325  h_ele_chi2VsPhi = new TH2F( "h_ele_chi2VsPhi", "ele track #chi^{2} vs phi", nbinphi2D,phimin,phimax,50,0.,15.);
326  h_ele_chi2VsPt = new TH2F( "h_ele_chi2VsPt", "ele track #chi^{2} vs pt", nbinpt2D,0.,ptmax,50,0.,15.);
327  h_ele_PinMnPout = new TH1F( "h_ele_PinMnPout", "ele track inner p - outer p, mean" ,nbinp,0.,200.);
328  h_ele_PinMnPout_mode = new TH1F( "h_ele_PinMnPout_mode", "ele track inner p - outer p, mode" ,nbinp,0.,100.);
329  h_ele_PinMnPoutVsEta_mode = new TH2F( "h_ele_PinMnPoutVsEta_mode", "ele track inner p - outer p vs eta, mode" ,nbineta2D, etamin,etamax,nbinp2D,0.,100.);
330  h_ele_PinMnPoutVsPhi_mode = new TH2F( "h_ele_PinMnPoutVsPhi_mode", "ele track inner p - outer p vs phi, mode" ,nbinphi2D, phimin,phimax,nbinp2D,0.,100.);
331  h_ele_PinMnPoutVsPt_mode = new TH2F( "h_ele_PinMnPoutVsPt_mode", "ele track inner p - outer p vs pt, mode" ,nbinpt2D, 0.,ptmax,nbinp2D,0.,100.);
332  h_ele_PinMnPoutVsE_mode = new TH2F( "h_ele_PinMnPoutVsE_mode", "ele track inner p - outer p vs E, mode" ,nbinp2D, 0.,200.,nbinp2D,0.,100.);
333  h_ele_PinMnPoutVsChi2_mode = new TH2F( "h_ele_PinMnPoutVsChi2_mode", "ele track inner p - outer p vs track chi2, mode" ,50, 0.,20.,nbinp2D,0.,100.);
334  h_ele_outerP = new TH1F( "h_ele_outerP", "ele track outer p, mean", nbinp,0.,pmax);
335  h_ele_outerP_mode = new TH1F( "h_ele_outerP_mode", "ele track outer p, mode", nbinp,0.,pmax);
336  h_ele_outerPVsEta_mode = new TH2F( "h_ele_outerPVsEta_mode", "ele track outer p vs eta mode", nbineta2D,etamin,etamax,50,0.,pmax);
337  h_ele_outerPt = new TH1F( "h_ele_outerPt", "ele track outer p_{T}, mean", nbinpt,0.,ptmax);
338  h_ele_outerPt_mode = new TH1F( "h_ele_outerPt_mode", "ele track outer p_{T}, mode", nbinpt,0.,ptmax);
339  h_ele_outerPtVsEta_mode = new TH2F( "h_ele_outerPtVsEta_mode", "ele track outer p_{T} vs eta, mode", nbineta2D,etamin,etamax,nbinpt2D,0.,ptmax);
340  h_ele_outerPtVsPhi_mode = new TH2F( "h_ele_outerPtVsPhi_mode", "ele track outer p_{T} vs phi, mode", nbinphi2D,phimin,phimax,nbinpt2D,0.,ptmax);
341  h_ele_outerPtVsPt_mode = new TH2F( "h_ele_outerPtVsPt_mode", "ele track outer p_{T} vs pt, mode", nbinpt2D,0.,100.,nbinpt2D,0.,ptmax);
342 
343  // matched electrons, matching
344  h_ele_EoP = new TH1F( "h_ele_EoP", "ele E/P_{vertex}", nbineop,0.,eopmax);
345  h_ele_EoPVsEta = new TH2F( "h_ele_EoPVsEta", "ele E/P_{vertex} vs eta", nbineta2D,etamin,etamax,nbineop2D,0.,eopmaxsht);
346  h_ele_EoPVsPhi = new TH2F( "h_ele_EoPVsPhi", "ele E/P_{vertex} vs phi", nbinphi2D,phimin,phimax,nbineop2D,0.,eopmaxsht);
347  h_ele_EoPVsE = new TH2F( "h_ele_EoPVsE", "ele E/P_{vertex} vs E", 50,0.,pmax ,50,0.,5.);
348  h_ele_EseedOP = new TH1F( "h_ele_EseedOP", "ele E_{seed}/P_{vertex}", nbineop,0.,eopmax);
349  h_ele_EseedOPVsEta = new TH2F( "h_ele_EseedOPVsEta", "ele E_{seed}/P_{vertex} vs eta", nbineta2D,etamin,etamax,nbineop2D,0.,eopmaxsht);
350  h_ele_EseedOPVsPhi = new TH2F( "h_ele_EseedOPVsPhi", "ele E_{seed}/P_{vertex} vs phi", nbinphi2D,phimin,phimax,nbineop2D,0.,eopmaxsht);
351  h_ele_EseedOPVsE = new TH2F( "h_ele_EseedOPVsE", "ele E_{seed}/P_{vertex} vs E", 50,0.,pmax ,50,0.,5.);
352  h_ele_EoPout = new TH1F( "h_ele_EoPout", "ele E/P_{out}", nbineop,0.,eopmax);
353  h_ele_EoPoutVsEta = new TH2F( "h_ele_EoPoutVsEta", "ele E/P_{out} vs eta", nbineta2D,etamin,etamax,nbineop2D,0.,eopmaxsht);
354  h_ele_EoPoutVsPhi = new TH2F( "h_ele_EoPoutVsPhi", "ele E/P_{out} vs phi", nbinphi2D,phimin,phimax,nbineop2D,0.,eopmaxsht);
355  h_ele_EoPoutVsE = new TH2F( "h_ele_EoPoutVsE", "ele E/P_{out} vs E", nbinp2D,0.,pmax,nbineop2D,0.,eopmaxsht);
356  h_ele_EeleOPout = new TH1F( "h_ele_EeleOPout", "ele E_{ele}/P_{out}", nbineop,0.,eopmax);
357  h_ele_EeleOPoutVsEta = new TH2F( "h_ele_EeleOPoutVsEta", "ele E_{ele}/P_{out} vs eta", nbineta2D,etamin,etamax,nbineop2D,0.,eopmaxsht);
358  h_ele_EeleOPoutVsPhi = new TH2F( "h_ele_EeleOPoutVsPhi", "ele E_{ele}/P_{out} vs phi", nbinphi2D,phimin,phimax,nbineop2D,0.,eopmaxsht);
359  h_ele_EeleOPoutVsE = new TH2F( "h_ele_EeleOPoutVsE", "ele E_{ele}/P_{out} vs E", nbinp2D,0.,pmax,nbineop2D,0.,eopmaxsht);
360  h_ele_dEtaSc_propVtx = new TH1F( "h_ele_dEtaSc_propVtx", "ele #eta_{sc} - #eta_{tr}, prop from vertex", nbindetamatch,detamatchmin,detamatchmax);
361  h_ele_dEtaScVsEta_propVtx = new TH2F( "h_ele_dEtaScVsEta_propVtx", "ele #eta_{sc} - #eta_{tr} vs eta, prop from vertex", nbineta2D,etamin,etamax,nbindetamatch2D,detamatchmin,detamatchmax);
362  h_ele_dEtaScVsPhi_propVtx = new TH2F( "h_ele_dEtaScVsPhi_propVtx", "ele #eta_{sc} - #eta_{tr} vs phi, prop from vertex", nbinphi2D,phimin,phimax,nbindetamatch2D,detamatchmin,detamatchmax);
363  h_ele_dEtaScVsPt_propVtx = new TH2F( "h_ele_dEtaScVsPt_propVtx", "ele #eta_{sc} - #eta_{tr} vs pt, prop from vertex", nbinpt2D,0.,ptmax,nbindetamatch2D,detamatchmin,detamatchmax);
364  h_ele_dPhiSc_propVtx = new TH1F( "h_ele_dPhiSc_propVtx", "ele #phi_{sc} - #phi_{tr}, prop from vertex", nbindphimatch,dphimatchmin,dphimatchmax);
365  h_ele_dPhiScVsEta_propVtx = new TH2F( "h_ele_dPhiScVsEta_propVtx", "ele #phi_{sc} - #phi_{tr} vs eta, prop from vertex", nbineta2D,etamin,etamax,nbindphimatch2D,dphimatchmin,dphimatchmax);
366  h_ele_dPhiScVsPhi_propVtx = new TH2F( "h_ele_dPhiScVsPhi_propVtx", "ele #phi_{sc} - #phi_{tr} vs phi, prop from vertex", nbinphi2D,phimin,phimax,nbindphimatch2D,dphimatchmin,dphimatchmax);
367  h_ele_dPhiScVsPt_propVtx = new TH2F( "h_ele_dPhiScVsPt_propVtx", "ele #phi_{sc} - #phi_{tr} vs pt, prop from vertex", nbinpt2D,0.,ptmax,nbindphimatch2D,dphimatchmin,dphimatchmax);
368  h_ele_dEtaCl_propOut = new TH1F( "h_ele_dEtaCl_propOut", "ele #eta_{cl} - #eta_{tr}, prop from outermost", nbindetamatch,detamatchmin,detamatchmax);
369  h_ele_dEtaClVsEta_propOut = new TH2F( "h_ele_dEtaClVsEta_propOut", "ele #eta_{cl} - #eta_{tr} vs eta, prop from out", nbineta2D,etamin,etamax,nbindetamatch2D,detamatchmin,detamatchmax);
370  h_ele_dEtaClVsPhi_propOut = new TH2F( "h_ele_dEtaClVsPhi_propOut", "ele #eta_{cl} - #eta_{tr} vs phi, prop from out", nbinphi2D,phimin,phimax,nbindetamatch2D,detamatchmin,detamatchmax);
371  h_ele_dEtaClVsPt_propOut = new TH2F( "h_ele_dEtaScVsPt_propOut", "ele #eta_{cl} - #eta_{tr} vs pt, prop from out", nbinpt2D,0.,ptmax,nbindetamatch2D,detamatchmin,detamatchmax);
372  h_ele_dPhiCl_propOut = new TH1F( "h_ele_dPhiCl_propOut", "ele #phi_{cl} - #phi_{tr}, prop from outermost", nbindphimatch,dphimatchmin,dphimatchmax);
373  h_ele_dPhiClVsEta_propOut = new TH2F( "h_ele_dPhiClVsEta_propOut", "ele #phi_{cl} - #phi_{tr} vs eta, prop from out", nbineta2D,etamin,etamax,nbindphimatch2D,dphimatchmin,dphimatchmax);
374  h_ele_dPhiClVsPhi_propOut = new TH2F( "h_ele_dPhiClVsPhi_propOut", "ele #phi_{cl} - #phi_{tr} vs phi, prop from out", nbinphi2D,phimin,phimax,nbindphimatch2D,dphimatchmin,dphimatchmax);
375  h_ele_dPhiClVsPt_propOut = new TH2F( "h_ele_dPhiSClsPt_propOut", "ele #phi_{cl} - #phi_{tr} vs pt, prop from out", nbinpt2D,0.,ptmax,nbindphimatch2D,dphimatchmin,dphimatchmax);
376  h_ele_dEtaEleCl_propOut = new TH1F( "h_ele_dEtaEleCl_propOut", "ele #eta_{EleCl} - #eta_{tr}, prop from outermost", nbindetamatch,detamatchmin,detamatchmax);
377  h_ele_dEtaEleClVsEta_propOut = new TH2F( "h_ele_dEtaEleClVsEta_propOut", "ele #eta_{EleCl} - #eta_{tr} vs eta, prop from out", nbineta2D,etamin,etamax,nbindetamatch2D,detamatchmin,detamatchmax);
378  h_ele_dEtaEleClVsPhi_propOut = new TH2F( "h_ele_dEtaEleClVsPhi_propOut", "ele #eta_{EleCl} - #eta_{tr} vs phi, prop from out", nbinphi2D,phimin,phimax,nbindetamatch2D,detamatchmin,detamatchmax);
379  h_ele_dEtaEleClVsPt_propOut = new TH2F( "h_ele_dEtaScVsPt_propOut", "ele #eta_{EleCl} - #eta_{tr} vs pt, prop from out", nbinpt2D,0.,ptmax,nbindetamatch2D,detamatchmin,detamatchmax);
380  h_ele_dPhiEleCl_propOut = new TH1F( "h_ele_dPhiEleCl_propOut", "ele #phi_{EleCl} - #phi_{tr}, prop from outermost", nbindphimatch,dphimatchmin,dphimatchmax);
381  h_ele_dPhiEleClVsEta_propOut = new TH2F( "h_ele_dPhiEleClVsEta_propOut", "ele #phi_{EleCl} - #phi_{tr} vs eta, prop from out", nbineta2D,etamin,etamax,nbindphimatch2D,dphimatchmin,dphimatchmax);
382  h_ele_dPhiEleClVsPhi_propOut = new TH2F( "h_ele_dPhiEleClVsPhi_propOut", "ele #phi_{EleCl} - #phi_{tr} vs phi, prop from out", nbinphi2D,phimin,phimax,nbindphimatch2D,dphimatchmin,dphimatchmax);
383  h_ele_dPhiEleClVsPt_propOut = new TH2F( "h_ele_dPhiSEleClsPt_propOut", "ele #phi_{EleCl} - #phi_{tr} vs pt, prop from out", nbinpt2D,0.,ptmax,nbindphimatch2D,dphimatchmin,dphimatchmax);
384 
385  h_ele_HoE = new TH1F("h_ele_HoE", "ele hadronic energy / em energy", nbinhoe, hoemin, hoemax) ;
386  h_ele_HoE_fiducial = new TH1F("h_ele_HoE_fiducial", "ele hadronic energy / em energy, fiducial region", nbinhoe, hoemin, hoemax) ;
387  h_ele_HoEVsEta = new TH2F("h_ele_HoEVsEta", "ele hadronic energy / em energy vs eta", nbineta,etamin,etamax,nbinhoe, hoemin, hoemax) ;
388  h_ele_HoEVsPhi = new TH2F("h_ele_HoEVsPhi", "ele hadronic energy / em energy vs phi", nbinphi2D,phimin,phimax,nbinhoe, hoemin, hoemax) ;
389  h_ele_HoEVsE = new TH2F("h_ele_HoEVsE", "ele hadronic energy / em energy vs E", nbinp, 0.,300.,nbinhoe, hoemin, hoemax) ;
390 
391  h_ele_seed_dphi2_ = new TH1F("h_ele_seedDphi2", "ele seed dphi 2nd layer", 50,-0.003,+0.003) ;
392  h_ele_seed_dphi2VsEta_ = new TH2F("h_ele_seedDphi2VsEta", "ele seed dphi 2nd layer vs eta", nbineta2D,etamin,etamax,50,-0.003,+0.003) ;
393  h_ele_seed_dphi2VsPt_ = new TH2F("h_ele_seedDphi2VsPt", "ele seed dphi 2nd layer vs pt", nbinpt2D,0.,ptmax,50,-0.003,+0.003) ;
394  h_ele_seed_drz2_ = new TH1F("h_ele_seedDrz2", "ele seed dr/dz 2nd layer", 50,-0.03,+0.03) ;
395  h_ele_seed_drz2VsEta_ = new TH2F("h_ele_seedDrz2VsEta", "ele seed dr/dz 2nd layer vs eta", nbineta2D,etamin,etamax,50,-0.03,+0.03) ;
396  h_ele_seed_drz2VsPt_ = new TH2F("h_ele_seedDrz2VsPt", "ele seed dr/dz 2nd layer vs pt", nbinpt2D,0.,ptmax,50,-0.03,+0.03) ;
397  h_ele_seed_subdet2_ = new TH1F("h_ele_seedSubdet2", "ele seed subdet 2nd layer", 10,0.,10.) ;
398 
399  // classes
400  h_ele_classes = new TH1F( "h_ele_classes", "electron classes", 20,0.0,20.);
401  h_ele_eta = new TH1F( "h_ele_eta", "ele electron eta", nbineta/2,0.0,etamax);
402  h_ele_eta_golden = new TH1F( "h_ele_eta_golden", "ele electron eta golden", nbineta/2,0.0,etamax);
403  h_ele_eta_bbrem = new TH1F( "h_ele_eta_bbrem", "ele electron eta bbrem", nbineta/2,0.0,etamax);
404  h_ele_eta_narrow = new TH1F( "h_ele_eta_narrow", "ele electron eta narrow", nbineta/2,0.0,etamax);
405  h_ele_eta_shower = new TH1F( "h_ele_eta_show", "ele electron eta showering", nbineta/2,0.0,etamax);
406  h_ele_PinVsPoutGolden_mode = new TH2F( "h_ele_PinVsPoutGolden_mode", "ele track inner p vs outer p vs eta, golden, mode" ,nbinp2D,0.,pmax,50,0.,pmax);
407  h_ele_PinVsPoutShowering_mode = new TH2F( "h_ele_PinVsPoutShowering_mode", "ele track inner p vs outer p vs eta, Showering, mode" ,nbinp2D,0.,pmax,50,0.,pmax);
408  h_ele_PinVsPoutGolden_mean = new TH2F( "h_ele_PinVsPoutGolden_mean", "ele track inner p vs outer p vs eta, golden, mean" ,nbinp2D,0.,pmax,50,0.,pmax);
409  h_ele_PinVsPoutShowering_mean = new TH2F( "h_ele_PinVsPoutShowering_mean", "ele track inner p vs outer p vs eta, Showering, mean" ,nbinp2D,0.,pmax,50,0.,pmax);
410  h_ele_PtinVsPtoutGolden_mode = new TH2F( "h_ele_PtinVsPtoutGolden_mode", "ele track inner pt vs outer pt vs eta, golden, mode" ,nbinpt2D,0.,ptmax,50,0.,ptmax);
411  h_ele_PtinVsPtoutShowering_mode = new TH2F( "h_ele_PtinVsPtoutShowering_mode", "ele track inner pt vs outer pt vs eta, showering, mode" ,nbinpt2D,0.,ptmax,50,0.,ptmax);
412  h_ele_PtinVsPtoutGolden_mean = new TH2F( "h_ele_PtinVsPtoutGolden_mean", "ele track inner pt vs outer pt vs eta, golden, mean" ,nbinpt2D,0.,ptmax,50,0.,ptmax);
413  h_ele_PtinVsPtoutShowering_mean = new TH2F( "h_ele_PtinVsPtoutShowering_mean", "ele track inner pt vs outer pt vs eta, showering, mean" ,nbinpt2D,0.,ptmax,50,0.,ptmax);
414  histSclEoEmatchingObjectGolden_barrel = new TH1F("h_scl_EoEmatchingObject golden, barrel","ele supercluster energy over matchingObject energy, golden, barrel",100,0.2,1.2);
415  histSclEoEmatchingObjectGolden_endcaps = new TH1F("h_scl_EoEmatchingObject golden, endcaps","ele supercluster energy over matchingObject energy, golden, endcaps",100,0.2,1.2);
416  histSclEoEmatchingObjectShowering_barrel = new TH1F("h_scl_EoEmatchingObject Showering, barrel","ele supercluster energy over matchingObject energy, showering, barrel",100,0.2,1.2);
417  histSclEoEmatchingObjectShowering_endcaps = new TH1F("h_scl_EoEmatchingObject Showering, endcaps","ele supercluster energy over matchingObject energy, showering, endcaps",100,0.2,1.2);
418 
419  // isolation
420  h_ele_tkSumPt_dr03 = new TH1F("h_ele_tkSumPt_dr03","tk isolation sum, dR=0.3",100,0.0,20.);
421  h_ele_ecalRecHitSumEt_dr03= new TH1F("h_ele_ecalRecHitSumEt_dr03","ecal isolation sum, dR=0.3",100,0.0,20.);
422  h_ele_hcalDepth1TowerSumEt_dr03= new TH1F("h_ele_hcalDepth1TowerSumEt_dr03","hcal depth1 isolation sum, dR=0.3",100,0.0,20.);
423  h_ele_hcalDepth2TowerSumEt_dr03= new TH1F("h_ele_hcalDepth2TowerSumEt_dr03","hcal depth2 isolation sum, dR=0.3",100,0.0,20.);
424  h_ele_tkSumPt_dr04= new TH1F("h_ele_tkSumPt_dr04","hcal isolation sum",100,0.0,20.);
425  h_ele_ecalRecHitSumEt_dr04= new TH1F("h_ele_ecalRecHitSumEt_dr04","ecal isolation sum, dR=0.4",100,0.0,20.);
426  h_ele_hcalDepth1TowerSumEt_dr04= new TH1F("h_ele_hcalDepth1TowerSumEt_dr04","hcal depth1 isolation sum, dR=0.4",100,0.0,20.);
427  h_ele_hcalDepth2TowerSumEt_dr04= new TH1F("h_ele_hcalDepth2TowerSumEt_dr04","hcal depth2 isolation sum, dR=0.4",100,0.0,20.);
428 
429  // fbrem
430  h_ele_fbrem = new TH1F( "h_ele_fbrem","ele brem fraction, mode",100,0.,1.);
431  h_ele_fbremVsEta_mode = new TProfile( "h_ele_fbremvsEtamode","mean ele brem fraction vs eta, mode",nbineta2D,etamin,etamax,0.,1.);
432  h_ele_fbremVsEta_mean = new TProfile( "h_ele_fbremvsEtamean","mean ele brem fraction vs eta, mean",nbineta2D,etamin,etamax,0.,1.);
433 
434  // e/g et pflow electrons
435  h_ele_mva = new TH1F( "h_ele_mva","ele identification mva",100,-1.,1.);
436  h_ele_provenance = new TH1F( "h_ele_provenance","ele provenance",5,-2.,3.);
437 
438  // histos titles
439  h_matchingObjectNum -> GetXaxis()-> SetTitle("N_{SC}");
440  h_matchingObjectNum -> GetYaxis()-> SetTitle("Events");
441  h_matchingObjectEta -> GetXaxis()-> SetTitle("#eta_{SC}");
442  h_matchingObjectEta -> GetYaxis()-> SetTitle("Events");
443  h_matchingObjectP -> GetXaxis()-> SetTitle("E_{SC} (GeV)");
444  h_matchingObjectP -> GetYaxis()-> SetTitle("Events");
445  h_ele_foundHits -> GetXaxis()-> SetTitle("N_{hits}");
446  h_ele_foundHits -> GetYaxis()-> SetTitle("Events");
447  h_ele_ambiguousTracks -> GetXaxis()-> SetTitle("N_{ambiguous tracks}");
448  h_ele_ambiguousTracks -> GetYaxis()-> SetTitle("Events");
449  h_ele_lostHits -> GetXaxis()-> SetTitle("N_{lost hits}");
450  h_ele_lostHits -> GetYaxis()-> SetTitle("Events");
451  h_ele_chi2 -> GetXaxis()-> SetTitle("#Chi^{2}");
452  h_ele_chi2 -> GetYaxis()-> SetTitle("Events");
453  h_ele_charge -> GetXaxis()-> SetTitle("charge");
454  h_ele_charge -> GetYaxis()-> SetTitle("Events");
455  h_ele_vertexP -> GetXaxis()-> SetTitle("p_{vertex} (GeV/c)");
456  h_ele_vertexP -> GetYaxis()-> SetTitle("Events");
457  h_ele_vertexPt -> GetXaxis()-> SetTitle("p_{T vertex} (GeV/c)");
458  h_ele_vertexPt -> GetYaxis()-> SetTitle("Events");
459  h_ele_Et -> GetXaxis()-> SetTitle("E_{T} (GeV)");
460  h_ele_Et -> GetYaxis()-> SetTitle("Events");
461  h_ele_vertexEta -> GetXaxis()-> SetTitle("#eta");
462  h_ele_vertexEta -> GetYaxis()-> SetTitle("Events");
463  h_ele_vertexPhi -> GetXaxis()-> SetTitle("#phi (rad)");
464  h_ele_vertexPhi -> GetYaxis()-> SetTitle("Events");
465  h_ele_PoPmatchingObject_matched -> GetXaxis()-> SetTitle("P/E_{SC}");
466  h_ele_PoPmatchingObject_matched -> GetYaxis()-> SetTitle("Events");
467  h_ele_PoPmatchingObject_barrel_matched -> GetXaxis()-> SetTitle("P/E_{SC}");
468  h_ele_PoPmatchingObject_barrel_matched -> GetYaxis()-> SetTitle("Events");
469  h_ele_PoPmatchingObject_endcaps_matched -> GetXaxis()-> SetTitle("P/E_{SC}");
470  h_ele_PoPmatchingObject_endcaps_matched -> GetYaxis()-> SetTitle("Events");
471  h_ele_PtoPtmatchingObject_matched -> GetXaxis()-> SetTitle("P_{T}/E_{T}^{SC}");
472  h_ele_PtoPtmatchingObject_matched -> GetYaxis()-> SetTitle("Events");
473  h_ele_PtoPtmatchingObject_barrel_matched -> GetXaxis()-> SetTitle("P_{T}/E_{T}^{SC}");
474  h_ele_PtoPtmatchingObject_barrel_matched -> GetYaxis()-> SetTitle("Events");
475  h_ele_PtoPtmatchingObject_endcaps_matched -> GetXaxis()-> SetTitle("P_{T}/E_{T}^{SC}");
476  h_ele_PtoPtmatchingObject_endcaps_matched -> GetYaxis()-> SetTitle("Events");
477  histSclSigEtaEta_-> GetXaxis()-> SetTitle("#sigma_{#eta #eta}") ;
478  histSclSigEtaEta_-> GetYaxis()-> SetTitle("Events") ;
479  histSclSigIEtaIEta_barrel_-> GetXaxis()-> SetTitle("#sigma_{i#eta i#eta}") ;
480  histSclSigIEtaIEta_barrel_-> GetYaxis()-> SetTitle("Events") ;
481  histSclSigIEtaIEta_endcaps_-> GetXaxis()-> SetTitle("#sigma_{i#eta i#eta}") ;
482  histSclSigIEtaIEta_endcaps_-> GetYaxis()-> SetTitle("Events") ;
483  histSclE1x5_-> GetXaxis()-> SetTitle("E1x5 (GeV)") ;
484  histSclE1x5_-> GetYaxis()-> SetTitle("Events") ;
485  histSclE1x5_barrel_-> GetXaxis()-> SetTitle("E1x5 (GeV)") ;
486  histSclE1x5_barrel_-> GetYaxis()-> SetTitle("Events") ;
487  histSclE1x5_endcaps_-> GetXaxis()-> SetTitle("E1x5 (GeV)") ;
488  histSclE1x5_endcaps_-> GetYaxis()-> SetTitle("Events") ;
489  histSclE2x5max_-> GetXaxis()-> SetTitle("E2x5 (GeV)") ;
490  histSclE2x5max_-> GetYaxis()-> SetTitle("Events") ;
491  histSclE2x5max_barrel_-> GetXaxis()-> SetTitle("E2x5 (GeV)") ;
492  histSclE2x5max_barrel_-> GetYaxis()-> SetTitle("Events") ;
493  histSclE2x5max_endcaps_-> GetXaxis()-> SetTitle("E2x5 (GeV)") ;
494  histSclE2x5max_endcaps_-> GetYaxis()-> SetTitle("Events") ;
495  histSclE5x5_-> GetXaxis()-> SetTitle("E5x5 (GeV)") ;
496  histSclE5x5_-> GetYaxis()-> SetTitle("Events") ;
497  histSclE5x5_barrel_-> GetXaxis()-> SetTitle("E5x5 (GeV)") ;
498  histSclE5x5_barrel_-> GetYaxis()-> SetTitle("Events") ;
499  histSclE5x5_endcaps_-> GetXaxis()-> SetTitle("E5x5 (GeV)") ;
500  histSclE5x5_endcaps_-> GetYaxis()-> SetTitle("Events") ;
501  h_ele_EtaMnEtamatchingObject_matched -> GetXaxis()-> SetTitle("#eta_{rec} - #eta_{SC}");
502  h_ele_EtaMnEtamatchingObject_matched -> GetYaxis()-> SetTitle("Events");
503  h_ele_PhiMnPhimatchingObject_matched -> GetXaxis()-> SetTitle("#phi_{rec} - #phi_{SC} (rad)");
504  h_ele_PhiMnPhimatchingObject_matched -> GetYaxis()-> SetTitle("Events");
505  h_ele_PinMnPout -> GetXaxis()-> SetTitle("P_{vertex} - P_{out} (GeV/c)");
506  h_ele_PinMnPout -> GetYaxis()-> SetTitle("Events");
507  h_ele_PinMnPout_mode -> GetXaxis()-> SetTitle("P_{vertex} - P_{out}, mode (GeV/c)");
508  h_ele_PinMnPout_mode -> GetYaxis()-> SetTitle("Events");
509  h_ele_outerP -> GetXaxis()-> SetTitle("P_{out} (GeV/c)");
510  h_ele_outerP -> GetYaxis()-> SetTitle("Events");
511  h_ele_outerP_mode -> GetXaxis()-> SetTitle("P_{out} (GeV/c)");
512  h_ele_outerP_mode -> GetYaxis()-> SetTitle("Events");
513  h_ele_outerPt -> GetXaxis()-> SetTitle("P_{T out} (GeV/c)");
514  h_ele_outerPt -> GetYaxis()-> SetTitle("Events");
515  h_ele_outerPt_mode -> GetXaxis()-> SetTitle("P_{T out} (GeV/c)");
516  h_ele_outerPt_mode -> GetYaxis()-> SetTitle("Events");
517  h_ele_EoP -> GetXaxis()-> SetTitle("E/P_{vertex}");
518  h_ele_EoP -> GetYaxis()-> SetTitle("Events");
519  h_ele_EseedOP -> GetXaxis()-> SetTitle("E_{seed}/P_{vertex}");
520  h_ele_EseedOP -> GetYaxis()-> SetTitle("Events");
521  h_ele_EoPout -> GetXaxis()-> SetTitle("E_{seed}/P_{out}");
522  h_ele_EoPout -> GetYaxis()-> SetTitle("Events");
523  h_ele_EeleOPout -> GetXaxis()-> SetTitle("E_{ele}/P_{out}");
524  h_ele_EeleOPout -> GetYaxis()-> SetTitle("Events");
525  h_ele_vertexX-> GetXaxis()-> SetTitle("x (cm)");
526  h_ele_vertexX-> GetYaxis()-> SetTitle("Events");
527  h_ele_vertexY-> GetXaxis()-> SetTitle("y (cm)");
528  h_ele_vertexY-> GetYaxis()-> SetTitle("Events");
529  h_ele_vertexZ-> GetXaxis()-> SetTitle("z (cm)");
530  h_ele_vertexZ-> GetYaxis()-> SetTitle("Events");
531  h_ele_vertexTIP-> GetXaxis()-> SetTitle("TIP (cm)");
532  h_ele_vertexTIP-> GetYaxis()-> SetTitle("Events");
533  h_ele_vertexTIPVsEta-> GetYaxis()-> SetTitle("TIP (cm)");
534  h_ele_vertexTIPVsEta-> GetXaxis()-> SetTitle("#eta");
535  h_ele_vertexTIPVsPhi-> GetYaxis()-> SetTitle("TIP (cm)");
536  h_ele_vertexTIPVsPhi-> GetXaxis()-> SetTitle("#phi (rad)");
537  h_ele_vertexTIPVsPt-> GetYaxis()-> SetTitle("TIP (cm)");
538  h_ele_vertexTIPVsEta-> GetXaxis()-> SetTitle("p_{T} (GeV/c)");
539  h_ele_dEtaSc_propVtx-> GetXaxis()-> SetTitle("#eta_{sc} - #eta_{tr}");
540  h_ele_dEtaSc_propVtx-> GetYaxis()-> SetTitle("Events");
541  h_ele_dEtaCl_propOut-> GetXaxis()-> SetTitle("#eta_{seedcl} - #eta_{tr}");
542  h_ele_dEtaCl_propOut-> GetYaxis()-> SetTitle("Events");
543  h_ele_dEtaEleCl_propOut-> GetXaxis()-> SetTitle("#eta_{elecl} - #eta_{tr}");
544  h_ele_dEtaEleCl_propOut-> GetYaxis()-> SetTitle("Events");
545  h_ele_dPhiSc_propVtx-> GetXaxis()-> SetTitle("#phi_{sc} - #phi_{tr} (rad)");
546  h_ele_dPhiSc_propVtx-> GetYaxis()-> SetTitle("Events");
547  h_ele_dPhiCl_propOut-> GetXaxis()-> SetTitle("#phi_{seedcl} - #phi_{tr} (rad)");
548  h_ele_dPhiCl_propOut-> GetYaxis()-> SetTitle("Events");
549  h_ele_dPhiEleCl_propOut-> GetXaxis()-> SetTitle("#phi_{elecl} - #phi_{tr} (rad)");
550  h_ele_dPhiEleCl_propOut-> GetYaxis()-> SetTitle("Events");
551  h_ele_HoE-> GetXaxis()-> SetTitle("H/E") ;
552  h_ele_HoE-> GetYaxis()-> SetTitle("Events") ;
553  h_ele_HoE_fiducial-> GetXaxis()-> SetTitle("H/E") ;
554  h_ele_HoE_fiducial-> GetYaxis()-> SetTitle("Events") ;
555  h_ele_fbrem-> GetXaxis()-> SetTitle("P_{in} - P_{out} / P_{in}");
556  h_ele_fbrem-> GetYaxis()-> SetTitle("Events");
557  h_ele_seed_dphi2_-> GetXaxis()-> SetTitle("#phi_{hit}-#phi_{pred} (rad)") ;
558  h_ele_seed_dphi2_-> GetYaxis()-> SetTitle("Events") ;
559  h_ele_seed_drz2_-> GetXaxis()-> SetTitle("r(z)_{hit}-r(z)_{pred} (cm)") ;
560  h_ele_seed_drz2_-> GetYaxis()-> SetTitle("Events") ;
561  h_ele_seed_subdet2_-> GetXaxis()-> SetTitle("2nd hit subdet Id") ;
562  h_ele_seed_subdet2_-> GetYaxis()-> SetTitle("Events") ;
563  h_ele_classes-> GetXaxis()-> SetTitle("class Id") ;
564  h_ele_classes-> GetYaxis()-> SetTitle("Events") ;
565  h_ele_mee_all-> GetXaxis()-> SetTitle("m_{ee} (GeV/c^{2})");
566  h_ele_mee_all-> GetYaxis()-> SetTitle("Events");
567  h_ele_mee_os-> GetXaxis()-> SetTitle("m_{e^{+}e^{-}} (GeV/c^{2})");
568  h_ele_mee_os-> GetYaxis()-> SetTitle("Events");
569  h_ele_mee_os_ebeb-> GetXaxis()-> SetTitle("m_{e^{+}e^{-}} (GeV/c^{2})");
570  h_ele_mee_os_ebeb-> GetYaxis()-> SetTitle("Events");
571  h_ele_mee_os_ebee-> GetXaxis()-> SetTitle("m_{e^{+}e^{-}} (GeV/c^{2})");
572  h_ele_mee_os_ebee-> GetYaxis()-> SetTitle("Events");
573  h_ele_mee_os_eeee-> GetXaxis()-> SetTitle("m_{e^{+}e^{-}} (GeV/c^{2})");
574  h_ele_mee_os_eeee-> GetYaxis()-> SetTitle("Events");
575  h_ele_mee_os_gg-> GetXaxis()-> SetTitle("m_{e^{+}e^{-}} (GeV/c^{2})");
576  h_ele_mee_os_gg-> GetYaxis()-> SetTitle("Events");
577  h_ele_mee_os_gb-> GetXaxis()-> SetTitle("m_{e^{+}e^{-}} (GeV/c^{2})");
578  h_ele_mee_os_gb-> GetYaxis()-> SetTitle("Events");
579  h_ele_mee_os_bb-> GetXaxis()-> SetTitle("m_{e^{+}e^{-}} (GeV/c^{2})");
580  h_ele_mee_os_bb-> GetYaxis()-> SetTitle("Events");
581  h_ele_E2mnE1vsMee_all-> GetXaxis()-> SetTitle("m_{e^{+}e^{-}} (GeV/c^{2})");
582  h_ele_E2mnE1vsMee_all-> GetYaxis()-> SetTitle("E2 - E1 (GeV)");
583  h_ele_E2mnE1vsMee_egeg_all-> GetXaxis()-> SetTitle("m_{e^{+}e^{-}} (GeV/c^{2})");
584  h_ele_E2mnE1vsMee_egeg_all-> GetYaxis()-> SetTitle("E2 - E1 (GeV)");
585  histNum_-> GetXaxis()-> SetTitle("N_{ele}");
586  histNum_-> GetYaxis()-> SetTitle("Events");
587  h_ele_fbremVsEta_mode-> GetXaxis()-> SetTitle("#eta");
588  h_ele_fbremVsEta_mean-> GetXaxis()-> SetTitle("#eta");
589 
590 }
591 
592 void
594 
595  histfile_->cd();
596  std::cout << "efficiency calculation " << std::endl;
597  // efficiency vs eta
598  TH1F *h_ele_etaEff = (TH1F*)h_ele_matchingObjectEta_matched->Clone("h_ele_etaEff");
599  h_ele_etaEff->Reset();
600  h_ele_etaEff->Divide(h_ele_matchingObjectEta_matched,h_matchingObjectEta,1,1,"b");
601  h_ele_etaEff->Print();
602  h_ele_etaEff->GetXaxis()->SetTitle("#eta");
603  h_ele_etaEff->GetYaxis()->SetTitle("Efficiency");
604 
605  // efficiency vs z
606  TH1F *h_ele_zEff = (TH1F*)h_ele_matchingObjectZ_matched->Clone("h_ele_zEff");
607  h_ele_zEff->Reset();
608  h_ele_zEff->Divide(h_ele_matchingObjectZ_matched,h_matchingObjectZ,1,1,"b");
609  h_ele_zEff->Print();
610  h_ele_zEff->GetXaxis()->SetTitle("z (cm)");
611  h_ele_zEff->GetYaxis()->SetTitle("Efficiency");
612 
613  // efficiency vs |eta|
614  TH1F *h_ele_absetaEff = (TH1F*)h_ele_matchingObjectAbsEta_matched->Clone("h_ele_absetaEff");
615  h_ele_absetaEff->Reset();
616  h_ele_absetaEff->Divide(h_ele_matchingObjectAbsEta_matched,h_matchingObjectAbsEta,1,1,"b");
617  h_ele_absetaEff->GetXaxis()->SetTitle("|#eta|");
618  h_ele_absetaEff->GetYaxis()->SetTitle("Efficiency");
619 
620  // efficiency vs pt
621  TH1F *h_ele_ptEff = (TH1F*)h_ele_matchingObjectPt_matched->Clone("h_ele_ptEff");
622  h_ele_ptEff->Reset();
623  h_ele_ptEff->Divide(h_ele_matchingObjectPt_matched,h_matchingObjectPt,1,1,"b");
624  h_ele_ptEff->GetXaxis()->SetTitle("p_{T} (GeV/c)");
625  h_ele_ptEff->GetYaxis()->SetTitle("Efficiency");
626 
627  // efficiency vs phi
628  TH1F *h_ele_phiEff = (TH1F*)h_ele_matchingObjectPhi_matched->Clone("h_ele_phiEff");
629  h_ele_phiEff->Reset();
630  h_ele_phiEff->Divide(h_ele_matchingObjectPhi_matched,h_matchingObjectPhi,1,1,"b");
631  h_ele_phiEff->GetXaxis()->SetTitle("#phi (rad)");
632  h_ele_phiEff->GetYaxis()->SetTitle("Efficiency");
633 
634  // classes
635  TH1F *h_ele_eta_goldenFrac = (TH1F*)h_ele_eta_golden->Clone("h_ele_eta_goldenFrac");
636  h_ele_eta_goldenFrac->Reset();
637  h_ele_eta_goldenFrac->Divide(h_ele_eta_golden,h_ele_eta,1,1);
638  h_ele_eta_goldenFrac->GetXaxis()->SetTitle("|#eta|");
639  h_ele_eta_goldenFrac->GetYaxis()->SetTitle("Fraction of electrons");
640  h_ele_eta_goldenFrac->SetTitle("fraction of golden electrons vs eta");
641  TH1F *h_ele_eta_bbremFrac = (TH1F*)h_ele_eta_bbrem->Clone("h_ele_eta_bbremFrac");
642  h_ele_eta_bbremFrac->Reset();
643  h_ele_eta_bbremFrac->Divide(h_ele_eta_bbrem,h_ele_eta,1,1);
644  h_ele_eta_bbremFrac->GetXaxis()->SetTitle("|#eta|");
645  h_ele_eta_bbremFrac->GetYaxis()->SetTitle("Fraction of electrons");
646  h_ele_eta_bbremFrac->SetTitle("fraction of big brem electrons vs eta");
647  TH1F *h_ele_eta_narrowFrac = (TH1F*)h_ele_eta_narrow->Clone("h_ele_eta_narrowFrac");
648  h_ele_eta_narrowFrac->Reset();
649  h_ele_eta_narrowFrac->Divide(h_ele_eta_narrow,h_ele_eta,1,1);
650  h_ele_eta_narrowFrac->GetXaxis()->SetTitle("|#eta|");
651  h_ele_eta_narrowFrac->GetYaxis()->SetTitle("Fraction of electrons");
652  h_ele_eta_narrowFrac->SetTitle("fraction of narrow electrons vs eta");
653  TH1F *h_ele_eta_showerFrac = (TH1F*)h_ele_eta_shower->Clone("h_ele_eta_showerFrac");
654  h_ele_eta_showerFrac->Reset();
655  h_ele_eta_showerFrac->Divide(h_ele_eta_shower,h_ele_eta,1,1);
656  h_ele_eta_showerFrac->GetXaxis()->SetTitle("|#eta|");
657  h_ele_eta_showerFrac->GetYaxis()->SetTitle("Fraction of electrons");
658  h_ele_eta_showerFrac->SetTitle("fraction of showering electrons vs eta");
659 
660  // fbrem
661  TH1F *h_ele_xOverX0VsEta = new TH1F( "h_ele_xOverx0VsEta","mean X/X_0 vs eta",nbineta/2,0.0,2.5);
662  for (int ibin=1;ibin<h_ele_fbremVsEta_mean->GetNbinsX()+1;ibin++) {
663  double xOverX0 = 0.;
664  if (h_ele_fbremVsEta_mean->GetBinContent(ibin)>0.) xOverX0 = -log(h_ele_fbremVsEta_mean->GetBinContent(ibin));
665  h_ele_xOverX0VsEta->SetBinContent(ibin,xOverX0);
666  }
667 
668  //profiles from 2D histos
669  TProfile *p_ele_PoPmatchingObjectVsEta_matched = h_ele_PoPmatchingObjectVsEta_matched->ProfileX();
670  p_ele_PoPmatchingObjectVsEta_matched->SetTitle("mean ele momentum / matching SC energy vs eta");
671  p_ele_PoPmatchingObjectVsEta_matched->GetXaxis()->SetTitle("#eta");
672  p_ele_PoPmatchingObjectVsEta_matched->GetYaxis()->SetTitle("<P/E_{matching SC}>");
673  p_ele_PoPmatchingObjectVsEta_matched->Write();
674  TProfile *p_ele_PoPmatchingObjectVsPhi_matched = h_ele_PoPmatchingObjectVsPhi_matched->ProfileX();
675  p_ele_PoPmatchingObjectVsPhi_matched->SetTitle("mean ele momentum / gen momentum vs phi");
676  p_ele_PoPmatchingObjectVsPhi_matched->GetXaxis()->SetTitle("#phi (rad)");
677  p_ele_PoPmatchingObjectVsPhi_matched->GetYaxis()->SetTitle("<P/E_{matching SC}>");
678  p_ele_PoPmatchingObjectVsPhi_matched->Write();
679  TProfile *p_ele_EtaMnEtamatchingObjectVsEta_matched = h_ele_EtaMnEtamatchingObjectVsEta_matched->ProfileX();
680  p_ele_EtaMnEtamatchingObjectVsEta_matched->GetXaxis()->SetTitle("#eta");
681  p_ele_EtaMnEtamatchingObjectVsEta_matched->GetYaxis()->SetTitle("<#eta_{rec} - #eta_{matching SC}>");
682  p_ele_EtaMnEtamatchingObjectVsEta_matched->Write();
683  TProfile *p_ele_EtaMnEtamatchingObjectVsPhi_matched = h_ele_EtaMnEtamatchingObjectVsPhi_matched->ProfileX();
684  p_ele_EtaMnEtamatchingObjectVsPhi_matched-> GetXaxis()-> SetTitle("#phi");
685  p_ele_EtaMnEtamatchingObjectVsPhi_matched-> GetYaxis()-> SetTitle("<#eta_{rec} - #eta_{matching SC}>");
686  p_ele_EtaMnEtamatchingObjectVsPhi_matched->Write();
687  TProfile *p_ele_PhiMnPhimatchingObjectVsEta_matched = h_ele_PhiMnPhimatchingObjectVsEta_matched->ProfileX();
688  p_ele_PhiMnPhimatchingObjectVsEta_matched-> GetXaxis()-> SetTitle("#eta");
689  p_ele_PhiMnPhimatchingObjectVsEta_matched-> GetYaxis()-> SetTitle("<#phi_{rec} - #phi_{matching SC}> (rad)");
690  p_ele_PhiMnPhimatchingObjectVsEta_matched->Write();
691  TProfile *p_ele_PhiMnPhimatchingObjectVsPhi_matched = h_ele_PhiMnPhimatchingObjectVsPhi_matched->ProfileX();
692  p_ele_PhiMnPhimatchingObjectVsPhi_matched-> GetXaxis()-> SetTitle("#phi");
693  p_ele_PhiMnPhimatchingObjectVsPhi_matched-> GetYaxis()-> SetTitle("<#phi_{rec} - #phi_{matching SC}> (rad)");
694  p_ele_PhiMnPhimatchingObjectVsPhi_matched->Write();
695  TProfile *p_ele_vertexPtVsEta = h_ele_vertexPtVsEta->ProfileX();
696  p_ele_vertexPtVsEta->GetXaxis()->SetTitle("#eta");
697  p_ele_vertexPtVsEta->GetYaxis()->SetTitle("<p_{T}> (GeV/c)");
698  p_ele_vertexPtVsEta->Write();
699  TProfile *p_ele_vertexPtVsPhi = h_ele_vertexPtVsPhi->ProfileX();
700  p_ele_vertexPtVsPhi->GetXaxis()->SetTitle("#phi (rad)");
701  p_ele_vertexPtVsPhi->GetYaxis()->SetTitle("<p_{T}> (GeV/c)");
702  p_ele_vertexPtVsPhi->Write();
703  TProfile *p_ele_EoPVsEta = h_ele_EoPVsEta->ProfileX();
704  p_ele_EoPVsEta->GetXaxis()->SetTitle("#eta");
705  p_ele_EoPVsEta->GetYaxis()->SetTitle("<E/P_{vertex}>");
706  p_ele_EoPVsEta->Write();
707  TProfile *p_ele_EoPVsPhi = h_ele_EoPVsPhi->ProfileX();
708  p_ele_EoPVsPhi->GetXaxis()->SetTitle("#phi (rad)");
709  p_ele_EoPVsPhi->GetYaxis()->SetTitle("<E/P_{vertex}>");
710  p_ele_EoPVsPhi->Write();
711  TProfile *p_ele_EoPoutVsEta = h_ele_EoPoutVsEta->ProfileX();
712  p_ele_EoPoutVsEta->GetXaxis()->SetTitle("#eta");
713  p_ele_EoPoutVsEta->GetYaxis()->SetTitle("<E_{seed}/P_{out}>");
714  p_ele_EoPoutVsEta->Write();
715  TProfile *p_ele_EoPoutVsPhi = h_ele_EoPoutVsPhi->ProfileX();
716  p_ele_EoPoutVsPhi->GetXaxis()->SetTitle("#phi (rad)");
717  p_ele_EoPoutVsPhi->GetYaxis()->SetTitle("<E_{seed}/P_{out}>");
718  p_ele_EoPoutVsPhi->Write();
719  TProfile *p_ele_EeleOPoutVsEta = h_ele_EeleOPoutVsEta->ProfileX();
720  p_ele_EeleOPoutVsEta->SetTitle("mean ele Eele/pout vs eta");
721  p_ele_EeleOPoutVsEta->GetXaxis()->SetTitle("#eta");
722  p_ele_EeleOPoutVsEta->GetYaxis()->SetTitle("<E_{ele}/P_{out}>");
723  p_ele_EeleOPoutVsEta->Write();
724  TProfile *p_ele_EeleOPoutVsPhi = h_ele_EeleOPoutVsPhi->ProfileX();
725  p_ele_EeleOPoutVsPhi->SetTitle("mean ele Eele/pout vs phi");
726  p_ele_EeleOPoutVsPhi->GetXaxis()->SetTitle("#phi (rad)");
727  p_ele_EeleOPoutVsPhi->GetYaxis()->SetTitle("<E_{ele}/P_{out}>");
728  p_ele_EeleOPoutVsPhi->Write();
729  TProfile *p_ele_HoEVsEta = h_ele_HoEVsEta->ProfileX();
730  p_ele_HoEVsEta->GetXaxis()->SetTitle("#eta");
731  p_ele_HoEVsEta->GetYaxis()->SetTitle("<H/E>");
732  p_ele_HoEVsEta->Write();
733  TProfile *p_ele_HoEVsPhi = h_ele_HoEVsPhi->ProfileX();
734  p_ele_HoEVsPhi->GetXaxis()->SetTitle("#phi (rad)");
735  p_ele_HoEVsPhi->GetYaxis()->SetTitle("<H/E>");
736  p_ele_HoEVsPhi->Write();
737  TProfile *p_ele_chi2VsEta = h_ele_chi2VsEta->ProfileX();
738  p_ele_chi2VsEta->GetXaxis()->SetTitle("#eta");
739  p_ele_chi2VsEta->GetYaxis()->SetTitle("<#Chi^{2}>");
740  p_ele_chi2VsEta->Write();
741  TProfile *p_ele_chi2VsPhi = h_ele_chi2VsPhi->ProfileX();
742  p_ele_chi2VsPhi->GetXaxis()->SetTitle("#phi (rad)");
743  p_ele_chi2VsPhi->GetYaxis()->SetTitle("<#Chi^{2}>");
744  p_ele_chi2VsPhi->Write();
745  TProfile *p_ele_foundHitsVsEta = h_ele_foundHitsVsEta->ProfileX();
746  p_ele_foundHitsVsEta->GetXaxis()->SetTitle("#eta");
747  p_ele_foundHitsVsEta->GetYaxis()->SetTitle("<N_{hits}>");
748  p_ele_foundHitsVsEta->Write();
749  TProfile *p_ele_foundHitsVsPhi = h_ele_foundHitsVsPhi->ProfileX();
750  p_ele_foundHitsVsPhi->GetXaxis()->SetTitle("#phi (rad)");
751  p_ele_foundHitsVsPhi->GetYaxis()->SetTitle("<N_{hits}>");
752  p_ele_foundHitsVsPhi->Write();
753  TProfile *p_ele_lostHitsVsEta = h_ele_lostHitsVsEta->ProfileX();
754  p_ele_lostHitsVsEta->GetXaxis()->SetTitle("#eta");
755  p_ele_lostHitsVsEta->GetYaxis()->SetTitle("<N_{hits}>");
756  p_ele_lostHitsVsEta->Write();
757  TProfile *p_ele_lostHitsVsPhi = h_ele_lostHitsVsPhi->ProfileX();
758  p_ele_lostHitsVsPhi->GetXaxis()->SetTitle("#phi (rad)");
759  p_ele_lostHitsVsPhi->GetYaxis()->SetTitle("<N_{hits}>");
760  p_ele_lostHitsVsPhi->Write();
761  TProfile *p_ele_vertexTIPVsEta = h_ele_vertexTIPVsEta->ProfileX();
762  p_ele_vertexTIPVsEta->SetTitle("mean tip (wrt gen vtx) vs eta");
763  p_ele_vertexTIPVsEta->GetXaxis()->SetTitle("#eta");
764  p_ele_vertexTIPVsEta->GetYaxis()->SetTitle("<TIP> (cm)");
765  p_ele_vertexTIPVsEta->Write();
766  TProfile *p_ele_vertexTIPVsPhi = h_ele_vertexTIPVsPhi->ProfileX();
767  p_ele_vertexTIPVsPhi->SetTitle("mean tip (wrt gen vtx) vs phi");
768  p_ele_vertexTIPVsPhi->GetXaxis()->SetTitle("#phi");
769  p_ele_vertexTIPVsPhi->GetYaxis()->SetTitle("<TIP> (cm)");
770  p_ele_vertexTIPVsPhi->Write();
771  TProfile *p_ele_vertexTIPVsPt = h_ele_vertexTIPVsPt->ProfileX();
772  p_ele_vertexTIPVsPt->SetTitle("mean tip (wrt gen vtx) vs phi");
773  p_ele_vertexTIPVsPt->GetXaxis()->SetTitle("p_{T} (GeV/c)");
774  p_ele_vertexTIPVsPt->GetYaxis()->SetTitle("<TIP> (cm)");
775  p_ele_vertexTIPVsPt->Write();
776 
777  // mc truth
778 
779  h_matchingObjectNum->Write();
780 
781  // rec event
782 
783  histNum_->Write();
784 
785  // mc
786  h_matchingObjectEta->Write();
787  h_matchingObjectAbsEta->Write();
788  h_matchingObjectP->Write();
789  h_matchingObjectPt->Write();
790  h_matchingObjectPhi->Write();
791  h_matchingObjectZ->Write();
792 
793  h_ele_mee_all->Write();
794  h_ele_mee_os->Write();
795  h_ele_mee_os_ebeb->Write();
796  h_ele_mee_os_ebee->Write();
797  h_ele_mee_os_eeee->Write();
798  h_ele_mee_os_gg->Write();
799  h_ele_mee_os_gb->Write();
800  h_ele_mee_os_bb->Write();
801  h_ele_E2mnE1vsMee_all ->Write();
803 
804  // matched electrons
805  h_ele_charge->Write();
806  h_ele_chargeVsEta->Write();
807  h_ele_chargeVsPhi->Write();
808  h_ele_chargeVsPt->Write();
809  h_ele_vertexP->Write();
810  h_ele_vertexPt->Write();
811  h_ele_Et->Write();
812  h_ele_vertexPtVsEta->Write();
813  h_ele_vertexPtVsPhi->Write();
815  h_ele_vertexEta->Write();
816  h_ele_vertexEtaVsPhi->Write();
820  h_ele_vertexPhi->Write();
821  h_ele_vertexX->Write();
822  h_ele_vertexY ->Write();
823  h_ele_vertexZ->Write();
824  h_ele_vertexTIP->Write();
826  h_ele_vertexTIPVsEta->Write();
827  h_ele_vertexTIPVsPhi->Write();
828  h_ele_vertexTIPVsPt->Write();
847 
848  // matched electron, superclusters
849  histSclEn_->Write();
854  histSclEt_->Write();
855  histSclEtVsEta_->Write();
856  histSclEtVsPhi_->Write();
857  histSclEtaVsPhi_ ->Write();
858  histSclEta_->Write();
859  histSclPhi_->Write();
860  histSclSigEtaEta_->Write();
863  histSclE1x5_->Write();
864  histSclE1x5_barrel_->Write();
865  histSclE1x5_endcaps_->Write();
866  histSclE2x5max_->Write();
867  histSclE2x5max_barrel_->Write();
868  histSclE2x5max_endcaps_->Write();
869  histSclE5x5_->Write();
870  histSclE5x5_barrel_->Write();
871  histSclE5x5_endcaps_->Write();
872 
873  // matched electron, gsf tracks
874  h_ele_ambiguousTracks->Write();
877  h_ele_ambiguousTracksVsPt->Write();
878  h_ele_foundHits->Write();
879  h_ele_foundHitsVsEta->Write();
880  h_ele_foundHitsVsPhi->Write();
881  h_ele_foundHitsVsPt->Write();
882  h_ele_lostHits->Write();
883  h_ele_lostHitsVsEta->Write();
884  h_ele_lostHitsVsPhi->Write();
885  h_ele_lostHitsVsPt->Write();
886  h_ele_chi2 ->Write();
887  h_ele_chi2VsEta ->Write();
888  h_ele_chi2VsPhi ->Write();
889  h_ele_chi2VsPt->Write();
890  h_ele_PinMnPout->Write();
891  h_ele_PinMnPout_mode->Write();
892  h_ele_PinMnPoutVsEta_mode->Write();
893  h_ele_PinMnPoutVsPhi_mode->Write();
894  h_ele_PinMnPoutVsPt_mode->Write();
895  h_ele_PinMnPoutVsE_mode->Write();
897  h_ele_outerP ->Write();
898  h_ele_outerP_mode->Write();
899  h_ele_outerPVsEta_mode->Write();
900  h_ele_outerPt->Write();
901  h_ele_outerPt_mode ->Write();
902  h_ele_outerPtVsEta_mode->Write();
903  h_ele_outerPtVsPhi_mode->Write();
904  h_ele_outerPtVsPt_mode->Write();
905 
906  // matched electrons, matching
907  h_ele_EoP ->Write();
908  h_ele_EoPVsEta ->Write();
909  h_ele_EoPVsPhi->Write();
910  h_ele_EoPVsE->Write();
911  h_ele_EseedOP ->Write();
912  h_ele_EseedOPVsEta ->Write();
913  h_ele_EseedOPVsPhi->Write();
914  h_ele_EseedOPVsE->Write();
915  h_ele_EoPout->Write();
916  h_ele_EoPoutVsEta->Write();
917  h_ele_EoPoutVsPhi->Write();
918  h_ele_EoPoutVsE ->Write();
919  h_ele_EeleOPout->Write();
920  h_ele_EeleOPoutVsEta->Write();
921  h_ele_EeleOPoutVsPhi->Write();
922  h_ele_EeleOPoutVsE ->Write();
923  h_ele_dEtaSc_propVtx->Write();
924  h_ele_dEtaScVsEta_propVtx->Write();
925  h_ele_dEtaScVsPhi_propVtx->Write();
926  h_ele_dEtaScVsPt_propVtx ->Write();
927  h_ele_dPhiSc_propVtx->Write();
928  h_ele_dPhiScVsEta_propVtx ->Write();
929  h_ele_dPhiScVsPhi_propVtx->Write();
930  h_ele_dPhiScVsPt_propVtx->Write();
931  h_ele_dEtaCl_propOut->Write();
932  h_ele_dEtaClVsEta_propOut->Write();
933  h_ele_dEtaClVsPhi_propOut->Write();
934  h_ele_dEtaClVsPt_propOut->Write();
935  h_ele_dPhiCl_propOut->Write();
936  h_ele_dPhiClVsEta_propOut->Write();
937  h_ele_dPhiClVsPhi_propOut->Write();
938  h_ele_dPhiClVsPt_propOut->Write();
939  h_ele_dEtaEleCl_propOut->Write();
943  h_ele_dPhiEleCl_propOut->Write();
947  h_ele_HoE->Write();
948  h_ele_HoE_fiducial->Write();
949  h_ele_HoEVsEta->Write();
950  h_ele_HoEVsPhi->Write();
951  h_ele_HoEVsE->Write();
952 
953  h_ele_seed_dphi2_->Write();
954  h_ele_seed_subdet2_->Write();
955  TProfile *p_ele_seed_dphi2VsEta_ = h_ele_seed_dphi2VsEta_->ProfileX();
956  p_ele_seed_dphi2VsEta_->SetTitle("mean ele seed dphi 2nd layer vs eta");
957  p_ele_seed_dphi2VsEta_->GetXaxis()->SetTitle("#eta");
958  p_ele_seed_dphi2VsEta_->GetYaxis()->SetTitle("<#phi_{pred} - #phi_{hit}, 2nd layer> (rad)");
959  p_ele_seed_dphi2VsEta_->SetMinimum(-0.004);
960  p_ele_seed_dphi2VsEta_->SetMaximum(0.004);
961  p_ele_seed_dphi2VsEta_->Write();
962  TProfile *p_ele_seed_dphi2VsPt_ = h_ele_seed_dphi2VsPt_->ProfileX();
963  p_ele_seed_dphi2VsPt_->SetTitle("mean ele seed dphi 2nd layer vs pt");
964  p_ele_seed_dphi2VsPt_->GetXaxis()->SetTitle("p_{T} (GeV/c)");
965  p_ele_seed_dphi2VsPt_->GetYaxis()->SetTitle("<#phi_{pred} - #phi_{hit}, 2nd layer> (rad)");
966  p_ele_seed_dphi2VsPt_->Write();
967  p_ele_seed_dphi2VsPt_->SetMinimum(-0.004);
968  p_ele_seed_dphi2VsPt_->SetMaximum(0.004);
969  h_ele_seed_drz2_->Write();
970  TProfile *p_ele_seed_drz2VsEta_ = h_ele_seed_drz2VsEta_->ProfileX();
971  p_ele_seed_drz2VsEta_->SetTitle("mean ele seed dr(dz) 2nd layer vs eta");
972  p_ele_seed_drz2VsEta_->GetXaxis()->SetTitle("#eta");
973  p_ele_seed_drz2VsEta_->GetYaxis()->SetTitle("<r(z)_{pred} - r(z)_{hit}, 2nd layer> (cm)");
974  p_ele_seed_drz2VsEta_->SetMinimum(-0.15);
975  p_ele_seed_drz2VsEta_->SetMaximum(0.15);
976  p_ele_seed_drz2VsEta_->Write();
977  TProfile *p_ele_seed_drz2VsPt_ = h_ele_seed_drz2VsPt_->ProfileX();
978  p_ele_seed_drz2VsPt_->SetTitle("mean ele seed dr(dz) 2nd layer vs pt");
979  p_ele_seed_drz2VsPt_->GetXaxis()->SetTitle("p_{T} (GeV/c)");
980  p_ele_seed_drz2VsPt_->GetYaxis()->SetTitle("<r(z)_{pred} - r(z)_{hit}, 2nd layer> (cm)");
981  p_ele_seed_drz2VsPt_->SetMinimum(-0.15);
982  p_ele_seed_drz2VsPt_->SetMaximum(0.15);
983  p_ele_seed_drz2VsPt_->Write();
984 
985  // classes
986  h_ele_classes->Write();
987  h_ele_eta->Write();
988  h_ele_eta_golden->Write();
989  h_ele_eta_bbrem->Write();
990  h_ele_eta_narrow->Write();
991  h_ele_eta_shower->Write();
1004 
1005  // fbrem
1006  h_ele_fbrem->Write();
1007  h_ele_fbremVsEta_mode->Write();
1008  h_ele_fbremVsEta_mean->Write();
1009  h_ele_etaEff->Write();
1010  h_ele_zEff->Write();
1011  h_ele_phiEff->Write();
1012  h_ele_absetaEff->Write();
1013  h_ele_ptEff->Write();
1014  h_ele_eta_goldenFrac->Write();
1015  h_ele_eta_bbremFrac->Write();
1016  h_ele_eta_narrowFrac->Write();
1017  h_ele_eta_showerFrac->Write();
1018  h_ele_xOverX0VsEta->Write();
1019 
1020  // e/g et pflow electrons
1021  h_ele_mva->Write();
1022  h_ele_provenance->Write();
1023 
1024  // isolation
1025  h_ele_tkSumPt_dr03->GetXaxis()->SetTitle("TkIsoSum, cone 0.3 (GeV/c)");
1026  h_ele_tkSumPt_dr03->GetYaxis()->SetTitle("Events");
1027  h_ele_tkSumPt_dr03->Write();
1028  h_ele_ecalRecHitSumEt_dr03->GetXaxis()->SetTitle("EcalIsoSum, cone 0.3 (GeV)");
1029  h_ele_ecalRecHitSumEt_dr03->GetYaxis()->SetTitle("Events");
1030  h_ele_ecalRecHitSumEt_dr03->Write();
1031  h_ele_hcalDepth1TowerSumEt_dr03->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.3 (GeV)");
1032  h_ele_hcalDepth1TowerSumEt_dr03->GetYaxis()->SetTitle("Events");
1034  h_ele_hcalDepth2TowerSumEt_dr03->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.3 (GeV)");
1035  h_ele_hcalDepth2TowerSumEt_dr03->GetYaxis()->SetTitle("Events");
1037  h_ele_tkSumPt_dr04->GetXaxis()->SetTitle("TkIsoSum, cone 0.4 (GeV/c)");
1038  h_ele_tkSumPt_dr04->GetYaxis()->SetTitle("Events");
1039  h_ele_tkSumPt_dr04->Write();
1040  h_ele_ecalRecHitSumEt_dr04->GetXaxis()->SetTitle("EcalIsoSum, cone 0.4 (GeV)");
1041  h_ele_ecalRecHitSumEt_dr04->GetYaxis()->SetTitle("Events");
1042  h_ele_ecalRecHitSumEt_dr04->Write();
1043  h_ele_hcalDepth1TowerSumEt_dr04->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.4 (GeV)");
1044  h_ele_hcalDepth1TowerSumEt_dr04->GetYaxis()->SetTitle("Events");
1046  h_ele_hcalDepth2TowerSumEt_dr04->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.4 (GeV)");
1047  h_ele_hcalDepth2TowerSumEt_dr04->GetYaxis()->SetTitle("Events");
1049 
1050 
1051 }
1052 
1053 void
1055 {
1056 
1057  std::cout << "analyzing new event " << std::endl;
1058  nEvents_++;
1059 
1060  // check event pass requested triggers if any
1061  if (!trigger(iEvent)) return;
1062 
1063  std::cout << "new event passing trigger " << std::endl;
1064  nAfterTrigger_++;
1065 
1066  // get reco electrons
1068  iEvent.getByLabel(electronCollection_,gsfElectrons);
1069  edm::LogInfo("")<<"\n\n =================> Treating event "<<iEvent.id()<<" Number of electrons "<<gsfElectrons.product()->size();
1070 
1071  // get reco supercluster collection
1073  iEvent.getByLabel(matchingObjectCollection_,recoClusters);
1074 
1075  // get the beamspot from the Event:
1076  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
1077  iEvent.getByLabel(beamSpot_, recoBeamSpotHandle);
1078  const BeamSpot bs = *recoBeamSpotHandle;
1079 
1080  histNum_->Fill((*gsfElectrons).size());
1081 
1082  // selected rec electrons
1083  for (reco::GsfElectronCollection::const_iterator gsfIter=gsfElectrons->begin();
1084  gsfIter!=gsfElectrons->end(); gsfIter++){
1085 
1086  // select electrons
1087  if (gsfIter->superCluster()->energy()/cosh(gsfIter->superCluster()->eta())<minEt_) continue;
1088  if (std::abs(gsfIter->eta())>maxAbsEta_) continue;
1089  if (gsfIter->pt()<minPt_) continue;
1090 
1091  if (gsfIter->isEB() && isEE_) continue;
1092  if (gsfIter->isEE() && isEB_) continue;
1093  if (gsfIter->isEBEEGap() && isNotEBEEGap_) continue;
1094 
1095  if (gsfIter->ecalDrivenSeed() && isTrackerDriven_) continue;
1096  if (gsfIter->trackerDrivenSeed() && isEcalDriven_) continue;
1097 
1098  if (gsfIter->isEB() && gsfIter->eSuperClusterOverP() < eOverPMinBarrel_) continue;
1099  if (gsfIter->isEB() && gsfIter->eSuperClusterOverP() > eOverPMaxBarrel_) continue;
1100  if (gsfIter->isEE() && gsfIter->eSuperClusterOverP() < eOverPMinEndcaps_) continue;
1101  if (gsfIter->isEE() && gsfIter->eSuperClusterOverP() > eOverPMaxEndcaps_) continue;
1102  if (gsfIter->isEB() && std::abs(gsfIter->deltaEtaSuperClusterTrackAtVtx()) < dEtaMinBarrel_) continue;
1103  if (gsfIter->isEB() && std::abs(gsfIter->deltaEtaSuperClusterTrackAtVtx()) > dEtaMaxBarrel_) continue;
1104  if (gsfIter->isEE() && std::abs(gsfIter->deltaEtaSuperClusterTrackAtVtx()) < dEtaMinEndcaps_) continue;
1105  if (gsfIter->isEE() && std::abs(gsfIter->deltaEtaSuperClusterTrackAtVtx()) > dEtaMaxEndcaps_) continue;
1106  if (gsfIter->isEB() && std::abs(gsfIter->deltaPhiSuperClusterTrackAtVtx()) < dPhiMinBarrel_) continue;
1107  if (gsfIter->isEB() && std::abs(gsfIter->deltaPhiSuperClusterTrackAtVtx()) > dPhiMaxBarrel_) continue;
1108  if (gsfIter->isEE() && std::abs(gsfIter->deltaPhiSuperClusterTrackAtVtx()) < dPhiMinEndcaps_) continue;
1109  if (gsfIter->isEE() && std::abs(gsfIter->deltaPhiSuperClusterTrackAtVtx()) > dPhiMaxEndcaps_) continue;
1110  if (gsfIter->isEB() && gsfIter->scSigmaIEtaIEta() < sigIetaIetaMinBarrel_) continue;
1111  if (gsfIter->isEB() && gsfIter->scSigmaIEtaIEta() > sigIetaIetaMaxBarrel_) continue;
1112  if (gsfIter->isEE() && gsfIter->scSigmaIEtaIEta() < sigIetaIetaMinEndcaps_) continue;
1113  if (gsfIter->isEE() && gsfIter->scSigmaIEtaIEta() > sigIetaIetaMaxEndcaps_) continue;
1114  if (gsfIter->isEB() && gsfIter->hadronicOverEm() > hadronicOverEmMaxBarrel_) continue;
1115  if (gsfIter->isEE() && gsfIter->hadronicOverEm() > hadronicOverEmMaxEndcaps_) continue;
1116  if (gsfIter->mva() < mvaMin_) continue;
1117 
1118  double d = (gsfIter->vertex().x()-bs.position().x())
1119  *(gsfIter->vertex().x()-bs.position().x())+
1120  (gsfIter->vertex().y()-bs.position().y())
1121  *(gsfIter->vertex().y()-bs.position().y());
1122  d = sqrt(d);
1123  if (gsfIter->isEB() && d > tipMaxBarrel_) continue;
1124  if (gsfIter->isEE() && d > tipMaxEndcaps_) continue;
1125 
1126  if (gsfIter->dr03TkSumPt() > tkIso03Max_) continue;
1127  if (gsfIter->isEB() && gsfIter->dr03HcalDepth1TowerSumEt() > hcalIso03Depth1MaxBarrel_) continue;
1128  if (gsfIter->isEE() && gsfIter->dr03HcalDepth1TowerSumEt() > hcalIso03Depth1MaxEndcaps_) continue;
1129  if (gsfIter->isEE() && gsfIter->dr03HcalDepth2TowerSumEt() > hcalIso03Depth2MaxEndcaps_) continue;
1130  if (gsfIter->isEB() && gsfIter->dr03EcalRecHitSumEt() > ecalIso03MaxBarrel_) continue;
1131  if (gsfIter->isEE() && gsfIter->dr03EcalRecHitSumEt() > ecalIso03MaxEndcaps_) continue;
1132 
1133  // electron related distributions
1134  h_ele_charge -> Fill( gsfIter->charge() );
1135  h_ele_chargeVsEta -> Fill( gsfIter->eta(),gsfIter->charge() );
1136  h_ele_chargeVsPhi -> Fill( gsfIter->phi(),gsfIter->charge() );
1137  h_ele_chargeVsPt -> Fill( gsfIter->pt(),gsfIter->charge() );
1138  h_ele_vertexP -> Fill( gsfIter->p() );
1139  h_ele_vertexPt -> Fill( gsfIter->pt() );
1140  h_ele_Et -> Fill( gsfIter->superCluster()->energy()/cosh( gsfIter->superCluster()->eta()) );
1141  h_ele_vertexPtVsEta -> Fill( gsfIter->eta(),gsfIter->pt() );
1142  h_ele_vertexPtVsPhi -> Fill( gsfIter->phi(),gsfIter->pt() );
1143  h_ele_vertexEta -> Fill( gsfIter->eta() );
1144 
1145  h_ele_vertexEtaVsPhi -> Fill( gsfIter->phi(),gsfIter->eta() );
1146  h_ele_vertexPhi -> Fill( gsfIter->phi() );
1147  h_ele_vertexX -> Fill( gsfIter->vertex().x() );
1148  h_ele_vertexY -> Fill( gsfIter->vertex().y() );
1149  h_ele_vertexZ -> Fill( gsfIter->vertex().z() );
1150  h_ele_vertexTIP -> Fill( d );
1151  h_ele_vertexTIPVsEta -> Fill( gsfIter->eta(), d );
1152  h_ele_vertexTIPVsPhi -> Fill( gsfIter->phi(), d );
1153  h_ele_vertexTIPVsPt -> Fill( gsfIter->pt(), d );
1154 
1155  // supercluster related distributions
1156  reco::SuperClusterRef sclRef = gsfIter->superCluster();
1157  if (!gsfIter->ecalDrivenSeed()&&gsfIter->trackerDrivenSeed()) sclRef = gsfIter->parentSuperCluster();
1158  histSclEn_->Fill(sclRef->energy());
1159  double R=TMath::Sqrt(sclRef->x()*sclRef->x() + sclRef->y()*sclRef->y() +sclRef->z()*sclRef->z());
1160  double Rt=TMath::Sqrt(sclRef->x()*sclRef->x() + sclRef->y()*sclRef->y());
1161  histSclEt_->Fill(sclRef->energy()*(Rt/R));
1162  histSclEtVsEta_->Fill(sclRef->eta(),sclRef->energy()*(Rt/R));
1163  histSclEtVsPhi_->Fill(sclRef->phi(),sclRef->energy()*(Rt/R));
1164  histSclEta_->Fill(sclRef->eta());
1165  histSclEtaVsPhi_->Fill(sclRef->phi(),sclRef->eta());
1166  histSclPhi_->Fill(sclRef->phi());
1167  histSclSigEtaEta_->Fill(gsfIter->scSigmaEtaEta());
1168  if (gsfIter->isEB()) histSclSigIEtaIEta_barrel_->Fill(gsfIter->scSigmaIEtaIEta());
1169  if (gsfIter->isEE()) histSclSigIEtaIEta_endcaps_->Fill(gsfIter->scSigmaIEtaIEta());
1170  histSclE1x5_->Fill(gsfIter->scE1x5());
1171  if (gsfIter->isEB()) histSclE1x5_barrel_->Fill(gsfIter->scE1x5());
1172  if (gsfIter->isEE()) histSclE1x5_endcaps_->Fill(gsfIter->scE1x5());
1173  histSclE2x5max_->Fill(gsfIter->scE2x5Max());
1174  if (gsfIter->isEB()) histSclE2x5max_barrel_->Fill(gsfIter->scE2x5Max());
1175  if (gsfIter->isEE()) histSclE2x5max_endcaps_->Fill(gsfIter->scE2x5Max());
1176  histSclE5x5_->Fill(gsfIter->scE5x5());
1177  if (gsfIter->isEB()) histSclE5x5_barrel_->Fill(gsfIter->scE5x5());
1178  if (gsfIter->isEE()) histSclE5x5_endcaps_->Fill(gsfIter->scE5x5());
1179 
1180  // track related distributions
1181  h_ele_ambiguousTracks -> Fill( gsfIter->ambiguousGsfTracksSize() );
1182  h_ele_ambiguousTracksVsEta -> Fill( gsfIter->eta(), gsfIter->ambiguousGsfTracksSize() );
1183  h_ele_ambiguousTracksVsPhi -> Fill( gsfIter->phi(), gsfIter->ambiguousGsfTracksSize() );
1184  h_ele_ambiguousTracksVsPt -> Fill( gsfIter->pt(), gsfIter->ambiguousGsfTracksSize() );
1185  if (!readAOD_) { // track extra does not exist in AOD
1186  h_ele_foundHits -> Fill( gsfIter->gsfTrack()->numberOfValidHits() );
1187  h_ele_foundHitsVsEta -> Fill( gsfIter->eta(), gsfIter->gsfTrack()->numberOfValidHits() );
1188  h_ele_foundHitsVsPhi -> Fill( gsfIter->phi(), gsfIter->gsfTrack()->numberOfValidHits() );
1189  h_ele_foundHitsVsPt -> Fill( gsfIter->pt(), gsfIter->gsfTrack()->numberOfValidHits() );
1190  h_ele_lostHits -> Fill( gsfIter->gsfTrack()->numberOfLostHits() );
1191  h_ele_lostHitsVsEta -> Fill( gsfIter->eta(), gsfIter->gsfTrack()->numberOfLostHits() );
1192  h_ele_lostHitsVsPhi -> Fill( gsfIter->phi(), gsfIter->gsfTrack()->numberOfLostHits() );
1193  h_ele_lostHitsVsPt -> Fill( gsfIter->pt(), gsfIter->gsfTrack()->numberOfLostHits() );
1194  h_ele_chi2 -> Fill( gsfIter->gsfTrack()->normalizedChi2() );
1195  h_ele_chi2VsEta -> Fill( gsfIter->eta(), gsfIter->gsfTrack()->normalizedChi2() );
1196  h_ele_chi2VsPhi -> Fill( gsfIter->phi(), gsfIter->gsfTrack()->normalizedChi2() );
1197  h_ele_chi2VsPt -> Fill( gsfIter->pt(), gsfIter->gsfTrack()->normalizedChi2() );
1198  }
1199  // from gsf track interface, hence using mean
1200  if (!readAOD_) { // track extra does not exist in AOD
1201  h_ele_PinMnPout -> Fill( gsfIter->gsfTrack()->innerMomentum().R() - gsfIter->gsfTrack()->outerMomentum().R() );
1202  h_ele_outerP -> Fill( gsfIter->gsfTrack()->outerMomentum().R() );
1203  h_ele_outerPt -> Fill( gsfIter->gsfTrack()->outerMomentum().Rho() );
1204  }
1205  // from electron interface, hence using mode
1206  h_ele_PinMnPout_mode -> Fill( gsfIter->trackMomentumAtVtx().R() - gsfIter->trackMomentumOut().R() );
1207  h_ele_PinMnPoutVsEta_mode -> Fill( gsfIter->eta(), gsfIter->trackMomentumAtVtx().R() - gsfIter->trackMomentumOut().R() );
1208  h_ele_PinMnPoutVsPhi_mode -> Fill( gsfIter->phi(), gsfIter->trackMomentumAtVtx().R() - gsfIter->trackMomentumOut().R() );
1209  h_ele_PinMnPoutVsPt_mode -> Fill( gsfIter->pt(), gsfIter->trackMomentumAtVtx().R() - gsfIter->trackMomentumOut().R() );
1210  h_ele_PinMnPoutVsE_mode -> Fill( gsfIter->caloEnergy(), gsfIter->trackMomentumAtVtx().R() - gsfIter->trackMomentumOut().R() );
1211  if (!readAOD_) // track extra does not exist in AOD
1212  h_ele_PinMnPoutVsChi2_mode -> Fill( gsfIter->gsfTrack()->normalizedChi2(), gsfIter->trackMomentumAtVtx().R() - gsfIter->trackMomentumOut().R() );
1213  h_ele_outerP_mode -> Fill( gsfIter->trackMomentumOut().R() );
1214  h_ele_outerPVsEta_mode -> Fill(gsfIter->eta(), gsfIter->trackMomentumOut().R() );
1215  h_ele_outerPt_mode -> Fill( gsfIter->trackMomentumOut().Rho() );
1216  h_ele_outerPtVsEta_mode -> Fill(gsfIter->eta(), gsfIter->trackMomentumOut().Rho() );
1217  h_ele_outerPtVsPhi_mode -> Fill(gsfIter->phi(), gsfIter->trackMomentumOut().Rho() );
1218  h_ele_outerPtVsPt_mode -> Fill(gsfIter->pt(), gsfIter->trackMomentumOut().Rho() );
1219 
1220  if (!readAOD_) { // track extra does not exist in AOD
1221  edm::RefToBase<TrajectorySeed> seed = gsfIter->gsfTrack()->extra()->seedRef();
1222  ElectronSeedRef elseed=seed.castTo<ElectronSeedRef>();
1223  h_ele_seed_dphi2_-> Fill(elseed->dPhi2());
1224  h_ele_seed_dphi2VsEta_-> Fill(gsfIter->eta(), elseed->dPhi2());
1225  h_ele_seed_dphi2VsPt_-> Fill(gsfIter->pt(), elseed->dPhi2()) ;
1226  h_ele_seed_drz2_-> Fill(elseed->dRz2());
1227  h_ele_seed_drz2VsEta_-> Fill(gsfIter->eta(), elseed->dRz2());
1228  h_ele_seed_drz2VsPt_-> Fill(gsfIter->pt(), elseed->dRz2());
1229  h_ele_seed_subdet2_-> Fill(elseed->subDet2());
1230  }
1231  // match distributions
1232  h_ele_EoP -> Fill( gsfIter->eSuperClusterOverP() );
1233  h_ele_EoPVsEta -> Fill(gsfIter->eta(), gsfIter->eSuperClusterOverP() );
1234  h_ele_EoPVsPhi -> Fill(gsfIter->phi(), gsfIter->eSuperClusterOverP() );
1235  h_ele_EoPVsE -> Fill(gsfIter->caloEnergy(), gsfIter->eSuperClusterOverP() );
1236  h_ele_EseedOP -> Fill( gsfIter->eSeedClusterOverP() );
1237  h_ele_EseedOPVsEta -> Fill(gsfIter->eta(), gsfIter->eSeedClusterOverP() );
1238  h_ele_EseedOPVsPhi -> Fill(gsfIter->phi(), gsfIter->eSeedClusterOverP() );
1239  h_ele_EseedOPVsE -> Fill(gsfIter->caloEnergy(), gsfIter->eSeedClusterOverP() );
1240  h_ele_EoPout -> Fill( gsfIter->eSeedClusterOverPout() );
1241  h_ele_EoPoutVsEta -> Fill( gsfIter->eta(), gsfIter->eSeedClusterOverPout() );
1242  h_ele_EoPoutVsPhi -> Fill( gsfIter->phi(), gsfIter->eSeedClusterOverPout() );
1243  h_ele_EoPoutVsE -> Fill( gsfIter->caloEnergy(), gsfIter->eSeedClusterOverPout() );
1244  h_ele_EeleOPout -> Fill( gsfIter->eEleClusterOverPout() );
1245  h_ele_EeleOPoutVsEta -> Fill( gsfIter->eta(), gsfIter->eEleClusterOverPout() );
1246  h_ele_EeleOPoutVsPhi -> Fill( gsfIter->phi(), gsfIter->eEleClusterOverPout() );
1247  h_ele_EeleOPoutVsE -> Fill( gsfIter->caloEnergy(), gsfIter->eEleClusterOverPout() );
1248  h_ele_dEtaSc_propVtx -> Fill(gsfIter->deltaEtaSuperClusterTrackAtVtx());
1249  h_ele_dEtaScVsEta_propVtx -> Fill( gsfIter->eta(),gsfIter->deltaEtaSuperClusterTrackAtVtx());
1250  h_ele_dEtaScVsPhi_propVtx -> Fill(gsfIter->phi(),gsfIter->deltaEtaSuperClusterTrackAtVtx());
1251  h_ele_dEtaScVsPt_propVtx -> Fill(gsfIter->pt(),gsfIter->deltaEtaSuperClusterTrackAtVtx());
1252  h_ele_dPhiSc_propVtx -> Fill(gsfIter->deltaPhiSuperClusterTrackAtVtx());
1253  h_ele_dPhiScVsEta_propVtx -> Fill( gsfIter->eta(),gsfIter->deltaPhiSuperClusterTrackAtVtx());
1254  h_ele_dPhiScVsPhi_propVtx -> Fill(gsfIter->phi(),gsfIter->deltaPhiSuperClusterTrackAtVtx());
1255  h_ele_dPhiScVsPt_propVtx -> Fill(gsfIter->pt(),gsfIter->deltaPhiSuperClusterTrackAtVtx());
1256  h_ele_dEtaCl_propOut -> Fill(gsfIter->deltaEtaSeedClusterTrackAtCalo());
1257  h_ele_dEtaClVsEta_propOut -> Fill( gsfIter->eta(),gsfIter->deltaEtaSeedClusterTrackAtCalo());
1258  h_ele_dEtaClVsPhi_propOut -> Fill(gsfIter->phi(),gsfIter->deltaEtaSeedClusterTrackAtCalo());
1259  h_ele_dEtaClVsPt_propOut -> Fill(gsfIter->pt(),gsfIter->deltaEtaSeedClusterTrackAtCalo());
1260  h_ele_dPhiCl_propOut -> Fill(gsfIter->deltaPhiSeedClusterTrackAtCalo());
1261  h_ele_dPhiClVsEta_propOut -> Fill( gsfIter->eta(),gsfIter->deltaPhiSeedClusterTrackAtCalo());
1262  h_ele_dPhiClVsPhi_propOut -> Fill(gsfIter->phi(),gsfIter->deltaPhiSeedClusterTrackAtCalo());
1263  h_ele_dPhiClVsPt_propOut -> Fill(gsfIter->pt(),gsfIter->deltaPhiSeedClusterTrackAtCalo());
1264  h_ele_dEtaEleCl_propOut -> Fill(gsfIter->deltaEtaEleClusterTrackAtCalo());
1265  h_ele_dEtaEleClVsEta_propOut -> Fill( gsfIter->eta(),gsfIter->deltaEtaEleClusterTrackAtCalo());
1266  h_ele_dEtaEleClVsPhi_propOut -> Fill(gsfIter->phi(),gsfIter->deltaEtaEleClusterTrackAtCalo());
1267  h_ele_dEtaEleClVsPt_propOut -> Fill(gsfIter->pt(),gsfIter->deltaEtaEleClusterTrackAtCalo());
1268  h_ele_dPhiEleCl_propOut -> Fill(gsfIter->deltaPhiEleClusterTrackAtCalo());
1269  h_ele_dPhiEleClVsEta_propOut -> Fill( gsfIter->eta(),gsfIter->deltaPhiEleClusterTrackAtCalo());
1270  h_ele_dPhiEleClVsPhi_propOut -> Fill(gsfIter->phi(),gsfIter->deltaPhiEleClusterTrackAtCalo());
1271  h_ele_dPhiEleClVsPt_propOut -> Fill(gsfIter->pt(),gsfIter->deltaPhiEleClusterTrackAtCalo());
1272  h_ele_HoE -> Fill(gsfIter->hadronicOverEm());
1273  if (!gsfIter->isEBEtaGap() && !gsfIter->isEBPhiGap()&& !gsfIter->isEBEEGap() &&
1274  !gsfIter->isEERingGap() && !gsfIter->isEEDeeGap()) h_ele_HoE_fiducial -> Fill(gsfIter->hadronicOverEm());
1275  h_ele_HoEVsEta -> Fill( gsfIter->eta(),gsfIter->hadronicOverEm());
1276  h_ele_HoEVsPhi -> Fill(gsfIter->phi(),gsfIter->hadronicOverEm());
1277  h_ele_HoEVsE -> Fill(gsfIter->caloEnergy(),gsfIter->hadronicOverEm());
1278 
1279  //classes
1280  int eleClass = gsfIter->classification();
1281  if (gsfIter->isEE()) eleClass+=10;
1282  h_ele_classes ->Fill(eleClass);
1283 
1284  h_ele_eta->Fill(std::abs(gsfIter->eta()));
1285  if (gsfIter->classification() == GsfElectron::GOLDEN) h_ele_eta_golden ->Fill(std::abs(gsfIter->eta()));
1286  if (gsfIter->classification() == GsfElectron::BIGBREM) h_ele_eta_bbrem ->Fill(std::abs(gsfIter->eta()));
1287  //if (gsfIter->classification() == GsfElectron::OLDNARROW) h_ele_eta_narrow ->Fill(std::abs(gsfIter->eta()));
1288  if (gsfIter->classification() == GsfElectron::SHOWERING) h_ele_eta_shower ->Fill(std::abs(gsfIter->eta()));
1289 
1290  //fbrem
1291  double fbrem_mean=0.;
1292  if (!readAOD_) // track extra does not exist in AOD
1293  fbrem_mean = 1. - gsfIter->gsfTrack()->outerMomentum().R()/gsfIter->gsfTrack()->innerMomentum().R();
1294  double fbrem_mode = gsfIter->fbrem();
1295  h_ele_fbrem->Fill(fbrem_mode);
1296  h_ele_fbremVsEta_mode->Fill(gsfIter->eta(),fbrem_mode);
1297  if (!readAOD_) // track extra does not exist in AOD
1298  h_ele_fbremVsEta_mean->Fill(gsfIter->eta(),fbrem_mean);
1299 
1300  if (gsfIter->classification() == GsfElectron::GOLDEN) h_ele_PinVsPoutGolden_mode -> Fill(gsfIter->trackMomentumOut().R(), gsfIter->trackMomentumAtVtx().R());
1301  if (gsfIter->classification() == GsfElectron::SHOWERING)
1302  h_ele_PinVsPoutShowering_mode -> Fill(gsfIter->trackMomentumOut().R(), gsfIter->trackMomentumAtVtx().R());
1303  if (!readAOD_) // track extra does not exist in AOD
1304  if (gsfIter->classification() == GsfElectron::GOLDEN) h_ele_PinVsPoutGolden_mean -> Fill(gsfIter->gsfTrack()->outerMomentum().R(), gsfIter->gsfTrack()->innerMomentum().R());
1305  if (!readAOD_) // track extra does not exist in AOD
1306  if (gsfIter->classification() == GsfElectron::SHOWERING)
1307  h_ele_PinVsPoutShowering_mean -> Fill(gsfIter->gsfTrack()->outerMomentum().R(), gsfIter->gsfTrack()->innerMomentum().R());
1308  if (gsfIter->classification() == GsfElectron::GOLDEN) h_ele_PtinVsPtoutGolden_mode -> Fill(gsfIter->trackMomentumOut().Rho(), gsfIter->trackMomentumAtVtx().Rho());
1309  if (gsfIter->classification() == GsfElectron::SHOWERING)
1310  h_ele_PtinVsPtoutShowering_mode -> Fill(gsfIter->trackMomentumOut().Rho(), gsfIter->trackMomentumAtVtx().Rho());
1311  if (!readAOD_) // track extra does not exist in AOD
1312  if (gsfIter->classification() == GsfElectron::GOLDEN) h_ele_PtinVsPtoutGolden_mean -> Fill(gsfIter->gsfTrack()->outerMomentum().Rho(), gsfIter->gsfTrack()->innerMomentum().Rho());
1313  if (!readAOD_) // track extra does not exist in AOD
1314  if (gsfIter->classification() == GsfElectron::SHOWERING)
1315  h_ele_PtinVsPtoutShowering_mean -> Fill(gsfIter->gsfTrack()->outerMomentum().Rho(), gsfIter->gsfTrack()->innerMomentum().Rho());
1316 
1317  h_ele_mva->Fill(gsfIter->mva());
1318  if (gsfIter->ecalDrivenSeed()) h_ele_provenance->Fill(1.);
1319  if (gsfIter->trackerDrivenSeed()) h_ele_provenance->Fill(-1.);
1320  if (gsfIter->trackerDrivenSeed()||gsfIter->ecalDrivenSeed()) h_ele_provenance->Fill(0.);
1321  if (gsfIter->trackerDrivenSeed()&&!gsfIter->ecalDrivenSeed()) h_ele_provenance->Fill(-2.);
1322  if (!gsfIter->trackerDrivenSeed()&&gsfIter->ecalDrivenSeed()) h_ele_provenance->Fill(2.);
1323 
1324  h_ele_tkSumPt_dr03->Fill(gsfIter->dr03TkSumPt());
1325  h_ele_ecalRecHitSumEt_dr03->Fill(gsfIter->dr03EcalRecHitSumEt());
1326  h_ele_hcalDepth1TowerSumEt_dr03->Fill(gsfIter->dr03HcalDepth1TowerSumEt());
1327  h_ele_hcalDepth2TowerSumEt_dr03->Fill(gsfIter->dr03HcalDepth2TowerSumEt());
1328  h_ele_tkSumPt_dr04->Fill(gsfIter->dr04TkSumPt());
1329  h_ele_ecalRecHitSumEt_dr04->Fill(gsfIter->dr04EcalRecHitSumEt());
1330  h_ele_hcalDepth1TowerSumEt_dr04->Fill(gsfIter->dr04HcalDepth1TowerSumEt());
1331  h_ele_hcalDepth2TowerSumEt_dr04->Fill(gsfIter->dr04HcalDepth2TowerSumEt());
1332 
1333  float enrj1=gsfIter->superCluster()->energy();
1334  // mee
1335  for (reco::GsfElectronCollection::const_iterator gsfIter2=gsfIter+1;
1336  gsfIter2!=gsfElectrons->end(); gsfIter2++){
1337 
1338  math::XYZTLorentzVector p12 = (*gsfIter).p4()+(*gsfIter2).p4();
1339  float mee2 = p12.Dot(p12);
1340  float enrj2=gsfIter2->superCluster()->energy();
1341  h_ele_mee_all -> Fill(sqrt(mee2));
1342  h_ele_E2mnE1vsMee_all->Fill(sqrt(mee2),enrj2-enrj1);
1343  if (gsfIter->ecalDrivenSeed() && gsfIter2->ecalDrivenSeed()) h_ele_E2mnE1vsMee_egeg_all->Fill(sqrt(mee2),enrj2-enrj1);
1344  if (gsfIter->charge()*gsfIter2->charge()<0.) {
1345  h_ele_mee_os -> Fill(sqrt(mee2));
1346  if (gsfIter->isEB() && gsfIter2->isEB()) h_ele_mee_os_ebeb -> Fill(sqrt(mee2));
1347  if ((gsfIter->isEB() && gsfIter2->isEE()) || (gsfIter->isEE() && gsfIter2->isEB())) h_ele_mee_os_ebee -> Fill(sqrt(mee2));
1348  if (gsfIter->isEE() && gsfIter2->isEE()) h_ele_mee_os_eeee -> Fill(sqrt(mee2));
1349  if ((gsfIter->classification()==GsfElectron::GOLDEN && gsfIter2->classification()==GsfElectron::GOLDEN) ||
1350  (gsfIter->classification()==GsfElectron::GOLDEN && gsfIter2->classification()==GsfElectron::BIGBREM) ||
1351  //(gsfIter->classification()==GsfElectron::GOLDEN && gsfIter2->classification()==GsfElectron::OLDNARROW) ||
1352  (gsfIter->classification()==GsfElectron::BIGBREM && gsfIter2->classification()==GsfElectron::GOLDEN) ||
1353  (gsfIter->classification()==GsfElectron::BIGBREM && gsfIter2->classification()==GsfElectron::BIGBREM)/* ||
1354  (gsfIter->classification()==GsfElectron::BIGBREM && gsfIter2->classification()==GsfElectron::OLDNARROW) ||
1355  (gsfIter->classification()==GsfElectron::OLDNARROW && gsfIter2->classification()==GsfElectron::GOLDEN) ||
1356  (gsfIter->classification()==GsfElectron::OLDNARROW && gsfIter2->classification()==GsfElectron::BIGBREM) ||
1357  (gsfIter->classification()==GsfElectron::OLDNARROW && gsfIter2->classification()==GsfElectron::OLDNARROW)*/)
1358  { h_ele_mee_os_gg -> Fill(sqrt(mee2));}
1359  else if (
1360  (gsfIter->classification()==GsfElectron::SHOWERING && gsfIter2->classification()==GsfElectron::SHOWERING) ||
1361  (gsfIter->classification()==GsfElectron::SHOWERING && gsfIter2->isGap()) ||
1362  (gsfIter->isGap() && gsfIter2->classification()==GsfElectron::SHOWERING) ||
1363  (gsfIter->isGap() && gsfIter2->isGap()))
1364  { h_ele_mee_os_bb -> Fill(sqrt(mee2));}
1365  else
1366  { h_ele_mee_os_gb -> Fill(sqrt(mee2));}
1367  }
1368 
1369  }
1370 
1371  }
1372 
1373  // association matching object-reco electrons
1374  int matchingObjectNum=0;
1375 
1376  for ( reco::SuperClusterCollection::const_iterator moIter=recoClusters->begin();
1377  moIter!=recoClusters->end(); moIter++ ) {
1378 
1379  // number of matching objects
1380  matchingObjectNum++;
1381 
1382  if (moIter->energy()/cosh(moIter->eta())> maxPtMatchingObject_ || std::abs(moIter->eta())> maxAbsEtaMatchingObject_) continue;
1383 
1384  // suppress the endcaps
1385  //if (std::abs(moIter->eta()) > 1.5) continue;
1386  // select central z
1387  //if ( std::abs((*mcIter)->production_vertex()->position().z())>50.) continue;
1388 
1389  h_matchingObjectEta -> Fill( moIter->eta() );
1390  h_matchingObjectAbsEta -> Fill( std::abs(moIter->eta()) );
1391  h_matchingObjectP -> Fill( moIter->energy() );
1392  h_matchingObjectPt -> Fill( moIter->energy()/cosh(moIter->eta()) );
1393  h_matchingObjectPhi -> Fill( moIter->phi() );
1394  h_matchingObjectZ -> Fill( moIter->z() );
1395 
1396  // looking for the best matching gsf electron
1397  bool okGsfFound = false;
1398  double gsfOkRatio = 999999.;
1399 
1400  // find matching electron
1401  reco::GsfElectron bestGsfElectron;
1402  for (reco::GsfElectronCollection::const_iterator gsfIter=gsfElectrons->begin();
1403  gsfIter!=gsfElectrons->end(); gsfIter++){
1404 
1405  // matching with a cone in eta phi
1406  if (matchingCondition_ == "Cone") {
1407  double dphi = gsfIter->phi()-moIter->phi();
1408  if (std::abs(dphi)>CLHEP::pi)
1409  dphi = dphi < 0? (CLHEP::twopi) + dphi : dphi - CLHEP::twopi;
1410  double deltaR = sqrt(std::pow((moIter->eta()-gsfIter->eta()),2) + std::pow(dphi,2));
1411  if ( deltaR < deltaR_ ){
1412  //if ( (genPc->pdg_id() == 11) && (gsfIter->charge() < 0.) || (genPc->pdg_id() == -11) &&
1413  //(gsfIter->charge() > 0.) ){
1414  double tmpGsfRatio = gsfIter->p()/moIter->energy();
1415  if ( std::abs(tmpGsfRatio-1) < std::abs(gsfOkRatio-1) ) {
1416  gsfOkRatio = tmpGsfRatio;
1417  bestGsfElectron=*gsfIter;
1418  okGsfFound = true;
1419  }
1420  //}
1421  }
1422  }
1423  } // loop over rec ele to look for the best one
1424 
1425  // analysis when the matching object is matched by a rec electron
1426  if (okGsfFound){
1427 
1428  // generated distributions for matched electrons
1429  h_ele_matchingObjectPt_matched -> Fill( moIter->energy()/cosh(moIter->eta()) );
1430  h_ele_matchingObjectPhi_matched -> Fill( moIter->phi() );
1431  h_ele_matchingObjectAbsEta_matched -> Fill( std::abs(moIter->eta()) );
1432  h_ele_matchingObjectEta_matched -> Fill( moIter->eta() );
1433  h_ele_matchingObjectZ_matched -> Fill( moIter->z() );
1434 
1435  // comparison electron vs matching object
1436  h_ele_EtaMnEtamatchingObject_matched -> Fill( bestGsfElectron.eta()-moIter->eta());
1437  h_ele_EtaMnEtamatchingObjectVsEta_matched -> Fill( bestGsfElectron.eta(), bestGsfElectron.eta()-moIter->eta());
1438  h_ele_EtaMnEtamatchingObjectVsPhi_matched -> Fill( bestGsfElectron.phi(), bestGsfElectron.eta()-moIter->eta());
1439  h_ele_EtaMnEtamatchingObjectVsPt_matched -> Fill( bestGsfElectron.pt(), bestGsfElectron.eta()-moIter->eta());
1440  h_ele_PhiMnPhimatchingObject_matched -> Fill( bestGsfElectron.phi()-moIter->phi());
1441  h_ele_PhiMnPhimatchingObject2_matched -> Fill( bestGsfElectron.phi()-moIter->phi());
1442  h_ele_PhiMnPhimatchingObjectVsEta_matched -> Fill( bestGsfElectron.eta(), bestGsfElectron.phi()-moIter->phi());
1443  h_ele_PhiMnPhimatchingObjectVsPhi_matched -> Fill( bestGsfElectron.phi(), bestGsfElectron.phi()-moIter->phi());
1444  h_ele_PhiMnPhimatchingObjectVsPt_matched -> Fill( bestGsfElectron.pt(), bestGsfElectron.phi()-moIter->phi());
1445  h_ele_PoPmatchingObject_matched -> Fill( bestGsfElectron.p()/moIter->energy());
1446  h_ele_PtoPtmatchingObject_matched -> Fill( bestGsfElectron.pt()/moIter->energy()/cosh(moIter->eta()));
1447  h_ele_PoPmatchingObjectVsEta_matched -> Fill( bestGsfElectron.eta(), bestGsfElectron.p()/moIter->energy());
1448  h_ele_PoPmatchingObjectVsPhi_matched -> Fill( bestGsfElectron.phi(), bestGsfElectron.p()/moIter->energy());
1449  h_ele_PoPmatchingObjectVsPt_matched -> Fill( bestGsfElectron.py(), bestGsfElectron.p()/moIter->energy());
1450  if (bestGsfElectron.isEB()) h_ele_PoPmatchingObject_barrel_matched -> Fill( bestGsfElectron.p()/moIter->energy());
1451  if (bestGsfElectron.isEE()) h_ele_PoPmatchingObject_endcaps_matched -> Fill( bestGsfElectron.p()/moIter->energy());
1452  if (bestGsfElectron.isEB()) h_ele_PtoPtmatchingObject_barrel_matched -> Fill( bestGsfElectron.pt()/moIter->energy()/cosh(moIter->eta()));
1453  if (bestGsfElectron.isEE()) h_ele_PtoPtmatchingObject_endcaps_matched -> Fill( bestGsfElectron.pt()/moIter->energy()/cosh(moIter->eta()));
1454 
1455  reco::SuperClusterRef sclRef = bestGsfElectron.superCluster();
1456  if (bestGsfElectron.isEB()) histSclEoEmatchingObject_barrel_matched->Fill(sclRef->energy()/moIter->energy());
1457  if (bestGsfElectron.isEE()) histSclEoEmatchingObject_endcaps_matched->Fill(sclRef->energy()/moIter->energy());
1458  if (bestGsfElectron.isEB()) histSclEoEmatchingObject_barrel_new_matched->Fill(sclRef->energy()/moIter->energy());
1459  if (bestGsfElectron.isEE()) histSclEoEmatchingObject_endcaps_new_matched->Fill(sclRef->energy()/moIter->energy());
1460 
1461  // add here distributions for matched electrons as for all electrons
1462  //..
1463 
1464  } // gsf electron found
1465 
1466  } // loop overmatching object
1467 
1468  h_matchingObjectNum->Fill(matchingObjectNum);
1469 
1470 }
1471 
1473 {
1474 
1475  // retreive TriggerResults from the event
1477  e.getByLabel(triggerResults_,triggerResults);
1478 
1479  bool accept = false;
1480 
1481  if (triggerResults.isValid()) {
1482  //std::cout << "TriggerResults found, number of HLT paths: " << triggerResults->size() << std::endl;
1483 
1484  // get trigger names
1485  const edm::TriggerNames & triggerNames = e.triggerNames(*triggerResults);
1486  if (nEvents_==1) {
1487  for (unsigned int i=0; i<triggerNames.size(); i++) {
1488  std::cout << "trigger path= " << triggerNames.triggerName(i) << std::endl;
1489  }
1490  }
1491 
1492  unsigned int n = HLTPathsByName_.size();
1493  for (unsigned int i=0; i!=n; i++) {
1495  }
1496 
1497  // empty input vectors (n==0) means any trigger paths
1498  if (n==0) {
1499  n=triggerResults->size();
1500  HLTPathsByName_.resize(n);
1501  HLTPathsByIndex_.resize(n);
1502  for (unsigned int i=0; i!=n; i++) {
1503  HLTPathsByName_[i]=triggerNames.triggerName(i);
1504  HLTPathsByIndex_[i]=i;
1505  }
1506  }
1507 
1508  if (nEvents_==1){
1509  if (n>0) {
1510  std::cout << "HLT trigger paths requested: index, name and valididty:" << std::endl;
1511  for (unsigned int i=0; i!=n; i++) {
1512  bool validity = HLTPathsByIndex_[i]<triggerResults->size();
1513  std::cout << " " << HLTPathsByIndex_[i]
1514  << " " << HLTPathsByName_[i]
1515  << " " << validity << std::endl;
1516  }
1517  }
1518  }
1519 
1520  // count number of requested HLT paths which have fired
1521  unsigned int fired=0;
1522  for (unsigned int i=0; i!=n; i++) {
1523  if (HLTPathsByIndex_[i]<triggerResults->size()) {
1524  if (triggerResults->accept(HLTPathsByIndex_[i])) {
1525  fired++;
1526  std::cout << "Fired HLT path= " << HLTPathsByName_[i] << std::endl;
1527  accept = true;
1528  }
1529  }
1530  }
1531 
1532  }
1533 
1534  return accept;
1535 
1536 }
1537 
1538 
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
Definition: Event.cc:204
std::vector< unsigned int > HLTPathsByIndex_
virtual double p() const GCC11_FINAL
magnitude of momentum vector
Strings::size_type size() const
Definition: TriggerNames.cc:39
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:26
uint16_t size_type
virtual double py() const GCC11_FINAL
y coordinate of momentum vector
bool isEE() const
Definition: GsfElectron.h:348
bool isEB() const
Definition: GsfElectron.h:347
const Double_t pi
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
virtual float phi() const GCC11_FINAL
momentum azimuthal angle
int iEvent
Definition: GenABIO.cc:230
unsigned int triggerIndex(std::string const &name) const
Definition: TriggerNames.cc:32
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
T sqrt(T t)
Definition: SSEVec.h:48
virtual SuperClusterRef superCluster() const
reference to a SuperCluster
Definition: GsfElectron.h:182
GsfElectronDataAnalyzer(const edm::ParameterSet &conf)
bool trigger(const edm::Event &e)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static std::string const triggerResults
Definition: EdmProvDump.cc:41
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
tuple conf
Definition: dbtoconf.py:185
virtual float eta() const GCC11_FINAL
momentum pseudorapidity
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
std::string const & triggerName(unsigned int index) const
Definition: TriggerNames.cc:27
REF castTo() const
cast to a concrete type
Definition: RefToBase.h:241
T const * product() const
Definition: Handle.h:81
std::string const & label() const
Definition: InputTag.h:42
edm::EventID id() const
Definition: EventBase.h:56
tuple cout
Definition: gather_cfg.py:121
const Point & position() const
position
Definition: BeamSpot.h:62
virtual void analyze(const edm::Event &e, const edm::EventSetup &c)
virtual float pt() const GCC11_FINAL
transverse momentum
std::vector< std::string > HLTPathsByName_
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40