CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
TriggerBxMonitor Class Reference
Inheritance diagram for TriggerBxMonitor:
DQMGlobalEDAnalyzer< RunBasedHistograms > edm::global::EDAnalyzer< edm::RunCache< RunBasedHistograms > > edm::global::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 TriggerBxMonitor (edm::ParameterSet const &)
 
 ~TriggerBxMonitor () override=default
 
- Public Member Functions inherited from edm::global::EDAnalyzer< edm::RunCache< RunBasedHistograms > >
 EDAnalyzer ()=default
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDAnalyzerBase () 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
 
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
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) 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 edm::global::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void bookHistograms (DQMStore::ConcurrentBooker &, 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
 
const edm::EDGetTokenT< GlobalAlgBlkBxCollectionm_l1t_results
 
const uint32_t m_ls_range
 
const bool m_make_1d_plots
 
const bool m_make_2d_plots
 

Static Private Attributes

static const unsigned int s_bx_range = 3564
 
static const char * s_tcds_trigger_types []
 

Additional Inherited Members

- Public Types inherited from edm::global::EDAnalyzerBase
typedef EDAnalyzerBase 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 71 of file TriggerBxMonitor.cc.

Constructor & Destructor Documentation

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

Definition at line 131 of file TriggerBxMonitor.cc.

131  :
132  // module configuration
133  m_l1t_results( consumes<GlobalAlgBlkBxCollection>( config.getUntrackedParameter<edm::InputTag>( "l1tResults" ) ) ),
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" ) )
139 {
140 }
const edm::EDGetTokenT< GlobalAlgBlkBxCollection > m_l1t_results
Definition: config.py:1
const edm::EDGetTokenT< edm::TriggerResults > m_hlt_results
const uint32_t m_ls_range
const std::string m_dqm_path
const bool m_make_1d_plots
const bool m_make_2d_plots
TriggerBxMonitor::~TriggerBxMonitor ( )
overridedefault

Member Function Documentation

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

Implements DQMGlobalEDAnalyzer< RunBasedHistograms >.

Definition at line 183 of file TriggerBxMonitor.cc.

References DQMStore::ConcurrentBooker::book1D(), DQMStore::ConcurrentBooker::book2D(), cmsPerfStripChart::format, mps_fire::i, m_dqm_path, m_ls_range, m_make_1d_plots, m_make_2d_plots, GlobalAlgBlk::maxPhysicsTriggers, dataset::name, s_bx_range, s_tcds_trigger_types, DQMStore::IBooker::setCurrentFolder(), GeneralSetup::setup(), findQualityFiles::size, str, and AlCaHLTBitMon_QueryRunRegistry::string.

184 {
185  // TCDS trigger type plots
186  {
188 
189  // book 2D histogram to monitor all TCDS trigger types in a single plot
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);
192 
193  // book the individual histograms for the known TCDS trigger types
194  booker.setCurrentFolder( m_dqm_path + "/TCDS" );
195  for (unsigned int i = 0; i < size; ++i) {
196  if (s_tcds_trigger_types[i]) {
197  if (m_make_1d_plots) {
198  histograms.tcds_bx.at(i) = booker.book1D(s_tcds_trigger_types[i], s_tcds_trigger_types[i], s_bx_range + 1, -0.5, s_bx_range + 0.5);
199  }
200  if (m_make_2d_plots) {
201  std::string const& name_ls = std::string(s_tcds_trigger_types[i]) + " vs LS";
202  histograms.tcds_bx_2d.at(i) = booker.book2D(name_ls, name_ls, s_bx_range + 1, -0.5, s_bx_range + 0.5, m_ls_range, 0.5, m_ls_range + 0.5);
203  }
204  histograms.tcds_bx_all.setBinLabel(i+1, s_tcds_trigger_types[i], 2); // Y axis
205  }
206  }
207  }
208 
209  // L1T plots
210  {
211  // book 2D histogram to monitor all L1 triggers in a single plot
212  booker.setCurrentFolder( m_dqm_path );
213  histograms.l1t_bx_all = booker.book2D("Level 1 Triggers", "Level 1 Triggers vs. bunch crossing", s_bx_range + 1, -0.5, s_bx_range + 0.5, GlobalAlgBlk::maxPhysicsTriggers, -0.5, GlobalAlgBlk::maxPhysicsTriggers - 0.5);
214 
215  // book the individual histograms for the L1 triggers that are included in the L1 menu
216  booker.setCurrentFolder( m_dqm_path + "/L1T" );
217  auto const& l1tMenu = edm::get<L1TUtmTriggerMenu, L1TUtmTriggerMenuRcd>(setup);
218  for (auto const& keyval: l1tMenu.getAlgorithmMap()) {
219  unsigned int bit = keyval.second.getIndex();
220  std::string const& name = (boost::format("%s (bit %d)") % keyval.first % bit).str();
221  if (m_make_1d_plots) {
222  histograms.l1t_bx.at(bit) = booker.book1D(name, name, s_bx_range + 1, -0.5, s_bx_range + 0.5);
223  }
224  if (m_make_2d_plots) {
225  std::string const& name_ls = name + " vs LS";
226  histograms.l1t_bx_2d.at(bit) = booker.book2D(name_ls, name_ls, s_bx_range + 1, -0.5, s_bx_range + 0.5, m_ls_range, 0.5, m_ls_range + 0.5);
227  }
228  histograms.l1t_bx_all.setBinLabel(bit+1, keyval.first, 2); // Y axis
229  }
230  }
231 
232  // HLT plots
233  if (histograms.hltConfig.inited()) {
234  // book 2D histogram to monitor all HLT paths in a single plot
235  booker.setCurrentFolder( m_dqm_path );
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);
237 
238  // book the individual HLT triggers histograms
239  booker.setCurrentFolder( m_dqm_path + "/HLT" );
240  for (unsigned int i = 0; i < histograms.hltConfig.size(); ++i) {
241  std::string const& name = histograms.hltConfig.triggerName(i);
242  if (m_make_1d_plots) {
243  histograms.hlt_bx[i] = booker.book1D(name, name, s_bx_range + 1, -0.5, s_bx_range + 0.5);
244  }
245  if (m_make_2d_plots) {
246  std::string const& name_ls = name + " vs LS";
247  histograms.hlt_bx_2d[i] = booker.book2D(name_ls, name_ls, s_bx_range + 1, -0.5, s_bx_range + 0.5, m_ls_range, 0.5, m_ls_range + 0.5);
248  }
249  histograms.hlt_bx_all.setBinLabel(i+1, name, 2); // Y axis
250  }
251  }
252 }
size
Write out results.
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:1
static const char * s_tcds_trigger_types[]
ConcurrentMonitorElement book2D(Args &&...args)
Definition: DQMStore.h:244
ConcurrentMonitorElement book1D(Args &&...args)
Definition: DQMStore.h:223
format
Some error handling for the usage.
const uint32_t m_ls_range
const std::string m_dqm_path
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
static unsigned int maxPhysicsTriggers
Definition: GlobalAlgBlk.h:54
const bool m_make_1d_plots
static const unsigned int s_bx_range
#define str(s)
const bool m_make_2d_plots
void TriggerBxMonitor::dqmAnalyze ( edm::Event const &  event,
edm::EventSetup const &  setup,
RunBasedHistograms const &  histograms 
) const
overrideprivate

Definition at line 255 of file TriggerBxMonitor.cc.

References DEFINE_FWK_MODULE, edm::get(), SelectingProcedure_cff::hltResults, mps_fire::i, eostools::ls(), m_hlt_results, m_l1t_results, m_make_1d_plots, m_make_2d_plots, GlobalAlgBlk::maxPhysicsTriggers, mps_update::results, s_tcds_trigger_types, and findQualityFiles::size.

256 {
257  unsigned int bx = event.bunchCrossing();
258  unsigned int ls = event.luminosityBlock();
259 
260  // monitor the bx distribution for the TCDS trigger types
261  {
263  unsigned int type = event.experimentType();
264  if (type < size) {
265  if (m_make_1d_plots and histograms.tcds_bx.at(type))
266  histograms.tcds_bx[type].fill(bx);
267  if (m_make_2d_plots and histograms.tcds_bx_2d.at(type))
268  histograms.tcds_bx_2d[type].fill(bx, ls);
269  }
270  histograms.tcds_bx_all.fill(bx, type);
271  }
272 
273  // monitor the bx distribution for the L1 triggers
274  {
275  auto const& bxvector = edm::get(event, m_l1t_results);
276  if (not bxvector.isEmpty(0)) {
277  auto const& results = bxvector.at(0, 0);
278  for (unsigned int i = 0; i < GlobalAlgBlk::maxPhysicsTriggers; ++i)
279  if (results.getAlgoDecisionFinal(i)) {
280  if (m_make_1d_plots and histograms.l1t_bx.at(i))
281  histograms.l1t_bx[i].fill(bx);
282  if (m_make_2d_plots and histograms.l1t_bx_2d.at(i))
283  histograms.l1t_bx_2d[i].fill(bx, ls);
284  histograms.l1t_bx_all.fill(bx, i);
285  }
286  }
287  }
288 
289  // monitor the bx distribution for the HLT triggers
290  if (histograms.hltConfig.inited()) {
291  auto const& hltResults = edm::get(event, m_hlt_results);
292  for (unsigned int i = 0; i < hltResults.size(); ++i) {
293  if (hltResults.at(i).accept()) {
294  if (m_make_1d_plots and histograms.hlt_bx.at(i))
295  histograms.hlt_bx[i].fill(bx);
296  if (m_make_2d_plots and histograms.hlt_bx_2d.at(i))
297  histograms.hlt_bx_2d[i].fill(bx, ls);
298  histograms.hlt_bx_all.fill(bx, i);
299  }
300  }
301  }
302 }
size
Write out results.
type
Definition: HCALResponse.h:21
const edm::EDGetTokenT< GlobalAlgBlkBxCollection > m_l1t_results
const edm::EDGetTokenT< edm::TriggerResults > m_hlt_results
static const char * s_tcds_trigger_types[]
T const & get(Event const &event, InputTag const &tag)
Definition: Event.h:690
def ls(path, rec=False)
Definition: eostools.py:348
static unsigned int maxPhysicsTriggers
Definition: GlobalAlgBlk.h:54
const bool m_make_1d_plots
const bool m_make_2d_plots
Definition: event.py:1
void TriggerBxMonitor::dqmBeginRun ( edm::Run const &  run,
edm::EventSetup const &  setup,
RunBasedHistograms &  histograms 
) const
overrideprivatevirtual

Reimplemented from DQMGlobalEDAnalyzer< RunBasedHistograms >.

Definition at line 142 of file TriggerBxMonitor.cc.

References tablePrinter::labels, edm::EDConsumerBase::labelsForToken(), m_hlt_results, m_make_1d_plots, m_make_2d_plots, GlobalAlgBlk::maxPhysicsTriggers, edm::ProductLabels::process, s_tcds_trigger_types, and findQualityFiles::size.

143 {
144  // initialise the TCDS vector
145  if (m_make_1d_plots) {
146  histograms.tcds_bx.clear();
147  histograms.tcds_bx.resize(std::size(s_tcds_trigger_types));
148  }
149  if (m_make_2d_plots) {
150  histograms.tcds_bx_2d.clear();
151  histograms.tcds_bx_2d.resize(std::size(s_tcds_trigger_types));
152  }
153 
154  // cache the L1 trigger menu
155  if (m_make_1d_plots) {
156  histograms.l1t_bx.clear();
158  }
159  if (m_make_2d_plots) {
160  histograms.l1t_bx_2d.clear();
162  }
163 
164  // initialise the HLTConfigProvider
165  bool changed = true;
167  labelsForToken(m_hlt_results, labels);
168  if (histograms.hltConfig.init(run, setup, labels.process, changed)) {
169  if (m_make_1d_plots) {
170  histograms.hlt_bx.clear();
171  histograms.hlt_bx.resize( histograms.hltConfig.size() );
172  }
173  if (m_make_2d_plots) {
174  histograms.hlt_bx_2d.clear();
175  histograms.hlt_bx_2d.resize( histograms.hltConfig.size() );
176  }
177  } else {
178  // HLTConfigProvider not initialised, skip the the HLT monitoring
179  edm::LogError("TriggerBxMonitor") << "failed to initialise HLTConfigProvider, the HLT bx distribution will not be monitored";
180  }
181 }
size
Write out results.
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:1
const edm::EDGetTokenT< edm::TriggerResults > m_hlt_results
char const * process
Definition: ProductLabels.h:7
static const char * s_tcds_trigger_types[]
static unsigned int maxPhysicsTriggers
Definition: GlobalAlgBlk.h:54
const bool m_make_1d_plots
void labelsForToken(EDGetToken iToken, Labels &oLabels) const
const bool m_make_2d_plots
void TriggerBxMonitor::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 119 of file TriggerBxMonitor.cc.

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

120 {
122  desc.addUntracked<edm::InputTag>( "l1tResults", edm::InputTag("gtStage2Digis"));
123  desc.addUntracked<edm::InputTag>( "hltResults", edm::InputTag("TriggerResults"));
124  desc.addUntracked<std::string>( "dqmPath", "HLT/TriggerBx" );
125  desc.addUntracked<bool>( "make1DPlots", true);
126  desc.addUntracked<bool>( "make2DPlots", false);
127  desc.addUntracked<uint32_t>( "lsRange", 4000);
128  descriptions.add("triggerBxMonitor", desc);
129 }
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)

Member Data Documentation

const std::string TriggerBxMonitor::m_dqm_path
private

Definition at line 110 of file TriggerBxMonitor.cc.

Referenced by bookHistograms().

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

Definition at line 109 of file TriggerBxMonitor.cc.

Referenced by dqmAnalyze(), and dqmBeginRun().

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

Definition at line 108 of file TriggerBxMonitor.cc.

Referenced by dqmAnalyze().

const uint32_t TriggerBxMonitor::m_ls_range
private

Definition at line 113 of file TriggerBxMonitor.cc.

Referenced by bookHistograms().

const bool TriggerBxMonitor::m_make_1d_plots
private

Definition at line 111 of file TriggerBxMonitor.cc.

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

const bool TriggerBxMonitor::m_make_2d_plots
private

Definition at line 112 of file TriggerBxMonitor.cc.

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

const unsigned int TriggerBxMonitor::s_bx_range = 3564
staticprivate

Definition at line 84 of file TriggerBxMonitor.cc.

Referenced by bookHistograms().

const char * TriggerBxMonitor::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 88 of file TriggerBxMonitor.cc.

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