20 #include "Math/QuantFuncMathCore.h"
40 throw cms::Exception(
"Configuration") <<
"Invalid option value \"" << value
41 <<
"\". Legal values are \"job\", \"run\", \"lumi\", \"event\" and \"never\".";
62 std::vector<std::vector<unsigned int> >
const& hlIndex,
63 std::vector<std::vector<unsigned int> >
const& dsIndex)
68 hlWasRun_(numHLNames),
71 hlAccept_(numHLNames),
72 hlAccTot_(numHLNames),
73 hlErrors_(numHLNames),
74 hlAccTotDS_(hlIndex.
size()),
75 hlAllTotDS_(hlIndex.
size()),
76 dsAccTotS_(dsIndex.
size()),
77 dsAllTotS_(dsIndex.
size()) {
78 for (
size_t ds = 0; ds < hlIndex.size(); ++ds) {
82 for (
size_t s = 0;
s < dsIndex.size(); ++
s) {
93 auto vsum = [](
auto&
to,
auto const& from) {
94 for (
size_t i = 0;
i < from.size(); ++
i) {
111 auto vvsum = [](
auto&
to,
auto const& from) {
112 for (
size_t i = 0;
i < from.size(); ++
i) {
114 for (
size_t j = 0;
j < from[
i].size(); ++
j) {
142 auto vvreset = [&vreset](
auto&
to) {
148 vvreset(hlAccTotDS_);
153 : hlTriggerResults_(iConfig.getParameter<edm::
InputTag>(
"HLTriggerResults")),
154 hlTriggerResultsToken_(consumes<edm::TriggerResults>(hlTriggerResults_)),
162 isCustomDatasets_(
false),
166 isCustomStreams_(
false),
167 refPath_(
"HLTriggerFinalPath"),
169 refRate_(iConfig.getUntrackedParameter<double>(
"ReferenceRate", 100.0)),
170 reportBy_(
decode(iConfig.getUntrackedParameter<std::
string>(
"reportBy",
"job"))),
171 resetBy_(
decode(iConfig.getUntrackedParameter<std::
string>(
"resetBy",
"never"))),
172 serviceBy_(
decode(iConfig.getUntrackedParameter<std::
string>(
"serviceBy",
"never"))),
221 descriptions.
add(
"hltTrigReport", desc);
240 for (
unsigned int i = 0;
i <
n; ++
i) {
244 for (
unsigned int j = 0;
j < moduleLabels.size(); ++
j) {
246 if (label ==
"HLTLevel1GTSeed")
248 else if (label ==
"HLTPrescaler")
269 for (
unsigned int p = 0;
p <
size; ++
p) {
283 for (
unsigned int ds = 0; ds <
size; ++ds) {
300 <<
"Using HLTriggerFinalPath instead.";
306 <<
"Using first path in table (index=0) instead.";
355 stream <<
"Summary for Run " << run.
run();
367 return std::make_shared<Accumulate>();
371 return std::shared_ptr<Accumulate>();
389 stream <<
"Summary for Run " << lumi.
run() <<
", LumiSection " << lumi.
luminosityBlock();
420 accumulate.nEvents_++;
425 if (HLTR.isValid()) {
427 accumulate.nWasRun_++;
428 const bool accept(HLTR->accept());
429 LogDebug(
"HLTrigReport") <<
"HLT TriggerResults decision: " <<
accept;
431 ++accumulate.nAccept_;
433 accumulate.nErrors_++;
436 accumulate.nErrors_++;
446 bool acceptedByPrevoiusPaths =
false;
447 for (
unsigned int i = 0;
i !=
n; ++
i) {
449 accumulate.hlWasRun_[
i]++;
450 if (HLTR->accept(
i)) {
451 acceptedByPrevoiusPaths =
true;
452 accumulate.hlAccept_[
i]++;
454 if (acceptedByPrevoiusPaths)
455 accumulate.hlAccTot_[
i]++;
457 accumulate.hlErrors_[
i]++;
458 const int index(static_cast<int>(HLTR->index(
i)));
459 if (HLTR->accept(
i)) {
461 accumulate.hltL1s_[
i]++;
463 accumulate.hltPre_[
i]++;
466 accumulate.hltL1s_[
i]++;
468 accumulate.hltPre_[
i]++;
473 std::vector<bool> acceptedByDS(
hlIndex_.size(),
false);
474 for (
size_t ds = 0; ds <
hlIndex_.size(); ++ds) {
476 if (acceptedByDS[ds]
or HLTR->accept(
hlIndex_[ds][
p])) {
477 acceptedByDS[ds] =
true;
478 accumulate.hlAccTotDS_[ds][
p]++;
481 if (acceptedByDS[ds])
482 accumulate.hlAllTotDS_[ds]++;
487 bool acceptedByS =
false;
488 for (
size_t ds = 0; ds <
dsIndex_[
s].size(); ++ds) {
489 if (acceptedByS
or acceptedByDS[
dsIndex_[
s][ds]]) {
491 accumulate.dsAccTotS_[
s][ds]++;
495 accumulate.dsAllTotS_[
s]++;
500 stream <<
"Summary for Run " << iEvent.
run() <<
", LumiSection " << iEvent.
luminosityBlock() <<
", Event "
525 if ((
n == 0) and (accumulate.
nEvents_ == 0))
530 <<
"---------- Event Summary ------------" << endl;
531 if (not header.empty())
532 LogVerbatim(
"HLTrigReport") <<
"HLT-Report " << header << endl;
534 <<
" Events total = " << accumulate.
nEvents_ <<
" wasrun = " << accumulate.
nWasRun_
535 <<
" passed = " << accumulate.
nAccept_ <<
" errors = " << accumulate.
nErrors_ << endl;
542 double alpha = 1 - (1.0 - .6854) / 2;
546 <<
"---------- HLTrig Summary ------------" << endl;
547 LogVerbatim(
"HLTrigReport") <<
"HLT-Report " << right << setw(7) <<
"HLT #"
548 <<
" " << right << setw(7) <<
"WasRun"
549 <<
" " << right << setw(7) <<
"L1S"
550 <<
" " << right << setw(7) <<
"Pre"
551 <<
" " << right << setw(7) <<
"HLT"
552 <<
" " << right << setw(9) <<
"%L1sPre"
553 <<
" " << right << setw(7) <<
"Rate"
554 <<
" " << right << setw(7) <<
"RateHi"
555 <<
" " << right << setw(7) <<
"Errors"
560 for (
unsigned int i = 0;
i !=
n; ++
i) {
562 <<
"HLT-Report " << right << setw(7) <<
i <<
" " << right << setw(7) << accumulate.
hlWasRun_[
i] <<
" "
563 << right << setw(7) << accumulate.
hltL1s_[
i] <<
" " << right << setw(7) << accumulate.
hltPre_[
i] <<
" "
564 << right << setw(7) << accumulate.
hlAccept_[
i] <<
" " << right << setw(9) << fixed << setprecision(5)
565 <<
static_cast<float>(100 * accumulate.
hlAccept_[
i]) / static_cast<float>(
max(accumulate.
hltPre_[
i], 1u))
566 <<
" " << right << setw(7) << fixed << setprecision(1) <<
scale * accumulate.
hlAccept_[
i] <<
" " << right
567 << setw(7) << fixed << setprecision(1)
579 <<
"---------- HLTrig Summary ------------" << endl;
580 LogVerbatim(
"HLTrigRprtTt") <<
"HLT-Report " << right << setw(7) <<
"HLT #"
581 <<
" " << right << setw(7) <<
"WasRun"
582 <<
" " << right << setw(7) <<
"L1S"
583 <<
" " << right << setw(7) <<
"Pre"
584 <<
" " << right << setw(7) <<
"HLT"
585 <<
" " << right << setw(9) <<
"%L1sPre"
586 <<
" " << right << setw(7) <<
"Rate"
587 <<
" " << right << setw(7) <<
"RateHi"
588 <<
" " << right << setw(7) <<
"HLTtot"
589 <<
" " << right << setw(7) <<
"RateTot"
590 <<
" " << right << setw(7) <<
"Errors"
595 for (
unsigned int i = 0;
i !=
n; ++
i) {
597 <<
"HLT-Report " << right << setw(7) <<
i <<
" " << right << setw(7) << accumulate.
hlWasRun_[
i] <<
" "
598 << right << setw(7) << accumulate.
hltL1s_[
i] <<
" " << right << setw(7) << accumulate.
hltPre_[
i] <<
" "
599 << right << setw(7) << accumulate.
hlAccept_[
i] <<
" " << right << setw(9) << fixed << setprecision(5)
600 <<
static_cast<float>(100 * accumulate.
hlAccept_[
i]) / static_cast<float>(
max(accumulate.
hltPre_[
i], 1u))
601 <<
" " << right << setw(7) << fixed << setprecision(1) <<
scale * accumulate.
hlAccept_[
i] <<
" " << right
602 << setw(7) << fixed << setprecision(1)
608 <<
" " << right << setw(7) << accumulate.
hlAccTot_[
i] <<
" " << right << setw(7) << fixed << setprecision(1)
614 for (
size_t ds = 0; ds <
hlIndex_.size(); ++ds) {
617 <<
"---------- Dataset Summary: " <<
datasetNames_[ds] <<
" ------------"
619 LogVerbatim(
"HLTrigRprtPD") <<
"HLT-Report " << right << setw(7) <<
"HLT #"
620 <<
" " << right << setw(7) <<
"WasRun"
621 <<
" " << right << setw(7) <<
"L1S"
622 <<
" " << right << setw(7) <<
"Pre"
623 <<
" " << right << setw(7) <<
"HLT"
624 <<
" " << right << setw(9) <<
"%L1sPre"
625 <<
" " << right << setw(7) <<
"Rate"
626 <<
" " << right << setw(7) <<
"RateHi"
627 <<
" " << right << setw(7) <<
"HLTtot"
628 <<
" " << right << setw(7) <<
"RateTot"
629 <<
" " << right << setw(7) <<
"Errors"
634 <<
"HLT-Report " << right << setw(7) <<
p <<
" " << right << setw(7)
636 <<
" " << right << setw(7) << accumulate.
hltPre_[
hlIndex_[ds][
p]] <<
" " << right << setw(7)
637 << accumulate.
hlAccept_[
hlIndex_[ds][
p]] <<
" " << right << setw(9) << fixed << setprecision(5)
641 <<
" " << right << setw(7) << fixed << setprecision(1)
643 ?
refRate_ * ROOT::Math::beta_quantile(
648 <<
" " << right << setw(7) << accumulate.
hlAccTotDS_[ds][
p] <<
" " << right << setw(7) << fixed
649 << setprecision(1) <<
scale * accumulate.
hlAccTotDS_[ds][
p] <<
" " << right << setw(7)
658 <<
"---------- Stream Summary: " <<
streamNames_[
s] <<
" ------------"
660 LogVerbatim(
"HLTrigRprtST") <<
"HLT-Report " << right << setw(10) <<
"Dataset #"
661 <<
" " << right << setw(10) <<
"Individual"
662 <<
" " << right << setw(10) <<
"Total"
663 <<
" " << right << setw(10) <<
"Rate"
664 <<
" " << right << setw(10) <<
"RateHi"
665 <<
" " << right << setw(10) <<
"RateTot"
668 for (
size_t ds = 0; ds <
dsIndex_[
s].size(); ++ds) {
671 <<
"HLT-Report " << right << setw(10) << ds <<
" " << right << setw(10) << acceptedDS <<
" " << right
672 << setw(10) << accumulate.
dsAccTotS_[
s][ds] <<
" " << right << setw(10) << fixed << setprecision(1)
673 <<
scale * acceptedDS <<
" " << right << setw(10) << fixed << setprecision(1)
678 <<
" " << right << setw(10) << fixed << setprecision(1) <<
scale * accumulate.
dsAccTotS_[
s][ds] <<
" "
684 LogVerbatim(
"HLTrigReport") <<
"HLT-Report - No HLT paths found!" << endl;
688 LogVerbatim(
"HLTrigReport") <<
"HLT-Report end!" << endl;
std::vector< std::vector< std::string > > datasetContents_
Log< level::Info, true > LogVerbatim
T getUntrackedParameter(std::string const &, T const &) const
std::vector< unsigned int > hlAllTotDS_
hltrigreport::Accumulate & chooseAccumulate(edm::LuminosityBlockIndex index)
std::vector< std::string > hlNames_
const std::string moduleType(const std::string &module) const
C++ class name of module.
const ReportEvery resetBy_
const ReportEvery reportBy_
const std::vector< std::vector< std::string > > & streamContents() const
names of datasets for all streams
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
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::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
LuminosityBlockIndex index() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< unsigned int > hlAccTot_
#define DEFINE_FWK_MODULE(type)
void dumpReport(hltrigreport::Accumulate const &accumulate, std::string const &header=std::string()) const
std::vector< std::vector< unsigned int > > hlAccTotDS_
const std::vector< std::string > & triggerNames() const
names of trigger paths
const std::vector< std::string > & datasetNames() const
edm::LuminosityBlockNumber_t luminosityBlock() const
std::vector< std::string > datasetNames_
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
static ReportEvery decode(const std::string &value)
void beginRun(edm::Run const &, edm::EventSetup const &) override
std::vector< int > posL1s_
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
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_
void endRun(edm::Run const &, edm::EventSetup const &) override
const std::vector< std::string > & streamNames() const
virtual void setStreamCounts(const std::vector< unsigned int > &)=0
if(conf_.getParameter< bool >("UseStripCablingDB"))
bool decode(bool &, std::string const &)
std::vector< std::string > streamNames_
LuminosityBlock const & getLuminosityBlock() const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void updateService(Accumulate const &accumulate) const
ParameterDescriptionBase * add(U const &iLabel, T const &value)
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
const edm::EDGetTokenT< edm::TriggerResults > hlTriggerResultsToken_
void fill(std::map< std::string, TH1 * > &h, const std::string &s, double x)
hltrigreport::Accumulate accumulate_
HLTConfigProvider hltConfig_
std::vector< std::vector< std::string > > streamContents_
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
T getParameter(std::string const &) const
std::shared_ptr< Accumulate > globalBeginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) const override
void add(std::string const &label, ParameterSetDescription const &psetDescription)
bool readAfterLumi() const
void globalEndLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
std::vector< std::vector< unsigned int > > dsAccTotS_
const std::vector< std::vector< std::string > > & datasetContents() const
names of trigger paths for all datasets
HLTrigReport(const edm::ParameterSet &)
std::vector< std::vector< unsigned int > > hlIndex_
void accumulate(Accumulate const &)
std::vector< unsigned int > dsAllTotS_
virtual void setDatasetCounts(const std::vector< unsigned int > &)=0
std::vector< unsigned int > hlWasRun_
void analyze(const edm::Event &, const edm::EventSetup &) override
std::vector< unsigned int > hlAccept_
const edm::InputTag hlTriggerResults_
const std::vector< std::string > & streamNames() const
Log< level::Warning, false > LogWarning
const ReportEvery serviceBy_
hltrigreport::Accumulate Accumulate
std::vector< std::vector< unsigned int > > dsIndex_
tuple size
Write out results.
std::vector< unsigned int > hltPre_
const std::vector< std::string > & datasetNames() const
bool useLumiCache() const
std::vector< unsigned int > hlErrors_
std::vector< unsigned int > hltL1s_