CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
TriggerRatesMonitor Class Reference
Inheritance diagram for TriggerRatesMonitor:
DQMGlobalEDAnalyzer< RunBasedHistograms > DQMGlobalEDAnalyzerBase< RunBasedHistograms, Args... > edm::global::EDProducer< edm::RunCache< RunBasedHistograms >, edm::EndRunProducer, edm::Accumulator, Args... > edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 TriggerRatesMonitor (edm::ParameterSet const &)
 
 ~TriggerRatesMonitor () override=default
 
- Public Member Functions inherited from DQMGlobalEDAnalyzer< RunBasedHistograms >
virtual void dqmEndRun (edm::Run const &, edm::EventSetup const &, RunBasedHistograms const &) const
 
void globalEndRunProduce (edm::Run &run, edm::EventSetup const &setup) const final
 
- Public Member Functions inherited from DQMGlobalEDAnalyzerBase< RunBasedHistograms, Args... >
void accumulate (edm::StreamID id, edm::Event const &event, edm::EventSetup const &setup) const final
 
 DQMGlobalEDAnalyzerBase ()
 
std::shared_ptr< RunBasedHistograms > globalBeginRun (edm::Run const &run, edm::EventSetup const &setup) const final
 
void globalEndRun (edm::Run const &, edm::EventSetup const &) const final
 
- Public Member Functions inherited from edm::global::EDProducer< edm::RunCache< RunBasedHistograms >, edm::EndRunProducer, edm::Accumulator, Args... >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &, RunBasedHistograms &) const override
 
void dqmAnalyze (edm::Event const &, edm::EventSetup const &, RunBasedHistograms const &) const override
 
void dqmBeginRun (edm::Run const &, edm::EventSetup const &, RunBasedHistograms &) const override
 

Private Attributes

const std::string m_dqm_path
 
const edm::EDGetTokenT< edm::TriggerResultsm_hlt_results_token
 
const edm::InputTag m_l1t_results_inputTag
 
const edm::EDGetTokenT< GlobalAlgBlkBxCollectionm_l1t_results_token
 
const edm::ESGetToken< L1TUtmTriggerMenu, L1TUtmTriggerMenuRcdm_l1tMenu_token
 
const uint32_t m_lumisections_range
 

Static Private Attributes

static constexpr const char *const s_tcds_trigger_types []
 

Additional Inherited Members

- Public Types inherited from DQMGlobalEDAnalyzerBase< RunBasedHistograms, Args... >
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from DQMGlobalEDAnalyzerBase< RunBasedHistograms, Args... >
uint64_t meId (edm::Run const &run) const
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 
- Protected Attributes inherited from DQMGlobalEDAnalyzerBase< RunBasedHistograms, Args... >
DQMStoredqmstore_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Definition at line 97 of file TriggerRatesMonitor.cc.

Constructor & Destructor Documentation

◆ TriggerRatesMonitor()

TriggerRatesMonitor::TriggerRatesMonitor ( edm::ParameterSet const &  config)
explicit

Definition at line 154 of file TriggerRatesMonitor.cc.

155  : // module configuration
156  m_l1tMenu_token{esConsumes<edm::Transition::BeginRun>()},
157  m_l1t_results_inputTag{config.getUntrackedParameter<edm::InputTag>("l1tResults")},
159  m_hlt_results_token{consumes(config.getUntrackedParameter<edm::InputTag>("hltResults"))},
160  m_dqm_path{config.getUntrackedParameter<std::string>("dqmPath")},
161  m_lumisections_range{config.getUntrackedParameter<uint32_t>("lumisectionRange")} {}
const std::string m_dqm_path
const edm::EDGetTokenT< edm::TriggerResults > m_hlt_results_token
Definition: config.py:1
const uint32_t m_lumisections_range
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const edm::EDGetTokenT< GlobalAlgBlkBxCollection > m_l1t_results_token
const edm::ESGetToken< L1TUtmTriggerMenu, L1TUtmTriggerMenuRcd > m_l1tMenu_token
const edm::InputTag m_l1t_results_inputTag

◆ ~TriggerRatesMonitor()

TriggerRatesMonitor::~TriggerRatesMonitor ( )
overridedefault

Member Function Documentation

◆ bookHistograms()

void TriggerRatesMonitor::bookHistograms ( DQMStore::IBooker booker,
edm::Run const &  run,
edm::EventSetup const &  setup,
RunBasedHistograms &  histograms 
) const
overrideprivatevirtual

Implements DQMGlobalEDAnalyzerBase< RunBasedHistograms, Args... >.

Definition at line 237 of file TriggerRatesMonitor.cc.

References triggerObjects_cff::bit, dqm::implementation::IBooker::book1D(), ztail::d, makeLayoutFileForGui::datasetNames, mps_fire::i, dqmiolumiharvest::j, label, m_dqm_path, m_l1tMenu_token, m_lumisections_range, Skims_PA_cff::name, or, s_tcds_trigger_types, dqm::implementation::NavigatorBase::setCurrentFolder(), singleTopDQM_cfi::setup, AlCaHLTBitMon_QueryRunRegistry::string, and runGCPTkAlMap::title.

240  {
241  // book histograms for the overall event count, and trigger types
243  histograms.events_processed = booker.book1D(
244  "events", "Processed events vs. lumisection", m_lumisections_range + 1, -0.5, m_lumisections_range + 0.5);
245  booker.setCurrentFolder(m_dqm_path + "/TCDS");
246  unsigned int const sizeof_tcds_trigger_types = sizeof(s_tcds_trigger_types) / sizeof(const char *);
247  if (sizeof_tcds_trigger_types == histograms.tcds_counts.size()) {
248  for (unsigned int i = 0; i < sizeof_tcds_trigger_types; ++i)
249  if (s_tcds_trigger_types[i]) {
250  std::string const &title = fmt::sprintf("%s events vs. lumisection", s_tcds_trigger_types[i]);
251  histograms.tcds_counts[i] =
253  }
254  } else
255  edm::LogError("TriggerRatesMonitor")
256  << "This should never happen: size of \"s_tcds_trigger_types\" array (" << sizeof_tcds_trigger_types
257  << ") differs from size of \"histograms.tcds_counts\" vector (size=" << histograms.tcds_counts.size()
258  << ").\nRate histograms of TCDS trigger types will not be booked for this run.";
259 
260  // book the rate histograms for the L1T triggers that are included in the L1T menu
261  booker.setCurrentFolder(m_dqm_path + "/L1T");
262  auto const &l1tMenu = setup.getData(m_l1tMenu_token);
263  for (auto const &keyval : l1tMenu.getAlgorithmMap()) {
264  unsigned int const bit = keyval.second.getIndex();
265  if (bit >= histograms.l1t_counts.size()) {
266  edm::LogError("TriggerRatesMonitor")
267  << "This should never happen: bit of L1T algorithm (bit=" << bit << ", name=\"" << keyval.first
268  << "\") is not smaller than size of \"histograms.l1t_counts\" vector (size=" << histograms.l1t_counts.size()
269  << ").\nRate histogram of this L1T algorithm will not be booked for this run.";
270  continue;
271  }
272  bool masked = false; // FIXME read L1T masks once they will be avaiable in the EventSetup
273  std::string const &name = fmt::sprintf("%s (bit %d)", keyval.first, bit);
274  std::string const &title =
275  fmt::sprintf("%s (bit %d)%s vs. lumisection", keyval.first, bit, (masked ? " (masked)" : ""));
276  histograms.l1t_counts[bit] = booker.book1D(name, title, m_lumisections_range + 1, -0.5, m_lumisections_range + 0.5);
277  }
278 
279  if (histograms.hltConfig.inited()) {
280  auto const &datasetNames = histograms.hltConfig.datasetNames();
281 
282  // book the rate histograms for the HLT triggers
283  for (unsigned int d = 0; d < datasetNames.size(); ++d) {
284  booker.setCurrentFolder(m_dqm_path + "/HLT/" + datasetNames[d]);
285  for (unsigned int i = 0; i < histograms.datasets[d].size(); ++i) {
286  unsigned int index = histograms.datasets[d][i];
287  std::string const &name = histograms.hltConfig.triggerName(index);
288  histograms.hlt_by_dataset_counts[d][i].pass_l1_seed = booker.book1D(name + "_pass_L1_seed",
289  name + " pass L1 seed, vs. lumisection",
291  -0.5,
292  m_lumisections_range + 0.5);
293  histograms.hlt_by_dataset_counts[d][i].pass_prescale = booker.book1D(name + "_pass_prescaler",
294  name + " pass prescaler, vs. lumisection",
296  -0.5,
297  m_lumisections_range + 0.5);
298  histograms.hlt_by_dataset_counts[d][i].accept = booker.book1D(name + "_accept",
299  name + " accept, vs. lumisection",
301  -0.5,
302  m_lumisections_range + 0.5);
303  histograms.hlt_by_dataset_counts[d][i].reject = booker.book1D(name + "_reject",
304  name + " reject, vs. lumisection",
306  -0.5,
307  m_lumisections_range + 0.5);
308  histograms.hlt_by_dataset_counts[d][i].error = booker.book1D(name + "_error",
309  name + " error, vs. lumisection",
311  -0.5,
312  m_lumisections_range + 0.5);
313  }
314 
315  for (unsigned int i : histograms.datasets[d]) {
316  // look for the index of the (last) L1T seed and prescale module in each path
317  histograms.hltIndices[i].index_l1_seed = histograms.hltConfig.size(i);
318  histograms.hltIndices[i].index_prescale = histograms.hltConfig.size(i);
319  for (unsigned int j = 0; j < histograms.hltConfig.size(i); ++j) {
320  std::string const &label = histograms.hltConfig.moduleLabel(i, j);
321  std::string const &type = histograms.hltConfig.moduleType(label);
322  if (type == "HLTL1TSeed" or type == "HLTLevel1GTSeed" or type == "HLTLevel1Activity" or
323  type == "HLTLevel1Pattern") {
324  // there might be more L1T seed filters in sequence
325  // keep looking and store the index of the last one
326  histograms.hltIndices[i].index_l1_seed = j;
327  } else if (type == "HLTPrescaler") {
328  // there should be only one prescaler in a path, and it should follow all L1T seed filters
329  histograms.hltIndices[i].index_prescale = j;
330  break;
331  }
332  }
333  }
334  }
335 
336  // book the rate histograms for the HLT datasets
337  booker.setCurrentFolder(m_dqm_path + "/Datasets");
338  for (unsigned int i = 0; i < datasetNames.size(); ++i)
339  histograms.dataset_counts[i] =
341 
342  // book the rate histograms for the HLT streams
343  booker.setCurrentFolder(m_dqm_path + "/Streams");
344  auto const &streamNames = histograms.hltConfig.streamNames();
345  for (unsigned int i = 0; i < streamNames.size(); ++i)
346  histograms.stream_counts[i] =
347  booker.book1D(streamNames[i], streamNames[i], m_lumisections_range + 1, -0.5, m_lumisections_range + 0.5);
348  }
349 }
const std::string m_dqm_path
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
Log< level::Error, false > LogError
const uint32_t m_lumisections_range
static constexpr const char *const s_tcds_trigger_types[]
char const * label
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
Definition: Activities.doc:12
d
Definition: ztail.py:151
const edm::ESGetToken< L1TUtmTriggerMenu, L1TUtmTriggerMenuRcd > m_l1tMenu_token
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98

◆ dqmAnalyze()

void TriggerRatesMonitor::dqmAnalyze ( edm::Event const &  event,
edm::EventSetup const &  setup,
RunBasedHistograms const &  histograms 
) const
overrideprivatevirtual

Implements DQMGlobalEDAnalyzerBase< RunBasedHistograms, Args... >.

Definition at line 351 of file TriggerRatesMonitor.cc.

References accept(), ztail::d, edm::InputTag::encode(), JetHT_cfg::hltResults, mps_fire::i, dqmiolumiharvest::j, m_hlt_results_token, m_l1t_results_inputTag, m_l1t_results_token, GlobalAlgBlk::maxPhysicsTriggers, castor_dqm_sourceclient_file_cfg::path, and mysort::results.

353  {
354  unsigned int lumisection = event.luminosityBlock();
355 
356  // monitor the overall event count and event types rates
357  histograms.events_processed->Fill(lumisection);
358  if (histograms.tcds_counts[event.experimentType()])
359  histograms.tcds_counts[event.experimentType()]->Fill(lumisection);
360 
361  // monitor the rates of L1T triggers
362  auto const &algBlkBxVecHandle = event.getHandle(m_l1t_results_token);
363  if (not algBlkBxVecHandle.isValid()) {
364  edm::LogError("TriggerRatesMonitor")
365  << "L1 trigger results with label [" << m_l1t_results_inputTag.encode()
366  << "] not present or invalid. MonitorElements of L1T results not filled for this event.";
367  } else if (algBlkBxVecHandle->isEmpty(0)) {
368  edm::LogError("TriggerRatesMonitor")
369  << "L1 trigger results with label [" << m_l1t_results_inputTag.encode()
370  << "] empty for BX=0. MonitorElements of L1T results not filled for this event.";
371  } else {
372  auto const &results = algBlkBxVecHandle->at(0, 0);
373  for (unsigned int i = 0; i < GlobalAlgBlk::maxPhysicsTriggers; ++i)
374  if (results.getAlgoDecisionFinal(i))
375  if (histograms.l1t_counts[i])
376  histograms.l1t_counts[i]->Fill(lumisection);
377  }
378 
379  // monitor the rates of HLT triggers, datasets and streams
380  if (histograms.hltConfig.inited()) {
381  auto const &hltResults = event.get(m_hlt_results_token);
382  if (hltResults.size() != histograms.hltIndices.size()) {
383  edm::LogError("TriggerRatesMonitor")
384  << "This should never happen: the number of HLT paths has changed since the beginning of the run"
385  << " (from " << histograms.hltIndices.size() << " to " << hltResults.size() << ").\n"
386  << "Histograms for rates of HLT paths, datasets and streams will not be filled for this event.";
387  return;
388  }
389 
390  for (unsigned int d = 0; d < histograms.datasets.size(); ++d) {
391  for (unsigned int i : histograms.datasets[d])
392  if (hltResults[i].accept()) {
393  histograms.dataset_counts[d]->Fill(lumisection);
394  // ensure each dataset is incremented only once per event
395  break;
396  }
397  for (unsigned int i = 0; i < histograms.datasets[d].size(); ++i) {
398  unsigned int const index = histograms.datasets[d][i];
400 
401  if (path.index() > histograms.hltIndices[index].index_l1_seed)
402  histograms.hlt_by_dataset_counts[d][i].pass_l1_seed->Fill(lumisection);
403  if (path.index() > histograms.hltIndices[index].index_prescale)
404  histograms.hlt_by_dataset_counts[d][i].pass_prescale->Fill(lumisection);
405  if (path.accept())
406  histograms.hlt_by_dataset_counts[d][i].accept->Fill(lumisection);
407  else if (path.error())
408  histograms.hlt_by_dataset_counts[d][i].error->Fill(lumisection);
409  else
410  histograms.hlt_by_dataset_counts[d][i].reject->Fill(lumisection);
411  }
412  }
413 
414  for (unsigned int i = 0; i < histograms.streams.size(); ++i)
415  for (unsigned int j : histograms.streams[i])
416  if (hltResults[j].accept()) {
417  histograms.stream_counts[i]->Fill(lumisection);
418  // ensure each stream is incremented only once per event
419  break;
420  }
421  }
422 }
std::string encode() const
Definition: InputTag.cc:159
const edm::EDGetTokenT< edm::TriggerResults > m_hlt_results_token
Log< level::Error, false > LogError
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:31
const edm::EDGetTokenT< GlobalAlgBlkBxCollection > m_l1t_results_token
d
Definition: ztail.py:151
results
Definition: mysort.py:8
static constexpr unsigned int maxPhysicsTriggers
Definition: GlobalAlgBlk.h:52
const edm::InputTag m_l1t_results_inputTag
Definition: event.py:1

◆ dqmBeginRun()

void TriggerRatesMonitor::dqmBeginRun ( edm::Run const &  run,
edm::EventSetup const &  setup,
RunBasedHistograms &  histograms 
) const
overrideprivatevirtual

Reimplemented from DQMGlobalEDAnalyzerBase< RunBasedHistograms, Args... >.

Definition at line 163 of file TriggerRatesMonitor.cc.

References mps_fire::i, SummaryClient_cfi::labels, edm::EDConsumerBase::labelsForToken(), LogDebug, m_hlt_results_token, GlobalAlgBlk::maxPhysicsTriggers, castor_dqm_sourceclient_file_cfg::path, Skims_PA_cff::paths, writedatasetfile::run, s_tcds_trigger_types, singleTopDQM_cfi::setup, jetUpdater_cfi::sort, and tier0::unique().

165  {
166  histograms.tcds_counts.clear();
167  histograms.tcds_counts.resize(sizeof(s_tcds_trigger_types) / sizeof(const char *));
168 
169  // cache the L1T trigger menu
170  histograms.l1t_counts.clear();
171  histograms.l1t_counts.resize(GlobalAlgBlk::maxPhysicsTriggers);
172 
173  // initialise the HLTConfigProvider
174  bool changed = true;
177  if (histograms.hltConfig.init(run, setup, labels.process, changed)) {
178  // number of trigger paths in labels.process
179  auto const nTriggers = histograms.hltConfig.size();
180  histograms.hltIndices.resize(nTriggers);
181 
182  unsigned int const nDatasets = histograms.hltConfig.datasetNames().size();
183  histograms.hlt_by_dataset_counts.clear();
184  histograms.hlt_by_dataset_counts.resize(nDatasets);
185 
186  histograms.datasets.clear();
187  histograms.datasets.resize(nDatasets);
188  for (unsigned int i = 0; i < nDatasets; ++i) {
189  auto const &paths = histograms.hltConfig.datasetContent(i);
190  histograms.hlt_by_dataset_counts[i].resize(paths.size());
191  histograms.datasets[i].reserve(paths.size());
192  for (auto const &path : paths) {
193  auto const triggerIdx = histograms.hltConfig.triggerIndex(path);
194  if (triggerIdx < nTriggers)
195  histograms.datasets[i].push_back(triggerIdx);
196  else
197  LogDebug("TriggerRatesMonitor")
198  << "The rates of the HLT path \"" << path << "\" (dataset: \"" << histograms.hltConfig.datasetName(i)
199  << "\") will not be monitored for this run.\nThis HLT path is not available in the process \""
200  << labels.process << "\", but it is listed in its \"datasets\" PSet.";
201  }
202  }
203  histograms.dataset_counts.clear();
204  histograms.dataset_counts.resize(nDatasets);
205 
206  unsigned int const nStreams = histograms.hltConfig.streamNames().size();
207  histograms.streams.clear();
208  histograms.streams.resize(nStreams);
209  for (unsigned int i = 0; i < nStreams; ++i) {
210  for (auto const &dataset : histograms.hltConfig.streamContent(i)) {
211  for (auto const &path : histograms.hltConfig.datasetContent(dataset)) {
212  auto const triggerIdx = histograms.hltConfig.triggerIndex(path);
213  if (triggerIdx < nTriggers)
214  histograms.streams[i].push_back(triggerIdx);
215  else
216  LogDebug("TriggerRatesMonitor")
217  << "The rates of the HLT path \"" << path << "\" (stream: \"" << histograms.hltConfig.streamName(i)
218  << "\", dataset: \"" << dataset << "\") will not be monitored for this run.\n"
219  << "This HLT path is not available in the process \"" << labels.process
220  << "\", but it is listed in its \"datasets\" PSet.";
221  }
222  }
223  std::sort(histograms.streams[i].begin(), histograms.streams[i].end());
224  auto unique_end = std::unique(histograms.streams[i].begin(), histograms.streams[i].end());
225  histograms.streams[i].resize(unique_end - histograms.streams[i].begin());
226  histograms.streams[i].shrink_to_fit();
227  }
228  histograms.stream_counts.clear();
229  histograms.stream_counts.resize(nStreams);
230  } else {
231  // HLTConfigProvider not initialised, skip the the HLT monitoring
232  edm::LogError("TriggerRatesMonitor") << "Failed to initialise HLTConfigProvider: the rates of HLT triggers, "
233  "datasets and streams will not be monitored for this run.";
234  }
235 }
const edm::EDGetTokenT< edm::TriggerResults > m_hlt_results_token
Log< level::Error, false > LogError
static constexpr const char *const s_tcds_trigger_types[]
def unique(seq, keepstr=True)
Definition: tier0.py:24
static constexpr unsigned int maxPhysicsTriggers
Definition: GlobalAlgBlk.h:52
void labelsForToken(EDGetToken iToken, Labels &oLabels) const
#define LogDebug(id)

◆ fillDescriptions()

void TriggerRatesMonitor::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 145 of file TriggerRatesMonitor.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, ProducerED_cfi::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

145  {
147  desc.addUntracked<edm::InputTag>("l1tResults", edm::InputTag("gtStage2Digis"));
148  desc.addUntracked<edm::InputTag>("hltResults", edm::InputTag("TriggerResults"));
149  desc.addUntracked<std::string>("dqmPath", "HLT/TriggerRates");
150  desc.addUntracked<uint32_t>("lumisectionRange", 2500); // ~16 hours
151  descriptions.add("triggerRatesMonitor", desc);
152 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

Member Data Documentation

◆ m_dqm_path

const std::string TriggerRatesMonitor::m_dqm_path
private

Definition at line 138 of file TriggerRatesMonitor.cc.

Referenced by bookHistograms().

◆ m_hlt_results_token

const edm::EDGetTokenT<edm::TriggerResults> TriggerRatesMonitor::m_hlt_results_token
private

Definition at line 137 of file TriggerRatesMonitor.cc.

Referenced by dqmAnalyze(), and dqmBeginRun().

◆ m_l1t_results_inputTag

const edm::InputTag TriggerRatesMonitor::m_l1t_results_inputTag
private

Definition at line 135 of file TriggerRatesMonitor.cc.

Referenced by dqmAnalyze().

◆ m_l1t_results_token

const edm::EDGetTokenT<GlobalAlgBlkBxCollection> TriggerRatesMonitor::m_l1t_results_token
private

Definition at line 136 of file TriggerRatesMonitor.cc.

Referenced by dqmAnalyze().

◆ m_l1tMenu_token

const edm::ESGetToken<L1TUtmTriggerMenu, L1TUtmTriggerMenuRcd> TriggerRatesMonitor::m_l1tMenu_token
private

Definition at line 134 of file TriggerRatesMonitor.cc.

Referenced by bookHistograms().

◆ m_lumisections_range

const uint32_t TriggerRatesMonitor::m_lumisections_range
private

Definition at line 139 of file TriggerRatesMonitor.cc.

Referenced by bookHistograms().

◆ s_tcds_trigger_types

constexpr const char *const TriggerRatesMonitor::s_tcds_trigger_types
staticprivate
Initial value:
= {
"Empty",
"Physics",
"Calibration",
"Random",
"Auxiliary",
nullptr,
nullptr,
nullptr,
"Cyclic",
"Bunch-pattern",
"Software",
"TTS",
nullptr,
nullptr,
nullptr,
nullptr
}

Definition at line 114 of file TriggerRatesMonitor.cc.

Referenced by bookHistograms(), and dqmBeginRun().