00001 #include "DQM/HLTEvF/interface/HLTTauDQML1Plotter.h"
00002 #include "Math/GenVector/VectorUtil.h"
00003
00004 HLTTauDQML1Plotter::HLTTauDQML1Plotter(const edm::ParameterSet& ps,int etbins,int etabins,int phibins,double maxpt,bool ref,double dr) :
00005 triggerTag_(ps.getParameter<std::string>("DQMFolder")),
00006 l1ExtraTaus_(ps.getParameter<edm::InputTag>("L1Taus")),
00007 l1ExtraJets_(ps.getParameter<edm::InputTag>("L1Jets")),
00008 l1ExtraElectrons_(ps.getParameter<edm::InputTag>("L1Electrons")),
00009 l1ExtraMuons_(ps.getParameter<edm::InputTag>("L1Muons")),
00010 doRefAnalysis_(ref),
00011 matchDeltaR_(dr),
00012 maxEt_(maxpt),
00013 binsEt_(etbins),
00014 binsEta_(etabins),
00015 binsPhi_(phibins)
00016 {
00017
00018 DQMStore* store = &*edm::Service<DQMStore>();
00019
00020 if(store)
00021 {
00022
00023 store->setCurrentFolder(triggerTag_);
00024
00025 l1tauEt_ = store->book1D("L1TauEt","L1 #tau E_{t}",binsEt_,0,maxEt_);
00026 l1tauEt_->getTH1F()->GetXaxis()->SetTitle("L1 #tau E_{T}");
00027 l1tauEt_->getTH1F()->GetYaxis()->SetTitle("entries");
00028
00029 l1tauEta_ = store->book1D("L1TauEta","L1 #tau #eta",binsEta_,-2.5,2.5);
00030 l1tauEta_->getTH1F()->GetXaxis()->SetTitle("L1 #tau #eta");
00031 l1tauEta_->getTH1F()->GetYaxis()->SetTitle("entries");
00032
00033 l1tauPhi_ = store->book1D("L1TauPhi","L1 #tau #phi",binsPhi_,-3.2,3.2);
00034 l1tauPhi_->getTH1F()->GetXaxis()->SetTitle("L1 #tau #phi");
00035 l1tauPhi_->getTH1F()->GetYaxis()->SetTitle("entries");
00036
00037 l1jetEt_ = store->book1D("L1JetEt","L1 jet E_{t}",binsEt_,0,maxEt_);
00038 l1jetEt_->getTH1F()->GetXaxis()->SetTitle("L1 Central Jet E_{T}");
00039 l1jetEt_->getTH1F()->GetYaxis()->SetTitle("entries");
00040
00041 l1jetEta_ = store->book1D("L1JetEta","L1 jet #eta",binsEta_,-2.5,2.5);
00042 l1jetEta_->getTH1F()->GetXaxis()->SetTitle("L1 Central Jet #eta");
00043 l1jetEta_->getTH1F()->GetYaxis()->SetTitle("entries");
00044
00045 l1jetPhi_ = store->book1D("L1JetPhi","L1 jet #phi",binsPhi_,-3.2,3.2);
00046 l1jetPhi_->getTH1F()->GetXaxis()->SetTitle("L1 Central Jet #phi");
00047 l1jetPhi_->getTH1F()->GetYaxis()->SetTitle("entries");
00048
00049
00050 inputEvents_ = store->book1D("InputEvents","Events Read",2,0,2);
00051 inputEvents_->getTH1F()->GetYaxis()->SetTitle("entries");
00052
00053 l1electronEt_ = store->book1D("L1ElectronEt","L1 electron E_{t}",binsEt_,0,maxEt_);
00054 l1electronEt_->getTH1F()->GetXaxis()->SetTitle("L1 e/#gamma E_{T}");
00055 l1electronEt_->getTH1F()->GetYaxis()->SetTitle("entries");
00056
00057 l1electronEta_ = store->book1D("L1ElectronEta","L1 electron #eta",binsEta_,-2.5,2.5);
00058 l1electronEta_->getTH1F()->GetXaxis()->SetTitle("L1 e/#gamma #eta");
00059 l1electronEta_->getTH1F()->GetYaxis()->SetTitle("entries");
00060
00061 l1electronPhi_ = store->book1D("L1ElectronPhi","L1 electron #phi",binsPhi_,-3.2,3.2);
00062 l1electronPhi_->getTH1F()->GetXaxis()->SetTitle("L1 e/#gamma #phi");
00063 l1electronPhi_->getTH1F()->GetYaxis()->SetTitle("entries");
00064
00065 l1muonEt_ = store->book1D("L1MuonEt","L1 muon p_{t}",binsEt_,0,maxEt_);
00066 l1muonEt_->getTH1F()->GetXaxis()->SetTitle("L1 #mu p_{T}");
00067 l1muonEt_->getTH1F()->GetYaxis()->SetTitle("entries");
00068
00069 l1muonEta_ = store->book1D("L1MuonEta","L1 muon #eta",binsEta_,-2.5,2.5);
00070 l1muonEta_->getTH1F()->GetXaxis()->SetTitle("L1 #mu #eta");
00071 l1muonEta_->getTH1F()->GetYaxis()->SetTitle("entries");
00072
00073 l1muonPhi_ = store->book1D("L1MuonPhi","L1 muon #phi",binsPhi_,-3.2,3.2);
00074 l1muonPhi_->getTH1F()->GetXaxis()->SetTitle("L1 #mu #phi");
00075 l1muonPhi_->getTH1F()->GetYaxis()->SetTitle("entries");
00076
00077
00078 l1doubleTauPath_ = store->book2D("L1DoubleTau","L1 Double Tau Path Et",binsEt_,0,maxEt_,binsEt_,0,maxEt_);
00079 l1doubleTauPath_->getTH2F()->GetXaxis()->SetTitle("first L1 #tau p_{T}");
00080 l1doubleTauPath_->getTH2F()->GetYaxis()->SetTitle("second L1 #tau p_{T}");
00081
00082 l1muonTauPath_ = store->book2D("L1MuonTau","L1 Muon Tau Path Et",binsEt_,0,maxEt_,binsEt_,0,maxEt_);
00083 l1muonTauPath_->getTH2F()->GetXaxis()->SetTitle("first L1 #tau p_{T}");
00084 l1muonTauPath_->getTH2F()->GetYaxis()->SetTitle("first L1 #gamma p_{T}");
00085
00086 l1electronTauPath_ = store->book2D("L1ElectronTau","L1 Electron Tau Path Et",binsEt_,0,maxEt_,binsEt_,0,maxEt_);
00087 l1electronTauPath_->getTH2F()->GetXaxis()->SetTitle("first L1 #mu p_{T}");
00088 l1electronTauPath_->getTH2F()->GetYaxis()->SetTitle("second L1 #mu p_{T}");
00089
00090 firstTauEt_ = store->book1D("L1LeadTauEt","L1 lead #tau ET",binsEt_,0,maxEt_);
00091 firstTauEt_->getTH1F()->Sumw2();
00092
00093 secondTauEt_ = store->book1D("L1SecondTauEt","L1 second #tau ET",binsEt_,0,maxEt_);
00094 secondTauEt_->getTH1F()->Sumw2();
00095
00096 if(doRefAnalysis_)
00097 {
00098 l1tauEtRes_ = store->book1D("L1TauEtResol","L1 #tau E_{t} resolution",40,-2,2);
00099 l1tauEtRes_->getTH1F()->GetXaxis()->SetTitle("[L1 #tau E_{T}-Ref #tau E_{T}]/Ref #tau E_{T}");
00100 l1tauEtRes_->getTH1F()->GetYaxis()->SetTitle("entries");
00101
00102 store->setCurrentFolder(triggerTag_+"/EfficiencyHelpers");
00103 l1tauEtEffNum_ = store->book1D("L1TauEtEffNum","L1 #tau E_{t} Efficiency Numerator",binsEt_,0,maxEt_);
00104 l1tauEtEffNum_->getTH1F()->Sumw2();
00105
00106
00107 l1tauEtEffDenom_ = store->book1D("L1TauEtEffDenom","L1 #tau E_{t} Denominator",binsEt_,0,maxEt_);
00108 l1tauEtEffDenom_->getTH1F()->Sumw2();
00109
00110 l1tauEtaEffNum_ = store->book1D("L1TauEtaEffNum","L1 #tau #eta Efficiency",binsEta_,-2.5,2.5);
00111 l1tauEtaEffNum_->getTH1F()->Sumw2();
00112
00113 l1tauEtaEffDenom_ = store->book1D("L1TauEtaEffDenom","L1 #tau #eta Denominator",binsEta_,-2.5,2.5);
00114 l1tauEtaEffDenom_->getTH1F()->Sumw2();
00115
00116 l1tauPhiEffNum_ = store->book1D("L1TauPhiEffNum","L1 #tau #phi Efficiency",binsPhi_,-3.2,3.2);
00117 l1tauPhiEffNum_->getTH1F()->Sumw2();
00118
00119 l1tauPhiEffDenom_ = store->book1D("L1TauPhiEffDenom","L1 #tau #phi Denominator",binsPhi_,-3.2,3.2);
00120 l1tauPhiEffDenom_->getTH1F()->Sumw2();
00121
00122 l1jetEtEffNum_ = store->book1D("L1JetEtEffNum","L1 jet E_{t} Efficiency",binsEt_,0,maxEt_);
00123 l1jetEtEffNum_->getTH1F()->Sumw2();
00124
00125 l1jetEtEffDenom_ = store->book1D("L1JetEtEffDenom","L1 jet E_{t} Denominator",binsEt_,0,maxEt_);
00126 l1jetEtEffDenom_->getTH1F()->Sumw2();
00127
00128 l1jetEtaEffNum_ = store->book1D("L1JetEtaEffNum","L1 jet #eta Efficiency",binsEta_,-2.5,2.5);
00129 l1jetEtaEffNum_->getTH1F()->Sumw2();
00130
00131 l1jetEtaEffDenom_ = store->book1D("L1JetEtaEffDenom","L1 jet #eta Denominator",binsEta_,-2.5,2.5);
00132 l1jetEtaEffDenom_->getTH1F()->Sumw2();
00133
00134 l1jetPhiEffNum_ = store->book1D("L1JetPhiEffNum","L1 jet #phi Efficiency",binsPhi_,-3.2,3.2);
00135 l1jetPhiEffNum_->getTH1F()->Sumw2();
00136
00137 l1jetPhiEffDenom_ = store->book1D("L1JetPhiEffDenom","L1 jet #phi Denominator",binsPhi_,-3.2,3.2);
00138 l1jetPhiEffDenom_->getTH1F()->Sumw2();
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175 }
00176 }
00177
00178
00179 }
00180
00181 HLTTauDQML1Plotter::~HLTTauDQML1Plotter()
00182 {
00183 }
00184
00185
00186
00187
00188
00189 void
00190 HLTTauDQML1Plotter::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup,const std::vector<LVColl>& refC)
00191 {
00192
00193
00194
00195
00196 if(doRefAnalysis_)
00197 {
00198 if(refC.size()>0)
00199 for(size_t j = 0;j<(refC[0]).size();++j)
00200 {
00201 l1tauEtEffDenom_->Fill((refC[0])[j].pt());
00202 l1jetEtEffDenom_->Fill((refC[0])[j].pt());
00203
00204 l1tauEtaEffDenom_->Fill((refC[0])[j].eta());
00205 l1jetEtaEffDenom_->Fill((refC[0])[j].eta());
00206
00207 l1tauPhiEffDenom_->Fill((refC[0])[j].phi());
00208 l1jetPhiEffDenom_->Fill((refC[0])[j].phi());
00209
00210 }
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226 }
00227
00228
00229
00230 edm::Handle<l1extra::L1JetParticleCollection> taus;
00231 edm::Handle<l1extra::L1JetParticleCollection> jets;
00232 edm::Handle<l1extra::L1EmParticleCollection> electrons;
00233 edm::Handle<l1extra::L1MuonParticleCollection> muons;
00234
00235
00236 LVColl pathTaus;
00237 LVColl pathMuons;
00238 LVColl pathElectrons;
00239
00240
00241 LVColl l1taus;
00242 LVColl l1electrons;
00243 LVColl l1muons;
00244 LVColl l1jets;
00245
00246
00247
00248
00249 bool gotL1Taus=iEvent.getByLabel(l1ExtraTaus_,taus) &&taus.isValid();
00250 bool gotL1Jets=iEvent.getByLabel(l1ExtraJets_,jets) && jets.isValid();
00251 bool gotL1Electrons=iEvent.getByLabel(l1ExtraElectrons_,electrons) &&electrons.isValid();
00252 bool gotL1Muons=iEvent.getByLabel(l1ExtraMuons_,muons) && muons.isValid();
00253
00254
00255
00256
00257 if(gotL1Taus)
00258 if(taus->size()>0)
00259 {
00260 if(!doRefAnalysis_)
00261 {
00262 firstTauEt_->Fill((*taus)[0].pt());
00263 if(taus->size()>1)
00264 secondTauEt_->Fill((*taus)[0].pt());
00265
00266 }
00267 for(l1extra::L1JetParticleCollection::const_iterator i = taus->begin();i!=taus->end();++i)
00268 {
00269 l1taus.push_back(i->p4());
00270 if(!doRefAnalysis_)
00271 {
00272 l1tauEt_->Fill(i->et());
00273 l1tauEta_->Fill(i->eta());
00274 l1tauPhi_->Fill(i->phi());
00275 pathTaus.push_back(i->p4());
00276 }
00277
00278 }
00279
00280 }
00281 if(gotL1Jets)
00282 if(jets->size()>0)
00283 for(l1extra::L1JetParticleCollection::const_iterator i = jets->begin();i!=jets->end();++i)
00284 {
00285 l1jets.push_back(i->p4());
00286 if(!doRefAnalysis_)
00287 {
00288 l1jetEt_->Fill(i->et());
00289 l1jetEta_->Fill(i->eta());
00290 l1jetPhi_->Fill(i->phi());
00291 pathTaus.push_back(i->p4());
00292 }
00293
00294 }
00295
00296
00297 if(gotL1Electrons)
00298 if(electrons->size()>0)
00299 for(l1extra::L1EmParticleCollection::const_iterator i = electrons->begin();i!=electrons->end();++i)
00300 {
00301 l1electrons.push_back(i->p4());
00302 l1electronEt_->Fill(i->et());
00303 l1electronEta_->Fill(i->eta());
00304 l1electronPhi_->Fill(i->phi());
00305 pathElectrons.push_back(i->p4());
00306 }
00307
00308
00309 if(gotL1Muons)
00310 if(muons->size()>0)
00311 for(l1extra::L1MuonParticleCollection::const_iterator i = muons->begin();i!=muons->end();++i)
00312 {
00313 l1muons.push_back(i->p4());
00314 l1muonEt_->Fill(i->et());
00315 l1muonEta_->Fill(i->eta());
00316 l1muonPhi_->Fill(i->phi());
00317 pathMuons.push_back(i->p4());
00318 }
00319
00320
00321
00322
00323
00324
00325 if(doRefAnalysis_)
00326 {
00327
00328
00329 if(refC.size()>0)
00330 if(refC[0].size()>0)
00331 for(LVColl::const_iterator i=(refC[0]).begin();i!=(refC[0]).end();++i)
00332 {
00333 std::pair<bool,LV> m= match(*i,l1taus,matchDeltaR_);
00334 if(m.first)
00335 {
00336 l1tauEt_->Fill(m.second.pt());
00337 l1tauEta_->Fill(m.second.eta());
00338 l1tauPhi_->Fill(m.second.phi());
00339 l1tauEtEffNum_->Fill(i->pt());
00340 l1tauEtaEffNum_->Fill(i->eta());
00341 l1tauPhiEffNum_->Fill(i->phi());
00342 l1tauEtRes_->Fill((m.second.pt()-i->pt())/i->pt());
00343 pathTaus.push_back(m.second);
00344 }
00345 }
00346
00347 if(refC.size()>0)
00348 if(refC[0].size()>0)
00349 for(LVColl::const_iterator i=(refC[0]).begin();i!=(refC[0]).end();++i)
00350 {
00351 std::pair<bool,LV> m= match(*i,l1jets,matchDeltaR_);
00352 if(m.first)
00353 {
00354 l1jetEt_->Fill(m.second.pt());
00355 l1jetEta_->Fill(m.second.eta());
00356 l1jetPhi_->Fill(m.second.phi());
00357 l1jetEtEffNum_->Fill(i->pt());
00358 l1jetEtaEffNum_->Fill(i->eta());
00359 l1jetPhiEffNum_->Fill(i->phi());
00360 }
00361 }
00362
00363 if(refC.size()>1)
00364 if(refC[1].size()>0)
00365 for(LVColl::const_iterator i=(refC[1]).begin();i!=(refC[1]).end();++i)
00366 {
00367 std::pair<bool,LV> m= match(*i,l1electrons,matchDeltaR_);
00368 if(m.first)
00369 {
00370 l1electronEt_->Fill(m.second.pt());
00371 l1electronEta_->Fill(m.second.eta());
00372 l1electronPhi_->Fill(m.second.phi());
00373
00374
00375
00376 pathElectrons.push_back(m.second);
00377
00378 }
00379 }
00380 if(refC.size()>2)
00381 if(refC[2].size()>0)
00382 for(LVColl::const_iterator i=(refC[2]).begin();i!=(refC[2]).end();++i)
00383 {
00384 std::pair<bool,LV> m= match(*i,l1muons,matchDeltaR_);
00385 if(m.first)
00386 {
00387 l1muonEt_->Fill(m.second.pt());
00388 l1muonEta_->Fill(m.second.eta());
00389 l1muonPhi_->Fill(m.second.phi());
00390
00391
00392
00393 pathMuons.push_back(m.second);
00394 }
00395 }
00396 }
00397
00398
00399
00400
00401
00402 if(pathTaus.size()>1)
00403 std::sort(pathTaus.begin(),pathTaus.end(),ptSort);
00404 if(pathElectrons.size()>1)
00405 std::sort(pathElectrons.begin(),pathElectrons.end(),ptSort);
00406 if(pathMuons.size()>1)
00407 std::sort(pathMuons.begin(),pathMuons.end(),ptSort);
00408
00409
00410 if(pathTaus.size()>0)
00411 {
00412 firstTauEt_->Fill(pathTaus[0].pt());
00413 inputEvents_->Fill(0.5);
00414 }
00415 if(pathTaus.size()>1)
00416 {
00417 secondTauEt_->Fill(pathTaus[1].pt());
00418 inputEvents_->Fill(1.5);
00419 }
00420
00421 if(pathTaus.size()>=2)
00422 {
00423
00424 l1doubleTauPath_->Fill(pathTaus[0].pt(),pathTaus[1].pt());
00425 }
00426 if(pathTaus.size()>=1&&pathElectrons.size()>=1)
00427 {
00428 l1electronTauPath_->Fill(pathTaus[0].pt(),pathElectrons[0].pt());
00429 }
00430 if(pathTaus.size()>=1&&pathMuons.size()>=1)
00431 {
00432 l1muonTauPath_->Fill(pathTaus[0].pt(),pathMuons[0].pt());
00433 }
00434 }
00435
00436
00437 std::pair<bool,LV>
00438 HLTTauDQML1Plotter::match(const LV& jet,const LVColl& McInfo,double dr)
00439 {
00440 bool matched=false;
00441 LV out;
00442
00443 if(&McInfo)
00444 if(McInfo.size()>0)
00445 for(std::vector<LV>::const_iterator it = McInfo.begin();it!=McInfo.end();++it)
00446 {
00447 double delta = ROOT::Math::VectorUtil::DeltaR(jet,*it);
00448 if(delta<dr)
00449 {
00450 matched=true;
00451 out=*it;
00452 }
00453 }
00454 std::pair<bool,LV> a =std::make_pair(matched,out);
00455 return a;
00456 }
00457
00458
00459