00001 #include "DQMOffline/EGamma/plugins/ElectronAnalyzer.h"
00002
00003 #include "DQMServices/Core/interface/MonitorElement.h"
00004
00005 #include "DataFormats/GsfTrackReco/interface/GsfTrack.h"
00006 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
00007 #include "DataFormats/EgammaReco/interface/BasicClusterFwd.h"
00008 #include "DataFormats/VertexReco/interface/VertexFwd.h"
00009 #include "DataFormats/VertexReco/interface/Vertex.h"
00010 #include "DataFormats/Common/interface/Handle.h"
00011 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
00012 #include "DataFormats/Common/interface/TriggerResults.h"
00013
00014 #include "FWCore/Common/interface/TriggerNames.h"
00015 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00016 #include "FWCore/Framework/interface/EDAnalyzer.h"
00017 #include "FWCore/Framework/interface/Event.h"
00018 #include "FWCore/Framework/interface/MakerMacros.h"
00019 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00020
00021 #include "FWCore/ServiceRegistry/interface/Service.h"
00022
00023 #include "CLHEP/Units/GlobalPhysicalConstants.h"
00024 #include "TMath.h"
00025
00026 #include <iostream>
00027
00028 using namespace reco ;
00029
00030 ElectronAnalyzer::ElectronAnalyzer( const edm::ParameterSet & conf )
00031 : ElectronDqmAnalyzerBase(conf)
00032 {
00033
00034 Selection_ = conf.getParameter<int>("Selection");
00035 electronCollection_ = conf.getParameter<edm::InputTag>("ElectronCollection");
00036 matchingObjectCollection_ = conf.getParameter<edm::InputTag>("MatchingObjectCollection");
00037 trackCollection_ = conf.getParameter<edm::InputTag>("TrackCollection");
00038 vertexCollection_ = conf.getParameter<edm::InputTag>("VertexCollection");
00039 gsftrackCollection_ = conf.getParameter<edm::InputTag>("GsfTrackCollection");
00040 beamSpotTag_ = conf.getParameter<edm::InputTag>("BeamSpot");
00041 readAOD_ = conf.getParameter<bool>("ReadAOD");
00042
00043
00044 matchingCondition_ = conf.getParameter<std::string>("MatchingCondition");
00045 assert (matchingCondition_=="Cone") ;
00046 maxPtMatchingObject_ = conf.getParameter<double>("MaxPtMatchingObject");
00047 maxAbsEtaMatchingObject_ = conf.getParameter<double>("MaxAbsEtaMatchingObject");
00048 deltaR_ = conf.getParameter<double>("DeltaR");
00049
00050
00051 minEt_ = conf.getParameter<double>("MinEt");
00052 minPt_ = conf.getParameter<double>("MinPt");
00053 maxAbsEta_ = conf.getParameter<double>("MaxAbsEta");
00054 isEB_ = conf.getParameter<bool>("SelectEb");
00055 isEE_ = conf.getParameter<bool>("SelectEe");
00056 isNotEBEEGap_ = conf.getParameter<bool>("SelectNotEbEeGap");
00057 isEcalDriven_ = conf.getParameter<bool>("SelectEcalDriven");
00058 isTrackerDriven_ = conf.getParameter<bool>("SelectTrackerDriven");
00059 eOverPMinBarrel_ = conf.getParameter<double>("MinEopBarrel");
00060 eOverPMaxBarrel_ = conf.getParameter<double>("MaxEopBarrel");
00061 eOverPMinEndcaps_ = conf.getParameter<double>("MinEopEndcaps");
00062 eOverPMaxEndcaps_ = conf.getParameter<double>("MaxEopEndcaps");
00063 dEtaMinBarrel_ = conf.getParameter<double>("MinDetaBarrel");
00064 dEtaMaxBarrel_ = conf.getParameter<double>("MaxDetaBarrel");
00065 dEtaMinEndcaps_ = conf.getParameter<double>("MinDetaEndcaps");
00066 dEtaMaxEndcaps_ = conf.getParameter<double>("MaxDetaEndcaps");
00067 dPhiMinBarrel_ = conf.getParameter<double>("MinDphiBarrel");
00068 dPhiMaxBarrel_ = conf.getParameter<double>("MaxDphiBarrel");
00069 dPhiMinEndcaps_ = conf.getParameter<double>("MinDphiEndcaps");
00070 dPhiMaxEndcaps_ = conf.getParameter<double>("MaxDphiEndcaps");
00071 sigIetaIetaMinBarrel_ = conf.getParameter<double>("MinSigIetaIetaBarrel");
00072 sigIetaIetaMaxBarrel_ = conf.getParameter<double>("MaxSigIetaIetaBarrel");
00073 sigIetaIetaMinEndcaps_ = conf.getParameter<double>("MinSigIetaIetaEndcaps");
00074 sigIetaIetaMaxEndcaps_ = conf.getParameter<double>("MaxSigIetaIetaEndcaps");
00075 hadronicOverEmMaxBarrel_ = conf.getParameter<double>("MaxHoeBarrel");
00076 hadronicOverEmMaxEndcaps_ = conf.getParameter<double>("MaxHoeEndcaps");
00077 mvaMin_ = conf.getParameter<double>("MinMva");
00078 tipMaxBarrel_ = conf.getParameter<double>("MaxTipBarrel");
00079 tipMaxEndcaps_ = conf.getParameter<double>("MaxTipEndcaps");
00080 tkIso03Max_ = conf.getParameter<double>("MaxTkIso03");
00081 hcalIso03Depth1MaxBarrel_ = conf.getParameter<double>("MaxHcalIso03Depth1Barrel");
00082 hcalIso03Depth1MaxEndcaps_ = conf.getParameter<double>("MaxHcalIso03Depth1Endcaps");
00083 hcalIso03Depth2MaxEndcaps_ = conf.getParameter<double>("MaxHcalIso03Depth2Endcaps");
00084 ecalIso03MaxBarrel_ = conf.getParameter<double>("MaxEcalIso03Barrel");
00085 ecalIso03MaxEndcaps_ = conf.getParameter<double>("MaxEcalIso03Endcaps");
00086
00087
00088 triggerResults_ = conf.getParameter<edm::InputTag>("TriggerResults");
00089
00090
00091
00092
00093 nbineta=conf.getParameter<int>("NbinEta");
00094 nbineta2D=conf.getParameter<int>("NbinEta2D");
00095 etamin=conf.getParameter<double>("EtaMin");
00096 etamax=conf.getParameter<double>("EtaMax");
00097
00098 nbinphi=conf.getParameter<int>("NbinPhi");
00099 nbinphi2D=conf.getParameter<int>("NbinPhi2D");
00100 phimin=conf.getParameter<double>("PhiMin");
00101 phimax=conf.getParameter<double>("PhiMax");
00102
00103 nbinpt=conf.getParameter<int>("NbinPt");
00104 nbinpteff=conf.getParameter<int>("NbinPtEff");
00105 nbinpt2D=conf.getParameter<int>("NbinPt2D");
00106 ptmax=conf.getParameter<double>("PtMax");
00107
00108 nbinp=conf.getParameter<int>("NbinP");
00109 nbinp2D=conf.getParameter<int>("NbinP2D");
00110 pmax=conf.getParameter<double>("PMax");
00111
00112 nbineop=conf.getParameter<int>("NbinEop");
00113 nbineop2D=conf.getParameter<int>("NbinEop2D");
00114 eopmax=conf.getParameter<double>("EopMax");
00115 eopmaxsht=conf.getParameter<double>("EopMaxSht");
00116
00117 nbindeta=conf.getParameter<int>("NbinDeta");
00118 detamin=conf.getParameter<double>("DetaMin");
00119 detamax=conf.getParameter<double>("DetaMax");
00120
00121 nbindphi=conf.getParameter<int>("NbinDphi");
00122 dphimin=conf.getParameter<double>("DphiMin");
00123 dphimax=conf.getParameter<double>("DphiMax");
00124
00125 nbindetamatch=conf.getParameter<int>("NbinDetaMatch");
00126 nbindetamatch2D=conf.getParameter<int>("NbinDetaMatch2D");
00127 detamatchmin=conf.getParameter<double>("DetaMatchMin");
00128 detamatchmax=conf.getParameter<double>("DetaMatchMax");
00129
00130 nbindphimatch=conf.getParameter<int>("NbinDphiMatch");
00131 nbindphimatch2D=conf.getParameter<int>("NbinDphiMatch2D");
00132 dphimatchmin=conf.getParameter<double>("DphiMatchMin");
00133 dphimatchmax=conf.getParameter<double>("DphiMatchMax");
00134
00135 nbinfhits=conf.getParameter<int>("NbinFhits");
00136 fhitsmax=conf.getParameter<double>("FhitsMax");
00137
00138 nbinlhits=conf.getParameter<int>("NbinLhits");
00139 lhitsmax=conf.getParameter<double>("LhitsMax");
00140
00141 nbinxyz=conf.getParameter<int>("NbinXyz");
00142 nbinxyz2D=conf.getParameter<int>("NbinXyz2D");
00143
00144 nbinpoptrue= conf.getParameter<int>("NbinPopTrue");
00145 poptruemin=conf.getParameter<double>("PopTrueMin");
00146 poptruemax=conf.getParameter<double>("PopTrueMax");
00147
00148 nbinmee= conf.getParameter<int>("NbinMee");
00149 meemin=conf.getParameter<double>("MeeMin");
00150 meemax=conf.getParameter<double>("MeeMax");
00151
00152 nbinhoe= conf.getParameter<int>("NbinHoe");
00153 hoemin=conf.getParameter<double>("HoeMin");
00154 hoemax=conf.getParameter<double>("HoeMax");
00155 }
00156
00157 ElectronAnalyzer::~ElectronAnalyzer()
00158 {}
00159
00160 void ElectronAnalyzer::book()
00161 {
00162 nEvents_ = 0 ;
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172 h1_vertexPt_barrel = bookH1("vertexPt_barrel","ele transverse momentum in barrel",nbinpt,0.,ptmax,"p_{T vertex} (GeV/c)");
00173 h1_vertexPt_endcaps = bookH1("vertexPt_endcaps","ele transverse momentum in endcaps",nbinpt,0.,ptmax,"p_{T vertex} (GeV/c)");
00174 h1_vertexEta = bookH1("vertexEta","ele momentum #eta",nbineta,etamin,etamax,"#eta");
00175
00176 h2_vertexEtaVsPhi = bookH2("vertexEtaVsPhi","ele momentum #eta vs #phi",nbineta2D,etamin,etamax,nbinphi2D,phimin,phimax,"#eta","#phi (rad)");
00177
00178
00179 h2_vertexXvsY = bookH2("vertexXvsY","ele vertex x vs y",nbinxyz2D,-0.1,0.1,nbinxyz2D,-0.1,0.1,"x (cm)","y (cm)");
00180 h1_vertexZ = bookH1("vertexZ","ele vertex z",nbinxyz,-25, 25,"z (cm)");
00181
00182
00183
00184
00185
00186 h1_sclEt = bookH1("sclEt","ele supercluster transverse energy",nbinpt,0.,ptmax,"E_{T} (GeV)");
00187
00188
00189
00190
00191
00192
00193 h1_chi2 = bookH1("chi2","ele track #chi^{2}",100,0.,15.,"#Chi^{2}");
00194 py_chi2VsEta = bookP1("chi2VsEta","ele track #chi^{2} vs #eta",nbineta2D,etamin,etamax,0.,15.,"#eta","<#chi^{2}>");
00195 py_chi2VsPhi = bookP1("chi2VsPhi","ele track #chi^{2} vs #phi",nbinphi2D,phimin,phimax,0.,15.,"#phi (rad)","<#chi^{2}>");
00196
00197 h1_foundHits = bookH1("foundHits","ele track # found hits",nbinfhits,0.,fhitsmax,"N_{hits}");
00198 py_foundHitsVsEta = bookP1("foundHitsVsEta","ele track # found hits vs #eta",nbineta2D,etamin,etamax,0.,fhitsmax,"#eta","<# hits>");
00199 py_foundHitsVsPhi = bookP1("foundHitsVsPhi","ele track # found hits vs #phi",nbinphi2D,phimin,phimax,0.,fhitsmax,"#phi (rad)","<# hits>");
00200
00201 h1_lostHits = bookH1("lostHits","ele track # lost hits",5,0.,5.,"N_{lost hits}");
00202 py_lostHitsVsEta = bookP1("lostHitsVsEta","ele track # lost hits vs #eta",nbineta2D,etamin,etamax,0.,lhitsmax,"#eta","<# hits>");
00203 py_lostHitsVsPhi = bookP1("lostHitsVsPhi","ele track # lost hits vs #eta",nbinphi2D,phimin,phimax,0.,lhitsmax,"#phi (rad)","<# hits>");
00204
00205
00206
00207
00208
00209
00210
00211
00212 h1_Eop_barrel = bookH1( "Eop_barrel","ele E/P_{vertex} in barrel",nbineop,0.,eopmax,"E/P_{vertex}");
00213 h1_Eop_endcaps = bookH1( "Eop_endcaps","ele E/P_{vertex} in endcaps",nbineop,0.,eopmax,"E/P_{vertex}");
00214 py_EopVsPhi = bookP1("EopVsPhi","ele E/P_{vertex} vs #phi",nbinphi2D,phimin,phimax,0.,eopmax,"#phi (rad)","<E/P_{vertex}>");
00215
00216 h1_EeleOPout_barrel = bookH1( "EeleOPout_barrel","ele E_{ele}/P_{out} in barrel",nbineop,0.,eopmax,"E_{ele}/P_{out}");
00217 h1_EeleOPout_endcaps = bookH1( "EeleOPout_endcaps","ele E_{ele}/P_{out} in endcaps",nbineop,0.,eopmax,"E_{ele}/P_{out}");
00218
00219
00220 h1_dEtaSc_propVtx_barrel = bookH1( "dEtaSc_propVtx_barrel","ele #eta_{sc} - #eta_{tr}, prop from vertex, in barrel",nbindetamatch,detamatchmin,detamatchmax,"#eta_{sc} - #eta_{tr}");
00221 h1_dEtaSc_propVtx_endcaps = bookH1( "dEtaSc_propVtx_endcaps","ele #eta_{sc} - #eta_{tr}, prop from vertex, in endcaps",nbindetamatch,detamatchmin,detamatchmax,"#eta_{sc} - #eta_{tr}");
00222 py_dEtaSc_propVtxVsPhi = bookP1("dEtaSc_propVtxVsPhi","ele #eta_{sc} - #eta_{tr}, prop from vertex vs #phi",nbinphi2D,phimin,phimax,detamatchmin,detamatchmax,"#phi (rad)","<#eta_{sc} - #eta_{tr}>");
00223
00224 h1_dEtaEleCl_propOut_barrel = bookH1( "dEtaEleCl_propOut_barrel","ele #eta_{EleCl} - #eta_{tr}, prop from outermost, in barrel",nbindetamatch,detamatchmin,detamatchmax,"#eta_{elecl} - #eta_{tr}");
00225 h1_dEtaEleCl_propOut_endcaps = bookH1( "dEtaEleCl_propOut_endcaps","ele #eta_{EleCl} - #eta_{tr}, prop from outermost, in endcaps",nbindetamatch,detamatchmin,detamatchmax,"#eta_{elecl} - #eta_{tr}");
00226
00227
00228 h1_dPhiSc_propVtx_barrel = bookH1( "dPhiSc_propVtx_barrel","ele #phi_{sc} - #phi_{tr}, prop from vertex, in barrel",nbindphimatch,dphimatchmin,dphimatchmax,"#phi_{sc} - #phi_{tr} (rad)");
00229 h1_dPhiSc_propVtx_endcaps = bookH1( "dPhiSc_propVtx_endcaps","ele #phi_{sc} - #phi_{tr}, prop from vertex, in endcaps",nbindphimatch,dphimatchmin,dphimatchmax,"#phi_{sc} - #phi_{tr} (rad)");
00230 py_dPhiSc_propVtxVsPhi = bookP1("dPhiSc_propVtxVsPhi","ele #phi_{sc} - #phi_{tr}, prop from vertex vs #phi",nbinphi2D,phimin,phimax,dphimatchmin,dphimatchmax,"#phi (rad)","<#phi_{sc} - #phi_{tr}> (rad)");
00231
00232 h1_dPhiEleCl_propOut_barrel = bookH1( "dPhiEleCl_propOut_barrel","ele #phi_{EleCl} - #phi_{tr}, prop from outermost, in barrel",nbindphimatch,dphimatchmin,dphimatchmax,"#phi_{elecl} - #phi_{tr} (rad)");
00233 h1_dPhiEleCl_propOut_endcaps = bookH1( "dPhiEleCl_propOut_endcaps","ele #phi_{EleCl} - #phi_{tr}, prop from outermost, in endcaps",nbindphimatch,dphimatchmin,dphimatchmax,"#phi_{elecl} - #phi_{tr} (rad)");
00234
00235
00236 h1_Hoe_barrel = bookH1("Hoe_barrel","ele hadronic energy / em energy, in barrel", nbinhoe, hoemin, hoemax,"H/E","Events","ELE_LOGY E1 P") ;
00237 h1_Hoe_endcaps = bookH1("Hoe_endcaps","ele hadronic energy / em energy, in endcaps", nbinhoe, hoemin, hoemax,"H/E","Events","ELE_LOGY E1 P") ;
00238 py_HoeVsPhi = bookP1("HoeVsPhi","ele hadronic energy / em energy vs #phi",nbinphi2D,phimin,phimax,hoemin,hoemax,"#phi (rad)","<H/E>","E1 P") ;
00239
00240 h1_sclSigEtaEta_barrel = bookH1("sclSigEtaEta_barrel","ele supercluster sigma ieta ieta in barrel",100,0.,0.05,"sietaieta");
00241 h1_sclSigEtaEta_endcaps = bookH1("sclSigEtaEta_endcaps","ele supercluster sigma ieta ieta in endcaps",100,0.,0.05,"sietaieta");
00242
00243
00244
00245
00246
00247
00248
00249
00250 h1_fbrem = bookH1("fbrem","ele brem fraction",100,0.,1.,"P_{in} - P_{out} / P_{in}") ;
00251 py_fbremVsEta = bookP1("fbremVsEta","ele brem fraction vs #eta",nbineta2D,etamin,etamax,0.,1.,"#eta","<P_{in} - P_{out} / P_{in}>") ;
00252 py_fbremVsPhi = bookP1("fbremVsPhi","ele brem fraction vs #phi",nbinphi2D,phimin,phimax,0.,1.,"#phi (rad)","<P_{in} - P_{out} / P_{in}>") ;
00253
00254 h1_classes = bookH1("classes","ele electron classes",10,0.0,10.);
00255
00256
00257 h1_mva = bookH1( "mva","ele identification mva",100,-1.,1.,"mva");
00258 h1_provenance = bookH1( "provenance","ele provenance",5,-2.,3.,"provenance");
00259
00260
00261 h1_tkSumPt_dr03 = bookH1("tkSumPt_dr03","tk isolation sum, dR=0.3",100,0.0,20.,"TkIsoSum (GeV/c)","Events","ELE_LOGY E1 P");
00262 h1_ecalRecHitSumEt_dr03 = bookH1("ecalRecHitSumEt_dr03","ecal isolation sum, dR=0.3",100,0.0,20.,"EcalIsoSum (GeV)","Events","ELE_LOGY E1 P");
00263 h1_hcalTowerSumEt_dr03 = bookH1("hcalTowerSumEt_dr03","hcal isolation sum, dR=0.3",100,0.0,20.,"HcalIsoSum (GeV)","Events","ELE_LOGY E1 P");
00264
00265
00266
00267
00268
00271
00272
00273 setBookIndex(200) ;
00274 h1_mee = bookH1("mee","ele pairs invariant mass", nbinmee, meemin, meemax,"m_{ee} (GeV/c^{2})");
00275 h1_mee_os = bookH1("mee_os","ele pairs invariant mass, opposite sign", nbinmee, meemin, meemax,"m_{e^{+}e^{-}} (GeV/c^{2})");
00276
00277
00278
00279
00280
00281
00282
00283
00284 std::string matchingObjectType ;
00285 if (std::string::npos!=matchingObjectCollection_.label().find("SuperCluster",0))
00286 { matchingObjectType = "SC" ; }
00287 if (matchingObjectType=="")
00288 { edm::LogError("ElectronMcFakeValidator::beginJob")<<"Unknown matching object type !" ; }
00289 else
00290 { edm::LogInfo("ElectronMcFakeValidator::beginJob")<<"Matching object type: "<<matchingObjectType ; }
00291
00292
00293
00294
00295 h1_matchingObject_Eta = bookH1withSumw2("matchingObject_Eta",matchingObjectType+" #eta",nbineta,etamin,etamax,"#eta_{SC}");
00296
00297
00298 h1_matchingObject_Pt = bookH1withSumw2("matchingObject_Pt",matchingObjectType+" pt",nbinpteff,5.,ptmax,"pt_{SC} (GeV/c)");
00299 h1_matchingObject_Phi = bookH1withSumw2("matchingObject_Phi",matchingObjectType+" #phi",nbinphi,phimin,phimax,"#phi (rad)");
00300
00301
00302 h1_matchedObject_Eta = bookH1withSumw2("matchedObject_Eta","Efficiency vs matching SC #eta",nbineta,etamin,etamax,"#eta_{SC}");
00303
00304 h1_matchedObject_Pt = bookH1withSumw2("matchedObject_Pt","Efficiency vs matching SC E_{T}",nbinpteff,5.,ptmax,"pt_{SC} (GeV/c)");
00305 h1_matchedObject_Phi = bookH1withSumw2("matchedObject_Phi","Efficiency vs matching SC #phi",nbinphi,phimin,phimax,"#phi (rad)");
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315 }
00316
00317 void ElectronAnalyzer::analyze( const edm::Event& iEvent, const edm::EventSetup & iSetup )
00318 {
00319 nEvents_++ ;
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332 edm::Handle<GsfElectronCollection> gsfElectrons ;
00333 iEvent.getByLabel(electronCollection_,gsfElectrons) ;
00334 edm::Handle<reco::SuperClusterCollection> recoClusters ;
00335 iEvent.getByLabel(matchingObjectCollection_,recoClusters) ;
00336 edm::Handle<reco::TrackCollection> tracks;
00337 iEvent.getByLabel(trackCollection_,tracks);
00338 edm::Handle<reco::GsfTrackCollection> gsfTracks;
00339 iEvent.getByLabel(gsftrackCollection_,gsfTracks);
00340 edm::Handle<reco::VertexCollection> vertices;
00341 iEvent.getByLabel(vertexCollection_,vertices);
00342 edm::Handle<reco::BeamSpot> recoBeamSpotHandle ;
00343 iEvent.getByLabel(beamSpotTag_,recoBeamSpotHandle) ;
00344 const BeamSpot bs = *recoBeamSpotHandle ;
00345
00346 int ievt = iEvent.id().event();
00347 int irun = iEvent.id().run();
00348 int ils = iEvent.luminosityBlock();
00349
00350 edm::LogInfo("ElectronAnalyzer::analyze")
00351 <<"Treating "<<gsfElectrons.product()->size()<<" electrons"
00352 <<" from event "<<ievt<<" in run "<<irun<<" and lumiblock "<<ils ;
00353
00354
00355
00356 reco::GsfElectronCollection::const_iterator gsfIter ;
00357 for
00358 ( gsfIter=gsfElectrons->begin() ;
00359 gsfIter!=gsfElectrons->end();
00360 gsfIter++ )
00361 {
00362
00363 double vertexTIP =
00364 (gsfIter->vertex().x()-bs.position().x()) * (gsfIter->vertex().x()-bs.position().x()) +
00365 (gsfIter->vertex().y()-bs.position().y()) * (gsfIter->vertex().y()-bs.position().y()) ;
00366 vertexTIP = sqrt(vertexTIP) ;
00367
00368
00369 if (!selected(gsfIter,vertexTIP)) continue ;
00370
00371
00372 if (gsfIter->isEB()) h1_vertexPt_barrel->Fill( gsfIter->pt() );
00373 if (gsfIter->isEE()) h1_vertexPt_endcaps->Fill( gsfIter->pt() );
00374 h1_vertexEta->Fill( gsfIter->eta() );
00375
00376 h2_vertexEtaVsPhi->Fill( gsfIter->eta(), gsfIter->phi() );
00377
00378
00379 h2_vertexXvsY->Fill( gsfIter->vertex().x(), gsfIter->vertex().y() );
00380 h1_vertexZ->Fill( gsfIter->vertex().z() );
00381
00382
00383
00384
00385
00386
00387 reco::SuperClusterRef sclRef = gsfIter->superCluster() ;
00388
00389
00390
00391
00392
00393
00394 double R=TMath::Sqrt(sclRef->x()*sclRef->x() + sclRef->y()*sclRef->y() +sclRef->z()*sclRef->z());
00395 double Rt=TMath::Sqrt(sclRef->x()*sclRef->x() + sclRef->y()*sclRef->y());
00396 h1_sclEt->Fill(sclRef->energy()*(Rt/R));
00397
00398
00399
00400
00401
00402
00403 if (!readAOD_)
00404 {
00405 h1_foundHits->Fill( gsfIter->gsfTrack()->numberOfValidHits() );
00406 py_foundHitsVsEta->Fill( gsfIter->eta(), gsfIter->gsfTrack()->numberOfValidHits() );
00407 py_foundHitsVsPhi->Fill( gsfIter->phi(), gsfIter->gsfTrack()->numberOfValidHits() );
00408
00409 h1_lostHits->Fill( gsfIter->gsfTrack()->numberOfLostHits() );
00410 py_lostHitsVsEta->Fill( gsfIter->eta(), gsfIter->gsfTrack()->numberOfLostHits() );
00411 py_lostHitsVsPhi->Fill( gsfIter->phi(), gsfIter->gsfTrack()->numberOfLostHits() );
00412
00413 h1_chi2->Fill( gsfIter->gsfTrack()->normalizedChi2() );
00414 py_chi2VsEta->Fill( gsfIter->eta(), gsfIter->gsfTrack()->normalizedChi2() );
00415 py_chi2VsPhi->Fill( gsfIter->phi(), gsfIter->gsfTrack()->normalizedChi2() );
00416
00417 }
00418
00419
00420 if (gsfIter->isEB())
00421 {
00422 h1_Eop_barrel->Fill( gsfIter->eSuperClusterOverP() );
00423 h1_EeleOPout_barrel->Fill( gsfIter->eEleClusterOverPout() );
00424 h1_dEtaSc_propVtx_barrel->Fill(gsfIter->deltaEtaSuperClusterTrackAtVtx());
00425 h1_dEtaEleCl_propOut_barrel->Fill(gsfIter->deltaEtaEleClusterTrackAtCalo());
00426 h1_dPhiSc_propVtx_barrel->Fill(gsfIter->deltaPhiSuperClusterTrackAtVtx());
00427 h1_dPhiEleCl_propOut_barrel->Fill(gsfIter->deltaPhiEleClusterTrackAtCalo());
00428 h1_Hoe_barrel->Fill(gsfIter->hadronicOverEm());
00429 h1_sclSigEtaEta_barrel->Fill( gsfIter->scSigmaEtaEta() );
00430 }
00431 if (gsfIter->isEE())
00432 {
00433 h1_Eop_endcaps->Fill( gsfIter->eSuperClusterOverP() );
00434 h1_EeleOPout_endcaps->Fill( gsfIter->eEleClusterOverPout() );
00435 h1_dEtaSc_propVtx_endcaps->Fill(gsfIter->deltaEtaSuperClusterTrackAtVtx());
00436 h1_dEtaEleCl_propOut_endcaps->Fill(gsfIter->deltaEtaEleClusterTrackAtCalo());
00437 h1_dPhiSc_propVtx_endcaps->Fill(gsfIter->deltaPhiSuperClusterTrackAtVtx());
00438 h1_dPhiEleCl_propOut_endcaps->Fill(gsfIter->deltaPhiEleClusterTrackAtCalo());
00439 h1_Hoe_endcaps->Fill(gsfIter->hadronicOverEm());
00440 h1_sclSigEtaEta_endcaps->Fill( gsfIter->scSigmaEtaEta() );
00441 }
00442 py_EopVsPhi->Fill( gsfIter->phi(), gsfIter->eSuperClusterOverP() );
00443
00444
00445
00446 py_dEtaSc_propVtxVsPhi->Fill(gsfIter->phi(), gsfIter->deltaEtaSuperClusterTrackAtVtx());
00447
00448
00449
00450 py_dPhiSc_propVtxVsPhi->Fill(gsfIter->phi(), gsfIter->deltaPhiSuperClusterTrackAtVtx());
00451
00452
00453
00454 py_HoeVsPhi->Fill(gsfIter->phi(), gsfIter->hadronicOverEm());
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473 h1_fbrem->Fill(gsfIter->fbrem()) ;
00474 py_fbremVsEta->Fill(gsfIter->eta(),gsfIter->fbrem()) ;
00475 py_fbremVsPhi->Fill(gsfIter->phi(),gsfIter->fbrem()) ;
00476
00477 int eleClass = gsfIter->classification() ;
00478 if (gsfIter->isEE()) eleClass+=5;
00479 h1_classes->Fill(eleClass) ;
00480
00481
00482
00483 h1_mva->Fill(gsfIter->mva()) ;
00484 if (gsfIter->ecalDrivenSeed()) h1_provenance->Fill(1.) ;
00485 if (gsfIter->trackerDrivenSeed()) h1_provenance->Fill(-1.) ;
00486 if (gsfIter->trackerDrivenSeed()||gsfIter->ecalDrivenSeed()) h1_provenance->Fill(0.);
00487 if (gsfIter->trackerDrivenSeed()&&!gsfIter->ecalDrivenSeed()) h1_provenance->Fill(-2.);
00488 if (!gsfIter->trackerDrivenSeed()&&gsfIter->ecalDrivenSeed()) h1_provenance->Fill(2.);
00489
00490
00491 h1_tkSumPt_dr03->Fill(gsfIter->dr03TkSumPt());
00492 h1_ecalRecHitSumEt_dr03->Fill(gsfIter->dr03EcalRecHitSumEt());
00493 h1_hcalTowerSumEt_dr03->Fill(gsfIter->dr03HcalTowerSumEt());
00494
00495
00496
00497
00498
00501
00502 }
00503
00504
00505 int matchingObjectNum=0;
00506 reco::SuperClusterCollection::const_iterator moIter ;
00507 for
00508 ( moIter=recoClusters->begin() ;
00509 moIter!=recoClusters->end() ;
00510 moIter++ )
00511 {
00512
00513 matchingObjectNum++;
00514
00515 if
00516 ( moIter->energy()/cosh(moIter->eta())>maxPtMatchingObject_ ||
00517 std::abs(moIter->eta())> maxAbsEtaMatchingObject_ )
00518 { continue ; }
00519
00520
00521
00522
00523
00524
00525 h1_matchingObject_Eta->Fill( moIter->eta() );
00526
00527
00528 h1_matchingObject_Pt->Fill( moIter->energy()/cosh(moIter->eta()) );
00529 h1_matchingObject_Phi->Fill( moIter->phi() );
00530
00531
00532 bool okGsfFound = false ;
00533 double gsfOkRatio = 999999999. ;
00534 reco::GsfElectron bestGsfElectron ;
00535 reco::GsfElectronCollection::const_iterator gsfIter ;
00536 for
00537 ( gsfIter=gsfElectrons->begin() ;
00538 gsfIter!=gsfElectrons->end() ;
00539 gsfIter++ )
00540 {
00541 reco::GsfElectronCollection::const_iterator gsfIter2 ;
00542 for
00543 ( gsfIter2=gsfIter+1;
00544 gsfIter2!=gsfElectrons->end() ;
00545 gsfIter2++ )
00546 {
00547 float invMass = computeInvMass(*gsfIter,*gsfIter2) ;
00548 if(matchingObjectNum == 1){h1_mee->Fill(invMass) ;}
00549 if ((matchingObjectNum == 1) && (((gsfIter->charge())*(gsfIter2->charge()))<0.))
00550 { h1_mee_os->Fill(invMass) ; }
00551 }
00552
00553 double vertexTIP =
00554 (gsfIter->vertex().x()-bs.position().x()) * (gsfIter->vertex().x()-bs.position().x()) +
00555 (gsfIter->vertex().y()-bs.position().y()) * (gsfIter->vertex().y()-bs.position().y()) ;
00556 vertexTIP = sqrt(vertexTIP) ;
00557
00558
00559 if (!selected(gsfIter,vertexTIP)) continue ;
00560
00561
00562 if ( matchingCondition_ == "Cone" )
00563 {
00564 double dphi = gsfIter->phi()-moIter->phi() ;
00565 if (std::abs(dphi)>CLHEP::pi)
00566 { dphi = dphi < 0? (CLHEP::twopi) + dphi : dphi - CLHEP::twopi ; }
00567 double deltaR = sqrt(pow((moIter->eta()-gsfIter->eta()),2) + pow(dphi,2)) ;
00568 if ( deltaR < deltaR_ )
00569 {
00570
00571
00572 double tmpGsfRatio = gsfIter->p()/moIter->energy() ;
00573 if ( std::abs(tmpGsfRatio-1) < std::abs(gsfOkRatio-1) )
00574 {
00575 gsfOkRatio = tmpGsfRatio;
00576 bestGsfElectron=*gsfIter;
00577 okGsfFound = true;
00578 }
00579
00580 }
00581 }
00582 }
00583 if (okGsfFound)
00584 {
00585
00586 h1_matchedObject_Eta->Fill( moIter->eta() );
00587
00588 h1_matchedObject_Pt->Fill( moIter->energy()/cosh(moIter->eta()) );
00589 h1_matchedObject_Phi->Fill( moIter->phi() );
00590
00591
00592
00593
00594
00595
00596
00597
00598
00599
00600 }
00601
00602 }
00603
00604
00605
00606 }
00607
00608 float ElectronAnalyzer::computeInvMass
00609 ( const reco::GsfElectron & e1,
00610 const reco::GsfElectron & e2 )
00611 {
00612 math::XYZTLorentzVector p12 = e1.p4()+e2.p4() ;
00613 float mee2 = p12.Dot(p12) ;
00614 float invMass = sqrt(mee2) ;
00615 return invMass ;
00616 }
00617
00618
00619
00620
00621
00622
00623
00624
00625
00626
00627
00628
00629
00630
00636
00637
00638
00639
00640
00641
00642
00643
00644
00645
00646
00647
00648
00649
00650
00651
00652
00653
00654
00655
00671
00672
00673
00674
00675
00676
00677
00678
00679
00680
00681
00682
00683
00684
00685
00686
00687
00688
00689
00690
00691
00692
00693 bool ElectronAnalyzer::selected( const reco::GsfElectronCollection::const_iterator & gsfIter , double vertexTIP )
00694 {
00695 if ((Selection_>0)&&generalCut(gsfIter)) return false ;
00696 if ((Selection_>=1)&&etCut(gsfIter)) return false ;
00697 if ((Selection_>=2)&&isolationCut(gsfIter,vertexTIP)) return false ;
00698 if ((Selection_>=3)&&idCut(gsfIter)) return false ;
00699 return true ;
00700 }
00701
00702 bool ElectronAnalyzer::generalCut( const reco::GsfElectronCollection::const_iterator & gsfIter)
00703 {
00704 if (std::abs(gsfIter->eta())>maxAbsEta_) return true ;
00705 if (gsfIter->pt()<minPt_) return true ;
00706
00707 if (gsfIter->isEB() && isEE_) return true ;
00708 if (gsfIter->isEE() && isEB_) return true ;
00709 if (gsfIter->isEBEEGap() && isNotEBEEGap_) return true ;
00710
00711 if (gsfIter->ecalDrivenSeed() && isTrackerDriven_) return true ;
00712 if (gsfIter->trackerDrivenSeed() && isEcalDriven_) return true ;
00713
00714 return false ;
00715 }
00716
00717 bool ElectronAnalyzer::etCut( const reco::GsfElectronCollection::const_iterator & gsfIter )
00718 {
00719 if (gsfIter->superCluster()->energy()/cosh(gsfIter->superCluster()->eta())<minEt_) return true ;
00720
00721 return false ;
00722 }
00723
00724 bool ElectronAnalyzer::isolationCut( const reco::GsfElectronCollection::const_iterator & gsfIter, double vertexTIP )
00725 {
00726 if (gsfIter->isEB() && vertexTIP > tipMaxBarrel_) return true ;
00727 if (gsfIter->isEE() && vertexTIP > tipMaxEndcaps_) return true ;
00728
00729 if (gsfIter->dr03TkSumPt() > tkIso03Max_) return true ;
00730 if (gsfIter->isEB() && gsfIter->dr03HcalDepth1TowerSumEt() > hcalIso03Depth1MaxBarrel_) return true ;
00731 if (gsfIter->isEE() && gsfIter->dr03HcalDepth1TowerSumEt() > hcalIso03Depth1MaxEndcaps_) return true ;
00732 if (gsfIter->isEE() && gsfIter->dr03HcalDepth2TowerSumEt() > hcalIso03Depth2MaxEndcaps_) return true ;
00733 if (gsfIter->isEB() && gsfIter->dr03EcalRecHitSumEt() > ecalIso03MaxBarrel_) return true ;
00734 if (gsfIter->isEE() && gsfIter->dr03EcalRecHitSumEt() > ecalIso03MaxEndcaps_) return true ;
00735
00736 return false ;
00737 }
00738
00739 bool ElectronAnalyzer::idCut( const reco::GsfElectronCollection::const_iterator & gsfIter )
00740 {
00741 if (gsfIter->isEB() && gsfIter->eSuperClusterOverP() < eOverPMinBarrel_) return true ;
00742 if (gsfIter->isEB() && gsfIter->eSuperClusterOverP() > eOverPMaxBarrel_) return true ;
00743 if (gsfIter->isEE() && gsfIter->eSuperClusterOverP() < eOverPMinEndcaps_) return true ;
00744 if (gsfIter->isEE() && gsfIter->eSuperClusterOverP() > eOverPMaxEndcaps_) return true ;
00745 if (gsfIter->isEB() && std::abs(gsfIter->deltaEtaSuperClusterTrackAtVtx()) < dEtaMinBarrel_) return true ;
00746 if (gsfIter->isEB() && std::abs(gsfIter->deltaEtaSuperClusterTrackAtVtx()) > dEtaMaxBarrel_) return true ;
00747 if (gsfIter->isEE() && std::abs(gsfIter->deltaEtaSuperClusterTrackAtVtx()) < dEtaMinEndcaps_) return true ;
00748 if (gsfIter->isEE() && std::abs(gsfIter->deltaEtaSuperClusterTrackAtVtx()) > dEtaMaxEndcaps_) return true ;
00749 if (gsfIter->isEB() && std::abs(gsfIter->deltaPhiSuperClusterTrackAtVtx()) < dPhiMinBarrel_) return true ;
00750 if (gsfIter->isEB() && std::abs(gsfIter->deltaPhiSuperClusterTrackAtVtx()) > dPhiMaxBarrel_) return true ;
00751 if (gsfIter->isEE() && std::abs(gsfIter->deltaPhiSuperClusterTrackAtVtx()) < dPhiMinEndcaps_) return true ;
00752 if (gsfIter->isEE() && std::abs(gsfIter->deltaPhiSuperClusterTrackAtVtx()) > dPhiMaxEndcaps_) return true ;
00753 if (gsfIter->isEB() && gsfIter->scSigmaIEtaIEta() < sigIetaIetaMinBarrel_) return true ;
00754 if (gsfIter->isEB() && gsfIter->scSigmaIEtaIEta() > sigIetaIetaMaxBarrel_) return true ;
00755 if (gsfIter->isEE() && gsfIter->scSigmaIEtaIEta() < sigIetaIetaMinEndcaps_) return true ;
00756 if (gsfIter->isEE() && gsfIter->scSigmaIEtaIEta() > sigIetaIetaMaxEndcaps_) return true ;
00757 if (gsfIter->isEB() && gsfIter->hadronicOverEm() > hadronicOverEmMaxBarrel_) return true ;
00758 if (gsfIter->isEE() && gsfIter->hadronicOverEm() > hadronicOverEmMaxEndcaps_) return true ;
00759
00760 return false ;
00761 }