CMS 3D CMS Logo

HLTTauDQMPathPlotter.cc
Go to the documentation of this file.
5 
6 namespace {
7  std::string stripVersion(const std::string& pathName) {
8  size_t versionStart = pathName.rfind("_v");
9  if (versionStart == std::string::npos)
10  return pathName;
11  return pathName.substr(0, versionStart);
12  }
13 } // namespace
14 
16  const HLTConfigProvider& HLTCP,
17  bool doRefAnalysis,
18  const std::string& dqmBaseFolder,
19  const std::string& hltProcess,
20  int ptbins,
21  int etabins,
22  int phibins,
23  double ptmax,
24  double highptmax,
25  double l1MatchDr,
26  double hltMatchDr)
27  : HLTTauDQMPlotter(stripVersion(pathName), dqmBaseFolder),
28  ptbins_(ptbins),
29  etabins_(etabins),
30  phibins_(phibins),
31  ptmax_(ptmax),
32  highptmax_(highptmax),
33  l1MatchDr_(l1MatchDr),
34  hltMatchDr_(hltMatchDr),
35  doRefAnalysis_(doRefAnalysis),
36  hltPath_(pathName, hltProcess, doRefAnalysis_, HLTCP) {
38 }
39 
40 #include <algorithm>
42  if (!isValid())
43  return;
44 
45  // Book histograms
46  iBooker.setCurrentFolder(triggerTag());
47 
48  hAcceptedEvents_ = iBooker.book1D(
49  "EventsPerFilter", "Accepted Events per filter;;entries", hltPath_.filtersSize(), 0, hltPath_.filtersSize());
50  for (size_t i = 0; i < hltPath_.filtersSize(); ++i) {
52  }
53 
54  // Efficiency helpers
55  if (doRefAnalysis_) {
56  iBooker.setCurrentFolder(triggerTag() + "/helpers");
57  if (hltPath_.hasL2Taus()) {
59  iBooker.book1D("L2TrigTauEtEffNum", "L2 #tau p_{T} efficiency;Ref #tau p_{T};entries", ptbins_, 0, ptmax_);
60  hL2TrigTauEtEffDenom_ = iBooker.book1D(
61  "L2TrigTauEtEffDenom", "L2 #tau p_{T} denominator;Ref #tau p_{T};Efficiency", ptbins_, 0, ptmax_);
63  iBooker.book1D("L2TrigTauEtaEffNum", "L2 #tau #eta efficiency;Ref #tau #eta;entries", etabins_, -2.5, 2.5);
65  "L2TrigTauEtaEffDenom", "L2 #tau #eta denominator;Ref #tau #eta;Efficiency", etabins_, -2.5, 2.5);
67  iBooker.book1D("L2TrigTauPhiEffNum", "L2 #tau #phi efficiency;Ref #tau #phi;entries", phibins_, -3.2, 3.2);
69  "L2TrigTauPhiEffDenom", "L2 #tau #phi denominator;Ref #tau #phi;Efficiency", phibins_, -3.2, 3.2);
70  hL2TrigTauHighEtEffNum_ = iBooker.book1D("L2TrigTauHighEtEffNum",
71  "L2 #tau p_{T} efficiency (high p_{T});Ref #tau p_{T};entries",
72  ptbins_,
73  0,
74  highptmax_);
75  hL2TrigTauHighEtEffDenom_ = iBooker.book1D("L2TrigTauHighEtEffDenom",
76  "L2 #tau p_{T} denominator (high p_{T});Ref #tau p_{T};Efficiency",
77  ptbins_,
78  0,
79  highptmax_);
80  }
81 
82  if (hltPath_.hasL3Taus()) {
84  iBooker.book1D("L3TrigTauEtEffNum", "L3 #tau p_{T} efficiency;Ref #tau p_{T};entries", ptbins_, 0, ptmax_);
85  hL3TrigTauEtEffDenom_ = iBooker.book1D(
86  "L3TrigTauEtEffDenom", "L3 #tau p_{T} denominator;Ref #tau p_{T};Efficiency", ptbins_, 0, ptmax_);
88  iBooker.book1D("L3TrigTauEtaEffNum", "L3 #tau #eta efficiency;Ref #tau #eta;entries", etabins_, -2.5, 2.5);
90  "L3TrigTauEtaEffDenom", "L3 #tau #eta denominator;Ref #tau #eta;Efficiency", etabins_, -2.5, 2.5);
92  iBooker.book1D("L3TrigTauPhiEffNum", "L3 #tau #phi efficiency;Ref #tau #phi;entries", phibins_, -3.2, 3.2);
94  "L3TrigTauPhiEffDenom", "L3 #tau #phi denominator;Ref #tau #phi;Efficiency", phibins_, -3.2, 3.2);
95  hL3TrigTauHighEtEffNum_ = iBooker.book1D("L3TrigTauHighEtEffNum",
96  "L3 #tau p_{T} efficiency (high p_{T});Ref #tau p_{T};entries",
97  ptbins_,
98  0,
99  highptmax_);
100  hL3TrigTauHighEtEffDenom_ = iBooker.book1D("L3TrigTauHighEtEffDenom",
101  "L3 #tau p_{T} denominator (high p_{T});Ref #tau p_{T};Efficiency",
102  ptbins_,
103  0,
104  highptmax_);
106  "L3TrigTauEtaPhiEffNum", "L3 efficiency in eta-phi plane", etabins_, -2.5, 2.5, phibins_, -3.2, 3.2);
108  "L3TrigTauEtaPhiEffDenom", "L3 denominator in eta-phi plane", etabins_, -2.5, 2.5, phibins_, -3.2, 3.2);
110  }
111 
112  if (hltPath_.hasL2Electrons()) {
114  "L2TrigElectronEtEffNum", "L2 electron p_{T} efficiency;Ref electron p_{T};entries", ptbins_, 0, ptmax_);
116  "L2TrigElectronEtEffDenom", "L2 electron p_{T} denominator;Ref electron p_{T};Efficiency", ptbins_, 0, ptmax_);
118  "L2TrigElectronEtaEffNum", "L2 electron #eta efficiency;Ref electron #eta;entries", etabins_, -2.5, 2.5);
120  "L2TrigElectronEtaEffDenom", "L2 electron #eta denominator;Ref electron #eta;Efficiency", etabins_, -2.5, 2.5);
122  "L2TrigElectronPhiEffNum", "L2 electron #phi efficiency;Ref electron #phi;entries", phibins_, -3.2, 3.2);
124  "L2TrigElectronPhiEffDenom", "L2 electron #phi denominator;Ref electron #phi;Efficiency", phibins_, -3.2, 3.2);
125  }
126 
127  if (hltPath_.hasL3Electrons()) {
129  "L3TrigElectronEtEffNum", "L3 electron p_{T} efficiency;Ref electron p_{T};entries", ptbins_, 0, ptmax_);
131  "L3TrigElectronEtEffDenom", "L3 electron p_{T} denominator;Ref electron p_{T};Efficiency", ptbins_, 0, ptmax_);
133  "L3TrigElectronEtaEffNum", "L3 electron #eta efficiency;Ref electron #eta;entries", etabins_, -2.5, 2.5);
135  "L3TrigElectronEtaEffDenom", "L3 electron #eta denominator;Ref electron #eta;Efficiency", etabins_, -2.5, 2.5);
137  "L3TrigElectronPhiEffNum", "L3 electron #phi efficiency;Ref electron #phi;entries", phibins_, -3.2, 3.2);
139  "L3TrigElectronPhiEffDenom", "L3 electron #phi denominator;Ref electron #phi;Efficiency", phibins_, -3.2, 3.2);
140  }
141 
142  if (hltPath_.hasL2Muons()) {
144  iBooker.book1D("L2TrigMuonEtEffNum", "L2 muon p_{T} efficiency;Ref muon p_{T};entries", ptbins_, 0, ptmax_);
145  hL2TrigMuonEtEffDenom_ = iBooker.book1D(
146  "L2TrigMuonEtEffDenom", "L2 muon p_{T} denominator;Ref muon p_{T};Efficiency", ptbins_, 0, ptmax_);
148  iBooker.book1D("L2TrigMuonEtaEffNum", "L2 muon #eta efficiency;Ref muon #eta;entries", etabins_, -2.5, 2.5);
150  "L2TrigMuonEtaEffDenom", "L2 muon #eta denominator;Ref muon #eta;Efficiency", etabins_, -2.5, 2.5);
152  iBooker.book1D("L2TrigMuonPhiEffNum", "L2 muon #phi efficiency;Ref muon #phi;entries", phibins_, -3.2, 3.2);
154  "L2TrigMuonPhiEffDenom", "L2 muon #phi denominator;Ref muon #phi;Efficiency", phibins_, -3.2, 3.2);
155  }
156 
157  if (hltPath_.hasL3Muons()) {
159  iBooker.book1D("L3TrigMuonEtEffNum", "L3 muon p_{T} efficiency;Ref muon p_{T};entries", ptbins_, 0, ptmax_);
160  hL3TrigMuonEtEffDenom_ = iBooker.book1D(
161  "L3TrigMuonEtEffDenom", "L3 muon p_{T} denominator;Ref muon p_{T};Efficiency", ptbins_, 0, ptmax_);
163  iBooker.book1D("L3TrigMuonEtaEffNum", "L3 muon #eta efficiency;Ref muon #eta;entries", etabins_, -2.5, 2.5);
165  "L3TrigMuonEtaEffDenom", "L3 muon #eta denominator;Ref muon #eta;Efficiency", etabins_, -2.5, 2.5);
167  iBooker.book1D("L3TrigMuonPhiEffNum", "L3 muon #phi efficiency;Ref muon #phi;entries", phibins_, -3.2, 3.2);
169  "L3TrigMuonPhiEffDenom", "L3 muon #phi denominator;Ref muon #phi;Efficiency", phibins_, -3.2, 3.2);
170  }
171 
172  if (hltPath_.hasL2CaloMET()) {
174  iBooker.book1D("L2TrigMETEtEffNum", "L2 MET efficiency;Ref MET;entries", ptbins_, 0, ptmax_);
176  iBooker.book1D("L2TrigMETEtEffDenom", "L2 MET denominator;Ref MET;Efficiency", ptbins_, 0, ptmax_);
177  }
178 
179  iBooker.setCurrentFolder(triggerTag());
180  }
181 
182  // Book di-object invariant mass histogram only for mu+tau, ele+tau, and di-tau paths
183  hMass_ = nullptr;
184  if (doRefAnalysis_) {
188 
189  int nmet = 0;
190  int lastMatchedMETFilter = -1;
191  for (size_t i = 0; i < hltPath_.filtersSize(); ++i) {
192  if (hltPath_.getFilterName(i).find("hltMET") < hltPath_.getFilterName(i).length())
193  lastMatchedMETFilter = i;
194  }
195  if (lastMatchedMETFilter >= 0)
196  nmet = hltPath_.getFilterMET(lastMatchedMETFilter);
197  auto create = [&](const std::string& name) {
198  if (name == "tau-met") {
199  this->hMass_ = iBooker.book1D(
200  "ReferenceMass", "Transverse mass of reference " + name + ";Reference transverse mass;entries", 100, 0, 500);
201  } else {
202  this->hMass_ = iBooker.book1D(
203  "ReferenceMass", "Invariant mass of reference " + name + ";Reference invariant mass;entries", 100, 0, 500);
204  }
205  };
206  LogDebug("HLTTauDQMOffline") << "Path " << hltPath_.getPathName() << " number of taus " << ntaus << " electrons "
207  << neles << " muons " << nmus;
208  if (ntaus > 0) {
209  hTrigTauEt_ = iBooker.book1D("TrigTauEt", "Triggered #tau p_{T};#tau p_{T};entries", ptbins_, 0, ptmax_);
210  hTrigTauEta_ = iBooker.book1D("TrigTauEta", "Triggered #tau #eta;#tau #eta;entries", etabins_, -2.5, 2.5);
211  hTrigTauPhi_ = iBooker.book1D("TrigTauPhi", "Triggered #tau #phi;#tau #phi;entries", phibins_, -3.2, 3.2);
212  }
213  if (neles > 0) {
215  iBooker.book1D("TrigElectronEt", "Triggered electron p_{T};electron p_{T};entries", ptbins_, 0, ptmax_);
217  iBooker.book1D("TrigElectronEta", "Triggered electron #eta;electron #eta;entries", etabins_, -2.5, 2.5);
219  iBooker.book1D("TrigElectronPhi", "Triggered electron #phi;electron #phi;entries", phibins_, -3.2, 3.2);
220  }
221  if (nmus > 0) {
222  hTrigMuonEt_ = iBooker.book1D("TrigMuonEt", "Triggered muon p_{T};muon p_{T};entries", ptbins_, 0, ptmax_);
223  hTrigMuonEta_ = iBooker.book1D("TrigMuonEta", "Triggered muon #eta;muon #eta;entries", etabins_, -2.5, 2.5);
224  hTrigMuonPhi_ = iBooker.book1D("TrigMuonPhi", "Triggered muon #phi;muon #phi;entries", phibins_, -3.2, 3.2);
225  }
226  if (nmet > 0) {
227  hTrigMETEt_ = iBooker.book1D("TrigMETEt", "Triggered MET E_{T};MET E_{T};entries", ptbins_, 0, ptmax_);
228  hTrigMETPhi_ = iBooker.book1D("TrigMETPhi", "Triggered MET #phi;MET #phi;entries", phibins_, -3.2, 3.2);
229  }
230  if (ntaus == 2 && neles == 0 && nmus == 0 && nmet == 0)
231  create("di-tau");
232  if (ntaus == 1 && neles == 1 && nmus == 0 && nmet == 0)
233  create("electron-tau");
234  if (ntaus == 1 && neles == 0 && nmus == 1 && nmet == 0)
235  create("muon-tau");
236  if (ntaus == 1 && neles == 0 && nmus == 0 && nmet == 1)
237  create("tau-met");
238  }
239 }
240 
242 
245  const HLTTauDQMOfflineObjects& refCollection) {
246  std::vector<HLTTauDQMPath::Object> triggerObjs;
247  std::vector<HLTTauDQMPath::Object> matchedTriggerObjs;
248  HLTTauDQMOfflineObjects matchedOfflineObjs;
249 
250  // Events per filter
251  const int lastPassedFilter = hltPath_.lastPassedFilter(triggerResults);
252  int lastMatchedFilter = -1;
253  int lastMatchedMETFilter = -1;
254  int lastMatchedElectronFilter = -1;
255  int lastMatchedMuonFilter = -1;
256  int lastMatchedTauFilter = -1;
257  int firstMatchedMETFilter = -1;
258 
259  if (doRefAnalysis_) {
260  double matchDr = hltPath_.isFirstFilterL1Seed() ? l1MatchDr_ : hltMatchDr_;
261  for (int i = 0; i <= lastPassedFilter; ++i) {
262  triggerObjs.clear();
263  matchedTriggerObjs.clear();
264  matchedOfflineObjs.clear();
265  hltPath_.getFilterObjects(triggerEvent, i, triggerObjs);
266  //std::cout << "Filter name " << hltPath_.getFilterName(i) << " nobjs " << triggerObjs.size() << " " << "ref size " << refCollection.taus.size() << std::endl;
267  bool matched =
268  hltPath_.offlineMatching(i, triggerObjs, refCollection, matchDr, matchedTriggerObjs, matchedOfflineObjs);
269  //std::cout << " offline matching: " << matched << " " << matchedTriggerObjs.size() << std::endl;
270  matchDr = hltMatchDr_;
271  if (!matched)
272  break;
273 
274  hAcceptedEvents_->Fill(i + 0.5);
275  lastMatchedFilter = i;
276  if (hltPath_.getFilterName(i).find("hltMET") < hltPath_.getFilterName(i).length())
277  lastMatchedMETFilter = i;
278  if (hltPath_.getFilterType(i) == "HLTMuonL3PreFilter" || hltPath_.getFilterType(i) == "HLTMuonIsoFilter")
279  lastMatchedMuonFilter = i;
280  if (hltPath_.getFilterName(i).find("hltEle") < hltPath_.getFilterName(i).length())
281  lastMatchedElectronFilter = i;
282  if (hltPath_.getFilterName(i).find("hltPFTau") < hltPath_.getFilterName(i).length() ||
283  hltPath_.getFilterName(i).find("hltHpsPFTau") < hltPath_.getFilterName(i).length() ||
284  hltPath_.getFilterName(i).find("hltDoublePFTau") < hltPath_.getFilterName(i).length() ||
285  hltPath_.getFilterName(i).find("hltHpsDoublePFTau") < hltPath_.getFilterName(i).length())
286  lastMatchedTauFilter = i;
287  if (firstMatchedMETFilter < 0 && hltPath_.getFilterName(i).find("hltMET") < hltPath_.getFilterName(i).length())
288  firstMatchedMETFilter = i;
289  }
290  } else {
291  for (int i = 0; i <= lastPassedFilter; ++i) {
292  hAcceptedEvents_->Fill(i + 0.5);
293  }
294  }
295 
296  // Efficiency plots
297  if (doRefAnalysis_ && lastMatchedFilter >= 0) {
298  // L2 taus
299  if (hltPath_.hasL2Taus()) {
300  // Denominators
301  if (static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastFilterBeforeL2TauIndex()) {
302  for (const LV& tau : refCollection.taus) {
303  hL2TrigTauEtEffDenom_->Fill(tau.pt());
304  hL2TrigTauHighEtEffDenom_->Fill(tau.pt());
305  hL2TrigTauEtaEffDenom_->Fill(tau.eta());
306  hL2TrigTauPhiEffDenom_->Fill(tau.phi());
307  }
308  }
309 
310  // Numerators
311  if (static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastL2TauFilterIndex()) {
312  triggerObjs.clear();
313  matchedTriggerObjs.clear();
314  matchedOfflineObjs.clear();
315  hltPath_.getFilterObjects(triggerEvent, hltPath_.getLastL2TauFilterIndex(), triggerObjs);
317  triggerObjs,
318  refCollection,
319  hltMatchDr_,
320  matchedTriggerObjs,
321  matchedOfflineObjs);
322  if (matched) {
323  for (const LV& tau : matchedOfflineObjs.taus) {
324  hL2TrigTauEtEffNum_->Fill(tau.pt());
325  hL2TrigTauHighEtEffNum_->Fill(tau.pt());
326  hL2TrigTauEtaEffNum_->Fill(tau.eta());
327  hL2TrigTauPhiEffNum_->Fill(tau.phi());
328  }
329  }
330  }
331  }
332 
333  // L3 taus
334  if (hltPath_.hasL3Taus()) {
335  // Denominators
336  if (static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastFilterBeforeL3TauIndex()) {
337  for (const LV& tau : refCollection.taus) {
338  hL3TrigTauEtEffDenom_->Fill(tau.pt());
339  hL3TrigTauHighEtEffDenom_->Fill(tau.pt());
340  hL3TrigTauEtaEffDenom_->Fill(tau.eta());
341  hL3TrigTauPhiEffDenom_->Fill(tau.phi());
342  hL3TrigTauEtaPhiEffDenom_->Fill(tau.eta(), tau.phi());
343  }
344  }
345 
346  // Numerators
347  if (static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastL3TauFilterIndex()) {
348  triggerObjs.clear();
349  matchedTriggerObjs.clear();
350  matchedOfflineObjs.clear();
351  hltPath_.getFilterObjects(triggerEvent, hltPath_.getLastL3TauFilterIndex(), triggerObjs);
353  triggerObjs,
354  refCollection,
355  hltMatchDr_,
356  matchedTriggerObjs,
357  matchedOfflineObjs);
358  if (matched) {
359  for (const LV& tau : matchedOfflineObjs.taus) {
360  hL3TrigTauEtEffNum_->Fill(tau.pt());
361  hL3TrigTauHighEtEffNum_->Fill(tau.pt());
362  hL3TrigTauEtaEffNum_->Fill(tau.eta());
363  hL3TrigTauPhiEffNum_->Fill(tau.phi());
364  hL3TrigTauEtaPhiEffNum_->Fill(tau.eta(), tau.phi());
365  }
366  }
367  }
368  }
369 
370  // L2 Electrons
371  if (hltPath_.hasL2Electrons()) {
372  // Denominators
373  if (static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastFilterBeforeL2ElectronIndex()) {
374  for (const LV& electron : refCollection.electrons) {
375  hL2TrigElectronEtEffDenom_->Fill(electron.pt());
376  hL2TrigElectronEtaEffDenom_->Fill(electron.eta());
377  hL2TrigElectronPhiEffDenom_->Fill(electron.phi());
378  }
379  }
380 
381  // Numerators
382  if (static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastL2ElectronFilterIndex()) {
383  triggerObjs.clear();
384  matchedTriggerObjs.clear();
385  matchedOfflineObjs.clear();
386  hltPath_.getFilterObjects(triggerEvent, hltPath_.getLastL2ElectronFilterIndex(), triggerObjs);
388  triggerObjs,
389  refCollection,
390  hltMatchDr_,
391  matchedTriggerObjs,
392  matchedOfflineObjs);
393  if (matched) {
394  for (const LV& electron : matchedOfflineObjs.electrons) {
395  hL2TrigElectronEtEffNum_->Fill(electron.pt());
396  hL2TrigElectronEtaEffNum_->Fill(electron.eta());
397  hL2TrigElectronPhiEffNum_->Fill(electron.phi());
398  }
399  }
400  }
401  }
402 
403  // L3 electron
404  if (hltPath_.hasL3Electrons()) {
405  // Denominators
406  if (static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastFilterBeforeL3ElectronIndex()) {
407  for (const LV& electron : refCollection.electrons) {
408  hL3TrigElectronEtEffDenom_->Fill(electron.pt());
409  hL3TrigElectronEtaEffDenom_->Fill(electron.eta());
410  hL3TrigElectronPhiEffDenom_->Fill(electron.phi());
411  }
412  }
413 
414  // Numerators
415  if (static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastL3ElectronFilterIndex()) {
416  triggerObjs.clear();
417  matchedTriggerObjs.clear();
418  matchedOfflineObjs.clear();
419  hltPath_.getFilterObjects(triggerEvent, hltPath_.getLastL3ElectronFilterIndex(), triggerObjs);
421  triggerObjs,
422  refCollection,
423  hltMatchDr_,
424  matchedTriggerObjs,
425  matchedOfflineObjs);
426  if (matched) {
427  for (const LV& electron : matchedOfflineObjs.electrons) {
428  hL3TrigElectronEtEffNum_->Fill(electron.pt());
429  hL3TrigElectronEtaEffNum_->Fill(electron.eta());
430  hL3TrigElectronPhiEffNum_->Fill(electron.phi());
431  }
432  }
433  }
434  }
435 
436  // L2 Muons
437  if (hltPath_.hasL2Muons()) {
438  // Denominators
439  if (static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastFilterBeforeL2MuonIndex()) {
440  for (const LV& muon : refCollection.muons) {
441  hL2TrigMuonEtEffDenom_->Fill(muon.pt());
442  hL2TrigMuonEtaEffDenom_->Fill(muon.eta());
443  hL2TrigMuonPhiEffDenom_->Fill(muon.phi());
444  }
445  }
446 
447  // Numerators
448  if (static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastL2MuonFilterIndex()) {
449  triggerObjs.clear();
450  matchedTriggerObjs.clear();
451  matchedOfflineObjs.clear();
452  hltPath_.getFilterObjects(triggerEvent, hltPath_.getLastL2MuonFilterIndex(), triggerObjs);
454  triggerObjs,
455  refCollection,
456  hltMatchDr_,
457  matchedTriggerObjs,
458  matchedOfflineObjs);
459  if (matched) {
460  for (const LV& muon : matchedOfflineObjs.muons) {
461  hL2TrigMuonEtEffNum_->Fill(muon.pt());
462  hL2TrigMuonEtaEffNum_->Fill(muon.eta());
463  hL2TrigMuonPhiEffNum_->Fill(muon.phi());
464  }
465  }
466  }
467  }
468 
469  // L3 muon
470  if (hltPath_.hasL3Muons()) {
471  // Denominators
472  if (static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastFilterBeforeL3MuonIndex()) {
473  for (const LV& muon : refCollection.muons) {
474  hL3TrigMuonEtEffDenom_->Fill(muon.pt());
475  hL3TrigMuonEtaEffDenom_->Fill(muon.eta());
476  hL3TrigMuonPhiEffDenom_->Fill(muon.phi());
477  }
478  }
479 
480  // Numerators
481  if (static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastL3MuonFilterIndex()) {
482  triggerObjs.clear();
483  matchedTriggerObjs.clear();
484  matchedOfflineObjs.clear();
485  hltPath_.getFilterObjects(triggerEvent, hltPath_.getLastL3MuonFilterIndex(), triggerObjs);
487  triggerObjs,
488  refCollection,
489  hltMatchDr_,
490  matchedTriggerObjs,
491  matchedOfflineObjs);
492  if (matched) {
493  for (const LV& muon : matchedOfflineObjs.muons) {
494  hL3TrigMuonEtEffNum_->Fill(muon.pt());
495  hL3TrigMuonEtaEffNum_->Fill(muon.eta());
496  hL3TrigMuonPhiEffNum_->Fill(muon.phi());
497  }
498  }
499  }
500  }
501 
502  // L2 CaloMET
503  if (hltPath_.hasL2CaloMET()) {
504  // Denominators
505  if (static_cast<size_t>(firstMatchedMETFilter) >= hltPath_.getFirstFilterBeforeL2CaloMETIndex()) {
506  hL2TrigMETEtEffDenom_->Fill(refCollection.met[0].pt());
507  }
508 
509  // Numerators
510  if (static_cast<size_t>(lastMatchedMETFilter) >= hltPath_.getLastL2CaloMETFilterIndex()) {
511  triggerObjs.clear();
512  matchedTriggerObjs.clear();
513  matchedOfflineObjs.clear();
514  hltPath_.getFilterObjects(triggerEvent, hltPath_.getLastL2CaloMETFilterIndex(), triggerObjs);
516  triggerObjs,
517  refCollection,
518  hltMatchDr_,
519  matchedTriggerObjs,
520  matchedOfflineObjs);
521  if (matched) {
522  hL2TrigMETEtEffNum_->Fill(matchedOfflineObjs.met[0].pt());
523  }
524  }
525  }
526  }
527 
528  if (hltPath_.fired(triggerResults)) {
529  triggerObjs.clear();
530  matchedTriggerObjs.clear();
531  matchedOfflineObjs.clear();
532 
533  if (lastMatchedMETFilter >= 0)
534  hltPath_.getFilterObjects(triggerEvent, lastMatchedMETFilter, triggerObjs);
535  if (lastMatchedMuonFilter >= 0)
536  hltPath_.getFilterObjects(triggerEvent, lastMatchedMuonFilter, triggerObjs);
537  if (lastMatchedElectronFilter >= 0)
538  hltPath_.getFilterObjects(triggerEvent, lastMatchedElectronFilter, triggerObjs);
539 
540  if (lastMatchedTauFilter >= 0)
541  hltPath_.getFilterObjects(triggerEvent, lastMatchedTauFilter, triggerObjs);
542 
543  if (doRefAnalysis_) {
545  lastPassedFilter, triggerObjs, refCollection, hltMatchDr_, matchedTriggerObjs, matchedOfflineObjs);
546  if (matched) {
547  // Di-object invariant mass
548  if (hMass_) {
549  const int ntaus = hltPath_.getFilterNTaus(lastPassedFilter);
550  if (ntaus == 2 && hltPath_.getFilterNElectrons(lastMatchedElectronFilter) == 0 &&
551  hltPath_.getFilterNMuons(lastMatchedMuonFilter) == 0) {
552  // Di-tau (matchedOfflineObjs are already sorted)
553  hMass_->Fill((matchedOfflineObjs.taus[0] + matchedOfflineObjs.taus[1]).M());
554  }
555  // Electron+tau
556  else if (ntaus == 1 && hltPath_.getFilterNElectrons(lastPassedFilter) == 1) {
557  hMass_->Fill((matchedOfflineObjs.taus[0] + matchedOfflineObjs.electrons[0]).M());
558  }
559  // Muon+tau
560  else if (ntaus == 1 && hltPath_.getFilterNMuons(lastPassedFilter) == 1) {
561  hMass_->Fill((matchedOfflineObjs.taus[0] + matchedOfflineObjs.muons[0]).M());
562  }
563  // Tau+MET
564  if (hltPath_.getFilterNTaus(lastPassedFilter) == 1 && hltPath_.getFilterMET(lastMatchedMETFilter) == 1) {
565  double taupt = matchedOfflineObjs.taus[0].Pt();
566  double tauphi = matchedOfflineObjs.taus[0].Phi();
567  double met = matchedOfflineObjs.met[0].Pt();
568  double metphi = matchedOfflineObjs.met[0].Phi();
569  double mT = sqrt(2 * taupt * met * (1 - cos(tauphi - metphi)));
570 
571  hMass_->Fill(mT);
572  }
573  }
574  }
575 
576  // Triggered object kinematics
577  for (const HLTTauDQMPath::Object& obj : triggerObjs) {
578  if (obj.id == trigger::TriggerTau) {
579  hTrigTauEt_->Fill(obj.object.pt());
580  hTrigTauEta_->Fill(obj.object.eta());
581  hTrigTauPhi_->Fill(obj.object.phi());
582  }
584  hTrigElectronEt_->Fill(obj.object.pt());
585  hTrigElectronEta_->Fill(obj.object.eta());
586  hTrigElectronPhi_->Fill(obj.object.phi());
587  }
588  if (obj.id == trigger::TriggerMuon) {
589  hTrigMuonEt_->Fill(obj.object.pt());
590  hTrigMuonEta_->Fill(obj.object.eta());
591  hTrigMuonPhi_->Fill(obj.object.phi());
592  }
593  if (obj.id == trigger::TriggerMET) {
594  hTrigMETEt_->Fill(obj.object.pt());
595  hTrigMETPhi_->Fill(obj.object.phi());
596  }
597  }
598  }
599  }
600 }
#define LogDebug(id)
bool isValid() const
size_t getLastL2TauFilterIndex() const
Definition: HLTTauDQMPath.h:97
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX)
Definition: DQMStore.cc:239
MonitorElement * hL3TrigTauEtEffDenom_
MonitorElement * hTrigElectronEta_
bool hasL3Electrons() const
Definition: HLTTauDQMPath.h:92
MonitorElement * hL3TrigTauPhiEffDenom_
MonitorElement * hL2TrigTauPhiEffDenom_
MonitorElement * hL3TrigMuonPhiEffNum_
MonitorElement * hL3TrigMuonEtaEffDenom_
MonitorElement * hL2TrigTauEtEffDenom_
MonitorElement * hTrigTauEt_
std::vector< LV > electrons
The single EDProduct to be saved for each event (AOD case)
Definition: TriggerEvent.h:25
def create(alignables, pedeDump, additionalData, outputFile, config)
size_t getLastL3ElectronFilterIndex() const
std::vector< LV > taus
HLTTauDQMPathPlotter(const std::string &pathName, const HLTConfigProvider &HLTCP, bool doRefAnalysis, const std::string &dqmBaseFolder, const std::string &hltProcess, int ptbins, int etabins, int phibins, double ptmax, double highptmax, double l1MatchDr, double hltMatchDr)
virtual void setOption(const char *option)
math::XYZTLorentzVectorD LV
size_t getLastL3MuonFilterIndex() const
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:418
MonitorElement * hTrigElectronPhi_
bool isValid() const
Definition: HLTTauDQMPath.h:41
bool hasL2Muons() const
Definition: HLTTauDQMPath.h:93
MonitorElement * hL3TrigTauEtEffNum_
int lastPassedFilter(const edm::TriggerResults &triggerResults) const
MonitorElement * hL2TrigMuonEtaEffNum_
const std::string & triggerTag() const
MonitorElement * hL3TrigMuonEtaEffNum_
MonitorElement * hL2TrigTauEtEffNum_
MonitorElement * hAcceptedEvents_
MonitorElement * hL2TrigElectronEtEffNum_
MonitorElement * hL2TrigMuonPhiEffNum_
int getFilterNElectrons(size_t i) const
Definition: HLTTauDQMPath.h:61
int getFilterNTaus(size_t i) const
Definition: HLTTauDQMPath.h:55
bool isFirstFilterL1Seed() const
Definition: HLTTauDQMPath.h:86
MonitorElement * hL2TrigTauPhiEffNum_
MonitorElement * hL3TrigTauEtaPhiEffDenom_
void Fill(long long x)
size_t getLastFilterBeforeL3TauIndex() const
Definition: HLTTauDQMPath.h:98
MonitorElement * hL3TrigMuonEtEffNum_
MonitorElement * hL2TrigMuonEtEffDenom_
void getFilterObjects(const trigger::TriggerEvent &triggerEvent, size_t i, std::vector< Object > &retval) const
const std::string & getFilterType(size_t i) const
Definition: HLTTauDQMPath.h:54
bool hasL2CaloMET() const
Definition: HLTTauDQMPath.h:95
MonitorElement * hL3TrigTauHighEtEffNum_
MonitorElement * hL3TrigElectronEtaEffNum_
MonitorElement * hL2TrigElectronPhiEffDenom_
MonitorElement * hL3TrigTauEtaEffDenom_
int getFilterNMuons(size_t i) const
Definition: HLTTauDQMPath.h:67
MonitorElement * hL3TrigTauEtaPhiEffNum_
MonitorElement * hL2TrigMuonEtaEffDenom_
MonitorElement * hL2TrigMETEtEffDenom_
T sqrt(T t)
Definition: SSEVec.h:19
size_t getLastFilterBeforeL3ElectronIndex() const
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
size_t filtersSize() const
Definition: HLTTauDQMPath.h:52
size_t getLastFilterBeforeL2MuonIndex() const
MonitorElement * hL3TrigElectronEtEffDenom_
MonitorElement * hL3TrigTauPhiEffNum_
MonitorElement * hTrigMETEt_
MonitorElement * hL3TrigTauEtaEffNum_
size_t getLastL2CaloMETFilterIndex() const
void analyze(const edm::TriggerResults &triggerResults, const trigger::TriggerEvent &triggerEvent, const HLTTauDQMOfflineObjects &refCollection)
MonitorElement * hTrigMETPhi_
size_t getLastL2MuonFilterIndex() const
bool hasL3Taus() const
Definition: HLTTauDQMPath.h:90
static std::string const triggerResults
Definition: EdmProvDump.cc:45
MonitorElement * hTrigMuonEt_
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
MonitorElement * hL2TrigMETEtEffNum_
size_t getLastFilterBeforeL3MuonIndex() const
size_t getLastL3TauFilterIndex() const
Definition: HLTTauDQMPath.h:99
std::vector< LV > met
MonitorElement * hL2TrigTauHighEtEffNum_
bool offlineMatching(size_t i, const std::vector< Object > &triggerObjects, const HLTTauDQMOfflineObjects &offlineObjects, double dR, std::vector< Object > &matchedTriggerObjects, HLTTauDQMOfflineObjects &matchedOfflineObjects) const
MonitorElement * hL3TrigElectronEtEffNum_
MonitorElement * hL3TrigElectronEtaEffDenom_
void bookHistograms(DQMStore::IBooker &iBooker)
MonitorElement * hL2TrigElectronPhiEffNum_
MonitorElement * hTrigTauPhi_
MonitorElement * hL2TrigElectronEtaEffDenom_
bool hasL3Muons() const
Definition: HLTTauDQMPath.h:94
MonitorElement * hTrigElectronEt_
MonitorElement * hL3TrigMuonPhiEffDenom_
const std::string & getFilterName(size_t i) const
Definition: HLTTauDQMPath.h:53
bool fired(const edm::TriggerResults &triggerResults) const
size_t getLastL2ElectronFilterIndex() const
MonitorElement * hTrigMuonEta_
size_t getLastFilterBeforeL2TauIndex() const
Definition: HLTTauDQMPath.h:96
int getFilterMET(size_t i) const
Definition: HLTTauDQMPath.h:73
size_t getLastFilterBeforeL2ElectronIndex() const
const std::string & getPathName() const
Definition: HLTTauDQMPath.h:49
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Definition: DQMStore.cc:266
MonitorElement * hL2TrigTauEtaEffNum_
MonitorElement * hL2TrigTauHighEtEffDenom_
bool hasL2Taus() const
Definition: HLTTauDQMPath.h:89
size_t getFirstFilterBeforeL2CaloMETIndex() const
MonitorElement * hL3TrigElectronPhiEffDenom_
bool hasL2Electrons() const
Definition: HLTTauDQMPath.h:91
MonitorElement * hTrigTauEta_
MonitorElement * hL2TrigTauEtaEffDenom_
MonitorElement * hL3TrigMuonEtEffDenom_
MonitorElement * hL2TrigElectronEtEffDenom_
MonitorElement * hL2TrigElectronEtaEffNum_
MonitorElement * hTrigMuonPhi_
MonitorElement * hL3TrigElectronPhiEffNum_
MonitorElement * hL2TrigMuonPhiEffDenom_
std::vector< LV > muons
MonitorElement * hL3TrigTauHighEtEffDenom_
MonitorElement * hL2TrigMuonEtEffNum_