Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support concurrent LuminosityBlocks in HLTrigReport #27961

Merged
merged 2 commits into from Sep 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
537 changes: 297 additions & 240 deletions HLTrigger/HLTanalyzers/plugins/HLTrigReport.cc

Large diffs are not rendered by default.

110 changes: 72 additions & 38 deletions HLTrigger/HLTanalyzers/plugins/HLTrigReport.h
Expand Up @@ -28,11 +28,46 @@
// class declaration
//

class HLTrigReport : public edm::one::EDAnalyzer<edm::one::WatchRuns, edm::one::WatchLuminosityBlocks> {
namespace hltrigreport {
struct Accumulate {
Accumulate();
Accumulate(size_t numHLNames,
std::vector<std::vector<unsigned int>> const& hlIndex,
std::vector<std::vector<unsigned int>> const& dsIndex);

unsigned int nEvents_; // number of events processed
unsigned int nWasRun_; // # where at least one HLT was run
unsigned int nAccept_; // # of accepted events
unsigned int nErrors_; // # where at least one HLT had error

std::vector<unsigned int> hlWasRun_; // # where HLT[i] was run
std::vector<unsigned int> hltL1s_; // # of events after L1 seed
std::vector<unsigned int> hltPre_; // # of events after HLT prescale
std::vector<unsigned int> hlAccept_; // # of events accepted by HLT[i]
std::vector<unsigned int> hlAccTot_; // # of events accepted by HLT[0] OR ... OR HLT[i]
std::vector<unsigned int> hlErrors_; // # of events with error in HLT[i]

std::vector<std::vector<unsigned int>>
hlAccTotDS_; // hlAccTotDS_[ds][p] stores the # of accepted events by the 0-th to p-th paths in the ds-th dataset
std::vector<unsigned int> hlAllTotDS_; // hlAllTotDS_[ds] stores the # of accepted events in the ds-th dataset
std::vector<std::vector<unsigned int>>
dsAccTotS_; // dsAccTotS_[s][ds] stores the # of accepted events by the 0-th to ds-th dataset in the s-th stream
std::vector<unsigned int> dsAllTotS_; // dsAllTotS_[s] stores the # of accepted events in the s-th stream

void accumulate(Accumulate const&);
void reset();
};

} // namespace hltrigreport

class HLTrigReport
: public edm::one::EDAnalyzer<edm::one::WatchRuns, edm::LuminosityBlockCache<hltrigreport::Accumulate>> {
private:
enum ReportEvery { NEVER = 0, EVERY_EVENT = 1, EVERY_LUMI = 2, EVERY_RUN = 3, EVERY_JOB = 4 };

public:
using Accumulate = hltrigreport::Accumulate;

explicit HLTrigReport(const edm::ParameterSet&);
~HLTrigReport() override;
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
Expand All @@ -45,66 +80,65 @@ class HLTrigReport : public edm::one::EDAnalyzer<edm::one::WatchRuns, edm::one::
void beginRun(edm::Run const&, edm::EventSetup const&) override;
void endRun(edm::Run const&, edm::EventSetup const&) override;

void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override;
void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override;
std::shared_ptr<Accumulate> globalBeginLuminosityBlock(edm::LuminosityBlock const&,
edm::EventSetup const&) const override;
void globalEndLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override;

void analyze(const edm::Event&, const edm::EventSetup&) override;

void reset(bool changed = false); // reset all counters

// names and event counts
const std::vector<std::string>& streamNames() const;
const std::vector<std::string>& datasetNames() const;
const std::vector<unsigned int>& streamCounts() const;
const std::vector<unsigned int>& datasetCounts() const;

private:
void dumpReport(std::string const& header = std::string());

edm::InputTag hlTriggerResults_; // Input tag for TriggerResults
edm::EDGetTokenT<edm::TriggerResults> hlTriggerResultsToken_;
void reset(); // reset all counters

hltrigreport::Accumulate& chooseAccumulate(edm::LuminosityBlockIndex index) {
if (useLumiCache()) {
return *luminosityBlockCache(index);
}
return accumulate_;
}
bool useLumiCache() const { return reportBy_ == EVERY_LUMI or serviceBy_ == EVERY_LUMI or resetBy_ == EVERY_LUMI; }
bool readAfterLumi() const {
return (reportBy_ == EVERY_RUN or reportBy_ == EVERY_JOB or serviceBy_ == EVERY_RUN or serviceBy_ == EVERY_JOB);
}

void updateConfigCache();

void dumpReport(hltrigreport::Accumulate const& accumulate, std::string const& header = std::string()) const;
void updateService(Accumulate const& accumulate) const;

const edm::InputTag hlTriggerResults_; // Input tag for TriggerResults
const edm::EDGetTokenT<edm::TriggerResults> hlTriggerResultsToken_;
bool configured_; // is HLTConfigProvider configured ?

unsigned int nEvents_; // number of events processed
unsigned int nWasRun_; // # where at least one HLT was run
unsigned int nAccept_; // # of accepted events
unsigned int nErrors_; // # where at least one HLT had error

std::vector<unsigned int> hlWasRun_; // # where HLT[i] was run
std::vector<unsigned int> hltL1s_; // # of events after L1 seed
std::vector<unsigned int> hltPre_; // # of events after HLT prescale
std::vector<unsigned int> hlAccept_; // # of events accepted by HLT[i]
std::vector<unsigned int> hlAccTot_; // # of events accepted by HLT[0] OR ... OR HLT[i]
std::vector<unsigned int> hlErrors_; // # of events with error in HLT[i]

std::vector<int> posL1s_; // pos # of last L1 seed
std::vector<int> posPre_; // pos # of last HLT prescale
std::vector<std::string> hlNames_; // name of each HLT algorithm

std::vector<std::vector<unsigned int> >
std::vector<std::vector<unsigned int>>
hlIndex_; // hlIndex_[ds][p] stores the hlNames_ index of the p-th path of the ds-th dataset
std::vector<std::vector<unsigned int> >
hlAccTotDS_; // hlAccTotDS_[ds][p] stores the # of accepted events by the 0-th to p-th paths in the ds-th dataset
std::vector<unsigned int> hlAllTotDS_; // hlAllTotDS_[ds] stores the # of accepted events in the ds-th dataset
std::vector<std::string> datasetNames_; // list of dataset names
std::vector<std::vector<std::string> > datasetContents_; // list of path names for each dataset

std::vector<int> posL1s_; // pos # of last L1 seed
std::vector<int> posPre_; // pos # of last HLT prescale

std::vector<std::string> datasetNames_; // list of dataset names
std::vector<std::vector<std::string>> datasetContents_; // list of path names for each dataset
bool isCustomDatasets_; // true if the user overwrote the dataset definitions of the provenance with the CustomDatasets parameter
std::vector<std::vector<unsigned int> >
std::vector<std::vector<unsigned int>>
dsIndex_; // dsIndex_[s][ds] stores the datasetNames_ index of the ds-th dataset of the s-th stream
std::vector<std::vector<unsigned int> >
dsAccTotS_; // dsAccTotS_[s][ds] stores the # of accepted events by the 0-th to ds-th dataset in the s-th stream
std::vector<unsigned int> dsAllTotS_; // dsAllTotS_[s] stores the # of accepted events in the s-th stream
std::vector<std::string> streamNames_; // list of stream names
std::vector<std::vector<std::string> > streamContents_; // list of dataset names for each stream
std::vector<std::string> streamNames_; // list of stream names
std::vector<std::vector<std::string>> streamContents_; // list of dataset names for each stream
bool isCustomStreams_; // true if the user overwrote the stream definitions of the provenance with the CustomSterams parameter
std::string refPath_; // name of the reference path for rate calculation
unsigned int refIndex_; // index of the reference path for rate calculation
double refRate_; // rate of the reference path, the rate of all other paths will be normalized to this
const double refRate_; // rate of the reference path, the rate of all other paths will be normalized to this

const ReportEvery reportBy_; // dump report for every never/event/lumi/run/job
const ReportEvery resetBy_; // reset counters every never/event/lumi/run/job
const ReportEvery serviceBy_; // call to service every never/event/lumi/run/job
HLTConfigProvider hltConfig_; // to get configuration for L1s/Pre

hltrigreport::Accumulate accumulate_;
};

#endif //HLTrigReport_h
6 changes: 6 additions & 0 deletions HLTrigger/HLTanalyzers/test/BuildFile.xml
@@ -0,0 +1,6 @@
<environment>
<bin file="TestHLTrigReport.cpp" name="TestHLTrigReport">
<flags TEST_RUNNER_ARGS=" /bin/bash HLTrigger/HLTanalyzers/test test_hltrigreport.sh"/>
<use name="FWCore/Utilities"/>
</bin>
</environment>
3 changes: 3 additions & 0 deletions HLTrigger/HLTanalyzers/test/TestHLTrigReport.cpp
@@ -0,0 +1,3 @@
#include "FWCore/Utilities/interface/TestHelper.h"

RUNTEST()
90 changes: 90 additions & 0 deletions HLTrigger/HLTanalyzers/test/comparison_logs/event_event.log
@@ -0,0 +1,90 @@
HLT-Report ---------- Event Summary ------------
HLT-Report Summary for Run 1, LumiSection 1, Event run: 1 lumi: 1 event: 1
HLT-Report Events total = 1 wasrun = 1 passed = 0 errors = 0
HLT-Report ---------- HLTrig Summary ------------
HLT-Report HLT # WasRun L1S Pre HLT %L1sPre Rate RateHi Errors Name
HLT-Report 0 1 1 1 0 0.00000 0.0 0.0 0 HLTriggerFinalPath
HLT-Report 1 1 1 1 0 0.00000 0.0 0.0 0 p1
HLT-Report 2 1 1 1 0 0.00000 0.0 0.0 0 p2
HLT-Report end!
HLT-Report ---------- Event Summary ------------
HLT-Report Summary for Run 1, LumiSection 1, Event run: 1 lumi: 1 event: 2
HLT-Report Events total = 1 wasrun = 1 passed = 1 errors = 0
HLT-Report ---------- HLTrig Summary ------------
HLT-Report HLT # WasRun L1S Pre HLT %L1sPre Rate RateHi Errors Name
HLT-Report 0 1 1 1 1 100.00000 100.0 0.0 0 HLTriggerFinalPath
HLT-Report 1 1 1 1 0 0.00000 0.0 84.3 0 p1
HLT-Report 2 1 1 1 1 100.00000 100.0 0.0 0 p2
HLT-Report end!
HLT-Report ---------- Event Summary ------------
HLT-Report Summary for Run 1, LumiSection 2, Event run: 1 lumi: 2 event: 3
HLT-Report Events total = 1 wasrun = 1 passed = 1 errors = 0
HLT-Report ---------- HLTrig Summary ------------
HLT-Report HLT # WasRun L1S Pre HLT %L1sPre Rate RateHi Errors Name
HLT-Report 0 1 1 1 1 100.00000 100.0 0.0 0 HLTriggerFinalPath
HLT-Report 1 1 1 1 1 100.00000 100.0 0.0 0 p1
HLT-Report 2 1 1 1 0 0.00000 0.0 84.3 0 p2
HLT-Report end!
HLT-Report ---------- Event Summary ------------
HLT-Report Summary for Run 1, LumiSection 2, Event run: 1 lumi: 2 event: 4
HLT-Report Events total = 1 wasrun = 1 passed = 0 errors = 0
HLT-Report ---------- HLTrig Summary ------------
HLT-Report HLT # WasRun L1S Pre HLT %L1sPre Rate RateHi Errors Name
HLT-Report 0 1 1 1 0 0.00000 0.0 0.0 0 HLTriggerFinalPath
HLT-Report 1 1 1 1 0 0.00000 0.0 0.0 0 p1
HLT-Report 2 1 1 1 0 0.00000 0.0 0.0 0 p2
HLT-Report end!
HLT-Report ---------- Event Summary ------------
HLT-Report Summary for Run 2, LumiSection 1, Event run: 2 lumi: 1 event: 1
HLT-Report Events total = 1 wasrun = 1 passed = 0 errors = 0
HLT-Report ---------- HLTrig Summary ------------
HLT-Report HLT # WasRun L1S Pre HLT %L1sPre Rate RateHi Errors Name
HLT-Report 0 1 1 1 0 0.00000 0.0 0.0 0 HLTriggerFinalPath
HLT-Report 1 1 1 1 0 0.00000 0.0 0.0 0 p1
HLT-Report 2 1 1 1 0 0.00000 0.0 0.0 0 p2
HLT-Report end!
HLT-Report ---------- Event Summary ------------
HLT-Report Summary for Run 2, LumiSection 1, Event run: 2 lumi: 1 event: 2
HLT-Report Events total = 1 wasrun = 1 passed = 1 errors = 0
HLT-Report ---------- HLTrig Summary ------------
HLT-Report HLT # WasRun L1S Pre HLT %L1sPre Rate RateHi Errors Name
HLT-Report 0 1 1 1 1 100.00000 100.0 0.0 0 HLTriggerFinalPath
HLT-Report 1 1 1 1 1 100.00000 100.0 0.0 0 p1
HLT-Report 2 1 1 1 0 0.00000 0.0 84.3 0 p2
HLT-Report end!
HLT-Report ---------- Event Summary ------------
HLT-Report Summary for Run 2, LumiSection 2, Event run: 2 lumi: 2 event: 3
HLT-Report Events total = 1 wasrun = 1 passed = 0 errors = 0
HLT-Report ---------- HLTrig Summary ------------
HLT-Report HLT # WasRun L1S Pre HLT %L1sPre Rate RateHi Errors Name
HLT-Report 0 1 1 1 0 0.00000 0.0 0.0 0 HLTriggerFinalPath
HLT-Report 1 1 1 1 0 0.00000 0.0 0.0 0 p1
HLT-Report 2 1 1 1 0 0.00000 0.0 0.0 0 p2
HLT-Report end!
HLT-Report ---------- Event Summary ------------
HLT-Report Summary for Run 2, LumiSection 2, Event run: 2 lumi: 2 event: 4
HLT-Report Events total = 1 wasrun = 1 passed = 0 errors = 0
HLT-Report ---------- HLTrig Summary ------------
HLT-Report HLT # WasRun L1S Pre HLT %L1sPre Rate RateHi Errors Name
HLT-Report 0 1 1 1 0 0.00000 0.0 0.0 0 HLTriggerFinalPath
HLT-Report 1 1 1 1 0 0.00000 0.0 0.0 0 p1
HLT-Report 2 1 1 1 0 0.00000 0.0 0.0 0 p2
HLT-Report end!
HLT-Report ---------- Event Summary ------------
HLT-Report Summary for Run 3, LumiSection 1, Event run: 3 lumi: 1 event: 1
HLT-Report Events total = 1 wasrun = 1 passed = 1 errors = 0
HLT-Report ---------- HLTrig Summary ------------
HLT-Report HLT # WasRun L1S Pre HLT %L1sPre Rate RateHi Errors Name
HLT-Report 0 1 1 1 1 100.00000 100.0 0.0 0 HLTriggerFinalPath
HLT-Report 1 1 1 1 1 100.00000 100.0 0.0 0 p1
HLT-Report 2 1 1 1 0 0.00000 0.0 84.3 0 p2
HLT-Report end!
HLT-Report ---------- Event Summary ------------
HLT-Report Summary for Run 3, LumiSection 1, Event run: 3 lumi: 1 event: 2
HLT-Report Events total = 1 wasrun = 1 passed = 0 errors = 0
HLT-Report ---------- HLTrig Summary ------------
HLT-Report HLT # WasRun L1S Pre HLT %L1sPre Rate RateHi Errors Name
HLT-Report 0 1 1 1 0 0.00000 0.0 0.0 0 HLTriggerFinalPath
HLT-Report 1 1 1 1 0 0.00000 0.0 0.0 0 p1
HLT-Report 2 1 1 1 0 0.00000 0.0 0.0 0 p2
HLT-Report end!
9 changes: 9 additions & 0 deletions HLTrigger/HLTanalyzers/test/comparison_logs/event_job.log
@@ -0,0 +1,9 @@
HLT-Report ---------- Event Summary ------------
HLT-Report Summary for Job
HLT-Report Events total = 1 wasrun = 1 passed = 0 errors = 0
HLT-Report ---------- HLTrig Summary ------------
HLT-Report HLT # WasRun L1S Pre HLT %L1sPre Rate RateHi Errors Name
HLT-Report 0 1 1 1 0 0.00000 0.0 0.0 0 HLTriggerFinalPath
HLT-Report 1 1 1 1 0 0.00000 0.0 0.0 0 p1
HLT-Report 2 1 1 1 0 0.00000 0.0 0.0 0 p2
HLT-Report end!
45 changes: 45 additions & 0 deletions HLTrigger/HLTanalyzers/test/comparison_logs/event_lumi.log
@@ -0,0 +1,45 @@
HLT-Report ---------- Event Summary ------------
HLT-Report Summary for Run 1, LumiSection 1
HLT-Report Events total = 1 wasrun = 1 passed = 1 errors = 0
HLT-Report ---------- HLTrig Summary ------------
HLT-Report HLT # WasRun L1S Pre HLT %L1sPre Rate RateHi Errors Name
HLT-Report 0 1 1 1 1 100.00000 100.0 0.0 0 HLTriggerFinalPath
HLT-Report 1 1 1 1 0 0.00000 0.0 84.3 0 p1
HLT-Report 2 1 1 1 1 100.00000 100.0 0.0 0 p2
HLT-Report end!
HLT-Report ---------- Event Summary ------------
HLT-Report Summary for Run 1, LumiSection 2
HLT-Report Events total = 1 wasrun = 1 passed = 0 errors = 0
HLT-Report ---------- HLTrig Summary ------------
HLT-Report HLT # WasRun L1S Pre HLT %L1sPre Rate RateHi Errors Name
HLT-Report 0 1 1 1 0 0.00000 0.0 0.0 0 HLTriggerFinalPath
HLT-Report 1 1 1 1 0 0.00000 0.0 0.0 0 p1
HLT-Report 2 1 1 1 0 0.00000 0.0 0.0 0 p2
HLT-Report end!
HLT-Report ---------- Event Summary ------------
HLT-Report Summary for Run 2, LumiSection 1
HLT-Report Events total = 1 wasrun = 1 passed = 1 errors = 0
HLT-Report ---------- HLTrig Summary ------------
HLT-Report HLT # WasRun L1S Pre HLT %L1sPre Rate RateHi Errors Name
HLT-Report 0 1 1 1 1 100.00000 100.0 0.0 0 HLTriggerFinalPath
HLT-Report 1 1 1 1 1 100.00000 100.0 0.0 0 p1
HLT-Report 2 1 1 1 0 0.00000 0.0 84.3 0 p2
HLT-Report end!
HLT-Report ---------- Event Summary ------------
HLT-Report Summary for Run 2, LumiSection 2
HLT-Report Events total = 1 wasrun = 1 passed = 0 errors = 0
HLT-Report ---------- HLTrig Summary ------------
HLT-Report HLT # WasRun L1S Pre HLT %L1sPre Rate RateHi Errors Name
HLT-Report 0 1 1 1 0 0.00000 0.0 0.0 0 HLTriggerFinalPath
HLT-Report 1 1 1 1 0 0.00000 0.0 0.0 0 p1
HLT-Report 2 1 1 1 0 0.00000 0.0 0.0 0 p2
HLT-Report end!
HLT-Report ---------- Event Summary ------------
HLT-Report Summary for Run 3, LumiSection 1
HLT-Report Events total = 1 wasrun = 1 passed = 0 errors = 0
HLT-Report ---------- HLTrig Summary ------------
HLT-Report HLT # WasRun L1S Pre HLT %L1sPre Rate RateHi Errors Name
HLT-Report 0 1 1 1 0 0.00000 0.0 0.0 0 HLTriggerFinalPath
HLT-Report 1 1 1 1 0 0.00000 0.0 0.0 0 p1
HLT-Report 2 1 1 1 0 0.00000 0.0 0.0 0 p2
HLT-Report end!
27 changes: 27 additions & 0 deletions HLTrigger/HLTanalyzers/test/comparison_logs/event_run.log
@@ -0,0 +1,27 @@
HLT-Report ---------- Event Summary ------------
HLT-Report Summary for Run 1
HLT-Report Events total = 1 wasrun = 1 passed = 0 errors = 0
HLT-Report ---------- HLTrig Summary ------------
HLT-Report HLT # WasRun L1S Pre HLT %L1sPre Rate RateHi Errors Name
HLT-Report 0 1 1 1 0 0.00000 0.0 0.0 0 HLTriggerFinalPath
HLT-Report 1 1 1 1 0 0.00000 0.0 0.0 0 p1
HLT-Report 2 1 1 1 0 0.00000 0.0 0.0 0 p2
HLT-Report end!
HLT-Report ---------- Event Summary ------------
HLT-Report Summary for Run 2
HLT-Report Events total = 1 wasrun = 1 passed = 0 errors = 0
HLT-Report ---------- HLTrig Summary ------------
HLT-Report HLT # WasRun L1S Pre HLT %L1sPre Rate RateHi Errors Name
HLT-Report 0 1 1 1 0 0.00000 0.0 0.0 0 HLTriggerFinalPath
HLT-Report 1 1 1 1 0 0.00000 0.0 0.0 0 p1
HLT-Report 2 1 1 1 0 0.00000 0.0 0.0 0 p2
HLT-Report end!
HLT-Report ---------- Event Summary ------------
HLT-Report Summary for Run 3
HLT-Report Events total = 1 wasrun = 1 passed = 0 errors = 0
HLT-Report ---------- HLTrig Summary ------------
HLT-Report HLT # WasRun L1S Pre HLT %L1sPre Rate RateHi Errors Name
HLT-Report 0 1 1 1 0 0.00000 0.0 0.0 0 HLTriggerFinalPath
HLT-Report 1 1 1 1 0 0.00000 0.0 0.0 0 p1
HLT-Report 2 1 1 1 0 0.00000 0.0 0.0 0 p2
HLT-Report end!