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 233 of file CSCDQM_Configuration.h.

Constructor & Destructor Documentation

cscdqm::Configuration::Configuration ( )
inline

Constructor.

Parameter Getters Parameter Setters

Definition at line 289 of file CSCDQM_Configuration.h.

References init.

289  {
290  init();
291  printStatsLocal = 0;
292  }
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 298 of file CSCDQM_Configuration.h.

References init.

298  {
299  init();
300  if (printStats) {
301  printStatsLocal = 1;
302  } else {
303  printStatsLocal = 2;
304  }
305  }
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 671 of file CSCDQM_Configuration.h.

674  {
675  setChamberCounterValue(counter_from, crateId, dmbId, getChamberCounterValue(counter_from, crateId, dmbId));
676  }
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 526 of file CSCDQM_Configuration.h.

526  {
527  if (start) {
528  eventTimer.restart();
529  } else {
530  eventTimeSum += eventTimer.elapsed();
531  }
532  }
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 685 of file CSCDQM_Configuration.h.

687  {
688  ChamberMapCounterMapType::iterator it = chamberCounters.find(boost::make_tuple(crateId, dmbId));
689  if (it == chamberCounters.end())
690  return 0;
691  ChamberCounterMapType::const_iterator itc = it->counters.find(counter);
692  if (itc == it->counters.end())
693  return 0;
694  return itc->second;
695  }
ChamberMapCounterMapType chamberCounters
const unsigned long cscdqm::Configuration::getNEvents ( ) const
inline

Getters for Global Counters.

Definition at line 603 of file CSCDQM_Configuration.h.

References nEvents.

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

Definition at line 604 of file CSCDQM_Configuration.h.

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

Definition at line 606 of file CSCDQM_Configuration.h.

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

Definition at line 605 of file CSCDQM_Configuration.h.

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

Definition at line 607 of file CSCDQM_Configuration.h.

607 { 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 633 of file CSCDQM_Configuration.h.

633  {
634  setChamberCounterValue(counter, crateId, dmbId, getChamberCounterValue(counter, crateId, dmbId) + 1);
635  }
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 613 of file CSCDQM_Configuration.h.

References LOG_INFO, and nEvents.

613  {
614  nEvents++;
615  if (getEVENTS_ECHO() > 0) {
616  if (getNEvents() % getEVENTS_ECHO() == 0) {
617  LOG_INFO << "(echo) Events processed: " << std::setw(12) << getNEvents();
618  }
619  }
620  }
const unsigned long getNEvents() const
#define LOG_INFO
Definition: CSCDQM_Logger.h:42
void cscdqm::Configuration::incNEventsBad ( )
inline

Definition at line 621 of file CSCDQM_Configuration.h.

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

Definition at line 623 of file CSCDQM_Configuration.h.

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

Definition at line 622 of file CSCDQM_Configuration.h.

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

Definition at line 624 of file CSCDQM_Configuration.h.

624 { 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 247 of file CSCDQM_Configuration.h.

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

247  {
249  BOOST_PP_SEQ_FOR_EACH_I(CONFIG_PARAMETER_DEFAULT_MACRO, _, CONFIG_PARAMETERS_SEQ)
250  reset();
251  }
#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 567 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.

567  {
568  bool result = true;
569  for (unsigned int i = 0; i < MOFilterItems.size(); i++) {
570  const MOFilterItem* filter = &MOFilterItems.at(i);
571  if (Utility::regexMatch(filter->pattern, name))
572  result = filter->include;
573  }
574  return result;
575  }
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 472 of file CSCDQM_Configuration.h.

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

472  {
473  double allTime = globalTimer.elapsed();
474  LogInfo logger;
475  logger << std::endl;
476 
477  STATFIELD("Events processed", nEvents, "")
478  STATFIELD("Bad events", nEventsBad, "")
479  STATFIELD("Good events", nEventsGood, "")
480  STATFIELD("CSC DCC events", nEventsCSC, "")
481  STATFIELD("Unpacked CSCs", nUnpackedCSC, "")
482 
483  SEPFIELD
484 
486  double eventTimeAverage = (nEvents > 0 ? eventTimeSum / nEvents : -1.0);
487  STATFIELD("Avg. event time", eventTimeAverage, "s")
488  double eventRateAverage = (eventTimeSum > 0 ? nEvents / eventTimeSum : -1.0);
489  STATFIELD("Avg. event rate", eventRateAverage, "Hz")
490  double chamberRateAverage = (eventTimeSum > 0 ? nUnpackedCSC / eventTimeSum : -1.0);
491  STATFIELD("Avg. chamber rate", chamberRateAverage, "Hz")
492 
493  SEPFIELD
494 
495  STATFIELD("All fra update time", fraTimeSum, "s")
496  STATFIELD("All fra update count", fraCount, "")
497  double fraTimeAverage = (fraCount > 0 ? fraTimeSum / fraCount : -1.0);
498  STATFIELD("Avg. fra update time", fraTimeAverage, "s")
499 
500  SEPFIELD
501 
502  STATFIELD("All eff update time", effTimeSum, "s")
503  STATFIELD("All eff update count", effCount, "")
504  double effTimeAverage = (effCount > 0 ? effTimeSum / effCount : -1.0);
505  STATFIELD("Avg. eff update time", effTimeAverage, "s")
506 
507  SEPFIELD
508 
509  STATFIELD("All time", allTime, "s")
510  double allTimeAverage = (nEvents > 0 ? allTime / nEvents : -1.0);
511  STATFIELD("Avg. event all time", allTimeAverage, "s")
512  double allRateAverage = (allTime > 0 ? nEvents / allTime : -1.0);
513  STATFIELD("Avg. event all rate", allRateAverage, "Hz")
514  double chamberAllRateAverage = (allTime > 0 ? nUnpackedCSC / allTime : -1.0);
515  STATFIELD("Avg. chamber all rate", chamberAllRateAverage, "Hz")
516  }
std::ostream & logger()
Definition: fwLog.cc:36
#define SEPFIELD
#define STATFIELD(caption, value, units)
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 586 of file CSCDQM_Configuration.h.

References nEvents.

586  {
587  nEvents = 0;
588  nEventsBad = 0;
589  nEventsGood = 0;
590  nEventsCSC = 0;
591  nUnpackedCSC = 0;
592  fraCount = 0;
593  effCount = 0;
594  eventTimeSum = 0.0;
595  fraTimeSum = 0.0;
596  effTimeSum = 0.0;
597  }
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 645 of file CSCDQM_Configuration.h.

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

648  {
649  ChamberMapCounterMapType::iterator it = chamberCounters.find(boost::make_tuple(crateId, dmbId));
650  if (it == chamberCounters.end()) {
651  it = chamberCounters.insert(chamberCounters.end(),
652  ChamberCounterKeyType(crateId, dmbId, ChamberCounterMapType()));
653  }
654  ChamberCounterMapType* cs = const_cast<ChamberCounterMapType*>(&it->counters);
655  ChamberCounterMapType::iterator itc = cs->find(counter);
656  if (itc == cs->end()) {
657  cs->insert(std::make_pair(counter, value));
658  } else {
659  itc->second = value;
660  }
661  }
unique_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 553 of file CSCDQM_Configuration.h.

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

553  {
554  if (start) {
555  effTimer.restart();
556  } else {
557  effTimeSum += effTimer.elapsed();
558  effCount++;
559  }
560  }
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 539 of file CSCDQM_Configuration.h.

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

539  {
540  if (start) {
541  fraTimer.restart();
542  } else {
543  fraTimeSum += fraTimer.elapsed();
544  fraCount++;
545  }
546  }
Definition: start.py:1

Member Data Documentation

ChamberMapCounterMapType cscdqm::Configuration::chamberCounters
private

Map of chamber counters

Definition at line 724 of file CSCDQM_Configuration.h.

unsigned long cscdqm::Configuration::effCount
private

Number of Efficiency MO updates

Definition at line 721 of file CSCDQM_Configuration.h.

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

Efficiency MO update Timer

Definition at line 435 of file CSCDQM_Configuration.h.

double cscdqm::Configuration::effTimeSum
private

Efficiency MO update time cummulative

Definition at line 444 of file CSCDQM_Configuration.h.

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

Event processing Timer

Definition at line 429 of file CSCDQM_Configuration.h.

double cscdqm::Configuration::eventTimeSum
private

Event processing time cummulative

Definition at line 438 of file CSCDQM_Configuration.h.

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

Pointer to Collection Book Function

Definition at line 275 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 266 of file CSCDQM_Configuration.h.

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

Definition at line 264 of file CSCDQM_Configuration.h.

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

Pointers to Cache Functions

Definition at line 262 of file CSCDQM_Configuration.h.

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

Definition at line 263 of file CSCDQM_Configuration.h.

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

Definition at line 267 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 278 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 259 of file CSCDQM_Configuration.h.

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

Definition at line 270 of file CSCDQM_Configuration.h.

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

Definition at line 271 of file CSCDQM_Configuration.h.

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

Definition at line 272 of file CSCDQM_Configuration.h.

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

Definition at line 269 of file CSCDQM_Configuration.h.

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

Definition at line 268 of file CSCDQM_Configuration.h.

unsigned long cscdqm::Configuration::fraCount
private

Number of Fractional MO updates

Definition at line 718 of file CSCDQM_Configuration.h.

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

Fractional MO update Timer

Definition at line 432 of file CSCDQM_Configuration.h.

double cscdqm::Configuration::fraTimeSum
private

Fractional MO update time cummulative

Definition at line 441 of file CSCDQM_Configuration.h.

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

Statistics collection and printing sectionGlobal Timer

Definition at line 426 of file CSCDQM_Configuration.h.

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

Map of MO Filters

Definition at line 238 of file CSCDQM_Configuration.h.

unsigned long cscdqm::Configuration::nEvents
private

Global Counters.Number of events

Definition at line 703 of file CSCDQM_Configuration.h.

Referenced by looper.Looper::loop().

unsigned long cscdqm::Configuration::nEventsBad
private

Number of bad events

Definition at line 706 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 712 of file CSCDQM_Configuration.h.

unsigned long cscdqm::Configuration::nEventsGood
private

Number of good events

Definition at line 709 of file CSCDQM_Configuration.h.

unsigned long cscdqm::Configuration::nUnpackedCSC
private

number of unpacked chambers

Definition at line 715 of file CSCDQM_Configuration.h.

unsigned short cscdqm::Configuration::printStatsLocal
private

Definition at line 235 of file CSCDQM_Configuration.h.