CMS 3D CMS Logo

GsfElectronFakeAnalyzer.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:    RecoEgamma/Examples
00004 // Class:      GsfElectronFakeAnalyzer
00005 // 
00013 //
00014 // Original Author:  Ursula Berthon
00015 //         Created:  Mon Mar 27 13:22:06 CEST 2006
00016 // $Id: GsfElectronFakeAnalyzer.cc,v 1.4 2008/09/13 08:30:26 charlot Exp $
00017 //
00018 //
00019 
00020 // user include files
00021 #include "RecoEgamma/Examples/plugins/GsfElectronFakeAnalyzer.h"
00022 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00023 #include "FWCore/Framework/interface/EDAnalyzer.h"
00024 #include "FWCore/Framework/interface/Event.h"
00025 #include "FWCore/Framework/interface/MakerMacros.h"
00026 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00027 #include "DataFormats/GsfTrackReco/interface/GsfTrack.h"
00028 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
00029 #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
00030 #include "DataFormats/EgammaReco/interface/BasicClusterFwd.h"
00031 #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"
00032 #include "DataFormats/JetReco/interface/CaloJetCollection.h"
00033 #include "DataFormats/JetReco/interface/CaloJet.h"
00034 #include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
00035 
00036 #include <iostream>
00037 #include "TMath.h"
00038 #include "TFile.h"
00039 #include "TH1F.h"
00040 #include "TH1I.h"
00041 #include "TH2F.h"
00042 #include "TProfile.h"
00043 #include "TTree.h"
00044 #include <iostream>
00045 
00046 using namespace reco;
00047  
00048 GsfElectronFakeAnalyzer::GsfElectronFakeAnalyzer(const edm::ParameterSet& conf)
00049 {
00050 
00051   outputFile_ = conf.getParameter<std::string>("outputFile");
00052   histfile_ = new TFile(outputFile_.c_str(),"RECREATE");
00053   electronCollection_=conf.getParameter<edm::InputTag>("electronCollection");
00054   matchingObjectCollection_ = conf.getParameter<edm::InputTag>("matchingObjectCollection");
00055   maxPt_ = conf.getParameter<double>("MaxPt");
00056   maxAbsEta_ = conf.getParameter<double>("MaxAbsEta");
00057   deltaR_ = conf.getParameter<double>("DeltaR");
00058   etamin=conf.getParameter<double>("Etamin");
00059   etamax=conf.getParameter<double>("Etamax");
00060   phimin=conf.getParameter<double>("Phimin");
00061   phimax=conf.getParameter<double>("Phimax");
00062   ptmax=conf.getParameter<double>("Ptmax");
00063   pmax=conf.getParameter<double>("Pmax");
00064   eopmax=conf.getParameter<double>("Eopmax");
00065   eopmaxsht=conf.getParameter<double>("Eopmaxsht");
00066   detamin=conf.getParameter<double>("Detamin");
00067   detamax=conf.getParameter<double>("Detamax");
00068   dphimin=conf.getParameter<double>("Dphimin");
00069   dphimax=conf.getParameter<double>("Dphimax");
00070   detamatchmin=conf.getParameter<double>("Detamatchmin");
00071   detamatchmax=conf.getParameter<double>("Detamatchmax");
00072   dphimatchmin=conf.getParameter<double>("Dphimatchmin");
00073   dphimatchmax=conf.getParameter<double>("Dphimatchmax");
00074   fhitsmax=conf.getParameter<double>("Fhitsmax");
00075   lhitsmax=conf.getParameter<double>("Lhitsmax");
00076   nbineta=conf.getParameter<int>("Nbineta");
00077   nbineta2D=conf.getParameter<int>("Nbineta2D");
00078   nbinp=conf.getParameter<int>("Nbinp");
00079   nbinpt=conf.getParameter<int>("Nbinpt");
00080   nbinp2D=conf.getParameter<int>("Nbinp2D");
00081   nbinpt2D=conf.getParameter<int>("Nbinpt2D");
00082   nbinpteff=conf.getParameter<int>("Nbinpteff");
00083   nbinphi=conf.getParameter<int>("Nbinphi");
00084   nbinphi2D=conf.getParameter<int>("Nbinphi2D");
00085   nbineop=conf.getParameter<int>("Nbineop");
00086   nbineop2D=conf.getParameter<int>("Nbineop2D");
00087   nbinfhits=conf.getParameter<int>("Nbinfhits");
00088   nbinlhits=conf.getParameter<int>("Nbinlhits");
00089   nbinxyz=conf.getParameter<int>("Nbinxyz");
00090   nbindeta=conf.getParameter<int>("Nbindeta");
00091   nbindphi=conf.getParameter<int>("Nbindphi");
00092   nbindetamatch=conf.getParameter<int>("Nbindetamatch");
00093   nbindphimatch=conf.getParameter<int>("Nbindphimatch");
00094   nbindetamatch2D=conf.getParameter<int>("Nbindetamatch2D");
00095   nbindphimatch2D=conf.getParameter<int>("Nbindphimatch2D");
00096 }  
00097   
00098 GsfElectronFakeAnalyzer::~GsfElectronFakeAnalyzer()
00099 {
00100  
00101   // do anything here that needs to be done at desctruction time
00102   // (e.g. close files, deallocate resources etc.)
00103   histfile_->Write();
00104   histfile_->Close();
00105 }
00106 
00107 void GsfElectronFakeAnalyzer::beginJob(edm::EventSetup const&iSetup){
00108 
00109   histfile_->cd();
00110   
00111   
00112   // matching object
00113   std::string::size_type locJet = matchingObjectCollection_.label().find( "iterativeCone5CaloJets", 0 );
00114   std::string type_;
00115   if ( locJet != std::string::npos ) {
00116     std::cout << "Matching objects are CaloJets " << std::endl;
00117     type_ = "CaloJet";
00118   } else {
00119     std::cout << "Didn't recognize input matching objects!! " << std::endl; 
00120   }
00121   
00122   std::string htitle, hlabel;
00123   hlabel="h_"+type_+"Num"; htitle="# "+type_+"s";
00124   h_matchingObjectNum              = new TH1F( hlabel.c_str(), htitle.c_str(),    nbinfhits,0.,fhitsmax );
00125     
00126   // rec event
00127   
00128   histNum_= new TH1F("h_recEleNum","# rec electrons",20, 0.,20.);
00129   
00130   // matching object distributions 
00131   hlabel="h_"+type_+"_eta"; htitle=type_+" #eta";
00132   h_matchingObjectEta             = new TH1F( hlabel.c_str(), htitle.c_str(), nbineta,etamin,etamax); 
00133   hlabel="h_"+type_+"_ahseta"; htitle=type_+" |#eta|";
00134   h_matchingObjectAbsEta             = new TH1F( hlabel.c_str(), htitle.c_str(), nbineta/2,0.,etamax); 
00135   hlabel="h_"+type_+"_P"; htitle=type_+" p";
00136   h_matchingObjectP               = new TH1F( hlabel.c_str(), htitle.c_str(),              nbinp,0.,pmax); 
00137   hlabel="h_"+type_+"_Pt"; htitle=type_+" pt";
00138   h_matchingObjectPt               = new TH1F( hlabel.c_str(),htitle.c_str(),            nbinpteff,5.,ptmax); 
00139   hlabel="h_"+type_+"_phi"; htitle=type_+" phi";
00140   h_matchingObjectPhi               = new TH1F( hlabel.c_str(), htitle.c_str(),        nbinphi,phimin,phimax); 
00141   hlabel="h_"+type_+"_z"; htitle=type_+" z";
00142   h_matchingObjectZ      = new TH1F( hlabel.c_str(), htitle.c_str(),    50, -25, 25 );
00143 
00144   // ctf tracks
00145   h_ctf_foundHitsVsEta      = new TH2F( "h_ctf_foundHitsVsEta",      "ctf track # found hits vs eta",  nbineta2D,etamin,etamax,nbinfhits,0.,fhitsmax);
00146   h_ctf_lostHitsVsEta       = new TH2F( "h_ctf_lostHitsVsEta",       "ctf track # lost hits vs eta",   nbineta2D,etamin,etamax,nbinlhits,0.,lhitsmax);
00147   
00148   // all electrons  
00149   h_ele_EoverP_all       = new TH1F( "h_ele_EoverP_all",       "all reco ele, E/p at vertex",  nbineop,0.,eopmax);
00150   h_ele_TIP_all       = new TH1F( "h_ele_TIP_all",       "all reco ele, tip at vertex",  100,0.,0.2);
00151   h_ele_vertexPt_all       = new TH1F( "h_ele_vertexPt_all",       "all reco ele, p_{T} at vertex",  nbinpteff,5.,ptmax);
00152   h_ele_vertexEta_all      = new TH1F( "h_ele_vertexEta_all",      "all reco ele, #eta at vertex",    nbineta,etamin,etamax);
00153   h_ele_mee_all      = new TH1F( "h_ele_mee_all", "all ele pairs invariant mass", 100, 0., 150. );
00154 
00155   // matched electrons
00156   h_ele_charge         = new TH1F( "h_ele_charge",         "ele charge",             5,-2.,2.);   
00157   h_ele_chargeVsEta    = new TH2F( "h_ele_chargeVsEta",         "ele charge vs eta", nbineta2D,etamin,etamax,5,-2.,2.);   
00158   h_ele_chargeVsPhi    = new TH2F( "h_ele_chargeVsPhi",         "ele charge vs phi", nbinphi2D,phimin,phimax,5,-2.,2.);   
00159   h_ele_chargeVsPt    = new TH2F( "h_ele_chargeVsPt",         "ele charge vs pt", nbinpt,0.,100.,5,-2.,2.);   
00160   h_ele_vertexP        = new TH1F( "h_ele_vertexP",        "ele p at vertex",       nbinp,0.,pmax);
00161   h_ele_vertexPt       = new TH1F( "h_ele_vertexPt",       "ele p_{T} at vertex",  nbinpt,0.,ptmax);
00162   h_ele_vertexPtVsEta   = new TH2F( "h_ele_vertexPtVsEta",       "ele p_{T} at vertex vs eta",nbinpt2D,etamin,etamax,nbinpt2D,0.,ptmax);
00163   h_ele_vertexPtVsPhi   = new TH2F( "h_ele_vertexPtVsPhi",       "ele p_{T} at vertex vs phi",nbinphi2D,phimin,phimax,nbinpt2D,0.,ptmax);
00164   h_ele_matchingObjectPt_matched       = new TH1F( "h_ele_matchingObjectPt_matched",       "matching jet p_{T}",  nbinpteff,5.,ptmax);
00165   h_ele_vertexEta      = new TH1F( "h_ele_vertexEta",      "ele #eta at vertex",    nbineta,etamin,etamax);
00166   h_ele_vertexEtaVsPhi  = new TH2F( "h_ele_vertexEtaVsPhi",      "ele #eta at vertex vs phi",nbineta2D,etamin,etamax,nbinphi2D,phimin,phimax );
00167   h_ele_matchingObjectAbsEta_matched      = new TH1F( "h_ele_matchingObjectAbsEta_matched",      "matching jet |#eta|",    nbineta/2,0.,2.5);
00168   h_ele_matchingObjectEta_matched      = new TH1F( "h_ele_matchingObjectEta_matched",      "matching jet #eta",    nbineta,etamin,etamax);
00169   h_ele_matchingObjectPhi_matched               = new TH1F( "h_ele_matchingObjectPhi_matched", "matching jet phi",        nbinphi,phimin,phimax); 
00170   h_ele_vertexPhi      = new TH1F( "h_ele_vertexPhi",      "ele #phi at vertex",    nbinphi,phimin,phimax);
00171   h_ele_vertexX      = new TH1F( "h_ele_vertexX",      "ele x at vertex",    nbinxyz,-0.1,0.1 );
00172   h_ele_vertexY      = new TH1F( "h_ele_vertexY",      "ele y at vertex",    nbinxyz,-0.1,0.1 );
00173   h_ele_vertexZ      = new TH1F( "h_ele_vertexZ",      "ele z at vertex",    nbinxyz,-25, 25 );
00174   h_ele_matchingObjectZ_matched      = new TH1F( "h_ele_matchingObjectZ_matched",      "matching jet z",    nbinxyz,-25,25);
00175   h_ele_vertexTIP      = new TH1F( "h_ele_vertexTIP",      "ele TIP",    90,0.,0.15);
00176   h_ele_vertexTIPVsEta      = new TH2F( "h_ele_vertexTIPVsEta",      "ele TIP vs eta", nbineta2D,etamin,etamax,45,0.,0.15);
00177   h_ele_vertexTIPVsPhi      = new TH2F( "h_ele_vertexTIPVsPhi",      "ele TIP vs phi", nbinphi2D,phimin,phimax,45,0.,0.15);
00178   h_ele_vertexTIPVsPt      = new TH2F( "h_ele_vertexTIPVsPt",      "ele TIP vs Pt", nbinpt2D,0.,ptmax,45,0.,0.15);
00179   h_ele_PoPmatchingObject        = new TH1F( "h_ele_PoPmatchingObject",        "ele P/P_{matching jet} @ vertex", 75,0.,1.5);
00180   h_ele_PoPmatchingObjectVsEta   = new TH2F( "h_ele_PoPmatchingObjectVsEta",        "ele P/P_{matching jet} @ vertex vs eta", nbineta2D,etamin,etamax,50,0.,1.5);
00181   h_ele_PoPmatchingObjectVsPhi   = new TH2F( "h_ele_PoPmatchingObjectVsPhi",        "ele P/P_{matching jet} @ vertex vs phi", nbinphi2D,phimin,phimax,50,0.,1.5);
00182   h_ele_PoPmatchingObjectVsPt   = new TH2F( "h_ele_PoPmatchingObjectVsPt",        "ele P/P_{matching jet} @ vertex vs eta", nbinpt2D,0.,ptmax,50,0.,1.5);
00183   h_ele_PoPmatchingObject_barrel         = new TH1F( "h_ele_PoPmatchingObject_barrel",        "ele P/P_{matching jet} @ vertex, barrel",75,0.,1.5);
00184   h_ele_PoPmatchingObject_endcaps        = new TH1F( "h_ele_PoPmatchingObject_endcaps",        "ele P/P_{matching jet} @ vertex, endcaps",75,0.,1.5);
00185   h_ele_EtaMnEtamatchingObject   = new TH1F( "h_ele_EtaMnEtamatchingObject",   "ele #eta_{rec} - #eta_{matching jet} @ vertex",nbindeta,detamin,detamax);
00186   h_ele_EtaMnEtamatchingObjectVsEta   = new TH2F( "h_ele_EtaMnEtamatchingObjectVsEta",   "ele #eta_{rec} - #eta_{matching jet} @ vertex vs eta",nbineta2D,etamin,etamax,nbindeta/2,detamin,detamax);
00187   h_ele_EtaMnEtamatchingObjectVsPhi   = new TH2F( "h_ele_EtaMnEtamatchingObjectVsPhi",   "ele #eta_{rec} - #eta_{matching jet} @ vertex vs phi",nbinphi2D,phimin,phimax,nbindeta/2,detamin,detamax);
00188   h_ele_EtaMnEtamatchingObjectVsPt   = new TH2F( "h_ele_EtaMnEtamatchingObjectVsPt",   "ele #eta_{rec} - #eta_{matching jet} @ vertex vs pt",nbinpt,0.,ptmax,nbindeta/2,detamin,detamax);
00189   h_ele_PhiMnPhimatchingObject   = new TH1F( "h_ele_PhiMnPhimatchingObject",   "ele #phi_{rec} - #phi_{matching jet} @ vertex",nbindphi,dphimin,dphimax);
00190   h_ele_PhiMnPhimatchingObject2   = new TH1F( "h_ele_PhiMnPhimatchingObject2",   "ele #phi_{rec} - #phi_{matching jet} @ vertex",nbindphimatch2D,dphimatchmin,dphimatchmax);
00191   h_ele_PhiMnPhimatchingObjectVsEta   = new TH2F( "h_ele_PhiMnPhimatchingObjectVsEta",   "ele #phi_{rec} - #phi_{matching jet} @ vertex vs eta",nbineta2D,etamin,etamax,nbindphi/2,dphimin,dphimax);
00192   h_ele_PhiMnPhimatchingObjectVsPhi   = new TH2F( "h_ele_PhiMnPhimatchingObjectVsPhi",   "ele #phi_{rec} - #phi_{matching jet} @ vertex vs phi",nbinphi2D,phimin,phimax,nbindphi/2,dphimin,dphimax);
00193   h_ele_PhiMnPhimatchingObjectVsPt   = new TH2F( "h_ele_PhiMnPhimatchingObjectVsPt",   "ele #phi_{rec} - #phi_{matching jet} @ vertex vs pt",nbinpt2D,0.,ptmax,nbindphi/2,dphimin,dphimax);
00194 
00195   // matched electron, superclusters
00196   histSclEn_ = new TH1F("h_scl_energy","ele supercluster energy",nbinp,0.,pmax);
00197   histSclEoEmatchingObject_barrel = new TH1F("h_scl_EoEmatchingObject_barrel","ele SC energy over matching jet energy, barrel",50,0.2,1.2);
00198   histSclEoEmatchingObject_endcaps = new TH1F("h_scl_EoEmatchingObject_endcaps","ele SC energy over matching jet energy, endcaps",50,0.2,1.2);
00199   histSclEt_ = new TH1F("h_scl_et","ele SC transverse energy",nbinpt,0.,ptmax);
00200   histSclEtVsEta_ = new TH2F("h_scl_etVsEta","ele SC transverse energy vs eta",nbineta2D,etamin,etamax,nbinpt,0.,ptmax);
00201   histSclEtVsPhi_ = new TH2F("h_scl_etVsPhi","ele SC transverse energy vs phi",nbinphi2D,phimin,phimax,nbinpt,0.,ptmax);
00202   histSclEtaVsPhi_ = new TH2F("h_scl_etaVsPhi","ele SC eta vs phi",nbinphi2D,phimin,phimax,nbineta2D,etamin,etamax);
00203   histSclEta_ = new TH1F("h_scl_eta","ele SC eta",nbineta,etamin,etamax);
00204   histSclPhi_ = new TH1F("h_scl_phi","ele SC phi",nbinphi,phimin,phimax);
00205 
00206   // matched electron, gsf tracks
00207   h_ele_foundHits      = new TH1F( "h_ele_foundHits",      "ele track # found hits",      nbinfhits,0.,fhitsmax);
00208   h_ele_foundHitsVsEta      = new TH2F( "h_ele_foundHitsVsEta",      "ele track # found hits vs eta",  nbineta2D,etamin,etamax,nbinfhits,0.,fhitsmax);
00209   h_ele_foundHitsVsPhi      = new TH2F( "h_ele_foundHitsVsPhi",      "ele track # found hits vs phi",  nbinphi2D,phimin,phimax,nbinfhits,0.,fhitsmax);
00210   h_ele_foundHitsVsPt      = new TH2F( "h_ele_foundHitsVsPt",      "ele track # found hits vs pt",  nbinpt2D,0.,ptmax,nbinfhits,0.,fhitsmax);
00211   h_ctf_foundHits      = new TH1F( "h_ctf_foundHits",      "ctf track # found hits",      nbinfhits,0.,fhitsmax);
00212   h_ele_lostHits       = new TH1F( "h_ele_lostHits",       "ele track # lost hits",       5,0.,5.);
00213   h_ele_lostHitsVsEta       = new TH2F( "h_ele_lostHitsVsEta",       "ele track # lost hits vs eta",   nbineta2D,etamin,etamax,nbinlhits,0.,lhitsmax);
00214   h_ele_lostHitsVsPhi       = new TH2F( "h_ele_lostHitsVsPhi",       "ele track # lost hits vs eta",   nbinphi2D,phimin,phimax,nbinlhits,0.,lhitsmax);
00215   h_ele_lostHitsVsPt       = new TH2F( "h_ele_lostHitsVsPt",       "ele track # lost hits vs eta",   nbinpt2D,0.,ptmax,nbinlhits,0.,lhitsmax);
00216   h_ele_chi2           = new TH1F( "h_ele_chi2",           "ele track #chi^{2}",         100,0.,15.);   
00217   h_ele_chi2VsEta           = new TH2F( "h_ele_chi2VsEta",           "ele track #chi^{2} vs eta",  nbineta2D,etamin,etamax,50,0.,15.);   
00218   h_ele_chi2VsPhi           = new TH2F( "h_ele_chi2VsPhi",           "ele track #chi^{2} vs phi",  nbinphi2D,phimin,phimax,50,0.,15.);   
00219   h_ele_chi2VsPt           = new TH2F( "h_ele_chi2VsPt",           "ele track #chi^{2} vs pt",  nbinpt2D,0.,ptmax,50,0.,15.);   
00220   h_ele_PinMnPout      = new TH1F( "h_ele_PinMnPout",      "ele track inner p - outer p, mean"   ,nbinp,0.,200.);
00221   h_ele_PinMnPout_mode      = new TH1F( "h_ele_PinMnPout_mode",      "ele track inner p - outer p, mode"   ,nbinp,0.,100.);
00222   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.);
00223   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.);
00224   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.);
00225   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.);
00226   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.);
00227   h_ele_outerP         = new TH1F( "h_ele_outerP",         "ele track outer p, mean",          nbinp,0.,pmax);
00228   h_ele_outerP_mode         = new TH1F( "h_ele_outerP_mode",         "ele track outer p, mode",          nbinp,0.,pmax);
00229   h_ele_outerPVsEta_mode         = new TH2F( "h_ele_outerPVsEta_mode",         "ele track outer p vs eta mode", nbineta2D,etamin,etamax,50,0.,pmax);
00230   h_ele_outerPt        = new TH1F( "h_ele_outerPt",        "ele track outer p_{T}, mean",      nbinpt,0.,ptmax);
00231   h_ele_outerPt_mode        = new TH1F( "h_ele_outerPt_mode",        "ele track outer p_{T}, mode",      nbinpt,0.,ptmax);
00232   h_ele_outerPtVsEta_mode        = new TH2F( "h_ele_outerPtVsEta_mode", "ele track outer p_{T} vs eta, mode", nbineta2D,etamin,etamax,nbinpt2D,0.,ptmax);
00233   h_ele_outerPtVsPhi_mode        = new TH2F( "h_ele_outerPtVsPhi_mode", "ele track outer p_{T} vs phi, mode", nbinphi2D,phimin,phimax,nbinpt2D,0.,ptmax);
00234   h_ele_outerPtVsPt_mode        = new TH2F( "h_ele_outerPtVsPt_mode", "ele track outer p_{T} vs pt, mode", nbinpt2D,0.,100.,nbinpt2D,0.,ptmax);
00235   
00236   // matched electrons,cluster-track  matching 
00237   h_ele_EoP            = new TH1F( "h_ele_EoP",            "ele E/P_{vertex}",        nbineop,0.,eopmax);
00238   h_ele_EoPVsEta            = new TH2F( "h_ele_EoPVsEta",            "ele E/P_{vertex} vs eta",  nbineta2D,etamin,etamax,nbineop2D,0.,eopmaxsht);
00239   h_ele_EoPVsPhi            = new TH2F( "h_ele_EoPVsPhi",            "ele E/P_{vertex} vs phi",  nbinphi2D,phimin,phimax,nbineop2D,0.,eopmaxsht);
00240   h_ele_EoPVsE            = new TH2F( "h_ele_EoPVsE",            "ele E/P_{vertex} vs E",  50,0.,pmax ,50,0.,5.);
00241   h_ele_EoPout         = new TH1F( "h_ele_EoPout",         "ele E/P_{out}",           nbineop,0.,eopmax);
00242   h_ele_EoPoutVsEta         = new TH2F( "h_ele_EoPoutVsEta",         "ele E/P_{out} vs eta",    nbineta2D,etamin,etamax,nbineop2D,0.,eopmaxsht);
00243   h_ele_EoPoutVsPhi         = new TH2F( "h_ele_EoPoutVsPhi",         "ele E/P_{out} vs phi",    nbinphi2D,phimin,phimax,nbineop2D,0.,eopmaxsht);
00244   h_ele_EoPoutVsE         = new TH2F( "h_ele_EoPoutVsE",         "ele E/P_{out} vs E",    nbinp2D,0.,pmax,nbineop2D,0.,eopmaxsht);
00245   h_ele_dEtaSc_propVtx = new TH1F( "h_ele_dEtaSc_propVtx", "ele #eta_{sc} - #eta_{tr} - prop from vertex",      nbindetamatch,detamatchmin,detamatchmax);
00246   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);
00247   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);
00248   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);
00249   h_ele_dPhiSc_propVtx = new TH1F( "h_ele_dPhiSc_propVtx", "ele #phi_{sc} - #phi_{tr} - prop from vertex",      nbindphimatch,dphimatchmin,dphimatchmax);
00250   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);
00251   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);
00252   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);
00253   h_ele_dEtaCl_propOut = new TH1F( "h_ele_dEtaCl_propOut", "ele #eta_{cl} - #eta_{tr} - prop from outermost",   nbindetamatch,detamatchmin,detamatchmax);
00254   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);
00255   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);
00256   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);
00257   h_ele_dPhiCl_propOut = new TH1F( "h_ele_dPhiCl_propOut", "ele #phi_{cl} - #phi_{tr} - prop from outermost",   nbindphimatch,dphimatchmin,dphimatchmax);
00258   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);
00259   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);
00260   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);
00261   
00262   h_ele_HoE = new TH1F("h_ele_HoE", "ele H/E", 55,-0.05,0.5) ;
00263   h_ele_HoEVsEta = new TH2F("h_ele_HoEVsEta", "ele H/E vs eta", nbineta,etamin,etamax,55,-0.05,0.5) ;
00264   h_ele_HoEVsPhi = new TH2F("h_ele_HoEVsPhi", "ele H/E vs phi", nbinphi2D,phimin,phimax,55,-0.05,0.5) ;
00265   h_ele_HoEVsE = new TH2F("h_ele_HoEVsE", "ele H/E vs E", nbinp, 0.,300.,55,-0.05,0.5) ;
00266   
00267   // classes  
00268   h_ele_classes = new TH1F( "h_ele_classes", "ele, electron classes",      150,0.0,150.);
00269   h_ele_eta = new TH1F( "h_ele_eta", "ele, electron eta",  nbineta/2,0.0,etamax);
00270   h_ele_eta_golden = new TH1F( "h_ele_eta_golden", "ele, electron eta golden",  nbineta/2,0.0,etamax);
00271   h_ele_eta_bbrem = new TH1F( "h_ele_eta_bbrem", "ele, electron eta bbrem",  nbineta/2,0.0,etamax);
00272   h_ele_eta_narrow = new TH1F( "h_ele_eta_narrow", "ele, electron eta narrow",  nbineta/2,0.0,etamax);
00273   h_ele_eta_shower = new TH1F( "h_ele_eta_show", "ele, electron eta showering",  nbineta/2,0.0,etamax);
00274   h_ele_PinVsPoutGolden_mode = new TH2F( "h_ele_PinVsPoutGolden_mode",      "ele track inner p vs outer p, golden, mode" ,nbinp2D,0.,pmax,50,0.,pmax);
00275   h_ele_PinVsPoutShowering0_mode = new TH2F( "h_ele_PinVsPoutShowering0_mode",      "ele track inner p vs outer p vs eta, showering0, mode" ,nbinp2D,0.,pmax,50,0.,pmax);
00276   h_ele_PinVsPoutShowering1234_mode = new TH2F( "h_ele_PinVsPoutShowering1234_mode",      "ele track inner p vs outer p, showering1234, mode" ,nbinp2D,0.,pmax,50,0.,pmax);
00277   h_ele_PinVsPoutGolden_mean = new TH2F( "h_ele_PinVsPoutGolden_mean",      "ele track inner p vs outer p, golden, mean" ,nbinp2D,0.,pmax,50,0.,pmax);
00278   h_ele_PinVsPoutShowering0_mean = new TH2F( "h_ele_PinVsPoutShowering0_mean",      "ele track inner p vs outer p, showering0, mean" ,nbinp2D,0.,pmax,50,0.,pmax);
00279   h_ele_PinVsPoutShowering1234_mean = new TH2F( "h_ele_PinVsPoutShowering1234_mean",      "ele track inner p vs outer p, showering1234, mean" ,nbinp2D,0.,pmax,50,0.,pmax);
00280   h_ele_PtinVsPtoutGolden_mode = new TH2F( "h_ele_PtinVsPtoutGolden_mode",      "ele track inner pt vs outer pt, golden, mode" ,nbinpt2D,0.,ptmax,50,0.,ptmax);
00281   h_ele_PtinVsPtoutShowering0_mode = new TH2F( "h_ele_PtinVsPtoutShowering0_mode",      "ele track inner pt vs outer pt, showering0, mode" ,nbinpt2D,0.,ptmax,50,0.,ptmax);
00282   h_ele_PtinVsPtoutShowering1234_mode = new TH2F( "h_ele_PtinVsPtoutShowering1234_mode",      "ele track inner pt vs outer pt, showering1234, mode" ,nbinpt2D,0.,ptmax,50,0.,ptmax);
00283   h_ele_PtinVsPtoutGolden_mean = new TH2F( "h_ele_PtinVsPtoutGolden_mean",      "ele track inner pt vs outer pt, golden, mean" ,nbinpt2D,0.,ptmax,50,0.,ptmax);
00284   h_ele_PtinVsPtoutShowering0_mean = new TH2F( "h_ele_PtinVsPtoutShowering0_mean",      "ele track inner pt vs outer pt, showering0, mean" ,nbinpt2D,0.,ptmax,50,0.,ptmax);
00285   h_ele_PtinVsPtoutShowering1234_mean = new TH2F( "h_ele_PtinVsPtoutShowering1234_mean",      "ele track inner pt vs outer pt, showering1234, mean" ,nbinpt2D,0.,ptmax,50,0.,ptmax);
00286   histSclEoEmatchingObjectGolden_barrel = new TH1F("h_scl_EoEmatchingObject golden, barrel","ele SC energy over matching jet energy, golden, barrel",100,0.2,1.2);
00287   histSclEoEmatchingObjectGolden_endcaps = new TH1F("h_scl_EoEmatchingObject golden, endcaps","ele SC energy over matching jet energy, golden, endcaps",100,0.2,1.2);
00288   histSclEoEmatchingObjectShowering0_barrel = new TH1F("h_scl_EoEmatchingObject showering0, barrel","ele SC energy over matching jet energy, showering0, barrel",100,0.2,1.2);
00289   histSclEoEmatchingObjectShowering0_endcaps = new TH1F("h_scl_EoEmatchingObject showering0, endcaps","ele SC energy over matching jet energy, showering0, endcaps",100,0.2,1.2);
00290   histSclEoEmatchingObjectShowering1234_barrel = new TH1F("h_scl_EoEmatchingObject showering1234, barrel","ele SC energy over matching jet energy, showering1234, barrel",100,0.2,1.2);
00291   histSclEoEmatchingObjectShowering1234_endcaps = new TH1F("h_scl_EoEmatchingObject showering1234, endcaps","ele SC over matchingObject energy, showering1234, endcaps",100,0.2,1.2);
00292 
00293   // fbrem
00294   h_ele_fbremVsEta_mode = new TProfile( "h_ele_fbremvsEtamode","ele, mean pout/pin vs eta, mode",nbineta2D,etamin,etamax,0.,1.);
00295   h_ele_fbremVsEta_mean = new TProfile( "h_ele_fbremvsEtamean","ele, mean pout/pin vs eta, mean",nbineta2D,etamin,etamax,0.,1.);
00296   
00297   // histos titles
00298   h_matchingObjectNum              -> GetXaxis()-> SetTitle("# reco jets");
00299   h_matchingObjectEta             -> GetXaxis()-> SetTitle("jet #eta");
00300   h_matchingObjectP               -> GetXaxis()-> SetTitle("jet p (GeV/c)");
00301   h_ele_foundHits      -> GetXaxis()-> SetTitle("# hits");   
00302   h_ele_lostHits       -> GetXaxis()-> SetTitle("# lost hits");   
00303   h_ele_chi2           -> GetXaxis()-> SetTitle("#Chi^{2}");   
00304   h_ele_charge         -> GetXaxis()-> SetTitle("charge");   
00305   h_ele_vertexP        -> GetXaxis()-> SetTitle("p_{vertex} (GeV/c)");
00306   h_ele_vertexPt       -> GetXaxis()-> SetTitle("p_{T vertex} (GeV/c)");
00307   h_ele_vertexEta      -> GetXaxis()-> SetTitle("#eta");  
00308   h_ele_vertexPhi      -> GetXaxis()-> SetTitle("#phi");   
00309   h_ele_PoPmatchingObject        -> GetXaxis()-> SetTitle("P/P_{jet}");
00310   h_ele_EtaMnEtamatchingObject   -> GetXaxis()-> SetTitle("#eta_{rec} - #eta_{jet}");
00311   h_ele_PhiMnPhimatchingObject   -> GetXaxis()-> SetTitle("#phi_{rec} - #phi_{jet}");
00312   h_ele_PinMnPout      -> GetXaxis()-> SetTitle("p_{vertex} - p_{out} (GeV)");
00313   h_ele_PinMnPout_mode      -> GetXaxis()-> SetTitle("p_{vertex} - p_{out}, mode (GeV)");
00314   h_ele_outerP         -> GetXaxis()-> SetTitle("p_{out} (GeV/c)");
00315   h_ele_outerP_mode         -> GetXaxis()-> SetTitle("p_{out} (GeV/c)");
00316   h_ele_outerPt        -> GetXaxis()-> SetTitle("p_{T out} (GeV/c)");
00317   h_ele_outerPt_mode        -> GetXaxis()-> SetTitle("p_{T out} (GeV/c)");
00318   h_ele_EoP            -> GetXaxis()-> SetTitle("E/p_{vertex}");
00319   h_ele_EoPout         -> GetXaxis()-> SetTitle("E/p_{out}");
00320 
00321 }     
00322 
00323 void
00324 GsfElectronFakeAnalyzer::endJob(){
00325   
00326   histfile_->cd();
00327   std::cout << "efficiency calculation " << std::endl; 
00328   // efficiency vs eta
00329   TH1F *h_ele_etaEff = (TH1F*)h_ele_matchingObjectEta_matched->Clone("h_ele_etaEff");
00330   h_ele_etaEff->Reset();
00331   h_ele_etaEff->Divide(h_ele_matchingObjectEta_matched,h_matchingObjectEta,1,1);
00332   h_ele_etaEff->Print();
00333   h_ele_etaEff->GetXaxis()->SetTitle("#eta");
00334   h_ele_etaEff->GetYaxis()->SetTitle("eff");
00335   
00336   // efficiency vs z
00337   TH1F *h_ele_zEff = (TH1F*)h_ele_matchingObjectZ_matched->Clone("h_ele_zEff");
00338   h_ele_zEff->Reset();
00339   h_ele_zEff->Divide(h_ele_matchingObjectZ_matched,h_matchingObjectZ,1,1);
00340   h_ele_zEff->Print();
00341   h_ele_zEff->GetXaxis()->SetTitle("z");
00342   h_ele_zEff->GetYaxis()->SetTitle("eff");
00343 
00344   // efficiency vs |eta|
00345   TH1F *h_ele_absetaEff = (TH1F*)h_ele_matchingObjectAbsEta_matched->Clone("h_ele_absetaEff");
00346   h_ele_absetaEff->Reset();
00347   h_ele_absetaEff->Divide(h_ele_matchingObjectAbsEta_matched,h_matchingObjectAbsEta,1,1);
00348   h_ele_absetaEff->GetXaxis()->SetTitle("|#eta|");
00349   h_ele_absetaEff->GetYaxis()->SetTitle("eff");
00350 
00351   // efficiency vs pt
00352   TH1F *h_ele_ptEff = (TH1F*)h_ele_matchingObjectPt_matched->Clone("h_ele_ptEff");
00353   h_ele_ptEff->Reset();
00354   h_ele_ptEff->Divide(h_ele_matchingObjectPt_matched,h_matchingObjectPt,1,1);
00355   h_ele_ptEff->GetXaxis()->SetTitle("p_T");
00356   h_ele_ptEff->GetYaxis()->SetTitle("eff");
00357 
00358   // efficiency vs phi
00359   TH1F *h_ele_phiEff = (TH1F*)h_ele_matchingObjectPhi_matched->Clone("h_ele_phiEff");
00360   h_ele_phiEff->Reset();
00361   h_ele_phiEff->Divide(h_ele_matchingObjectPhi_matched,h_matchingObjectPhi,1,1);
00362   h_ele_phiEff->GetXaxis()->SetTitle("phi");
00363   h_ele_phiEff->GetYaxis()->SetTitle("eff");
00364 
00365   // rec/matching objects all electrons
00366   TH1F *h_ele_etaEff_all = (TH1F*)h_ele_vertexEta_all->Clone("h_ele_etaEff_all");
00367   h_ele_etaEff_all->Reset();
00368   h_ele_etaEff_all->Divide(h_ele_vertexEta_all,h_matchingObjectEta,1,1);
00369   h_ele_etaEff_all->Print();
00370   h_ele_etaEff_all->GetXaxis()->SetTitle("#eta");
00371   h_ele_etaEff_all->GetYaxis()->SetTitle("# rec/# matching objects");
00372   TH1F *h_ele_ptEff_all = (TH1F*)h_ele_vertexPt_all->Clone("h_ele_ptEff_all");
00373   h_ele_ptEff_all->Reset();
00374   h_ele_ptEff_all->Divide(h_ele_vertexPt_all,h_matchingObjectPt,1,1);
00375   h_ele_ptEff_all->Print();
00376   h_ele_ptEff_all->GetXaxis()->SetTitle("p_{T}");
00377   h_ele_ptEff_all->GetYaxis()->SetTitle("# rec/# matching objects");
00378 
00379   // classes
00380   TH1F *h_ele_eta_goldenFrac = (TH1F*)h_ele_eta_golden->Clone("h_ele_eta_goldenFrac");
00381   h_ele_eta_goldenFrac->Reset();
00382   h_ele_eta_goldenFrac->Divide(h_ele_eta_golden,h_ele_eta,1,1);
00383   TH1F *h_ele_eta_bbremFrac = (TH1F*)h_ele_eta_bbrem->Clone("h_ele_eta_bbremFrac");
00384   h_ele_eta_bbremFrac->Reset();
00385   h_ele_eta_bbremFrac->Divide(h_ele_eta_bbrem,h_ele_eta,1,1);
00386   TH1F *h_ele_eta_narrowFrac = (TH1F*)h_ele_eta_narrow->Clone("h_ele_eta_narrowFrac");
00387   h_ele_eta_narrowFrac->Reset();
00388   h_ele_eta_narrowFrac->Divide(h_ele_eta_narrow,h_ele_eta,1,1);
00389   TH1F *h_ele_eta_showerFrac = (TH1F*)h_ele_eta_shower->Clone("h_ele_eta_showerFrac");
00390   h_ele_eta_showerFrac->Reset();
00391   h_ele_eta_showerFrac->Divide(h_ele_eta_shower,h_ele_eta,1,1);
00392   
00393   // fbrem
00394   TH1F *h_ele_xOverX0VsEta = new TH1F( "h_ele_xOverx0VsEta","mean X/X_0 vs eta",nbineta/2,0.0,2.5);
00395   for (int ibin=1;ibin<h_ele_fbremVsEta_mean->GetNbinsX()+1;ibin++) {
00396     double xOverX0 = 0.;
00397     if (h_ele_fbremVsEta_mean->GetBinContent(ibin)>0.) xOverX0 = -log(h_ele_fbremVsEta_mean->GetBinContent(ibin));
00398     h_ele_xOverX0VsEta->SetBinContent(ibin,xOverX0);
00399   }
00400    
00401   //profiles from 2D histos
00402   TProfile *p_ele_PoPmatchingObjectVsEta = h_ele_PoPmatchingObjectVsEta->ProfileX();
00403   p_ele_PoPmatchingObjectVsEta->Write();
00404   TProfile *p_ele_PoPmatchingObjectVsPhi = h_ele_PoPmatchingObjectVsPhi->ProfileX();
00405   p_ele_PoPmatchingObjectVsPhi->Write();
00406   TProfile *p_ele_EtaMnEtamatchingObjectVsEta = h_ele_EtaMnEtamatchingObjectVsEta->ProfileX();
00407   p_ele_EtaMnEtamatchingObjectVsEta->Write();
00408   TProfile *p_ele_EtaMnEtamatchingObjectVsPhi = h_ele_EtaMnEtamatchingObjectVsPhi->ProfileX();
00409   p_ele_EtaMnEtamatchingObjectVsPhi->Write();
00410   TProfile *p_ele_PhiMnPhimatchingObjectVsEta = h_ele_PhiMnPhimatchingObjectVsEta->ProfileX();
00411   p_ele_PhiMnPhimatchingObjectVsEta->Write();
00412   TProfile *p_ele_PhiMnPhimatchingObjectVsPhi = h_ele_PhiMnPhimatchingObjectVsPhi->ProfileX();
00413   p_ele_PhiMnPhimatchingObjectVsPhi->Write();
00414   TProfile *p_ele_vertexPtVsEta = h_ele_vertexPtVsEta->ProfileX();
00415   p_ele_vertexPtVsEta->Write();
00416   TProfile *p_ele_vertexPtVsPhi = h_ele_vertexPtVsPhi->ProfileX();
00417   p_ele_vertexPtVsPhi->Write();
00418   TProfile *p_ele_EoPVsEta = h_ele_EoPVsEta->ProfileX();
00419   p_ele_EoPVsEta->Write();
00420   TProfile *p_ele_EoPVsPhi = h_ele_EoPVsPhi->ProfileX();
00421   p_ele_EoPVsPhi->Write();
00422   TProfile *p_ele_EoPoutVsEta = h_ele_EoPoutVsEta->ProfileX();
00423   p_ele_EoPoutVsEta->Write();
00424   TProfile *p_ele_EoPoutVsPhi = h_ele_EoPoutVsPhi->ProfileX();
00425   p_ele_EoPoutVsPhi->Write();
00426   TProfile *p_ele_HoEVsEta = h_ele_HoEVsEta->ProfileX();
00427   p_ele_HoEVsEta->Write();
00428   TProfile *p_ele_HoEVsPhi = h_ele_HoEVsPhi->ProfileX();
00429   p_ele_HoEVsPhi->Write();
00430   TProfile *p_ele_chi2VsEta = h_ele_chi2VsEta->ProfileX();
00431   p_ele_chi2VsEta->Write();
00432   TProfile *p_ele_chi2VsPhi = h_ele_chi2VsPhi->ProfileX();
00433   p_ele_chi2VsPhi->Write();
00434   TProfile *p_ele_foundHitsVsEta = h_ele_foundHitsVsEta->ProfileX();
00435   p_ele_foundHitsVsEta->Write();
00436   TProfile *p_ele_foundHitsVsPhi = h_ele_foundHitsVsPhi->ProfileX();
00437   p_ele_foundHitsVsPhi->Write();
00438   TProfile *p_ele_lostHitsVsEta = h_ele_lostHitsVsEta->ProfileX();
00439   p_ele_lostHitsVsEta->Write();
00440   TProfile *p_ele_lostHitsVsPhi = h_ele_lostHitsVsPhi->ProfileX();
00441   p_ele_lostHitsVsPhi->Write();
00442   
00443   // mc truth  
00444 
00445   h_matchingObjectNum->Write();
00446     
00447   // rec event
00448   
00449   histNum_->Write();
00450   
00451   // mc  
00452   h_matchingObjectEta->Write();
00453   h_matchingObjectAbsEta->Write();
00454   h_matchingObjectP->Write();
00455   h_matchingObjectPt->Write();
00456 
00457   // ctf tracks
00458   h_ctf_foundHitsVsEta->Write();
00459   h_ctf_lostHitsVsEta->Write();
00460   
00461   // all electrons  
00462   h_ele_EoverP_all->Write();
00463   h_ele_TIP_all->Write();
00464   h_ele_vertexPt_all->Write();
00465   h_ele_vertexEta_all->Write();
00466   h_ele_mee_all->Write();
00467 
00468   // matched electrons
00469   h_ele_charge->Write();
00470   h_ele_chargeVsEta->Write();
00471   h_ele_chargeVsPhi->Write();
00472   h_ele_chargeVsPt->Write();
00473   h_ele_vertexP->Write();
00474   h_ele_vertexPt->Write();
00475   h_ele_vertexPtVsEta->Write();
00476   h_ele_vertexPtVsPhi->Write();
00477   h_ele_matchingObjectPt_matched->Write();
00478   h_ele_vertexEta->Write();
00479   h_ele_vertexEtaVsPhi->Write();
00480   h_ele_matchingObjectAbsEta_matched->Write();
00481   h_ele_matchingObjectEta_matched->Write();
00482   h_ele_vertexPhi->Write();
00483   h_ele_vertexX->Write();
00484   h_ele_vertexY ->Write();
00485   h_ele_vertexZ->Write();
00486   h_ele_vertexTIP->Write();
00487   h_ele_matchingObjectZ_matched->Write();
00488   h_ele_vertexTIPVsEta->Write();
00489   h_ele_vertexTIPVsPhi->Write();
00490   h_ele_vertexTIPVsPt->Write();
00491   h_ele_PoPmatchingObject->Write();
00492   h_ele_PoPmatchingObjectVsEta ->Write();
00493   h_ele_PoPmatchingObjectVsPhi->Write();
00494   h_ele_PoPmatchingObjectVsPt->Write();
00495   h_ele_PoPmatchingObject_barrel ->Write();
00496   h_ele_PoPmatchingObject_endcaps->Write();
00497   h_ele_EtaMnEtamatchingObject->Write();
00498   h_ele_EtaMnEtamatchingObjectVsEta ->Write();
00499   h_ele_EtaMnEtamatchingObjectVsPhi->Write();
00500   h_ele_EtaMnEtamatchingObjectVsPt->Write();
00501   h_ele_PhiMnPhimatchingObject ->Write();
00502   h_ele_PhiMnPhimatchingObject2 ->Write();
00503   h_ele_PhiMnPhimatchingObjectVsEta->Write();
00504   h_ele_PhiMnPhimatchingObjectVsPhi->Write();
00505   h_ele_PhiMnPhimatchingObjectVsPt->Write();
00506 
00507   // matched electron, superclusters
00508   histSclEn_->Write();
00509   histSclEoEmatchingObject_barrel->Write();
00510   histSclEoEmatchingObject_endcaps->Write();
00511   histSclEt_->Write();
00512   histSclEtVsEta_->Write();
00513   histSclEtVsPhi_->Write();
00514   histSclEtaVsPhi_ ->Write();
00515   histSclEta_->Write();
00516   histSclPhi_->Write();
00517 
00518   // matched electron, gsf tracks
00519   h_ele_foundHits->Write();
00520   h_ele_foundHitsVsEta->Write();
00521   h_ele_foundHitsVsPhi->Write();
00522   h_ele_foundHitsVsPt->Write();
00523   h_ctf_foundHits->Write();
00524   h_ele_lostHits->Write();
00525   h_ele_lostHitsVsEta->Write();
00526   h_ele_lostHitsVsPhi->Write();
00527   h_ele_lostHitsVsPt->Write();
00528   h_ele_chi2 ->Write();
00529   h_ele_chi2VsEta ->Write();
00530   h_ele_chi2VsPhi ->Write();
00531   h_ele_chi2VsPt->Write();
00532   h_ele_PinMnPout->Write();
00533   h_ele_PinMnPout_mode->Write();
00534   h_ele_PinMnPoutVsEta_mode->Write();
00535   h_ele_PinMnPoutVsPhi_mode->Write();
00536   h_ele_PinMnPoutVsPt_mode->Write();
00537   h_ele_PinMnPoutVsE_mode->Write();
00538   h_ele_PinMnPoutVsChi2_mode->Write();
00539   h_ele_outerP ->Write();
00540   h_ele_outerP_mode->Write();
00541   h_ele_outerPVsEta_mode->Write();
00542   h_ele_outerPt->Write();
00543   h_ele_outerPt_mode ->Write();
00544   h_ele_outerPtVsEta_mode->Write();
00545   h_ele_outerPtVsPhi_mode->Write();
00546   h_ele_outerPtVsPt_mode->Write();
00547   
00548   // matched electrons, matching 
00549   h_ele_EoP ->Write();
00550   h_ele_EoPVsEta ->Write();
00551   h_ele_EoPVsPhi->Write();
00552   h_ele_EoPVsE->Write();
00553   h_ele_EoPout->Write();
00554   h_ele_EoPoutVsEta->Write();
00555   h_ele_EoPoutVsPhi->Write();
00556   h_ele_EoPoutVsE ->Write();
00557   h_ele_dEtaSc_propVtx->Write();
00558   h_ele_dEtaScVsEta_propVtx->Write();
00559   h_ele_dEtaScVsPhi_propVtx->Write();
00560   h_ele_dEtaScVsPt_propVtx ->Write();
00561   h_ele_dPhiSc_propVtx->Write();
00562   h_ele_dPhiScVsEta_propVtx ->Write();
00563   h_ele_dPhiScVsPhi_propVtx->Write();
00564   h_ele_dPhiScVsPt_propVtx->Write();
00565   h_ele_dEtaCl_propOut->Write();
00566   h_ele_dEtaClVsEta_propOut->Write();
00567   h_ele_dEtaClVsPhi_propOut->Write();
00568   h_ele_dEtaClVsPt_propOut->Write();
00569   h_ele_dPhiCl_propOut->Write();
00570   h_ele_dPhiClVsEta_propOut->Write();
00571   h_ele_dPhiClVsPhi_propOut->Write();
00572   h_ele_dPhiClVsPt_propOut->Write();
00573   
00574   h_ele_HoE->Write();
00575   h_ele_HoEVsEta->Write();
00576   h_ele_HoEVsPhi->Write();
00577   h_ele_HoEVsE->Write();
00578  
00579   // classes  
00580   h_ele_classes->Write();
00581   h_ele_eta->Write();
00582   h_ele_eta_golden->Write();
00583   h_ele_eta_bbrem->Write();
00584   h_ele_eta_narrow->Write();
00585   h_ele_eta_shower->Write();
00586   h_ele_PinVsPoutGolden_mode->Write();
00587   h_ele_PinVsPoutShowering0_mode->Write();
00588   h_ele_PinVsPoutShowering1234_mode->Write();
00589   h_ele_PinVsPoutGolden_mean->Write();
00590   h_ele_PinVsPoutShowering0_mean->Write();
00591   h_ele_PinVsPoutShowering1234_mean->Write();
00592   h_ele_PtinVsPtoutGolden_mode->Write();
00593   h_ele_PtinVsPtoutShowering0_mode->Write();
00594   h_ele_PtinVsPtoutShowering1234_mode->Write();
00595   h_ele_PtinVsPtoutGolden_mean->Write();
00596   h_ele_PtinVsPtoutShowering0_mean->Write();
00597   h_ele_PtinVsPtoutShowering1234_mean->Write();
00598   histSclEoEmatchingObjectGolden_barrel->Write();
00599   histSclEoEmatchingObjectGolden_endcaps->Write();
00600   histSclEoEmatchingObjectShowering0_barrel->Write();
00601   histSclEoEmatchingObjectShowering0_endcaps->Write();
00602   histSclEoEmatchingObjectShowering1234_barrel->Write();
00603   histSclEoEmatchingObjectShowering1234_endcaps->Write();
00604 
00605   // fbrem
00606   h_ele_fbremVsEta_mode->Write();
00607   h_ele_fbremVsEta_mean->Write();
00608   h_ele_etaEff->Write();
00609   h_ele_zEff->Write();
00610   h_ele_phiEff->Write();
00611   h_ele_absetaEff->Write();
00612   h_ele_ptEff->Write();
00613   h_ele_etaEff_all->Write();
00614   h_ele_ptEff_all->Write();
00615   h_ele_eta_goldenFrac->Write();
00616   h_ele_eta_bbremFrac->Write();
00617   h_ele_eta_narrowFrac->Write();
00618   h_ele_eta_showerFrac->Write();
00619   h_ele_xOverX0VsEta->Write();
00620   
00621 }
00622 
00623 void
00624 GsfElectronFakeAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
00625 {
00626   std::cout << "analyzing new event " << std::endl;
00627 
00628   // get reco electrons  
00629   edm::Handle<reco::GsfElectronCollection> gsfElectrons;
00630   iEvent.getByLabel(electronCollection_,gsfElectrons); 
00631   edm::LogInfo("")<<"\n\n =================> Treating event "<<iEvent.id()<<" Number of electrons "<<gsfElectrons.product()->size();
00632 
00633   // get reco calojet collection
00634   edm::Handle<reco::CaloJetCollection> recoCaloJets;
00635   iEvent.getByLabel(matchingObjectCollection_, recoCaloJets); 
00636 
00637   histNum_->Fill((*gsfElectrons).size());
00638   
00639   // all rec electrons
00640   for (reco::GsfElectronCollection::const_iterator gsfIter=gsfElectrons->begin();
00641    gsfIter!=gsfElectrons->end(); gsfIter++){
00642     // preselect electrons
00643     if (gsfIter->pt()>maxPt_ || fabs(gsfIter->eta())>maxAbsEta_) continue;
00644     double d = gsfIter->gsfTrack()->vertex().x()*gsfIter->gsfTrack()->vertex().x()+
00645      gsfIter->gsfTrack()->vertex().y()*gsfIter->gsfTrack()->vertex().y();
00646     h_ele_TIP_all     -> Fill( sqrt(d) );
00647     h_ele_EoverP_all     -> Fill( gsfIter->eSuperClusterOverP() );
00648     h_ele_vertexEta_all     -> Fill( gsfIter->eta() );
00649     h_ele_vertexPt_all      -> Fill( gsfIter->pt() );
00650     // mee
00651     for (reco::GsfElectronCollection::const_iterator gsfIter2=gsfIter+1;
00652      gsfIter2!=gsfElectrons->end(); gsfIter2++){
00653              math::XYZTLorentzVector p12 = (*gsfIter).p4()+(*gsfIter2).p4();
00654         float mee2 = p12.Dot(p12);
00655         h_ele_mee_all -> Fill(sqrt(mee2));       
00656     }
00657   }
00658    
00659   // association matching object-reco electrons
00660   int matchingObjectNum=0;
00661       
00662   for ( reco::CaloJetCollection::const_iterator moIter=recoCaloJets->begin();
00663    moIter!=recoCaloJets->end(); moIter++ ) {
00664     
00665     // number of matching objects
00666     matchingObjectNum++;
00667 
00668       if (moIter->energy()/cosh(moIter->eta())> maxPt_ || fabs(moIter->eta())> maxAbsEta_) continue;
00669       
00670       // suppress the endcaps
00671       //if (fabs(moIter->eta()) > 1.5) continue;
00672       // select central z
00673       //if ( fabs((*mcIter)->production_vertex()->position().z())>50.) continue;
00674  
00675       h_matchingObjectEta -> Fill( moIter->eta() );
00676       h_matchingObjectAbsEta -> Fill( fabs(moIter->eta()) );
00677       h_matchingObjectP   -> Fill( moIter->energy() );
00678       h_matchingObjectPt   -> Fill( moIter->energy()/cosh(moIter->eta()) );
00679       h_matchingObjectPhi   -> Fill( moIter->phi() );
00680       h_matchingObjectZ   -> Fill(  moIter->vz() );
00681         
00682       // looking for the best matching gsf electron
00683       bool okGsfFound = false;
00684       double gsfOkRatio = 999999.;
00685 
00686       // find best matched electron
00687       reco::GsfElectron bestGsfElectron;
00688       for (reco::GsfElectronCollection::const_iterator gsfIter=gsfElectrons->begin();
00689        gsfIter!=gsfElectrons->end(); gsfIter++){
00690         
00691         double deltaR = sqrt(pow((gsfIter->eta()-moIter->eta()),2) + pow((gsfIter->phi()-moIter->phi()),2));
00692         if ( deltaR < deltaR_ ){
00693         //if ( (genPc->pdg_id() == 11) && (gsfIter->charge() < 0.) || (genPc->pdg_id() == -11) &&
00694         //(gsfIter->charge() > 0.) ){
00695           double tmpGsfRatio = gsfIter->p()/moIter->energy();
00696           if ( fabs(tmpGsfRatio-1) < fabs(gsfOkRatio-1) ) {
00697             gsfOkRatio = tmpGsfRatio;
00698             bestGsfElectron=*gsfIter;
00699             okGsfFound = true;
00700           } 
00701         //} 
00702         } 
00703       } // loop over rec ele to look for the best one   
00704 
00705       // analysis when the matching object is matched by a rec electron
00706      if (okGsfFound){
00707 
00708         // electron related distributions
00709         h_ele_charge        -> Fill( bestGsfElectron.charge() );
00710         h_ele_chargeVsEta        -> Fill( bestGsfElectron.eta(),bestGsfElectron.charge() );
00711         h_ele_chargeVsPhi        -> Fill( bestGsfElectron.phi(),bestGsfElectron.charge() );
00712         h_ele_chargeVsPt        -> Fill( bestGsfElectron.pt(),bestGsfElectron.charge() );
00713         h_ele_vertexP       -> Fill( bestGsfElectron.p() );
00714         h_ele_vertexPt      -> Fill( bestGsfElectron.pt() );
00715         h_ele_vertexPtVsEta      -> Fill(  bestGsfElectron.eta(),bestGsfElectron.pt() );
00716         h_ele_vertexPtVsPhi      -> Fill(  bestGsfElectron.phi(),bestGsfElectron.pt() );
00717         h_ele_vertexEta     -> Fill( bestGsfElectron.eta() );
00718         // generated distributions for matched electrons
00719         h_ele_matchingObjectPt_matched      -> Fill( moIter->energy()/cosh(moIter->eta()) );
00720         h_ele_matchingObjectPhi_matched   -> Fill( moIter->phi() );
00721         h_ele_matchingObjectAbsEta_matched     -> Fill( fabs(moIter->eta()) );
00722         h_ele_matchingObjectEta_matched     -> Fill( moIter->eta() );
00723         h_ele_vertexEtaVsPhi     -> Fill(  bestGsfElectron.phi(),bestGsfElectron.eta() );
00724         h_ele_vertexPhi     -> Fill( bestGsfElectron.phi() );
00725         h_ele_vertexX     -> Fill( bestGsfElectron.vertex().x() );
00726         h_ele_vertexY     -> Fill( bestGsfElectron.vertex().y() );
00727         h_ele_vertexZ     -> Fill( bestGsfElectron.vertex().z() );
00728         h_ele_matchingObjectZ_matched   -> Fill( moIter->vz() );
00729         double d = bestGsfElectron.gsfTrack()->vertex().x()*bestGsfElectron.gsfTrack()->vertex().x()+
00730          bestGsfElectron.gsfTrack()->vertex().y()*bestGsfElectron.gsfTrack()->vertex().y();
00731         d = sqrt(d); 
00732         h_ele_vertexTIP     -> Fill( d );
00733         h_ele_vertexTIPVsEta     -> Fill(  bestGsfElectron.eta(), d );
00734         h_ele_vertexTIPVsPhi     -> Fill(  bestGsfElectron.phi(), d );
00735         h_ele_vertexTIPVsPt     -> Fill(  bestGsfElectron.pt(), d );    
00736         h_ele_EtaMnEtamatchingObject  -> Fill( bestGsfElectron.eta()-moIter->eta());
00737         h_ele_EtaMnEtamatchingObjectVsEta  -> Fill( bestGsfElectron.eta(), bestGsfElectron.eta()-moIter->eta());
00738         h_ele_EtaMnEtamatchingObjectVsPhi  -> Fill( bestGsfElectron.phi(), bestGsfElectron.eta()-moIter->eta());
00739         h_ele_EtaMnEtamatchingObjectVsPt  -> Fill( bestGsfElectron.pt(), bestGsfElectron.eta()-moIter->eta());
00740         h_ele_PhiMnPhimatchingObject  -> Fill( bestGsfElectron.phi()-moIter->phi());
00741         h_ele_PhiMnPhimatchingObject2  -> Fill( bestGsfElectron.phi()-moIter->phi());
00742         h_ele_PhiMnPhimatchingObjectVsEta  -> Fill( bestGsfElectron.eta(), bestGsfElectron.phi()-moIter->phi());
00743         h_ele_PhiMnPhimatchingObjectVsPhi  -> Fill( bestGsfElectron.phi(), bestGsfElectron.phi()-moIter->phi());
00744         h_ele_PhiMnPhimatchingObjectVsPt  -> Fill( bestGsfElectron.pt(), bestGsfElectron.phi()-moIter->phi());
00745         h_ele_PoPmatchingObject       -> Fill( bestGsfElectron.p()/moIter->energy());
00746         h_ele_PoPmatchingObjectVsEta       -> Fill( bestGsfElectron.eta(), bestGsfElectron.p()/moIter->energy());
00747         h_ele_PoPmatchingObjectVsPhi       -> Fill( bestGsfElectron.phi(), bestGsfElectron.p()/moIter->energy());
00748         h_ele_PoPmatchingObjectVsPt       -> Fill( bestGsfElectron.py(), bestGsfElectron.p()/moIter->energy());
00749         if (bestGsfElectron.classification() < 100) h_ele_PoPmatchingObject_barrel       -> Fill( bestGsfElectron.p()/moIter->energy());
00750         if (bestGsfElectron.classification() >= 100) h_ele_PoPmatchingObject_endcaps       -> Fill( bestGsfElectron.p()/moIter->energy());
00751 
00752         // supercluster related distributions
00753         reco::SuperClusterRef sclRef = bestGsfElectron.superCluster();
00754         histSclEn_->Fill(sclRef->energy());
00755         double R=TMath::Sqrt(sclRef->x()*sclRef->x() + sclRef->y()*sclRef->y() +sclRef->z()*sclRef->z());
00756         double Rt=TMath::Sqrt(sclRef->x()*sclRef->x() + sclRef->y()*sclRef->y());
00757         histSclEt_->Fill(sclRef->energy()*(Rt/R));
00758         histSclEtVsEta_->Fill(sclRef->eta(),sclRef->energy()*(Rt/R));
00759         histSclEtVsPhi_->Fill(sclRef->phi(),sclRef->energy()*(Rt/R));
00760         if (bestGsfElectron.classification() < 100)  histSclEoEmatchingObject_barrel->Fill(sclRef->energy()/moIter->energy());
00761         if (bestGsfElectron.classification() >= 100)  histSclEoEmatchingObject_endcaps->Fill(sclRef->energy()/moIter->energy());
00762         histSclEta_->Fill(sclRef->eta());
00763         histSclEtaVsPhi_->Fill(sclRef->phi(),sclRef->eta());
00764         histSclPhi_->Fill(sclRef->phi());
00765 
00766         // track related distributions
00767         h_ele_foundHits     -> Fill( bestGsfElectron.gsfTrack()->numberOfValidHits() );
00768         h_ele_foundHitsVsEta     -> Fill( bestGsfElectron.eta(), bestGsfElectron.gsfTrack()->numberOfValidHits() );
00769         h_ele_foundHitsVsPhi     -> Fill( bestGsfElectron.phi(), bestGsfElectron.gsfTrack()->numberOfValidHits() );
00770         h_ele_foundHitsVsPt     -> Fill( bestGsfElectron.pt(), bestGsfElectron.gsfTrack()->numberOfValidHits() );
00771         h_ele_lostHits      -> Fill( bestGsfElectron.gsfTrack()->numberOfLostHits() );
00772         h_ele_lostHitsVsEta      -> Fill( bestGsfElectron.eta(), bestGsfElectron.gsfTrack()->numberOfLostHits() );
00773         h_ele_lostHitsVsPhi      -> Fill( bestGsfElectron.phi(), bestGsfElectron.gsfTrack()->numberOfLostHits() );
00774         h_ele_lostHitsVsPt      -> Fill( bestGsfElectron.pt(), bestGsfElectron.gsfTrack()->numberOfLostHits() );
00775         h_ele_chi2          -> Fill( bestGsfElectron.gsfTrack()->normalizedChi2() );  
00776         h_ele_chi2VsEta          -> Fill( bestGsfElectron.eta(), bestGsfElectron.gsfTrack()->normalizedChi2() );  
00777         h_ele_chi2VsPhi          -> Fill( bestGsfElectron.phi(), bestGsfElectron.gsfTrack()->normalizedChi2() );  
00778         h_ele_chi2VsPt          -> Fill( bestGsfElectron.pt(), bestGsfElectron.gsfTrack()->normalizedChi2() );  
00779         // from gsf track interface, hence using mean
00780         h_ele_PinMnPout     -> Fill( bestGsfElectron.gsfTrack()->innerMomentum().R() - bestGsfElectron.gsfTrack()->outerMomentum().R() );
00781         h_ele_outerP        -> Fill( bestGsfElectron.gsfTrack()->outerMomentum().R() );
00782         h_ele_outerPt       -> Fill( bestGsfElectron.gsfTrack()->outerMomentum().Rho() );
00783         // from electron interface, hence using mode
00784         h_ele_PinMnPout_mode     -> Fill( bestGsfElectron.trackMomentumAtVtx().R() - bestGsfElectron.trackMomentumOut().R() );
00785         h_ele_PinMnPoutVsEta_mode     -> Fill(  bestGsfElectron.eta(), bestGsfElectron.trackMomentumAtVtx().R() - bestGsfElectron.trackMomentumOut().R() );
00786         h_ele_PinMnPoutVsPhi_mode     -> Fill(  bestGsfElectron.phi(), bestGsfElectron.trackMomentumAtVtx().R() - bestGsfElectron.trackMomentumOut().R() );
00787         h_ele_PinMnPoutVsPt_mode     -> Fill(  bestGsfElectron.pt(), bestGsfElectron.trackMomentumAtVtx().R() - bestGsfElectron.trackMomentumOut().R() );
00788         h_ele_PinMnPoutVsE_mode     -> Fill(  bestGsfElectron.caloEnergy(), bestGsfElectron.trackMomentumAtVtx().R() - bestGsfElectron.trackMomentumOut().R() );
00789         h_ele_PinMnPoutVsChi2_mode     -> Fill(  bestGsfElectron.gsfTrack()->normalizedChi2(), bestGsfElectron.trackMomentumAtVtx().R() - bestGsfElectron.trackMomentumOut().R() );
00790         h_ele_outerP_mode        -> Fill( bestGsfElectron.trackMomentumOut().R() );
00791         h_ele_outerPVsEta_mode        -> Fill(bestGsfElectron.eta(),  bestGsfElectron.trackMomentumOut().R() );
00792         h_ele_outerPt_mode       -> Fill( bestGsfElectron.trackMomentumOut().Rho() );
00793         h_ele_outerPtVsEta_mode       -> Fill(bestGsfElectron.eta(),  bestGsfElectron.trackMomentumOut().Rho() );
00794         h_ele_outerPtVsPhi_mode       -> Fill(bestGsfElectron.phi(),  bestGsfElectron.trackMomentumOut().Rho() );
00795         h_ele_outerPtVsPt_mode       -> Fill(bestGsfElectron.pt(),  bestGsfElectron.trackMomentumOut().Rho() );
00796         
00797         // match distributions 
00798         h_ele_EoP    -> Fill( bestGsfElectron.eSuperClusterOverP() );
00799         h_ele_EoPVsEta    -> Fill(bestGsfElectron.eta(),  bestGsfElectron.eSuperClusterOverP() );
00800         h_ele_EoPVsPhi    -> Fill(bestGsfElectron.phi(),  bestGsfElectron.eSuperClusterOverP() );
00801         h_ele_EoPVsE    -> Fill(bestGsfElectron.caloEnergy(),  bestGsfElectron.eSuperClusterOverP() );
00802         h_ele_EoPout -> Fill( bestGsfElectron.eSeedClusterOverPout() );
00803         h_ele_EoPoutVsEta -> Fill( bestGsfElectron.eta(), bestGsfElectron.eSeedClusterOverPout() );
00804         h_ele_EoPoutVsPhi -> Fill( bestGsfElectron.phi(), bestGsfElectron.eSeedClusterOverPout() );
00805         h_ele_EoPoutVsE -> Fill( bestGsfElectron.caloEnergy(), bestGsfElectron.eSeedClusterOverPout() );
00806         h_ele_dEtaSc_propVtx -> Fill(bestGsfElectron.deltaEtaSuperClusterTrackAtVtx());
00807         h_ele_dEtaScVsEta_propVtx -> Fill( bestGsfElectron.eta(),bestGsfElectron.deltaEtaSuperClusterTrackAtVtx());
00808         h_ele_dEtaScVsPhi_propVtx -> Fill(bestGsfElectron.phi(),bestGsfElectron.deltaEtaSuperClusterTrackAtVtx());
00809         h_ele_dEtaScVsPt_propVtx -> Fill(bestGsfElectron.pt(),bestGsfElectron.deltaEtaSuperClusterTrackAtVtx());
00810         h_ele_dPhiSc_propVtx -> Fill(bestGsfElectron.deltaPhiSuperClusterTrackAtVtx()); 
00811         h_ele_dPhiScVsEta_propVtx -> Fill( bestGsfElectron.eta(),bestGsfElectron.deltaPhiSuperClusterTrackAtVtx()); 
00812         h_ele_dPhiScVsPhi_propVtx -> Fill(bestGsfElectron.phi(),bestGsfElectron.deltaPhiSuperClusterTrackAtVtx()); 
00813         h_ele_dPhiScVsPt_propVtx -> Fill(bestGsfElectron.pt(),bestGsfElectron.deltaPhiSuperClusterTrackAtVtx()); 
00814         h_ele_dEtaCl_propOut -> Fill(bestGsfElectron.deltaEtaSeedClusterTrackAtCalo()); 
00815         h_ele_dEtaClVsEta_propOut -> Fill( bestGsfElectron.eta(),bestGsfElectron.deltaEtaSeedClusterTrackAtCalo()); 
00816         h_ele_dEtaClVsPhi_propOut -> Fill(bestGsfElectron.phi(),bestGsfElectron.deltaEtaSeedClusterTrackAtCalo()); 
00817         h_ele_dEtaClVsPt_propOut -> Fill(bestGsfElectron.pt(),bestGsfElectron.deltaEtaSeedClusterTrackAtCalo()); 
00818         h_ele_dPhiCl_propOut -> Fill(bestGsfElectron.deltaPhiSeedClusterTrackAtCalo()); 
00819         h_ele_dPhiClVsEta_propOut -> Fill( bestGsfElectron.eta(),bestGsfElectron.deltaPhiSeedClusterTrackAtCalo()); 
00820         h_ele_dPhiClVsPhi_propOut -> Fill(bestGsfElectron.phi(),bestGsfElectron.deltaPhiSeedClusterTrackAtCalo()); 
00821         h_ele_dPhiClVsPt_propOut -> Fill(bestGsfElectron.pt(),bestGsfElectron.deltaPhiSeedClusterTrackAtCalo()); 
00822         h_ele_HoE -> Fill(bestGsfElectron.hadronicOverEm());
00823         h_ele_HoEVsEta -> Fill( bestGsfElectron.eta(),bestGsfElectron.hadronicOverEm());
00824         h_ele_HoEVsPhi -> Fill(bestGsfElectron.phi(),bestGsfElectron.hadronicOverEm());
00825         h_ele_HoEVsE -> Fill(bestGsfElectron.caloEnergy(),bestGsfElectron.hadronicOverEm());
00826          
00827         //classes
00828         int eleClass = bestGsfElectron.classification();
00829         h_ele_classes ->Fill(eleClass); 
00830 /*
00831         if (bestGsfElectron.classification() == 0)  histSclEoEmatchingObjectGolden_barrel->Fill(sclRef->energy()/moIter->energy());
00832         if (bestGsfElectron.classification() == 100)  histSclEoEmatchingObjectGolden_endcaps->Fill(sclRef->energy()/moIter->energy());
00833         if (bestGsfElectron.classification() == 30)  histSclEoEmatchingObjectShowering0_barrel->Fill(sclRef->energy()/moIter->energy());
00834         if (bestGsfElectron.classification() == 130)  histSclEoEmatchingObjectShowering0_endcaps->Fill(sclRef->energy()/moIter->energy());
00835         if (bestGsfElectron.classification() == 31 || bestGsfElectron.classification() == 32  || bestGsfElectron.classification() == 33 || eleClass == 34 )  histSclEoEmatchingObjectShowering1234_barrel->Fill(sclRef->energy()/moIter->energy());
00836         if (bestGsfElectron.classification() == 131 || bestGsfElectron.classification() == 132 || bestGsfElectron.classification() == 133 || eleClass == 134 )  histSclEoEmatchingObjectShowering1234_endcaps->Fill(sclRef->energy()/moIter->energy());
00837 */
00838         eleClass = eleClass%100; // get rid of barrel/endcap distinction
00839         h_ele_eta->Fill(fabs(bestGsfElectron.eta()));
00840         if (eleClass == 0) h_ele_eta_golden ->Fill(fabs(bestGsfElectron.eta()));
00841         if (eleClass == 10) h_ele_eta_bbrem ->Fill(fabs(bestGsfElectron.eta()));
00842         if (eleClass == 20) h_ele_eta_narrow ->Fill(fabs(bestGsfElectron.eta()));
00843         if (eleClass == 30 || eleClass == 31 || eleClass == 32  || eleClass == 33 || eleClass == 34 ) h_ele_eta_shower ->Fill(fabs(bestGsfElectron.eta()));
00844 
00845         //fbrem 
00846         double fbrem_mean =  bestGsfElectron.gsfTrack()->outerMomentum().R()/bestGsfElectron.gsfTrack()->innerMomentum().R();
00847         double fbrem_mode =  bestGsfElectron.trackMomentumOut().R()/bestGsfElectron.trackMomentumAtVtx().R();
00848         h_ele_fbremVsEta_mode->Fill(bestGsfElectron.eta(),fbrem_mode);
00849         h_ele_fbremVsEta_mean->Fill(bestGsfElectron.eta(),fbrem_mean);
00850  
00851         if (eleClass == 0) h_ele_PinVsPoutGolden_mode -> Fill(bestGsfElectron.trackMomentumOut().R(), bestGsfElectron.trackMomentumAtVtx().R());
00852         if (eleClass == 30)
00853          h_ele_PinVsPoutShowering0_mode -> Fill(bestGsfElectron.trackMomentumOut().R(), bestGsfElectron.trackMomentumAtVtx().R());
00854         if (eleClass == 31 || eleClass == 32  || eleClass == 33 || eleClass == 34 )
00855          h_ele_PinVsPoutShowering1234_mode -> Fill(bestGsfElectron.trackMomentumOut().R(), bestGsfElectron.trackMomentumAtVtx().R());
00856         if (eleClass == 0) h_ele_PinVsPoutGolden_mean -> Fill(bestGsfElectron.gsfTrack()->outerMomentum().R(), bestGsfElectron.gsfTrack()->innerMomentum().R());
00857         if (eleClass == 30)
00858          h_ele_PinVsPoutShowering0_mean ->  Fill(bestGsfElectron.gsfTrack()->outerMomentum().R(), bestGsfElectron.gsfTrack()->innerMomentum().R());
00859         if (eleClass == 31 || eleClass == 32  || eleClass == 33 || eleClass == 34 )
00860          h_ele_PinVsPoutShowering1234_mean ->  Fill(bestGsfElectron.gsfTrack()->outerMomentum().R(), bestGsfElectron.gsfTrack()->innerMomentum().R());
00861         if (eleClass == 0) h_ele_PtinVsPtoutGolden_mode -> Fill(bestGsfElectron.trackMomentumOut().Rho(), bestGsfElectron.trackMomentumAtVtx().Rho());
00862         if (eleClass == 30 )
00863          h_ele_PtinVsPtoutShowering0_mode -> Fill(bestGsfElectron.trackMomentumOut().Rho(), bestGsfElectron.trackMomentumAtVtx().Rho());
00864         if (eleClass == 31 || eleClass == 32  || eleClass == 33 || eleClass == 34 )
00865          h_ele_PtinVsPtoutShowering1234_mode -> Fill(bestGsfElectron.trackMomentumOut().Rho(), bestGsfElectron.trackMomentumAtVtx().Rho());
00866         if (eleClass == 0) h_ele_PtinVsPtoutGolden_mean -> Fill(bestGsfElectron.gsfTrack()->outerMomentum().Rho(), bestGsfElectron.gsfTrack()->innerMomentum().Rho());
00867         if (eleClass == 30 )
00868          h_ele_PtinVsPtoutShowering0_mean ->  Fill(bestGsfElectron.gsfTrack()->outerMomentum().Rho(), bestGsfElectron.gsfTrack()->innerMomentum().Rho());
00869         if (eleClass == 31 || eleClass == 32  || eleClass == 33 || eleClass == 34 )
00870          h_ele_PtinVsPtoutShowering1234_mean ->  Fill(bestGsfElectron.gsfTrack()->outerMomentum().Rho(), bestGsfElectron.gsfTrack()->innerMomentum().Rho());
00871 
00872       } // gsf electron found
00873 
00874 //    } // matching object found
00875 
00876 //    }
00877 
00878   } // loop overmatching object
00879   
00880   h_matchingObjectNum->Fill(matchingObjectNum);
00881 
00882 }
00883 
00884 

Generated on Tue Jun 9 17:43:33 2009 for CMSSW by  doxygen 1.5.4