CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
TriggerRatesMonitor Class Reference
Inheritance diagram for TriggerRatesMonitor:
DQMEDAnalyzer edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > > edm::stream::EDAnalyzerBase edm::EDConsumerBase

Classes

struct  HLTIndices
 
struct  HLTRatesPlots
 

Public Member Functions

 TriggerRatesMonitor (edm::ParameterSet const &)
 
 ~TriggerRatesMonitor ()
 
- Public Member Functions inherited from DQMEDAnalyzer
virtual void beginRun (edm::Run const &, edm::EventSetup const &) final
 
virtual void beginStream (edm::StreamID id) final
 
 DQMEDAnalyzer (void)
 
virtual void endLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
virtual void endRunSummary (edm::Run const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
uint32_t streamId () const
 
- Public Member Functions inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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::vector< ModuleDescription const * > &modules, 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
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static std::shared_ptr< dqmDetails::NoCacheglobalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
 
static std::shared_ptr< dqmDetails::NoCacheglobalBeginRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *)
 
static void globalEndLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *, dqmDetails::NoCache *)
 
static void globalEndRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *, dqmDetails::NoCache *)
 
- Static Public Member Functions inherited from edm::stream::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

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

Private Attributes

std::vector< TH1F * > m_dataset_counts
 
std::vector< std::vector< unsigned int > > m_datasets
 
std::string m_dqm_path
 
TH1F * m_events_processed
 
std::vector< std::vector< HLTRatesPlots > > m_hlt_by_dataset_counts
 
const edm::EDGetTokenT< edm::TriggerResultsm_hlt_results
 
HLTConfigProvider m_hltConfig
 
std::vector< HLTIndicesm_hltIndices
 
std::vector< TH1F * > m_l1t_counts
 
const edm::EDGetTokenT< GlobalAlgBlkBxCollectionm_l1t_results
 
L1TUtmTriggerMenu const * m_l1tMenu
 
uint32_t m_lumisections_range
 
std::vector< TH1F * > m_stream_counts
 
std::vector< std::vector< unsigned int > > m_streams
 
std::vector< TH1F * > m_tcds_counts
 

Static Private Attributes

static const char *const s_tcds_trigger_types []
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
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)
 

Detailed Description

Definition at line 61 of file TriggerRatesMonitor.cc.

Constructor & Destructor Documentation

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

Definition at line 163 of file TriggerRatesMonitor.cc.

163  :
164  // module configuration
165  m_l1t_results(consumes<GlobalAlgBlkBxCollection>( config.getUntrackedParameter<edm::InputTag>( "l1tResults" ) )),
166  m_hlt_results(consumes<edm::TriggerResults>( config.getUntrackedParameter<edm::InputTag>( "hltResults" ) )),
167  m_dqm_path( config.getUntrackedParameter<std::string>( "dqmPath" ) ),
168  m_lumisections_range( config.getUntrackedParameter<uint32_t>( "lumisectionRange" ) ),
169  // L1T and HLT configuration
170  m_l1tMenu(nullptr),
171  m_hltConfig(),
172  m_hltIndices(),
173  m_datasets(),
174  m_streams(),
175  // overall event count and event types
176  m_events_processed(nullptr),
177  m_tcds_counts(),
178  // L1T triggers
179  m_l1t_counts(),
180  // HLT triggers
182  // datasets
184  // streams
186 {
187 }
const edm::EDGetTokenT< GlobalAlgBlkBxCollection > m_l1t_results
const edm::EDGetTokenT< edm::TriggerResults > m_hlt_results
std::vector< std::vector< HLTRatesPlots > > m_hlt_by_dataset_counts
Definition: config.py:1
std::vector< std::vector< unsigned int > > m_streams
std::vector< TH1F * > m_dataset_counts
std::vector< std::vector< unsigned int > > m_datasets
L1TUtmTriggerMenu const * m_l1tMenu
HLTConfigProvider m_hltConfig
std::vector< TH1F * > m_stream_counts
std::vector< TH1F * > m_l1t_counts
std::vector< HLTIndices > m_hltIndices
std::vector< TH1F * > m_tcds_counts
TriggerRatesMonitor::~TriggerRatesMonitor ( )

Definition at line 189 of file TriggerRatesMonitor.cc.

190 {
191 }

Member Function Documentation

void TriggerRatesMonitor::analyze ( edm::Event const &  event,
edm::EventSetup const &  setup 
)
overrideprivatevirtual

Implements edm::stream::EDAnalyzerBase.

Definition at line 331 of file TriggerRatesMonitor.cc.

References accept(), edm::HLTPathStatus::accept(), edm::HLTGlobalStatus::at(), edmIntegrityCheck::d, DEFINE_FWK_MODULE, relativeConstraints::error, edm::HLTPathStatus::error(), event(), edm::EventBase::experimentType(), HcalObjRepresent::Fill(), SelectingProcedure_cff::hltResults, mps_fire::i, edm::HLTPathStatus::index(), diffTreeTool::index, HLTConfigProvider::inited(), m_dataset_counts, m_datasets, m_events_processed, m_hlt_by_dataset_counts, m_hlt_results, m_hltConfig, m_hltIndices, m_l1t_counts, m_l1t_results, m_l1tMenu, m_stream_counts, m_streams, m_tcds_counts, GlobalAlgBlk::maxPhysicsTriggers, callgraph::path, mps_update::results, and edm::HLTGlobalStatus::size().

332 {
333  unsigned int lumisection = event.luminosityBlock();
334 
335  // monitor the overall event count and event types rates
336  m_events_processed->Fill(lumisection);
337  if (m_tcds_counts[event.experimentType()])
338  m_tcds_counts[event.experimentType()]->Fill(lumisection);
339 
340  // monitor the L1 triggers rates
341  if (m_l1tMenu) {
342  auto const & bxvector = get<GlobalAlgBlkBxCollection>(event, m_l1t_results);
343  if (not bxvector.isEmpty(0)) {
344  auto const & results = bxvector.at(0, 0);
345  for (unsigned int i = 0; i < GlobalAlgBlk::maxPhysicsTriggers; ++i)
346  if (results.getAlgoDecisionFinal(i))
347  if (m_l1t_counts[i])
348  m_l1t_counts[i]->Fill(lumisection);
349  }
350  }
351 
352  // monitor the HLT triggers and datsets rates
353  if (m_hltConfig.inited()) {
354  edm::TriggerResults const & hltResults = get<edm::TriggerResults>(event, m_hlt_results);
355  if (hltResults.size() == m_hltIndices.size()) {
356  } else {
357  edm::LogWarning("TriggerRatesMonitor") << "This should never happen: the number of HLT paths has changed since the beginning of the run";
358  }
359 
360  for (unsigned int d = 0; d < m_datasets.size(); ++d) {
361  for (unsigned int i: m_datasets[d])
362  if (hltResults.at(i).accept()) {
363  m_dataset_counts[d]->Fill(lumisection);
364  // ensure each dataset is incremented only once per event
365  break;
366  }
367  for (unsigned int i = 0; i < m_datasets[d].size(); ++i) {
368  unsigned int index = m_datasets[d][i];
369  edm::HLTPathStatus const & path = hltResults.at(index);
370 
371  if (path.index() > m_hltIndices[index].index_l1_seed)
372  m_hlt_by_dataset_counts[d][i].pass_l1_seed->Fill(lumisection);
373  if (path.index() > m_hltIndices[index].index_prescale)
374  m_hlt_by_dataset_counts[d][i].pass_prescale->Fill(lumisection);
375  if (path.accept())
376  m_hlt_by_dataset_counts[d][i].accept->Fill(lumisection);
377  else if (path.error())
378  m_hlt_by_dataset_counts[d][i].error ->Fill(lumisection);
379  else
380  m_hlt_by_dataset_counts[d][i].reject->Fill(lumisection);
381  }
382  }
383 
384  for (unsigned int i = 0; i < m_streams.size(); ++i)
385  for (unsigned int j: m_streams[i])
386  if (hltResults.at(j).accept()) {
387  m_stream_counts[i]->Fill(lumisection);
388  // ensure each stream is incremented only once per event
389  break;
390  }
391  }
392 }
const edm::EDGetTokenT< GlobalAlgBlkBxCollection > m_l1t_results
const edm::EDGetTokenT< edm::TriggerResults > m_hlt_results
std::vector< std::vector< HLTRatesPlots > > m_hlt_by_dataset_counts
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:30
static const unsigned int maxPhysicsTriggers
Definition: GlobalAlgBlk.h:52
bool inited() const
Accessors (const methods)
std::vector< std::vector< unsigned int > > m_streams
std::vector< TH1F * > m_dataset_counts
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
unsigned int size() const
Get number of paths stored.
std::vector< std::vector< unsigned int > > m_datasets
L1TUtmTriggerMenu const * m_l1tMenu
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
const HLTPathStatus & at(const unsigned int i) const
HLTConfigProvider m_hltConfig
bool error() const
has this path encountered an error (exception)?
Definition: HLTPathStatus.h:64
std::vector< TH1F * > m_stream_counts
bool accept() const
has this path accepted the event?
Definition: HLTPathStatus.h:62
std::vector< TH1F * > m_l1t_counts
std::vector< HLTIndices > m_hltIndices
std::vector< TH1F * > m_tcds_counts
Definition: event.py:1
unsigned int index() const
Definition: HLTPathStatus.h:55
void TriggerRatesMonitor::bookHistograms ( DQMStore::IBooker booker,
edm::Run const &  run,
edm::EventSetup const &  setup 
)
overrideprivatevirtual

Implements DQMEDAnalyzer.

Definition at line 253 of file TriggerRatesMonitor.cc.

References DQMStore::IBooker::book1D(), edmIntegrityCheck::d, HLTConfigProvider::datasetNames(), edmIntegrityCheck::datasets, cmsPerfStripChart::format, L1TUtmTriggerMenu::getAlgorithmMap(), MonitorElement::getTH1F(), mps_fire::i, diffTreeTool::index, HLTConfigProvider::inited(), diffTwoXMLs::label, m_dataset_counts, m_datasets, m_dqm_path, m_events_processed, m_hlt_by_dataset_counts, m_hltConfig, m_hltIndices, m_l1t_counts, m_l1tMenu, m_lumisections_range, m_stream_counts, m_tcds_counts, HLTConfigProvider::moduleLabel(), HLTConfigProvider::moduleType(), dataset::name, or, s_tcds_trigger_types, DQMStore::IBooker::setCurrentFolder(), HLTConfigProvider::size(), harvestTrackValidationPlots::str, HLTConfigProvider::streamNames(), AlCaHLTBitMon_QueryRunRegistry::string, fftjetcommon_cfi::title, and HLTConfigProvider::triggerName().

254 {
255  // book the overall event count and event types histograms
256  booker.setCurrentFolder( m_dqm_path );
257  m_events_processed = booker.book1D("events", "Processed events vs. lumisection", m_lumisections_range + 1, -0.5, m_lumisections_range + 0.5)->getTH1F();
258  booker.setCurrentFolder( m_dqm_path + "/TCDS" );
259  for (unsigned int i = 0; i < sizeof(s_tcds_trigger_types)/sizeof(const char *); ++i)
260  if (s_tcds_trigger_types[i]) {
261  std::string const & title = (boost::format("%s events vs. lumisection") % s_tcds_trigger_types[i]).str();
263  }
264 
265  if (m_l1tMenu) {
266  // book the rate histograms for the L1 triggers that are included in the L1 menu
267  booker.setCurrentFolder( m_dqm_path + "/L1T" );
268  for (auto const & keyval: m_l1tMenu->getAlgorithmMap()) {
269  unsigned int bit = keyval.second.getIndex();
270  bool masked = false; // FIXME read L1 masks once they will be avaiable in the EventSetup
271  std::string const & name = (boost::format("%s (bit %d)") % keyval.first % bit).str();
272  std::string const & title = (boost::format("%s (bit %d)%s vs. lumisection") % keyval.first % bit % (masked ? " (masked)" : "")).str();
273  m_l1t_counts.at(bit) = booker.book1D(name, title, m_lumisections_range + 1, -0.5, m_lumisections_range + 0.5)->getTH1F();
274  }
275  }
276 
277  if (m_hltConfig.inited()) {
278 
279  auto const & datasets = m_hltConfig.datasetNames();
280 
281  // book the rate histograms for the HLT triggers
282  for (unsigned int d = 0; d < datasets.size(); ++d) {
283  booker.setCurrentFolder( m_dqm_path + "/HLT/" + datasets[d]);
284  for (unsigned int i = 0; i < m_datasets[d].size(); ++i) {
285  unsigned int index = m_datasets[d][i];
286  std::string const & name = m_hltConfig.triggerName(index);
287  m_hlt_by_dataset_counts[d][i].pass_l1_seed = booker.book1D(name + "_pass_L1_seed", name + " pass L1 seed, vs. lumisection", m_lumisections_range + 1, -0.5, m_lumisections_range + 0.5)->getTH1F();
288  m_hlt_by_dataset_counts[d][i].pass_prescale = booker.book1D(name + "_pass_prescaler", name + " pass prescaler, vs. lumisection", m_lumisections_range + 1, -0.5, m_lumisections_range + 0.5)->getTH1F();
289  m_hlt_by_dataset_counts[d][i].accept = booker.book1D(name + "_accept", name + " accept, vs. lumisection", m_lumisections_range + 1, -0.5, m_lumisections_range + 0.5)->getTH1F();
290  m_hlt_by_dataset_counts[d][i].reject = booker.book1D(name + "_reject", name + " reject, vs. lumisection", m_lumisections_range + 1, -0.5, m_lumisections_range + 0.5)->getTH1F();
291  m_hlt_by_dataset_counts[d][i].error = booker.book1D(name + "_error", name + " error, vs. lumisection", m_lumisections_range + 1, -0.5, m_lumisections_range + 0.5)->getTH1F();
292  }
293 
294  // booker.setCurrentFolder( m_dqm_path + "/HLT/" + datasets[d]);
295  for (unsigned int i: m_datasets[d]) {
296 
297  // look for the index of the (last) L1 seed and prescale module in each path
298  m_hltIndices[i].index_l1_seed = m_hltConfig.size(i);
299  m_hltIndices[i].index_prescale = m_hltConfig.size(i);
300  for (unsigned int j = 0; j < m_hltConfig.size(i); ++j) {
301  std::string const & label = m_hltConfig.moduleLabel(i, j);
302  std::string const & type = m_hltConfig.moduleType(label);
303  if (type == "HLTL1TSeed" or type == "HLTLevel1GTSeed" or type == "HLTLevel1Activity" or type == "HLTLevel1Pattern") {
304  // there might be more L1 seed filters in sequence
305  // keep looking and store the index of the last one
306  m_hltIndices[i].index_l1_seed = j;
307  } else if (type == "HLTPrescaler") {
308  // there should be only one prescaler in a path, and it should follow all L1 seed filters
309  m_hltIndices[i].index_prescale = j;
310  break;
311  }
312  }
313  }
314  }
315 
316  // book the HLT datasets rate histograms
317  booker.setCurrentFolder( m_dqm_path + "/Datasets" );
318  for (unsigned int i = 0; i < datasets.size(); ++i)
320 
321  // book the HLT streams rate histograms
322  booker.setCurrentFolder( m_dqm_path + "/Streams" );
323  auto const & streams = m_hltConfig.streamNames();
324  for (unsigned int i = 0; i < streams.size(); ++i)
325  m_stream_counts[i] = booker.book1D(streams[i], streams[i], m_lumisections_range + 1, -0.5, m_lumisections_range + 0.5)->getTH1F();
326  }
327 
328 }
unsigned int size() const
number of trigger paths in trigger table
type
Definition: HCALResponse.h:21
const std::string moduleType(const std::string &module) const
C++ class name of module.
const std::string & triggerName(unsigned int triggerIndex) const
std::vector< std::vector< HLTRatesPlots > > m_hlt_by_dataset_counts
const std::string & moduleLabel(unsigned int trigger, unsigned int module) const
bool inited() const
Accessors (const methods)
static const char *const s_tcds_trigger_types[]
const std::vector< std::string > & streamNames() const
std::vector< TH1F * > m_dataset_counts
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
std::vector< std::vector< unsigned int > > m_datasets
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
L1TUtmTriggerMenu const * m_l1tMenu
format
Some error handling for the usage.
HLTConfigProvider m_hltConfig
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:277
TH1F * getTH1F(void) const
std::vector< TH1F * > m_stream_counts
const std::map< std::string, L1TUtmAlgorithm > & getAlgorithmMap() const
std::vector< TH1F * > m_l1t_counts
std::vector< HLTIndices > m_hltIndices
std::vector< TH1F * > m_tcds_counts
const std::vector< std::string > & datasetNames() const
void TriggerRatesMonitor::dqmBeginRun ( edm::Run const &  run,
edm::EventSetup const &  setup 
)
overrideprivatevirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 193 of file TriggerRatesMonitor.cc.

References begin, HLTConfigProvider::datasetContent(), HLTConfigProvider::datasetNames(), edmIntegrityCheck::datasets, end, mps_fire::i, HLTConfigProvider::init(), tablePrinter::labels, edm::EDConsumerBase::labelsForToken(), m_dataset_counts, m_datasets, m_events_processed, m_hlt_by_dataset_counts, m_hlt_results, m_hltConfig, m_hltIndices, m_l1t_counts, m_l1tMenu, m_stream_counts, m_streams, m_tcds_counts, GlobalAlgBlk::maxPhysicsTriggers, callgraph::path, edm::ProductLabels::process, s_tcds_trigger_types, GeneralSetup::setup(), HLTConfigProvider::size(), HLTConfigProvider::streamContent(), HLTConfigProvider::streamNames(), HLTConfigProvider::triggerIndex(), and tier0::unique().

194 {
195  m_events_processed = nullptr;
196  m_tcds_counts.clear();
197  m_tcds_counts.resize(sizeof(s_tcds_trigger_types)/sizeof(const char *), nullptr);
198 
199  // cache the L1 trigger menu
200  m_l1tMenu = & get<L1TUtmTriggerMenuRcd, L1TUtmTriggerMenu>(setup);
201  if (m_l1tMenu) {
202  m_l1t_counts.clear();
204  } else {
205  edm::LogError("TriggerRatesMonitor") << "failed to read the L1 menu from the EventSetup, the L1 trigger rates will not be monitored";
206  }
207 
208  // initialise the HLTConfigProvider
209  bool changed = true;
211  labelsForToken(m_hlt_results, labels);
212  if (m_hltConfig.init(run, setup, labels.process, changed)) {
213  m_hltIndices.resize( m_hltConfig.size(), HLTIndices() );
214 
215  unsigned int datasets = m_hltConfig.datasetNames().size();
216  m_hlt_by_dataset_counts.clear();
217  m_hlt_by_dataset_counts.resize( datasets, {} );
218 
219  m_datasets.clear();
220  m_datasets.resize( datasets, {} );
221  for (unsigned int i = 0; i < datasets; ++i) {
222  auto const & paths = m_hltConfig.datasetContent(i);
223  m_hlt_by_dataset_counts[i].resize( paths.size(), HLTRatesPlots() );
224  m_datasets[i].reserve(paths.size());
225  for (auto const & path: paths) {
227  }
228  }
229  m_dataset_counts.clear();
230  m_dataset_counts.resize( datasets, nullptr );
231 
232  unsigned int streams = m_hltConfig.streamNames().size();
233  m_streams.clear();
234  m_streams.resize( streams, {} );
235  for (unsigned int i = 0; i < streams; ++i) {
236  for (auto const & dataset : m_hltConfig.streamContent(i)) {
237  for (auto const & path : m_hltConfig.datasetContent(dataset))
238  m_streams[i].push_back(m_hltConfig.triggerIndex(path));
239  }
240  std::sort(m_streams[i].begin(), m_streams[i].end());
241  auto unique_end = std::unique(m_streams[i].begin(), m_streams[i].end());
242  m_streams[i].resize(unique_end - m_streams[i].begin());
243  m_streams[i].shrink_to_fit();
244  }
245  m_stream_counts.clear();
246  m_stream_counts.resize( streams, nullptr );
247  } else {
248  // HLTConfigProvider not initialised, skip the the HLT monitoring
249  edm::LogError("TriggerRatesMonitor") << "failed to initialise HLTConfigProvider, the HLT trigger and datasets rates will not be monitored";
250  }
251 }
unsigned int size() const
number of trigger paths in trigger table
const edm::EDGetTokenT< edm::TriggerResults > m_hlt_results
std::vector< std::vector< HLTRatesPlots > > m_hlt_by_dataset_counts
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:1
static const unsigned int maxPhysicsTriggers
Definition: GlobalAlgBlk.h:52
char const * process
Definition: ProductLabels.h:7
unsigned int triggerIndex(const std::string &triggerName) const
slot position of trigger path in trigger table (0 to size-1)
static const char *const s_tcds_trigger_types[]
std::vector< std::vector< unsigned int > > m_streams
const std::vector< std::string > & streamNames() const
std::vector< TH1F * > m_dataset_counts
const std::vector< std::string > & streamContent(unsigned int stream) const
names of datasets in stream with index i
def unique(seq, keepstr=True)
Definition: tier0.py:24
std::vector< std::vector< unsigned int > > m_datasets
#define end
Definition: vmac.h:37
L1TUtmTriggerMenu const * m_l1tMenu
HLTConfigProvider m_hltConfig
const std::vector< std::string > & datasetContent(unsigned int dataset) const
names of trigger paths in dataset with index i
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
std::vector< TH1F * > m_stream_counts
void labelsForToken(EDGetToken iToken, Labels &oLabels) const
#define begin
Definition: vmac.h:30
std::vector< TH1F * > m_l1t_counts
std::vector< HLTIndices > m_hltIndices
std::vector< TH1F * > m_tcds_counts
const std::vector< std::string > & datasetNames() const
void TriggerRatesMonitor::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 152 of file TriggerRatesMonitor.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::addUntracked(), and AlCaHLTBitMon_QueryRunRegistry::string.

153 {
155  desc.addUntracked<edm::InputTag>( "l1tResults", edm::InputTag("gtStage2Digis"));
156  desc.addUntracked<edm::InputTag>( "hltResults", edm::InputTag("TriggerResults"));
157  desc.addUntracked<std::string>( "dqmPath", "HLT/TriggerRates" );
158  desc.addUntracked<uint32_t>( "lumisectionRange", 2500 ); // ~16 hours
159  descriptions.add("triggerRatesMonitor", desc);
160 }
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)

Member Data Documentation

std::vector<TH1F *> TriggerRatesMonitor::m_dataset_counts
private

Definition at line 141 of file TriggerRatesMonitor.cc.

Referenced by analyze(), bookHistograms(), and dqmBeginRun().

std::vector<std::vector<unsigned int> > TriggerRatesMonitor::m_datasets
private

Definition at line 117 of file TriggerRatesMonitor.cc.

Referenced by analyze(), bookHistograms(), and dqmBeginRun().

std::string TriggerRatesMonitor::m_dqm_path
private

Definition at line 97 of file TriggerRatesMonitor.cc.

Referenced by bookHistograms().

TH1F* TriggerRatesMonitor::m_events_processed
private

Definition at line 131 of file TriggerRatesMonitor.cc.

Referenced by analyze(), bookHistograms(), and dqmBeginRun().

std::vector<std::vector<HLTRatesPlots> > TriggerRatesMonitor::m_hlt_by_dataset_counts
private

Definition at line 138 of file TriggerRatesMonitor.cc.

Referenced by analyze(), bookHistograms(), and dqmBeginRun().

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

Definition at line 96 of file TriggerRatesMonitor.cc.

Referenced by analyze(), and dqmBeginRun().

HLTConfigProvider TriggerRatesMonitor::m_hltConfig
private

Definition at line 114 of file TriggerRatesMonitor.cc.

Referenced by analyze(), bookHistograms(), and dqmBeginRun().

std::vector<HLTIndices> TriggerRatesMonitor::m_hltIndices
private

Definition at line 115 of file TriggerRatesMonitor.cc.

Referenced by analyze(), bookHistograms(), and dqmBeginRun().

std::vector<TH1F *> TriggerRatesMonitor::m_l1t_counts
private

Definition at line 135 of file TriggerRatesMonitor.cc.

Referenced by analyze(), bookHistograms(), and dqmBeginRun().

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

Definition at line 95 of file TriggerRatesMonitor.cc.

Referenced by analyze().

L1TUtmTriggerMenu const* TriggerRatesMonitor::m_l1tMenu
private

Definition at line 102 of file TriggerRatesMonitor.cc.

Referenced by analyze(), bookHistograms(), and dqmBeginRun().

uint32_t TriggerRatesMonitor::m_lumisections_range
private

Definition at line 98 of file TriggerRatesMonitor.cc.

Referenced by bookHistograms().

std::vector<TH1F *> TriggerRatesMonitor::m_stream_counts
private

Definition at line 144 of file TriggerRatesMonitor.cc.

Referenced by analyze(), bookHistograms(), and dqmBeginRun().

std::vector<std::vector<unsigned int> > TriggerRatesMonitor::m_streams
private

Definition at line 118 of file TriggerRatesMonitor.cc.

Referenced by analyze(), and dqmBeginRun().

std::vector<TH1F *> TriggerRatesMonitor::m_tcds_counts
private

Definition at line 132 of file TriggerRatesMonitor.cc.

Referenced by analyze(), bookHistograms(), and dqmBeginRun().

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

Definition at line 75 of file TriggerRatesMonitor.cc.

Referenced by bookHistograms(), and dqmBeginRun().