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>
41 //void HLTTauDQMPathPlotter::bookHistograms(DQMStore::IBooker& iBooker) {
43  if (!isValid())
44  return;
45 
46  // Book histograms
47  iBooker.setCurrentFolder(triggerTag());
48 
49  hCounter_ = iWrapper.book1D(iBooker, "EventCounter", "Accepted events;;entries", 3, 0, 3, kEverything);
50  hAcceptedEvents_ = iWrapper.book1D(iBooker,
51  "EventsPerFilter",
52  "Accepted Events per filter;;entries",
54  0,
56  kEverything);
57  if (hCounter_) {
58  hCounter_->setBinLabel(1, "all events");
59  hCounter_->setBinLabel(2, "ref tau found");
60  hCounter_->setBinLabel(3, "passed trg");
61  }
62  for (size_t i = 0; i < hltPath_.filtersSize(); ++i) {
63  if (hAcceptedEvents_)
65  }
66 
67  // Efficiency helpers
68  if (doRefAnalysis_) {
69  iBooker.setCurrentFolder(triggerTag() + "/helpers");
70  if (hltPath_.hasL2Taus()) {
71  hL2TrigTauEtEffNum_ = iWrapper.book1D(
72  iBooker, "L2TrigTauEtEffNum", "L2 #tau p_{T} efficiency;Ref #tau p_{T};entries", ptbins_, 0, ptmax_, kVital);
73  hL2TrigTauEtEffDenom_ = iWrapper.book1D(iBooker,
74  "L2TrigTauEtEffDenom",
75  "L2 #tau p_{T} denominator;Ref #tau p_{T};Efficiency",
76  ptbins_,
77  0,
78  ptmax_,
79  kVital);
80  hL2TrigTauEtaEffNum_ = iWrapper.book1D(iBooker,
81  "L2TrigTauEtaEffNum",
82  "L2 #tau #eta efficiency;Ref #tau #eta;entries",
83  etabins_,
84  -2.5,
85  2.5,
86  kEverything);
87  hL2TrigTauEtaEffDenom_ = iWrapper.book1D(iBooker,
88  "L2TrigTauEtaEffDenom",
89  "L2 #tau #eta denominator;Ref #tau #eta;Efficiency",
90  etabins_,
91  -2.5,
92  2.5,
93  kEverything);
94  hL2TrigTauPhiEffNum_ = iWrapper.book1D(iBooker,
95  "L2TrigTauPhiEffNum",
96  "L2 #tau #phi efficiency;Ref #tau #phi;entries",
97  phibins_,
98  -3.2,
99  3.2,
100  kEverything);
101  hL2TrigTauPhiEffDenom_ = iWrapper.book1D(
102  iBooker, "L2TrigTauPhiEffDenom", "L2 #tau #phi denominator;Ref #tau #phi;Efficiency", phibins_, -3.2, 3.2);
103  hL2TrigTauHighEtEffNum_ = iWrapper.book1D(iBooker,
104  "L2TrigTauHighEtEffNum",
105  "L2 #tau p_{T} efficiency (high p_{T});Ref #tau p_{T};entries",
106  ptbins_,
107  0,
108  highptmax_,
109  kVital);
110  hL2TrigTauHighEtEffDenom_ = iWrapper.book1D(iBooker,
111  "L2TrigTauHighEtEffDenom",
112  "L2 #tau p_{T} denominator (high p_{T});Ref #tau p_{T};Efficiency",
113  ptbins_,
114  0,
115  highptmax_,
116  kVital);
117  }
118 
119  if (hltPath_.hasL3Taus()) {
120  hL3TrigTauEtEffNum_ = iWrapper.book1D(
121  iBooker, "L3TrigTauEtEffNum", "L3 #tau p_{T} efficiency;Ref #tau p_{T};entries", ptbins_, 0, ptmax_, kVital);
122  hL3TrigTauEtEffDenom_ = iWrapper.book1D(iBooker,
123  "L3TrigTauEtEffDenom",
124  "L3 #tau p_{T} denominator;Ref #tau p_{T};Efficiency",
125  ptbins_,
126  0,
127  ptmax_,
128  kVital);
129  hL3TrigTauEtaEffNum_ = iWrapper.book1D(
130  iBooker, "L3TrigTauEtaEffNum", "L3 #tau #eta efficiency;Ref #tau #eta;entries", etabins_, -2.5, 2.5, kVital);
131  hL3TrigTauEtaEffDenom_ = iWrapper.book1D(iBooker,
132  "L3TrigTauEtaEffDenom",
133  "L3 #tau #eta denominator;Ref #tau #eta;Efficiency",
134  etabins_,
135  -2.5,
136  2.5,
137  kEverything);
138  hL3TrigTauPhiEffNum_ = iWrapper.book1D(iBooker,
139  "L3TrigTauPhiEffNum",
140  "L3 #tau #phi efficiency;Ref #tau #phi;entries",
141  phibins_,
142  -3.2,
143  3.2,
144  kEverything);
145  hL3TrigTauPhiEffDenom_ = iWrapper.book1D(iBooker,
146  "L3TrigTauPhiEffDenom",
147  "L3 #tau #phi denominator;Ref #tau #phi;Efficiency",
148  phibins_,
149  -3.2,
150  3.2,
151  kEverything);
152  hL3TrigTauHighEtEffNum_ = iWrapper.book1D(iBooker,
153  "L3TrigTauHighEtEffNum",
154  "L3 #tau p_{T} efficiency (high p_{T});Ref #tau p_{T};entries",
155  ptbins_,
156  0,
157  highptmax_,
158  kVital);
159  hL3TrigTauHighEtEffDenom_ = iWrapper.book1D(iBooker,
160  "L3TrigTauHighEtEffDenom",
161  "L3 #tau p_{T} denominator (high p_{T});Ref #tau p_{T};Efficiency",
162  ptbins_,
163  0,
164  highptmax_,
165  kVital);
166  hL3TrigTauEtaPhiEffNum_ = iWrapper.book2D(iBooker,
167  "L3TrigTauEtaPhiEffNum",
168  "L3 efficiency in eta-phi plane",
169  etabins_,
170  -2.5,
171  2.5,
172  phibins_,
173  -3.2,
174  3.2,
175  kEverything);
176  hL3TrigTauEtaPhiEffDenom_ = iWrapper.book2D(iBooker,
177  "L3TrigTauEtaPhiEffDenom",
178  "L3 denominator in eta-phi plane",
179  etabins_,
180  -2.5,
181  2.5,
182  phibins_,
183  -3.2,
184  3.2,
185  kEverything);
188  }
189 
190  if (hltPath_.hasL2Electrons()) {
191  hL2TrigElectronEtEffNum_ = iWrapper.book1D(iBooker,
192  "L2TrigElectronEtEffNum",
193  "L2 electron p_{T} efficiency;Ref electron p_{T};entries",
194  ptbins_,
195  0,
196  ptmax_,
197  kVital);
198  hL2TrigElectronEtEffDenom_ = iWrapper.book1D(iBooker,
199  "L2TrigElectronEtEffDenom",
200  "L2 electron p_{T} denominator;Ref electron p_{T};Efficiency",
201  ptbins_,
202  0,
203  ptmax_,
204  kVital);
205  hL2TrigElectronEtaEffNum_ = iWrapper.book1D(iBooker,
206  "L2TrigElectronEtaEffNum",
207  "L2 electron #eta efficiency;Ref electron #eta;entries",
208  etabins_,
209  -2.5,
210  2.5,
211  kEverything);
212  hL2TrigElectronEtaEffDenom_ = iWrapper.book1D(iBooker,
213  "L2TrigElectronEtaEffDenom",
214  "L2 electron #eta denominator;Ref electron #eta;Efficiency",
215  etabins_,
216  -2.5,
217  2.5,
218  kEverything);
219  hL2TrigElectronPhiEffNum_ = iWrapper.book1D(iBooker,
220  "L2TrigElectronPhiEffNum",
221  "L2 electron #phi efficiency;Ref electron #phi;entries",
222  phibins_,
223  -3.2,
224  3.2,
225  kEverything);
226  hL2TrigElectronPhiEffDenom_ = iWrapper.book1D(iBooker,
227  "L2TrigElectronPhiEffDenom",
228  "L2 electron #phi denominator;Ref electron #phi;Efficiency",
229  phibins_,
230  -3.2,
231  3.2,
232  kEverything);
233  }
234 
235  if (hltPath_.hasL3Electrons()) {
236  hL3TrigElectronEtEffNum_ = iWrapper.book1D(iBooker,
237  "L3TrigElectronEtEffNum",
238  "L3 electron p_{T} efficiency;Ref electron p_{T};entries",
239  ptbins_,
240  0,
241  ptmax_,
242  kVital);
243  hL3TrigElectronEtEffDenom_ = iWrapper.book1D(iBooker,
244  "L3TrigElectronEtEffDenom",
245  "L3 electron p_{T} denominator;Ref electron p_{T};Efficiency",
246  ptbins_,
247  0,
248  ptmax_,
249  kVital);
250  hL3TrigElectronEtaEffNum_ = iWrapper.book1D(iBooker,
251  "L3TrigElectronEtaEffNum",
252  "L3 electron #eta efficiency;Ref electron #eta;entries",
253  etabins_,
254  -2.5,
255  2.5,
256  kEverything);
257  hL3TrigElectronEtaEffDenom_ = iWrapper.book1D(iBooker,
258  "L3TrigElectronEtaEffDenom",
259  "L3 electron #eta denominator;Ref electron #eta;Efficiency",
260  etabins_,
261  -2.5,
262  2.5,
263  kEverything);
264  hL3TrigElectronPhiEffNum_ = iWrapper.book1D(iBooker,
265  "L3TrigElectronPhiEffNum",
266  "L3 electron #phi efficiency;Ref electron #phi;entries",
267  phibins_,
268  -3.2,
269  3.2,
270  kEverything);
271  hL3TrigElectronPhiEffDenom_ = iWrapper.book1D(iBooker,
272  "L3TrigElectronPhiEffDenom",
273  "L3 electron #phi denominator;Ref electron #phi;Efficiency",
274  phibins_,
275  -3.2,
276  3.2,
277  kEverything);
278  }
279 
280  if (hltPath_.hasL2Muons()) {
281  hL2TrigMuonEtEffNum_ = iWrapper.book1D(
282  iBooker, "L2TrigMuonEtEffNum", "L2 muon p_{T} efficiency;Ref muon p_{T};entries", ptbins_, 0, ptmax_, kVital);
283  hL2TrigMuonEtEffDenom_ = iWrapper.book1D(iBooker,
284  "L2TrigMuonEtEffDenom",
285  "L2 muon p_{T} denominator;Ref muon p_{T};Efficiency",
286  ptbins_,
287  0,
288  ptmax_,
289  kVital);
290  hL2TrigMuonEtaEffNum_ = iWrapper.book1D(
291  iBooker, "L2TrigMuonEtaEffNum", "L2 muon #eta efficiency;Ref muon #eta;entries", etabins_, -2.5, 2.5, kVital);
292  hL2TrigMuonEtaEffDenom_ = iWrapper.book1D(iBooker,
293  "L2TrigMuonEtaEffDenom",
294  "L2 muon #eta denominator;Ref muon #eta;Efficiency",
295  etabins_,
296  -2.5,
297  2.5,
298  kEverything);
299  hL2TrigMuonPhiEffNum_ = iWrapper.book1D(iBooker,
300  "L2TrigMuonPhiEffNum",
301  "L2 muon #phi efficiency;Ref muon #phi;entries",
302  phibins_,
303  -3.2,
304  3.2,
305  kEverything);
306  hL2TrigMuonPhiEffDenom_ = iWrapper.book1D(iBooker,
307  "L2TrigMuonPhiEffDenom",
308  "L2 muon #phi denominator;Ref muon #phi;Efficiency",
309  phibins_,
310  -3.2,
311  3.2,
312  kEverything);
313  }
314 
315  if (hltPath_.hasL3Muons()) {
316  hL3TrigMuonEtEffNum_ = iWrapper.book1D(
317  iBooker, "L3TrigMuonEtEffNum", "L3 muon p_{T} efficiency;Ref muon p_{T};entries", ptbins_, 0, ptmax_, kVital);
318  hL3TrigMuonEtEffDenom_ = iWrapper.book1D(iBooker,
319  "L3TrigMuonEtEffDenom",
320  "L3 muon p_{T} denominator;Ref muon p_{T};Efficiency",
321  ptbins_,
322  0,
323  ptmax_,
324  kVital);
325  hL3TrigMuonEtaEffNum_ = iWrapper.book1D(iBooker,
326  "L3TrigMuonEtaEffNum",
327  "L3 muon #eta efficiency;Ref muon #eta;entries",
328  etabins_,
329  -2.5,
330  2.5,
331  kEverything);
332  hL3TrigMuonEtaEffDenom_ = iWrapper.book1D(iBooker,
333  "L3TrigMuonEtaEffDenom",
334  "L3 muon #eta denominator;Ref muon #eta;Efficiency",
335  etabins_,
336  -2.5,
337  2.5,
338  kEverything);
339  hL3TrigMuonPhiEffNum_ = iWrapper.book1D(iBooker,
340  "L3TrigMuonPhiEffNum",
341  "L3 muon #phi efficiency;Ref muon #phi;entries",
342  phibins_,
343  -3.2,
344  3.2,
345  kEverything);
346  hL3TrigMuonPhiEffDenom_ = iWrapper.book1D(iBooker,
347  "L3TrigMuonPhiEffDenom",
348  "L3 muon #phi denominator;Ref muon #phi;Efficiency",
349  phibins_,
350  -3.2,
351  3.2,
352  kEverything);
353  }
354 
355  if (hltPath_.hasL2CaloMET()) {
356  hL2TrigMETEtEffNum_ = iWrapper.book1D(
357  iBooker, "L2TrigMETEtEffNum", "L2 MET efficiency;Ref MET;entries", ptbins_, 0, ptmax_, kVital);
358  hL2TrigMETEtEffDenom_ = iWrapper.book1D(
359  iBooker, "L2TrigMETEtEffDenom", "L2 MET denominator;Ref MET;Efficiency", ptbins_, 0, ptmax_, kVital);
360  }
361 
362  iBooker.setCurrentFolder(triggerTag());
363  }
364 
365  // Book di-object invariant mass histogram only for mu+tau, ele+tau, and di-tau paths
366  hMass_ = nullptr;
367  if (doRefAnalysis_) {
371 
372  int nmet = 0;
373  int lastMatchedMETFilter = -1;
374  for (size_t i = 0; i < hltPath_.filtersSize(); ++i) {
375  if (hltPath_.getFilterName(i).find("hltMET") < hltPath_.getFilterName(i).length())
376  lastMatchedMETFilter = i;
377  }
378  if (lastMatchedMETFilter >= 0)
379  nmet = hltPath_.getFilterMET(lastMatchedMETFilter);
380  auto create = [&](const std::string& name) {
381  if (name == "tau-met") {
382  this->hMass_ = iWrapper.book1D(iBooker,
383  "ReferenceMass",
384  "Transverse mass of reference " + name + ";Reference transverse mass;entries",
385  100,
386  0,
387  500);
388  } else {
389  this->hMass_ = iWrapper.book1D(iBooker,
390  "ReferenceMass",
391  "Invariant mass of reference " + name + ";Reference invariant mass;entries",
392  100,
393  0,
394  500);
395  }
396  };
397  LogDebug("HLTTauDQMOffline") << "Path " << hltPath_.getPathName() << " number of taus " << ntaus << " electrons "
398  << neles << " muons " << nmus;
399  if (ntaus > 0) {
400  hTrigTauEt_ =
401  iWrapper.book1D(iBooker, "TrigTauEt", "Triggered #tau p_{T};#tau p_{T};entries", ptbins_, 0, ptmax_);
402  hTrigTauEta_ =
403  iWrapper.book1D(iBooker, "TrigTauEta", "Triggered #tau #eta;#tau #eta;entries", etabins_, -2.5, 2.5);
404  hTrigTauPhi_ =
405  iWrapper.book1D(iBooker, "TrigTauPhi", "Triggered #tau #phi;#tau #phi;entries", phibins_, -3.2, 3.2);
406  }
407  if (neles > 0) {
408  hTrigElectronEt_ = iWrapper.book1D(
409  iBooker, "TrigElectronEt", "Triggered electron p_{T};electron p_{T};entries", ptbins_, 0, ptmax_);
410  hTrigElectronEta_ = iWrapper.book1D(
411  iBooker, "TrigElectronEta", "Triggered electron #eta;electron #eta;entries", etabins_, -2.5, 2.5);
412  hTrigElectronPhi_ = iWrapper.book1D(
413  iBooker, "TrigElectronPhi", "Triggered electron #phi;electron #phi;entries", phibins_, -3.2, 3.2);
414  }
415  if (nmus > 0) {
416  hTrigMuonEt_ =
417  iWrapper.book1D(iBooker, "TrigMuonEt", "Triggered muon p_{T};muon p_{T};entries", ptbins_, 0, ptmax_);
418  hTrigMuonEta_ =
419  iWrapper.book1D(iBooker, "TrigMuonEta", "Triggered muon #eta;muon #eta;entries", etabins_, -2.5, 2.5);
420  hTrigMuonPhi_ =
421  iWrapper.book1D(iBooker, "TrigMuonPhi", "Triggered muon #phi;muon #phi;entries", phibins_, -3.2, 3.2);
422  }
423  if (nmet > 0) {
424  hTrigMETEt_ = iWrapper.book1D(iBooker, "TrigMETEt", "Triggered MET E_{T};MET E_{T};entries", ptbins_, 0, ptmax_);
425  hTrigMETPhi_ = iWrapper.book1D(iBooker, "TrigMETPhi", "Triggered MET #phi;MET #phi;entries", phibins_, -3.2, 3.2);
426  }
427  if (ntaus == 2 && neles == 0 && nmus == 0 && nmet == 0)
428  create("di-tau");
429  if (ntaus == 1 && neles == 1 && nmus == 0 && nmet == 0)
430  create("electron-tau");
431  if (ntaus == 1 && neles == 0 && nmus == 1 && nmet == 0)
432  create("muon-tau");
433  if (ntaus == 1 && neles == 0 && nmus == 0 && nmet == 1)
434  create("tau-met");
435  }
436 }
437 
439 
442  const HLTTauDQMOfflineObjects& refCollection) {
443  std::vector<HLTTauDQMPath::Object> triggerObjs;
444  std::vector<HLTTauDQMPath::Object> matchedTriggerObjs;
445  HLTTauDQMOfflineObjects matchedOfflineObjs;
446 
447  // Events per filter
448  const int lastPassedFilter = hltPath_.lastPassedFilter(triggerResults);
449  int lastMatchedFilter = -1;
450  int lastMatchedMETFilter = -1;
451  int lastMatchedElectronFilter = -1;
452  int lastMatchedMuonFilter = -1;
453  int lastMatchedTauFilter = -1;
454  int firstMatchedMETFilter = -1;
455  if (hCounter_) {
456  hCounter_->Fill(0.5);
457  if (refCollection.taus.size() > 0) {
458  hCounter_->Fill(1.5);
460  hCounter_->Fill(2.5);
461  }
462  }
463 
464  if (doRefAnalysis_) {
465  double matchDr = hltPath_.isFirstFilterL1Seed() ? l1MatchDr_ : hltMatchDr_;
466  for (int i = 0; i <= lastPassedFilter; ++i) {
467  triggerObjs.clear();
468  matchedTriggerObjs.clear();
469  matchedOfflineObjs.clear();
470  hltPath_.getFilterObjects(triggerEvent, i, triggerObjs);
471  //std::cout << "Filter name " << hltPath_.getFilterName(i) << " nobjs " << triggerObjs.size() << " " << "ref size " << refCollection.taus.size() << std::endl;
472  bool matched =
473  hltPath_.offlineMatching(i, triggerObjs, refCollection, matchDr, matchedTriggerObjs, matchedOfflineObjs);
474  //std::cout << " offline matching: " << matched << " " << matchedTriggerObjs.size() << std::endl;
475  matchDr = hltMatchDr_;
476  if (!matched)
477  break;
478 
479  if (hAcceptedEvents_)
480  hAcceptedEvents_->Fill(i + 0.5);
481  lastMatchedFilter = i;
482  if (hltPath_.getFilterName(i).find("hltMET") < hltPath_.getFilterName(i).length())
483  lastMatchedMETFilter = i;
484  if (hltPath_.getFilterType(i) == "HLTMuonL3PreFilter" || hltPath_.getFilterType(i) == "HLTMuonIsoFilter")
485  lastMatchedMuonFilter = i;
486  if (hltPath_.getFilterName(i).find("hltEle") < hltPath_.getFilterName(i).length())
487  lastMatchedElectronFilter = i;
488  if (hltPath_.getFilterName(i).find("hltPFTau") < hltPath_.getFilterName(i).length() ||
489  hltPath_.getFilterName(i).find("hltHpsPFTau") < hltPath_.getFilterName(i).length() ||
490  hltPath_.getFilterName(i).find("hltDoublePFTau") < hltPath_.getFilterName(i).length() ||
491  hltPath_.getFilterName(i).find("hltHpsDoublePFTau") < hltPath_.getFilterName(i).length() ||
492  hltPath_.getFilterName(i).find("PNetTauhTag") < hltPath_.getFilterName(i).length())
493  lastMatchedTauFilter = i;
494  if (firstMatchedMETFilter < 0 && hltPath_.getFilterName(i).find("hltMET") < hltPath_.getFilterName(i).length())
495  firstMatchedMETFilter = i;
496  }
497  } else {
498  for (int i = 0; i <= lastPassedFilter; ++i) {
499  if (hAcceptedEvents_)
500  hAcceptedEvents_->Fill(i + 0.5);
501  }
502  }
503 
504  // Efficiency plots
505  if (doRefAnalysis_ && lastMatchedFilter >= 0) {
506  // L2 taus
507  if (hltPath_.hasL2Taus()) {
508  // Denominators
509  if (static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastFilterBeforeL2TauIndex()) {
510  for (const LV& tau : refCollection.taus) {
519  }
520  }
521 
522  // Numerators
523  if (static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastL2TauFilterIndex()) {
524  triggerObjs.clear();
525  matchedTriggerObjs.clear();
526  matchedOfflineObjs.clear();
529  triggerObjs,
530  refCollection,
531  hltMatchDr_,
532  matchedTriggerObjs,
533  matchedOfflineObjs);
534  if (matched) {
535  for (const LV& tau : matchedOfflineObjs.taus) {
541  hL2TrigTauEtaEffNum_->Fill(tau.eta());
543  hL2TrigTauPhiEffNum_->Fill(tau.phi());
544  }
545  }
546  }
547  }
548 
549  // L3 taus
550  if (hltPath_.hasL3Taus()) {
551  // Denominators
552  if (static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastFilterBeforeL3TauIndex()) {
553  for (const LV& tau : refCollection.taus) {
563  hL3TrigTauEtaPhiEffDenom_->Fill(tau.eta(), tau.phi());
564  }
565  }
566 
567  // Numerators
568  if (static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastL3TauFilterIndex()) {
569  triggerObjs.clear();
570  matchedTriggerObjs.clear();
571  matchedOfflineObjs.clear();
574  triggerObjs,
575  refCollection,
576  hltMatchDr_,
577  matchedTriggerObjs,
578  matchedOfflineObjs);
579  if (matched) {
580  for (const LV& tau : matchedOfflineObjs.taus) {
586  hL3TrigTauEtaEffNum_->Fill(tau.eta());
588  hL3TrigTauPhiEffNum_->Fill(tau.phi());
590  hL3TrigTauEtaPhiEffNum_->Fill(tau.eta(), tau.phi());
591  }
592  }
593  }
594  }
595 
596  // L2 Electrons
597  if (hltPath_.hasL2Electrons()) {
598  // Denominators
599  if (static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastFilterBeforeL2ElectronIndex()) {
600  for (const LV& electron : refCollection.electrons) {
607  }
608  }
609 
610  // Numerators
611  if (static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastL2ElectronFilterIndex()) {
612  triggerObjs.clear();
613  matchedTriggerObjs.clear();
614  matchedOfflineObjs.clear();
617  triggerObjs,
618  refCollection,
619  hltMatchDr_,
620  matchedTriggerObjs,
621  matchedOfflineObjs);
622  if (matched) {
623  for (const LV& electron : matchedOfflineObjs.electrons) {
630  }
631  }
632  }
633  }
634 
635  // L3 electron
636  if (hltPath_.hasL3Electrons()) {
637  // Denominators
638  if (static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastFilterBeforeL3ElectronIndex()) {
639  for (const LV& electron : refCollection.electrons) {
646  }
647  }
648 
649  // Numerators
650  if (static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastL3ElectronFilterIndex()) {
651  triggerObjs.clear();
652  matchedTriggerObjs.clear();
653  matchedOfflineObjs.clear();
656  triggerObjs,
657  refCollection,
658  hltMatchDr_,
659  matchedTriggerObjs,
660  matchedOfflineObjs);
661  if (matched) {
662  for (const LV& electron : matchedOfflineObjs.electrons) {
669  }
670  }
671  }
672  }
673 
674  // L2 Muons
675  if (hltPath_.hasL2Muons()) {
676  // Denominators
677  if (static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastFilterBeforeL2MuonIndex()) {
678  for (const LV& muon : refCollection.muons) {
685  }
686  }
687 
688  // Numerators
689  if (static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastL2MuonFilterIndex()) {
690  triggerObjs.clear();
691  matchedTriggerObjs.clear();
692  matchedOfflineObjs.clear();
695  triggerObjs,
696  refCollection,
697  hltMatchDr_,
698  matchedTriggerObjs,
699  matchedOfflineObjs);
700  if (matched) {
701  for (const LV& muon : matchedOfflineObjs.muons) {
708  }
709  }
710  }
711  }
712 
713  // L3 muon
714  if (hltPath_.hasL3Muons()) {
715  // Denominators
716  if (static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastFilterBeforeL3MuonIndex()) {
717  for (const LV& muon : refCollection.muons) {
724  }
725  }
726 
727  // Numerators
728  if (static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastL3MuonFilterIndex()) {
729  triggerObjs.clear();
730  matchedTriggerObjs.clear();
731  matchedOfflineObjs.clear();
734  triggerObjs,
735  refCollection,
736  hltMatchDr_,
737  matchedTriggerObjs,
738  matchedOfflineObjs);
739  if (matched) {
740  for (const LV& muon : matchedOfflineObjs.muons) {
747  }
748  }
749  }
750  }
751 
752  // L2 CaloMET
753  if (hltPath_.hasL2CaloMET()) {
754  // Denominators
755  if (static_cast<size_t>(firstMatchedMETFilter) >= hltPath_.getFirstFilterBeforeL2CaloMETIndex()) {
757  hL2TrigMETEtEffDenom_->Fill(refCollection.met[0].pt());
758  }
759 
760  // Numerators
761  if (static_cast<size_t>(lastMatchedMETFilter) >= hltPath_.getLastL2CaloMETFilterIndex()) {
762  triggerObjs.clear();
763  matchedTriggerObjs.clear();
764  matchedOfflineObjs.clear();
767  triggerObjs,
768  refCollection,
769  hltMatchDr_,
770  matchedTriggerObjs,
771  matchedOfflineObjs);
772  if (matched) {
774  hL2TrigMETEtEffNum_->Fill(matchedOfflineObjs.met[0].pt());
775  }
776  }
777  }
778  }
779 
781  triggerObjs.clear();
782  matchedTriggerObjs.clear();
783  matchedOfflineObjs.clear();
784 
785  if (lastMatchedMETFilter >= 0)
786  hltPath_.getFilterObjects(triggerEvent, lastMatchedMETFilter, triggerObjs);
787  if (lastMatchedMuonFilter >= 0)
788  hltPath_.getFilterObjects(triggerEvent, lastMatchedMuonFilter, triggerObjs);
789  if (lastMatchedElectronFilter >= 0)
790  hltPath_.getFilterObjects(triggerEvent, lastMatchedElectronFilter, triggerObjs);
791 
792  if (lastMatchedTauFilter >= 0)
793  hltPath_.getFilterObjects(triggerEvent, lastMatchedTauFilter, triggerObjs);
794 
795  if (doRefAnalysis_) {
797  lastPassedFilter, triggerObjs, refCollection, hltMatchDr_, matchedTriggerObjs, matchedOfflineObjs);
798  if (matched) {
799  // Di-object invariant mass
800  if (hMass_) {
801  const int ntaus = hltPath_.getFilterNTaus(lastPassedFilter);
802  if (ntaus == 2 && hltPath_.getFilterNElectrons(lastMatchedElectronFilter) == 0 &&
803  hltPath_.getFilterNMuons(lastMatchedMuonFilter) == 0) {
804  // Di-tau (matchedOfflineObjs are already sorted)
805  if (hMass_)
806  hMass_->Fill((matchedOfflineObjs.taus[0] + matchedOfflineObjs.taus[1]).M());
807  }
808  // Electron+tau
809  else if (ntaus == 1 && hltPath_.getFilterNElectrons(lastPassedFilter) == 1) {
810  if (hMass_)
811  hMass_->Fill((matchedOfflineObjs.taus[0] + matchedOfflineObjs.electrons[0]).M());
812  }
813  // Muon+tau
814  else if (ntaus == 1 && hltPath_.getFilterNMuons(lastPassedFilter) == 1) {
815  if (hMass_)
816  hMass_->Fill((matchedOfflineObjs.taus[0] + matchedOfflineObjs.muons[0]).M());
817  }
818  // Tau+MET
819  if (hltPath_.getFilterNTaus(lastPassedFilter) == 1 && hltPath_.getFilterMET(lastMatchedMETFilter) == 1) {
820  double taupt = matchedOfflineObjs.taus[0].Pt();
821  double tauphi = matchedOfflineObjs.taus[0].Phi();
822  double met = matchedOfflineObjs.met[0].Pt();
823  double metphi = matchedOfflineObjs.met[0].Phi();
824  double mT = sqrt(2 * taupt * met * (1 - cos(tauphi - metphi)));
825 
826  if (hMass_)
827  hMass_->Fill(mT);
828  }
829  }
830  }
831 
832  // Triggered object kinematics
833  for (const HLTTauDQMPath::Object& obj : triggerObjs) {
834  if (obj.id == trigger::TriggerTau) {
835  if (hTrigTauEt_)
836  hTrigTauEt_->Fill(obj.object.pt());
837  if (hTrigTauEta_)
838  hTrigTauEta_->Fill(obj.object.eta());
839  if (hTrigTauPhi_)
840  hTrigTauPhi_->Fill(obj.object.phi());
841  }
843  if (hTrigElectronEt_)
844  hTrigElectronEt_->Fill(obj.object.pt());
845  if (hTrigElectronEta_)
846  hTrigElectronEta_->Fill(obj.object.eta());
847  if (hTrigElectronPhi_)
848  hTrigElectronPhi_->Fill(obj.object.phi());
849  }
850  if (obj.id == trigger::TriggerMuon) {
851  if (hTrigMuonEt_)
852  hTrigMuonEt_->Fill(obj.object.pt());
853  if (hTrigMuonEta_)
854  hTrigMuonEta_->Fill(obj.object.eta());
855  if (hTrigMuonPhi_)
856  hTrigMuonPhi_->Fill(obj.object.phi());
857  }
858  if (obj.id == trigger::TriggerMET) {
859  if (hTrigMETEt_)
860  hTrigMETEt_->Fill(obj.object.pt());
861  if (hTrigMETPhi_)
862  hTrigMETPhi_->Fill(obj.object.phi());
863  }
864  }
865  }
866  }
867 }
bool hasL2Muons() const
Definition: HLTTauDQMPath.h:93
MonitorElement * hL3TrigTauEtEffDenom_
MonitorElement * hTrigElectronEta_
MonitorElement * hL3TrigTauPhiEffDenom_
MonitorElement * hL2TrigTauPhiEffDenom_
MonitorElement * hL3TrigMuonPhiEffNum_
bool hasL2Taus() const
Definition: HLTTauDQMPath.h:89
size_t getLastFilterBeforeL3MuonIndex() const
MonitorElement * hL3TrigMuonEtaEffDenom_
MonitorElement * hL2TrigTauEtEffDenom_
MonitorElement * hTrigTauEt_
std::vector< LV > electrons
size_t getLastFilterBeforeL2ElectronIndex() const
The single EDProduct to be saved for each event (AOD case)
Definition: TriggerEvent.h:26
def create(alignables, pedeDump, additionalData, outputFile, config)
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
std::vector< LV > taus
int getFilterNElectrons(size_t i) const
Definition: HLTTauDQMPath.h:61
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)
const std::string & getFilterType(size_t i) const
Definition: HLTTauDQMPath.h:54
virtual void setOption(const char *option)
math::XYZTLorentzVectorD LV
MonitorElement * hTrigElectronPhi_
size_t getLastFilterBeforeL3TauIndex() const
Definition: HLTTauDQMPath.h:98
MonitorElement * hL3TrigTauEtEffNum_
bool isValid() const
MonitorElement * hL2TrigMuonEtaEffNum_
const std::string & getPathName() const
Definition: HLTTauDQMPath.h:49
MonitorElement * hL3TrigMuonEtaEffNum_
bool hasL3Muons() const
Definition: HLTTauDQMPath.h:94
MonitorElement * hL2TrigTauEtEffNum_
MonitorElement * hAcceptedEvents_
MonitorElement * hL2TrigElectronEtEffNum_
MonitorElement * hL2TrigMuonPhiEffNum_
size_t getLastL2ElectronFilterIndex() const
size_t getLastL3TauFilterIndex() const
Definition: HLTTauDQMPath.h:99
MonitorElement * hL2TrigTauPhiEffNum_
MonitorElement * hL3TrigTauEtaPhiEffDenom_
void Fill(long long x)
size_t getLastFilterBeforeL2TauIndex() const
Definition: HLTTauDQMPath.h:96
MonitorElement * hL3TrigMuonEtEffNum_
MonitorElement * hL2TrigMuonEtEffDenom_
bool hasL3Taus() const
Definition: HLTTauDQMPath.h:90
MonitorElement * hL3TrigTauHighEtEffNum_
MonitorElement * hL3TrigElectronEtaEffNum_
MonitorElement * hL2TrigElectronPhiEffDenom_
MonitorElement * hL3TrigTauEtaEffDenom_
void bookHistograms(HistoWrapper &iWrapper, DQMStore::IBooker &iBooker)
MonitorElement * hCounter_
MonitorElement * hL3TrigTauEtaPhiEffNum_
MonitorElement * hL2TrigMuonEtaEffDenom_
MonitorElement * hL2TrigMETEtEffDenom_
T sqrt(T t)
Definition: SSEVec.h:19
size_t filtersSize() const
Definition: HLTTauDQMPath.h:52
size_t getLastL3MuonFilterIndex() const
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
bool isValid() const
Definition: HLTTauDQMPath.h:41
MonitorElement * hL3TrigElectronEtEffDenom_
size_t getLastFilterBeforeL3ElectronIndex() const
MonitorElement * hL3TrigTauPhiEffNum_
MonitorElement * hTrigMETEt_
MonitorElement * hL3TrigTauEtaEffNum_
bool hasL2CaloMET() const
Definition: HLTTauDQMPath.h:95
void analyze(const edm::TriggerResults &triggerResults, const trigger::TriggerEvent &triggerEvent, const HLTTauDQMOfflineObjects &refCollection)
int getFilterMET(size_t i) const
Definition: HLTTauDQMPath.h:73
MonitorElement * hTrigMETPhi_
MonitorElement * book1D(DQMStore::IBooker &iBooker, TString const &name, TString const &title, int const nchX, double const lowX, double const highX, int level=kEverything)
Definition: HistoWrapper.cc:17
int getFilterNMuons(size_t i) const
Definition: HLTTauDQMPath.h:67
static std::string const triggerResults
Definition: EdmProvDump.cc:47
size_t getLastL2MuonFilterIndex() const
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)
size_t getLastL2CaloMETFilterIndex() const
MonitorElement * hL2TrigMETEtEffNum_
std::vector< LV > met
MonitorElement * hL2TrigTauHighEtEffNum_
MonitorElement * hL3TrigElectronEtEffNum_
MonitorElement * hL3TrigElectronEtaEffDenom_
size_t getLastL3ElectronFilterIndex() const
bool hasL2Electrons() const
Definition: HLTTauDQMPath.h:91
MonitorElement * hL2TrigElectronPhiEffNum_
MonitorElement * hTrigTauPhi_
bool hasL3Electrons() const
Definition: HLTTauDQMPath.h:92
MonitorElement * hL2TrigElectronEtaEffDenom_
MonitorElement * hTrigElectronEt_
MonitorElement * hL3TrigMuonPhiEffDenom_
MonitorElement * book2D(DQMStore::IBooker &iBooker, TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, int level=kEverything)
Definition: HistoWrapper.cc:33
int getFilterNTaus(size_t i) const
Definition: HLTTauDQMPath.h:55
void getFilterObjects(const trigger::TriggerEvent &triggerEvent, size_t i, std::vector< Object > &retval) const
MonitorElement * hTrigMuonEta_
size_t getLastFilterBeforeL2MuonIndex() const
size_t getLastL2TauFilterIndex() const
Definition: HLTTauDQMPath.h:97
MonitorElement * hL2TrigTauEtaEffNum_
bool isFirstFilterL1Seed() const
Definition: HLTTauDQMPath.h:86
MonitorElement * hL2TrigTauHighEtEffDenom_
MonitorElement * hL3TrigElectronPhiEffDenom_
MonitorElement * hTrigTauEta_
int lastPassedFilter(const edm::TriggerResults &triggerResults) const
MonitorElement * hL2TrigTauEtaEffDenom_
MonitorElement * hL3TrigMuonEtEffDenom_
const std::string & getFilterName(size_t i) const
Definition: HLTTauDQMPath.h:53
const std::string & triggerTag() const
bool fired(const edm::TriggerResults &triggerResults) const
MonitorElement * hL2TrigElectronEtEffDenom_
MonitorElement * hL2TrigElectronEtaEffNum_
MonitorElement * hTrigMuonPhi_
MonitorElement * hL3TrigElectronPhiEffNum_
MonitorElement * hL2TrigMuonPhiEffDenom_
std::vector< LV > muons
MonitorElement * hL3TrigTauHighEtEffDenom_
size_t getFirstFilterBeforeL2CaloMETIndex() const
#define LogDebug(id)
bool offlineMatching(size_t i, const std::vector< Object > &triggerObjects, const HLTTauDQMOfflineObjects &offlineObjects, double dR, std::vector< Object > &matchedTriggerObjects, HLTTauDQMOfflineObjects &matchedOfflineObjects) const
MonitorElement * hL2TrigMuonEtEffNum_