CMS 3D CMS Logo

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