10 #include <boost/regex.hpp>
11 #include <boost/format.hpp>
41 struct RunBasedHistograms {
45 unsigned int index_l1_seed;
46 unsigned int index_prescale;
48 HLTIndices() : index_l1_seed((unsigned
int)-1), index_prescale((unsigned
int)-1) {}
52 std::vector<HLTIndices> hltIndices;
54 std::vector<std::vector<unsigned int>>
datasets;
55 std::vector<std::vector<unsigned int>>
streams;
60 struct HLTRatesPlots {
70 std::vector<dqm::reco::MonitorElement *> tcds_counts;
73 std::vector<dqm::reco::MonitorElement *> l1t_counts;
76 std::vector<std::vector<HLTRatesPlots>> hlt_by_dataset_counts;
79 std::vector<dqm::reco::MonitorElement *> dataset_counts;
82 std::vector<dqm::reco::MonitorElement *> stream_counts;
96 hlt_by_dataset_counts(),
116 RunBasedHistograms &)
const override;
156 descriptions.
add(
"triggerRatesMonitor", desc);
164 m_lumisections_range(
config.getUntrackedParameter<uint32_t>(
"lumisectionRange")) {}
218 <<
"failed to initialise HLTConfigProvider, the HLT trigger and datasets rates will not be monitored";
230 booker.setCurrentFolder(
m_dqm_path +
"/TCDS");
240 auto const &l1tMenu = edm::get<L1TUtmTriggerMenu, L1TUtmTriggerMenuRcd>(
setup);
241 for (
auto const &keyval : l1tMenu.getAlgorithmMap()) {
242 unsigned int bit = keyval.second.getIndex();
246 (
boost::format(
"%s (bit %d)%s vs. lumisection") % keyval.first % bit % (masked ?
" (masked)" :
"")).str();
255 for (
unsigned int d = 0;
d <
datasets.size(); ++
d) {
257 for (
unsigned int i = 0;
i <
histograms.datasets[
d].size(); ++
i) {
260 histograms.hlt_by_dataset_counts[
d][
i].pass_l1_seed = booker.book1D(
name +
"_pass_L1_seed",
261 name +
" pass L1 seed, vs. lumisection",
265 histograms.hlt_by_dataset_counts[
d][
i].pass_prescale = booker.book1D(
name +
"_pass_prescaler",
266 name +
" pass prescaler, vs. lumisection",
270 histograms.hlt_by_dataset_counts[
d][
i].accept = booker.book1D(
name +
"_accept",
271 name +
" accept, vs. lumisection",
275 histograms.hlt_by_dataset_counts[
d][
i].reject = booker.book1D(
name +
"_reject",
276 name +
" reject, vs. lumisection",
280 histograms.hlt_by_dataset_counts[
d][
i].error = booker.book1D(
name +
"_error",
281 name +
" error, vs. lumisection",
295 if (
type ==
"HLTL1TSeed" or type ==
"HLTLevel1GTSeed" or type ==
"HLTLevel1Activity" or
296 type ==
"HLTLevel1Pattern") {
300 }
else if (
type ==
"HLTPrescaler") {
310 booker.setCurrentFolder(
m_dqm_path +
"/Datasets");
316 booker.setCurrentFolder(
m_dqm_path +
"/Streams");
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))
350 <<
"This should never happen: the number of HLT paths has changed since the beginning of the run";
353 for (
unsigned int d = 0;
d <
histograms.datasets.size(); ++
d) {
360 for (
unsigned int i = 0;
i <
histograms.datasets[
d].size(); ++
i) {
365 histograms.hlt_by_dataset_counts[
d][
i].pass_l1_seed->Fill(lumisection);
367 histograms.hlt_by_dataset_counts[
d][
i].pass_prescale->Fill(lumisection);
369 histograms.hlt_by_dataset_counts[
d][
i].accept->Fill(lumisection);
370 else if (
path.error())
371 histograms.hlt_by_dataset_counts[
d][
i].error->Fill(lumisection);
373 histograms.hlt_by_dataset_counts[
d][
i].reject->Fill(lumisection);