7 #include <fmt/printf.h>
31 struct RunBasedHistograms {
56 std::vector<dqm::reco::MonitorElement*> tcds_bx;
57 std::vector<dqm::reco::MonitorElement*> l1t_bx;
58 std::vector<dqm::reco::MonitorElement*> hlt_bx;
59 std::vector<dqm::reco::MonitorElement*> tcds_bx_2d;
60 std::vector<dqm::reco::MonitorElement*> l1t_bx_2d;
61 std::vector<dqm::reco::MonitorElement*> hlt_bx_2d;
123 descriptions.
add(
"triggerBxMonitor", desc);
128 m_l1tMenuToken{esConsumes<edm::Transition::BeginRun>()},
141 histograms.tcds_bx.clear();
145 histograms.tcds_bx_2d.clear();
151 histograms.l1t_bx.clear();
155 histograms.l1t_bx_2d.clear();
163 if (histograms.hltConfig.init(run, setup, labels.
process, changed)) {
165 histograms.hlt_bx.clear();
166 histograms.hlt_bx.resize(histograms.hltConfig.size());
169 histograms.hlt_bx_2d.clear();
170 histograms.hlt_bx_2d.resize(histograms.hltConfig.size());
175 <<
"failed to initialise HLTConfigProvider, the HLT bx distribution will not be monitored";
189 histograms.tcds_bx_all = booker.
book2D(
"TCDS Trigger Types",
190 "TCDS Trigger Types vs. bunch crossing",
200 for (
unsigned int i = 0;
i <
size; ++
i) {
203 histograms.tcds_bx.at(i) =
208 histograms.tcds_bx_2d.at(i) = booker.
book2D(
220 histograms.l1t_bx_all = booker.
book2D(
"Level 1 Triggers",
221 "Level 1 Triggers vs. bunch crossing",
232 for (
auto const& keyval : l1tMenu.getAlgorithmMap()) {
233 unsigned int bit = keyval.second.getIndex();
234 std::string const&
name = fmt::sprintf(
"%s (bit %d)", keyval.first, bit);
240 histograms.l1t_bx_2d.at(bit) =
243 histograms.l1t_bx_all->setBinLabel(bit + 1, keyval.first, 2);
248 if (histograms.hltConfig.inited()) {
251 histograms.hlt_bx_all = booker.
book2D(
"High Level Triggers",
252 "High Level Triggers vs. bunch crossing",
256 histograms.hltConfig.size(),
258 histograms.hltConfig.size() - 0.5);
262 for (
unsigned int i = 0;
i < histograms.hltConfig.size(); ++
i) {
269 histograms.hlt_bx_2d[
i] =
272 histograms.hlt_bx_all->setBinLabel(
i + 1, name, 2);
280 unsigned int bx =
event.bunchCrossing();
281 unsigned int ls =
event.luminosityBlock();
286 unsigned int type =
event.experimentType();
289 histograms.tcds_bx[type]->Fill(bx);
291 histograms.tcds_bx_2d[type]->Fill(bx, ls);
293 histograms.tcds_bx_all->Fill(bx, type);
299 if (not bxvector.isEmpty(0)) {
300 auto const&
results = bxvector.at(0, 0);
302 if (
results.getAlgoDecisionFinal(
i)) {
304 histograms.l1t_bx[
i]->Fill(bx);
306 histograms.l1t_bx_2d[
i]->Fill(bx, ls);
307 histograms.l1t_bx_all->Fill(bx,
i);
313 if (histograms.hltConfig.inited()) {
318 histograms.hlt_bx[
i]->Fill(bx);
320 histograms.hlt_bx_2d[
i]->Fill(bx, ls);
321 histograms.hlt_bx_all->Fill(bx,
i);
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void dqmAnalyze(edm::Event const &, edm::EventSetup const &, RunBasedHistograms const &) const override
T getUntrackedParameter(std::string const &, T const &) const
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
virtual void setCurrentFolder(std::string const &fullpath)
#define DEFINE_FWK_MODULE(type)
~TriggerBxMonitor() override=default
const edm::EDGetTokenT< GlobalAlgBlkBxCollection > m_l1t_results
void dqmBeginRun(edm::Run const &, edm::EventSetup const &, RunBasedHistograms &) const override
Log< level::Error, false > LogError
const edm::EDGetTokenT< edm::TriggerResults > m_hlt_results
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &, RunBasedHistograms &) const override
bool getData(T &iHolder) const
static constexpr const char * s_tcds_trigger_types[]
const uint32_t m_ls_range
const std::string m_dqm_path
TriggerBxMonitor(edm::ParameterSet const &)
dqm::legacy::MonitorElement MonitorElement
const bool m_make_1d_plots
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
static const unsigned int s_bx_range
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void labelsForToken(EDGetToken iToken, Labels &oLabels) const
tuple config
parse the configuration file
static constexpr unsigned int maxPhysicsTriggers
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
const bool m_make_2d_plots
tuple size
Write out results.
const edm::ESGetToken< L1TUtmTriggerMenu, L1TUtmTriggerMenuRcd > m_l1tMenuToken