00001
00002
00003
00004
00005
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "RecoEgamma/Examples/plugins/DQMAnalyzer.h"
00022
00023 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00024 #include "FWCore/Framework/interface/EDAnalyzer.h"
00025 #include "FWCore/Framework/interface/Event.h"
00026 #include "FWCore/Framework/interface/MakerMacros.h"
00027 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00028 #include "FWCore/Common/interface/TriggerNames.h"
00029
00030 #include "DataFormats/GsfTrackReco/interface/GsfTrack.h"
00031 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
00032 #include "DataFormats/EgammaReco/interface/BasicClusterFwd.h"
00033 #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"
00034 #include "DataFormats/EgammaReco/interface/ElectronSeed.h"
00035 #include "DataFormats/EgammaReco/interface/ElectronSeedFwd.h"
00036 #include "DataFormats/JetReco/interface/CaloJetCollection.h"
00037 #include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
00038 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
00039 #include "DataFormats/Common/interface/TriggerResults.h"
00040
00041 #include "HLTrigger/HLTfilters/interface/HLTHighLevel.h"
00042
00043 #include "CLHEP/Units/GlobalPhysicalConstants.h"
00044 #include <iostream>
00045 #include "TMath.h"
00046 #include "TFile.h"
00047 #include "TH1F.h"
00048 #include "TH1I.h"
00049 #include "TH2F.h"
00050 #include "TProfile.h"
00051 #include "TTree.h"
00052 #include <iostream>
00053 #include <cassert>
00054
00055 using namespace reco;
00056
00057
00058 DQMAnalyzer::DQMAnalyzer(const edm::ParameterSet& conf) :
00059 beamSpot_(conf.getParameter<edm::InputTag>("beamSpot"))
00060 {
00061
00062 outputFile_ = conf.getParameter<std::string>("outputFile");
00063 electronCollection_=conf.getParameter<edm::InputTag>("electronCollection");
00064 matchingObjectCollection_ = conf.getParameter<edm::InputTag>("matchingObjectCollection");
00065 matchingCondition_ = conf.getParameter<std::string>("matchingCondition");
00066 readAOD_ = conf.getParameter<bool>("readAOD");
00067
00068 histfile_ = new TFile(outputFile_.c_str(),"RECREATE");
00069
00070
00071 assert(matchingCondition_=="Cone") ;
00072 maxPtMatchingObject_ = conf.getParameter<double>("MaxPtMatchingObject");
00073 maxAbsEtaMatchingObject_ = conf.getParameter<double>("MaxAbsEtaMatchingObject");
00074 deltaR_ = conf.getParameter<double>("DeltaR");
00075
00076 Selection_ = conf.getParameter<int>("Selection");
00077 massLow_ = conf.getParameter< double >("MassLow");
00078 massHigh_ = conf.getParameter< double >("MassHigh");
00079 TPchecksign_ = conf.getParameter<bool>("TPchecksign");
00080 TAGcheckclass_ = conf.getParameter<bool>("TAGcheckclass");
00081 PROBEetcut_ = conf.getParameter<bool>("PROBEetcut");
00082 PROBEcheckclass_ = conf.getParameter<bool>("PROBEcheckclass");
00083
00084 minEt_ = conf.getParameter<double>("MinEt");
00085 minPt_ = conf.getParameter<double>("MinPt");
00086 maxAbsEta_ = conf.getParameter<double>("MaxAbsEta");
00087 isEB_ = conf.getParameter<bool>("SelectEB");
00088 isEE_ = conf.getParameter<bool>("SelectEE");
00089 isNotEBEEGap_ = conf.getParameter<bool>("SelectNotEBEEGap");
00090 isEcalDriven_ = conf.getParameter<bool>("SelectEcalDriven");
00091 isTrackerDriven_ = conf.getParameter<bool>("SelectTrackerDriven");
00092 eOverPMinBarrel_ = conf.getParameter<double>("MinEOverPBarrel");
00093 eOverPMaxBarrel_ = conf.getParameter<double>("MaxEOverPBarrel");
00094 eOverPMinEndcaps_ = conf.getParameter<double>("MinEOverPEndcaps");
00095 eOverPMaxEndcaps_ = conf.getParameter<double>("MaxEOverPEndcaps");
00096 dEtaMinBarrel_ = conf.getParameter<double>("MinDetaBarrel");
00097 dEtaMaxBarrel_ = conf.getParameter<double>("MaxDetaBarrel");
00098 dEtaMinEndcaps_ = conf.getParameter<double>("MinDetaEndcaps");
00099 dEtaMaxEndcaps_ = conf.getParameter<double>("MaxDetaEndcaps");
00100 dPhiMinBarrel_ = conf.getParameter<double>("MinDphiBarrel");
00101 dPhiMaxBarrel_ = conf.getParameter<double>("MaxDphiBarrel");
00102 dPhiMinEndcaps_ = conf.getParameter<double>("MinDphiEndcaps");
00103 dPhiMaxEndcaps_ = conf.getParameter<double>("MaxDphiEndcaps");
00104 sigIetaIetaMinBarrel_ = conf.getParameter<double>("MinSigIetaIetaBarrel");
00105 sigIetaIetaMaxBarrel_ = conf.getParameter<double>("MaxSigIetaIetaBarrel");
00106 sigIetaIetaMinEndcaps_ = conf.getParameter<double>("MinSigIetaIetaEndcaps");
00107 sigIetaIetaMaxEndcaps_ = conf.getParameter<double>("MaxSigIetaIetaEndcaps");
00108 hadronicOverEmMaxBarrel_ = conf.getParameter<double>("MaxHoEBarrel");
00109 hadronicOverEmMaxEndcaps_ = conf.getParameter<double>("MaxHoEEndcaps");
00110 mvaMin_ = conf.getParameter<double>("MinMVA");
00111 tipMaxBarrel_ = conf.getParameter<double>("MaxTipBarrel");
00112 tipMaxEndcaps_ = conf.getParameter<double>("MaxTipEndcaps");
00113 tkIso03Max_ = conf.getParameter<double>("MaxTkIso03");
00114 hcalIso03Depth1MaxBarrel_ = conf.getParameter<double>("MaxHcalIso03Depth1Barrel");
00115 hcalIso03Depth1MaxEndcaps_ = conf.getParameter<double>("MaxHcalIso03Depth1Endcaps");
00116 hcalIso03Depth2MaxEndcaps_ = conf.getParameter<double>("MaxHcalIso03Depth2Endcaps");
00117 ecalIso03MaxBarrel_ = conf.getParameter<double>("MaxEcalIso03Barrel");
00118 ecalIso03MaxEndcaps_ = conf.getParameter<double>("MaxEcalIso03Endcaps");
00119
00120 triggerResults_ = conf.getParameter<edm::InputTag>("triggerResults");
00121 HLTPathsByName_= conf.getParameter<std::vector<std::string > >("hltPaths");
00122 HLTPathsByIndex_.resize(HLTPathsByName_.size());
00123
00124 edm::ParameterSet pset =
00125 conf.getParameter<edm::ParameterSet>("HistosConfigurationData") ;
00126
00127 etamin=pset.getParameter<double>("Etamin");
00128 etamax=pset.getParameter<double>("Etamax");
00129 phimin=pset.getParameter<double>("Phimin");
00130 phimax=pset.getParameter<double>("Phimax");
00131 ptmax=pset.getParameter<double>("Ptmax");
00132 pmax=pset.getParameter<double>("Pmax");
00133 eopmax=pset.getParameter<double>("Eopmax");
00134 eopmaxsht=pset.getParameter<double>("Eopmaxsht");
00135 detamin=pset.getParameter<double>("Detamin");
00136 detamax=pset.getParameter<double>("Detamax");
00137 dphimin=pset.getParameter<double>("Dphimin");
00138 dphimax=pset.getParameter<double>("Dphimax");
00139 detamatchmin=pset.getParameter<double>("Detamatchmin");
00140 detamatchmax=pset.getParameter<double>("Detamatchmax");
00141 dphimatchmin=pset.getParameter<double>("Dphimatchmin");
00142 dphimatchmax=pset.getParameter<double>("Dphimatchmax");
00143 fhitsmax=pset.getParameter<double>("Fhitsmax");
00144 lhitsmax=pset.getParameter<double>("Lhitsmax");
00145 nbineta=pset.getParameter<int>("Nbineta");
00146 nbineta2D=pset.getParameter<int>("Nbineta2D");
00147 nbinp=pset.getParameter<int>("Nbinp");
00148 nbinpt=pset.getParameter<int>("Nbinpt");
00149 nbinp2D=pset.getParameter<int>("Nbinp2D");
00150 nbinpt2D=pset.getParameter<int>("Nbinpt2D");
00151 nbinpteff=pset.getParameter<int>("Nbinpteff");
00152 nbinphi=pset.getParameter<int>("Nbinphi");
00153 nbinphi2D=pset.getParameter<int>("Nbinphi2D");
00154 nbineop=pset.getParameter<int>("Nbineop");
00155 nbineop2D=pset.getParameter<int>("Nbineop2D");
00156 nbinfhits=pset.getParameter<int>("Nbinfhits");
00157 nbinlhits=pset.getParameter<int>("Nbinlhits");
00158 nbinxyz=pset.getParameter<int>("Nbinxyz");
00159 nbindeta=pset.getParameter<int>("Nbindeta");
00160 nbindphi=pset.getParameter<int>("Nbindphi");
00161 nbindetamatch=pset.getParameter<int>("Nbindetamatch");
00162 nbindphimatch=pset.getParameter<int>("Nbindphimatch");
00163 nbindetamatch2D=pset.getParameter<int>("Nbindetamatch2D");
00164 nbindphimatch2D=pset.getParameter<int>("Nbindphimatch2D");
00165 nbinpoptrue= pset.getParameter<int>("Nbinpoptrue");
00166 poptruemin=pset.getParameter<double>("Poptruemin");
00167 poptruemax=pset.getParameter<double>("Poptruemax");
00168 nbinmee= pset.getParameter<int>("Nbinmee");
00169 meemin=pset.getParameter<double>("Meemin");
00170 meemax=pset.getParameter<double>("Meemax");
00171 nbinhoe= pset.getParameter<int>("Nbinhoe");
00172 hoemin=pset.getParameter<double>("Hoemin");
00173 hoemax=pset.getParameter<double>("Hoemax");
00174
00175 }
00176
00177
00178 DQMAnalyzer::~DQMAnalyzer()
00179 {
00180
00181
00182
00183 histfile_->Write();
00184 histfile_->Close();
00185 }
00186
00187 void
00188 DQMAnalyzer::beginJob(){
00189
00190 histfile_->cd();
00191
00192 nEvents_ = 0;
00193 nAfterTrigger_ = 0;
00194
00195
00196 std::string::size_type locSC = matchingObjectCollection_.label().find( "SuperCluster", 0 );
00197 std::string type ;
00198 if ( locSC != std::string::npos ) {
00199 std::cout << "Matching objects are SuperClusters "<< std::endl;
00200 type = "SC";
00201 } else {
00202 std::cout << "Didn't recognize input matching objects!! " << std::endl;
00203 }
00204
00205
00206
00207
00208
00209 std::string htitle, hlabel;
00210 hlabel="h_"+type+"Num"; htitle="# "+type+"s";
00211 h_matchingObjectNum = new TH1F( hlabel.c_str(), htitle.c_str(), nbinfhits,0.,fhitsmax );
00212 hlabel="h_"+type+"_eta"; htitle=type+" #eta";
00213 h_matchingObjectEta = new TH1F( hlabel.c_str(), htitle.c_str(), nbineta,etamin,etamax);
00214 hlabel="h_"+type+"_abseta"; htitle=type+" |#eta|";
00215 h_matchingObjectAbsEta = new TH1F( hlabel.c_str(), htitle.c_str(), nbineta/2,0.,etamax);
00216 hlabel="h_"+type+"_P"; htitle=type+" p";
00217 h_matchingObjectP = new TH1F( hlabel.c_str(), htitle.c_str(), nbinp,0.,pmax);
00218 hlabel="h_"+type+"_Pt"; htitle=type+" pt";
00219 h_matchingObjectPt = new TH1F( hlabel.c_str(),htitle.c_str(), nbinpteff,5.,ptmax);
00220 hlabel="h_"+type+"_phi"; htitle=type+" phi";
00221 h_matchingObjectPhi = new TH1F( hlabel.c_str(), htitle.c_str(), nbinphi,phimin,phimax);
00222 hlabel="h_"+type+"_z"; htitle=type+" z";
00223 h_matchingObjectZ = new TH1F( hlabel.c_str(), htitle.c_str(), nbinxyz , -25, 25 );
00224
00225 h_matchingObjectNum->GetXaxis()-> SetTitle("N_{SC}");
00226 h_matchingObjectNum->GetYaxis()-> SetTitle("Events");
00227 h_matchingObjectEta->GetXaxis()-> SetTitle("#eta_{SC}");
00228 h_matchingObjectEta->GetYaxis()-> SetTitle("Events");
00229 h_matchingObjectP->GetXaxis()-> SetTitle("E_{SC} (GeV)");
00230 h_matchingObjectP->GetYaxis()-> SetTitle("Events");
00231
00232 h_ele_matchingObjectEta_matched = new TH1F( "h_ele_matchingObjectEta_matched", "Efficiency vs matching SC #eta", nbineta,etamin,etamax);
00233 h_ele_matchingObjectEta_matched->Sumw2();
00234 h_ele_matchingObjectAbsEta_matched = new TH1F( "h_ele_matchingObjectAbsEta_matched", "Efficiency vs matching SC |#eta|", nbineta/2,0.,2.5);
00235 h_ele_matchingObjectAbsEta_matched->Sumw2();
00236 h_ele_matchingObjectPt_matched = new TH1F( "h_ele_matchingObjectPt_matched", "Efficiency vs matching SC E_{T}", nbinpteff,5.,ptmax);
00237 h_ele_matchingObjectPt_matched->Sumw2();
00238 h_ele_matchingObjectPhi_matched = new TH1F( "h_ele_matchingObjectPhi_matched", "Efficiency vs matching SC phi", nbinphi,phimin,phimax);
00239 h_ele_matchingObjectPhi_matched->Sumw2();
00240 h_ele_matchingObjectZ_matched = new TH1F( "h_ele_matchingObjectZ_matched", "Efficiency vs matching SC z", nbinxyz,-25,25);
00241 h_ele_matchingObjectZ_matched->Sumw2();
00242
00243
00244
00245
00246
00247 h_ele_vertexPt = new TH1F( "h_ele_vertexPt","ele transverse momentum",nbinpt,0.,ptmax);
00248 h_ele_Et = new TH1F( "h_ele_Et", "ele SC transverse energy", nbinpt,0.,ptmax);
00249 h_ele_vertexEta = new TH1F( "h_ele_vertexEta","ele momentum eta",nbineta,etamin,etamax);
00250 h_ele_vertexPhi = new TH1F( "h_ele_vertexPhi","ele momentum #phi",nbinphi,phimin,phimax);
00251 h_ele_vertexX = new TH1F( "h_ele_vertexX","ele vertex x",nbinxyz,-0.1,0.1 );
00252 h_ele_vertexY = new TH1F( "h_ele_vertexY","ele vertex y",nbinxyz,-0.1,0.1 );
00253 h_ele_vertexZ = new TH1F( "h_ele_vertexZ","ele vertex z",nbinxyz,-25, 25 );
00254 h_ele_vertexTIP = new TH1F( "h_ele_vertexTIP","ele transverse impact parameter (wrt bs)",90,0.,0.15);
00255 h_ele_charge = new TH1F( "h_ele_charge","ele charge",5,-2.,2.);
00256
00257 h_ele_charge->GetXaxis()-> SetTitle("charge");
00258 h_ele_charge->GetYaxis()-> SetTitle("Events");
00259
00260 h_ele_vertexPt->GetXaxis()-> SetTitle("p_{T vertex} (GeV/c)");
00261 h_ele_vertexPt->GetYaxis()-> SetTitle("Events");
00262
00263 h_ele_Et->GetXaxis()-> SetTitle("E_{T} (GeV)");
00264 h_ele_Et->GetYaxis()-> SetTitle("Events");
00265
00266 h_ele_vertexEta->GetXaxis()-> SetTitle("#eta");
00267 h_ele_vertexEta->GetYaxis()-> SetTitle("Events");
00268 h_ele_vertexPhi->GetXaxis()-> SetTitle("#phi (rad)");
00269 h_ele_vertexPhi->GetYaxis()-> SetTitle("Events");
00270
00271 h_ele_vertexX-> GetXaxis()-> SetTitle("x (cm)");
00272 h_ele_vertexX-> GetYaxis()-> SetTitle("Events");
00273 h_ele_vertexY-> GetXaxis()-> SetTitle("y (cm)");
00274 h_ele_vertexY-> GetYaxis()-> SetTitle("Events");
00275 h_ele_vertexZ-> GetXaxis()-> SetTitle("z (cm)");
00276 h_ele_vertexZ-> GetYaxis()-> SetTitle("Events");
00277
00278 h_ele_vertexTIP-> GetXaxis()-> SetTitle("TIP (cm)");
00279 h_ele_vertexTIP-> GetYaxis()-> SetTitle("Events");
00280
00281
00282
00283
00284
00285 histNum_= new TH1F("h_recEleNum","# rec electrons",20, 0.,20.);
00286
00287 histNum_-> GetXaxis()-> SetTitle("N_{ele}");
00288 histNum_-> GetYaxis()-> SetTitle("Events");
00289
00290
00291
00292
00293
00294 histSclEn_ = new TH1F("h_scl_energy","ele supercluster energy",nbinp,0.,pmax);
00295 histSclEt_ = new TH1F("h_scl_et","ele supercluster transverse energy",nbinpt,0.,ptmax);
00296 histSclEta_ = new TH1F("h_scl_eta","ele supercluster eta",nbineta,etamin,etamax);
00297 histSclPhi_ = new TH1F("h_scl_phi","ele supercluster phi",nbinphi,phimin,phimax);
00298 histSclSigEtaEta_ = new TH1F("h_scl_sigetaeta","ele supercluster sigma eta eta",100,0.,0.05);
00299
00300
00301
00302
00303
00304 h_ele_ambiguousTracks = new TH1F( "h_ele_ambiguousTracks", "ele # ambiguous tracks", 5,0.,5.);
00305 h_ele_ambiguousTracksVsEta = new TH2F( "h_ele_ambiguousTracksVsEta","ele # ambiguous tracks vs eta", nbineta2D,etamin,etamax,5,0.,5.);
00306 h_ele_ambiguousTracksVsPhi = new TH2F( "h_ele_ambiguousTracksVsPhi", "ele # ambiguous tracks vs phi", nbinphi2D,phimin,phimax,5,0.,5.);
00307 h_ele_ambiguousTracksVsPt = new TH2F( "h_ele_ambiguousTracksVsPt", "ele # ambiguous tracks vs pt", nbinpt2D,0.,ptmax,5,0.,5.);
00308 h_ele_foundHits = new TH1F( "h_ele_foundHits", "ele track # found hits", nbinfhits,0.,fhitsmax);
00309 h_ele_foundHitsVsEta = new TH2F( "h_ele_foundHitsVsEta", "ele track # found hits vs eta", nbineta2D,etamin,etamax,nbinfhits,0.,fhitsmax);
00310 h_ele_foundHitsVsPhi = new TH2F( "h_ele_foundHitsVsPhi", "ele track # found hits vs phi", nbinphi2D,phimin,phimax,nbinfhits,0.,fhitsmax);
00311 h_ele_foundHitsVsPt = new TH2F( "h_ele_foundHitsVsPt", "ele track # found hits vs pt", nbinpt2D,0.,ptmax,nbinfhits,0.,fhitsmax);
00312 h_ele_lostHits = new TH1F( "h_ele_lostHits", "ele track # lost hits", 5,0.,5.);
00313 h_ele_lostHitsVsEta = new TH2F( "h_ele_lostHitsVsEta", "ele track # lost hits vs eta", nbineta2D,etamin,etamax,nbinlhits,0.,lhitsmax);
00314 h_ele_lostHitsVsPhi = new TH2F( "h_ele_lostHitsVsPhi", "ele track # lost hits vs eta", nbinphi2D,phimin,phimax,nbinlhits,0.,lhitsmax);
00315 h_ele_lostHitsVsPt = new TH2F( "h_ele_lostHitsVsPt", "ele track # lost hits vs eta", nbinpt2D,0.,ptmax,nbinlhits,0.,lhitsmax);
00316 h_ele_chi2 = new TH1F( "h_ele_chi2", "ele track #chi^{2}", 100,0.,15.);
00317 h_ele_chi2VsEta = new TH2F( "h_ele_chi2VsEta", "ele track #chi^{2} vs eta", nbineta2D,etamin,etamax,50,0.,15.);
00318 h_ele_chi2VsPhi = new TH2F( "h_ele_chi2VsPhi", "ele track #chi^{2} vs phi", nbinphi2D,phimin,phimax,50,0.,15.);
00319 h_ele_chi2VsPt = new TH2F( "h_ele_chi2VsPt", "ele track #chi^{2} vs pt", nbinpt2D,0.,ptmax,50,0.,15.);
00320
00321 h_ele_foundHits->GetXaxis()-> SetTitle("N_{hits}");
00322 h_ele_foundHits->GetYaxis()-> SetTitle("Events");
00323 h_ele_lostHits->GetXaxis()-> SetTitle("N_{lost hits}");
00324 h_ele_lostHits->GetYaxis()-> SetTitle("Events");
00325 h_ele_chi2->GetXaxis()-> SetTitle("#Chi^{2}");
00326 h_ele_chi2->GetYaxis()-> SetTitle("Events");
00327
00328
00329
00330
00331
00332 h_ele_EoP = new TH1F( "h_ele_EoP", "ele E/P_{vertex}", nbineop,0.,eopmax);
00333
00334 h_ele_EeleOPout = new TH1F( "h_ele_EeleOPout", "ele E_{ele}/P_{out}", nbineop,0.,eopmax);
00335 h_ele_dEtaSc_propVtx = new TH1F( "h_ele_dEtaSc_propVtx", "ele #eta_{sc} - #eta_{tr}, prop from vertex", nbindetamatch,detamatchmin,detamatchmax);
00336 h_ele_dPhiSc_propVtx = new TH1F( "h_ele_dPhiSc_propVtx", "ele #phi_{sc} - #phi_{tr}, prop from vertex", nbindphimatch,dphimatchmin,dphimatchmax);
00337 h_ele_dEtaCl_propOut = new TH1F( "h_ele_dEtaCl_propOut", "ele #eta_{cl} - #eta_{tr}, prop from outermost", nbindetamatch,detamatchmin,detamatchmax);
00338 h_ele_dPhiCl_propOut = new TH1F( "h_ele_dPhiCl_propOut", "ele #phi_{cl} - #phi_{tr}, prop from outermost", nbindphimatch,dphimatchmin,dphimatchmax);
00339 h_ele_dEtaEleCl_propOut = new TH1F( "h_ele_dEtaEleCl_propOut", "ele #eta_{EleCl} - #eta_{tr}, prop from outermost", nbindetamatch,detamatchmin,detamatchmax);
00340 h_ele_dPhiEleCl_propOut = new TH1F( "h_ele_dPhiEleCl_propOut", "ele #phi_{EleCl} - #phi_{tr}, prop from outermost", nbindphimatch,dphimatchmin,dphimatchmax);
00341 h_ele_HoE = new TH1F("h_ele_HoE", "ele hadronic energy / em energy", nbinhoe, hoemin, hoemax) ;
00342 h_ele_outerP = new TH1F( "h_ele_outerP", "ele track outer p, mean", nbinp,0.,pmax);
00343 h_ele_outerP_mode = new TH1F( "h_ele_outerP_mode", "ele track outer p, mode", nbinp,0.,pmax);
00344 h_ele_outerPt = new TH1F( "h_ele_outerPt", "ele track outer p_{T}, mean", nbinpt,0.,ptmax);
00345 h_ele_outerPt_mode = new TH1F( "h_ele_outerPt_mode", "ele track outer p_{T}, mode", nbinpt,0.,ptmax);
00346
00347 h_ele_PinMnPout = new TH1F( "h_ele_PinMnPout", "ele track inner p - outer p, mean" ,nbinp,0.,200.);
00348 h_ele_PinMnPout_mode = new TH1F( "h_ele_PinMnPout_mode", "ele track inner p - outer p, mode" ,nbinp,0.,100.);
00349
00350 h_ele_mva = new TH1F( "h_ele_mva","ele identification mva",100,-1.,1.);
00351 h_ele_provenance = new TH1F( "h_ele_provenance","ele provenance",5,-2.,3.);
00352
00353 h_ele_PinMnPout->GetXaxis()-> SetTitle("P_{vertex} - P_{out} (GeV/c)");
00354 h_ele_PinMnPout->GetYaxis()-> SetTitle("Events");
00355 h_ele_PinMnPout_mode->GetXaxis()-> SetTitle("P_{vertex} - P_{out}, mode (GeV/c)");
00356 h_ele_PinMnPout_mode->GetYaxis()-> SetTitle("Events");
00357
00358 h_ele_outerP->GetXaxis()-> SetTitle("P_{out} (GeV/c)");
00359 h_ele_outerP->GetYaxis()-> SetTitle("Events");
00360 h_ele_outerP_mode->GetXaxis()-> SetTitle("P_{out} (GeV/c)");
00361 h_ele_outerP_mode->GetYaxis()-> SetTitle("Events");
00362
00363 h_ele_outerPt->GetXaxis()-> SetTitle("P_{T out} (GeV/c)");
00364 h_ele_outerPt->GetYaxis()-> SetTitle("Events");
00365 h_ele_outerPt_mode->GetXaxis()-> SetTitle("P_{T out} (GeV/c)");
00366 h_ele_outerPt_mode->GetYaxis()-> SetTitle("Events");
00367
00368 h_ele_EoP->GetXaxis()-> SetTitle("E/P_{vertex}");
00369 h_ele_EoP->GetYaxis()-> SetTitle("Events");
00370
00371
00372
00373 h_ele_EeleOPout->GetXaxis()-> SetTitle("E_{ele}/P_{out}");
00374 h_ele_EeleOPout->GetYaxis()-> SetTitle("Events");
00375
00376 h_ele_dEtaSc_propVtx-> GetXaxis()-> SetTitle("#eta_{sc} - #eta_{tr}");
00377 h_ele_dEtaSc_propVtx-> GetYaxis()-> SetTitle("Events");
00378 h_ele_dEtaCl_propOut-> GetXaxis()-> SetTitle("#eta_{seedcl} - #eta_{tr}");
00379 h_ele_dEtaCl_propOut-> GetYaxis()-> SetTitle("Events");
00380 h_ele_dEtaEleCl_propOut-> GetXaxis()-> SetTitle("#eta_{elecl} - #eta_{tr}");
00381 h_ele_dEtaEleCl_propOut-> GetYaxis()-> SetTitle("Events");
00382 h_ele_dPhiSc_propVtx-> GetXaxis()-> SetTitle("#phi_{sc} - #phi_{tr} (rad)");
00383 h_ele_dPhiSc_propVtx-> GetYaxis()-> SetTitle("Events");
00384 h_ele_dPhiCl_propOut-> GetXaxis()-> SetTitle("#phi_{seedcl} - #phi_{tr} (rad)");
00385 h_ele_dPhiCl_propOut-> GetYaxis()-> SetTitle("Events");
00386 h_ele_dPhiEleCl_propOut-> GetXaxis()-> SetTitle("#phi_{elecl} - #phi_{tr} (rad)");
00387 h_ele_dPhiEleCl_propOut-> GetYaxis()-> SetTitle("Events");
00388 h_ele_HoE-> GetXaxis()-> SetTitle("H/E") ;
00389 h_ele_HoE-> GetYaxis()-> SetTitle("Events") ;
00390
00391
00392
00393
00394
00395 h_ele_tkSumPt_dr03 = new TH1F("h_ele_tkSumPt_dr03","tk isolation sum, dR=0.3",100,0.0,20.);
00396 h_ele_ecalRecHitSumEt_dr03= new TH1F("h_ele_ecalRecHitSumEt_dr03","ecal isolation sum, dR=0.3",100,0.0,20.);
00397 h_ele_hcalDepth1TowerSumEt_dr03= new TH1F("h_ele_hcalDepth1TowerSumEt_dr03","hcal depth1 isolation sum, dR=0.3",100,0.0,20.);
00398 h_ele_hcalDepth2TowerSumEt_dr03= new TH1F("h_ele_hcalDepth2TowerSumEt_dr03","hcal depth2 isolation sum, dR=0.3",100,0.0,20.);
00399 h_ele_tkSumPt_dr04= new TH1F("h_ele_tkSumPt_dr04","hcal isolation sum",100,0.0,20.);
00400 h_ele_ecalRecHitSumEt_dr04= new TH1F("h_ele_ecalRecHitSumEt_dr04","ecal isolation sum, dR=0.4",100,0.0,20.);
00401 h_ele_hcalDepth1TowerSumEt_dr04= new TH1F("h_ele_hcalDepth1TowerSumEt_dr04","hcal depth1 isolation sum, dR=0.4",100,0.0,20.);
00402 h_ele_hcalDepth2TowerSumEt_dr04= new TH1F("h_ele_hcalDepth2TowerSumEt_dr04","hcal depth2 isolation sum, dR=0.4",100,0.0,20.);
00403
00404
00405
00406
00407 h_ele_mee_os = new TH1F( "h_ele_mee_os", "ele pairs invariant mass, opposite sign", nbinmee, meemin, meemax );
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446 }
00447
00448
00449 void
00450 DQMAnalyzer::endJob(){
00451
00452 histfile_->cd();
00453 std::cout << "efficiency calculation " << std::endl;
00454
00455
00456 TH1F *h_ele_ptEff = (TH1F*)h_ele_matchingObjectPt_matched->Clone("h_ele_ptEff");
00457 h_ele_ptEff->Reset();
00458 h_ele_ptEff->Divide(h_ele_matchingObjectPt_matched,h_matchingObjectPt,1,1,"b");
00459 h_ele_ptEff->GetXaxis()->SetTitle("p_{T} (GeV/c)");
00460 h_ele_ptEff->GetYaxis()->SetTitle("Efficiency");
00461
00462
00463 TH1F *h_ele_etaEff = (TH1F*)h_ele_matchingObjectEta_matched->Clone("h_ele_etaEff");
00464 h_ele_etaEff->Reset();
00465 h_ele_etaEff->Divide(h_ele_matchingObjectEta_matched,h_matchingObjectEta,1,1,"b");
00466 h_ele_etaEff->Print();
00467 h_ele_etaEff->GetXaxis()->SetTitle("#eta");
00468 h_ele_etaEff->GetYaxis()->SetTitle("Efficiency");
00469
00470
00471 TH1F *h_ele_absetaEff = (TH1F*)h_ele_matchingObjectAbsEta_matched->Clone("h_ele_absetaEff");
00472 h_ele_absetaEff->Reset();
00473 h_ele_absetaEff->Divide(h_ele_matchingObjectAbsEta_matched,h_matchingObjectAbsEta,1,1,"b");
00474 h_ele_absetaEff->GetXaxis()->SetTitle("|#eta|");
00475 h_ele_absetaEff->GetYaxis()->SetTitle("Efficiency");
00476
00477
00478 TH1F *h_ele_phiEff = (TH1F*)h_ele_matchingObjectPhi_matched->Clone("h_ele_phiEff");
00479 h_ele_phiEff->Reset();
00480 h_ele_phiEff->Divide(h_ele_matchingObjectPhi_matched,h_matchingObjectPhi,1,1,"b");
00481 h_ele_phiEff->GetXaxis()->SetTitle("#phi (rad)");
00482 h_ele_phiEff->GetYaxis()->SetTitle("Efficiency");
00483
00484
00485 TH1F *h_ele_zEff = (TH1F*)h_ele_matchingObjectZ_matched->Clone("h_ele_zEff");
00486 h_ele_zEff->Reset();
00487 h_ele_zEff->Divide(h_ele_matchingObjectZ_matched,h_matchingObjectZ,1,1,"b");
00488 h_ele_zEff->Print();
00489 h_ele_zEff->GetXaxis()->SetTitle("z (cm)");
00490 h_ele_zEff->GetYaxis()->SetTitle("Efficiency");
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503 h_matchingObjectNum->Write();
00504
00505
00506
00507 histNum_->Write();
00508
00509
00510 h_matchingObjectEta->Write();
00511 h_matchingObjectAbsEta->Write();
00512 h_matchingObjectP->Write();
00513 h_matchingObjectPt->Write();
00514 h_matchingObjectPhi->Write();
00515 h_matchingObjectZ->Write();
00516
00517
00518
00519
00520 h_ele_charge->Write();
00521
00522
00523 h_ele_vertexPt->Write();
00524 h_ele_vertexEta->Write();
00525 h_ele_vertexPhi->Write();
00526 h_ele_vertexX->Write();
00527 h_ele_vertexY ->Write();
00528 h_ele_vertexZ->Write();
00529
00530 h_ele_vertexTIP->Write();
00531
00532 h_ele_Et->Write();
00533
00534 h_ele_matchingObjectPt_matched->Write();
00535 h_ele_matchingObjectAbsEta_matched->Write();
00536 h_ele_matchingObjectEta_matched->Write();
00537 h_ele_matchingObjectPhi_matched->Write();
00538 h_ele_matchingObjectZ_matched->Write();
00539
00540
00541
00542
00543
00544
00545
00546
00547
00548
00549
00550
00551
00552 histSclEn_->Write();
00553 histSclEt_->Write();
00554 histSclEta_->Write();
00555 histSclPhi_->Write();
00556 histSclSigEtaEta_->Write();
00557
00558
00559 h_ele_ambiguousTracks->Write();
00560 h_ele_ambiguousTracksVsEta->Write();
00561 h_ele_ambiguousTracksVsPhi->Write();
00562 h_ele_ambiguousTracksVsPt->Write();
00563
00564 h_ele_foundHits->Write();
00565 h_ele_foundHitsVsEta->Write();
00566 h_ele_foundHitsVsPhi->Write();
00567 h_ele_foundHitsVsPt->Write();
00568
00569 h_ele_lostHits->Write();
00570 h_ele_lostHitsVsEta->Write();
00571 h_ele_lostHitsVsPhi->Write();
00572 h_ele_lostHitsVsPt->Write();
00573
00574 h_ele_chi2 ->Write();
00575 h_ele_chi2VsEta ->Write();
00576 h_ele_chi2VsPhi ->Write();
00577 h_ele_chi2VsPt->Write();
00578
00579 h_ele_PinMnPout->Write();
00580 h_ele_PinMnPout_mode->Write();
00581 h_ele_outerP ->Write();
00582 h_ele_outerP_mode->Write();
00583 h_ele_outerPt->Write();
00584 h_ele_outerPt_mode ->Write();
00585
00586
00587 h_ele_EoP ->Write();
00588
00589 h_ele_EeleOPout->Write();
00590 h_ele_dEtaSc_propVtx->Write();
00591 h_ele_dPhiSc_propVtx->Write();
00592 h_ele_dEtaCl_propOut->Write();
00593 h_ele_dPhiCl_propOut->Write();
00594 h_ele_dEtaEleCl_propOut->Write();
00595 h_ele_dPhiEleCl_propOut->Write();
00596 h_ele_HoE->Write();
00597
00598
00599
00600 h_ele_mee_os-> GetXaxis()-> SetTitle("m_{e^{+}e^{-}} (GeV/c^{2})");
00601 h_ele_mee_os-> GetYaxis()-> SetTitle("Events");
00602 h_ele_mee_os->Write();
00603
00604
00605
00606
00607
00608
00609 h_ele_etaEff->Write();
00610 h_ele_zEff->Write();
00611 h_ele_phiEff->Write();
00612 h_ele_absetaEff->Write();
00613 h_ele_ptEff->Write();
00614
00615
00616
00617 h_ele_mva->Write();
00618 h_ele_provenance->Write();
00619
00620
00621 h_ele_tkSumPt_dr03->GetXaxis()->SetTitle("TkIsoSum, cone 0.3 (GeV/c)");
00622 h_ele_tkSumPt_dr03->GetYaxis()->SetTitle("Events");
00623 h_ele_ecalRecHitSumEt_dr03->GetXaxis()->SetTitle("EcalIsoSum, cone 0.3 (GeV)");
00624 h_ele_ecalRecHitSumEt_dr03->GetYaxis()->SetTitle("Events");
00625 h_ele_hcalDepth1TowerSumEt_dr03->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.3 (GeV)");
00626 h_ele_hcalDepth1TowerSumEt_dr03->GetYaxis()->SetTitle("Events");
00627 h_ele_hcalDepth2TowerSumEt_dr03->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.3 (GeV)");
00628 h_ele_hcalDepth2TowerSumEt_dr03->GetYaxis()->SetTitle("Events");
00629 h_ele_tkSumPt_dr04->GetXaxis()->SetTitle("TkIsoSum, cone 0.4 (GeV/c)");
00630 h_ele_tkSumPt_dr04->GetYaxis()->SetTitle("Events");
00631 h_ele_ecalRecHitSumEt_dr04->GetXaxis()->SetTitle("EcalIsoSum, cone 0.4 (GeV)");
00632 h_ele_ecalRecHitSumEt_dr04->GetYaxis()->SetTitle("Events");
00633 h_ele_hcalDepth1TowerSumEt_dr04->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.4 (GeV)");
00634 h_ele_hcalDepth1TowerSumEt_dr04->GetYaxis()->SetTitle("Events");
00635 h_ele_hcalDepth2TowerSumEt_dr04->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.4 (GeV)");
00636 h_ele_hcalDepth2TowerSumEt_dr04->GetYaxis()->SetTitle("Events");
00637
00638 h_ele_tkSumPt_dr03->Write();
00639 h_ele_ecalRecHitSumEt_dr03->Write();
00640 h_ele_hcalDepth1TowerSumEt_dr03->Write();
00641 h_ele_hcalDepth2TowerSumEt_dr03->Write();
00642 h_ele_tkSumPt_dr04->Write();
00643 h_ele_ecalRecHitSumEt_dr04->Write();
00644 h_ele_hcalDepth1TowerSumEt_dr04->Write();
00645 h_ele_hcalDepth2TowerSumEt_dr04->Write();
00646
00647 }
00648
00649
00650 void
00651 DQMAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
00652 {
00653 edm::LogInfo("DQMAnalyzer::analyze")<<"Treating event "<<iEvent.id() ;
00654 nEvents_++ ;
00655 if (!trigger(iEvent)) return ;
00656 nAfterTrigger_++ ;
00657 edm::LogInfo("DQMAnalyzer::analyze")<<"Trigger OK" ;
00658 edm::Handle<reco::GsfElectronCollection> gsfElectrons;
00659 iEvent.getByLabel(electronCollection_,gsfElectrons);
00660 edm::LogInfo("DQMAnalyzer::analyze")<<"Event has "<<gsfElectrons.product()->size()<<" electrons" ;
00661 edm::Handle<reco::SuperClusterCollection> recoClusters;
00662 iEvent.getByLabel(matchingObjectCollection_,recoClusters);
00663 edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
00664 iEvent.getByLabel(beamSpot_, recoBeamSpotHandle);
00665 const reco::BeamSpot bs = *recoBeamSpotHandle;
00666 histNum_->Fill((*gsfElectrons).size());
00667
00668
00669 reco::GsfElectronCollection::const_iterator gsfIter ;
00670 for
00671 ( gsfIter=gsfElectrons->begin() ;
00672 gsfIter!=gsfElectrons->end();
00673 gsfIter++ )
00674 {
00675
00676 double vertexTIP =
00677 (gsfIter->vertex().x()-bs.position().x()) * (gsfIter->vertex().x()-bs.position().x()) +
00678 (gsfIter->vertex().y()-bs.position().y()) * (gsfIter->vertex().y()-bs.position().y()) ;
00679 vertexTIP = sqrt(vertexTIP) ;
00680
00681
00682 if (!selected(gsfIter,vertexTIP)) continue ;
00683
00684
00685 h_ele_charge->Fill( gsfIter->charge() );
00686
00687 h_ele_vertexPt->Fill( gsfIter->pt() );
00688 h_ele_Et->Fill( gsfIter->superCluster()->energy()/cosh( gsfIter->superCluster()->eta()) );
00689 h_ele_vertexEta->Fill( gsfIter->eta() );
00690 h_ele_vertexPhi->Fill( gsfIter->phi() );
00691 h_ele_vertexX->Fill( gsfIter->vertex().x() );
00692 h_ele_vertexY->Fill( gsfIter->vertex().y() );
00693 h_ele_vertexZ->Fill( gsfIter->vertex().z() );
00694 h_ele_vertexTIP->Fill( vertexTIP );
00695
00696
00697 reco::SuperClusterRef sclRef = gsfIter->superCluster() ;
00698
00699
00700
00701 histSclEn_->Fill(sclRef->energy());
00702 double R=TMath::Sqrt(sclRef->x()*sclRef->x() + sclRef->y()*sclRef->y() +sclRef->z()*sclRef->z());
00703 double Rt=TMath::Sqrt(sclRef->x()*sclRef->x() + sclRef->y()*sclRef->y());
00704 histSclEt_->Fill(sclRef->energy()*(Rt/R));
00705 histSclEta_->Fill(sclRef->eta());
00706 histSclPhi_->Fill(sclRef->phi());
00707 histSclSigEtaEta_->Fill(gsfIter->scSigmaEtaEta());
00708
00709
00710 h_ele_ambiguousTracks->Fill( gsfIter->ambiguousGsfTracksSize() );
00711 h_ele_ambiguousTracksVsEta->Fill( gsfIter->eta(), gsfIter->ambiguousGsfTracksSize() );
00712 h_ele_ambiguousTracksVsPhi->Fill( gsfIter->phi(), gsfIter->ambiguousGsfTracksSize() );
00713 h_ele_ambiguousTracksVsPt->Fill( gsfIter->pt(), gsfIter->ambiguousGsfTracksSize() );
00714 if (!readAOD_)
00715 {
00716 h_ele_foundHits->Fill( gsfIter->gsfTrack()->numberOfValidHits() );
00717 h_ele_foundHitsVsEta->Fill( gsfIter->eta(), gsfIter->gsfTrack()->numberOfValidHits() );
00718 h_ele_foundHitsVsPhi->Fill( gsfIter->phi(), gsfIter->gsfTrack()->numberOfValidHits() );
00719 h_ele_foundHitsVsPt->Fill( gsfIter->pt(), gsfIter->gsfTrack()->numberOfValidHits() );
00720 h_ele_lostHits->Fill( gsfIter->gsfTrack()->numberOfLostHits() );
00721 h_ele_lostHitsVsEta->Fill( gsfIter->eta(), gsfIter->gsfTrack()->numberOfLostHits() );
00722 h_ele_lostHitsVsPhi->Fill( gsfIter->phi(), gsfIter->gsfTrack()->numberOfLostHits() );
00723 h_ele_lostHitsVsPt->Fill( gsfIter->pt(), gsfIter->gsfTrack()->numberOfLostHits() );
00724 h_ele_chi2->Fill( gsfIter->gsfTrack()->normalizedChi2() );
00725 h_ele_chi2VsEta->Fill( gsfIter->eta(), gsfIter->gsfTrack()->normalizedChi2() );
00726 h_ele_chi2VsPhi->Fill( gsfIter->phi(), gsfIter->gsfTrack()->normalizedChi2() );
00727 h_ele_chi2VsPt->Fill( gsfIter->pt(), gsfIter->gsfTrack()->normalizedChi2() );
00728 }
00729
00730
00731 if (!readAOD_)
00732 {
00733 h_ele_PinMnPout->Fill( gsfIter->gsfTrack()->innerMomentum().R() - gsfIter->gsfTrack()->outerMomentum().R() );
00734 h_ele_outerP->Fill( gsfIter->gsfTrack()->outerMomentum().R() );
00735 h_ele_outerPt->Fill( gsfIter->gsfTrack()->outerMomentum().Rho() );
00736 }
00737
00738
00739 h_ele_PinMnPout_mode->Fill( gsfIter->trackMomentumAtVtx().R() - gsfIter->trackMomentumOut().R() );
00740 h_ele_outerP_mode->Fill( gsfIter->trackMomentumOut().R() );
00741 h_ele_outerPt_mode->Fill( gsfIter->trackMomentumOut().Rho() );
00742
00743
00744
00745
00746
00747
00748
00749
00750
00751
00752
00753
00754
00755
00756
00757
00758 h_ele_EoP->Fill( gsfIter->eSuperClusterOverP() );
00759 h_ele_EeleOPout->Fill( gsfIter->eEleClusterOverPout() );
00760 h_ele_dEtaSc_propVtx->Fill(gsfIter->deltaEtaSuperClusterTrackAtVtx());
00761 h_ele_dPhiSc_propVtx->Fill(gsfIter->deltaPhiSuperClusterTrackAtVtx());
00762 h_ele_dEtaCl_propOut->Fill(gsfIter->deltaEtaSeedClusterTrackAtCalo());
00763 h_ele_dPhiCl_propOut->Fill(gsfIter->deltaPhiSeedClusterTrackAtCalo());
00764 h_ele_dEtaEleCl_propOut->Fill(gsfIter->deltaEtaEleClusterTrackAtCalo());
00765 h_ele_dPhiEleCl_propOut->Fill(gsfIter->deltaPhiEleClusterTrackAtCalo());
00766 h_ele_HoE->Fill(gsfIter->hadronicOverEm());
00767
00768
00769
00770
00771
00772 h_ele_mva->Fill(gsfIter->mva()) ;
00773 if (gsfIter->ecalDrivenSeed()) h_ele_provenance->Fill(1.) ;
00774 if (gsfIter->trackerDrivenSeed()) h_ele_provenance->Fill(-1.) ;
00775 if (gsfIter->trackerDrivenSeed()||gsfIter->ecalDrivenSeed()) h_ele_provenance->Fill(0.);
00776 if (gsfIter->trackerDrivenSeed()&&!gsfIter->ecalDrivenSeed()) h_ele_provenance->Fill(-2.);
00777 if (!gsfIter->trackerDrivenSeed()&&gsfIter->ecalDrivenSeed()) h_ele_provenance->Fill(2.);
00778
00779 h_ele_tkSumPt_dr03->Fill(gsfIter->dr03TkSumPt());
00780 h_ele_ecalRecHitSumEt_dr03->Fill(gsfIter->dr03EcalRecHitSumEt());
00781 h_ele_hcalDepth1TowerSumEt_dr03->Fill(gsfIter->dr03HcalDepth1TowerSumEt());
00782 h_ele_hcalDepth2TowerSumEt_dr03->Fill(gsfIter->dr03HcalDepth2TowerSumEt());
00783 h_ele_tkSumPt_dr04->Fill(gsfIter->dr04TkSumPt());
00784 h_ele_ecalRecHitSumEt_dr04->Fill(gsfIter->dr04EcalRecHitSumEt());
00785 h_ele_hcalDepth1TowerSumEt_dr04->Fill(gsfIter->dr04HcalDepth1TowerSumEt());
00786 h_ele_hcalDepth2TowerSumEt_dr04->Fill(gsfIter->dr04HcalDepth2TowerSumEt());
00787 }
00788
00789
00790 int matchingObjectNum=0 ;
00791 reco::SuperClusterCollection::const_iterator moIter ;
00792 for
00793 ( moIter=recoClusters->begin() ;
00794 moIter!=recoClusters->end() ;
00795 moIter++ )
00796 {
00797
00798 matchingObjectNum++;
00799
00800 if
00801 ( moIter->energy()/cosh(moIter->eta())>maxPtMatchingObject_ ||
00802 fabs(moIter->eta())> maxAbsEtaMatchingObject_ )
00803 { continue ; }
00804
00805
00806
00807
00808
00809
00810 h_matchingObjectEta->Fill( moIter->eta() );
00811 h_matchingObjectAbsEta->Fill( fabs(moIter->eta()) );
00812 h_matchingObjectP->Fill( moIter->energy() );
00813 h_matchingObjectPt->Fill( moIter->energy()/cosh(moIter->eta()) );
00814 h_matchingObjectPhi->Fill( moIter->phi() );
00815 h_matchingObjectZ->Fill( moIter->z() );
00816
00817
00818 bool okGsfFound = false;
00819 double gsfOkRatio = 999999.;
00820 reco::GsfElectron bestGsfElectron ;
00821 reco::GsfElectronCollection::const_iterator gsfIter ;
00822 for
00823 ( gsfIter=gsfElectrons->begin() ;
00824 gsfIter!=gsfElectrons->end() ;
00825 gsfIter++ )
00826 {
00827 double vertexTIP =
00828 (gsfIter->vertex().x()-bs.position().x()) * (gsfIter->vertex().x()-bs.position().x()) +
00829 (gsfIter->vertex().y()-bs.position().y()) * (gsfIter->vertex().y()-bs.position().y()) ;
00830 vertexTIP = sqrt(vertexTIP) ;
00831
00832
00833 if (!selected(gsfIter,vertexTIP)) continue ;
00834
00835 if (Selection_ >= 4)
00836 {
00837 reco::GsfElectronCollection::const_iterator gsfIter2 ;
00838 for
00839 ( gsfIter2=gsfIter+1 ;
00840 gsfIter2!=gsfElectrons->end() ;
00841 gsfIter2++ )
00842 {
00843 math::XYZTLorentzVector p12 = (*gsfIter).p4()+(*gsfIter2).p4() ;
00844 float mee2 = p12.Dot(p12) ;
00845 bool opsign = (gsfIter->charge()*gsfIter2->charge()<0.) ;
00846 float invMass = sqrt(mee2) ;
00847
00848 if (TPchecksign_ && !opsign) break ;
00849
00850
00851 if(TAGcheckclass_ && (gsfIter->classification()==GsfElectron::SHOWERING || gsfIter->isGap())) break;
00852
00853
00854 if(PROBEetcut_ && (gsfIter2->superCluster()->energy()/cosh(gsfIter2->superCluster()->eta())<minEt_)) continue;
00855 if(PROBEcheckclass_ && (gsfIter2->classification()==GsfElectron::SHOWERING || gsfIter2->isGap())) continue;
00856
00857 if( invMass < massLow_ || invMass > massHigh_ ) continue ;
00858
00859 h_ele_mee_os->Fill(invMass) ;
00860 bestGsfElectron =* gsfIter2 ;
00861 okGsfFound = true ;
00862 }
00863 }
00864 else
00865 {
00866 reco::GsfElectronCollection::const_iterator gsfIter2 ;
00867 for
00868 ( gsfIter2=gsfIter+1;
00869 gsfIter2!=gsfElectrons->end() ;
00870 gsfIter2++ )
00871 {
00872 math::XYZTLorentzVector p12 = (*gsfIter).p4()+(*gsfIter2).p4() ;
00873 float mee2 = p12.Dot(p12) ;
00874
00875 float invMass = sqrt(mee2) ;
00876 h_ele_mee_os->Fill(invMass) ;
00877 }
00878
00879
00880 if ( matchingCondition_ == "Cone" )
00881 {
00882 double dphi = gsfIter->phi()-moIter->phi() ;
00883 if (fabs(dphi)>CLHEP::pi)
00884 { dphi = dphi < 0? (CLHEP::twopi) + dphi : dphi - CLHEP::twopi ; }
00885 double deltaR = sqrt(std::pow((moIter->eta()-gsfIter->eta()),2) + std::pow(dphi,2)) ;
00886 if ( deltaR < deltaR_ )
00887 {
00888
00889
00890 double tmpGsfRatio = gsfIter->p()/moIter->energy();
00891 if ( fabs(tmpGsfRatio-1) < fabs(gsfOkRatio-1) && Selection_ != 4 )
00892 {
00893 gsfOkRatio = tmpGsfRatio;
00894 bestGsfElectron=*gsfIter;
00895 okGsfFound = true;
00896 }
00897
00898 }
00899 }
00900 }
00901 }
00902
00903
00904 if (okGsfFound)
00905 {
00906
00907 h_ele_matchingObjectPt_matched->Fill( moIter->energy()/cosh(moIter->eta()) );
00908 h_ele_matchingObjectPhi_matched->Fill( moIter->phi() );
00909 h_ele_matchingObjectAbsEta_matched->Fill( fabs(moIter->eta()) );
00910 h_ele_matchingObjectEta_matched->Fill( moIter->eta() );
00911 h_ele_matchingObjectZ_matched->Fill( moIter->z() );
00912
00913
00914
00915
00916
00917
00918
00919
00920
00921
00922
00923
00924
00925
00926
00927
00928 reco::SuperClusterRef sclRef = bestGsfElectron.superCluster() ;
00929
00930
00931
00932 }
00933
00934 }
00935
00936 h_matchingObjectNum->Fill(matchingObjectNum) ;
00937
00938 }
00939
00940 bool DQMAnalyzer::trigger( const edm::Event & e )
00941 {
00942
00943 edm::Handle<edm::TriggerResults> triggerResults ;
00944 e.getByLabel(triggerResults_,triggerResults) ;
00945
00946 bool accept = false ;
00947
00948 if (triggerResults.isValid())
00949 {
00950
00951
00952
00953 const edm::TriggerNames & triggerNames = e.triggerNames(*triggerResults);
00954 if (nEvents_==1)
00955 {
00956 for (unsigned int i=0; i<triggerNames.size(); i++)
00957 {
00958
00959 }
00960 }
00961
00962 unsigned int n = HLTPathsByName_.size() ;
00963 for (unsigned int i=0; i!=n; i++)
00964 {
00965 HLTPathsByIndex_[i]=triggerNames.triggerIndex(HLTPathsByName_[i]) ;
00966 }
00967
00968
00969 if (n==0)
00970 {
00971 n=triggerResults->size() ;
00972 HLTPathsByName_.resize(n) ;
00973 HLTPathsByIndex_.resize(n) ;
00974 for ( unsigned int i=0 ; i!=n ; i++)
00975 {
00976 HLTPathsByName_[i]=triggerNames.triggerName(i) ;
00977 HLTPathsByIndex_[i]=i ;
00978 }
00979 }
00980
00981
00982
00983
00984
00985
00986
00987
00988
00989
00990
00991
00992
00993
00994
00995
00996
00997
00998 unsigned int fired=0 ;
00999 for ( unsigned int i=0 ; i!=n ; i++ )
01000 {
01001 if (HLTPathsByIndex_[i]<triggerResults->size())
01002 {
01003 if (triggerResults->accept(HLTPathsByIndex_[i]))
01004 {
01005 fired++ ;
01006
01007 accept = true ;
01008 }
01009 }
01010 }
01011
01012 }
01013
01014 return accept ;
01015 }
01016
01017 bool DQMAnalyzer::selected( const reco::GsfElectronCollection::const_iterator & gsfIter , double vertexTIP )
01018 {
01019 if ((Selection_>0)&&generalCut(gsfIter)) return false ;
01020 if ((Selection_>=1)&&etCut(gsfIter)) return false ;
01021 if ((Selection_>=2)&&isolationCut(gsfIter,vertexTIP)) return false ;
01022 if ((Selection_>=3)&&idCut(gsfIter)) return false ;
01023 return true ;
01024 }
01025
01026 bool DQMAnalyzer::generalCut( const reco::GsfElectronCollection::const_iterator & gsfIter)
01027 {
01028 if (fabs(gsfIter->eta())>maxAbsEta_) return true ;
01029 if (gsfIter->pt()<minPt_) return true ;
01030
01031 if (gsfIter->isEB() && isEE_) return true ;
01032 if (gsfIter->isEE() && isEB_) return true ;
01033 if (gsfIter->isEBEEGap() && isNotEBEEGap_) return true ;
01034
01035 if (gsfIter->ecalDrivenSeed() && isTrackerDriven_) return true ;
01036 if (gsfIter->trackerDrivenSeed() && isEcalDriven_) return true ;
01037
01038 return false ;
01039 }
01040
01041 bool DQMAnalyzer::etCut( const reco::GsfElectronCollection::const_iterator & gsfIter )
01042 {
01043 if (gsfIter->superCluster()->energy()/cosh(gsfIter->superCluster()->eta())<minEt_) return true ;
01044
01045 return false ;
01046 }
01047
01048 bool DQMAnalyzer::isolationCut( const reco::GsfElectronCollection::const_iterator & gsfIter, double vertexTIP )
01049 {
01050 if (gsfIter->isEB() && vertexTIP > tipMaxBarrel_) return true ;
01051 if (gsfIter->isEE() && vertexTIP > tipMaxEndcaps_) return true ;
01052
01053 if (gsfIter->dr03TkSumPt() > tkIso03Max_) return true ;
01054 if (gsfIter->isEB() && gsfIter->dr03HcalDepth1TowerSumEt() > hcalIso03Depth1MaxBarrel_) return true ;
01055 if (gsfIter->isEE() && gsfIter->dr03HcalDepth1TowerSumEt() > hcalIso03Depth1MaxEndcaps_) return true ;
01056 if (gsfIter->isEE() && gsfIter->dr03HcalDepth2TowerSumEt() > hcalIso03Depth2MaxEndcaps_) return true ;
01057 if (gsfIter->isEB() && gsfIter->dr03EcalRecHitSumEt() > ecalIso03MaxBarrel_) return true ;
01058 if (gsfIter->isEE() && gsfIter->dr03EcalRecHitSumEt() > ecalIso03MaxEndcaps_) return true ;
01059
01060 return false ;
01061 }
01062
01063 bool DQMAnalyzer::idCut( const reco::GsfElectronCollection::const_iterator & gsfIter )
01064 {
01065 if (gsfIter->isEB() && gsfIter->eSuperClusterOverP() < eOverPMinBarrel_) return true ;
01066 if (gsfIter->isEB() && gsfIter->eSuperClusterOverP() > eOverPMaxBarrel_) return true ;
01067 if (gsfIter->isEE() && gsfIter->eSuperClusterOverP() < eOverPMinEndcaps_) return true ;
01068 if (gsfIter->isEE() && gsfIter->eSuperClusterOverP() > eOverPMaxEndcaps_) return true ;
01069 if (gsfIter->isEB() && fabs(gsfIter->deltaEtaSuperClusterTrackAtVtx()) < dEtaMinBarrel_) return true ;
01070 if (gsfIter->isEB() && fabs(gsfIter->deltaEtaSuperClusterTrackAtVtx()) > dEtaMaxBarrel_) return true ;
01071 if (gsfIter->isEE() && fabs(gsfIter->deltaEtaSuperClusterTrackAtVtx()) < dEtaMinEndcaps_) return true ;
01072 if (gsfIter->isEE() && fabs(gsfIter->deltaEtaSuperClusterTrackAtVtx()) > dEtaMaxEndcaps_) return true ;
01073 if (gsfIter->isEB() && fabs(gsfIter->deltaPhiSuperClusterTrackAtVtx()) < dPhiMinBarrel_) return true ;
01074 if (gsfIter->isEB() && fabs(gsfIter->deltaPhiSuperClusterTrackAtVtx()) > dPhiMaxBarrel_) return true ;
01075 if (gsfIter->isEE() && fabs(gsfIter->deltaPhiSuperClusterTrackAtVtx()) < dPhiMinEndcaps_) return true ;
01076 if (gsfIter->isEE() && fabs(gsfIter->deltaPhiSuperClusterTrackAtVtx()) > dPhiMaxEndcaps_) return true ;
01077 if (gsfIter->isEB() && gsfIter->scSigmaIEtaIEta() < sigIetaIetaMinBarrel_) return true ;
01078 if (gsfIter->isEB() && gsfIter->scSigmaIEtaIEta() > sigIetaIetaMaxBarrel_) return true ;
01079 if (gsfIter->isEE() && gsfIter->scSigmaIEtaIEta() < sigIetaIetaMinEndcaps_) return true ;
01080 if (gsfIter->isEE() && gsfIter->scSigmaIEtaIEta() > sigIetaIetaMaxEndcaps_) return true ;
01081 if (gsfIter->isEB() && gsfIter->hadronicOverEm() > hadronicOverEmMaxBarrel_) return true ;
01082 if (gsfIter->isEE() && gsfIter->hadronicOverEm() > hadronicOverEmMaxEndcaps_) return true ;
01083
01084 return false ;
01085 }
01086