CMS 3D CMS Logo

HLTrigReport.cc
Go to the documentation of this file.
1 
10 #include <iomanip>
11 #include <cstring>
12 #include <sstream>
13 
19 #include "HLTrigReportService.h"
20 #include "Math/QuantFuncMathCore.h"
21 
22 #include "HLTrigReport.h"
23 
24 
26  if (value == "never")
27  return NEVER;
28 
29  if (value == "job")
30  return EVERY_JOB;
31 
32  if (value == "run")
33  return EVERY_RUN;
34 
35  if (value == "lumi")
36  return EVERY_LUMI;
37 
38  if (value == "event")
39  return EVERY_EVENT;
40 
41  throw cms::Exception("Configuration") << "Invalid option value \"" << value << "\". Legal values are \"job\", \"run\", \"lumi\", \"event\" and \"never\".";
42 }
43 
44 
45 //
46 // constructors and destructor
47 //
49  hlTriggerResults_(iConfig.getParameter<edm::InputTag> ("HLTriggerResults")),
52  nEvents_(0),
53  nWasRun_(0),
54  nAccept_(0),
55  nErrors_(0),
56  hlWasRun_(0),
57  hltL1s_(0),
58  hltPre_(0),
59  hlAccept_(0),
60  hlAccTot_(0),
61  hlErrors_(0),
62  posL1s_(0),
63  posPre_(0),
64  hlNames_(0),
65  hlIndex_(0),
66  hlAccTotDS_(0),
67  datasetNames_(0),
70  dsIndex_(0),
71  dsAccTotS_(0),
72  streamNames_(0),
73  streamContents_(0),
75  refPath_("HLTriggerFinalPath"),
76  refIndex_(0),
77  refRate_(100.0),
78  reportBy_( decode(iConfig.getUntrackedParameter<std::string>("reportBy", "job")) ),
79  resetBy_( decode(iConfig.getUntrackedParameter<std::string>("resetBy", "never")) ),
80  serviceBy_(decode(iConfig.getUntrackedParameter<std::string>("serviceBy", "never")) ),
81  hltConfig_()
82 {
83  const edm::ParameterSet customDatasets(iConfig.getUntrackedParameter<edm::ParameterSet>("CustomDatasets", edm::ParameterSet()));
84  isCustomDatasets_ = (customDatasets != edm::ParameterSet());
85  if (isCustomDatasets_) {
86  datasetNames_ = customDatasets.getParameterNamesForType<std::vector<std::string> >();
87  for (std::vector<std::string>::const_iterator name = datasetNames_.begin(); name != datasetNames_.end(); name++) {
88  datasetContents_.push_back(customDatasets.getParameter<std::vector<std::string> >(*name));
89  }
90  }
91 
92  const edm::ParameterSet customStreams (iConfig.getUntrackedParameter<edm::ParameterSet>("CustomStreams" , edm::ParameterSet()));
93  isCustomStreams_ = (customStreams != edm::ParameterSet());
94  if (isCustomStreams_ ) {
95  streamNames_ = customStreams.getParameterNamesForType<std::vector<std::string> >();
96  for (std::vector<std::string>::const_iterator name = streamNames_.begin(); name != streamNames_.end(); name++) {
97  streamContents_.push_back(customStreams.getParameter<std::vector<std::string> >(*name));
98  }
99  }
100 
101  refPath_ = iConfig.getUntrackedParameter<std::string>("ReferencePath","HLTriggerFinalPath");
102  refRate_ = iConfig.getUntrackedParameter<double>("ReferenceRate", 100.0);
103  refIndex_= 0;
104 
105  LogDebug("HLTrigReport")
106  << "HL TiggerResults: " + hlTriggerResults_.encode()
107  << " using reference path and rate: " + refPath_ + " " << refRate_;
108 
110  edm::Service<HLTrigReportService>()->registerModule(this);
111  }
112 
113 }
114 
115 HLTrigReport::~HLTrigReport() = default;
116 
117 void
120  desc.add<edm::InputTag>("HLTriggerResults",edm::InputTag("TriggerResults","","HLT"));
121  desc.addUntracked<std::string>("reportBy","job");
122  desc.addUntracked<std::string>("resetBy","never");
123  desc.addUntracked<std::string>("serviceBy","never");
124 
125  edm::ParameterSetDescription customDatasetsParameters;
126  desc.addUntracked<edm::ParameterSetDescription>("CustomDatasets" ,customDatasetsParameters);
127  edm::ParameterSetDescription customStreamsParameters;
128  desc.addUntracked<edm::ParameterSetDescription>("CustomStreams" ,customStreamsParameters);
129  desc.addUntracked<std::string>("ReferencePath","HLTriggerFinalPath");
130  desc.addUntracked<double>("ReferenceRate",100.0);
131 
132  descriptions.add("hltTrigReport",desc);
133 }
134 
135 //
136 // member functions
137 //
138 
139 const std::vector<std::string>& HLTrigReport::datasetNames() const {
140  return datasetNames_;
141 }
142 const std::vector<std::string>& HLTrigReport::streamNames() const {
143  return streamNames_;
144 }
145 const std::vector<unsigned int>& HLTrigReport::datasetCounts() const {
146  return hlAllTotDS_;
147 }
148 const std::vector<unsigned int>& HLTrigReport::streamCounts() const {
149  return dsAllTotS_;
150 }
151 
152 void HLTrigReport::reset(bool changed /* = false */) {
153 
154  // reset global counters
155  nEvents_ = 0;
156  nWasRun_ = 0;
157  nAccept_ = 0;
158  nErrors_ = 0;
159 
160  // update trigger names
161  if (changed)
163 
164  const unsigned int n = hlNames_.size();
165 
166  if (changed) {
167  // resize per-path counters
168  hlWasRun_.resize(n);
169  hltL1s_.resize(n);
170  hltPre_.resize(n);
171  hlAccept_.resize(n);
172  hlAccTot_.resize(n);
173  hlErrors_.resize(n);
174  // find the positions of seeding and prescaler modules
175  posL1s_.resize(n);
176  posPre_.resize(n);
177  for (unsigned int i = 0; i < n; ++i) {
178  posL1s_[i] = -1;
179  posPre_[i] = -1;
180  const std::vector<std::string> & moduleLabels(hltConfig_.moduleLabels(i));
181  for (unsigned int j = 0; j < moduleLabels.size(); ++j) {
182  const std::string & label = hltConfig_.moduleType(moduleLabels[j]);
183  if (label == "HLTLevel1GTSeed")
184  posL1s_[i] = j;
185  else if (label == "HLTPrescaler")
186  posPre_[i] = j;
187  }
188  }
189  }
190 
191  // reset per-path counters
192  for (unsigned int i = 0; i < n; ++i) {
193  hlWasRun_[i] = 0;
194  hltL1s_[i] = 0;
195  hltPre_[i] = 0;
196  hlAccept_[i] = 0;
197  hlAccTot_[i] = 0;
198  hlErrors_[i] = 0;
199  }
200 
201  // if not overridden, reload the datasets and streams
202  if (changed and not isCustomDatasets_) {
205  }
206  if (changed and not isCustomStreams_) {
209  }
210 
211  if (changed) {
212  // fill the matrices of hlIndex_, hlAccTotDS_
213  hlIndex_.clear();
214  hlIndex_.resize(datasetNames_.size());
215  hlAccTotDS_.clear();
216  hlAllTotDS_.clear();
217  hlAccTotDS_.resize(datasetNames_.size());
218  hlAllTotDS_.resize(datasetNames_.size());
219  for (unsigned int ds = 0; ds < datasetNames_.size(); ds++) {
220  unsigned int size = datasetContents_[ds].size();
221  hlIndex_[ds].reserve(size);
222  hlAccTotDS_[ds].reserve(size);
223  hlAllTotDS_[ds]=0;
224  for (unsigned int p = 0; p < size; ++p) {
225  unsigned int i = hltConfig_.triggerIndex(datasetContents_[ds][p]);
226  if (i<n) {
227  hlIndex_[ds].push_back(i);
228  hlAccTotDS_[ds].push_back(0);
229  }
230  }
231  }
232  } else {
233  // reset the matrix of hlAccTotDS_
234  for (unsigned int ds = 0; ds < datasetNames_.size(); ds++) {
235  hlAllTotDS_[ds]=0;
236  for (unsigned int & i : hlAccTotDS_[ds])
237  i = 0;
238  }
239  }
240 
241  if (changed) {
242  // fill the matrices of dsIndex_, dsAccTotS_
243  dsIndex_.clear();
244  dsIndex_.resize(streamNames_.size());
245  dsAccTotS_.clear();
246  dsAllTotS_.clear();
247  dsAccTotS_.resize(streamNames_.size());
248  dsAllTotS_.resize(streamNames_.size());
249  for (unsigned int s = 0; s < streamNames_.size(); ++s) {
250  unsigned int size = streamContents_[s].size();
251  dsIndex_.reserve(size);
252  dsAccTotS_.reserve(size);
253  dsAllTotS_[s]=0;
254  for (unsigned int ds = 0; ds < size; ++ds) {
255  unsigned int i = 0;
256  for (; i<datasetNames_.size(); i++) if (datasetNames_[i] == streamContents_[s][ds])
257  break;
258  // report only datasets that have at least one path otherwise crash
259  if (i < datasetNames_.size() and !hlIndex_[i].empty()) {
260  dsIndex_[s].push_back(i);
261  dsAccTotS_[s].push_back(0);
262  }
263  }
264  }
265  } else {
266  // reset the matrix of dsAccTotS_
267  for (unsigned int s = 0; s < streamNames_.size(); ++s) {
268  dsAllTotS_[s]=0;
269  for (unsigned int & i : dsAccTotS_[s])
270  i = 0;
271  }
272  }
273 
274  // if needed, update the reference path
275  if (changed) {
277  if (refIndex_ >= n) {
278  refIndex_ = 0;
279  edm::LogWarning("HLTrigReport")
280  << "Requested reference path '"+refPath_+"' not in HLT menu. "
281  << "Using HLTriggerFinalPath instead.";
282  refPath_ = "HLTriggerFinalPath";
284  if (refIndex_ >= n) {
285  refIndex_ = 0;
286  edm::LogWarning("HLTrigReport")
287  << "Requested reference path '"+refPath_+"' not in HLT menu. "
288  << "Using first path in table (index=0) instead.";
289  }
290  }
291  }
292 
293  if (changed and serviceBy_ != NEVER and edm::Service<HLTrigReportService>()) {
296  }
297 
298 }
299 
301  if (resetBy_ == EVERY_JOB)
302  reset();
303 }
304 
306  if (reportBy_ == EVERY_JOB)
307  dumpReport("Summary for Job");
309  edm::Service<HLTrigReportService>()->setDatasetCounts(datasetCounts());
310  edm::Service<HLTrigReportService>()->setStreamCounts(streamCounts());
311  }
312 
313 }
314 
315 void
316 HLTrigReport::beginRun(edm::Run const & iRun, edm::EventSetup const& iSetup)
317 {
318  bool changed = true;
319  if (hltConfig_.init(iRun, iSetup, hlTriggerResults_.process(), changed)) {
320  configured_ = true;
321  if (changed) {
322  dumpReport("Summary for this HLT table");
323  reset(true);
324  }
325  } else {
326  dumpReport("Summary for this HLT table");
327  // cannot initialize the HLT menu - reset and clear all counters and tables
328  configured_ = false;
329  nEvents_ = 0;
330  nWasRun_ = 0;
331  nAccept_ = 0;
332  nErrors_ = 0;
333  hlWasRun_.clear();
334  hltL1s_.clear();
335  hltPre_.clear();
336  hlAccept_.clear();
337  hlAccTot_.clear();
338  hlErrors_.clear();
339  posL1s_.clear();
340  posPre_.clear();
341  hlNames_.clear();
342  hlIndex_.clear();
343  hlAccTotDS_.clear();
344  hlAllTotDS_.clear();
345  dsIndex_.clear();
346  dsAccTotS_.clear();
347  dsAllTotS_.clear();
348  }
349 
350  if (resetBy_ == EVERY_RUN) reset();
351 
352 }
353 
355  if (reportBy_ == EVERY_RUN) {
356  std::stringstream stream;
357  stream << "Summary for Run " << run.run();
358  dumpReport(stream.str());
359  }
361  edm::Service<HLTrigReportService>()->setDatasetCounts(datasetCounts());
362  edm::Service<HLTrigReportService>()->setStreamCounts(streamCounts());
363  }
364 }
365 
367  if (resetBy_ == EVERY_LUMI) reset();
368 }
369 
371  if (reportBy_ == EVERY_LUMI) {
372  std::stringstream stream;
373  stream << "Summary for Run " << lumi.run() << ", LumiSection " << lumi.luminosityBlock();
374  dumpReport(stream.str());
375  }
377  edm::Service<HLTrigReportService>()->setDatasetCounts(datasetCounts());
378  edm::Service<HLTrigReportService>()->setStreamCounts(streamCounts());
379  }
380 }
381 
382 
383 // ------------ method called to produce the data ------------
384 void
386 {
387  // accumulation of statistics event by event
388 
389  using namespace std;
390  using namespace edm;
391 
392  if (resetBy_ == EVERY_EVENT) reset();
393 
394  nEvents_++;
395 
396  // get hold of TriggerResults
398  iEvent.getByToken(hlTriggerResultsToken_, HLTR);
399  if (HLTR.isValid()) {
400  if (HLTR->wasrun()) nWasRun_++;
401  const bool accept(HLTR->accept());
402  LogDebug("HLTrigReport") << "HLT TriggerResults decision: " << accept;
403  if (accept) ++nAccept_;
404  if (HLTR->error()) nErrors_++;
405  } else {
406  LogDebug("HLTrigReport") << "HLT TriggerResults with label ["+hlTriggerResults_.encode()+"] not found!";
407  nErrors_++;
408  return;
409  }
410 
411  // HLTConfigProvider not configured - cannot produce any detailed statistics
412  if (not configured_)
413  return;
414 
415  // decision for each HL algorithm
416  const unsigned int n(hlNames_.size());
417  bool acceptedByPrevoiusPaths = false;
418  for (unsigned int i=0; i!=n; ++i) {
419  if (HLTR->wasrun(i)) hlWasRun_[i]++;
420  if (HLTR->accept(i)) {
421  acceptedByPrevoiusPaths = true;
422  hlAccept_[i]++;
423  }
424  if (acceptedByPrevoiusPaths) hlAccTot_[i]++;
425  if (HLTR->error(i) ) hlErrors_[i]++;
426  const int index(static_cast<int>(HLTR->index(i)));
427  if (HLTR->accept(i)) {
428  if (index >= posL1s_[i]) hltL1s_[i]++;
429  if (index >= posPre_[i]) hltPre_[i]++;
430  } else {
431  if (index > posL1s_[i]) hltL1s_[i]++;
432  if (index > posPre_[i]) hltPre_[i]++;
433  }
434  }
435 
436  // calculate accumulation of accepted events by a path within a dataset
437  std::vector<bool> acceptedByDS(hlIndex_.size(), false);
438  for (size_t ds=0; ds<hlIndex_.size(); ++ds) {
439  for (size_t p=0; p<hlIndex_[ds].size(); ++p) {
440  if (acceptedByDS[ds] or HLTR->accept(hlIndex_[ds][p])) {
441  acceptedByDS[ds] = true;
442  hlAccTotDS_[ds][p]++;
443  }
444  }
445  if (acceptedByDS[ds]) hlAllTotDS_[ds]++;
446  }
447 
448  // calculate accumulation of accepted events by a dataset within a stream
449  for (size_t s=0; s<dsIndex_.size(); ++s) {
450  bool acceptedByS = false;
451  for (size_t ds=0; ds<dsIndex_[s].size(); ++ds) {
452  if (acceptedByS or acceptedByDS[dsIndex_[s][ds]]) {
453  acceptedByS = true;
454  dsAccTotS_[s][ds]++;
455  }
456  }
457  if (acceptedByS) dsAllTotS_[s]++;
458  }
459 
460  if (reportBy_ == EVERY_EVENT) {
461  std::stringstream stream;
462  stream << "Summary for Run " << iEvent.run() << ", LumiSection " << iEvent.luminosityBlock() << ", Event " << iEvent.id();
463  dumpReport(stream.str());
464  }
466  edm::Service<HLTrigReportService>()->setDatasetCounts(datasetCounts());
467  edm::Service<HLTrigReportService>()->setStreamCounts(streamCounts());
468  }
469 
470 }
471 
472 void
473 HLTrigReport::dumpReport(std::string const & header /* = std::string() */)
474 {
475  // final printout of accumulated statistics
476 
477  using namespace std;
478  using namespace edm;
479  const unsigned int n(hlNames_.size());
480 
481  if ((n==0) and (nEvents_==0)) return;
482 
483  LogVerbatim("HLTrigReport") << dec << endl;
484  LogVerbatim("HLTrigReport") << "HLT-Report " << "---------- Event Summary ------------" << endl;
485  if (not header.empty())
486  LogVerbatim("HLTrigReport") << "HLT-Report " << header << endl;
487  LogVerbatim("HLTrigReport") << "HLT-Report"
488  << " Events total = " << nEvents_
489  << " wasrun = " << nWasRun_
490  << " passed = " << nAccept_
491  << " errors = " << nErrors_
492  << endl;
493 
494  // HLTConfigProvider not configured - cannot produce any detailed statistics
495  if (not configured_)
496  return;
497 
498  double scale = hlAccept_[refIndex_]>0 ? refRate_/hlAccept_[refIndex_] : 0.;
499  double alpha = 1 - (1.0 - .6854)/2; // for the Clopper-Pearson 68% CI
500 
501  LogVerbatim("HLTrigReport") << endl;
502  LogVerbatim("HLTrigReport") << "HLT-Report " << "---------- HLTrig Summary ------------" << endl;
503  LogVerbatim("HLTrigReport") << "HLT-Report "
504  << right << setw(7) << "HLT #" << " "
505  << right << setw(7) << "WasRun" << " "
506  << right << setw(7) << "L1S" << " "
507  << right << setw(7) << "Pre" << " "
508  << right << setw(7) << "HLT" << " "
509  << right << setw(9) << "%L1sPre" << " "
510  << right << setw(7) << "Rate" << " "
511  << right << setw(7) << "RateHi" << " "
512  << right << setw(7) << "Errors" << " "
513  << "Name" << endl;
514 
515  if (n>0) {
516  for (unsigned int i=0; i!=n; ++i) {
517  LogVerbatim("HLTrigReport") << "HLT-Report "
518  << right << setw(7) << i << " "
519  << right << setw(7) << hlWasRun_[i] << " "
520  << right << setw(7) << hltL1s_[i] << " "
521  << right << setw(7) << hltPre_[i] << " "
522  << right << setw(7) << hlAccept_[i] << " "
523  << right << setw(9) << fixed << setprecision(5)
524  << static_cast<float>(100*hlAccept_[i])/
525  static_cast<float>(max(hltPre_[i], 1u)) << " "
526  << right << setw(7) << fixed << setprecision(1) << scale*hlAccept_[i] << " "
527  << right << setw(7) << fixed << setprecision(1) <<
528  ((hlAccept_[refIndex_]-hlAccept_[i] > 0) ? refRate_*ROOT::Math::beta_quantile(alpha, hlAccept_[i]+1, hlAccept_[refIndex_]-hlAccept_[i]) : 0) << " "
529  << right << setw(7) << hlErrors_[i] << " "
530  << hlNames_[i] << endl;
531  }
532  }
533 
534  LogVerbatim("HLTrigRprtTt") << endl;
535  LogVerbatim("HLTrigRprtTt") << "HLT-Report " << "---------- HLTrig Summary ------------" << endl;
536  LogVerbatim("HLTrigRprtTt") << "HLT-Report "
537  << right << setw(7) << "HLT #" << " "
538  << right << setw(7) << "WasRun" << " "
539  << right << setw(7) << "L1S" << " "
540  << right << setw(7) << "Pre" << " "
541  << right << setw(7) << "HLT" << " "
542  << right << setw(9) << "%L1sPre" << " "
543  << right << setw(7) << "Rate" << " "
544  << right << setw(7) << "RateHi" << " "
545  << right << setw(7) << "HLTtot" << " "
546  << right << setw(7) << "RateTot" << " "
547  << right << setw(7) << "Errors" << " "
548  << "Name" << endl;
549 
550  if (n>0) {
551  for (unsigned int i=0; i!=n; ++i) {
552  LogVerbatim("HLTrigRprtTt") << "HLT-Report "
553  << right << setw(7) << i << " "
554  << right << setw(7) << hlWasRun_[i] << " "
555  << right << setw(7) << hltL1s_[i] << " "
556  << right << setw(7) << hltPre_[i] << " "
557  << right << setw(7) << hlAccept_[i] << " "
558  << right << setw(9) << fixed << setprecision(5)
559  << static_cast<float>(100*hlAccept_[i])/
560  static_cast<float>(max(hltPre_[i], 1u)) << " "
561  << right << setw(7) << fixed << setprecision(1) << scale*hlAccept_[i] << " "
562  << right << setw(7) << fixed << setprecision(1) <<
563  ((hlAccept_[refIndex_]-hlAccept_[i] > 0) ? refRate_*ROOT::Math::beta_quantile(alpha, hlAccept_[i]+1, hlAccept_[refIndex_]-hlAccept_[i]) : 0) << " "
564  << right << setw(7) << hlAccTot_[i] << " "
565  << right << setw(7) << fixed << setprecision(1) << scale*hlAccTot_[i] << " "
566  << right << setw(7) << hlErrors_[i] << " "
567  << hlNames_[i] << endl;
568  }
569 
570  // now for each dataset
571  for (size_t ds=0; ds<hlIndex_.size(); ++ds) {
572  LogVerbatim("HLTrigRprtPD") << endl;
573  LogVerbatim("HLTrigRprtPD") << "HLT-Report " << "---------- Dataset Summary: " << datasetNames_[ds] << " ------------" << hlAllTotDS_[ds] << endl;
574  LogVerbatim("HLTrigRprtPD") << "HLT-Report "
575  << right << setw(7) << "HLT #" << " "
576  << right << setw(7) << "WasRun" << " "
577  << right << setw(7) << "L1S" << " "
578  << right << setw(7) << "Pre" << " "
579  << right << setw(7) << "HLT" << " "
580  << right << setw(9) << "%L1sPre" << " "
581  << right << setw(7) << "Rate" << " "
582  << right << setw(7) << "RateHi" << " "
583  << right << setw(7) << "HLTtot" << " "
584  << right << setw(7) << "RateTot" << " "
585  << right << setw(7) << "Errors" << " "
586  << "Name" << endl;
587  for (size_t p=0; p<hlIndex_[ds].size(); ++p) {
588  LogVerbatim("HLTrigRprtPD") << "HLT-Report "
589  << right << setw(7) << p << " "
590  << right << setw(7) << hlWasRun_[hlIndex_[ds][p]] << " "
591  << right << setw(7) << hltL1s_[hlIndex_[ds][p]] << " "
592  << right << setw(7) << hltPre_[hlIndex_[ds][p]] << " "
593  << right << setw(7) << hlAccept_[hlIndex_[ds][p]] << " "
594  << right << setw(9) << fixed << setprecision(5)
595  << static_cast<float>(100*hlAccept_[hlIndex_[ds][p]])/
596  static_cast<float>(max(hltPre_[hlIndex_[ds][p]], 1u)) << " "
597  << right << setw(7) << fixed << setprecision(1) << scale*hlAccept_[hlIndex_[ds][p]] << " "
598  << right << setw(7) << fixed << setprecision(1) <<
599  ((hlAccept_[refIndex_]-hlAccept_[hlIndex_[ds][p]] > 0) ? refRate_*ROOT::Math::beta_quantile(alpha, hlAccept_[hlIndex_[ds][p]]+1, hlAccept_[refIndex_]-hlAccept_[hlIndex_[ds][p]]) : 0) << " "
600  << right << setw(7) << hlAccTotDS_[ds][p] << " "
601  << right << setw(7) << fixed << setprecision(1) << scale*hlAccTotDS_[ds][p] << " "
602  << right << setw(7) << hlErrors_[hlIndex_[ds][p]] << " "
603  << hlNames_[hlIndex_[ds][p]] << endl;
604  }
605  }
606 
607  // now for each stream
608  for (size_t s=0; s<dsIndex_.size(); ++s) {
609  LogVerbatim("HLTrigRprtST") << endl;
610  LogVerbatim("HLTrigRprtST") << "HLT-Report " << "---------- Stream Summary: " << streamNames_[s] << " ------------" << dsAllTotS_[s] << endl;
611  LogVerbatim("HLTrigRprtST") << "HLT-Report "
612  << right << setw(10) << "Dataset #" << " "
613  << right << setw(10) << "Individual" << " "
614  << right << setw(10) << "Total" << " "
615  << right << setw(10) << "Rate" << " "
616  << right << setw(10) << "RateHi" << " "
617  << right << setw(10) << "RateTot" << " "
618  << "Name" << endl;
619  for (size_t ds=0;ds<dsIndex_[s].size(); ++ds) {
620  unsigned int acceptedDS = hlAccTotDS_[dsIndex_[s][ds]][hlIndex_[dsIndex_[s][ds]].size()-1];
621  LogVerbatim("HLTrigRprtST") << "HLT-Report "
622  << right << setw(10) << ds << " "
623  << right << setw(10) << acceptedDS << " "
624  << right << setw(10) << dsAccTotS_[s][ds] << " "
625  << right << setw(10) << fixed << setprecision(1) << scale*acceptedDS << " "
626  << right << setw(10) << fixed << setprecision(1) <<
627  ((hlAccept_[refIndex_]-acceptedDS > 0) ? refRate_*ROOT::Math::beta_quantile(alpha, acceptedDS+1, hlAccept_[refIndex_]-acceptedDS) : 0) << " "
628  << right << setw(10) << fixed << setprecision(1) << scale*dsAccTotS_[s][ds] << " "
629  << datasetNames_[dsIndex_[s][ds]] << endl;
630  }
631  }
632 
633  } else {
634  LogVerbatim("HLTrigReport") << "HLT-Report - No HLT paths found!" << endl;
635  }
636 
637  LogVerbatim("HLTrigReport") << endl;
638  LogVerbatim("HLTrigReport") << "HLT-Report end!" << endl;
639  LogVerbatim("HLTrigReport") << endl;
640 
641  return;
642 }
643 
644 
645 // declare this class as a framework plugin
#define LogDebug(id)
std::vector< unsigned int > hlErrors_
Definition: HLTrigReport.h:85
size
Write out results.
std::vector< std::vector< std::string > > datasetContents_
Definition: HLTrigReport.h:95
bool isCustomStreams_
Definition: HLTrigReport.h:102
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
bool wasrun() const
Was at least one path run?
bool isCustomDatasets_
Definition: HLTrigReport.h:96
float alpha
Definition: AMPTWrapper.h:95
std::vector< unsigned int > hlAccTot_
Definition: HLTrigReport.h:84
std::vector< std::string > hlNames_
Definition: HLTrigReport.h:89
const std::string moduleType(const std::string &module) const
C++ class name of module.
const ReportEvery resetBy_
Definition: HLTrigReport.h:108
const ReportEvery reportBy_
Definition: HLTrigReport.h:107
const std::vector< std::vector< std::string > > & streamContents() const
names of datasets for all streams
RunNumber_t run() const
Definition: RunBase.h:40
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
std::vector< unsigned int > dsAllTotS_
Definition: HLTrigReport.h:99
const std::vector< unsigned int > & streamCounts() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
std::vector< std::vector< unsigned int > > hlAccTotDS_
Definition: HLTrigReport.h:92
bool accept() const
Has at least one path accepted the event?
const std::vector< std::string > & triggerNames() const
names of trigger paths
const std::vector< std::string > & datasetNames() const
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:63
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:2
unsigned int nWasRun_
Definition: HLTrigReport.h:76
std::vector< std::string > datasetNames_
Definition: HLTrigReport.h:94
double refRate_
Definition: HLTrigReport.h:105
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:30
static ReportEvery decode(const std::string &value)
Definition: HLTrigReport.cc:25
std::string encode() const
Definition: InputTag.cc:166
edm::EDGetTokenT< edm::TriggerResults > hlTriggerResultsToken_
Definition: HLTrigReport.h:72
void beginRun(edm::Run const &, edm::EventSetup const &) override
std::vector< int > posL1s_
Definition: HLTrigReport.h:87
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
Definition: ParameterSet.h:193
LuminosityBlockNumber_t luminosityBlock() const
unsigned int triggerIndex(const std::string &triggerName) const
slot position of trigger path in trigger table (0 to size-1)
std::vector< int > posPre_
Definition: HLTrigReport.h:88
std::vector< unsigned int > hltL1s_
Definition: HLTrigReport.h:81
void endRun(edm::Run const &, edm::EventSetup const &) override
int iEvent
Definition: GenABIO.cc:230
void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
const std::vector< std::string > & streamNames() const
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
unsigned int index(const unsigned int i) const
Get index (slot position) of module giving the decision of the ith path.
RunNumber_t run() const
Definition: Event.h:109
bool error() const
Has any path encountered an error (exception)
void dumpReport(std::string const &header=std::string())
std::vector< std::string > streamNames_
Definition: HLTrigReport.h:100
RunNumber_t run() const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: value.py:1
ParameterDescriptionBase * add(U const &iLabel, T const &value)
bool isValid() const
Definition: HandleBase.h:74
unsigned int nAccept_
Definition: HLTrigReport.h:77
unsigned int refIndex_
Definition: HLTrigReport.h:104
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
std::vector< unsigned int > hlWasRun_
Definition: HLTrigReport.h:80
bool configured_
Definition: HLTrigReport.h:73
std::string refPath_
Definition: HLTrigReport.h:103
HLTConfigProvider hltConfig_
Definition: HLTrigReport.h:110
std::vector< unsigned int > hlAllTotDS_
Definition: HLTrigReport.h:93
std::vector< std::vector< std::string > > streamContents_
Definition: HLTrigReport.h:101
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
const std::vector< unsigned int > & datasetCounts() const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
unsigned int nEvents_
Definition: HLTrigReport.h:75
std::vector< unsigned int > hltPre_
Definition: HLTrigReport.h:82
std::string const & process() const
Definition: InputTag.h:40
unsigned int nErrors_
Definition: HLTrigReport.h:78
const std::vector< std::vector< std::string > > & datasetContents() const
names of trigger paths for all datasets
edm::EventID id() const
Definition: EventBase.h:60
HLT enums.
void reset(bool changed=false)
~HLTrigReport() override
void beginJob() override
HLTrigReport(const edm::ParameterSet &)
Definition: HLTrigReport.cc:48
std::vector< std::vector< unsigned int > > hlIndex_
Definition: HLTrigReport.h:91
void endJob() override
std::vector< unsigned int > hlAccept_
Definition: HLTrigReport.h:83
void analyze(const edm::Event &, const edm::EventSetup &) override
std::vector< std::vector< unsigned int > > dsAccTotS_
Definition: HLTrigReport.h:98
const std::vector< std::string > & streamNames() const
void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
edm::InputTag hlTriggerResults_
Definition: HLTrigReport.h:71
const ReportEvery serviceBy_
Definition: HLTrigReport.h:109
std::vector< std::vector< unsigned int > > dsIndex_
Definition: HLTrigReport.h:97
Definition: Run.h:44
const std::vector< std::string > & datasetNames() const