CMS 3D CMS Logo

Public Member Functions | Public Attributes | Private Member Functions | Private Attributes

cscdqm::Configuration Class Reference

CSCDQM Framework Global Configuration. More...

#include <CSCDQM_Configuration.h>

List of all members.

Public Member Functions

 Configuration ()
 Constructor.
 Configuration (const bool printStats)
 Constructor.
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.
void eventProcessTimer (const bool start)
 Switch on/off event processing timer.
const uint32_t getChamberCounterValue (const ChamberCounterType counter, const HwId crateId, const HwId dmbId) const
 Get Chamber counter value.
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.
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.
void printStats ()
 Print Statistics on Exit (Destruction)
void reset ()
 Reset counters.
void setChamberCounterValue (const ChamberCounterType counter, const HwId crateId, const HwId dmbId, const uint32_t value)
 Set Chamber counter value.
void updateEffTimer (const bool start)
 Switch on/off efficiency MO processing timer.
void updateFraTimer (const bool start)
 Switch on/off fractional MO processing timer.
 ~Configuration ()
 Destructor.

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, 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 &, 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)

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


Constructor & Destructor Documentation

cscdqm::Configuration::Configuration ( ) [inline]

Constructor.

Parameter Getters Parameter Setters

Definition at line 275 of file CSCDQM_Configuration.h.

References init(), and printStatsLocal.

                      {
        init();
        printStatsLocal = 0;
      }
cscdqm::Configuration::Configuration ( const bool  printStats) [inline]

Constructor.

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

Definition at line 284 of file CSCDQM_Configuration.h.

References init(), and printStatsLocal.

                                           {
        init();
        if (printStats) {
          printStatsLocal = 1;
        } else {
          printStatsLocal = 2;
        }
      }
cscdqm::Configuration::~Configuration ( ) [inline]

Destructor.

Definition at line 296 of file CSCDQM_Configuration.h.

References printStats(), and printStatsLocal.

                       {
        if ((PRINT_STATS_ON_EXIT && printStatsLocal == 0) || printStatsLocal == 1) {
          printStats();
        }
      }

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

References getChamberCounterValue(), and setChamberCounterValue().

Referenced by cscdqm::EventProcessor::processCSC(), and cscdqm::EventProcessor::processExaminer().

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

References eventTimer, and eventTimeSum.

                                               {
        if (start) {
          eventTimer.restart();
        } else {
          eventTimeSum += eventTimer.elapsed();
        }
      }
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 665 of file CSCDQM_Configuration.h.

References chamberCounters.

Referenced by copyChamberCounterValue(), incChamberCounter(), cscdqm::EventProcessor::processCSC(), cscdqm::EventProcessor::processExaminer(), and cscdqm::EventProcessor::updateFractionHistos().

                                                                                                                          {
        ChamberMapCounterMapType::iterator it = chamberCounters.find(boost::make_tuple(crateId, dmbId));
        if (it == chamberCounters.end()) return 0;
        ChamberCounterMapType::const_iterator itc = it->counters.find(counter);
        if (itc == it->counters.end()) return 0;
        return itc->second;
      }
const unsigned long cscdqm::Configuration::getNEvents ( ) const [inline]
const unsigned long cscdqm::Configuration::getNEventsBad ( ) const [inline]

Definition at line 591 of file CSCDQM_Configuration.h.

References nEventsBad.

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

Definition at line 593 of file CSCDQM_Configuration.h.

References nEventsCSC.

Referenced by cscdqm::Dispatcher::updateFractionAndEfficiencyHistosAuto().

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

Definition at line 592 of file CSCDQM_Configuration.h.

References nEventsGood.

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

Definition at line 594 of file CSCDQM_Configuration.h.

References nUnpackedCSC.

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

References getChamberCounterValue(), and setChamberCounterValue().

Referenced by cscdqm::EventProcessor::processExaminer().

                                                                                                     {
        setChamberCounterValue(counter, crateId, dmbId, getChamberCounterValue(counter, crateId, dmbId) + 1);
      }
void cscdqm::Configuration::incNEvents ( ) [inline]

Increments (by 1) for Global Counters.

Definition at line 600 of file CSCDQM_Configuration.h.

References getNEvents(), LOG_INFO, and nEvents.

Referenced by CSCOfflineClient::endRun(), and cscdqm::EventProcessor::preProcessEvent().

                             { 
        nEvents++; 
        if (getEVENTS_ECHO() > 0) {
          if (getNEvents() % getEVENTS_ECHO() == 0) {
            LOG_INFO << "(echo) Events processed: " << std::setw(12) << getNEvents();
          }
        }
      }
void cscdqm::Configuration::incNEventsBad ( ) [inline]

Definition at line 608 of file CSCDQM_Configuration.h.

References nEventsBad.

Referenced by cscdqm::EventProcessor::processExaminer().

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

Definition at line 610 of file CSCDQM_Configuration.h.

References nEventsCSC.

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

Definition at line 609 of file CSCDQM_Configuration.h.

References nEventsGood.

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

Definition at line 611 of file CSCDQM_Configuration.h.

References nUnpackedCSC.

Referenced by cscdqm::EventProcessor::processCSC().

{ nUnpackedCSC++; }
void cscdqm::Configuration::init ( void  ) [inline, private]

Initialize parameter values and reset counters (used by constructors)

Define parameters

Returns:

Assign default values to parameters

Definition at line 235 of file CSCDQM_Configuration.h.

References CONFIG_PARAMETER_DEFAULT_MACRO, CONFIG_PARAMETERS_SEQ, and reset().

Referenced by Configuration().

                  {
        BOOST_PP_SEQ_FOR_EACH_I(CONFIG_PARAMETER_DEFAULT_MACRO, _, CONFIG_PARAMETERS_SEQ)
        reset();
      }
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 554 of file CSCDQM_Configuration.h.

References i, cscdqm::MOFilterItem::include, MOFilterItems, cscdqm::MOFilterItem::pattern, cscdqm::Utility::regexMatch(), and query::result.

Referenced by cscdqm::Collection::book().

                                                        {
        bool result = true;
        for (unsigned int i = 0; i < MOFilterItems.size(); i++) {
          const MOFilterItem* filter = &MOFilterItems.at(i);
          if (Utility::regexMatch(filter->pattern, name)) result = filter->include;
        }
        return result;
      }
void cscdqm::Configuration::printStats ( ) [inline]

Print Statistics on Exit (Destruction)

Returns:

Definition at line 457 of file CSCDQM_Configuration.h.

References effCount, effTimeSum, eventTimeSum, fraCount, fraTimeSum, globalTimer, fwlog::logger(), nEvents, nEventsBad, nEventsCSC, nEventsGood, nUnpackedCSC, SEPFIELD, and STATFIELD.

Referenced by ~Configuration().

                        {

        double allTime = globalTimer.elapsed();
        LogInfo logger;
        logger << std::endl;

        STATFIELD("Events processed", nEvents, "")
        STATFIELD("Bad events", nEventsBad, "")
        STATFIELD("Good events", nEventsGood, "")
        STATFIELD("CSC DCC events", nEventsCSC, "")
        STATFIELD("Unpacked CSCs", nUnpackedCSC, "")

        SEPFIELD

        STATFIELD("All event time", eventTimeSum, "s")
        double eventTimeAverage = (nEvents > 0 ? eventTimeSum / nEvents : -1.0);
        STATFIELD("Avg. event time", eventTimeAverage, "s")
        double eventRateAverage = (eventTimeSum > 0 ? nEvents / eventTimeSum : -1.0);
        STATFIELD("Avg. event rate", eventRateAverage, "Hz")
        double chamberRateAverage = (eventTimeSum > 0 ? nUnpackedCSC / eventTimeSum : -1.0);
        STATFIELD("Avg. chamber rate", chamberRateAverage, "Hz")

        SEPFIELD

        STATFIELD("All fra update time", fraTimeSum, "s")
        STATFIELD("All fra update count", fraCount, "")
        double fraTimeAverage = (fraCount > 0 ? fraTimeSum / fraCount : -1.0);
        STATFIELD("Avg. fra update time", fraTimeAverage, "s")

        SEPFIELD

        STATFIELD("All eff update time", effTimeSum, "s")
        STATFIELD("All eff update count", effCount, "")
        double effTimeAverage = (effCount > 0 ? effTimeSum / effCount : -1.0);
        STATFIELD("Avg. eff update time", effTimeAverage, "s")

        SEPFIELD

        STATFIELD("All time", allTime, "s")
        double allTimeAverage = (nEvents > 0 ? allTime / nEvents : -1.0);
        STATFIELD("Avg. event all time", allTimeAverage, "s")
        double allRateAverage = (allTime > 0 ? nEvents / allTime : -1.0);
        STATFIELD("Avg. event all rate", allRateAverage, "Hz")
        double chamberAllRateAverage = (allTime > 0 ? nUnpackedCSC / allTime : -1.0);
        STATFIELD("Avg. chamber all rate", chamberAllRateAverage, "Hz")

      }
void cscdqm::Configuration::reset ( void  ) [inline]

Reset counters.

Counters section.

Returns:

Definition at line 573 of file CSCDQM_Configuration.h.

References effCount, effTimeSum, eventTimeSum, fraCount, fraTimeSum, nEvents, nEventsBad, nEventsCSC, nEventsGood, and nUnpackedCSC.

Referenced by init().

                   {
        nEvents = 0;
        nEventsBad = 0;
        nEventsGood = 0;
        nEventsCSC = 0;
        nUnpackedCSC = 0;
        fraCount = 0;
        effCount = 0;
        eventTimeSum = 0.0;
        fraTimeSum = 0.0;
        effTimeSum = 0.0;
      }
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 632 of file CSCDQM_Configuration.h.

References chamberCounters, and relativeConstraints::value.

Referenced by copyChamberCounterValue(), incChamberCounter(), and cscdqm::EventProcessor::processCSC().

                                                                                                                                {
        ChamberMapCounterMapType::iterator it = chamberCounters.find(boost::make_tuple(crateId, dmbId));
        if (it == chamberCounters.end()) {
          it = chamberCounters.insert(chamberCounters.end(), ChamberCounterKeyType(crateId, dmbId, ChamberCounterMapType()));
        }
        ChamberCounterMapType* cs = const_cast<ChamberCounterMapType*>(&it->counters);
        ChamberCounterMapType::iterator itc = cs->find(counter);
        if (itc == cs->end()) {
          cs->insert(std::make_pair(counter, value));
        } else {
          itc->second = value;
        }
      }
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 540 of file CSCDQM_Configuration.h.

References effCount, effTimer, and effTimeSum.

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

                                            {
        if (start) {
          effTimer.restart();
        } else {
          effTimeSum += effTimer.elapsed();
          effCount++;
        }
      }
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 526 of file CSCDQM_Configuration.h.

References fraCount, fraTimer, and fraTimeSum.

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

                                            {
        if (start) {
          fraTimer.restart();
        } else {
          fraTimeSum += fraTimer.elapsed();
          fraCount++;
        }
      }

Member Data Documentation

Map of chamber counters

Definition at line 701 of file CSCDQM_Configuration.h.

Referenced by getChamberCounterValue(), and setChamberCounterValue().

unsigned long cscdqm::Configuration::effCount [private]

Number of Efficiency MO updates

Definition at line 698 of file CSCDQM_Configuration.h.

Referenced by printStats(), reset(), and updateEffTimer().

boost::timer cscdqm::Configuration::effTimer [private]

Efficiency MO update Timer

Definition at line 419 of file CSCDQM_Configuration.h.

Referenced by updateEffTimer().

Efficiency MO update time cummulative

Definition at line 428 of file CSCDQM_Configuration.h.

Referenced by printStats(), reset(), and updateEffTimer().

boost::timer cscdqm::Configuration::eventTimer [private]

Event processing Timer

Definition at line 413 of file CSCDQM_Configuration.h.

Referenced by eventProcessTimer().

Event processing time cummulative

Definition at line 422 of file CSCDQM_Configuration.h.

Referenced by eventProcessTimer(), printStats(), and reset().

Pointer to Collection Book Function

Definition at line 261 of file CSCDQM_Configuration.h.

Referenced by cscdqm::Collection::book(), and cscdqm::Dispatcher::Dispatcher().

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

Pointers to Cache Functions

Definition at line 251 of file CSCDQM_Configuration.h.

Referenced by cscdqm::Dispatcher::Dispatcher(), and cscdqm::EventProcessor::getEMUHisto().

boost::function< bool (const HistoId id, MonitorObject*& mo) cscdqm::Configuration::fnGetCacheParHisto)
boost::function< bool (const unsigned int, const unsigned int, CSCDetId&) > cscdqm::Configuration::fnGetCSCDetId
boost::function< bool (const HistoDef& histoT, MonitorObject*&) cscdqm::Configuration::fnGetHisto)
boost::function< bool (unsigned int&, unsigned int&) > cscdqm::Configuration::fnIsBookedCSC

Definition at line 257 of file CSCDQM_Configuration.h.

Referenced by cscdqm::Dispatcher::Dispatcher().

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

Definition at line 258 of file CSCDQM_Configuration.h.

Referenced by cscdqm::Dispatcher::Dispatcher().

boost::function< bool (unsigned int&, unsigned int&, unsigned int&) > cscdqm::Configuration::fnNextBookedCSC
boost::function< void (const HistoDef& histoT, MonitorObject*&) cscdqm::Configuration::fnPutHisto)
unsigned long cscdqm::Configuration::fraCount [private]

Number of Fractional MO updates

Definition at line 695 of file CSCDQM_Configuration.h.

Referenced by printStats(), reset(), and updateFraTimer().

boost::timer cscdqm::Configuration::fraTimer [private]

Fractional MO update Timer

Definition at line 416 of file CSCDQM_Configuration.h.

Referenced by updateFraTimer().

Fractional MO update time cummulative

Definition at line 425 of file CSCDQM_Configuration.h.

Referenced by printStats(), reset(), and updateFraTimer().

boost::timer cscdqm::Configuration::globalTimer [private]

Statistics collection and printing section Global Timer

Definition at line 410 of file CSCDQM_Configuration.h.

Referenced by printStats().

Map of MO Filters

Definition at line 226 of file CSCDQM_Configuration.h.

Referenced by needBookMO().

unsigned long cscdqm::Configuration::nEvents [private]

Global Counters. Number of events

Definition at line 680 of file CSCDQM_Configuration.h.

Referenced by getNEvents(), incNEvents(), printStats(), and reset().

unsigned long cscdqm::Configuration::nEventsBad [private]

Number of bad events

Definition at line 683 of file CSCDQM_Configuration.h.

Referenced by getNEventsBad(), incNEventsBad(), printStats(), and reset().

unsigned long cscdqm::Configuration::nEventsCSC [private]

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

Definition at line 689 of file CSCDQM_Configuration.h.

Referenced by getNEventsCSC(), incNEventsCSC(), printStats(), and reset().

unsigned long cscdqm::Configuration::nEventsGood [private]

Number of good events

Definition at line 686 of file CSCDQM_Configuration.h.

Referenced by getNEventsGood(), incNEventsGood(), printStats(), and reset().

unsigned long cscdqm::Configuration::nUnpackedCSC [private]

number of unpacked chambers

Definition at line 692 of file CSCDQM_Configuration.h.

Referenced by getNUnpackedCSC(), incNUnpackedCSC(), printStats(), and reset().

unsigned short cscdqm::Configuration::printStatsLocal [private]

Definition at line 223 of file CSCDQM_Configuration.h.

Referenced by Configuration(), and ~Configuration().