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