CMS 3D CMS Logo

cscdqm::Configuration Class Reference

Framework configuration. More...

#include <DQM/CSCMonitorModule/interface/CSCDQM_Configuration.h>

List of all members.

Public Member Functions

 Configuration (const bool p_printStatsOnExit=true)
void eventProcessTimer (const bool start)
const unsigned long getNEvents () const
const unsigned long getNEventsBad () const
const unsigned long getNEventsCSC () const
const unsigned long getNEventsGood () const
const unsigned long getNUnpackedDMB () const
void incNEvents ()
void incNEventsBad ()
void incNEventsCSC ()
void incNEventsGood ()
void incNUnpackedDMB ()
void load (const std::string &configFile)
const bool needBookMO (const std::string name) const
void printStats ()
void reset ()
 Counters.
void updateEffTimer (const bool start)
void updateFraTimer (const bool start)
 ~Configuration ()

Static Public Member Functions

static void printXML (const Configuration &config)

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< CSCDetId(const
unsigned int, const unsigned
int) > 
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 Attributes

unsigned long effCount
boost::timer effTimer
double effTimeSum
boost::timer eventTimer
double eventTimeSum
unsigned long fraCount
boost::timer fraTimer
double fraTimeSum
boost::timer globalTimer
 Statistics.
std::vector< MOFilterItemMOFilterItems
unsigned long nEvents
unsigned long nEventsBad
unsigned long nEventsCSC
unsigned long nEventsGood
unsigned long nUnpackedDMB
bool printStatsOnExit


Detailed Description

Framework configuration.

Definition at line 152 of file CSCDQM_Configuration.h.


Constructor & Destructor Documentation

cscdqm::Configuration::Configuration ( const bool  p_printStatsOnExit = true  )  [inline]

Definition at line 177 of file CSCDQM_Configuration.h.

References CONFIG_PARAMETER_DEFAULT_MACRO, CONFIG_PARAMETERS_SEQ, printStatsOnExit, and reset().

00177                                                           {
00178         printStatsOnExit = p_printStatsOnExit;
00179         BOOST_PP_SEQ_FOR_EACH_I(CONFIG_PARAMETER_DEFAULT_MACRO, _, CONFIG_PARAMETERS_SEQ)
00180         reset();
00181       }

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

Definition at line 183 of file CSCDQM_Configuration.h.

References printStats(), and printStatsOnExit.

00183                        {
00184         if (printStatsOnExit) {
00185           printStats();
00186         }
00187       }


Member Function Documentation

void cscdqm::Configuration::eventProcessTimer ( const bool  start  )  [inline]

Definition at line 379 of file CSCDQM_Configuration.h.

References eventTimer, and eventTimeSum.

00379                                                {
00380         if (start) {
00381           eventTimer.restart();
00382         } else {
00383           eventTimeSum += eventTimer.elapsed();
00384         }
00385       }

const unsigned long cscdqm::Configuration::getNEvents (  )  const [inline]

Definition at line 373 of file CSCDQM_Configuration.h.

References nEvents.

Referenced by incNEvents(), cscdqm::EventProcessor::processCSC(), and cscdqm::EventProcessor::processDDU().

00373 { return nEvents; }

const unsigned long cscdqm::Configuration::getNEventsBad (  )  const [inline]

Definition at line 374 of file CSCDQM_Configuration.h.

References nEventsBad.

00374 { return nEventsBad; }

const unsigned long cscdqm::Configuration::getNEventsCSC (  )  const [inline]

Definition at line 376 of file CSCDQM_Configuration.h.

References nEventsCSC.

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

00376 { return nEventsCSC; }

const unsigned long cscdqm::Configuration::getNEventsGood (  )  const [inline]

Definition at line 375 of file CSCDQM_Configuration.h.

References nEventsGood.

00375 { return nEventsGood; }

const unsigned long cscdqm::Configuration::getNUnpackedDMB (  )  const [inline]

Definition at line 377 of file CSCDQM_Configuration.h.

References nUnpackedDMB.

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

00377 { return nUnpackedDMB; }

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

Definition at line 405 of file CSCDQM_Configuration.h.

References getNEvents(), LOG_INFO, and nEvents.

00405                              { 
00406         nEvents++; 
00407         if (getEVENTS_ECHO() > 0) {
00408           if (getNEvents() % getEVENTS_ECHO() == 0) {
00409             LOG_INFO << "(echo) Events processed: " << std::setw(12) << getNEvents();
00410           }
00411         }
00412       }

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

Definition at line 413 of file CSCDQM_Configuration.h.

References nEventsBad.

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

00413 { nEventsBad++; }

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

Definition at line 415 of file CSCDQM_Configuration.h.

References nEventsCSC.

00415 { nEventsCSC++; }

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

Definition at line 414 of file CSCDQM_Configuration.h.

References nEventsGood.

00414 { nEventsGood++; }

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

Definition at line 416 of file CSCDQM_Configuration.h.

References nUnpackedDMB.

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

00416 { nUnpackedDMB++; }

void cscdqm::Configuration::load ( const std::string &  configFile  )  [inline]

Definition at line 189 of file CSCDQM_Configuration.h.

References CONFIG_PARAMETER_LOADXML_MACRO, CONFIG_PARAMETERS_SEQ, doc, filter, i, j, MOFilterItems, prof2calltree::node, indexGen::parser, transcode(), and value.

Referenced by CSCMonitorModuleCmn::CSCMonitorModuleCmn().

00189                                              {
00190         XMLPlatformUtils::Initialize();
00191         boost::shared_ptr<XercesDOMParser> parser(new XercesDOMParser());
00192 
00193         /*
00194         parser->setValidationScheme(XercesDOMParser::Val_Always);
00195         parser->setDoNamespaces(true);
00196         parser->setDoSchema(false);
00197         parser->setExitOnFirstFatalError(true);
00198         parser->setValidationConstraintFatal(true);
00199         */
00200 
00201         XMLFileErrorHandler eh;
00202         parser->setErrorHandler(&eh);
00203 
00204         parser->parse(configFile.c_str());
00205         DOMDocument *doc = parser->getDocument();
00206         DOMNode *docNode = (DOMNode*) doc->getDocumentElement();
00207 
00208         DOMNodeList *itemList = docNode->getChildNodes();
00209         for(uint32_t i = 0; i < itemList->getLength(); i++) {
00210           DOMNode* node = itemList->item(i);
00211           if (node->getNodeType() != DOMNode::ELEMENT_NODE) { continue; }
00212 
00213           std::string nodeName = XMLString::transcode(node->getNodeName());
00214           std::string value = XMLString::transcode(node->getTextContent());
00215           std::istringstream stm(value);
00216 
00217           BOOST_PP_SEQ_FOR_EACH_I(CONFIG_PARAMETER_LOADXML_MACRO, _, CONFIG_PARAMETERS_SEQ)
00218 
00219           if (nodeName.compare("MO_FILTER") == 0) {
00220             DOMNodeList *filterList = node->getChildNodes();
00221             for(uint32_t j = 0; j < filterList->getLength(); j++) {
00222               DOMNode* filter = filterList->item(j);
00223               if (filter->getNodeType() != DOMNode::ELEMENT_NODE) { continue; }
00224               std::string filterName = XMLString::transcode(filter->getNodeName());
00225               std::string filterValue = XMLString::transcode(filter->getTextContent());
00226               MOFilterItems.insert(MOFilterItems.end(), MOFilterItem(filterValue, (filterName.compare("INCLUDE") == 0)));
00227             }
00228           }
00229 
00230         }
00231 
00232         //doc->release();
00233         //XMLPlatformUtils::Terminate();
00234 
00235       }

const bool cscdqm::Configuration::needBookMO ( const std::string  name  )  const [inline]

Definition at line 345 of file CSCDQM_Configuration.h.

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

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

00345                                                         {
00346         bool result = true;
00347         for (unsigned int i = 0; i < MOFilterItems.size(); i++) {
00348           const MOFilterItem* filter = &MOFilterItems.at(i);
00349           if (Utility::regexMatch(filter->pattern, name)) result = filter->include;
00350         }
00351         return result;
00352       }

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

Definition at line 300 of file CSCDQM_Configuration.h.

References effCount, effTimeSum, lat::endl(), eventTimeSum, fraCount, fraTimeSum, globalTimer, cmsRelvalreport::logger(), nEvents, nEventsBad, nEventsCSC, nEventsGood, nUnpackedDMB, SEPFIELD, and STATFIELD.

Referenced by ~Configuration().

00300                         {
00301 
00302         double allTime = globalTimer.elapsed();
00303         LogInfo logger;
00304         logger << std::endl;
00305 
00306         STATFIELD("Events processed", nEvents, "")
00307         STATFIELD("Bad events: ", nEventsBad, "")
00308         STATFIELD("Good events: ", nEventsGood, "")
00309         STATFIELD("CSC events: ", nEventsCSC, "")
00310         STATFIELD("Unpacked DMBs: ", nUnpackedDMB, "")
00311 
00312         SEPFIELD
00313 
00314         STATFIELD("All event time: ", eventTimeSum, "s")
00315         double eventTimeAverage = (nEvents > 0 ? eventTimeSum / nEvents : -1.0);
00316         STATFIELD("Avg. event time: ", eventTimeAverage, "s")
00317         double eventRateAverage = (eventTimeSum > 0 ? nEvents / eventTimeSum : -1.0);
00318         STATFIELD("Avg. event rate: ", eventRateAverage, "Hz")
00319 
00320         SEPFIELD
00321 
00322         STATFIELD("All fra update time: ", fraTimeSum, "s")
00323         double fraTimeAverage = (fraCount > 0 ? fraTimeSum / fraCount : -1.0);
00324         STATFIELD("Avg. fra update time: ", fraTimeAverage, "s")
00325 
00326         SEPFIELD
00327 
00328         STATFIELD("All eff update time: ", effTimeSum, "s")
00329         double effTimeAverage = (effCount > 0 ? effTimeSum / effCount : -1.0);
00330         STATFIELD("Avg. eff update time: ", effTimeAverage, "s")
00331 
00332         SEPFIELD
00333 
00334         STATFIELD("All time: ", allTime, "s")
00335         double allTimeAverage = (nEvents > 0 ? allTime / nEvents : -1.0);
00336         STATFIELD("Avg. event all time: ", allTimeAverage, "s")
00337         double allRateAverage = (allTime > 0 ? nEvents / allTime : -1.0);
00338         STATFIELD("Avg. event all rate: ", allRateAverage, "Hz")
00339 
00340       }

static void cscdqm::Configuration::printXML ( const Configuration config  )  [inline, static]

Definition at line 237 of file CSCDQM_Configuration.h.

References CONFIG_PARAMETER_PRINTXML_MACRO, CONFIG_PARAMETERS_SEQ, doc, and XERCES_TRANSCODE.

00237                                                         {
00238         XMLPlatformUtils::Initialize();
00239 
00240         DOMImplementation* domImpl = DOMImplementationRegistry::getDOMImplementation(XERCES_TRANSCODE("core"));
00241         DOMDocument *doc = domImpl->createDocument(0, XERCES_TRANSCODE("processor_configuration"), 0);
00242         DOMElement* rootElem = doc->getDocumentElement();
00243 
00244         BOOST_PP_SEQ_FOR_EACH_I(CONFIG_PARAMETER_PRINTXML_MACRO, _, CONFIG_PARAMETERS_SEQ)
00245 
00246         DOMWriter *ser = domImpl->createDOMWriter();
00247         if (ser->canSetFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true)) {
00248           ser->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true);
00249         }
00250         XMLFileErrorHandler eh;
00251         ser->setErrorHandler((DOMErrorHandler*) &eh);
00252         ser->writeNode(new StdOutFormatTarget(), *doc);
00253 
00254         doc->release();
00255         XMLPlatformUtils::Terminate();
00256       }

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

Counters.

Definition at line 360 of file CSCDQM_Configuration.h.

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

Referenced by Configuration().

00360                    {
00361         nEvents = 0;
00362         nEventsBad = 0;
00363         nEventsGood = 0;
00364         nEventsCSC = 0;
00365         nUnpackedDMB = 0;
00366         fraCount = 0;
00367         effCount = 0;
00368         eventTimeSum = 0.0;
00369         fraTimeSum = 0.0;
00370         effTimeSum = 0.0;
00371       }

void cscdqm::Configuration::updateEffTimer ( const bool  start  )  [inline]

Definition at line 396 of file CSCDQM_Configuration.h.

References effCount, effTimer, and effTimeSum.

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

00396                                             {
00397         if (start) {
00398           effTimer.restart();
00399         } else {
00400           effTimeSum += effTimer.elapsed();
00401           effCount++;
00402         }
00403       }

void cscdqm::Configuration::updateFraTimer ( const bool  start  )  [inline]

Definition at line 387 of file CSCDQM_Configuration.h.

References fraCount, fraTimer, and fraTimeSum.

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

00387                                             {
00388         if (start) {
00389           fraTimer.restart();
00390         } else {
00391           fraTimeSum += fraTimer.elapsed();
00392           fraCount++;
00393         }
00394       }


Member Data Documentation

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

Definition at line 426 of file CSCDQM_Configuration.h.

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

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

Definition at line 275 of file CSCDQM_Configuration.h.

Referenced by updateEffTimer().

double cscdqm::Configuration::effTimeSum [private]

Definition at line 278 of file CSCDQM_Configuration.h.

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

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

Definition at line 273 of file CSCDQM_Configuration.h.

Referenced by eventProcessTimer().

double cscdqm::Configuration::eventTimeSum [private]

Definition at line 276 of file CSCDQM_Configuration.h.

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

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

Definition at line 168 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)

Definition at line 165 of file CSCDQM_Configuration.h.

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

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

Definition at line 164 of file CSCDQM_Configuration.h.

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

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

Definition at line 163 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)

Definition at line 166 of file CSCDQM_Configuration.h.

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

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

Definition at line 169 of file CSCDQM_Configuration.h.

Referenced by cscdqm::Dispatcher::Dispatcher(), cscdqm::EventProcessor::getCSCFromMap(), and cscdqm::EventProcessor::processCSC().

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

Definition at line 162 of file CSCDQM_Configuration.h.

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

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

Definition at line 171 of file CSCDQM_Configuration.h.

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

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

Definition at line 172 of file CSCDQM_Configuration.h.

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

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

Definition at line 170 of file CSCDQM_Configuration.h.

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

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

Definition at line 167 of file CSCDQM_Configuration.h.

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

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

Definition at line 425 of file CSCDQM_Configuration.h.

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

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

Definition at line 274 of file CSCDQM_Configuration.h.

Referenced by updateFraTimer().

double cscdqm::Configuration::fraTimeSum [private]

Definition at line 277 of file CSCDQM_Configuration.h.

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

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

Statistics.

Definition at line 272 of file CSCDQM_Configuration.h.

Referenced by printStats().

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

Definition at line 157 of file CSCDQM_Configuration.h.

Referenced by load(), and needBookMO().

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

Definition at line 420 of file CSCDQM_Configuration.h.

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

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

Definition at line 421 of file CSCDQM_Configuration.h.

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

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

Definition at line 423 of file CSCDQM_Configuration.h.

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

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

Definition at line 422 of file CSCDQM_Configuration.h.

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

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

Definition at line 424 of file CSCDQM_Configuration.h.

Referenced by getNUnpackedDMB(), incNUnpackedDMB(), printStats(), and reset().

bool cscdqm::Configuration::printStatsOnExit [private]

Definition at line 156 of file CSCDQM_Configuration.h.

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


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:36:56 2009 for CMSSW by  doxygen 1.5.4