CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/RecoEgamma/Examples/plugins/GsfElectronDataAnalyzer.cc

Go to the documentation of this file.
00001 
00002 // -*- C++ -*-
00003 //
00004 // Package:    RecoEgamma/Examples
00005 // Class:      GsfElectronDataAnalyzer
00006 //
00014 //
00015 // Original Author:  Ursula Berthon
00016 //         Created:  Mon Mar 27 13:22:06 CEST 2006
00017 // $Id: GsfElectronDataAnalyzer.cc,v 1.40 2011/03/04 14:43:15 chamont Exp $
00018 //
00019 //
00020 
00021 // user include files
00022 #include "RecoEgamma/Examples/plugins/GsfElectronDataAnalyzer.h"
00023 
00024 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00025 #include "FWCore/Framework/interface/EDAnalyzer.h"
00026 #include "FWCore/Framework/interface/Event.h"
00027 #include "FWCore/Framework/interface/MakerMacros.h"
00028 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00029 #include "FWCore/Common/interface/TriggerNames.h"
00030 
00031 #include "DataFormats/GsfTrackReco/interface/GsfTrack.h"
00032 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
00033 #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
00034 #include "DataFormats/EgammaReco/interface/BasicClusterFwd.h"
00035 #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"
00036 #include "DataFormats/EgammaReco/interface/ElectronSeed.h"
00037 #include "DataFormats/EgammaReco/interface/ElectronSeedFwd.h"
00038 #include "DataFormats/JetReco/interface/CaloJetCollection.h"
00039 #include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
00040 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
00041 #include "DataFormats/Common/interface/TriggerResults.h"
00042 
00043 #include "HLTrigger/HLTfilters/interface/HLTHighLevel.h"
00044 
00045 #include "CLHEP/Units/GlobalPhysicalConstants.h"
00046 #include <iostream>
00047 #include "TMath.h"
00048 #include "TFile.h"
00049 #include "TH1F.h"
00050 #include "TH1I.h"
00051 #include "TH2F.h"
00052 #include "TProfile.h"
00053 #include "TTree.h"
00054 #include <iostream>
00055 
00056 using namespace reco;
00057 
00058 GsfElectronDataAnalyzer::GsfElectronDataAnalyzer(const edm::ParameterSet& conf)
00059 {
00060 
00061   outputFile_ = conf.getParameter<std::string>("outputFile");
00062   histfile_ = new TFile(outputFile_.c_str(),"RECREATE");
00063   electronCollection_=conf.getParameter<edm::InputTag>("electronCollection");
00064   readAOD_ = conf.getParameter<bool>("readAOD");
00065 
00066   matchingObjectCollection_ = conf.getParameter<edm::InputTag>("matchingObjectCollection");
00067   matchingCondition_ = conf.getParameter<std::string>("matchingCondition");
00068   // currently only one possible matching conditions
00069   assert (matchingCondition_ == "Cone");
00070   maxPtMatchingObject_ = conf.getParameter<double>("MaxPtMatchingObject");
00071   maxAbsEtaMatchingObject_ = conf.getParameter<double>("MaxAbsEtaMatchingObject");
00072   deltaR_ = conf.getParameter<double>("DeltaR");
00073 
00074   triggerResults_ = conf.getParameter<edm::InputTag>("triggerResults");
00075   HLTPathsByName_= conf.getParameter<std::vector<std::string > >("hltPaths");
00076   HLTPathsByIndex_.resize(HLTPathsByName_.size());
00077 
00078   minEt_ = conf.getParameter<double>("MinEt");
00079   minPt_ = conf.getParameter<double>("MinPt");
00080   maxAbsEta_ = conf.getParameter<double>("MaxAbsEta");
00081   isEB_ = conf.getParameter<bool>("SelectEB");
00082   isEE_ = conf.getParameter<bool>("SelectEE");
00083   isNotEBEEGap_ = conf.getParameter<bool>("SelectNotEBEEGap");
00084   isEcalDriven_ = conf.getParameter<bool>("SelectEcalDriven");
00085   isTrackerDriven_ = conf.getParameter<bool>("SelectTrackerDriven");
00086   eOverPMinBarrel_ = conf.getParameter<double>("MinEOverPBarrel");
00087   eOverPMaxBarrel_ = conf.getParameter<double>("MaxEOverPBarrel");
00088   eOverPMinEndcaps_ = conf.getParameter<double>("MinEOverPEndcaps");
00089   eOverPMaxEndcaps_ = conf.getParameter<double>("MaxEOverPEndcaps");
00090   dEtaMinBarrel_ = conf.getParameter<double>("MinDetaBarrel");
00091   dEtaMaxBarrel_ = conf.getParameter<double>("MaxDetaBarrel");
00092   dEtaMinEndcaps_ = conf.getParameter<double>("MinDetaEndcaps");
00093   dEtaMaxEndcaps_ = conf.getParameter<double>("MaxDetaEndcaps");
00094   dPhiMinBarrel_ = conf.getParameter<double>("MinDphiBarrel");
00095   dPhiMaxBarrel_ = conf.getParameter<double>("MaxDphiBarrel");
00096   dPhiMinEndcaps_ = conf.getParameter<double>("MinDphiEndcaps");
00097   dPhiMaxEndcaps_ = conf.getParameter<double>("MaxDphiEndcaps");
00098   sigIetaIetaMinBarrel_ = conf.getParameter<double>("MinSigIetaIetaBarrel");
00099   sigIetaIetaMaxBarrel_ = conf.getParameter<double>("MaxSigIetaIetaBarrel");
00100   sigIetaIetaMinEndcaps_ = conf.getParameter<double>("MinSigIetaIetaEndcaps");
00101   sigIetaIetaMaxEndcaps_ = conf.getParameter<double>("MaxSigIetaIetaEndcaps");
00102   hadronicOverEmMaxBarrel_ = conf.getParameter<double>("MaxHoEBarrel");
00103   hadronicOverEmMaxEndcaps_ = conf.getParameter<double>("MaxHoEEndcaps");
00104   mvaMin_ = conf.getParameter<double>("MinMVA");
00105   tipMaxBarrel_ = conf.getParameter<double>("MaxTipBarrel");
00106   tipMaxEndcaps_ = conf.getParameter<double>("MaxTipEndcaps");
00107   tkIso03Max_ = conf.getParameter<double>("MaxTkIso03");
00108   hcalIso03Depth1MaxBarrel_ = conf.getParameter<double>("MaxHcalIso03Depth1Barrel");
00109   hcalIso03Depth1MaxEndcaps_ = conf.getParameter<double>("MaxHcalIso03Depth1Endcaps");
00110   hcalIso03Depth2MaxEndcaps_ = conf.getParameter<double>("MaxHcalIso03Depth2Endcaps");
00111   ecalIso03MaxBarrel_ = conf.getParameter<double>("MaxEcalIso03Barrel");
00112   ecalIso03MaxEndcaps_ = conf.getParameter<double>("MaxEcalIso03Endcaps");
00113 
00114   edm::ParameterSet pset =
00115    conf.getParameter<edm::ParameterSet>("HistosConfigurationData") ;
00116 
00117   etamin=pset.getParameter<double>("Etamin");
00118   etamax=pset.getParameter<double>("Etamax");
00119   phimin=pset.getParameter<double>("Phimin");
00120   phimax=pset.getParameter<double>("Phimax");
00121   ptmax=pset.getParameter<double>("Ptmax");
00122   pmax=pset.getParameter<double>("Pmax");
00123   eopmax=pset.getParameter<double>("Eopmax");
00124   eopmaxsht=pset.getParameter<double>("Eopmaxsht");
00125   detamin=pset.getParameter<double>("Detamin");
00126   detamax=pset.getParameter<double>("Detamax");
00127   dphimin=pset.getParameter<double>("Dphimin");
00128   dphimax=pset.getParameter<double>("Dphimax");
00129   detamatchmin=pset.getParameter<double>("Detamatchmin");
00130   detamatchmax=pset.getParameter<double>("Detamatchmax");
00131   dphimatchmin=pset.getParameter<double>("Dphimatchmin");
00132   dphimatchmax=pset.getParameter<double>("Dphimatchmax");
00133   fhitsmax=pset.getParameter<double>("Fhitsmax");
00134   lhitsmax=pset.getParameter<double>("Lhitsmax");
00135   nbineta=pset.getParameter<int>("Nbineta");
00136   nbineta2D=pset.getParameter<int>("Nbineta2D");
00137   nbinp=pset.getParameter<int>("Nbinp");
00138   nbinpt=pset.getParameter<int>("Nbinpt");
00139   nbinp2D=pset.getParameter<int>("Nbinp2D");
00140   nbinpt2D=pset.getParameter<int>("Nbinpt2D");
00141   nbinpteff=pset.getParameter<int>("Nbinpteff");
00142   nbinphi=pset.getParameter<int>("Nbinphi");
00143   nbinphi2D=pset.getParameter<int>("Nbinphi2D");
00144   nbineop=pset.getParameter<int>("Nbineop");
00145   nbineop2D=pset.getParameter<int>("Nbineop2D");
00146   nbinfhits=pset.getParameter<int>("Nbinfhits");
00147   nbinlhits=pset.getParameter<int>("Nbinlhits");
00148   nbinxyz=pset.getParameter<int>("Nbinxyz");
00149   nbindeta=pset.getParameter<int>("Nbindeta");
00150   nbindphi=pset.getParameter<int>("Nbindphi");
00151   nbindetamatch=pset.getParameter<int>("Nbindetamatch");
00152   nbindphimatch=pset.getParameter<int>("Nbindphimatch");
00153   nbindetamatch2D=pset.getParameter<int>("Nbindetamatch2D");
00154   nbindphimatch2D=pset.getParameter<int>("Nbindphimatch2D");
00155   nbinpoptrue= pset.getParameter<int>("Nbinpoptrue");
00156   poptruemin=pset.getParameter<double>("Poptruemin");
00157   poptruemax=pset.getParameter<double>("Poptruemax");
00158   nbinmee= pset.getParameter<int>("Nbinmee");
00159   meemin=pset.getParameter<double>("Meemin");
00160   meemax=pset.getParameter<double>("Meemax");
00161   nbinhoe= pset.getParameter<int>("Nbinhoe");
00162   hoemin=pset.getParameter<double>("Hoemin");
00163   hoemax=pset.getParameter<double>("Hoemax");
00164 
00165 }
00166 
00167 GsfElectronDataAnalyzer::~GsfElectronDataAnalyzer()
00168 {
00169 
00170   // do anything here that needs to be done at desctruction time
00171   // (e.g. close files, deallocate resources etc.)
00172   histfile_->Write();
00173   histfile_->Close();
00174 }
00175 
00176 void GsfElectronDataAnalyzer::beginJob(){
00177 
00178   histfile_->cd();
00179 
00180   nEvents_ = 0;
00181   nAfterTrigger_ = 0;
00182 
00183   // matching object
00184   std::string::size_type locSC = matchingObjectCollection_.label().find( "SuperCluster", 0 );
00185   std::string type_;
00186   if ( locSC != std::string::npos ) {
00187     std::cout << "Matching objects are SuperClusters "<< std::endl;
00188     type_ = "SC";
00189   } else {
00190     std::cout << "Didn't recognize input matching objects!! " << std::endl;
00191   }
00192 
00193   std::string htitle, hlabel;
00194   hlabel="h_"+type_+"Num"; htitle="# "+type_+"s";
00195   h_matchingObjectNum              = new TH1F( hlabel.c_str(), htitle.c_str(),    nbinfhits,0.,fhitsmax );
00196 
00197   // rec event
00198 
00199   histNum_= new TH1F("h_recEleNum","# rec electrons",20, 0.,20.);
00200 
00201   // matching object distributions
00202   hlabel="h_"+type_+"_eta"; htitle=type_+" #eta";
00203   h_matchingObjectEta             = new TH1F( hlabel.c_str(), htitle.c_str(), nbineta,etamin,etamax);
00204   hlabel="h_"+type_+"_abseta"; htitle=type_+" |#eta|";
00205   h_matchingObjectAbsEta             = new TH1F( hlabel.c_str(), htitle.c_str(), nbineta/2,0.,etamax);
00206   hlabel="h_"+type_+"_P"; htitle=type_+" p";
00207   h_matchingObjectP               = new TH1F( hlabel.c_str(), htitle.c_str(),              nbinp,0.,pmax);
00208   hlabel="h_"+type_+"_Pt"; htitle=type_+" pt";
00209   h_matchingObjectPt               = new TH1F( hlabel.c_str(),htitle.c_str(),            nbinpteff,5.,ptmax);
00210   hlabel="h_"+type_+"_phi"; htitle=type_+" phi";
00211   h_matchingObjectPhi               = new TH1F( hlabel.c_str(), htitle.c_str(),        nbinphi,phimin,phimax);
00212   hlabel="h_"+type_+"_z"; htitle=type_+" z";
00213   h_matchingObjectZ      = new TH1F( hlabel.c_str(), htitle.c_str(),   nbinxyz , -25, 25 );
00214 
00215   // mee
00216   h_ele_mee_all      = new TH1F( "h_ele_mee_all", "ele pairs invariant mass, all charge combinations", nbinmee, meemin, meemax );
00217   h_ele_mee_os      = new TH1F( "h_ele_mee_os", "ele pairs invariant mass, opposite sign", nbinmee, meemin, meemax );
00218   h_ele_mee_os_ebeb      = new TH1F( "h_ele_mee_os_ebeb", "ele pairs invariant mass, opp. sign, EB-EB", nbinmee, meemin, meemax );
00219   h_ele_mee_os_ebeb->Sumw2();
00220   h_ele_mee_os_ebee      = new TH1F( "h_ele_mee_os_ebee", "ele pairs invariant mass, opp. sign, EB-EE", nbinmee, meemin, meemax );
00221   h_ele_mee_os_ebee->Sumw2();
00222   h_ele_mee_os_eeee      = new TH1F( "h_ele_mee_os_eeee", "ele pairs invariant mass, opp. sign, EE-EE", nbinmee, meemin, meemax );
00223   h_ele_mee_os_eeee->Sumw2();
00224   h_ele_mee_os_gg      = new TH1F( "h_ele_mee_os_gg", "ele pairs invariant mass, opp. sign, good-good", nbinmee, meemin, meemax );
00225   h_ele_mee_os_gg->Sumw2();
00226   h_ele_mee_os_gb      = new TH1F( "h_ele_mee_os_gb", "ele pairs invariant mass, opp. sign, good-bad", nbinmee, meemin, meemax );
00227   h_ele_mee_os_gb->Sumw2();
00228   h_ele_mee_os_bb      = new TH1F( "h_ele_mee_os_bb", "ele pairs invariant mass, opp. sign, bad-bad", nbinmee, meemin, meemax );
00229   h_ele_mee_os_bb->Sumw2();
00230 
00231   // duplicates
00232   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. );
00233   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. );
00234 
00235   // recoed and matched electrons
00236   h_ele_charge         = new TH1F( "h_ele_charge",         "ele charge",             5,-2.,2.);
00237   h_ele_chargeVsEta    = new TH2F( "h_ele_chargeVsEta",         "ele charge vs eta", nbineta2D,etamin,etamax,5,-2.,2.);
00238   h_ele_chargeVsPhi    = new TH2F( "h_ele_chargeVsPhi",         "ele charge vs phi", nbinphi2D,phimin,phimax,5,-2.,2.);
00239   h_ele_chargeVsPt    = new TH2F( "h_ele_chargeVsPt",         "ele charge vs pt", nbinpt,0.,100.,5,-2.,2.);
00240   h_ele_vertexP        = new TH1F( "h_ele_vertexP",        "ele momentum",       nbinp,0.,pmax);
00241   h_ele_vertexPt       = new TH1F( "h_ele_vertexPt",       "ele transverse momentum",  nbinpt,0.,ptmax);
00242   h_ele_Et       = new TH1F( "h_ele_Et",       "ele SC transverse energy",  nbinpt,0.,ptmax);
00243   h_ele_vertexPtVsEta   = new TH2F( "h_ele_vertexPtVsEta",       "ele transverse momentum vs eta",nbineta2D,etamin,etamax,nbinpt2D,0.,ptmax);
00244   h_ele_vertexPtVsPhi   = new TH2F( "h_ele_vertexPtVsPhi",       "ele transverse momentum vs phi",nbinphi2D,phimin,phimax,nbinpt2D,0.,ptmax);
00245   h_ele_matchingObjectPt_matched       = new TH1F( "h_ele_matchingObjectPt_matched",       "Efficiency vs matching SC E_{T}",  nbinpteff,5.,ptmax);
00246   h_ele_matchingObjectPt_matched->Sumw2();
00247   h_ele_vertexEta      = new TH1F( "h_ele_vertexEta",      "ele momentum eta",    nbineta,etamin,etamax);
00248   h_ele_vertexEtaVsPhi  = new TH2F( "h_ele_vertexEtaVsPhi",      "ele momentum eta vs phi",nbineta2D,etamin,etamax,nbinphi2D,phimin,phimax );
00249   h_ele_matchingObjectAbsEta_matched      = new TH1F( "h_ele_matchingObjectAbsEta_matched",      "Efficiency vs matching SC |#eta|",    nbineta/2,0.,2.5);
00250   h_ele_matchingObjectAbsEta_matched->Sumw2();
00251   h_ele_matchingObjectEta_matched      = new TH1F( "h_ele_matchingObjectEta_matched",      "Efficiency vs matching SC #eta",    nbineta,etamin,etamax);
00252   h_ele_matchingObjectEta_matched->Sumw2();
00253   h_ele_matchingObjectPhi_matched               = new TH1F( "h_ele_matchingObjectPhi_matched", "Efficiency vs matching SC phi",        nbinphi,phimin,phimax);
00254   h_ele_matchingObjectPhi_matched->Sumw2();
00255   h_ele_vertexPhi      = new TH1F( "h_ele_vertexPhi",      "ele  momentum #phi",    nbinphi,phimin,phimax);
00256   h_ele_vertexX      = new TH1F( "h_ele_vertexX",      "ele vertex x",    nbinxyz,-0.1,0.1 );
00257   h_ele_vertexY      = new TH1F( "h_ele_vertexY",      "ele vertex y",    nbinxyz,-0.1,0.1 );
00258   h_ele_vertexZ      = new TH1F( "h_ele_vertexZ",      "ele vertex z",    nbinxyz,-25, 25 );
00259   h_ele_matchingObjectZ_matched      = new TH1F( "h_ele_matchingObjectZ_matched",      "Efficiency vs matching SC z",    nbinxyz,-25,25);
00260   h_ele_matchingObjectZ_matched->Sumw2();
00261   h_ele_vertexTIP      = new TH1F( "h_ele_vertexTIP",      "ele transverse impact parameter (wrt bs)",    90,0.,0.15);
00262   h_ele_vertexTIPVsEta      = new TH2F( "h_ele_vertexTIPVsEta",      "ele transverse impact parameter (wrt bs) vs eta", nbineta2D,etamin,etamax,45,0.,0.15);
00263   h_ele_vertexTIPVsPhi      = new TH2F( "h_ele_vertexTIPVsPhi",      "ele transverse impact parameter (wrt bs) vs phi", nbinphi2D,phimin,phimax,45,0.,0.15);
00264   h_ele_vertexTIPVsPt      = new TH2F( "h_ele_vertexTIPVsPt",      "ele transverse impact parameter (wrt bs) vs transverse momentum", nbinpt2D,0.,ptmax,45,0.,0.15);
00265   h_ele_PoPmatchingObject_matched        = new TH1F( "h_ele_PoPmatchingObject_matched",        "ele momentum / matching SC energy", nbinpoptrue,poptruemin,poptruemax);
00266   h_ele_PtoPtmatchingObject_matched        = new TH1F( "h_ele_PtoPtmatchingObject_matched",        "ele trans momentum / matching SC trans energy", nbinpoptrue,poptruemin,poptruemax);
00267   h_ele_PoPmatchingObjectVsEta_matched   = new TH2F( "h_ele_PoPmatchingObjectVsEta_matched",        "ele momentum / matching SC energy vs eta", nbineta2D,etamin,etamax,50,poptruemin,poptruemax);
00268   h_ele_PoPmatchingObjectVsPhi_matched   = new TH2F( "h_ele_PoPmatchingObjectVsPhi_matched",        "ele momentum / matching SC energy vs phi", nbinphi2D,phimin,phimax,50,poptruemin,poptruemax);
00269   h_ele_PoPmatchingObjectVsPt_matched   = new TH2F( "h_ele_PoPmatchingObjectVsPt_matched",        "ele momentum / matching SC energy vs eta", nbinpt2D,0.,ptmax,50,poptruemin,poptruemax);
00270   h_ele_PoPmatchingObject_barrel_matched         = new TH1F( "h_ele_PoPmatchingObject_barrel_matched",        "ele momentum / matching SC energy, barrel",nbinpoptrue,poptruemin,poptruemax);
00271   h_ele_PoPmatchingObject_endcaps_matched        = new TH1F( "h_ele_PoPmatchingObject_endcaps_matched",        "ele momentum / matching SC energy, endcaps",nbinpoptrue,poptruemin,poptruemax);
00272   h_ele_PtoPtmatchingObject_barrel_matched         = new TH1F( "h_ele_PtoPmatchingObject_barrel_matched",        "ele trans momentum / matching SC trans energy, barrel",nbinpoptrue,poptruemin,poptruemax);
00273   h_ele_PtoPtmatchingObject_endcaps_matched        = new TH1F( "h_ele_PtoPmatchingObject_endcaps_matched",        "ele trans momentum / matching SC trans energy, endcaps",nbinpoptrue,poptruemin,poptruemax);
00274   h_ele_EtaMnEtamatchingObject_matched   = new TH1F( "h_ele_EtaMnEtamatchingObject_matched",   "ele momentum eta - matching SC eta",nbindeta,detamin,detamax);
00275   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);
00276   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);
00277   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);
00278   h_ele_PhiMnPhimatchingObject_matched   = new TH1F( "h_ele_PhiMnPhimatchingObject_matched",   "ele momentum phi - matching SC phi",nbindphi,dphimin,dphimax);
00279   h_ele_PhiMnPhimatchingObject2_matched   = new TH1F( "h_ele_PhiMnPhimatchingObject2_matched",   "ele momentum phi - matching SC phi",nbindphimatch2D,dphimatchmin,dphimatchmax);
00280   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);
00281   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);
00282   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);
00283 
00284   // matched electron, superclusters
00285   histSclEn_ = new TH1F("h_scl_energy","ele supercluster energy",nbinp,0.,pmax);
00286   histSclEoEmatchingObject_barrel_matched = new TH1F("h_scl_EoEmatchingObject_barrel_matched","ele supercluster energy / matching SC energy, barrel",50,0.2,1.2);
00287   histSclEoEmatchingObject_endcaps_matched = new TH1F("h_scl_EoEmatchingObject_endcaps_matched","ele supercluster energy / matching SC energy, endcaps",50,0.2,1.2);
00288   histSclEoEmatchingObject_barrel_new_matched = new TH1F("h_scl_EoEmatchingObject_barrel_new_matched","ele supercluster energy / matching SC energy, barrel",nbinpoptrue,poptruemin,poptruemax);
00289   histSclEoEmatchingObject_endcaps_new_matched = new TH1F("h_scl_EoEmatchingObject_endcaps_new_matched","ele supercluster energy / matching SC energy, endcaps",nbinpoptrue,poptruemin,poptruemax);
00290   histSclEt_ = new TH1F("h_scl_et","ele supercluster transverse energy",nbinpt,0.,ptmax);
00291   histSclEtVsEta_ = new TH2F("h_scl_etVsEta","ele supercluster transverse energy vs eta",nbineta2D,etamin,etamax,nbinpt,0.,ptmax);
00292   histSclEtVsPhi_ = new TH2F("h_scl_etVsPhi","ele supercluster transverse energy vs phi",nbinphi2D,phimin,phimax,nbinpt,0.,ptmax);
00293   histSclEtaVsPhi_ = new TH2F("h_scl_etaVsPhi","ele supercluster eta vs phi",nbinphi2D,phimin,phimax,nbineta2D,etamin,etamax);
00294   histSclEta_ = new TH1F("h_scl_eta","ele supercluster eta",nbineta,etamin,etamax);
00295   histSclPhi_ = new TH1F("h_scl_phi","ele supercluster phi",nbinphi,phimin,phimax);
00296 
00297   histSclSigEtaEta_ =  new TH1F("h_scl_sigetaeta","ele supercluster sigma eta eta",100,0.,0.05);
00298   histSclSigIEtaIEta_barrel_ =  new TH1F("h_scl_sigietaieta_barrel","ele supercluster sigma ieta ieta, barrel",100,0.,0.05);
00299   histSclSigIEtaIEta_endcaps_ =  new TH1F("h_scl_sigietaieta_endcaps","ele supercluster sigma ieta ieta, endcaps",100,0.,0.05);
00300   histSclE1x5_ =  new TH1F("h_scl_E1x5","ele supercluster energy in 1x5",nbinp,0.,pmax);
00301   histSclE1x5_barrel_ =  new TH1F("h_scl_E1x_barrel5","ele supercluster energy in 1x5 barrel",nbinp,0.,pmax);
00302   histSclE1x5_endcaps_ =  new TH1F("h_scl_E1x5_endcaps","ele supercluster energy in 1x5 endcaps",nbinp,0.,pmax);
00303   histSclE2x5max_ =  new TH1F("h_scl_E2x5max","ele supercluster energy in 2x5 max",nbinp,0.,pmax);
00304   histSclE2x5max_barrel_ =  new TH1F("h_scl_E2x5max_barrel","ele supercluster energy in 2x5 max barrel",nbinp,0.,pmax);
00305   histSclE2x5max_endcaps_ =  new TH1F("h_scl_E2x5max_endcaps","ele supercluster energy in 2x5 max endcaps",nbinp,0.,pmax);
00306   histSclE5x5_ =  new TH1F("h_scl_E5x5","ele supercluster energy in 5x5",nbinp,0.,pmax);
00307   histSclE5x5_barrel_ =  new TH1F("h_scl_E5x5_barrel","ele supercluster energy in 5x5 barrel",nbinp,0.,pmax);
00308   histSclE5x5_endcaps_ =  new TH1F("h_scl_E5x5_endcaps","ele supercluster energy in 5x5 endcaps",nbinp,0.,pmax);
00309 
00310   // matched electron, gsf tracks
00311   h_ele_ambiguousTracks      = new TH1F( "h_ele_ambiguousTracks", "ele # ambiguous tracks",  5,0.,5.);
00312   h_ele_ambiguousTracksVsEta      = new TH2F( "h_ele_ambiguousTracksVsEta","ele # ambiguous tracks  vs eta",  nbineta2D,etamin,etamax,5,0.,5.);
00313   h_ele_ambiguousTracksVsPhi      = new TH2F( "h_ele_ambiguousTracksVsPhi", "ele # ambiguous tracks  vs phi",  nbinphi2D,phimin,phimax,5,0.,5.);
00314   h_ele_ambiguousTracksVsPt      = new TH2F( "h_ele_ambiguousTracksVsPt", "ele # ambiguous tracks vs pt",  nbinpt2D,0.,ptmax,5,0.,5.);
00315   h_ele_foundHits      = new TH1F( "h_ele_foundHits",      "ele track # found hits",      nbinfhits,0.,fhitsmax);
00316   h_ele_foundHitsVsEta      = new TH2F( "h_ele_foundHitsVsEta",      "ele track # found hits vs eta",  nbineta2D,etamin,etamax,nbinfhits,0.,fhitsmax);
00317   h_ele_foundHitsVsPhi      = new TH2F( "h_ele_foundHitsVsPhi",      "ele track # found hits vs phi",  nbinphi2D,phimin,phimax,nbinfhits,0.,fhitsmax);
00318   h_ele_foundHitsVsPt      = new TH2F( "h_ele_foundHitsVsPt",      "ele track # found hits vs pt",  nbinpt2D,0.,ptmax,nbinfhits,0.,fhitsmax);
00319   h_ele_lostHits       = new TH1F( "h_ele_lostHits",       "ele track # lost hits",       5,0.,5.);
00320   h_ele_lostHitsVsEta       = new TH2F( "h_ele_lostHitsVsEta",       "ele track # lost hits vs eta",   nbineta2D,etamin,etamax,nbinlhits,0.,lhitsmax);
00321   h_ele_lostHitsVsPhi       = new TH2F( "h_ele_lostHitsVsPhi",       "ele track # lost hits vs eta",   nbinphi2D,phimin,phimax,nbinlhits,0.,lhitsmax);
00322   h_ele_lostHitsVsPt       = new TH2F( "h_ele_lostHitsVsPt",       "ele track # lost hits vs eta",   nbinpt2D,0.,ptmax,nbinlhits,0.,lhitsmax);
00323   h_ele_chi2           = new TH1F( "h_ele_chi2",           "ele track #chi^{2}",         100,0.,15.);
00324   h_ele_chi2VsEta           = new TH2F( "h_ele_chi2VsEta",           "ele track #chi^{2} vs eta",  nbineta2D,etamin,etamax,50,0.,15.);
00325   h_ele_chi2VsPhi           = new TH2F( "h_ele_chi2VsPhi",           "ele track #chi^{2} vs phi",  nbinphi2D,phimin,phimax,50,0.,15.);
00326   h_ele_chi2VsPt           = new TH2F( "h_ele_chi2VsPt",           "ele track #chi^{2} vs pt",  nbinpt2D,0.,ptmax,50,0.,15.);
00327   h_ele_PinMnPout      = new TH1F( "h_ele_PinMnPout",      "ele track inner p - outer p, mean"   ,nbinp,0.,200.);
00328   h_ele_PinMnPout_mode      = new TH1F( "h_ele_PinMnPout_mode",      "ele track inner p - outer p, mode"   ,nbinp,0.,100.);
00329   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.);
00330   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.);
00331   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.);
00332   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.);
00333   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.);
00334   h_ele_outerP         = new TH1F( "h_ele_outerP",         "ele track outer p, mean",          nbinp,0.,pmax);
00335   h_ele_outerP_mode         = new TH1F( "h_ele_outerP_mode",         "ele track outer p, mode",          nbinp,0.,pmax);
00336   h_ele_outerPVsEta_mode         = new TH2F( "h_ele_outerPVsEta_mode",         "ele track outer p vs eta mode", nbineta2D,etamin,etamax,50,0.,pmax);
00337   h_ele_outerPt        = new TH1F( "h_ele_outerPt",        "ele track outer p_{T}, mean",      nbinpt,0.,ptmax);
00338   h_ele_outerPt_mode        = new TH1F( "h_ele_outerPt_mode",        "ele track outer p_{T}, mode",      nbinpt,0.,ptmax);
00339   h_ele_outerPtVsEta_mode        = new TH2F( "h_ele_outerPtVsEta_mode", "ele track outer p_{T} vs eta, mode", nbineta2D,etamin,etamax,nbinpt2D,0.,ptmax);
00340   h_ele_outerPtVsPhi_mode        = new TH2F( "h_ele_outerPtVsPhi_mode", "ele track outer p_{T} vs phi, mode", nbinphi2D,phimin,phimax,nbinpt2D,0.,ptmax);
00341   h_ele_outerPtVsPt_mode        = new TH2F( "h_ele_outerPtVsPt_mode", "ele track outer p_{T} vs pt, mode", nbinpt2D,0.,100.,nbinpt2D,0.,ptmax);
00342 
00343   // matched electrons, matching
00344   h_ele_EoP            = new TH1F( "h_ele_EoP",            "ele E/P_{vertex}",        nbineop,0.,eopmax);
00345   h_ele_EoPVsEta            = new TH2F( "h_ele_EoPVsEta",            "ele E/P_{vertex} vs eta",  nbineta2D,etamin,etamax,nbineop2D,0.,eopmaxsht);
00346   h_ele_EoPVsPhi            = new TH2F( "h_ele_EoPVsPhi",            "ele E/P_{vertex} vs phi",  nbinphi2D,phimin,phimax,nbineop2D,0.,eopmaxsht);
00347   h_ele_EoPVsE            = new TH2F( "h_ele_EoPVsE",            "ele E/P_{vertex} vs E",  50,0.,pmax ,50,0.,5.);
00348   h_ele_EseedOP            = new TH1F( "h_ele_EseedOP",            "ele E_{seed}/P_{vertex}",        nbineop,0.,eopmax);
00349   h_ele_EseedOPVsEta            = new TH2F( "h_ele_EseedOPVsEta",            "ele E_{seed}/P_{vertex} vs eta",  nbineta2D,etamin,etamax,nbineop2D,0.,eopmaxsht);
00350   h_ele_EseedOPVsPhi            = new TH2F( "h_ele_EseedOPVsPhi",            "ele E_{seed}/P_{vertex} vs phi",  nbinphi2D,phimin,phimax,nbineop2D,0.,eopmaxsht);
00351   h_ele_EseedOPVsE            = new TH2F( "h_ele_EseedOPVsE",            "ele E_{seed}/P_{vertex} vs E",  50,0.,pmax ,50,0.,5.);
00352   h_ele_EoPout         = new TH1F( "h_ele_EoPout",         "ele E/P_{out}",           nbineop,0.,eopmax);
00353   h_ele_EoPoutVsEta         = new TH2F( "h_ele_EoPoutVsEta",         "ele E/P_{out} vs eta",    nbineta2D,etamin,etamax,nbineop2D,0.,eopmaxsht);
00354   h_ele_EoPoutVsPhi         = new TH2F( "h_ele_EoPoutVsPhi",         "ele E/P_{out} vs phi",    nbinphi2D,phimin,phimax,nbineop2D,0.,eopmaxsht);
00355   h_ele_EoPoutVsE         = new TH2F( "h_ele_EoPoutVsE",         "ele E/P_{out} vs E",    nbinp2D,0.,pmax,nbineop2D,0.,eopmaxsht);
00356   h_ele_EeleOPout         = new TH1F( "h_ele_EeleOPout",         "ele E_{ele}/P_{out}",           nbineop,0.,eopmax);
00357   h_ele_EeleOPoutVsEta         = new TH2F( "h_ele_EeleOPoutVsEta",         "ele E_{ele}/P_{out} vs eta",    nbineta2D,etamin,etamax,nbineop2D,0.,eopmaxsht);
00358   h_ele_EeleOPoutVsPhi         = new TH2F( "h_ele_EeleOPoutVsPhi",         "ele E_{ele}/P_{out} vs phi",    nbinphi2D,phimin,phimax,nbineop2D,0.,eopmaxsht);
00359   h_ele_EeleOPoutVsE         = new TH2F( "h_ele_EeleOPoutVsE",         "ele E_{ele}/P_{out} vs E",    nbinp2D,0.,pmax,nbineop2D,0.,eopmaxsht);
00360   h_ele_dEtaSc_propVtx = new TH1F( "h_ele_dEtaSc_propVtx", "ele #eta_{sc} - #eta_{tr}, prop from vertex",      nbindetamatch,detamatchmin,detamatchmax);
00361   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);
00362   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);
00363   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);
00364   h_ele_dPhiSc_propVtx = new TH1F( "h_ele_dPhiSc_propVtx", "ele #phi_{sc} - #phi_{tr}, prop from vertex",      nbindphimatch,dphimatchmin,dphimatchmax);
00365   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);
00366   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);
00367   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);
00368   h_ele_dEtaCl_propOut = new TH1F( "h_ele_dEtaCl_propOut", "ele #eta_{cl} - #eta_{tr}, prop from outermost",   nbindetamatch,detamatchmin,detamatchmax);
00369   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);
00370   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);
00371   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);
00372   h_ele_dPhiCl_propOut = new TH1F( "h_ele_dPhiCl_propOut", "ele #phi_{cl} - #phi_{tr}, prop from outermost",   nbindphimatch,dphimatchmin,dphimatchmax);
00373   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);
00374   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);
00375   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);
00376   h_ele_dEtaEleCl_propOut = new TH1F( "h_ele_dEtaEleCl_propOut", "ele #eta_{EleCl} - #eta_{tr}, prop from outermost",   nbindetamatch,detamatchmin,detamatchmax);
00377   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);
00378   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);
00379   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);
00380   h_ele_dPhiEleCl_propOut = new TH1F( "h_ele_dPhiEleCl_propOut", "ele #phi_{EleCl} - #phi_{tr}, prop from outermost",   nbindphimatch,dphimatchmin,dphimatchmax);
00381   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);
00382   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);
00383   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);
00384 
00385   h_ele_HoE = new TH1F("h_ele_HoE", "ele hadronic energy / em energy", nbinhoe, hoemin, hoemax) ;
00386   h_ele_HoE_fiducial = new TH1F("h_ele_HoE_fiducial", "ele hadronic energy / em energy, fiducial region", nbinhoe, hoemin, hoemax) ;
00387   h_ele_HoEVsEta = new TH2F("h_ele_HoEVsEta", "ele hadronic energy / em energy vs eta", nbineta,etamin,etamax,nbinhoe, hoemin, hoemax) ;
00388   h_ele_HoEVsPhi = new TH2F("h_ele_HoEVsPhi", "ele hadronic energy / em energy vs phi", nbinphi2D,phimin,phimax,nbinhoe, hoemin, hoemax) ;
00389   h_ele_HoEVsE = new TH2F("h_ele_HoEVsE", "ele hadronic energy / em energy vs E", nbinp, 0.,300.,nbinhoe, hoemin, hoemax) ;
00390 
00391   h_ele_seed_dphi2_ = new TH1F("h_ele_seedDphi2", "ele seed dphi 2nd layer", 50,-0.003,+0.003) ;
00392   h_ele_seed_dphi2VsEta_ = new TH2F("h_ele_seedDphi2VsEta", "ele seed dphi 2nd layer vs eta", nbineta2D,etamin,etamax,50,-0.003,+0.003) ;
00393   h_ele_seed_dphi2VsPt_ = new TH2F("h_ele_seedDphi2VsPt", "ele seed dphi 2nd layer vs pt", nbinpt2D,0.,ptmax,50,-0.003,+0.003) ;
00394   h_ele_seed_drz2_ = new TH1F("h_ele_seedDrz2", "ele seed dr/dz 2nd layer", 50,-0.03,+0.03) ;
00395   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) ;
00396   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) ;
00397   h_ele_seed_subdet2_ = new TH1F("h_ele_seedSubdet2", "ele seed subdet 2nd layer", 10,0.,10.) ;
00398 
00399   // classes
00400   h_ele_classes = new TH1F( "h_ele_classes", "electron classes",      20,0.0,20.);
00401   h_ele_eta = new TH1F( "h_ele_eta", "ele electron eta",  nbineta/2,0.0,etamax);
00402   h_ele_eta_golden = new TH1F( "h_ele_eta_golden", "ele electron eta golden",  nbineta/2,0.0,etamax);
00403   h_ele_eta_bbrem = new TH1F( "h_ele_eta_bbrem", "ele electron eta bbrem",  nbineta/2,0.0,etamax);
00404   h_ele_eta_narrow = new TH1F( "h_ele_eta_narrow", "ele electron eta narrow",  nbineta/2,0.0,etamax);
00405   h_ele_eta_shower = new TH1F( "h_ele_eta_show", "ele electron eta showering",  nbineta/2,0.0,etamax);
00406   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);
00407   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);
00408   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);
00409   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);
00410   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);
00411   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);
00412   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);
00413   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);
00414   histSclEoEmatchingObjectGolden_barrel = new TH1F("h_scl_EoEmatchingObject golden, barrel","ele supercluster energy over matchingObject energy, golden, barrel",100,0.2,1.2);
00415   histSclEoEmatchingObjectGolden_endcaps = new TH1F("h_scl_EoEmatchingObject golden, endcaps","ele supercluster energy over matchingObject energy, golden, endcaps",100,0.2,1.2);
00416   histSclEoEmatchingObjectShowering_barrel = new TH1F("h_scl_EoEmatchingObject Showering, barrel","ele supercluster energy over matchingObject energy, showering, barrel",100,0.2,1.2);
00417   histSclEoEmatchingObjectShowering_endcaps = new TH1F("h_scl_EoEmatchingObject Showering, endcaps","ele supercluster energy over matchingObject energy, showering, endcaps",100,0.2,1.2);
00418 
00419   // isolation
00420   h_ele_tkSumPt_dr03 = new TH1F("h_ele_tkSumPt_dr03","tk isolation sum, dR=0.3",100,0.0,20.);
00421   h_ele_ecalRecHitSumEt_dr03= new TH1F("h_ele_ecalRecHitSumEt_dr03","ecal isolation sum, dR=0.3",100,0.0,20.);
00422   h_ele_hcalDepth1TowerSumEt_dr03= new TH1F("h_ele_hcalDepth1TowerSumEt_dr03","hcal depth1 isolation sum, dR=0.3",100,0.0,20.);
00423   h_ele_hcalDepth2TowerSumEt_dr03= new TH1F("h_ele_hcalDepth2TowerSumEt_dr03","hcal depth2 isolation sum, dR=0.3",100,0.0,20.);
00424   h_ele_tkSumPt_dr04= new TH1F("h_ele_tkSumPt_dr04","hcal isolation sum",100,0.0,20.);
00425   h_ele_ecalRecHitSumEt_dr04= new TH1F("h_ele_ecalRecHitSumEt_dr04","ecal isolation sum, dR=0.4",100,0.0,20.);
00426   h_ele_hcalDepth1TowerSumEt_dr04= new TH1F("h_ele_hcalDepth1TowerSumEt_dr04","hcal depth1 isolation sum, dR=0.4",100,0.0,20.);
00427   h_ele_hcalDepth2TowerSumEt_dr04= new TH1F("h_ele_hcalDepth2TowerSumEt_dr04","hcal depth2 isolation sum, dR=0.4",100,0.0,20.);
00428 
00429   // fbrem
00430   h_ele_fbrem = new TH1F( "h_ele_fbrem","ele brem fraction, mode",100,0.,1.);
00431   h_ele_fbremVsEta_mode = new TProfile( "h_ele_fbremvsEtamode","mean ele brem fraction vs eta, mode",nbineta2D,etamin,etamax,0.,1.);
00432   h_ele_fbremVsEta_mean = new TProfile( "h_ele_fbremvsEtamean","mean ele brem fraction vs eta, mean",nbineta2D,etamin,etamax,0.,1.);
00433 
00434   // e/g et pflow electrons
00435   h_ele_mva = new TH1F( "h_ele_mva","ele identification mva",100,-1.,1.);
00436   h_ele_provenance = new TH1F( "h_ele_provenance","ele provenance",5,-2.,3.);
00437 
00438   // histos titles
00439   h_matchingObjectNum              -> GetXaxis()-> SetTitle("N_{SC}");
00440   h_matchingObjectNum              -> GetYaxis()-> SetTitle("Events");
00441   h_matchingObjectEta             -> GetXaxis()-> SetTitle("#eta_{SC}");
00442   h_matchingObjectEta             -> GetYaxis()-> SetTitle("Events");
00443   h_matchingObjectP               -> GetXaxis()-> SetTitle("E_{SC} (GeV)");
00444   h_matchingObjectP               -> GetYaxis()-> SetTitle("Events");
00445   h_ele_foundHits      -> GetXaxis()-> SetTitle("N_{hits}");
00446   h_ele_foundHits      -> GetYaxis()-> SetTitle("Events");
00447   h_ele_ambiguousTracks      -> GetXaxis()-> SetTitle("N_{ambiguous tracks}");
00448   h_ele_ambiguousTracks      -> GetYaxis()-> SetTitle("Events");
00449   h_ele_lostHits       -> GetXaxis()-> SetTitle("N_{lost hits}");
00450   h_ele_lostHits       -> GetYaxis()-> SetTitle("Events");
00451   h_ele_chi2           -> GetXaxis()-> SetTitle("#Chi^{2}");
00452   h_ele_chi2           -> GetYaxis()-> SetTitle("Events");
00453   h_ele_charge         -> GetXaxis()-> SetTitle("charge");
00454   h_ele_charge         -> GetYaxis()-> SetTitle("Events");
00455   h_ele_vertexP        -> GetXaxis()-> SetTitle("p_{vertex} (GeV/c)");
00456   h_ele_vertexP        -> GetYaxis()-> SetTitle("Events");
00457   h_ele_vertexPt       -> GetXaxis()-> SetTitle("p_{T vertex} (GeV/c)");
00458   h_ele_vertexPt       -> GetYaxis()-> SetTitle("Events");
00459   h_ele_Et       -> GetXaxis()-> SetTitle("E_{T} (GeV)");
00460   h_ele_Et       -> GetYaxis()-> SetTitle("Events");
00461   h_ele_vertexEta      -> GetXaxis()-> SetTitle("#eta");
00462   h_ele_vertexEta      -> GetYaxis()-> SetTitle("Events");
00463   h_ele_vertexPhi      -> GetXaxis()-> SetTitle("#phi (rad)");
00464   h_ele_vertexPhi      -> GetYaxis()-> SetTitle("Events");
00465   h_ele_PoPmatchingObject_matched        -> GetXaxis()-> SetTitle("P/E_{SC}");
00466   h_ele_PoPmatchingObject_matched        -> GetYaxis()-> SetTitle("Events");
00467   h_ele_PoPmatchingObject_barrel_matched        -> GetXaxis()-> SetTitle("P/E_{SC}");
00468   h_ele_PoPmatchingObject_barrel_matched        -> GetYaxis()-> SetTitle("Events");
00469   h_ele_PoPmatchingObject_endcaps_matched        -> GetXaxis()-> SetTitle("P/E_{SC}");
00470   h_ele_PoPmatchingObject_endcaps_matched        -> GetYaxis()-> SetTitle("Events");
00471   h_ele_PtoPtmatchingObject_matched        -> GetXaxis()-> SetTitle("P_{T}/E_{T}^{SC}");
00472   h_ele_PtoPtmatchingObject_matched        -> GetYaxis()-> SetTitle("Events");
00473   h_ele_PtoPtmatchingObject_barrel_matched        -> GetXaxis()-> SetTitle("P_{T}/E_{T}^{SC}");
00474   h_ele_PtoPtmatchingObject_barrel_matched        -> GetYaxis()-> SetTitle("Events");
00475   h_ele_PtoPtmatchingObject_endcaps_matched        -> GetXaxis()-> SetTitle("P_{T}/E_{T}^{SC}");
00476   h_ele_PtoPtmatchingObject_endcaps_matched        -> GetYaxis()-> SetTitle("Events");
00477   histSclSigEtaEta_-> GetXaxis()-> SetTitle("#sigma_{#eta #eta}") ;
00478   histSclSigEtaEta_-> GetYaxis()-> SetTitle("Events") ;
00479   histSclSigIEtaIEta_barrel_-> GetXaxis()-> SetTitle("#sigma_{i#eta i#eta}") ;
00480   histSclSigIEtaIEta_barrel_-> GetYaxis()-> SetTitle("Events") ;
00481   histSclSigIEtaIEta_endcaps_-> GetXaxis()-> SetTitle("#sigma_{i#eta i#eta}") ;
00482   histSclSigIEtaIEta_endcaps_-> GetYaxis()-> SetTitle("Events") ;
00483   histSclE1x5_-> GetXaxis()-> SetTitle("E1x5 (GeV)") ;
00484   histSclE1x5_-> GetYaxis()-> SetTitle("Events") ;
00485   histSclE1x5_barrel_-> GetXaxis()-> SetTitle("E1x5 (GeV)") ;
00486   histSclE1x5_barrel_-> GetYaxis()-> SetTitle("Events") ;
00487   histSclE1x5_endcaps_-> GetXaxis()-> SetTitle("E1x5 (GeV)") ;
00488   histSclE1x5_endcaps_-> GetYaxis()-> SetTitle("Events") ;
00489   histSclE2x5max_-> GetXaxis()-> SetTitle("E2x5 (GeV)") ;
00490   histSclE2x5max_-> GetYaxis()-> SetTitle("Events") ;
00491   histSclE2x5max_barrel_-> GetXaxis()-> SetTitle("E2x5 (GeV)") ;
00492   histSclE2x5max_barrel_-> GetYaxis()-> SetTitle("Events") ;
00493   histSclE2x5max_endcaps_-> GetXaxis()-> SetTitle("E2x5 (GeV)") ;
00494   histSclE2x5max_endcaps_-> GetYaxis()-> SetTitle("Events") ;
00495   histSclE5x5_-> GetXaxis()-> SetTitle("E5x5 (GeV)") ;
00496   histSclE5x5_-> GetYaxis()-> SetTitle("Events") ;
00497   histSclE5x5_barrel_-> GetXaxis()-> SetTitle("E5x5 (GeV)") ;
00498   histSclE5x5_barrel_-> GetYaxis()-> SetTitle("Events") ;
00499   histSclE5x5_endcaps_-> GetXaxis()-> SetTitle("E5x5 (GeV)") ;
00500   histSclE5x5_endcaps_-> GetYaxis()-> SetTitle("Events") ;
00501   h_ele_EtaMnEtamatchingObject_matched   -> GetXaxis()-> SetTitle("#eta_{rec} - #eta_{SC}");
00502   h_ele_EtaMnEtamatchingObject_matched   -> GetYaxis()-> SetTitle("Events");
00503   h_ele_PhiMnPhimatchingObject_matched   -> GetXaxis()-> SetTitle("#phi_{rec} - #phi_{SC} (rad)");
00504   h_ele_PhiMnPhimatchingObject_matched   -> GetYaxis()-> SetTitle("Events");
00505   h_ele_PinMnPout      -> GetXaxis()-> SetTitle("P_{vertex} - P_{out} (GeV/c)");
00506   h_ele_PinMnPout      -> GetYaxis()-> SetTitle("Events");
00507   h_ele_PinMnPout_mode      -> GetXaxis()-> SetTitle("P_{vertex} - P_{out}, mode (GeV/c)");
00508   h_ele_PinMnPout_mode      -> GetYaxis()-> SetTitle("Events");
00509   h_ele_outerP         -> GetXaxis()-> SetTitle("P_{out} (GeV/c)");
00510   h_ele_outerP         -> GetYaxis()-> SetTitle("Events");
00511   h_ele_outerP_mode         -> GetXaxis()-> SetTitle("P_{out} (GeV/c)");
00512   h_ele_outerP_mode         -> GetYaxis()-> SetTitle("Events");
00513   h_ele_outerPt        -> GetXaxis()-> SetTitle("P_{T out} (GeV/c)");
00514   h_ele_outerPt        -> GetYaxis()-> SetTitle("Events");
00515   h_ele_outerPt_mode        -> GetXaxis()-> SetTitle("P_{T out} (GeV/c)");
00516   h_ele_outerPt_mode        -> GetYaxis()-> SetTitle("Events");
00517   h_ele_EoP            -> GetXaxis()-> SetTitle("E/P_{vertex}");
00518   h_ele_EoP            -> GetYaxis()-> SetTitle("Events");
00519   h_ele_EseedOP            -> GetXaxis()-> SetTitle("E_{seed}/P_{vertex}");
00520   h_ele_EseedOP            -> GetYaxis()-> SetTitle("Events");
00521   h_ele_EoPout         -> GetXaxis()-> SetTitle("E_{seed}/P_{out}");
00522   h_ele_EoPout         -> GetYaxis()-> SetTitle("Events");
00523   h_ele_EeleOPout         -> GetXaxis()-> SetTitle("E_{ele}/P_{out}");
00524   h_ele_EeleOPout         -> GetYaxis()-> SetTitle("Events");
00525   h_ele_vertexX-> GetXaxis()-> SetTitle("x (cm)");
00526   h_ele_vertexX-> GetYaxis()-> SetTitle("Events");
00527   h_ele_vertexY-> GetXaxis()-> SetTitle("y (cm)");
00528   h_ele_vertexY-> GetYaxis()-> SetTitle("Events");
00529   h_ele_vertexZ-> GetXaxis()-> SetTitle("z (cm)");
00530   h_ele_vertexZ-> GetYaxis()-> SetTitle("Events");
00531   h_ele_vertexTIP-> GetXaxis()-> SetTitle("TIP (cm)");
00532   h_ele_vertexTIP-> GetYaxis()-> SetTitle("Events");
00533   h_ele_vertexTIPVsEta-> GetYaxis()-> SetTitle("TIP (cm)");
00534   h_ele_vertexTIPVsEta-> GetXaxis()-> SetTitle("#eta");
00535   h_ele_vertexTIPVsPhi-> GetYaxis()-> SetTitle("TIP (cm)");
00536   h_ele_vertexTIPVsPhi-> GetXaxis()-> SetTitle("#phi (rad)");
00537   h_ele_vertexTIPVsPt-> GetYaxis()-> SetTitle("TIP (cm)");
00538   h_ele_vertexTIPVsEta-> GetXaxis()-> SetTitle("p_{T} (GeV/c)");
00539   h_ele_dEtaSc_propVtx-> GetXaxis()-> SetTitle("#eta_{sc} - #eta_{tr}");
00540   h_ele_dEtaSc_propVtx-> GetYaxis()-> SetTitle("Events");
00541   h_ele_dEtaCl_propOut-> GetXaxis()-> SetTitle("#eta_{seedcl} - #eta_{tr}");
00542   h_ele_dEtaCl_propOut-> GetYaxis()-> SetTitle("Events");
00543   h_ele_dEtaEleCl_propOut-> GetXaxis()-> SetTitle("#eta_{elecl} - #eta_{tr}");
00544   h_ele_dEtaEleCl_propOut-> GetYaxis()-> SetTitle("Events");
00545   h_ele_dPhiSc_propVtx-> GetXaxis()-> SetTitle("#phi_{sc} - #phi_{tr} (rad)");
00546   h_ele_dPhiSc_propVtx-> GetYaxis()-> SetTitle("Events");
00547   h_ele_dPhiCl_propOut-> GetXaxis()-> SetTitle("#phi_{seedcl} - #phi_{tr} (rad)");
00548   h_ele_dPhiCl_propOut-> GetYaxis()-> SetTitle("Events");
00549   h_ele_dPhiEleCl_propOut-> GetXaxis()-> SetTitle("#phi_{elecl} - #phi_{tr} (rad)");
00550   h_ele_dPhiEleCl_propOut-> GetYaxis()-> SetTitle("Events");
00551   h_ele_HoE-> GetXaxis()-> SetTitle("H/E") ;
00552   h_ele_HoE-> GetYaxis()-> SetTitle("Events") ;
00553   h_ele_HoE_fiducial-> GetXaxis()-> SetTitle("H/E") ;
00554   h_ele_HoE_fiducial-> GetYaxis()-> SetTitle("Events") ;
00555   h_ele_fbrem-> GetXaxis()-> SetTitle("P_{in} - P_{out} / P_{in}");
00556   h_ele_fbrem-> GetYaxis()-> SetTitle("Events");
00557   h_ele_seed_dphi2_-> GetXaxis()-> SetTitle("#phi_{hit}-#phi_{pred} (rad)") ;
00558   h_ele_seed_dphi2_-> GetYaxis()-> SetTitle("Events") ;
00559   h_ele_seed_drz2_-> GetXaxis()-> SetTitle("r(z)_{hit}-r(z)_{pred} (cm)") ;
00560   h_ele_seed_drz2_-> GetYaxis()-> SetTitle("Events") ;
00561   h_ele_seed_subdet2_-> GetXaxis()-> SetTitle("2nd hit subdet Id") ;
00562   h_ele_seed_subdet2_-> GetYaxis()-> SetTitle("Events") ;
00563   h_ele_classes-> GetXaxis()-> SetTitle("class Id") ;
00564   h_ele_classes-> GetYaxis()-> SetTitle("Events") ;
00565   h_ele_mee_all-> GetXaxis()-> SetTitle("m_{ee} (GeV/c^{2})");
00566   h_ele_mee_all-> GetYaxis()-> SetTitle("Events");
00567   h_ele_mee_os-> GetXaxis()-> SetTitle("m_{e^{+}e^{-}} (GeV/c^{2})");
00568   h_ele_mee_os-> GetYaxis()-> SetTitle("Events");
00569   h_ele_mee_os_ebeb-> GetXaxis()-> SetTitle("m_{e^{+}e^{-}} (GeV/c^{2})");
00570   h_ele_mee_os_ebeb-> GetYaxis()-> SetTitle("Events");
00571   h_ele_mee_os_ebee-> GetXaxis()-> SetTitle("m_{e^{+}e^{-}} (GeV/c^{2})");
00572   h_ele_mee_os_ebee-> GetYaxis()-> SetTitle("Events");
00573   h_ele_mee_os_eeee-> GetXaxis()-> SetTitle("m_{e^{+}e^{-}} (GeV/c^{2})");
00574   h_ele_mee_os_eeee-> GetYaxis()-> SetTitle("Events");
00575   h_ele_mee_os_gg-> GetXaxis()-> SetTitle("m_{e^{+}e^{-}} (GeV/c^{2})");
00576   h_ele_mee_os_gg-> GetYaxis()-> SetTitle("Events");
00577   h_ele_mee_os_gb-> GetXaxis()-> SetTitle("m_{e^{+}e^{-}} (GeV/c^{2})");
00578   h_ele_mee_os_gb-> GetYaxis()-> SetTitle("Events");
00579   h_ele_mee_os_bb-> GetXaxis()-> SetTitle("m_{e^{+}e^{-}} (GeV/c^{2})");
00580   h_ele_mee_os_bb-> GetYaxis()-> SetTitle("Events");
00581   h_ele_E2mnE1vsMee_all-> GetXaxis()-> SetTitle("m_{e^{+}e^{-}} (GeV/c^{2})");
00582   h_ele_E2mnE1vsMee_all-> GetYaxis()-> SetTitle("E2 - E1 (GeV)");
00583   h_ele_E2mnE1vsMee_egeg_all-> GetXaxis()-> SetTitle("m_{e^{+}e^{-}} (GeV/c^{2})");
00584   h_ele_E2mnE1vsMee_egeg_all-> GetYaxis()-> SetTitle("E2 - E1 (GeV)");
00585   histNum_-> GetXaxis()-> SetTitle("N_{ele}");
00586   histNum_-> GetYaxis()-> SetTitle("Events");
00587   h_ele_fbremVsEta_mode-> GetXaxis()-> SetTitle("#eta");
00588   h_ele_fbremVsEta_mean-> GetXaxis()-> SetTitle("#eta");
00589 
00590 }
00591 
00592 void
00593 GsfElectronDataAnalyzer::endJob(){
00594 
00595   histfile_->cd();
00596   std::cout << "efficiency calculation " << std::endl;
00597   // efficiency vs eta
00598   TH1F *h_ele_etaEff = (TH1F*)h_ele_matchingObjectEta_matched->Clone("h_ele_etaEff");
00599   h_ele_etaEff->Reset();
00600   h_ele_etaEff->Divide(h_ele_matchingObjectEta_matched,h_matchingObjectEta,1,1,"b");
00601   h_ele_etaEff->Print();
00602   h_ele_etaEff->GetXaxis()->SetTitle("#eta");
00603   h_ele_etaEff->GetYaxis()->SetTitle("Efficiency");
00604 
00605   // efficiency vs z
00606   TH1F *h_ele_zEff = (TH1F*)h_ele_matchingObjectZ_matched->Clone("h_ele_zEff");
00607   h_ele_zEff->Reset();
00608   h_ele_zEff->Divide(h_ele_matchingObjectZ_matched,h_matchingObjectZ,1,1,"b");
00609   h_ele_zEff->Print();
00610   h_ele_zEff->GetXaxis()->SetTitle("z (cm)");
00611   h_ele_zEff->GetYaxis()->SetTitle("Efficiency");
00612 
00613   // efficiency vs |eta|
00614   TH1F *h_ele_absetaEff = (TH1F*)h_ele_matchingObjectAbsEta_matched->Clone("h_ele_absetaEff");
00615   h_ele_absetaEff->Reset();
00616   h_ele_absetaEff->Divide(h_ele_matchingObjectAbsEta_matched,h_matchingObjectAbsEta,1,1,"b");
00617   h_ele_absetaEff->GetXaxis()->SetTitle("|#eta|");
00618   h_ele_absetaEff->GetYaxis()->SetTitle("Efficiency");
00619 
00620   // efficiency vs pt
00621   TH1F *h_ele_ptEff = (TH1F*)h_ele_matchingObjectPt_matched->Clone("h_ele_ptEff");
00622   h_ele_ptEff->Reset();
00623   h_ele_ptEff->Divide(h_ele_matchingObjectPt_matched,h_matchingObjectPt,1,1,"b");
00624   h_ele_ptEff->GetXaxis()->SetTitle("p_{T} (GeV/c)");
00625   h_ele_ptEff->GetYaxis()->SetTitle("Efficiency");
00626 
00627   // efficiency vs phi
00628   TH1F *h_ele_phiEff = (TH1F*)h_ele_matchingObjectPhi_matched->Clone("h_ele_phiEff");
00629   h_ele_phiEff->Reset();
00630   h_ele_phiEff->Divide(h_ele_matchingObjectPhi_matched,h_matchingObjectPhi,1,1,"b");
00631   h_ele_phiEff->GetXaxis()->SetTitle("#phi (rad)");
00632   h_ele_phiEff->GetYaxis()->SetTitle("Efficiency");
00633 
00634   // classes
00635   TH1F *h_ele_eta_goldenFrac = (TH1F*)h_ele_eta_golden->Clone("h_ele_eta_goldenFrac");
00636   h_ele_eta_goldenFrac->Reset();
00637   h_ele_eta_goldenFrac->Divide(h_ele_eta_golden,h_ele_eta,1,1);
00638   h_ele_eta_goldenFrac->GetXaxis()->SetTitle("|#eta|");
00639   h_ele_eta_goldenFrac->GetYaxis()->SetTitle("Fraction of electrons");
00640   h_ele_eta_goldenFrac->SetTitle("fraction of golden electrons vs eta");
00641   TH1F *h_ele_eta_bbremFrac = (TH1F*)h_ele_eta_bbrem->Clone("h_ele_eta_bbremFrac");
00642   h_ele_eta_bbremFrac->Reset();
00643   h_ele_eta_bbremFrac->Divide(h_ele_eta_bbrem,h_ele_eta,1,1);
00644   h_ele_eta_bbremFrac->GetXaxis()->SetTitle("|#eta|");
00645   h_ele_eta_bbremFrac->GetYaxis()->SetTitle("Fraction of electrons");
00646   h_ele_eta_bbremFrac->SetTitle("fraction of big brem electrons vs eta");
00647   TH1F *h_ele_eta_narrowFrac = (TH1F*)h_ele_eta_narrow->Clone("h_ele_eta_narrowFrac");
00648   h_ele_eta_narrowFrac->Reset();
00649   h_ele_eta_narrowFrac->Divide(h_ele_eta_narrow,h_ele_eta,1,1);
00650   h_ele_eta_narrowFrac->GetXaxis()->SetTitle("|#eta|");
00651   h_ele_eta_narrowFrac->GetYaxis()->SetTitle("Fraction of electrons");
00652   h_ele_eta_narrowFrac->SetTitle("fraction of narrow electrons vs eta");
00653   TH1F *h_ele_eta_showerFrac = (TH1F*)h_ele_eta_shower->Clone("h_ele_eta_showerFrac");
00654   h_ele_eta_showerFrac->Reset();
00655   h_ele_eta_showerFrac->Divide(h_ele_eta_shower,h_ele_eta,1,1);
00656   h_ele_eta_showerFrac->GetXaxis()->SetTitle("|#eta|");
00657   h_ele_eta_showerFrac->GetYaxis()->SetTitle("Fraction of electrons");
00658   h_ele_eta_showerFrac->SetTitle("fraction of showering electrons vs eta");
00659 
00660   // fbrem
00661   TH1F *h_ele_xOverX0VsEta = new TH1F( "h_ele_xOverx0VsEta","mean X/X_0 vs eta",nbineta/2,0.0,2.5);
00662   for (int ibin=1;ibin<h_ele_fbremVsEta_mean->GetNbinsX()+1;ibin++) {
00663     double xOverX0 = 0.;
00664     if (h_ele_fbremVsEta_mean->GetBinContent(ibin)>0.) xOverX0 = -log(h_ele_fbremVsEta_mean->GetBinContent(ibin));
00665     h_ele_xOverX0VsEta->SetBinContent(ibin,xOverX0);
00666   }
00667 
00668   //profiles from 2D histos
00669   TProfile *p_ele_PoPmatchingObjectVsEta_matched = h_ele_PoPmatchingObjectVsEta_matched->ProfileX();
00670   p_ele_PoPmatchingObjectVsEta_matched->SetTitle("mean ele momentum / matching SC energy vs eta");
00671   p_ele_PoPmatchingObjectVsEta_matched->GetXaxis()->SetTitle("#eta");
00672   p_ele_PoPmatchingObjectVsEta_matched->GetYaxis()->SetTitle("<P/E_{matching SC}>");
00673   p_ele_PoPmatchingObjectVsEta_matched->Write();
00674   TProfile *p_ele_PoPmatchingObjectVsPhi_matched = h_ele_PoPmatchingObjectVsPhi_matched->ProfileX();
00675   p_ele_PoPmatchingObjectVsPhi_matched->SetTitle("mean ele momentum / gen momentum vs phi");
00676   p_ele_PoPmatchingObjectVsPhi_matched->GetXaxis()->SetTitle("#phi (rad)");
00677   p_ele_PoPmatchingObjectVsPhi_matched->GetYaxis()->SetTitle("<P/E_{matching SC}>");
00678   p_ele_PoPmatchingObjectVsPhi_matched->Write();
00679   TProfile *p_ele_EtaMnEtamatchingObjectVsEta_matched = h_ele_EtaMnEtamatchingObjectVsEta_matched->ProfileX();
00680   p_ele_EtaMnEtamatchingObjectVsEta_matched->GetXaxis()->SetTitle("#eta");
00681   p_ele_EtaMnEtamatchingObjectVsEta_matched->GetYaxis()->SetTitle("<#eta_{rec} - #eta_{matching SC}>");
00682   p_ele_EtaMnEtamatchingObjectVsEta_matched->Write();
00683   TProfile *p_ele_EtaMnEtamatchingObjectVsPhi_matched = h_ele_EtaMnEtamatchingObjectVsPhi_matched->ProfileX();
00684   p_ele_EtaMnEtamatchingObjectVsPhi_matched-> GetXaxis()-> SetTitle("#phi");
00685   p_ele_EtaMnEtamatchingObjectVsPhi_matched-> GetYaxis()-> SetTitle("<#eta_{rec} - #eta_{matching SC}>");
00686   p_ele_EtaMnEtamatchingObjectVsPhi_matched->Write();
00687   TProfile *p_ele_PhiMnPhimatchingObjectVsEta_matched = h_ele_PhiMnPhimatchingObjectVsEta_matched->ProfileX();
00688   p_ele_PhiMnPhimatchingObjectVsEta_matched-> GetXaxis()-> SetTitle("#eta");
00689   p_ele_PhiMnPhimatchingObjectVsEta_matched-> GetYaxis()-> SetTitle("<#phi_{rec} - #phi_{matching SC}> (rad)");
00690   p_ele_PhiMnPhimatchingObjectVsEta_matched->Write();
00691   TProfile *p_ele_PhiMnPhimatchingObjectVsPhi_matched = h_ele_PhiMnPhimatchingObjectVsPhi_matched->ProfileX();
00692   p_ele_PhiMnPhimatchingObjectVsPhi_matched-> GetXaxis()-> SetTitle("#phi");
00693   p_ele_PhiMnPhimatchingObjectVsPhi_matched-> GetYaxis()-> SetTitle("<#phi_{rec} - #phi_{matching SC}> (rad)");
00694   p_ele_PhiMnPhimatchingObjectVsPhi_matched->Write();
00695   TProfile *p_ele_vertexPtVsEta = h_ele_vertexPtVsEta->ProfileX();
00696   p_ele_vertexPtVsEta->GetXaxis()->SetTitle("#eta");
00697   p_ele_vertexPtVsEta->GetYaxis()->SetTitle("<p_{T}> (GeV/c)");
00698   p_ele_vertexPtVsEta->Write();
00699   TProfile *p_ele_vertexPtVsPhi = h_ele_vertexPtVsPhi->ProfileX();
00700   p_ele_vertexPtVsPhi->GetXaxis()->SetTitle("#phi (rad)");
00701   p_ele_vertexPtVsPhi->GetYaxis()->SetTitle("<p_{T}> (GeV/c)");
00702   p_ele_vertexPtVsPhi->Write();
00703   TProfile *p_ele_EoPVsEta = h_ele_EoPVsEta->ProfileX();
00704   p_ele_EoPVsEta->GetXaxis()->SetTitle("#eta");
00705   p_ele_EoPVsEta->GetYaxis()->SetTitle("<E/P_{vertex}>");
00706   p_ele_EoPVsEta->Write();
00707   TProfile *p_ele_EoPVsPhi = h_ele_EoPVsPhi->ProfileX();
00708   p_ele_EoPVsPhi->GetXaxis()->SetTitle("#phi (rad)");
00709   p_ele_EoPVsPhi->GetYaxis()->SetTitle("<E/P_{vertex}>");
00710   p_ele_EoPVsPhi->Write();
00711   TProfile *p_ele_EoPoutVsEta = h_ele_EoPoutVsEta->ProfileX();
00712   p_ele_EoPoutVsEta->GetXaxis()->SetTitle("#eta");
00713   p_ele_EoPoutVsEta->GetYaxis()->SetTitle("<E_{seed}/P_{out}>");
00714   p_ele_EoPoutVsEta->Write();
00715   TProfile *p_ele_EoPoutVsPhi = h_ele_EoPoutVsPhi->ProfileX();
00716   p_ele_EoPoutVsPhi->GetXaxis()->SetTitle("#phi (rad)");
00717   p_ele_EoPoutVsPhi->GetYaxis()->SetTitle("<E_{seed}/P_{out}>");
00718   p_ele_EoPoutVsPhi->Write();
00719   TProfile *p_ele_EeleOPoutVsEta = h_ele_EeleOPoutVsEta->ProfileX();
00720   p_ele_EeleOPoutVsEta->SetTitle("mean ele Eele/pout vs eta");
00721   p_ele_EeleOPoutVsEta->GetXaxis()->SetTitle("#eta");
00722   p_ele_EeleOPoutVsEta->GetYaxis()->SetTitle("<E_{ele}/P_{out}>");
00723   p_ele_EeleOPoutVsEta->Write();
00724   TProfile *p_ele_EeleOPoutVsPhi = h_ele_EeleOPoutVsPhi->ProfileX();
00725   p_ele_EeleOPoutVsPhi->SetTitle("mean ele Eele/pout vs phi");
00726   p_ele_EeleOPoutVsPhi->GetXaxis()->SetTitle("#phi (rad)");
00727   p_ele_EeleOPoutVsPhi->GetYaxis()->SetTitle("<E_{ele}/P_{out}>");
00728   p_ele_EeleOPoutVsPhi->Write();
00729   TProfile *p_ele_HoEVsEta = h_ele_HoEVsEta->ProfileX();
00730   p_ele_HoEVsEta->GetXaxis()->SetTitle("#eta");
00731   p_ele_HoEVsEta->GetYaxis()->SetTitle("<H/E>");
00732   p_ele_HoEVsEta->Write();
00733   TProfile *p_ele_HoEVsPhi = h_ele_HoEVsPhi->ProfileX();
00734   p_ele_HoEVsPhi->GetXaxis()->SetTitle("#phi (rad)");
00735   p_ele_HoEVsPhi->GetYaxis()->SetTitle("<H/E>");
00736   p_ele_HoEVsPhi->Write();
00737   TProfile *p_ele_chi2VsEta = h_ele_chi2VsEta->ProfileX();
00738   p_ele_chi2VsEta->GetXaxis()->SetTitle("#eta");
00739   p_ele_chi2VsEta->GetYaxis()->SetTitle("<#Chi^{2}>");
00740   p_ele_chi2VsEta->Write();
00741   TProfile *p_ele_chi2VsPhi = h_ele_chi2VsPhi->ProfileX();
00742   p_ele_chi2VsPhi->GetXaxis()->SetTitle("#phi (rad)");
00743   p_ele_chi2VsPhi->GetYaxis()->SetTitle("<#Chi^{2}>");
00744   p_ele_chi2VsPhi->Write();
00745   TProfile *p_ele_foundHitsVsEta = h_ele_foundHitsVsEta->ProfileX();
00746   p_ele_foundHitsVsEta->GetXaxis()->SetTitle("#eta");
00747   p_ele_foundHitsVsEta->GetYaxis()->SetTitle("<N_{hits}>");
00748   p_ele_foundHitsVsEta->Write();
00749   TProfile *p_ele_foundHitsVsPhi = h_ele_foundHitsVsPhi->ProfileX();
00750   p_ele_foundHitsVsPhi->GetXaxis()->SetTitle("#phi (rad)");
00751   p_ele_foundHitsVsPhi->GetYaxis()->SetTitle("<N_{hits}>");
00752   p_ele_foundHitsVsPhi->Write();
00753   TProfile *p_ele_lostHitsVsEta = h_ele_lostHitsVsEta->ProfileX();
00754   p_ele_lostHitsVsEta->GetXaxis()->SetTitle("#eta");
00755   p_ele_lostHitsVsEta->GetYaxis()->SetTitle("<N_{hits}>");
00756   p_ele_lostHitsVsEta->Write();
00757   TProfile *p_ele_lostHitsVsPhi = h_ele_lostHitsVsPhi->ProfileX();
00758   p_ele_lostHitsVsPhi->GetXaxis()->SetTitle("#phi (rad)");
00759   p_ele_lostHitsVsPhi->GetYaxis()->SetTitle("<N_{hits}>");
00760   p_ele_lostHitsVsPhi->Write();
00761   TProfile *p_ele_vertexTIPVsEta = h_ele_vertexTIPVsEta->ProfileX();
00762   p_ele_vertexTIPVsEta->SetTitle("mean tip (wrt gen vtx) vs eta");
00763   p_ele_vertexTIPVsEta->GetXaxis()->SetTitle("#eta");
00764   p_ele_vertexTIPVsEta->GetYaxis()->SetTitle("<TIP> (cm)");
00765   p_ele_vertexTIPVsEta->Write();
00766   TProfile *p_ele_vertexTIPVsPhi = h_ele_vertexTIPVsPhi->ProfileX();
00767   p_ele_vertexTIPVsPhi->SetTitle("mean tip (wrt gen vtx) vs phi");
00768   p_ele_vertexTIPVsPhi->GetXaxis()->SetTitle("#phi");
00769   p_ele_vertexTIPVsPhi->GetYaxis()->SetTitle("<TIP> (cm)");
00770   p_ele_vertexTIPVsPhi->Write();
00771   TProfile *p_ele_vertexTIPVsPt = h_ele_vertexTIPVsPt->ProfileX();
00772   p_ele_vertexTIPVsPt->SetTitle("mean tip (wrt gen vtx) vs phi");
00773   p_ele_vertexTIPVsPt->GetXaxis()->SetTitle("p_{T} (GeV/c)");
00774   p_ele_vertexTIPVsPt->GetYaxis()->SetTitle("<TIP> (cm)");
00775   p_ele_vertexTIPVsPt->Write();
00776 
00777   // mc truth
00778 
00779   h_matchingObjectNum->Write();
00780 
00781   // rec event
00782 
00783   histNum_->Write();
00784 
00785   // mc
00786   h_matchingObjectEta->Write();
00787   h_matchingObjectAbsEta->Write();
00788   h_matchingObjectP->Write();
00789   h_matchingObjectPt->Write();
00790   h_matchingObjectPhi->Write();
00791   h_matchingObjectZ->Write();
00792 
00793   h_ele_mee_all->Write();
00794   h_ele_mee_os->Write();
00795   h_ele_mee_os_ebeb->Write();
00796   h_ele_mee_os_ebee->Write();
00797   h_ele_mee_os_eeee->Write();
00798   h_ele_mee_os_gg->Write();
00799   h_ele_mee_os_gb->Write();
00800   h_ele_mee_os_bb->Write();
00801   h_ele_E2mnE1vsMee_all ->Write();
00802   h_ele_E2mnE1vsMee_egeg_all->Write();
00803 
00804   // matched electrons
00805   h_ele_charge->Write();
00806   h_ele_chargeVsEta->Write();
00807   h_ele_chargeVsPhi->Write();
00808   h_ele_chargeVsPt->Write();
00809   h_ele_vertexP->Write();
00810   h_ele_vertexPt->Write();
00811   h_ele_Et->Write();
00812   h_ele_vertexPtVsEta->Write();
00813   h_ele_vertexPtVsPhi->Write();
00814   h_ele_matchingObjectPt_matched->Write();
00815   h_ele_vertexEta->Write();
00816   h_ele_vertexEtaVsPhi->Write();
00817   h_ele_matchingObjectAbsEta_matched->Write();
00818   h_ele_matchingObjectEta_matched->Write();
00819   h_ele_matchingObjectPhi_matched->Write();
00820   h_ele_vertexPhi->Write();
00821   h_ele_vertexX->Write();
00822   h_ele_vertexY ->Write();
00823   h_ele_vertexZ->Write();
00824   h_ele_vertexTIP->Write();
00825   h_ele_matchingObjectZ_matched->Write();
00826   h_ele_vertexTIPVsEta->Write();
00827   h_ele_vertexTIPVsPhi->Write();
00828   h_ele_vertexTIPVsPt->Write();
00829   h_ele_PoPmatchingObject_matched->Write();
00830   h_ele_PtoPtmatchingObject_matched->Write();
00831   h_ele_PoPmatchingObjectVsEta_matched ->Write();
00832   h_ele_PoPmatchingObjectVsPhi_matched->Write();
00833   h_ele_PoPmatchingObjectVsPt_matched->Write();
00834   h_ele_PoPmatchingObject_barrel_matched ->Write();
00835   h_ele_PoPmatchingObject_endcaps_matched->Write();
00836   h_ele_PtoPtmatchingObject_barrel_matched ->Write();
00837   h_ele_PtoPtmatchingObject_endcaps_matched->Write();
00838   h_ele_EtaMnEtamatchingObject_matched->Write();
00839   h_ele_EtaMnEtamatchingObjectVsEta_matched ->Write();
00840   h_ele_EtaMnEtamatchingObjectVsPhi_matched->Write();
00841   h_ele_EtaMnEtamatchingObjectVsPt_matched->Write();
00842   h_ele_PhiMnPhimatchingObject_matched ->Write();
00843   h_ele_PhiMnPhimatchingObject2_matched ->Write();
00844   h_ele_PhiMnPhimatchingObjectVsEta_matched->Write();
00845   h_ele_PhiMnPhimatchingObjectVsPhi_matched->Write();
00846   h_ele_PhiMnPhimatchingObjectVsPt_matched->Write();
00847 
00848   // matched electron, superclusters
00849   histSclEn_->Write();
00850   histSclEoEmatchingObject_barrel_matched->Write();
00851   histSclEoEmatchingObject_endcaps_matched->Write();
00852   histSclEoEmatchingObject_barrel_new_matched->Write();
00853   histSclEoEmatchingObject_endcaps_new_matched->Write();
00854   histSclEt_->Write();
00855   histSclEtVsEta_->Write();
00856   histSclEtVsPhi_->Write();
00857   histSclEtaVsPhi_ ->Write();
00858   histSclEta_->Write();
00859   histSclPhi_->Write();
00860   histSclSigEtaEta_->Write();
00861   histSclSigIEtaIEta_barrel_->Write();
00862   histSclSigIEtaIEta_endcaps_->Write();
00863   histSclE1x5_->Write();
00864   histSclE1x5_barrel_->Write();
00865   histSclE1x5_endcaps_->Write();
00866   histSclE2x5max_->Write();
00867   histSclE2x5max_barrel_->Write();
00868   histSclE2x5max_endcaps_->Write();
00869   histSclE5x5_->Write();
00870   histSclE5x5_barrel_->Write();
00871   histSclE5x5_endcaps_->Write();
00872 
00873   // matched electron, gsf tracks
00874   h_ele_ambiguousTracks->Write();
00875   h_ele_ambiguousTracksVsEta->Write();
00876   h_ele_ambiguousTracksVsPhi->Write();
00877   h_ele_ambiguousTracksVsPt->Write();
00878   h_ele_foundHits->Write();
00879   h_ele_foundHitsVsEta->Write();
00880   h_ele_foundHitsVsPhi->Write();
00881   h_ele_foundHitsVsPt->Write();
00882   h_ele_lostHits->Write();
00883   h_ele_lostHitsVsEta->Write();
00884   h_ele_lostHitsVsPhi->Write();
00885   h_ele_lostHitsVsPt->Write();
00886   h_ele_chi2 ->Write();
00887   h_ele_chi2VsEta ->Write();
00888   h_ele_chi2VsPhi ->Write();
00889   h_ele_chi2VsPt->Write();
00890   h_ele_PinMnPout->Write();
00891   h_ele_PinMnPout_mode->Write();
00892   h_ele_PinMnPoutVsEta_mode->Write();
00893   h_ele_PinMnPoutVsPhi_mode->Write();
00894   h_ele_PinMnPoutVsPt_mode->Write();
00895   h_ele_PinMnPoutVsE_mode->Write();
00896   h_ele_PinMnPoutVsChi2_mode->Write();
00897   h_ele_outerP ->Write();
00898   h_ele_outerP_mode->Write();
00899   h_ele_outerPVsEta_mode->Write();
00900   h_ele_outerPt->Write();
00901   h_ele_outerPt_mode ->Write();
00902   h_ele_outerPtVsEta_mode->Write();
00903   h_ele_outerPtVsPhi_mode->Write();
00904   h_ele_outerPtVsPt_mode->Write();
00905 
00906   // matched electrons, matching
00907   h_ele_EoP ->Write();
00908   h_ele_EoPVsEta ->Write();
00909   h_ele_EoPVsPhi->Write();
00910   h_ele_EoPVsE->Write();
00911   h_ele_EseedOP ->Write();
00912   h_ele_EseedOPVsEta ->Write();
00913   h_ele_EseedOPVsPhi->Write();
00914   h_ele_EseedOPVsE->Write();
00915   h_ele_EoPout->Write();
00916   h_ele_EoPoutVsEta->Write();
00917   h_ele_EoPoutVsPhi->Write();
00918   h_ele_EoPoutVsE ->Write();
00919   h_ele_EeleOPout->Write();
00920   h_ele_EeleOPoutVsEta->Write();
00921   h_ele_EeleOPoutVsPhi->Write();
00922   h_ele_EeleOPoutVsE ->Write();
00923   h_ele_dEtaSc_propVtx->Write();
00924   h_ele_dEtaScVsEta_propVtx->Write();
00925   h_ele_dEtaScVsPhi_propVtx->Write();
00926   h_ele_dEtaScVsPt_propVtx ->Write();
00927   h_ele_dPhiSc_propVtx->Write();
00928   h_ele_dPhiScVsEta_propVtx ->Write();
00929   h_ele_dPhiScVsPhi_propVtx->Write();
00930   h_ele_dPhiScVsPt_propVtx->Write();
00931   h_ele_dEtaCl_propOut->Write();
00932   h_ele_dEtaClVsEta_propOut->Write();
00933   h_ele_dEtaClVsPhi_propOut->Write();
00934   h_ele_dEtaClVsPt_propOut->Write();
00935   h_ele_dPhiCl_propOut->Write();
00936   h_ele_dPhiClVsEta_propOut->Write();
00937   h_ele_dPhiClVsPhi_propOut->Write();
00938   h_ele_dPhiClVsPt_propOut->Write();
00939   h_ele_dEtaEleCl_propOut->Write();
00940   h_ele_dEtaEleClVsEta_propOut->Write();
00941   h_ele_dEtaEleClVsPhi_propOut->Write();
00942   h_ele_dEtaEleClVsPt_propOut->Write();
00943   h_ele_dPhiEleCl_propOut->Write();
00944   h_ele_dPhiEleClVsEta_propOut->Write();
00945   h_ele_dPhiEleClVsPhi_propOut->Write();
00946   h_ele_dPhiEleClVsPt_propOut->Write();
00947   h_ele_HoE->Write();
00948   h_ele_HoE_fiducial->Write();
00949   h_ele_HoEVsEta->Write();
00950   h_ele_HoEVsPhi->Write();
00951   h_ele_HoEVsE->Write();
00952 
00953   h_ele_seed_dphi2_->Write();
00954   h_ele_seed_subdet2_->Write();
00955   TProfile *p_ele_seed_dphi2VsEta_ = h_ele_seed_dphi2VsEta_->ProfileX();
00956   p_ele_seed_dphi2VsEta_->SetTitle("mean ele seed dphi 2nd layer vs eta");
00957   p_ele_seed_dphi2VsEta_->GetXaxis()->SetTitle("#eta");
00958   p_ele_seed_dphi2VsEta_->GetYaxis()->SetTitle("<#phi_{pred} - #phi_{hit}, 2nd layer> (rad)");
00959   p_ele_seed_dphi2VsEta_->SetMinimum(-0.004);
00960   p_ele_seed_dphi2VsEta_->SetMaximum(0.004);
00961   p_ele_seed_dphi2VsEta_->Write();
00962   TProfile *p_ele_seed_dphi2VsPt_ = h_ele_seed_dphi2VsPt_->ProfileX();
00963   p_ele_seed_dphi2VsPt_->SetTitle("mean ele seed dphi 2nd layer vs pt");
00964   p_ele_seed_dphi2VsPt_->GetXaxis()->SetTitle("p_{T} (GeV/c)");
00965   p_ele_seed_dphi2VsPt_->GetYaxis()->SetTitle("<#phi_{pred} - #phi_{hit}, 2nd layer> (rad)");
00966   p_ele_seed_dphi2VsPt_->Write();
00967   p_ele_seed_dphi2VsPt_->SetMinimum(-0.004);
00968   p_ele_seed_dphi2VsPt_->SetMaximum(0.004);
00969   h_ele_seed_drz2_->Write();
00970   TProfile *p_ele_seed_drz2VsEta_ = h_ele_seed_drz2VsEta_->ProfileX();
00971   p_ele_seed_drz2VsEta_->SetTitle("mean ele seed dr(dz) 2nd layer vs eta");
00972   p_ele_seed_drz2VsEta_->GetXaxis()->SetTitle("#eta");
00973   p_ele_seed_drz2VsEta_->GetYaxis()->SetTitle("<r(z)_{pred} - r(z)_{hit}, 2nd layer> (cm)");
00974   p_ele_seed_drz2VsEta_->SetMinimum(-0.15);
00975   p_ele_seed_drz2VsEta_->SetMaximum(0.15);
00976   p_ele_seed_drz2VsEta_->Write();
00977   TProfile *p_ele_seed_drz2VsPt_ = h_ele_seed_drz2VsPt_->ProfileX();
00978   p_ele_seed_drz2VsPt_->SetTitle("mean ele seed dr(dz) 2nd layer vs pt");
00979   p_ele_seed_drz2VsPt_->GetXaxis()->SetTitle("p_{T} (GeV/c)");
00980   p_ele_seed_drz2VsPt_->GetYaxis()->SetTitle("<r(z)_{pred} - r(z)_{hit}, 2nd layer> (cm)");
00981   p_ele_seed_drz2VsPt_->SetMinimum(-0.15);
00982   p_ele_seed_drz2VsPt_->SetMaximum(0.15);
00983   p_ele_seed_drz2VsPt_->Write();
00984 
00985   // classes
00986   h_ele_classes->Write();
00987   h_ele_eta->Write();
00988   h_ele_eta_golden->Write();
00989   h_ele_eta_bbrem->Write();
00990   h_ele_eta_narrow->Write();
00991   h_ele_eta_shower->Write();
00992   h_ele_PinVsPoutGolden_mode->Write();
00993   h_ele_PinVsPoutShowering_mode->Write();
00994   h_ele_PinVsPoutGolden_mean->Write();
00995   h_ele_PinVsPoutShowering_mean->Write();
00996   h_ele_PtinVsPtoutGolden_mode->Write();
00997   h_ele_PtinVsPtoutShowering_mode->Write();
00998   h_ele_PtinVsPtoutGolden_mean->Write();
00999   h_ele_PtinVsPtoutShowering_mean->Write();
01000   histSclEoEmatchingObjectGolden_barrel->Write();
01001   histSclEoEmatchingObjectGolden_endcaps->Write();
01002   histSclEoEmatchingObjectShowering_barrel->Write();
01003   histSclEoEmatchingObjectShowering_endcaps->Write();
01004 
01005   // fbrem
01006   h_ele_fbrem->Write();
01007   h_ele_fbremVsEta_mode->Write();
01008   h_ele_fbremVsEta_mean->Write();
01009   h_ele_etaEff->Write();
01010   h_ele_zEff->Write();
01011   h_ele_phiEff->Write();
01012   h_ele_absetaEff->Write();
01013   h_ele_ptEff->Write();
01014   h_ele_eta_goldenFrac->Write();
01015   h_ele_eta_bbremFrac->Write();
01016   h_ele_eta_narrowFrac->Write();
01017   h_ele_eta_showerFrac->Write();
01018   h_ele_xOverX0VsEta->Write();
01019 
01020   // e/g et pflow electrons
01021   h_ele_mva->Write();
01022   h_ele_provenance->Write();
01023 
01024   // isolation
01025   h_ele_tkSumPt_dr03->GetXaxis()->SetTitle("TkIsoSum, cone 0.3 (GeV/c)");
01026   h_ele_tkSumPt_dr03->GetYaxis()->SetTitle("Events");
01027   h_ele_tkSumPt_dr03->Write();
01028   h_ele_ecalRecHitSumEt_dr03->GetXaxis()->SetTitle("EcalIsoSum, cone 0.3 (GeV)");
01029   h_ele_ecalRecHitSumEt_dr03->GetYaxis()->SetTitle("Events");
01030   h_ele_ecalRecHitSumEt_dr03->Write();
01031   h_ele_hcalDepth1TowerSumEt_dr03->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.3 (GeV)");
01032   h_ele_hcalDepth1TowerSumEt_dr03->GetYaxis()->SetTitle("Events");
01033   h_ele_hcalDepth1TowerSumEt_dr03->Write();
01034   h_ele_hcalDepth2TowerSumEt_dr03->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.3 (GeV)");
01035   h_ele_hcalDepth2TowerSumEt_dr03->GetYaxis()->SetTitle("Events");
01036   h_ele_hcalDepth2TowerSumEt_dr03->Write();
01037   h_ele_tkSumPt_dr04->GetXaxis()->SetTitle("TkIsoSum, cone 0.4 (GeV/c)");
01038   h_ele_tkSumPt_dr04->GetYaxis()->SetTitle("Events");
01039   h_ele_tkSumPt_dr04->Write();
01040   h_ele_ecalRecHitSumEt_dr04->GetXaxis()->SetTitle("EcalIsoSum, cone 0.4 (GeV)");
01041   h_ele_ecalRecHitSumEt_dr04->GetYaxis()->SetTitle("Events");
01042   h_ele_ecalRecHitSumEt_dr04->Write();
01043   h_ele_hcalDepth1TowerSumEt_dr04->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.4 (GeV)");
01044   h_ele_hcalDepth1TowerSumEt_dr04->GetYaxis()->SetTitle("Events");
01045   h_ele_hcalDepth1TowerSumEt_dr04->Write();
01046   h_ele_hcalDepth2TowerSumEt_dr04->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.4 (GeV)");
01047   h_ele_hcalDepth2TowerSumEt_dr04->GetYaxis()->SetTitle("Events");
01048   h_ele_hcalDepth2TowerSumEt_dr04->Write();
01049 
01050 
01051 }
01052 
01053 void
01054 GsfElectronDataAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
01055 {
01056 
01057   std::cout << "analyzing new event " << std::endl;
01058   nEvents_++;
01059 
01060   // check event pass requested triggers if any
01061   if (!trigger(iEvent)) return;
01062 
01063   std::cout << "new event passing trigger " << std::endl;
01064   nAfterTrigger_++;
01065 
01066   // get reco electrons
01067   edm::Handle<reco::GsfElectronCollection> gsfElectrons;
01068   iEvent.getByLabel(electronCollection_,gsfElectrons);
01069   edm::LogInfo("")<<"\n\n =================> Treating event "<<iEvent.id()<<" Number of electrons "<<gsfElectrons.product()->size();
01070 
01071   // get reco supercluster collection
01072   edm::Handle<reco::SuperClusterCollection> recoClusters;
01073   iEvent.getByLabel(matchingObjectCollection_,recoClusters);
01074 
01075   // get the beamspot from the Event:
01076   edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
01077   iEvent.getByType(recoBeamSpotHandle);
01078   const BeamSpot bs = *recoBeamSpotHandle;
01079 
01080   histNum_->Fill((*gsfElectrons).size());
01081 
01082   // selected rec electrons
01083   for (reco::GsfElectronCollection::const_iterator gsfIter=gsfElectrons->begin();
01084    gsfIter!=gsfElectrons->end(); gsfIter++){
01085 
01086         // select electrons
01087         if (gsfIter->superCluster()->energy()/cosh(gsfIter->superCluster()->eta())<minEt_) continue;
01088         if (std::abs(gsfIter->eta())>maxAbsEta_) continue;
01089         if (gsfIter->pt()<minPt_) continue;
01090 
01091         if (gsfIter->isEB() && isEE_) continue;
01092         if (gsfIter->isEE() && isEB_) continue;
01093         if (gsfIter->isEBEEGap() && isNotEBEEGap_) continue;
01094 
01095         if (gsfIter->ecalDrivenSeed() && isTrackerDriven_) continue;
01096         if (gsfIter->trackerDrivenSeed() && isEcalDriven_) continue;
01097 
01098         if (gsfIter->isEB() && gsfIter->eSuperClusterOverP() < eOverPMinBarrel_) continue;
01099         if (gsfIter->isEB() && gsfIter->eSuperClusterOverP() > eOverPMaxBarrel_) continue;
01100         if (gsfIter->isEE() && gsfIter->eSuperClusterOverP() < eOverPMinEndcaps_) continue;
01101         if (gsfIter->isEE() && gsfIter->eSuperClusterOverP() > eOverPMaxEndcaps_) continue;
01102         if (gsfIter->isEB() && std::abs(gsfIter->deltaEtaSuperClusterTrackAtVtx()) < dEtaMinBarrel_) continue;
01103         if (gsfIter->isEB() && std::abs(gsfIter->deltaEtaSuperClusterTrackAtVtx()) > dEtaMaxBarrel_) continue;
01104         if (gsfIter->isEE() && std::abs(gsfIter->deltaEtaSuperClusterTrackAtVtx()) < dEtaMinEndcaps_) continue;
01105         if (gsfIter->isEE() && std::abs(gsfIter->deltaEtaSuperClusterTrackAtVtx()) > dEtaMaxEndcaps_) continue;
01106         if (gsfIter->isEB() && std::abs(gsfIter->deltaPhiSuperClusterTrackAtVtx()) < dPhiMinBarrel_) continue;
01107         if (gsfIter->isEB() && std::abs(gsfIter->deltaPhiSuperClusterTrackAtVtx()) > dPhiMaxBarrel_) continue;
01108         if (gsfIter->isEE() && std::abs(gsfIter->deltaPhiSuperClusterTrackAtVtx()) < dPhiMinEndcaps_) continue;
01109         if (gsfIter->isEE() && std::abs(gsfIter->deltaPhiSuperClusterTrackAtVtx()) > dPhiMaxEndcaps_) continue;
01110         if (gsfIter->isEB() && gsfIter->scSigmaIEtaIEta() < sigIetaIetaMinBarrel_) continue;
01111         if (gsfIter->isEB() && gsfIter->scSigmaIEtaIEta() > sigIetaIetaMaxBarrel_) continue;
01112         if (gsfIter->isEE() && gsfIter->scSigmaIEtaIEta() < sigIetaIetaMinEndcaps_) continue;
01113         if (gsfIter->isEE() && gsfIter->scSigmaIEtaIEta() > sigIetaIetaMaxEndcaps_) continue;
01114         if (gsfIter->isEB() && gsfIter->hadronicOverEm() > hadronicOverEmMaxBarrel_) continue;
01115         if (gsfIter->isEE() && gsfIter->hadronicOverEm() > hadronicOverEmMaxEndcaps_) continue;
01116         if (gsfIter->mva() < mvaMin_) continue;
01117 
01118         double d = (gsfIter->vertex().x()-bs.position().x())
01119                   *(gsfIter->vertex().x()-bs.position().x())+
01120                    (gsfIter->vertex().y()-bs.position().y())
01121                   *(gsfIter->vertex().y()-bs.position().y());
01122         d = sqrt(d);
01123         if (gsfIter->isEB() && d > tipMaxBarrel_) continue;
01124         if (gsfIter->isEE() && d > tipMaxEndcaps_) continue;
01125 
01126         if (gsfIter->dr03TkSumPt() > tkIso03Max_) continue;
01127         if (gsfIter->isEB() && gsfIter->dr03HcalDepth1TowerSumEt() > hcalIso03Depth1MaxBarrel_) continue;
01128         if (gsfIter->isEE() && gsfIter->dr03HcalDepth1TowerSumEt() > hcalIso03Depth1MaxEndcaps_) continue;
01129         if (gsfIter->isEE() && gsfIter->dr03HcalDepth2TowerSumEt() > hcalIso03Depth2MaxEndcaps_) continue;
01130         if (gsfIter->isEB() && gsfIter->dr03EcalRecHitSumEt() > ecalIso03MaxBarrel_) continue;
01131         if (gsfIter->isEE() && gsfIter->dr03EcalRecHitSumEt() > ecalIso03MaxEndcaps_) continue;
01132 
01133         // electron related distributions
01134         h_ele_charge        -> Fill( gsfIter->charge() );
01135         h_ele_chargeVsEta        -> Fill( gsfIter->eta(),gsfIter->charge() );
01136         h_ele_chargeVsPhi        -> Fill( gsfIter->phi(),gsfIter->charge() );
01137         h_ele_chargeVsPt        -> Fill( gsfIter->pt(),gsfIter->charge() );
01138         h_ele_vertexP       -> Fill( gsfIter->p() );
01139         h_ele_vertexPt      -> Fill( gsfIter->pt() );
01140         h_ele_Et      -> Fill( gsfIter->superCluster()->energy()/cosh( gsfIter->superCluster()->eta()) );
01141         h_ele_vertexPtVsEta      -> Fill(  gsfIter->eta(),gsfIter->pt() );
01142         h_ele_vertexPtVsPhi      -> Fill(  gsfIter->phi(),gsfIter->pt() );
01143         h_ele_vertexEta     -> Fill( gsfIter->eta() );
01144 
01145         h_ele_vertexEtaVsPhi     -> Fill(  gsfIter->phi(),gsfIter->eta() );
01146         h_ele_vertexPhi     -> Fill( gsfIter->phi() );
01147         h_ele_vertexX     -> Fill( gsfIter->vertex().x() );
01148         h_ele_vertexY     -> Fill( gsfIter->vertex().y() );
01149         h_ele_vertexZ     -> Fill( gsfIter->vertex().z() );
01150         h_ele_vertexTIP     -> Fill( d );
01151         h_ele_vertexTIPVsEta     -> Fill(  gsfIter->eta(), d );
01152         h_ele_vertexTIPVsPhi     -> Fill(  gsfIter->phi(), d );
01153         h_ele_vertexTIPVsPt     -> Fill(  gsfIter->pt(), d );
01154 
01155         // supercluster related distributions
01156         reco::SuperClusterRef sclRef = gsfIter->superCluster();
01157         if (!gsfIter->ecalDrivenSeed()&&gsfIter->trackerDrivenSeed()) sclRef = gsfIter->pflowSuperCluster();
01158         histSclEn_->Fill(sclRef->energy());
01159         double R=TMath::Sqrt(sclRef->x()*sclRef->x() + sclRef->y()*sclRef->y() +sclRef->z()*sclRef->z());
01160         double Rt=TMath::Sqrt(sclRef->x()*sclRef->x() + sclRef->y()*sclRef->y());
01161         histSclEt_->Fill(sclRef->energy()*(Rt/R));
01162         histSclEtVsEta_->Fill(sclRef->eta(),sclRef->energy()*(Rt/R));
01163         histSclEtVsPhi_->Fill(sclRef->phi(),sclRef->energy()*(Rt/R));
01164         histSclEta_->Fill(sclRef->eta());
01165         histSclEtaVsPhi_->Fill(sclRef->phi(),sclRef->eta());
01166         histSclPhi_->Fill(sclRef->phi());
01167         histSclSigEtaEta_->Fill(gsfIter->scSigmaEtaEta());
01168         if (gsfIter->isEB()) histSclSigIEtaIEta_barrel_->Fill(gsfIter->scSigmaIEtaIEta());
01169         if (gsfIter->isEE()) histSclSigIEtaIEta_endcaps_->Fill(gsfIter->scSigmaIEtaIEta());
01170         histSclE1x5_->Fill(gsfIter->scE1x5());
01171         if (gsfIter->isEB()) histSclE1x5_barrel_->Fill(gsfIter->scE1x5());
01172         if (gsfIter->isEE()) histSclE1x5_endcaps_->Fill(gsfIter->scE1x5());
01173         histSclE2x5max_->Fill(gsfIter->scE2x5Max());
01174         if (gsfIter->isEB()) histSclE2x5max_barrel_->Fill(gsfIter->scE2x5Max());
01175         if (gsfIter->isEE()) histSclE2x5max_endcaps_->Fill(gsfIter->scE2x5Max());
01176         histSclE5x5_->Fill(gsfIter->scE5x5());
01177         if (gsfIter->isEB()) histSclE5x5_barrel_->Fill(gsfIter->scE5x5());
01178         if (gsfIter->isEE()) histSclE5x5_endcaps_->Fill(gsfIter->scE5x5());
01179 
01180         // track related distributions
01181         h_ele_ambiguousTracks     -> Fill( gsfIter->ambiguousGsfTracksSize() );
01182         h_ele_ambiguousTracksVsEta     -> Fill( gsfIter->eta(), gsfIter->ambiguousGsfTracksSize() );
01183         h_ele_ambiguousTracksVsPhi     -> Fill( gsfIter->phi(), gsfIter->ambiguousGsfTracksSize() );
01184         h_ele_ambiguousTracksVsPt     -> Fill( gsfIter->pt(), gsfIter->ambiguousGsfTracksSize() );
01185         if (!readAOD_) { // track extra does not exist in AOD
01186           h_ele_foundHits     -> Fill( gsfIter->gsfTrack()->numberOfValidHits() );
01187           h_ele_foundHitsVsEta     -> Fill( gsfIter->eta(), gsfIter->gsfTrack()->numberOfValidHits() );
01188           h_ele_foundHitsVsPhi     -> Fill( gsfIter->phi(), gsfIter->gsfTrack()->numberOfValidHits() );
01189           h_ele_foundHitsVsPt     -> Fill( gsfIter->pt(), gsfIter->gsfTrack()->numberOfValidHits() );
01190           h_ele_lostHits      -> Fill( gsfIter->gsfTrack()->numberOfLostHits() );
01191           h_ele_lostHitsVsEta      -> Fill( gsfIter->eta(), gsfIter->gsfTrack()->numberOfLostHits() );
01192           h_ele_lostHitsVsPhi      -> Fill( gsfIter->phi(), gsfIter->gsfTrack()->numberOfLostHits() );
01193           h_ele_lostHitsVsPt      -> Fill( gsfIter->pt(), gsfIter->gsfTrack()->numberOfLostHits() );
01194           h_ele_chi2          -> Fill( gsfIter->gsfTrack()->normalizedChi2() );
01195           h_ele_chi2VsEta          -> Fill( gsfIter->eta(), gsfIter->gsfTrack()->normalizedChi2() );
01196           h_ele_chi2VsPhi          -> Fill( gsfIter->phi(), gsfIter->gsfTrack()->normalizedChi2() );
01197           h_ele_chi2VsPt          -> Fill( gsfIter->pt(), gsfIter->gsfTrack()->normalizedChi2() );
01198         }
01199         // from gsf track interface, hence using mean
01200         if (!readAOD_) { // track extra does not exist in AOD
01201           h_ele_PinMnPout     -> Fill( gsfIter->gsfTrack()->innerMomentum().R() - gsfIter->gsfTrack()->outerMomentum().R() );
01202           h_ele_outerP        -> Fill( gsfIter->gsfTrack()->outerMomentum().R() );
01203           h_ele_outerPt       -> Fill( gsfIter->gsfTrack()->outerMomentum().Rho() );
01204         }
01205         // from electron interface, hence using mode
01206         h_ele_PinMnPout_mode     -> Fill( gsfIter->trackMomentumAtVtx().R() - gsfIter->trackMomentumOut().R() );
01207         h_ele_PinMnPoutVsEta_mode     -> Fill(  gsfIter->eta(), gsfIter->trackMomentumAtVtx().R() - gsfIter->trackMomentumOut().R() );
01208         h_ele_PinMnPoutVsPhi_mode     -> Fill(  gsfIter->phi(), gsfIter->trackMomentumAtVtx().R() - gsfIter->trackMomentumOut().R() );
01209         h_ele_PinMnPoutVsPt_mode     -> Fill(  gsfIter->pt(), gsfIter->trackMomentumAtVtx().R() - gsfIter->trackMomentumOut().R() );
01210         h_ele_PinMnPoutVsE_mode     -> Fill(  gsfIter->caloEnergy(), gsfIter->trackMomentumAtVtx().R() - gsfIter->trackMomentumOut().R() );
01211         if (!readAOD_)  // track extra does not exist in AOD
01212          h_ele_PinMnPoutVsChi2_mode     -> Fill(  gsfIter->gsfTrack()->normalizedChi2(), gsfIter->trackMomentumAtVtx().R() - gsfIter->trackMomentumOut().R() );
01213         h_ele_outerP_mode        -> Fill( gsfIter->trackMomentumOut().R() );
01214         h_ele_outerPVsEta_mode        -> Fill(gsfIter->eta(),  gsfIter->trackMomentumOut().R() );
01215         h_ele_outerPt_mode       -> Fill( gsfIter->trackMomentumOut().Rho() );
01216         h_ele_outerPtVsEta_mode       -> Fill(gsfIter->eta(),  gsfIter->trackMomentumOut().Rho() );
01217         h_ele_outerPtVsPhi_mode       -> Fill(gsfIter->phi(),  gsfIter->trackMomentumOut().Rho() );
01218         h_ele_outerPtVsPt_mode       -> Fill(gsfIter->pt(),  gsfIter->trackMomentumOut().Rho() );
01219 
01220         if (!readAOD_) { // track extra does not exist in AOD
01221           edm::RefToBase<TrajectorySeed> seed = gsfIter->gsfTrack()->extra()->seedRef();
01222           ElectronSeedRef elseed=seed.castTo<ElectronSeedRef>();
01223           h_ele_seed_dphi2_-> Fill(elseed->dPhi2());
01224           h_ele_seed_dphi2VsEta_-> Fill(gsfIter->eta(), elseed->dPhi2());
01225           h_ele_seed_dphi2VsPt_-> Fill(gsfIter->pt(), elseed->dPhi2()) ;
01226           h_ele_seed_drz2_-> Fill(elseed->dRz2());
01227           h_ele_seed_drz2VsEta_-> Fill(gsfIter->eta(), elseed->dRz2());
01228           h_ele_seed_drz2VsPt_-> Fill(gsfIter->pt(), elseed->dRz2());
01229           h_ele_seed_subdet2_-> Fill(elseed->subDet2());
01230         }
01231         // match distributions
01232         h_ele_EoP    -> Fill( gsfIter->eSuperClusterOverP() );
01233         h_ele_EoPVsEta    -> Fill(gsfIter->eta(),  gsfIter->eSuperClusterOverP() );
01234         h_ele_EoPVsPhi    -> Fill(gsfIter->phi(),  gsfIter->eSuperClusterOverP() );
01235         h_ele_EoPVsE    -> Fill(gsfIter->caloEnergy(),  gsfIter->eSuperClusterOverP() );
01236         h_ele_EseedOP    -> Fill( gsfIter->eSeedClusterOverP() );
01237         h_ele_EseedOPVsEta    -> Fill(gsfIter->eta(),  gsfIter->eSeedClusterOverP() );
01238         h_ele_EseedOPVsPhi    -> Fill(gsfIter->phi(),  gsfIter->eSeedClusterOverP() );
01239         h_ele_EseedOPVsE    -> Fill(gsfIter->caloEnergy(),  gsfIter->eSeedClusterOverP() );
01240         h_ele_EoPout -> Fill( gsfIter->eSeedClusterOverPout() );
01241         h_ele_EoPoutVsEta -> Fill( gsfIter->eta(), gsfIter->eSeedClusterOverPout() );
01242         h_ele_EoPoutVsPhi -> Fill( gsfIter->phi(), gsfIter->eSeedClusterOverPout() );
01243         h_ele_EoPoutVsE -> Fill( gsfIter->caloEnergy(), gsfIter->eSeedClusterOverPout() );
01244         h_ele_EeleOPout -> Fill( gsfIter->eEleClusterOverPout() );
01245         h_ele_EeleOPoutVsEta -> Fill( gsfIter->eta(), gsfIter->eEleClusterOverPout() );
01246         h_ele_EeleOPoutVsPhi -> Fill( gsfIter->phi(), gsfIter->eEleClusterOverPout() );
01247         h_ele_EeleOPoutVsE -> Fill( gsfIter->caloEnergy(), gsfIter->eEleClusterOverPout() );
01248         h_ele_dEtaSc_propVtx -> Fill(gsfIter->deltaEtaSuperClusterTrackAtVtx());
01249         h_ele_dEtaScVsEta_propVtx -> Fill( gsfIter->eta(),gsfIter->deltaEtaSuperClusterTrackAtVtx());
01250         h_ele_dEtaScVsPhi_propVtx -> Fill(gsfIter->phi(),gsfIter->deltaEtaSuperClusterTrackAtVtx());
01251         h_ele_dEtaScVsPt_propVtx -> Fill(gsfIter->pt(),gsfIter->deltaEtaSuperClusterTrackAtVtx());
01252         h_ele_dPhiSc_propVtx -> Fill(gsfIter->deltaPhiSuperClusterTrackAtVtx());
01253         h_ele_dPhiScVsEta_propVtx -> Fill( gsfIter->eta(),gsfIter->deltaPhiSuperClusterTrackAtVtx());
01254         h_ele_dPhiScVsPhi_propVtx -> Fill(gsfIter->phi(),gsfIter->deltaPhiSuperClusterTrackAtVtx());
01255         h_ele_dPhiScVsPt_propVtx -> Fill(gsfIter->pt(),gsfIter->deltaPhiSuperClusterTrackAtVtx());
01256         h_ele_dEtaCl_propOut -> Fill(gsfIter->deltaEtaSeedClusterTrackAtCalo());
01257         h_ele_dEtaClVsEta_propOut -> Fill( gsfIter->eta(),gsfIter->deltaEtaSeedClusterTrackAtCalo());
01258         h_ele_dEtaClVsPhi_propOut -> Fill(gsfIter->phi(),gsfIter->deltaEtaSeedClusterTrackAtCalo());
01259         h_ele_dEtaClVsPt_propOut -> Fill(gsfIter->pt(),gsfIter->deltaEtaSeedClusterTrackAtCalo());
01260         h_ele_dPhiCl_propOut -> Fill(gsfIter->deltaPhiSeedClusterTrackAtCalo());
01261         h_ele_dPhiClVsEta_propOut -> Fill( gsfIter->eta(),gsfIter->deltaPhiSeedClusterTrackAtCalo());
01262         h_ele_dPhiClVsPhi_propOut -> Fill(gsfIter->phi(),gsfIter->deltaPhiSeedClusterTrackAtCalo());
01263         h_ele_dPhiClVsPt_propOut -> Fill(gsfIter->pt(),gsfIter->deltaPhiSeedClusterTrackAtCalo());
01264         h_ele_dEtaEleCl_propOut -> Fill(gsfIter->deltaEtaEleClusterTrackAtCalo());
01265         h_ele_dEtaEleClVsEta_propOut -> Fill( gsfIter->eta(),gsfIter->deltaEtaEleClusterTrackAtCalo());
01266         h_ele_dEtaEleClVsPhi_propOut -> Fill(gsfIter->phi(),gsfIter->deltaEtaEleClusterTrackAtCalo());
01267         h_ele_dEtaEleClVsPt_propOut -> Fill(gsfIter->pt(),gsfIter->deltaEtaEleClusterTrackAtCalo());
01268         h_ele_dPhiEleCl_propOut -> Fill(gsfIter->deltaPhiEleClusterTrackAtCalo());
01269         h_ele_dPhiEleClVsEta_propOut -> Fill( gsfIter->eta(),gsfIter->deltaPhiEleClusterTrackAtCalo());
01270         h_ele_dPhiEleClVsPhi_propOut -> Fill(gsfIter->phi(),gsfIter->deltaPhiEleClusterTrackAtCalo());
01271         h_ele_dPhiEleClVsPt_propOut -> Fill(gsfIter->pt(),gsfIter->deltaPhiEleClusterTrackAtCalo());
01272         h_ele_HoE -> Fill(gsfIter->hadronicOverEm());
01273         if (!gsfIter->isEBEtaGap() && !gsfIter->isEBPhiGap()&& !gsfIter->isEBEEGap() &&
01274             !gsfIter->isEERingGap() && !gsfIter->isEEDeeGap()) h_ele_HoE_fiducial -> Fill(gsfIter->hadronicOverEm());
01275         h_ele_HoEVsEta -> Fill( gsfIter->eta(),gsfIter->hadronicOverEm());
01276         h_ele_HoEVsPhi -> Fill(gsfIter->phi(),gsfIter->hadronicOverEm());
01277         h_ele_HoEVsE -> Fill(gsfIter->caloEnergy(),gsfIter->hadronicOverEm());
01278 
01279         //classes
01280         int eleClass = gsfIter->classification();
01281         if (gsfIter->isEE()) eleClass+=10;
01282         h_ele_classes ->Fill(eleClass);
01283 
01284   h_ele_eta->Fill(std::abs(gsfIter->eta()));
01285   if (gsfIter->classification() == GsfElectron::GOLDEN) h_ele_eta_golden ->Fill(std::abs(gsfIter->eta()));
01286   if (gsfIter->classification() == GsfElectron::BIGBREM) h_ele_eta_bbrem ->Fill(std::abs(gsfIter->eta()));
01287   //if (gsfIter->classification() == GsfElectron::OLDNARROW) h_ele_eta_narrow ->Fill(std::abs(gsfIter->eta()));
01288   if (gsfIter->classification() == GsfElectron::SHOWERING) h_ele_eta_shower ->Fill(std::abs(gsfIter->eta()));
01289 
01290         //fbrem
01291         double fbrem_mean=0.;
01292         if (!readAOD_) // track extra does not exist in AOD
01293          fbrem_mean =  1. - gsfIter->gsfTrack()->outerMomentum().R()/gsfIter->gsfTrack()->innerMomentum().R();
01294         double fbrem_mode =  gsfIter->fbrem();
01295         h_ele_fbrem->Fill(fbrem_mode);
01296         h_ele_fbremVsEta_mode->Fill(gsfIter->eta(),fbrem_mode);
01297         if (!readAOD_) // track extra does not exist in AOD
01298          h_ele_fbremVsEta_mean->Fill(gsfIter->eta(),fbrem_mean);
01299 
01300         if (gsfIter->classification() == GsfElectron::GOLDEN) h_ele_PinVsPoutGolden_mode -> Fill(gsfIter->trackMomentumOut().R(), gsfIter->trackMomentumAtVtx().R());
01301         if (gsfIter->classification() == GsfElectron::SHOWERING)
01302          h_ele_PinVsPoutShowering_mode -> Fill(gsfIter->trackMomentumOut().R(), gsfIter->trackMomentumAtVtx().R());
01303         if (!readAOD_) // track extra does not exist in AOD
01304          if (gsfIter->classification() == GsfElectron::GOLDEN) h_ele_PinVsPoutGolden_mean -> Fill(gsfIter->gsfTrack()->outerMomentum().R(), gsfIter->gsfTrack()->innerMomentum().R());
01305         if (!readAOD_) // track extra does not exist in AOD
01306          if (gsfIter->classification() == GsfElectron::SHOWERING)
01307           h_ele_PinVsPoutShowering_mean ->  Fill(gsfIter->gsfTrack()->outerMomentum().R(), gsfIter->gsfTrack()->innerMomentum().R());
01308         if (gsfIter->classification() == GsfElectron::GOLDEN) h_ele_PtinVsPtoutGolden_mode -> Fill(gsfIter->trackMomentumOut().Rho(), gsfIter->trackMomentumAtVtx().Rho());
01309         if (gsfIter->classification() == GsfElectron::SHOWERING)
01310          h_ele_PtinVsPtoutShowering_mode -> Fill(gsfIter->trackMomentumOut().Rho(), gsfIter->trackMomentumAtVtx().Rho());
01311         if (!readAOD_) // track extra does not exist in AOD
01312          if (gsfIter->classification() == GsfElectron::GOLDEN) h_ele_PtinVsPtoutGolden_mean -> Fill(gsfIter->gsfTrack()->outerMomentum().Rho(), gsfIter->gsfTrack()->innerMomentum().Rho());
01313         if (!readAOD_) // track extra does not exist in AOD
01314          if (gsfIter->classification() == GsfElectron::SHOWERING)
01315           h_ele_PtinVsPtoutShowering_mean ->  Fill(gsfIter->gsfTrack()->outerMomentum().Rho(), gsfIter->gsfTrack()->innerMomentum().Rho());
01316 
01317         h_ele_mva->Fill(gsfIter->mva());
01318         if (gsfIter->ecalDrivenSeed()) h_ele_provenance->Fill(1.);
01319         if (gsfIter->trackerDrivenSeed()) h_ele_provenance->Fill(-1.);
01320         if (gsfIter->trackerDrivenSeed()||gsfIter->ecalDrivenSeed()) h_ele_provenance->Fill(0.);
01321         if (gsfIter->trackerDrivenSeed()&&!gsfIter->ecalDrivenSeed()) h_ele_provenance->Fill(-2.);
01322         if (!gsfIter->trackerDrivenSeed()&&gsfIter->ecalDrivenSeed()) h_ele_provenance->Fill(2.);
01323 
01324         h_ele_tkSumPt_dr03->Fill(gsfIter->dr03TkSumPt());
01325         h_ele_ecalRecHitSumEt_dr03->Fill(gsfIter->dr03EcalRecHitSumEt());
01326         h_ele_hcalDepth1TowerSumEt_dr03->Fill(gsfIter->dr03HcalDepth1TowerSumEt());
01327         h_ele_hcalDepth2TowerSumEt_dr03->Fill(gsfIter->dr03HcalDepth2TowerSumEt());
01328         h_ele_tkSumPt_dr04->Fill(gsfIter->dr04TkSumPt());
01329         h_ele_ecalRecHitSumEt_dr04->Fill(gsfIter->dr04EcalRecHitSumEt());
01330         h_ele_hcalDepth1TowerSumEt_dr04->Fill(gsfIter->dr04HcalDepth1TowerSumEt());
01331         h_ele_hcalDepth2TowerSumEt_dr04->Fill(gsfIter->dr04HcalDepth2TowerSumEt());
01332 
01333         float enrj1=gsfIter->superCluster()->energy();
01334         // mee
01335         for (reco::GsfElectronCollection::const_iterator gsfIter2=gsfIter+1;
01336          gsfIter2!=gsfElectrons->end(); gsfIter2++){
01337 
01338             math::XYZTLorentzVector p12 = (*gsfIter).p4()+(*gsfIter2).p4();
01339             float mee2 = p12.Dot(p12);
01340             float enrj2=gsfIter2->superCluster()->energy();
01341             h_ele_mee_all -> Fill(sqrt(mee2));
01342             h_ele_E2mnE1vsMee_all->Fill(sqrt(mee2),enrj2-enrj1);
01343             if (gsfIter->ecalDrivenSeed() && gsfIter2->ecalDrivenSeed()) h_ele_E2mnE1vsMee_egeg_all->Fill(sqrt(mee2),enrj2-enrj1);
01344             if (gsfIter->charge()*gsfIter2->charge()<0.) {
01345               h_ele_mee_os -> Fill(sqrt(mee2));
01346               if (gsfIter->isEB() && gsfIter2->isEB()) h_ele_mee_os_ebeb -> Fill(sqrt(mee2));
01347               if ((gsfIter->isEB() && gsfIter2->isEE()) || (gsfIter->isEE() && gsfIter2->isEB())) h_ele_mee_os_ebee -> Fill(sqrt(mee2));
01348               if (gsfIter->isEE() && gsfIter2->isEE()) h_ele_mee_os_eeee -> Fill(sqrt(mee2));
01349               if ((gsfIter->classification()==GsfElectron::GOLDEN && gsfIter2->classification()==GsfElectron::GOLDEN) ||
01350                  (gsfIter->classification()==GsfElectron::GOLDEN && gsfIter2->classification()==GsfElectron::BIGBREM) ||
01351                  //(gsfIter->classification()==GsfElectron::GOLDEN && gsfIter2->classification()==GsfElectron::OLDNARROW) ||
01352                  (gsfIter->classification()==GsfElectron::BIGBREM && gsfIter2->classification()==GsfElectron::GOLDEN) ||
01353                  (gsfIter->classification()==GsfElectron::BIGBREM && gsfIter2->classification()==GsfElectron::BIGBREM)/* ||
01354                  (gsfIter->classification()==GsfElectron::BIGBREM && gsfIter2->classification()==GsfElectron::OLDNARROW) ||
01355                  (gsfIter->classification()==GsfElectron::OLDNARROW && gsfIter2->classification()==GsfElectron::GOLDEN) ||
01356                  (gsfIter->classification()==GsfElectron::OLDNARROW && gsfIter2->classification()==GsfElectron::BIGBREM) ||
01357                  (gsfIter->classification()==GsfElectron::OLDNARROW && gsfIter2->classification()==GsfElectron::OLDNARROW)*/)
01358                { h_ele_mee_os_gg -> Fill(sqrt(mee2));}
01359               else if (
01360                  (gsfIter->classification()==GsfElectron::SHOWERING && gsfIter2->classification()==GsfElectron::SHOWERING) ||
01361                  (gsfIter->classification()==GsfElectron::SHOWERING && gsfIter2->isGap()) ||
01362                  (gsfIter->isGap() && gsfIter2->classification()==GsfElectron::SHOWERING) ||
01363                  (gsfIter->isGap() && gsfIter2->isGap()))
01364                { h_ele_mee_os_bb -> Fill(sqrt(mee2));}
01365               else
01366                { h_ele_mee_os_gb -> Fill(sqrt(mee2));}
01367             }
01368 
01369         }
01370 
01371   }
01372 
01373   // association matching object-reco electrons
01374   int matchingObjectNum=0;
01375 
01376   for ( reco::SuperClusterCollection::const_iterator moIter=recoClusters->begin();
01377    moIter!=recoClusters->end(); moIter++ ) {
01378 
01379     // number of matching objects
01380     matchingObjectNum++;
01381 
01382       if (moIter->energy()/cosh(moIter->eta())> maxPtMatchingObject_ || std::abs(moIter->eta())> maxAbsEtaMatchingObject_) continue;
01383 
01384       // suppress the endcaps
01385       //if (std::abs(moIter->eta()) > 1.5) continue;
01386       // select central z
01387       //if ( std::abs((*mcIter)->production_vertex()->position().z())>50.) continue;
01388 
01389       h_matchingObjectEta -> Fill( moIter->eta() );
01390       h_matchingObjectAbsEta -> Fill( std::abs(moIter->eta()) );
01391       h_matchingObjectP   -> Fill( moIter->energy() );
01392       h_matchingObjectPt   -> Fill( moIter->energy()/cosh(moIter->eta()) );
01393       h_matchingObjectPhi   -> Fill( moIter->phi() );
01394       h_matchingObjectZ   -> Fill(  moIter->z() );
01395 
01396       // looking for the best matching gsf electron
01397       bool okGsfFound = false;
01398       double gsfOkRatio = 999999.;
01399 
01400       // find matching electron
01401       reco::GsfElectron bestGsfElectron;
01402       for (reco::GsfElectronCollection::const_iterator gsfIter=gsfElectrons->begin();
01403        gsfIter!=gsfElectrons->end(); gsfIter++){
01404 
01405         // matching with a cone in eta phi
01406         if (matchingCondition_ == "Cone") {
01407         double dphi = gsfIter->phi()-moIter->phi();
01408         if (std::abs(dphi)>CLHEP::pi)
01409          dphi = dphi < 0? (CLHEP::twopi) + dphi : dphi - CLHEP::twopi;
01410         double deltaR = sqrt(std::pow((moIter->eta()-gsfIter->eta()),2) + std::pow(dphi,2));
01411         if ( deltaR < deltaR_ ){
01412         //if ( (genPc->pdg_id() == 11) && (gsfIter->charge() < 0.) || (genPc->pdg_id() == -11) &&
01413         //(gsfIter->charge() > 0.) ){
01414           double tmpGsfRatio = gsfIter->p()/moIter->energy();
01415           if ( std::abs(tmpGsfRatio-1) < std::abs(gsfOkRatio-1) ) {
01416             gsfOkRatio = tmpGsfRatio;
01417             bestGsfElectron=*gsfIter;
01418             okGsfFound = true;
01419           }
01420         //}
01421         }
01422         }
01423       } // loop over rec ele to look for the best one
01424 
01425       // analysis when the matching object is matched by a rec electron
01426      if (okGsfFound){
01427 
01428         // generated distributions for matched electrons
01429         h_ele_matchingObjectPt_matched      -> Fill( moIter->energy()/cosh(moIter->eta()) );
01430         h_ele_matchingObjectPhi_matched   -> Fill( moIter->phi() );
01431         h_ele_matchingObjectAbsEta_matched     -> Fill( std::abs(moIter->eta()) );
01432         h_ele_matchingObjectEta_matched     -> Fill( moIter->eta() );
01433         h_ele_matchingObjectZ_matched   -> Fill( moIter->z() );
01434 
01435         // comparison electron vs matching object
01436         h_ele_EtaMnEtamatchingObject_matched  -> Fill( bestGsfElectron.eta()-moIter->eta());
01437         h_ele_EtaMnEtamatchingObjectVsEta_matched  -> Fill( bestGsfElectron.eta(), bestGsfElectron.eta()-moIter->eta());
01438         h_ele_EtaMnEtamatchingObjectVsPhi_matched  -> Fill( bestGsfElectron.phi(), bestGsfElectron.eta()-moIter->eta());
01439         h_ele_EtaMnEtamatchingObjectVsPt_matched  -> Fill( bestGsfElectron.pt(), bestGsfElectron.eta()-moIter->eta());
01440         h_ele_PhiMnPhimatchingObject_matched  -> Fill( bestGsfElectron.phi()-moIter->phi());
01441         h_ele_PhiMnPhimatchingObject2_matched  -> Fill( bestGsfElectron.phi()-moIter->phi());
01442         h_ele_PhiMnPhimatchingObjectVsEta_matched  -> Fill( bestGsfElectron.eta(), bestGsfElectron.phi()-moIter->phi());
01443         h_ele_PhiMnPhimatchingObjectVsPhi_matched  -> Fill( bestGsfElectron.phi(), bestGsfElectron.phi()-moIter->phi());
01444         h_ele_PhiMnPhimatchingObjectVsPt_matched  -> Fill( bestGsfElectron.pt(), bestGsfElectron.phi()-moIter->phi());
01445         h_ele_PoPmatchingObject_matched       -> Fill( bestGsfElectron.p()/moIter->energy());
01446         h_ele_PtoPtmatchingObject_matched       -> Fill( bestGsfElectron.pt()/moIter->energy()/cosh(moIter->eta()));
01447         h_ele_PoPmatchingObjectVsEta_matched       -> Fill( bestGsfElectron.eta(), bestGsfElectron.p()/moIter->energy());
01448         h_ele_PoPmatchingObjectVsPhi_matched       -> Fill( bestGsfElectron.phi(), bestGsfElectron.p()/moIter->energy());
01449         h_ele_PoPmatchingObjectVsPt_matched       -> Fill( bestGsfElectron.py(), bestGsfElectron.p()/moIter->energy());
01450         if (bestGsfElectron.isEB()) h_ele_PoPmatchingObject_barrel_matched       -> Fill( bestGsfElectron.p()/moIter->energy());
01451         if (bestGsfElectron.isEE()) h_ele_PoPmatchingObject_endcaps_matched       -> Fill( bestGsfElectron.p()/moIter->energy());
01452         if (bestGsfElectron.isEB()) h_ele_PtoPtmatchingObject_barrel_matched       -> Fill( bestGsfElectron.pt()/moIter->energy()/cosh(moIter->eta()));
01453         if (bestGsfElectron.isEE()) h_ele_PtoPtmatchingObject_endcaps_matched       -> Fill( bestGsfElectron.pt()/moIter->energy()/cosh(moIter->eta()));
01454 
01455         reco::SuperClusterRef sclRef = bestGsfElectron.superCluster();
01456         if (bestGsfElectron.isEB())  histSclEoEmatchingObject_barrel_matched->Fill(sclRef->energy()/moIter->energy());
01457         if (bestGsfElectron.isEE())  histSclEoEmatchingObject_endcaps_matched->Fill(sclRef->energy()/moIter->energy());
01458         if (bestGsfElectron.isEB())  histSclEoEmatchingObject_barrel_new_matched->Fill(sclRef->energy()/moIter->energy());
01459         if (bestGsfElectron.isEE())  histSclEoEmatchingObject_endcaps_new_matched->Fill(sclRef->energy()/moIter->energy());
01460 
01461         // add here distributions for matched electrons as for all electrons
01462         //..
01463 
01464       } // gsf electron found
01465 
01466   } // loop overmatching object
01467 
01468   h_matchingObjectNum->Fill(matchingObjectNum);
01469 
01470 }
01471 
01472 bool GsfElectronDataAnalyzer::trigger(const edm::Event & e)
01473 {
01474 
01475   // retreive TriggerResults from the event
01476   edm::Handle<edm::TriggerResults> triggerResults;
01477   e.getByLabel(triggerResults_,triggerResults);
01478 
01479   bool accept = false;
01480 
01481   if (triggerResults.isValid()) {
01482     //std::cout << "TriggerResults found, number of HLT paths: " << triggerResults->size() << std::endl;
01483 
01484     // get trigger names
01485     const edm::TriggerNames & triggerNames = e.triggerNames(*triggerResults);
01486     if (nEvents_==1) {
01487       for (unsigned int i=0; i<triggerNames.size(); i++) {
01488         std::cout << "trigger path= " << triggerNames.triggerName(i) << std::endl;
01489       }
01490     }
01491 
01492     unsigned int n = HLTPathsByName_.size();
01493     for (unsigned int i=0; i!=n; i++) {
01494       HLTPathsByIndex_[i]=triggerNames.triggerIndex(HLTPathsByName_[i]);
01495     }
01496 
01497     // empty input vectors (n==0) means any trigger paths
01498     if (n==0) {
01499       n=triggerResults->size();
01500       HLTPathsByName_.resize(n);
01501       HLTPathsByIndex_.resize(n);
01502       for (unsigned int i=0; i!=n; i++) {
01503         HLTPathsByName_[i]=triggerNames.triggerName(i);
01504         HLTPathsByIndex_[i]=i;
01505       }
01506     }
01507 
01508     if (nEvents_==1){
01509       if (n>0) {
01510         std::cout << "HLT trigger paths requested: index, name and valididty:" << std::endl;
01511         for (unsigned int i=0; i!=n; i++) {
01512           bool validity = HLTPathsByIndex_[i]<triggerResults->size();
01513           std::cout << " " << HLTPathsByIndex_[i]
01514                << " " << HLTPathsByName_[i]
01515                << " " << validity << std::endl;
01516         }
01517       }
01518     }
01519 
01520     // count number of requested HLT paths which have fired
01521     unsigned int fired=0;
01522     for (unsigned int i=0; i!=n; i++) {
01523       if (HLTPathsByIndex_[i]<triggerResults->size()) {
01524         if (triggerResults->accept(HLTPathsByIndex_[i])) {
01525           fired++;
01526           std::cout << "Fired HLT path= " << HLTPathsByName_[i] << std::endl;
01527           accept = true;
01528         }
01529       }
01530     }
01531 
01532   }
01533 
01534   return accept;
01535 
01536 }
01537 
01538