CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/HLTrigger/HLTanalyzers/src/HLTrigReport.cc

Go to the documentation of this file.
00001 
00012 #include "HLTrigger/HLTanalyzers/interface/HLTrigReport.h"
00013 
00014 #include "DataFormats/Common/interface/Handle.h"
00015 #include "DataFormats/Common/interface/TriggerResults.h"
00016 
00017 #include "FWCore/Common/interface/TriggerNames.h"
00018 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00019 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00020 #include "Math/QuantFuncMathCore.h"
00021 
00022 #include "FWCore/ServiceRegistry/interface/Service.h"
00023 #include "HLTrigger/HLTanalyzers/interface/HLTrigReportService.h"
00024 
00025 #include <iomanip>
00026 #include <cstring>
00027 #include <sstream>
00028 
00029 
00030 HLTrigReport::ReportEvery HLTrigReport::decode(const std::string & value) {
00031   if (value == "never")
00032     return NEVER;
00033 
00034   if (value == "job")
00035     return EVERY_JOB;
00036 
00037   if (value == "run")
00038     return EVERY_RUN;
00039 
00040   if (value == "lumi")
00041     return EVERY_LUMI;
00042 
00043   if (value == "event")
00044     return EVERY_EVENT;
00045   
00046   throw cms::Exception("Configuration") << "Invalid option value \"" << value << "\". Legal values are \"job\", \"run\", \"lumi\", \"event\" and \"never\".";
00047 }
00048 
00049 
00050 //
00051 // constructors and destructor
00052 //
00053 HLTrigReport::HLTrigReport(const edm::ParameterSet& iConfig) :
00054   hlTriggerResults_ (iConfig.getParameter<edm::InputTag> ("HLTriggerResults")),
00055   configured_(false),
00056   nEvents_(0),
00057   nWasRun_(0),
00058   nAccept_(0),
00059   nErrors_(0),
00060   hlWasRun_(0),
00061   hltL1s_(0),
00062   hltPre_(0),
00063   hlAccept_(0),
00064   hlAccTot_(0),
00065   hlErrors_(0),
00066   posL1s_(0),
00067   posPre_(0),
00068   hlNames_(0),
00069   hlIndex_(0),
00070   hlAccTotDS_(0),
00071   datasetNames_(0),
00072   datasetContents_(0),
00073   isCustomDatasets_(false),
00074   dsIndex_(0),
00075   dsAccTotS_(0),
00076   streamNames_(0),
00077   streamContents_(0),
00078   isCustomStreams_(false),
00079   refPath_("HLTriggerFinalPath"),
00080   refIndex_(0),
00081   refRate_(100.0),
00082   reportBy_( decode(iConfig.getUntrackedParameter<std::string>("reportBy",  "job")) ),
00083   resetBy_(  decode(iConfig.getUntrackedParameter<std::string>("resetBy",   "never")) ),
00084   serviceBy_(decode(iConfig.getUntrackedParameter<std::string>("serviceBy", "never")) ),
00085   hltConfig_()
00086 {
00087   const edm::ParameterSet customDatasets(iConfig.getUntrackedParameter<edm::ParameterSet>("CustomDatasets", edm::ParameterSet()));
00088   isCustomDatasets_ = (customDatasets != edm::ParameterSet());
00089   if (isCustomDatasets_) {
00090     datasetNames_ = customDatasets.getParameterNamesForType<std::vector<std::string> >();
00091     for (std::vector<std::string>::const_iterator name = datasetNames_.begin(); name != datasetNames_.end(); name++) {
00092       datasetContents_.push_back(customDatasets.getParameter<std::vector<std::string> >(*name));
00093     }
00094   }
00095 
00096   const edm::ParameterSet customStreams (iConfig.getUntrackedParameter<edm::ParameterSet>("CustomStreams" , edm::ParameterSet()));
00097   isCustomStreams_  = (customStreams  != edm::ParameterSet());
00098   if (isCustomStreams_ ) {
00099     streamNames_ = customStreams.getParameterNamesForType<std::vector<std::string> >();
00100     for (std::vector<std::string>::const_iterator name = streamNames_.begin(); name != streamNames_.end(); name++) {
00101       streamContents_.push_back(customStreams.getParameter<std::vector<std::string> >(*name));
00102     }
00103   }
00104 
00105   refPath_ = iConfig.getUntrackedParameter<std::string>("ReferencePath","HLTriggerFinalPath");
00106   refRate_ = iConfig.getUntrackedParameter<double>("ReferenceRate", 100.0);
00107   refIndex_= 0;
00108 
00109   LogDebug("HLTrigReport")
00110     << "HL TiggerResults: " + hlTriggerResults_.encode()
00111     << " using reference path and rate: " + refPath_ + " " << refRate_;
00112 
00113   if (serviceBy_ != NEVER and edm::Service<HLTrigReportService>()) {
00114     edm::Service<HLTrigReportService>()->registerModule(this);
00115   }
00116 
00117 }
00118 
00119 HLTrigReport::~HLTrigReport() { }
00120 
00121 //
00122 // member functions
00123 //
00124 
00125 const std::vector<std::string>& HLTrigReport::datasetNames() const {
00126   return datasetNames_;
00127 }
00128 const std::vector<std::string>& HLTrigReport::streamNames() const {
00129   return streamNames_;
00130 }
00131 const std::vector<unsigned int>& HLTrigReport::datasetCounts() const {
00132   return hlAllTotDS_;
00133 }
00134 const std::vector<unsigned int>& HLTrigReport::streamCounts() const {
00135   return dsAllTotS_;
00136 }
00137 
00138 void HLTrigReport::reset(bool changed /* = false */) {
00139 
00140   // reset global counters
00141   nEvents_ = 0;
00142   nWasRun_ = 0;
00143   nAccept_ = 0;
00144   nErrors_ = 0;
00145 
00146   // update trigger names
00147   if (changed)
00148     hlNames_ = hltConfig_.triggerNames();
00149 
00150   const unsigned int n = hlNames_.size();
00151 
00152   if (changed) {
00153     // resize per-path counters
00154     hlWasRun_.resize(n);
00155     hltL1s_.resize(n);
00156     hltPre_.resize(n);
00157     hlAccept_.resize(n);
00158     hlAccTot_.resize(n);
00159     hlErrors_.resize(n);
00160     // find the positions of seeding and prescaler modules
00161     posL1s_.resize(n);
00162     posPre_.resize(n);
00163     for (unsigned int i = 0; i < n; ++i) {
00164       posL1s_[i] = -1;
00165       posPre_[i] = -1;
00166       const std::vector<std::string> & moduleLabels(hltConfig_.moduleLabels(i));
00167       for (unsigned int j = 0; j < moduleLabels.size(); ++j) {
00168         const std::string & label = hltConfig_.moduleType(moduleLabels[j]);
00169         if (label == "HLTLevel1GTSeed")
00170           posL1s_[i] = j;
00171         else if (label == "HLTPrescaler")
00172           posPre_[i] = j;
00173       }
00174     }
00175   }
00176 
00177   // reset per-path counters
00178   for (unsigned int i = 0; i < n; ++i) {
00179     hlWasRun_[i] = 0;
00180     hltL1s_[i]   = 0;
00181     hltPre_[i]   = 0;
00182     hlAccept_[i] = 0;
00183     hlAccTot_[i] = 0;
00184     hlErrors_[i] = 0;
00185   }
00186 
00187   // if not overridden, reload the datasets and streams
00188   if (changed and not isCustomDatasets_) {
00189     datasetNames_    = hltConfig_.datasetNames();
00190     datasetContents_ = hltConfig_.datasetContents();
00191   }
00192   if (changed and not isCustomStreams_) {
00193     streamNames_     = hltConfig_.streamNames();
00194     streamContents_  = hltConfig_.streamContents();
00195   }
00196 
00197   if (changed) {
00198     // fill the matrices of hlIndex_, hlAccTotDS_
00199     hlIndex_.clear();
00200     hlIndex_.resize(datasetNames_.size());
00201     hlAccTotDS_.clear();
00202     hlAllTotDS_.clear();
00203     hlAccTotDS_.resize(datasetNames_.size());
00204     hlAllTotDS_.resize(datasetNames_.size());
00205     for (unsigned int ds = 0; ds < datasetNames_.size(); ds++) {
00206       unsigned int size = datasetContents_[ds].size();
00207       hlIndex_[ds].reserve(size);
00208       hlAccTotDS_[ds].reserve(size);
00209       hlAllTotDS_[ds]=0;
00210       for (unsigned int p = 0; p < size; ++p) {
00211         unsigned int i = hltConfig_.triggerIndex(datasetContents_[ds][p]);
00212         if (i<n) {
00213           hlIndex_[ds].push_back(i);
00214           hlAccTotDS_[ds].push_back(0);
00215         }
00216       }
00217     }
00218   } else {
00219     // reset the matrix of hlAccTotDS_
00220     for (unsigned int ds = 0; ds < datasetNames_.size(); ds++) {
00221       hlAllTotDS_[ds]=0;
00222       for (unsigned int i = 0; i < hlAccTotDS_[ds].size(); ++i)
00223           hlAccTotDS_[ds][i] = 0;
00224     }
00225   }
00226 
00227   if (changed) {
00228     // fill the matrices of dsIndex_, dsAccTotS_
00229     dsIndex_.clear();
00230     dsIndex_.resize(streamNames_.size());
00231     dsAccTotS_.clear();
00232     dsAllTotS_.clear();
00233     dsAccTotS_.resize(streamNames_.size());
00234     dsAllTotS_.resize(streamNames_.size());
00235     for (unsigned int s = 0; s < streamNames_.size(); ++s) {
00236       unsigned int size = streamContents_[s].size();
00237       dsIndex_.reserve(size);
00238       dsAccTotS_.reserve(size);
00239       dsAllTotS_[s]=0;
00240       for (unsigned int ds = 0; ds < size; ++ds) {
00241         unsigned int i = 0;
00242         for (; i<datasetNames_.size(); i++) if (datasetNames_[i] == streamContents_[s][ds]) 
00243           break;
00244         // report only datasets that have at least one path otherwise crash
00245         if (i < datasetNames_.size() and hlIndex_[i].size() > 0) {
00246           dsIndex_[s].push_back(i);
00247           dsAccTotS_[s].push_back(0);
00248         }
00249       }
00250     }
00251   } else {
00252     // reset the matrix of dsAccTotS_
00253     for (unsigned int s = 0; s < streamNames_.size(); ++s) {
00254       dsAllTotS_[s]=0;
00255       for (unsigned int i = 0; i < dsAccTotS_[s].size(); ++i)
00256         dsAccTotS_[s][i] = 0;
00257     }
00258   }
00259 
00260   // if needed, update the reference path
00261   if (changed) {
00262     refIndex_ = hltConfig_.triggerIndex(refPath_);
00263     if (refIndex_ >= n) {
00264       refIndex_ = 0;
00265       edm::LogWarning("HLTrigReport")
00266         << "Requested reference path '"+refPath_+"' not in HLT menu. "
00267         << "Using HLTriggerFinalPath instead.";
00268       refPath_ = "HLTriggerFinalPath";
00269       refIndex_ = hltConfig_.triggerIndex(refPath_);
00270       if (refIndex_ >= n) {
00271         refIndex_ = 0;
00272         edm::LogWarning("HLTrigReport")
00273           << "Requested reference path '"+refPath_+"' not in HLT menu. "
00274           << "Using first path in table (index=0) instead.";
00275       }
00276     }
00277   }
00278 
00279   if (changed and serviceBy_ != NEVER and edm::Service<HLTrigReportService>()) {
00280     edm::Service<HLTrigReportService>()->setDatasetNames(datasetNames_);
00281     edm::Service<HLTrigReportService>()->setStreamNames(streamNames_);
00282   }
00283 
00284 }
00285 
00286 void HLTrigReport::beginJob() {
00287   if (resetBy_ == EVERY_JOB)
00288     reset();
00289 }
00290 
00291 void HLTrigReport::endJob() {
00292   if (reportBy_ == EVERY_JOB)
00293     dumpReport("Summary for Job");
00294   if (serviceBy_ == EVERY_JOB and edm::Service<HLTrigReportService>()) {
00295     edm::Service<HLTrigReportService>()->setDatasetCounts(datasetCounts());
00296     edm::Service<HLTrigReportService>()->setStreamCounts(streamCounts());
00297   }
00298 
00299 }
00300 
00301 void
00302 HLTrigReport::beginRun(edm::Run const & iRun, edm::EventSetup const& iSetup)
00303 {
00304   bool changed = true;
00305   if (hltConfig_.init(iRun, iSetup, hlTriggerResults_.process(), changed)) {
00306     configured_ = true;
00307     if (changed) {
00308       dumpReport("Summary for this HLT table");
00309       reset(true);
00310     }
00311   } else {
00312     dumpReport("Summary for this HLT table");
00313     // cannot initialize the HLT menu - reset and clear all counters and tables
00314     configured_ = false;
00315     nEvents_    = 0;
00316     nWasRun_    = 0;
00317     nAccept_    = 0;
00318     nErrors_    = 0;
00319     hlWasRun_.clear();
00320     hltL1s_.clear();
00321     hltPre_.clear();
00322     hlAccept_.clear();
00323     hlAccTot_.clear();
00324     hlErrors_.clear();
00325     posL1s_.clear();
00326     posPre_.clear();
00327     hlNames_.clear();
00328     hlIndex_.clear();
00329     hlAccTotDS_.clear();
00330     hlAllTotDS_.clear();
00331     dsIndex_.clear();
00332     dsAccTotS_.clear();
00333     dsAllTotS_.clear();
00334   }
00335 
00336   if (resetBy_ == EVERY_RUN) reset();
00337 
00338 }
00339 
00340 void HLTrigReport::endRun(edm::Run const & run, edm::EventSetup const & setup) {
00341   if (reportBy_ == EVERY_RUN) {
00342     std::stringstream stream;
00343     stream << "Summary for Run " << run.run();
00344     dumpReport(stream.str());
00345   }
00346   if (serviceBy_ == EVERY_RUN and edm::Service<HLTrigReportService>()) {
00347     edm::Service<HLTrigReportService>()->setDatasetCounts(datasetCounts());
00348     edm::Service<HLTrigReportService>()->setStreamCounts(streamCounts());
00349   }
00350 }
00351 
00352 void HLTrigReport::beginLuminosityBlock(edm::LuminosityBlock const & lumi, edm::EventSetup const & setup) {
00353   if (resetBy_ == EVERY_LUMI) reset();
00354 }
00355 
00356 void HLTrigReport::endLuminosityBlock(edm::LuminosityBlock const & lumi, edm::EventSetup const & setup) {
00357   if (reportBy_ == EVERY_LUMI) {
00358     std::stringstream stream;
00359     stream << "Summary for Run " << lumi.run() << ", LumiSection " << lumi.luminosityBlock();
00360     dumpReport(stream.str());
00361   }
00362   if (serviceBy_ == EVERY_LUMI and edm::Service<HLTrigReportService>()) {
00363     edm::Service<HLTrigReportService>()->setDatasetCounts(datasetCounts());
00364     edm::Service<HLTrigReportService>()->setStreamCounts(streamCounts());
00365   }
00366 }
00367 
00368 
00369 // ------------ method called to produce the data  ------------
00370 void
00371 HLTrigReport::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
00372 {
00373   // accumulation of statistics event by event
00374 
00375   using namespace std;
00376   using namespace edm;
00377 
00378   if (resetBy_ == EVERY_EVENT) reset();
00379 
00380   nEvents_++;
00381 
00382   // get hold of TriggerResults
00383   Handle<TriggerResults> HLTR;
00384   iEvent.getByLabel(hlTriggerResults_, HLTR);
00385   if (HLTR.isValid()) {
00386     if (HLTR->wasrun()) nWasRun_++;
00387     const bool accept(HLTR->accept());
00388     LogDebug("HLTrigReport") << "HLT TriggerResults decision: " << accept;
00389     if (accept) ++nAccept_;
00390     if (HLTR->error()) nErrors_++;
00391   } else {
00392     LogDebug("HLTrigReport") << "HLT TriggerResults with label ["+hlTriggerResults_.encode()+"] not found!";
00393     nErrors_++;
00394     return;
00395   }
00396 
00397   // HLTConfigProvider not configured - cannot produce any detailed statistics
00398   if (not configured_)
00399     return;
00400 
00401   // decision for each HL algorithm
00402   const unsigned int n(hlNames_.size());
00403   bool acceptedByPrevoiusPaths = false;
00404   for (unsigned int i=0; i!=n; ++i) {
00405     if (HLTR->wasrun(i)) hlWasRun_[i]++;
00406     if (HLTR->accept(i)) {
00407       acceptedByPrevoiusPaths = true;
00408       hlAccept_[i]++;
00409     }
00410     if (acceptedByPrevoiusPaths) hlAccTot_[i]++;
00411     if (HLTR->error(i) ) hlErrors_[i]++;
00412     const int index(static_cast<int>(HLTR->index(i)));
00413     if (HLTR->accept(i)) {
00414       if (index >= posL1s_[i]) hltL1s_[i]++;
00415       if (index >= posPre_[i]) hltPre_[i]++;
00416     } else {
00417       if (index >  posL1s_[i]) hltL1s_[i]++;
00418       if (index >  posPre_[i]) hltPre_[i]++;
00419     }
00420   }
00421 
00422   // calculate accumulation of accepted events by a path within a dataset
00423   std::vector<bool> acceptedByDS(hlIndex_.size(), false);
00424   for (size_t ds=0; ds<hlIndex_.size(); ++ds) {
00425     for (size_t p=0; p<hlIndex_[ds].size(); ++p) {
00426       if (acceptedByDS[ds] or HLTR->accept(hlIndex_[ds][p])) {
00427         acceptedByDS[ds] = true;
00428         hlAccTotDS_[ds][p]++;
00429       }
00430     }
00431     if (acceptedByDS[ds]) hlAllTotDS_[ds]++;
00432   }
00433 
00434   // calculate accumulation of accepted events by a dataset within a stream
00435   for (size_t s=0; s<dsIndex_.size(); ++s) {
00436     bool acceptedByS = false;
00437     for (size_t ds=0; ds<dsIndex_[s].size(); ++ds) {
00438       if (acceptedByS or acceptedByDS[dsIndex_[s][ds]]) {
00439         acceptedByS = true;
00440         dsAccTotS_[s][ds]++;
00441       }
00442     }
00443     if (acceptedByS) dsAllTotS_[s]++;
00444   }
00445 
00446   if (reportBy_ == EVERY_EVENT) {
00447     std::stringstream stream;
00448     stream << "Summary for Run " << iEvent.run() << ", LumiSection " << iEvent.luminosityBlock() << ", Event " << iEvent.id();
00449     dumpReport(stream.str());
00450   }
00451   if (serviceBy_ == EVERY_EVENT and edm::Service<HLTrigReportService>()) {
00452     edm::Service<HLTrigReportService>()->setDatasetCounts(datasetCounts());
00453     edm::Service<HLTrigReportService>()->setStreamCounts(streamCounts());
00454   }
00455 
00456 }
00457 
00458 void
00459 HLTrigReport::dumpReport(std::string const & header /* = std::string() */)
00460 {
00461   // final printout of accumulated statistics
00462 
00463   using namespace std;
00464   using namespace edm;
00465   const unsigned int n(hlNames_.size());
00466 
00467   if ((n==0) and (nEvents_==0)) return;
00468 
00469   LogVerbatim("HLTrigReport") << dec << endl;
00470   LogVerbatim("HLTrigReport") << "HLT-Report " << "---------- Event  Summary ------------" << endl;
00471   if (not header.empty())
00472     LogVerbatim("HLTrigReport") << "HLT-Report " << header << endl;
00473   LogVerbatim("HLTrigReport") << "HLT-Report"
00474          << " Events total = " << nEvents_
00475          << " wasrun = " << nWasRun_
00476          << " passed = " << nAccept_
00477          << " errors = " << nErrors_
00478          << endl;
00479 
00480   // HLTConfigProvider not configured - cannot produce any detailed statistics
00481   if (not configured_)
00482     return;
00483 
00484   double scale = hlAccept_[refIndex_]>0 ? refRate_/hlAccept_[refIndex_] : 0.;
00485   double alpha = 1 - (1.0 - .6854)/2; // for the Clopper-Pearson 68% CI
00486 
00487   LogVerbatim("HLTrigReport") << endl;
00488   LogVerbatim("HLTrigReport") << "HLT-Report " << "---------- HLTrig Summary ------------" << endl;
00489   LogVerbatim("HLTrigReport") << "HLT-Report "
00490          << right << setw(7) << "HLT #" << " "
00491          << right << setw(7) << "WasRun" << " "
00492          << right << setw(7) << "L1S" << " "
00493          << right << setw(7) << "Pre" << " "
00494          << right << setw(7) << "HLT" << " "
00495          << right << setw(9) << "%L1sPre" << " "
00496          << right << setw(7) << "Rate" << " "
00497          << right << setw(7) << "RateHi" << " "
00498          << right << setw(7) << "HLTtot" << " "
00499          << right << setw(7) << "RateTot" << " "
00500          << right << setw(7) << "Errors" << " "
00501          << "Name" << endl;
00502 
00503   if (n>0) {
00504     for (unsigned int i=0; i!=n; ++i) {
00505       LogVerbatim("HLTrigReport") << "HLT-Report "
00506            << right << setw(7) << i << " "
00507            << right << setw(7) << hlWasRun_[i] << " "
00508            << right << setw(7) << hltL1s_[i] << " "
00509            << right << setw(7) << hltPre_[i] << " "
00510            << right << setw(7) << hlAccept_[i] << " "
00511            << right << setw(9) << fixed << setprecision(5)
00512            << static_cast<float>(100*hlAccept_[i])/
00513               static_cast<float>(max(hltPre_[i], 1u)) << " "
00514            << right << setw(7) << fixed << setprecision(1) << scale*hlAccept_[i] << " "
00515            << right << setw(7) << fixed << setprecision(1) <<
00516               ((hlAccept_[refIndex_]-hlAccept_[i] > 0) ? refRate_*ROOT::Math::beta_quantile(alpha, hlAccept_[i]+1, hlAccept_[refIndex_]-hlAccept_[i]) : 0) << " "
00517            << right << setw(7) << hlAccTot_[i] << " "
00518            << right << setw(7) << fixed << setprecision(1) << scale*hlAccTot_[i] << " "
00519            << right << setw(7) << hlErrors_[i] << " "
00520            << hlNames_[i] << endl;
00521     }
00522 
00523     // now for each dataset
00524     for (size_t ds=0; ds<hlIndex_.size(); ++ds) {
00525       LogVerbatim("HLTrigReport") << endl;
00526       LogVerbatim("HLTrigReport") << "HLT-Report " << "---------- Dataset Summary: " << datasetNames_[ds] << " ------------" << hlAllTotDS_[ds] << endl;
00527       LogVerbatim("HLTrigReport") << "HLT-Report "
00528          << right << setw(7) << "HLT #" << " "
00529          << right << setw(7) << "WasRun" << " "
00530          << right << setw(7) << "L1S" << " "
00531          << right << setw(7) << "Pre" << " "
00532          << right << setw(7) << "HLT" << " "
00533          << right << setw(9) << "%L1sPre" << " "
00534          << right << setw(7) << "Rate" << " "
00535          << right << setw(7) << "RateHi" << " "
00536          << right << setw(7) << "HLTtot" << " "
00537          << right << setw(7) << "RateTot" << " "
00538          << right << setw(7) << "Errors" << " "
00539          << "Name" << endl;
00540       for (size_t p=0; p<hlIndex_[ds].size(); ++p) {
00541         LogVerbatim("HLTrigReport") << "HLT-Report "
00542            << right << setw(7) << p << " "
00543            << right << setw(7) << hlWasRun_[hlIndex_[ds][p]] << " "
00544            << right << setw(7) << hltL1s_[hlIndex_[ds][p]] << " "
00545            << right << setw(7) << hltPre_[hlIndex_[ds][p]] << " "
00546            << right << setw(7) << hlAccept_[hlIndex_[ds][p]] << " "
00547            << right << setw(9) << fixed << setprecision(5)
00548            << static_cast<float>(100*hlAccept_[hlIndex_[ds][p]])/
00549               static_cast<float>(max(hltPre_[hlIndex_[ds][p]], 1u)) << " "
00550            << right << setw(7) << fixed << setprecision(1) << scale*hlAccept_[hlIndex_[ds][p]] << " "
00551            << right << setw(7) << fixed << setprecision(1) <<
00552               ((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) << " "
00553            << right << setw(7) << hlAccTotDS_[ds][p] << " "
00554            << right << setw(7) << fixed << setprecision(1) << scale*hlAccTotDS_[ds][p] << " "
00555            << right << setw(7) << hlErrors_[hlIndex_[ds][p]] << " "
00556            << hlNames_[hlIndex_[ds][p]] << endl;
00557       }
00558     }
00559 
00560     // now for each stream
00561     for (size_t s=0; s<dsIndex_.size(); ++s) {
00562       LogVerbatim("HLTrigReport") << endl;
00563       LogVerbatim("HLTrigReport") << "HLT-Report " << "---------- Stream Summary: " << streamNames_[s] << " ------------" << dsAllTotS_[s] << endl;
00564       LogVerbatim("HLTrigReport") << "HLT-Report "
00565          << right << setw(10) << "Dataset #" << " "
00566          << right << setw(10) << "Individual" << " "
00567          << right << setw(10) << "Total" << " "
00568          << right << setw(10) << "Rate" << " "
00569          << right << setw(10) << "RateHi" << " "
00570          << right << setw(10) << "RateTot" << " "
00571          << "Name" << endl;
00572       for (size_t ds=0;ds<dsIndex_[s].size(); ++ds) {
00573         unsigned int acceptedDS = hlAccTotDS_[dsIndex_[s][ds]][hlIndex_[dsIndex_[s][ds]].size()-1];
00574         LogVerbatim("HLTrigReport") << "HLT-Report "
00575            << right << setw(10) << ds << " "
00576            << right << setw(10) << acceptedDS << " "
00577            << right << setw(10) << dsAccTotS_[s][ds] << " "
00578            << right << setw(10) << fixed << setprecision(1) << scale*acceptedDS << " "
00579            << right << setw(10) << fixed << setprecision(1) <<
00580               ((hlAccept_[refIndex_]-acceptedDS > 0) ? refRate_*ROOT::Math::beta_quantile(alpha, acceptedDS+1, hlAccept_[refIndex_]-acceptedDS) : 0) << " "
00581            << right << setw(10) << fixed << setprecision(1) << scale*dsAccTotS_[s][ds] << " "
00582            << datasetNames_[dsIndex_[s][ds]] << endl;
00583       }
00584     }
00585 
00586   } else {
00587     LogVerbatim("HLTrigReport") << "HLT-Report - No HLT paths found!" << endl;
00588   }
00589 
00590   LogVerbatim("HLTrigReport") << endl;
00591   LogVerbatim("HLTrigReport") << "HLT-Report end!" << endl;
00592   LogVerbatim("HLTrigReport") << endl;
00593 
00594   return;
00595 }