9 #include <fmt/printf.h>
12 #include <boost/regex.hpp>
42 struct RunBasedHistograms {
46 unsigned int index_l1_seed;
47 unsigned int index_prescale;
49 HLTIndices() : index_l1_seed((unsigned
int)-1), index_prescale((unsigned
int)-1) {}
53 std::vector<HLTIndices> hltIndices;
55 std::vector<std::vector<unsigned int>>
datasets;
56 std::vector<std::vector<unsigned int>>
streams;
61 struct HLTRatesPlots {
71 std::vector<dqm::reco::MonitorElement *> tcds_counts;
74 std::vector<dqm::reco::MonitorElement *> l1t_counts;
77 std::vector<std::vector<HLTRatesPlots>> hlt_by_dataset_counts;
80 std::vector<dqm::reco::MonitorElement *> dataset_counts;
83 std::vector<dqm::reco::MonitorElement *> stream_counts;
97 hlt_by_dataset_counts(),
117 RunBasedHistograms &)
const override;
156 desc.addUntracked<uint32_t>(
"lumisectionRange", 2500);
157 descriptions.
add(
"triggerRatesMonitor",
desc);
165 m_lumisections_range(
config.getUntrackedParameter<uint32_t>(
"lumisectionRange")) {}
219 <<
"failed to initialise HLTConfigProvider, the HLT trigger and datasets rates will not be monitored";
241 auto const &l1tMenu = edm::get<L1TUtmTriggerMenu, L1TUtmTriggerMenuRcd>(
setup);
242 for (
auto const &keyval : l1tMenu.getAlgorithmMap()) {
243 unsigned int bit = keyval.second.getIndex();
245 std::string const &
name = fmt::sprintf(
"%s (bit %d)", keyval.first, bit);
247 fmt::sprintf(
"%s (bit %d)%s vs. lumisection", keyval.first, bit, (masked ?
" (masked)" :
""));
256 for (
unsigned int d = 0;
d <
datasets.size(); ++
d) {
258 for (
unsigned int i = 0;
i <
histograms.datasets[
d].size(); ++
i) {
262 name +
" pass L1 seed, vs. lumisection",
267 name +
" pass prescaler, vs. lumisection",
272 name +
" accept, vs. lumisection",
277 name +
" reject, vs. lumisection",
282 name +
" error, vs. lumisection",
296 if (
type ==
"HLTL1TSeed" or type ==
"HLTLevel1GTSeed" or type ==
"HLTLevel1Activity" or
297 type ==
"HLTLevel1Pattern") {
301 }
else if (
type ==
"HLTPrescaler") {
319 for (
unsigned int i = 0;
i <
streams.size(); ++
i)
328 unsigned int lumisection =
event.luminosityBlock();
331 histograms.events_processed->Fill(lumisection);
337 if (not bxvector.isEmpty(0)) {
338 auto const &
results = bxvector.at(0, 0);
340 if (
results.getAlgoDecisionFinal(
i))
351 <<
"This should never happen: the number of HLT paths has changed since the beginning of the run";
354 for (
unsigned int d = 0;
d <
histograms.datasets.size(); ++
d) {
361 for (
unsigned int i = 0;
i <
histograms.datasets[
d].size(); ++
i) {
366 histograms.hlt_by_dataset_counts[
d][
i].pass_l1_seed->Fill(lumisection);
368 histograms.hlt_by_dataset_counts[
d][
i].pass_prescale->Fill(lumisection);
370 histograms.hlt_by_dataset_counts[
d][
i].accept->Fill(lumisection);
371 else if (
path.error())
372 histograms.hlt_by_dataset_counts[
d][
i].error->Fill(lumisection);
374 histograms.hlt_by_dataset_counts[
d][
i].reject->Fill(lumisection);