CMS 3D CMS Logo

CSCDQM_Configuration.h
Go to the documentation of this file.
1 /*
2  * =====================================================================================
3  *
4  * Filename: Configuration.h
5  *
6  * Description: CSCDQM Configuration parameter storage
7  *
8  * Version: 1.0
9  * Created: 10/03/2008 10:26:04 AM
10  * Revision: none
11  * Compiler: gcc
12  *
13  * Author: Valdas Rapsevicius, valdas.rapsevicius@cern.ch
14  * Company: CERN, CH
15  *
16  * =====================================================================================
17  */
18 
19 #ifndef CSCDQM_Configuration_H
20 #define CSCDQM_Configuration_H
21 
22 #include <string>
23 #include <sstream>
24 
25 #include <xercesc/parsers/XercesDOMParser.hpp>
26 #include <xercesc/dom/DOMNodeList.hpp>
27 #include <xercesc/dom/DOMElement.hpp>
28 #include <xercesc/dom/DOMComment.hpp>
29 #include <xercesc/sax/ErrorHandler.hpp>
30 #include <xercesc/sax/SAXParseException.hpp>
31 #include <xercesc/dom/DOMImplementation.hpp>
32 #include <xercesc/framework/StdOutFormatTarget.hpp>
33 #include <xercesc/dom/DOM.hpp>
34 
35 #include <boost/multi_index_container.hpp>
36 #include <boost/multi_index/member.hpp>
37 #include <boost/multi_index/composite_key.hpp>
38 #include <boost/multi_index/ordered_index.hpp>
39 #include "boost/tuple/tuple.hpp"
40 
41 #include <boost/preprocessor/tuple/elem.hpp>
42 #include <boost/preprocessor/seq/for_each_i.hpp>
43 #include <boost/preprocessor/stringize.hpp>
44 #include <boost/preprocessor/cat.hpp>
45 #include <boost/preprocessor/comparison/equal.hpp>
46 
47 #include <boost/shared_ptr.hpp>
48 #include <boost/function.hpp>
49 #include <boost/bind.hpp>
50 
51 #include <boost/timer.hpp>
52 
54 #ifdef DQMGLOBAL
55 
57 
58 #endif
59 
61 #include "CSCDQM_Exception.h"
62 #include "CSCDQM_Utility.h"
63 #include "CSCDQM_Logger.h"
64 
66 #define CONFIG_PARAMETERS_SEQ_LEN 4
67 
72 #define CONFIG_PARAMETERS_SEQ \
73  \
74  \
75  (( bool, PROCESS_DDU, true, "enter DDU (and latter Chamber) sections (EventProcessor flag)" )) \
76  (( bool, PROCESS_CSC, true, "enter Chamber section (EventProcessor flag)" )) \
77  (( bool, PROCESS_EFF_HISTOS, true, "calculate efficiency histograms (Dispatcher flag)" )) \
78  (( bool, PROCESS_EFF_PARAMETERS, true, "calculate efficiency parameters (EventProcessor flag)" )) \
79  (( bool, BINCHECKER_CRC_ALCT, false , "check ALCT CRC (CSCDCCExaminer flag)" )) \
80  (( bool, BINCHECKER_CRC_CLCT, false , "check CLCT CRC (CSCDCCExaminer flag)" )) \
81  (( bool, BINCHECKER_CRC_CFEB, false , "check CFEB CRC (CSCDCCExaminer flag)" )) \
82  (( bool, BINCHECKER_MODE_DDU, true , "set DDU mode (CSCDCCExaminer flag)" )) \
83  (( bool, BINCHECKER_OUTPUT, false , "print 1 and 2 output (CSCDCCExaminer flag)" )) \
84  (( bool, FRAEFF_AUTO_UPDATE, false , "start fractional and efficiency histogram update automatically (Dispatcher flag)" )) \
85  (( bool, FRAEFF_SEPARATE_THREAD, false , "start fractional and efficiency histogram update on separate thread (EventProcessor flag)" )) \
86  (( bool, PRINT_STATS_ON_EXIT, true , "print statistics on exit (destruction)" )) \
87  (( bool, IN_FULL_STANDBY, true , "full detector is in standby mode from the beginning of the run" )) \
88  (( std::string, BOOKING_XML_FILE, "" , "histogram description (booking) file in XML format (Collection)" )) \
89  (( std::string, FOLDER_EMU, "" , "root file folder name to be used for EMU histograms (EventProcessor)" )) \
90  (( std::string, FOLDER_DDU, "" , "root file folder name to be used for DDU histograms (EventProcessor)" )) \
91  (( std::string, FOLDER_CSC, "" , "root file folder name to be used for CSC histograms (EventProcessor)" )) \
92  (( std::string, FOLDER_PAR, "" , "root file folder name to be used for parameters (EventProcessor)" )) \
93  (( unsigned int, DDU_CHECK_MASK, 0xFFFFFFFF , "mask for cumulative EmuFileReader DDU error flags (EventProcessor)" )) \
94  (( unsigned int, DDU_BINCHECK_MASK, 0x02080016 , "mask for DDU level examiner errors (CSCDCCExaminer)" )) \
95  (( unsigned int, BINCHECK_MASK, 0xFFFFFFFF , "mask for chamber level examiner errors (CSCDCCExaminer)" )) \
96  (( unsigned int, FRAEFF_AUTO_UPDATE_START, 5 , "event number to start automatic fractional and efficiency histogram updates from (Dispatcer)" )) \
97  (( unsigned int, FRAEFF_AUTO_UPDATE_FREQ, 1 , "frequency in events to perform automatic fractional and efficiency histogram updates (Dispatcher)" )) \
98  (( double, EFF_COLD_THRESHOLD, 0.1 , "threshold in fraction to check for cold (not reporting) HW (EventProcessor)" )) \
99  (( double, EFF_COLD_SIGFAIL, 5.0 , "statistical significance for cold (not reporting) HW (EventProcessor)" )) \
100  (( double, EFF_HOT_THRESHOLD, 0.1 , "threshold in fraction to check for hot HW (EventProcessor)" )) \
101  (( double, EFF_HOT_SIGFAIL, 5.0 , "statistical significance for hot HW (EventProcessor)" )) \
102  (( double, EFF_ERR_THRESHOLD, 0.1 , "threshold in fraction to check for errors in HW (EventProcessor)" )) \
103  (( double, EFF_ERR_SIGFAIL, 5.0 , "statistical significance for errors in HW (EventProcessor)" )) \
104  (( double, EFF_NODATA_THRESHOLD, 0.1 , "threshold in fraction to check for not reporting elements in HW (EventProcessor)" )) \
105  (( double, EFF_NODATA_SIGFAIL, 5.0 , "statistical significance for not reportingelements in HW (EventProcessor)" )) \
106  (( unsigned int, EVENTS_ECHO, 1000, "frequency in events to print echo message (EventProcessor)" )) \
107  (( std::string, FOLDER_FED, "" , "root file folder name to be used for FED histograms (EventProcessor)" )) \
108  (( bool, PREBOOK_ALL_HISTOS, true, "pre-book all FED, DDU, CSC histogragrams before run begins" )) \
109  \
110  \
111 
112 
117 #define CONFIG_PARAMETER_DEFINE_MACRO(r, data, i, elem) \
118  BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 0, elem) BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 1, elem);
119 
121 #define CONFIG_PARAMETER_DEFAULT_MACRO(r, data, i, elem) \
122  BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 1, elem) = BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 2, elem);
123 
125 #define CONFIG_PARAMETER_GETTER_MACRO(r, data, i, elem) \
126  const BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 0, elem) BOOST_PP_CAT(get, BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 1, elem))() const { \
127  return BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 1, elem); \
128  }
129 
131 #define CONFIG_PARAMETER_SETTER_MACRO(r, data, i, elem) \
132  void BOOST_PP_CAT(set, BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 1, elem))(BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 0, elem) p) { \
133  BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 1, elem) = p; \
134  }
135 
136 #ifdef DQMGLOBAL
137 
139 #define CONFIG_PARAMETER_LOADPS_MACRO(r, data, i, elem) \
140  BOOST_PP_CAT(set, BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 1, elem))(ps.getUntrackedParameter<BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 0, elem)>(BOOST_PP_STRINGIZE(BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 1, elem)), BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 2, elem)));
141 
142 #endif
143 
144 #ifdef DQMLOCAL
145 
147 #define CONFIG_PARAMETER_LOADXML_MACRO(r, data, i, elem) \
148  if (nodeName.compare(BOOST_PP_STRINGIZE(BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 1, elem))) == 0) { \
149  stm >> BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 1, elem); \
150  continue; \
151  }
152 
154 #define CONFIG_PARAMETER_PRINTXML_MACRO(r, data, i, elem) \
155  { \
156  DOMComment* comment = doc->createComment(XERCES_TRANSCODE(BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 3, elem))); \
157  DOMElement* el = doc->createElement(XERCES_TRANSCODE(BOOST_PP_STRINGIZE(BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 1, elem)))); \
158  std::string value = toString(config.BOOST_PP_CAT(get, BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 1, elem))()); \
159  DOMText* tdata = doc->createTextNode(XERCES_TRANSCODE(value.c_str())); \
160  el->appendChild(tdata); \
161  rootElem->appendChild(comment); \
162  rootElem->appendChild(el); \
163  }
164 
165 #endif
166 
167 namespace cscdqm {
168 
170  struct MOFilterItem {
172  TPRegexp pattern;
174  bool include;
176  MOFilterItem(const std::string pattern_, const bool include_) :
177  pattern(pattern_.c_str()), include(include_) { }
178  };
179 
189  };
190 
192  typedef std::map<ChamberCounterType, uint32_t> ChamberCounterMapType;
193 
198  ChamberCounterMapType counters;
199  ChamberCounterKeyType(const HwId& crateId_, const HwId& dmbId_, const ChamberCounterMapType& c_) : crateId(crateId_), dmbId(dmbId_), counters(c_) { }
200  };
201 
203  typedef boost::multi_index_container<
205  boost::multi_index::indexed_by<
206  boost::multi_index::ordered_unique<
207  boost::multi_index::composite_key<
208  ChamberCounterKeyType,
209  boost::multi_index::member<ChamberCounterKeyType, HwId, &ChamberCounterKeyType::crateId>,
210  boost::multi_index::member<ChamberCounterKeyType, HwId, &ChamberCounterKeyType::dmbId>
211  >
212  >
213  >
215 
221 
222  private:
223 
224  unsigned short printStatsLocal;
225 
227  std::vector<MOFilterItem> MOFilterItems;
228 
230  BOOST_PP_SEQ_FOR_EACH_I(CONFIG_PARAMETER_DEFINE_MACRO, _, CONFIG_PARAMETERS_SEQ)
231 
232 
236  void init() {
238  BOOST_PP_SEQ_FOR_EACH_I(CONFIG_PARAMETER_DEFAULT_MACRO, _, CONFIG_PARAMETERS_SEQ)
239  reset();
240  }
241 
242  public:
243 
249  boost::function< bool (const HistoDef& histoT, MonitorObject*&) > fnGetHisto;
250 
252  boost::function< bool (const HistoId id, MonitorObject*& mo) > fnGetCacheEMUHisto;
253  boost::function< bool (const HistoId id, const HwId& id1, MonitorObject*& mo) > fnGetCacheFEDHisto;
254  boost::function< bool (const HistoId id, const HwId& id1, MonitorObject*& mo) > fnGetCacheDDUHisto;
255  boost::function< bool (const HistoId id, const HwId& id1, const HwId& id2, const HwId& id3, MonitorObject*& mo) > fnGetCacheCSCHisto;
256  boost::function< bool (const HistoId id, MonitorObject*& mo) > fnGetCacheParHisto;
257  boost::function< void (const HistoDef& histoT, MonitorObject*&) > fnPutHisto;
258  boost::function< bool (unsigned int&, unsigned int&, unsigned int&) > fnNextBookedCSC;
259  boost::function< bool (unsigned int&, unsigned int&) > fnIsBookedCSC;
260  boost::function< bool (unsigned int&) > fnIsBookedDDU;
261  boost::function< bool (unsigned int&) > fnIsBookedFED;
262 
264  boost::function< MonitorObject* (const HistoBookRequest&) > fnBook;
265 
267  boost::function< bool (const unsigned int, const unsigned int, CSCDetId&) > fnGetCSCDetId;
268 
270  BOOST_PP_SEQ_FOR_EACH_I(CONFIG_PARAMETER_GETTER_MACRO, _, CONFIG_PARAMETERS_SEQ)
271 
272 
273  BOOST_PP_SEQ_FOR_EACH_I(CONFIG_PARAMETER_SETTER_MACRO, _, CONFIG_PARAMETERS_SEQ)
274 
279  init();
280  printStatsLocal = 0;
281  }
282 
287  Configuration(const bool printStats) {
288  init();
289  if (printStats) {
290  printStatsLocal = 1;
291  } else {
292  printStatsLocal = 2;
293  }
294  }
295 
300  if ((PRINT_STATS_ON_EXIT && printStatsLocal == 0) || printStatsLocal == 1) {
301  printStats();
302  }
303  }
304 
305 #ifdef DQMLOCAL
306 
312  void load(const std::string& configFile) {
314 
315  {
316  XercesDOMParser parser;
317 
319  parser.setErrorHandler(&eh);
320 
321  parser.parse(configFile.c_str());
322  DOMDocument *doc = parser.getDocument();
323  DOMNode *docNode = (DOMNode*) doc->getDocumentElement();
324 
325  DOMNodeList *itemList = docNode->getChildNodes();
326  for(XMLSize_t i = 0; i < itemList->getLength(); i++) {
327  DOMNode* node = itemList->item(i);
328  if (node->getNodeType() != DOMNode::ELEMENT_NODE) { continue; }
329 
330  std::string nodeName = XMLString::transcode(node->getNodeName());
331  std::string value = XMLString::transcode(node->getTextContent());
332  std::istringstream stm(value);
333 
334  BOOST_PP_SEQ_FOR_EACH_I(CONFIG_PARAMETER_LOADXML_MACRO, _, CONFIG_PARAMETERS_SEQ)
335 
336  if (nodeName.compare("MO_FILTER") == 0) {
337  DOMNodeList *filterList = node->getChildNodes();
338  for(XMLSize_t j = 0; j < filterList->getLength(); j++) {
339  DOMNode* filter = filterList->item(j);
340  if (filter->getNodeType() != DOMNode::ELEMENT_NODE) { continue; }
341  std::string filterName = XMLString::transcode(filter->getNodeName());
342  std::string filterValue = XMLString::transcode(filter->getTextContent());
343  MOFilterItems.insert(MOFilterItems.end(), MOFilterItem(filterValue, (filterName.compare("INCLUDE") == 0)));
344  }
345  }
346 
347  }
348  }
349 
351 
352  }
353 
359  static void printXML(const Configuration& config) {
361 
362  DOMImplementation* domImpl = DOMImplementationRegistry::getDOMImplementation(XERCES_TRANSCODE("core"));
363  DOMDocument *doc = domImpl->createDocument(0, XERCES_TRANSCODE("processor_configuration"), 0);
364  DOMElement* rootElem = doc->getDocumentElement();
365 
366  BOOST_PP_SEQ_FOR_EACH_I(CONFIG_PARAMETER_PRINTXML_MACRO, _, CONFIG_PARAMETERS_SEQ)
367 
368  DOMLSSerializer *ser = domImpl->createLSSerializer();
369  if (ser->getDomConfig()->canSetParameter(XMLUni::fgDOMWRTFormatPrettyPrint, true)) {
370  ser->getDomConfig()->setParameter(XMLUni::fgDOMWRTFormatPrettyPrint, true);
371  }
373  ser->setErrorHandler((DOMErrorHandler*) &eh);
374  ser->writeNode(new StdOutFormatTarget(), *doc);
375 
376  doc->release();
378  }
379 
380 #endif
381 
382 #ifdef DQMGLOBAL
383 
389  void load(const edm::ParameterSet& ps) {
390  BOOST_PP_SEQ_FOR_EACH_I(CONFIG_PARAMETER_LOADPS_MACRO, _, CONFIG_PARAMETERS_SEQ)
391  std::vector<std::string> moFilter = ps.getUntrackedParameter<std::vector<std::string> >("MO_FILTER");
392  for (std::vector<std::string>::iterator it = moFilter.begin(); it != moFilter.end(); it++) {
393  std::string f = *it;
394  if (!Utility::regexMatch("^[-+]/.*/$", f)) {
395  LOG_WARN << "MO_FILTER item " << f << " does not recognized to be a valid one. Skipping...";
396  continue;
397  }
398  bool include = Utility::regexMatch("^[+]", f);
399  Utility::regexReplace("^./(.*)/$", f, "$1");
400  MOFilterItems.insert(MOFilterItems.end(), MOFilterItem(f, include));
401  }
402  }
403 
404 #endif
405 
410  private:
411 
413  boost::timer globalTimer;
414 
416  boost::timer eventTimer;
417 
419  boost::timer fraTimer;
420 
422  boost::timer effTimer;
423 
425  double eventTimeSum;
426 
428  double fraTimeSum;
429 
431  double effTimeSum;
432 
433  public:
434 
436 #define STATFIELD(caption, value, units) \
437  logger << std::setfill(' '); \
438  logger << std::setiosflags(std::ios::right) << std::setw(25) << caption << " : "; \
439  logger << std::setiosflags(std::ios::right) << std::setw(12); \
440  if (((double) value) < 0) { \
441  logger << "NA"; \
442  } else { \
443  logger << value; \
444  } \
445  logger << std::setiosflags(std::ios::left) << std::setw(2) << units; \
446  logger << std::endl;
447 
449 #define SEPFIELD \
450  logger << std::setfill('-'); \
451  logger << std::setw(25) << ""; \
452  logger << std::setw(10) << ""; \
453  logger << std::setw(2) << ""; \
454  logger << std::endl;
455 
460  void printStats() {
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 
474  STATFIELD("All event time", eventTimeSum, "s")
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  }
507 
508 #undef STATFIELD
509 #undef SEPFIELD
510 
516  void eventProcessTimer(const bool start) {
517  if (start) {
518  eventTimer.restart();
519  } else {
520  eventTimeSum += eventTimer.elapsed();
521  }
522  }
523 
529  void updateFraTimer(const bool start) {
530  if (start) {
531  fraTimer.restart();
532  } else {
533  fraTimeSum += fraTimer.elapsed();
534  fraCount++;
535  }
536  }
537 
543  void updateEffTimer(const bool start) {
544  if (start) {
545  effTimer.restart();
546  } else {
547  effTimeSum += effTimer.elapsed();
548  effCount++;
549  }
550  }
551 
557  const bool needBookMO(const std::string name) const {
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  }
565 
570  public:
571 
576  void reset() {
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  }
588 
593  const unsigned long getNEvents() const { return nEvents; }
594  const unsigned long getNEventsBad() const { return nEventsBad; }
595  const unsigned long getNEventsGood() const { return nEventsGood; }
596  const unsigned long getNEventsCSC() const { return nEventsCSC; }
597  const unsigned long getNUnpackedCSC() const { return nUnpackedCSC; }
598 
603  void incNEvents() {
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  }
611  void incNEventsBad() { nEventsBad++; }
612  void incNEventsGood() { nEventsGood++; }
613  void incNEventsCSC() { nEventsCSC++; }
614  void incNUnpackedCSC() { nUnpackedCSC++; }
615 
623  void incChamberCounter(const ChamberCounterType counter, const HwId crateId, const HwId dmbId) {
624  setChamberCounterValue(counter, crateId, dmbId, getChamberCounterValue(counter, crateId, dmbId) + 1);
625  }
626 
635  void setChamberCounterValue(const ChamberCounterType counter, const HwId crateId, const HwId dmbId, const uint32_t value) {
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  }
648 
657  void copyChamberCounterValue(const ChamberCounterType counter_from, const ChamberCounterType counter_to, const HwId crateId, const HwId dmbId) {
658  setChamberCounterValue(counter_from, crateId, dmbId, getChamberCounterValue(counter_from, crateId, dmbId));
659  }
660 
668  const uint32_t getChamberCounterValue(const ChamberCounterType counter, const HwId crateId, const HwId dmbId) const {
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  }
675 
676  private:
677 
683  unsigned long nEvents;
684 
686  unsigned long nEventsBad;
687 
689  unsigned long nEventsGood;
690 
692  unsigned long nEventsCSC;
693 
695  unsigned long nUnpackedCSC;
696 
698  unsigned long fraCount;
699 
701  unsigned long effCount;
702 
705 
706  };
707 
708 }
709 
710 #undef CONFIG_PARAMETERS_SEQ_LEN
711 #undef CONFIG_PARAMETERS_SEQ
712 #undef CONFIG_PARAMETER_DEFINE_MACRO
713 #undef CONFIG_PARAMETER_DEFAULT_MACRO
714 #undef CONFIG_PARAMETER_GETTER_MACRO
715 #undef CONFIG_PARAMETER_SETTER_MACRO
716 #undef CONFIG_PARAMETER_LOADPS_MACRO
717 #undef CONFIG_PARAMETER_LOADXML_MACRO
718 #undef CONFIG_PARAMETER_PRINTXML_MACRO
719 
720 #endif
void updateFraTimer(const bool start)
Switch on/off fractional MO processing timer.
Definition: start.py:1
Configuration(const bool printStats)
Constructor.
T getUntrackedParameter(std::string const &, T const &) const
Chamber Counters key type.
MOFilterItem(const std::string pattern_, const bool include_)
unsigned int HwId
boost::function< bool(unsigned int &, unsigned int &) > fnIsBookedCSC
void incChamberCounter(const ChamberCounterType counter, const HwId crateId, const HwId dmbId)
Increment Chamber counter by 1.
auto_ptr< ClusterSequence > cs
const unsigned long getNEvents() const
#define CONFIG_PARAMETER_GETTER_MACRO(r, data, i, elem)
boost::function< bool(const HistoId id, MonitorObject *&mo) > fnGetCacheParHisto
#define LOG_INFO
Definition: CSCDQM_Logger.h:43
Information level logger. Use LOG_INFO macros instead, i.e. LOG_INFO << "x = " << x;...
Definition: CSCDQM_Logger.h:59
void xercesTerminate()
Definition: Xerces.cc:23
const unsigned long getNEventsGood() const
std::ostream & logger()
Definition: fwLog.cc:40
#define CONFIG_PARAMETERS_SEQ
void eventProcessTimer(const bool start)
Switch on/off event processing timer.
void updateEffTimer(const bool start)
Switch on/off efficiency MO processing timer.
const unsigned long getNUnpackedCSC() const
boost::function< bool(const HistoId id, const HwId &id1, const HwId &id2, const HwId &id3, MonitorObject *&mo) > fnGetCacheCSCHisto
std::map< ChamberCounterType, uint32_t > ChamberCounterMapType
Definition: config.py:1
static bool regexMatch(const std::string &expression, const std::string &message)
Match RegExp expression string against string message and return result.
void xercesInitialize()
Definition: Xerces.cc:18
#define CONFIG_PARAMETER_DEFINE_MACRO(r, data, i, elem)
ChamberCounterKeyType(const HwId &crateId_, const HwId &dmbId_, const ChamberCounterMapType &c_)
void printStats()
Print Statistics on Exit (Destruction)
const unsigned long getNEventsCSC() const
const unsigned long getNEventsBad() const
ChamberCounterType
Chamber level counter types.
CSCDQM Framework Global Configuration.
#define STATFIELD(caption, value, units)
#define CONFIG_PARAMETER_DEFAULT_MACRO(r, data, i, elem)
ChamberMapCounterMapType chamberCounters
#define SEPFIELD
boost::function< bool(unsigned int &, unsigned int &, unsigned int &) > fnNextBookedCSC
boost::function< bool(const HistoDef &histoT, MonitorObject *&) > fnGetHisto
boost::function< bool(const unsigned int, const unsigned int, CSCDetId &) > fnGetCSCDetId
const bool needBookMO(const std::string name) const
Check if MO is not excluded by MO Filter.
double f[11][100]
Definition: value.py:1
void setChamberCounterValue(const ChamberCounterType counter, const HwId crateId, const HwId dmbId, const uint32_t value)
Set Chamber counter value.
boost::function< MonitorObject *(const HistoBookRequest &) > fnBook
def load(fileName)
Definition: svgfig.py:546
boost::function< bool(unsigned int &) > fnIsBookedDDU
const uint32_t getChamberCounterValue(const ChamberCounterType counter, const HwId crateId, const HwId dmbId) const
Get Chamber counter value.
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.
#define LOG_WARN
Definition: CSCDQM_Logger.h:42
boost::function< bool(unsigned int &) > fnIsBookedFED
std::vector< MOFilterItem > MOFilterItems
boost::function< bool(const HistoId id, const HwId &id1, MonitorObject *&mo) > fnGetCacheFEDHisto
boost::function< void(const HistoDef &histoT, MonitorObject *&) > fnPutHisto
static void regexReplace(const std::string &expression, std::string &message, const std::string replace="")
Replace string part that matches RegExp expression with some string.
#define CONFIG_PARAMETER_SETTER_MACRO(r, data, i, elem)
Takes care of errors and warnings while parsing XML files file in XML format.
boost::function< bool(const HistoId id, const HwId &id1, MonitorObject *&mo) > fnGetCacheDDUHisto
boost::multi_index_container< ChamberCounterKeyType, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::composite_key< ChamberCounterKeyType, boost::multi_index::member< ChamberCounterKeyType, HwId,&ChamberCounterKeyType::crateId >, boost::multi_index::member< ChamberCounterKeyType, HwId,&ChamberCounterKeyType::dmbId > > > > > ChamberMapCounterMapType
UInt_t nEvents
Definition: hcalCalib.cc:42
MO filter Item definition (loaded from XML/PSet)
void reset()
Reset counters.
void reset(double vett[256])
Definition: TPedValues.cc:11
boost::function< bool(const HistoId id, MonitorObject *&mo) > fnGetCacheEMUHisto