CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
cscdqm::Configuration Class Reference

CSCDQM Framework Global Configuration. More...

#include <CSCDQM_Configuration.h>

Public Member Functions

 Configuration ()
 Constructor. More...
 
 Configuration (const bool printStats)
 Constructor. More...
 
void copyChamberCounterValue (const ChamberCounterType counter_from, const ChamberCounterType counter_to, const HwId crateId, const HwId dmbId)
 Copy Chamber counter value from one counter to another. More...
 
void eventProcessTimer (const bool start)
 Switch on/off event processing timer. More...
 
const uint32_t getChamberCounterValue (const ChamberCounterType counter, const HwId crateId, const HwId dmbId) const
 Get Chamber counter value. More...
 
const unsigned long getNEvents () const
 
const unsigned long getNEventsBad () const
 
const unsigned long getNEventsCSC () const
 
const unsigned long getNEventsGood () const
 
const unsigned long getNUnpackedCSC () const
 
void incChamberCounter (const ChamberCounterType counter, const HwId crateId, const HwId dmbId)
 Increment Chamber counter by 1. More...
 
void incNEvents ()
 
void incNEventsBad ()
 
void incNEventsCSC ()
 
void incNEventsGood ()
 
void incNUnpackedCSC ()
 
const bool needBookMO (const std::string name) const
 Check if MO is not excluded by MO Filter. More...
 
void printStats ()
 Print Statistics on Exit (Destruction) More...
 
void reset ()
 Reset counters. More...
 
void setChamberCounterValue (const ChamberCounterType counter, const HwId crateId, const HwId dmbId, const uint32_t value)
 Set Chamber counter value. More...
 
void updateEffTimer (const bool start)
 Switch on/off efficiency MO processing timer. More...
 
void updateFraTimer (const bool start)
 Switch on/off fractional MO processing timer. More...
 
 ~Configuration ()
 Destructor. More...
 

Public Attributes

boost::function< MonitorObject *(const HistoBookRequest &) > fnBook
 
boost::function< bool(const HistoId id, const HwId &id1, const HwId &id2, const HwId &id3, MonitorObject *&mo) > fnGetCacheCSCHisto
 
boost::function< bool(const HistoId id, const HwId &id1, MonitorObject *&mo) > fnGetCacheDDUHisto
 
boost::function< bool(const HistoId id, MonitorObject *&mo) > fnGetCacheEMUHisto
 
boost::function< bool(const HistoId id, const HwId &id1, MonitorObject *&mo) > fnGetCacheFEDHisto
 
boost::function< bool(const HistoId id, MonitorObject *&mo) > fnGetCacheParHisto
 
boost::function< bool(const unsigned int, const unsigned int, CSCDetId &) > fnGetCSCDetId
 
boost::function< bool(const HistoDef &histoT, MonitorObject *&) > fnGetHisto
 
boost::function< bool(unsigned int &, unsigned int &) > fnIsBookedCSC
 
boost::function< bool(unsigned int &) > fnIsBookedDDU
 
boost::function< bool(unsigned int &) > fnIsBookedFED
 
boost::function< bool(unsigned int &, unsigned int &, unsigned int &) > fnNextBookedCSC
 
boost::function< void(const HistoDef &histoT, MonitorObject *&) > fnPutHisto
 

Private Member Functions

void init ()
 Initialize parameter values and reset counters (used by constructors) More...
 

Private Attributes

ChamberMapCounterMapType chamberCounters
 
unsigned long effCount
 
boost::timer effTimer
 
double effTimeSum
 
boost::timer eventTimer
 
double eventTimeSum
 
unsigned long fraCount
 
boost::timer fraTimer
 
double fraTimeSum
 
boost::timer globalTimer
 
std::vector< MOFilterItemMOFilterItems
 
unsigned long nEvents
 
unsigned long nEventsBad
 
unsigned long nEventsCSC
 
unsigned long nEventsGood
 
unsigned long nUnpackedCSC
 
unsigned short printStatsLocal
 

Detailed Description

CSCDQM Framework Global Configuration.

Definition at line 220 of file CSCDQM_Configuration.h.

Constructor & Destructor Documentation

cscdqm::Configuration::Configuration ( )
inline

Constructor.

Parameter Getters Parameter Setters

Definition at line 278 of file CSCDQM_Configuration.h.

References StGenEvtProducer_cfi::init.

278  {
279  init();
280  printStatsLocal = 0;
281  }
void init()
Initialize parameter values and reset counters (used by constructors)
cscdqm::Configuration::Configuration ( const bool  printStats)
inline

Constructor.

Parameters
printStatsPrint statistics on exit or not (overrides configuration parameter)

Definition at line 287 of file CSCDQM_Configuration.h.

References StGenEvtProducer_cfi::init.

287  {
288  init();
289  if (printStats) {
290  printStatsLocal = 1;
291  } else {
292  printStatsLocal = 2;
293  }
294  }
void printStats()
Print Statistics on Exit (Destruction)
void init()
Initialize parameter values and reset counters (used by constructors)
cscdqm::Configuration::~Configuration ( )
inline

Member Function Documentation

void cscdqm::Configuration::copyChamberCounterValue ( const ChamberCounterType  counter_from,
const ChamberCounterType  counter_to,
const HwId  crateId,
const HwId  dmbId 
)
inline

Copy Chamber counter value from one counter to another.

Parameters
counter_fromCounter Type to copy value from
counter_toCounter Type to copy value to
crateIdCSC Crate ID
dmbIdCSC DMB ID
Returns

Definition at line 657 of file CSCDQM_Configuration.h.

657  {
658  setChamberCounterValue(counter_from, crateId, dmbId, getChamberCounterValue(counter_from, crateId, dmbId));
659  }
void setChamberCounterValue(const ChamberCounterType counter, const HwId crateId, const HwId dmbId, const uint32_t value)
Set Chamber counter value.
const uint32_t getChamberCounterValue(const ChamberCounterType counter, const HwId crateId, const HwId dmbId) const
Get Chamber counter value.
void cscdqm::Configuration::eventProcessTimer ( const bool  start)
inline

Switch on/off event processing timer.

Parameters
starttimer action (true - start, false - stop)
Returns

Definition at line 516 of file CSCDQM_Configuration.h.

516  {
517  if (start) {
518  eventTimer.restart();
519  } else {
520  eventTimeSum += eventTimer.elapsed();
521  }
522  }
Definition: start.py:1
const uint32_t cscdqm::Configuration::getChamberCounterValue ( const ChamberCounterType  counter,
const HwId  crateId,
const HwId  dmbId 
) const
inline

Get Chamber counter value.

Parameters
counterCounter Type
crateIdCSC Crate ID
dmbIdCSC DMB ID
Returns
current counter value

Definition at line 668 of file CSCDQM_Configuration.h.

668  {
669  ChamberMapCounterMapType::iterator it = chamberCounters.find(boost::make_tuple(crateId, dmbId));
670  if (it == chamberCounters.end()) return 0;
671  ChamberCounterMapType::const_iterator itc = it->counters.find(counter);
672  if (itc == it->counters.end()) return 0;
673  return itc->second;
674  }
ChamberMapCounterMapType chamberCounters
const unsigned long cscdqm::Configuration::getNEvents ( ) const
inline

Getters for Global Counters.

Definition at line 593 of file CSCDQM_Configuration.h.

References nEvents.

593 { return nEvents; }
const unsigned long cscdqm::Configuration::getNEventsBad ( ) const
inline

Definition at line 594 of file CSCDQM_Configuration.h.

594 { return nEventsBad; }
const unsigned long cscdqm::Configuration::getNEventsCSC ( ) const
inline

Definition at line 596 of file CSCDQM_Configuration.h.

596 { return nEventsCSC; }
const unsigned long cscdqm::Configuration::getNEventsGood ( ) const
inline

Definition at line 595 of file CSCDQM_Configuration.h.

595 { return nEventsGood; }
const unsigned long cscdqm::Configuration::getNUnpackedCSC ( ) const
inline

Definition at line 597 of file CSCDQM_Configuration.h.

597 { return nUnpackedCSC; }
void cscdqm::Configuration::incChamberCounter ( const ChamberCounterType  counter,
const HwId  crateId,
const HwId  dmbId 
)
inline

Increment Chamber counter by 1.

Parameters
counterCounter Type
crateIdCSC Crate ID
dmbIdCSC DMB ID
Returns

Definition at line 623 of file CSCDQM_Configuration.h.

623  {
624  setChamberCounterValue(counter, crateId, dmbId, getChamberCounterValue(counter, crateId, dmbId) + 1);
625  }
void setChamberCounterValue(const ChamberCounterType counter, const HwId crateId, const HwId dmbId, const uint32_t value)
Set Chamber counter value.
const uint32_t getChamberCounterValue(const ChamberCounterType counter, const HwId crateId, const HwId dmbId) const
Get Chamber counter value.
void cscdqm::Configuration::incNEvents ( )
inline

Increments (by 1) for Global Counters.

Definition at line 603 of file CSCDQM_Configuration.h.

References LOG_INFO, and nEvents.

603  {
604  nEvents++;
605  if (getEVENTS_ECHO() > 0) {
606  if (getNEvents() % getEVENTS_ECHO() == 0) {
607  LOG_INFO << "(echo) Events processed: " << std::setw(12) << getNEvents();
608  }
609  }
610  }
const unsigned long getNEvents() const
#define LOG_INFO
Definition: CSCDQM_Logger.h:43
void cscdqm::Configuration::incNEventsBad ( )
inline

Definition at line 611 of file CSCDQM_Configuration.h.

611 { nEventsBad++; }
void cscdqm::Configuration::incNEventsCSC ( )
inline

Definition at line 613 of file CSCDQM_Configuration.h.

613 { nEventsCSC++; }
void cscdqm::Configuration::incNEventsGood ( )
inline

Definition at line 612 of file CSCDQM_Configuration.h.

612 { nEventsGood++; }
void cscdqm::Configuration::incNUnpackedCSC ( )
inline

Definition at line 614 of file CSCDQM_Configuration.h.

614 { nUnpackedCSC++; }
void cscdqm::Configuration::init ( void  )
inlineprivate

Initialize parameter values and reset counters (used by constructors)

Define parameters

Returns

Assign default values to parameters

Definition at line 236 of file CSCDQM_Configuration.h.

References crabWrapper::_, CONFIG_PARAMETER_DEFAULT_MACRO, CONFIG_PARAMETERS_SEQ, and reset().

236  {
238  BOOST_PP_SEQ_FOR_EACH_I(CONFIG_PARAMETER_DEFAULT_MACRO, _, CONFIG_PARAMETERS_SEQ)
239  reset();
240  }
#define CONFIG_PARAMETERS_SEQ
#define CONFIG_PARAMETER_DEFAULT_MACRO(r, data, i, elem)
void reset()
Reset counters.
const bool cscdqm::Configuration::needBookMO ( const std::string  name) const
inline

Check if MO is not excluded by MO Filter.

Parameters
nameMO name to book
Returns
true if MO is not excluded, false - otherwise

Definition at line 557 of file CSCDQM_Configuration.h.

References ALCARECOTkAlBeamHalo_cff::filter, mps_fire::i, cscdqm::MOFilterItem::include, cscdqm::MOFilterItem::pattern, cscdqm::Utility::regexMatch(), and mps_fire::result.

557  {
558  bool result = true;
559  for (unsigned int i = 0; i < MOFilterItems.size(); i++) {
560  const MOFilterItem* filter = &MOFilterItems.at(i);
561  if (Utility::regexMatch(filter->pattern, name)) result = filter->include;
562  }
563  return result;
564  }
static bool regexMatch(const std::string &expression, const std::string &message)
Match RegExp expression string against string message and return result.
std::vector< MOFilterItem > MOFilterItems
void cscdqm::Configuration::printStats ( )
inline

Print Statistics on Exit (Destruction)

Returns

Definition at line 460 of file CSCDQM_Configuration.h.

References fwlog::logger(), nEvents, SEPFIELD, and STATFIELD.

460  {
461 
462  double allTime = globalTimer.elapsed();
463  LogInfo logger;
464  logger << std::endl;
465 
466  STATFIELD("Events processed", nEvents, "")
467  STATFIELD("Bad events", nEventsBad, "")
468  STATFIELD("Good events", nEventsGood, "")
469  STATFIELD("CSC DCC events", nEventsCSC, "")
470  STATFIELD("Unpacked CSCs", nUnpackedCSC, "")
471 
472  SEPFIELD
473 
475  double eventTimeAverage = (nEvents > 0 ? eventTimeSum / nEvents : -1.0);
476  STATFIELD("Avg. event time", eventTimeAverage, "s")
477  double eventRateAverage = (eventTimeSum > 0 ? nEvents / eventTimeSum : -1.0);
478  STATFIELD("Avg. event rate", eventRateAverage, "Hz")
479  double chamberRateAverage = (eventTimeSum > 0 ? nUnpackedCSC / eventTimeSum : -1.0);
480  STATFIELD("Avg. chamber rate", chamberRateAverage, "Hz")
481 
482  SEPFIELD
483 
484  STATFIELD("All fra update time", fraTimeSum, "s")
485  STATFIELD("All fra update count", fraCount, "")
486  double fraTimeAverage = (fraCount > 0 ? fraTimeSum / fraCount : -1.0);
487  STATFIELD("Avg. fra update time", fraTimeAverage, "s")
488 
489  SEPFIELD
490 
491  STATFIELD("All eff update time", effTimeSum, "s")
492  STATFIELD("All eff update count", effCount, "")
493  double effTimeAverage = (effCount > 0 ? effTimeSum / effCount : -1.0);
494  STATFIELD("Avg. eff update time", effTimeAverage, "s")
495 
496  SEPFIELD
497 
498  STATFIELD("All time", allTime, "s")
499  double allTimeAverage = (nEvents > 0 ? allTime / nEvents : -1.0);
500  STATFIELD("Avg. event all time", allTimeAverage, "s")
501  double allRateAverage = (allTime > 0 ? nEvents / allTime : -1.0);
502  STATFIELD("Avg. event all rate", allRateAverage, "Hz")
503  double chamberAllRateAverage = (allTime > 0 ? nUnpackedCSC / allTime : -1.0);
504  STATFIELD("Avg. chamber all rate", chamberAllRateAverage, "Hz")
505 
506  }
std::ostream & logger()
Definition: fwLog.cc:40
#define STATFIELD(caption, value, units)
#define SEPFIELD
double rate(double x)
Definition: Constants.cc:3
#define update(a, b)
Definition: event.py:1
void cscdqm::Configuration::reset ( void  )
inline

Reset counters.

Counters section.

Returns

Definition at line 576 of file CSCDQM_Configuration.h.

References nEvents.

576  {
577  nEvents = 0;
578  nEventsBad = 0;
579  nEventsGood = 0;
580  nEventsCSC = 0;
581  nUnpackedCSC = 0;
582  fraCount = 0;
583  effCount = 0;
584  eventTimeSum = 0.0;
585  fraTimeSum = 0.0;
586  effTimeSum = 0.0;
587  }
void cscdqm::Configuration::setChamberCounterValue ( const ChamberCounterType  counter,
const HwId  crateId,
const HwId  dmbId,
const uint32_t  value 
)
inline

Set Chamber counter value.

Parameters
counterCounter Type
crateIdCSC Crate ID
dmbIdCSC DMB ID
valuevalue to set
Returns

Definition at line 635 of file CSCDQM_Configuration.h.

References fwrapper::cs, and relativeConstraints::value.

635  {
636  ChamberMapCounterMapType::iterator it = chamberCounters.find(boost::make_tuple(crateId, dmbId));
637  if (it == chamberCounters.end()) {
638  it = chamberCounters.insert(chamberCounters.end(), ChamberCounterKeyType(crateId, dmbId, ChamberCounterMapType()));
639  }
640  ChamberCounterMapType* cs = const_cast<ChamberCounterMapType*>(&it->counters);
641  ChamberCounterMapType::iterator itc = cs->find(counter);
642  if (itc == cs->end()) {
643  cs->insert(std::make_pair(counter, value));
644  } else {
645  itc->second = value;
646  }
647  }
auto_ptr< ClusterSequence > cs
std::map< ChamberCounterType, uint32_t > ChamberCounterMapType
ChamberMapCounterMapType chamberCounters
Definition: value.py:1
void cscdqm::Configuration::updateEffTimer ( const bool  start)
inline

Switch on/off efficiency MO processing timer.

Parameters
starttimer action (true - start, false - stop)
Returns

Definition at line 543 of file CSCDQM_Configuration.h.

Referenced by cscdqm::EventProcessorMutex::updateFractionAndEfficiencyHistos().

543  {
544  if (start) {
545  effTimer.restart();
546  } else {
547  effTimeSum += effTimer.elapsed();
548  effCount++;
549  }
550  }
Definition: start.py:1
void cscdqm::Configuration::updateFraTimer ( const bool  start)
inline

Switch on/off fractional MO processing timer.

Parameters
starttimer action (true - start, false - stop)
Returns

Definition at line 529 of file CSCDQM_Configuration.h.

Referenced by cscdqm::EventProcessorMutex::updateFractionAndEfficiencyHistos().

529  {
530  if (start) {
531  fraTimer.restart();
532  } else {
533  fraTimeSum += fraTimer.elapsed();
534  fraCount++;
535  }
536  }
Definition: start.py:1

Member Data Documentation

ChamberMapCounterMapType cscdqm::Configuration::chamberCounters
private

Map of chamber counters

Definition at line 704 of file CSCDQM_Configuration.h.

unsigned long cscdqm::Configuration::effCount
private

Number of Efficiency MO updates

Definition at line 701 of file CSCDQM_Configuration.h.

boost::timer cscdqm::Configuration::effTimer
private

Efficiency MO update Timer

Definition at line 422 of file CSCDQM_Configuration.h.

double cscdqm::Configuration::effTimeSum
private

Efficiency MO update time cummulative

Definition at line 431 of file CSCDQM_Configuration.h.

boost::timer cscdqm::Configuration::eventTimer
private

Event processing Timer

Definition at line 416 of file CSCDQM_Configuration.h.

double cscdqm::Configuration::eventTimeSum
private

Event processing time cummulative

Definition at line 425 of file CSCDQM_Configuration.h.

boost::function< MonitorObject* (const HistoBookRequest&) > cscdqm::Configuration::fnBook

Pointer to Collection Book Function

Definition at line 264 of file CSCDQM_Configuration.h.

boost::function< bool (const HistoId id, const HwId& id1, const HwId& id2, const HwId& id3, MonitorObject*& mo) > cscdqm::Configuration::fnGetCacheCSCHisto

Definition at line 255 of file CSCDQM_Configuration.h.

boost::function< bool (const HistoId id, const HwId& id1, MonitorObject*& mo) > cscdqm::Configuration::fnGetCacheDDUHisto

Definition at line 254 of file CSCDQM_Configuration.h.

boost::function< bool (const HistoId id, MonitorObject*& mo) > cscdqm::Configuration::fnGetCacheEMUHisto

Pointers to Cache Functions

Definition at line 252 of file CSCDQM_Configuration.h.

boost::function< bool (const HistoId id, const HwId& id1, MonitorObject*& mo) > cscdqm::Configuration::fnGetCacheFEDHisto

Definition at line 253 of file CSCDQM_Configuration.h.

boost::function< bool (const HistoId id, MonitorObject*& mo) > cscdqm::Configuration::fnGetCacheParHisto

Definition at line 256 of file CSCDQM_Configuration.h.

boost::function< bool (const unsigned int, const unsigned int, CSCDetId&) > cscdqm::Configuration::fnGetCSCDetId

Pointer to CSC Det Id function

Definition at line 267 of file CSCDQM_Configuration.h.

boost::function< bool (const HistoDef& histoT, MonitorObject*&) > cscdqm::Configuration::fnGetHisto

Pointers to Shared functions (created in Dispatcher)Get MO Globally

Definition at line 249 of file CSCDQM_Configuration.h.

boost::function< bool (unsigned int&, unsigned int&) > cscdqm::Configuration::fnIsBookedCSC

Definition at line 259 of file CSCDQM_Configuration.h.

boost::function< bool (unsigned int&) > cscdqm::Configuration::fnIsBookedDDU

Definition at line 260 of file CSCDQM_Configuration.h.

boost::function< bool (unsigned int&) > cscdqm::Configuration::fnIsBookedFED

Definition at line 261 of file CSCDQM_Configuration.h.

boost::function< bool (unsigned int&, unsigned int&, unsigned int&) > cscdqm::Configuration::fnNextBookedCSC

Definition at line 258 of file CSCDQM_Configuration.h.

boost::function< void (const HistoDef& histoT, MonitorObject*&) > cscdqm::Configuration::fnPutHisto

Definition at line 257 of file CSCDQM_Configuration.h.

unsigned long cscdqm::Configuration::fraCount
private

Number of Fractional MO updates

Definition at line 698 of file CSCDQM_Configuration.h.

boost::timer cscdqm::Configuration::fraTimer
private

Fractional MO update Timer

Definition at line 419 of file CSCDQM_Configuration.h.

double cscdqm::Configuration::fraTimeSum
private

Fractional MO update time cummulative

Definition at line 428 of file CSCDQM_Configuration.h.

boost::timer cscdqm::Configuration::globalTimer
private

Statistics collection and printing sectionGlobal Timer

Definition at line 413 of file CSCDQM_Configuration.h.

std::vector<MOFilterItem> cscdqm::Configuration::MOFilterItems
private

Map of MO Filters

Definition at line 227 of file CSCDQM_Configuration.h.

unsigned long cscdqm::Configuration::nEvents
private

Global Counters.Number of events

Definition at line 683 of file CSCDQM_Configuration.h.

Referenced by looper.Looper::loop().

unsigned long cscdqm::Configuration::nEventsBad
private

Number of bad events

Definition at line 686 of file CSCDQM_Configuration.h.

unsigned long cscdqm::Configuration::nEventsCSC
private

Number of events that have CSC data (used in Global DQM)

Definition at line 692 of file CSCDQM_Configuration.h.

unsigned long cscdqm::Configuration::nEventsGood
private

Number of good events

Definition at line 689 of file CSCDQM_Configuration.h.

unsigned long cscdqm::Configuration::nUnpackedCSC
private

number of unpacked chambers

Definition at line 695 of file CSCDQM_Configuration.h.

unsigned short cscdqm::Configuration::printStatsLocal
private

Definition at line 224 of file CSCDQM_Configuration.h.