7 #include <boost/format.hpp> 35 struct RunBasedHistograms {
37 RunBasedHistograms() :
61 std::vector<ConcurrentMonitorElement> tcds_bx;
62 std::vector<ConcurrentMonitorElement> l1t_bx;
63 std::vector<ConcurrentMonitorElement> hlt_bx;
64 std::vector<ConcurrentMonitorElement> tcds_bx_2d;
65 std::vector<ConcurrentMonitorElement> l1t_bx_2d;
66 std::vector<ConcurrentMonitorElement> hlt_bx_2d;
84 static const unsigned int s_bx_range = 3564;
88 static constexpr const char * s_tcds_trigger_types[] = {
128 descriptions.
add(
"triggerBxMonitor", desc);
134 m_hlt_results( consumes<
edm::TriggerResults>( config.getUntrackedParameter<
edm::InputTag>(
"hltResults" ) ) ),
135 m_dqm_path( config.getUntrackedParameter<
std::
string>(
"dqmPath" ) ),
136 m_make_1d_plots( config.getUntrackedParameter<
bool>(
"make1DPlots" ) ),
137 m_make_2d_plots( config.getUntrackedParameter<
bool>(
"make2DPlots" ) ),
138 m_ls_range( config.getUntrackedParameter<uint32_t>(
"lsRange" ) )
146 histograms.tcds_bx.clear();
150 histograms.tcds_bx_2d.clear();
156 histograms.l1t_bx.clear();
160 histograms.l1t_bx_2d.clear();
168 if (histograms.hltConfig.init(run, setup, labels.
process, changed)) {
170 histograms.hlt_bx.clear();
171 histograms.hlt_bx.resize( histograms.hltConfig.size() );
174 histograms.hlt_bx_2d.clear();
175 histograms.hlt_bx_2d.resize( histograms.hltConfig.size() );
179 edm::LogError(
"TriggerBxMonitor") <<
"failed to initialise HLTConfigProvider, the HLT bx distribution will not be monitored";
191 histograms.tcds_bx_all = booker.
book2D(
"TCDS Trigger Types",
"TCDS Trigger Types vs. bunch crossing",
s_bx_range + 1, -0.5,
s_bx_range + 0.5, size, -0.5, size - 0.5);
195 for (
unsigned int i = 0;
i <
size; ++
i) {
217 auto const& l1tMenu = edm::get<L1TUtmTriggerMenu, L1TUtmTriggerMenuRcd>(
setup);
218 for (
auto const& keyval: l1tMenu.getAlgorithmMap()) {
219 unsigned int bit = keyval.second.getIndex();
228 histograms.l1t_bx_all.setBinLabel(bit+1, keyval.first, 2);
233 if (histograms.hltConfig.inited()) {
236 histograms.hlt_bx_all = booker.
book2D(
"High Level Triggers",
"High Level Triggers vs. bunch crossing",
s_bx_range + 1, -0.5,
s_bx_range + 0.5, histograms.hltConfig.size(), -0.5, histograms.hltConfig.size() - 0.5);
240 for (
unsigned int i = 0;
i < histograms.hltConfig.size(); ++
i) {
249 histograms.hlt_bx_all.setBinLabel(
i+1, name, 2);
257 unsigned int bx =
event.bunchCrossing();
258 unsigned int ls =
event.luminosityBlock();
263 unsigned int type =
event.experimentType();
266 histograms.tcds_bx[type].fill(bx);
268 histograms.tcds_bx_2d[type].fill(bx, ls);
270 histograms.tcds_bx_all.fill(bx, type);
276 if (not bxvector.isEmpty(0)) {
277 auto const&
results = bxvector.at(0, 0);
279 if (
results.getAlgoDecisionFinal(
i)) {
281 histograms.l1t_bx[
i].fill(bx);
283 histograms.l1t_bx_2d[
i].fill(bx, ls);
284 histograms.l1t_bx_all.fill(bx,
i);
290 if (histograms.hltConfig.inited()) {
295 histograms.hlt_bx[
i].fill(bx);
297 histograms.hlt_bx_2d[
i].fill(bx, ls);
298 histograms.hlt_bx_all.fill(bx,
i);
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void dqmBeginRun(edm::Run const &, edm::EventSetup const &, RunBasedHistograms &) const override
#define DEFINE_FWK_MODULE(type)
const edm::EDGetTokenT< GlobalAlgBlkBxCollection > m_l1t_results
virtual example_global void dqmAnalyze(edm::Event const &,@example_global edm::EventSetup const &,@example_global Histograms___class__ const &) const override
def setup(process, global_tag, zero_tesla=False)
const edm::EDGetTokenT< edm::TriggerResults > m_hlt_results
static const char * s_tcds_trigger_types[]
ConcurrentMonitorElement book2D(Args &&...args)
T const & get(Event const &event, InputTag const &tag)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
virtual example_stream void bookHistograms(DQMStore::IBooker &,@example_stream edm::Run const &,@example_stream edm::EventSetup const &) override
ConcurrentMonitorElement book1D(Args &&...args)
format
Some error handling for the usage.
const uint32_t m_ls_range
const std::string m_dqm_path
TriggerBxMonitor(edm::ParameterSet const &)
void setCurrentFolder(const std::string &fullpath)
static unsigned int maxPhysicsTriggers
const bool m_make_1d_plots
static const unsigned int s_bx_range
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void labelsForToken(EDGetToken iToken, Labels &oLabels) const
void bookHistograms(DQMStore::ConcurrentBooker &, edm::Run const &, edm::EventSetup const &, RunBasedHistograms &) const override
const bool m_make_2d_plots
void dqmAnalyze(edm::Event const &, edm::EventSetup const &, RunBasedHistograms const &) const override