9 #include <fmt/printf.h> 12 #include <boost/regex.hpp> 39 struct RunBasedHistograms {
43 unsigned int index_l1_seed;
44 unsigned int index_prescale;
46 HLTIndices() : index_l1_seed((unsigned
int)-1), index_prescale((unsigned
int)-1) {}
50 std::vector<HLTIndices> hltIndices;
52 std::vector<std::vector<unsigned int>>
datasets;
53 std::vector<std::vector<unsigned int>>
streams;
58 struct HLTRatesPlots {
68 std::vector<dqm::reco::MonitorElement *> tcds_counts;
71 std::vector<dqm::reco::MonitorElement *> l1t_counts;
74 std::vector<std::vector<HLTRatesPlots>> hlt_by_dataset_counts;
77 std::vector<dqm::reco::MonitorElement *> dataset_counts;
80 std::vector<dqm::reco::MonitorElement *> stream_counts;
94 hlt_by_dataset_counts(),
114 RunBasedHistograms &)
const override;
154 desc.addUntracked<uint32_t>(
"lumisectionRange", 2500);
155 descriptions.
add(
"triggerRatesMonitor",
desc);
160 m_l1tMenuToken{esConsumes<edm::Transition::BeginRun>()},
161 m_l1t_results(consumes<GlobalAlgBlkBxCollection>(
config.getUntrackedParameter<
edm::InputTag>(
"l1tResults"))),
162 m_hlt_results(consumes<edm::TriggerResults>(
config.getUntrackedParameter<
edm::InputTag>(
"hltResults"))),
164 m_lumisections_range(
config.getUntrackedParameter<uint32_t>(
"lumisectionRange")) {}
218 <<
"failed to initialise HLTConfigProvider, the HLT trigger and datasets rates will not be monitored";
241 for (
auto const &keyval : l1tMenu.getAlgorithmMap()) {
242 unsigned int bit = keyval.second.getIndex();
244 std::string const &
name = fmt::sprintf(
"%s (bit %d)", keyval.first, bit);
246 fmt::sprintf(
"%s (bit %d)%s vs. lumisection", keyval.first, bit, (masked ?
" (masked)" :
""));
255 for (
unsigned int d = 0;
d <
datasets.size(); ++
d) {
257 for (
unsigned int i = 0;
i <
histograms.datasets[
d].size(); ++
i) {
261 name +
" pass L1 seed, vs. lumisection",
266 name +
" pass prescaler, vs. lumisection",
271 name +
" accept, vs. lumisection",
276 name +
" reject, vs. lumisection",
281 name +
" error, vs. lumisection",
295 if (
type ==
"HLTL1TSeed" or type ==
"HLTLevel1GTSeed" or type ==
"HLTLevel1Activity" or 296 type ==
"HLTLevel1Pattern") {
300 }
else if (
type ==
"HLTPrescaler") {
318 for (
unsigned int i = 0;
i <
streams.size(); ++
i)
327 unsigned int lumisection =
event.luminosityBlock();
330 histograms.events_processed->Fill(lumisection);
336 if (not bxvector.isEmpty(0)) {
337 auto const &
results = bxvector.at(0, 0);
339 if (
results.getAlgoDecisionFinal(
i))
349 <<
"This should never happen: the number of HLT paths has changed since the beginning of the run";
352 for (
unsigned int d = 0;
d <
histograms.datasets.size(); ++
d) {
359 for (
unsigned int i = 0;
i <
histograms.datasets[
d].size(); ++
i) {
364 histograms.hlt_by_dataset_counts[
d][
i].pass_l1_seed->Fill(lumisection);
366 histograms.hlt_by_dataset_counts[
d][
i].pass_prescale->Fill(lumisection);
368 histograms.hlt_by_dataset_counts[
d][
i].accept->Fill(lumisection);
369 else if (
path.error())
370 histograms.hlt_by_dataset_counts[
d][
i].error->Fill(lumisection);
372 histograms.hlt_by_dataset_counts[
d][
i].reject->Fill(lumisection);
void dqmBeginRun(edm::Run const &, edm::EventSetup const &, RunBasedHistograms &) const override
const std::string m_dqm_path
const edm::EDGetTokenT< GlobalAlgBlkBxCollection > m_l1t_results
virtual void setCurrentFolder(std::string const &fullpath)
#define DEFINE_FWK_MODULE(type)
const edm::EDGetTokenT< edm::TriggerResults > m_hlt_results
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Log< level::Error, false > LogError
const uint32_t m_lumisections_range
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &, RunBasedHistograms &) const override
static constexpr const char *const s_tcds_trigger_types[]
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
def unique(seq, keepstr=True)
const edm::ESGetToken< L1TUtmTriggerMenu, L1TUtmTriggerMenuRcd > m_l1tMenuToken
dqm::legacy::MonitorElement MonitorElement
void dqmAnalyze(edm::Event const &, edm::EventSetup const &, RunBasedHistograms const &) const override
void add(std::string const &label, ParameterSetDescription const &psetDescription)
TriggerRatesMonitor(edm::ParameterSet const &)
static constexpr unsigned int maxPhysicsTriggers
Log< level::Warning, false > LogWarning
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
~TriggerRatesMonitor() override=default
void labelsForToken(EDGetToken iToken, Labels &oLabels) const