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 #include <ctime>
25 #include <functional>
26 
27 #include <xercesc/parsers/XercesDOMParser.hpp>
28 #include <xercesc/dom/DOMNodeList.hpp>
29 #include <xercesc/dom/DOMElement.hpp>
30 #include <xercesc/dom/DOMComment.hpp>
31 #include <xercesc/sax/ErrorHandler.hpp>
32 #include <xercesc/sax/SAXParseException.hpp>
33 #include <xercesc/dom/DOMImplementation.hpp>
34 #include <xercesc/framework/StdOutFormatTarget.hpp>
35 #include <xercesc/dom/DOM.hpp>
36 
37 #include <boost/multi_index_container.hpp>
38 #include <boost/multi_index/member.hpp>
39 #include <boost/multi_index/composite_key.hpp>
40 #include <boost/multi_index/ordered_index.hpp>
41 #include "boost/tuple/tuple.hpp"
42 
43 #include <boost/preprocessor/tuple/elem.hpp>
44 #include <boost/preprocessor/seq/for_each_i.hpp>
45 #include <boost/preprocessor/stringize.hpp>
46 #include <boost/preprocessor/cat.hpp>
47 #include <boost/preprocessor/comparison/equal.hpp>
48 
50 #ifdef DQMGLOBAL
51 
53 
54 #endif
55 
57 #include "CSCDQM_Exception.h"
58 #include "CSCDQM_Utility.h"
59 #include "CSCDQM_Logger.h"
60 
62 #define CONFIG_PARAMETERS_SEQ_LEN 4
63 
68 #define CONFIG_PARAMETERS_SEQ \
69  \
70  ((bool, PROCESS_DDU, true, "enter DDU (and latter Chamber) sections (EventProcessor flag)"))( \
71  (bool, PROCESS_CSC, true, "enter Chamber section (EventProcessor flag)"))( \
72  (bool, PROCESS_EFF_HISTOS, true, "calculate efficiency histograms (Dispatcher flag)"))( \
73  (bool, PROCESS_EFF_PARAMETERS, true, "calculate efficiency parameters (EventProcessor flag)"))( \
74  (bool, BINCHECKER_CRC_ALCT, false, "check ALCT CRC (CSCDCCExaminer flag)"))( \
75  (bool, BINCHECKER_CRC_CLCT, false, "check CLCT CRC (CSCDCCExaminer flag)"))( \
76  (bool, BINCHECKER_CRC_CFEB, false, "check CFEB CRC (CSCDCCExaminer flag)"))( \
77  (bool, BINCHECKER_MODE_DDU, true, "set DDU mode (CSCDCCExaminer flag)"))( \
78  (bool, BINCHECKER_OUTPUT, false, "print 1 and 2 output (CSCDCCExaminer flag)"))( \
79  (bool, \
80  FRAEFF_AUTO_UPDATE, \
81  false, \
82  "start fractional and efficiency histogram update automatically (Dispatcher flag)"))( \
83  (bool, \
84  FRAEFF_SEPARATE_THREAD, \
85  false, \
86  "start fractional and efficiency histogram update on separate thread (EventProcessor flag)"))( \
87  (bool, PRINT_STATS_ON_EXIT, true, "print statistics on exit (destruction)"))( \
88  (bool, IN_FULL_STANDBY, true, "full detector is in standby mode from the beginning of the run"))( \
89  (std::string, BOOKING_XML_FILE, "", "histogram description (booking) file in XML format (Collection)"))( \
90  (std::string, FOLDER_EMU, "", "root file folder name to be used for EMU histograms (EventProcessor)"))( \
91  (std::string, FOLDER_DDU, "", "root file folder name to be used for DDU histograms (EventProcessor)"))( \
92  (std::string, FOLDER_CSC, "", "root file folder name to be used for CSC histograms (EventProcessor)"))( \
93  (std::string, FOLDER_PAR, "", "root file folder name to be used for parameters (EventProcessor)"))(( \
94  unsigned int, DDU_CHECK_MASK, 0xFFFFFFFF, "mask for cumulative EmuFileReader DDU error flags (EventProcessor)"))( \
95  (unsigned int, DDU_BINCHECK_MASK, 0x02080016, "mask for DDU level examiner errors (CSCDCCExaminer)"))( \
96  (unsigned int, BINCHECK_MASK, 0xFFFFFFFF, "mask for chamber level examiner errors (CSCDCCExaminer)"))( \
97  (unsigned int, \
98  FRAEFF_AUTO_UPDATE_START, \
99  5, \
100  "event number to start automatic fractional and efficiency histogram updates from (Dispatcer)"))( \
101  (unsigned int, \
102  FRAEFF_AUTO_UPDATE_FREQ, \
103  1, \
104  "frequency in events to perform automatic fractional and efficiency histogram updates (Dispatcher)"))(( \
105  double, EFF_COLD_THRESHOLD, 0.1, "threshold in fraction to check for cold (not reporting) HW (EventProcessor)"))( \
106  (double, EFF_COLD_SIGFAIL, 5.0, "statistical significance for cold (not reporting) HW (EventProcessor)"))( \
107  (double, EFF_HOT_THRESHOLD, 0.1, "threshold in fraction to check for hot HW (EventProcessor)"))( \
108  (double, EFF_HOT_SIGFAIL, 5.0, "statistical significance for hot HW (EventProcessor)"))( \
109  (double, EFF_ERR_THRESHOLD, 0.1, "threshold in fraction to check for errors in HW (EventProcessor)"))( \
110  (double, EFF_ERR_SIGFAIL, 5.0, "statistical significance for errors in HW (EventProcessor)"))( \
111  (double, \
112  EFF_NODATA_THRESHOLD, \
113  0.1, \
114  "threshold in fraction to check for not reporting elements in HW (EventProcessor)"))( \
115  (double, EFF_NODATA_SIGFAIL, 5.0, "statistical significance for not reportingelements in HW (EventProcessor)"))( \
116  (unsigned int, EVENTS_ECHO, 1000, "frequency in events to print echo message (EventProcessor)"))( \
117  (std::string, FOLDER_FED, "", "root file folder name to be used for FED histograms (EventProcessor)"))( \
118  (bool, PREBOOK_ALL_HISTOS, true, "pre-book all FED, DDU, CSC histogragrams before run begins"))
119 
125 #define CONFIG_PARAMETER_DEFINE_MACRO(r, data, i, elem) \
126  BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 0, elem) BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 1, elem);
127 
129 #define CONFIG_PARAMETER_DEFAULT_MACRO(r, data, i, elem) \
130  BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 1, elem) = BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 2, elem);
131 
133 #define CONFIG_PARAMETER_GETTER_MACRO(r, data, i, elem) \
134  const BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 0, elem) \
135  BOOST_PP_CAT(get, BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 1, elem))() const { \
136  return BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 1, elem); \
137  }
138 
140 #define CONFIG_PARAMETER_SETTER_MACRO(r, data, i, elem) \
141  void BOOST_PP_CAT(set, BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 1, elem))( \
142  BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 0, elem) p) { \
143  BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 1, elem) = p; \
144  }
145 
146 #ifdef DQMGLOBAL
147 
149 #define CONFIG_PARAMETER_LOADPS_MACRO(r, data, i, elem) \
150  BOOST_PP_CAT(set, BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 1, elem)) \
151  (ps.getUntrackedParameter<BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 0, elem)>( \
152  BOOST_PP_STRINGIZE(BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 1, elem)), \
153  BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 2, elem)));
154 
155 #endif
156 
157 #ifdef DQMLOCAL
158 
160 #define CONFIG_PARAMETER_LOADXML_MACRO(r, data, i, elem) \
161  if (nodeName.compare(BOOST_PP_STRINGIZE(BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 1, elem))) == 0) { \
162  stm >> BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 1, elem); \
163  continue; \
164  }
165 
167 #define CONFIG_PARAMETER_PRINTXML_MACRO(r, data, i, elem) \
168  { \
169  DOMComment* comment = \
170  doc->createComment(XERCES_TRANSCODE(BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 3, elem))); \
171  DOMElement* el = doc->createElement( \
172  XERCES_TRANSCODE(BOOST_PP_STRINGIZE(BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 1, elem)))); \
173  std::string value = toString(config.BOOST_PP_CAT(get, BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 1, elem))()); \
174  DOMText* tdata = doc->createTextNode(XERCES_TRANSCODE(value.c_str())); \
175  el->appendChild(tdata); \
176  rootElem->appendChild(comment); \
177  rootElem->appendChild(el); \
178  }
179 
180 #endif
181 
182 namespace cscdqm {
183 
185  struct MOFilterItem {
187  TPRegexp pattern;
189  bool include;
191  MOFilterItem(const std::string pattern_, const bool include_) : pattern(pattern_.c_str()), include(include_) {}
192  };
193 
203  };
204 
206  typedef std::map<ChamberCounterType, uint32_t> ChamberCounterMapType;
207 
213  ChamberCounterKeyType(const HwId& crateId_, const HwId& dmbId_, const ChamberCounterMapType& c_)
214  : crateId(crateId_), dmbId(dmbId_), counters(c_) {}
215  };
216 
218  typedef boost::multi_index_container<
219  ChamberCounterKeyType,
220  boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::composite_key<
221  ChamberCounterKeyType,
222  boost::multi_index::member<ChamberCounterKeyType, HwId, &ChamberCounterKeyType::crateId>,
223  boost::multi_index::member<ChamberCounterKeyType, HwId, &ChamberCounterKeyType::dmbId> > > > >
225 
231  private:
232  unsigned short printStatsLocal;
233 
235  std::vector<MOFilterItem> MOFilterItems;
236 
238  BOOST_PP_SEQ_FOR_EACH_I(CONFIG_PARAMETER_DEFINE_MACRO, _, CONFIG_PARAMETERS_SEQ)
239 
240 
244  void init() {
246  BOOST_PP_SEQ_FOR_EACH_I(CONFIG_PARAMETER_DEFAULT_MACRO, _, CONFIG_PARAMETERS_SEQ)
247  globalTimer = eventTimer = fraTimer = effTimer = std::clock();
248  reset();
249  }
250 
251  public:
257  std::function<bool(const HistoDef& histoT, MonitorObject*&)> fnGetHisto;
258 
260  std::function<bool(const HistoId id, MonitorObject*& mo)> fnGetCacheEMUHisto;
261  std::function<bool(const HistoId id, const HwId& id1, MonitorObject*& mo)> fnGetCacheFEDHisto;
262  std::function<bool(const HistoId id, const HwId& id1, MonitorObject*& mo)> fnGetCacheDDUHisto;
263  std::function<bool(const HistoId id, const HwId& id1, const HwId& id2, const HwId& id3, MonitorObject*& mo)>
265  std::function<bool(const HistoId id, MonitorObject*& mo)> fnGetCacheParHisto;
266  std::function<void(const HistoDef& histoT, MonitorObject*&)> fnPutHisto;
267  std::function<bool(unsigned int&, unsigned int&, unsigned int&)> fnNextBookedCSC;
268  std::function<bool(unsigned int&, unsigned int&)> fnIsBookedCSC;
269  std::function<bool(unsigned int&)> fnIsBookedDDU;
270  std::function<bool(unsigned int&)> fnIsBookedFED;
271 
273  std::function<MonitorObject*(const HistoBookRequest&)> fnBook;
274 
276  std::function<bool(const unsigned int, const unsigned int, CSCDetId&)> fnGetCSCDetId;
277 
279  BOOST_PP_SEQ_FOR_EACH_I(CONFIG_PARAMETER_GETTER_MACRO, _, CONFIG_PARAMETERS_SEQ)
280 
281 
282  BOOST_PP_SEQ_FOR_EACH_I(CONFIG_PARAMETER_SETTER_MACRO, _, CONFIG_PARAMETERS_SEQ)
283 
284 
288  init();
289  printStatsLocal = 0;
290  }
291 
296  Configuration(const bool printStats) {
297  init();
298  if (printStats) {
299  printStatsLocal = 1;
300  } else {
301  printStatsLocal = 2;
302  }
303  }
304 
309  if ((PRINT_STATS_ON_EXIT && printStatsLocal == 0) || printStatsLocal == 1) {
310  printStats();
311  }
312  }
313 
314 #ifdef DQMLOCAL
315 
321  void load(const std::string& configFile) {
323 
324  {
325  XercesDOMParser parser;
326 
328  parser.setErrorHandler(&eh);
329 
330  parser.parse(configFile.c_str());
331  DOMDocument* doc = parser.getDocument();
332  DOMNode* docNode = (DOMNode*)doc->getDocumentElement();
333 
334  DOMNodeList* itemList = docNode->getChildNodes();
335  for (XMLSize_t i = 0; i < itemList->getLength(); i++) {
336  DOMNode* node = itemList->item(i);
337  if (node->getNodeType() != DOMNode::ELEMENT_NODE) {
338  continue;
339  }
340 
341  std::string nodeName = XMLString::transcode(node->getNodeName());
342  std::string value = XMLString::transcode(node->getTextContent());
343  std::istringstream stm(value);
344 
345  BOOST_PP_SEQ_FOR_EACH_I(CONFIG_PARAMETER_LOADXML_MACRO, _, CONFIG_PARAMETERS_SEQ)
346 
347  if (nodeName.compare("MO_FILTER") == 0) {
348  DOMNodeList* filterList = node->getChildNodes();
349  for (XMLSize_t j = 0; j < filterList->getLength(); j++) {
350  DOMNode* filter = filterList->item(j);
351  if (filter->getNodeType() != DOMNode::ELEMENT_NODE) {
352  continue;
353  }
354  std::string filterName = XMLString::transcode(filter->getNodeName());
355  std::string filterValue = XMLString::transcode(filter->getTextContent());
356  MOFilterItems.insert(MOFilterItems.end(),
357  MOFilterItem(filterValue, (filterName.compare("INCLUDE") == 0)));
358  }
359  }
360  }
361  }
362 
364  }
365 
371  static void printXML(const Configuration& config) {
373 
374  DOMImplementation* domImpl = DOMImplementationRegistry::getDOMImplementation(XERCES_TRANSCODE("core"));
375  DOMDocument* doc = domImpl->createDocument(0, XERCES_TRANSCODE("processor_configuration"), 0);
376  DOMElement* rootElem = doc->getDocumentElement();
377 
378  BOOST_PP_SEQ_FOR_EACH_I(CONFIG_PARAMETER_PRINTXML_MACRO, _, CONFIG_PARAMETERS_SEQ)
379 
380  DOMLSSerializer* ser = domImpl->createLSSerializer();
381  if (ser->getDomConfig()->canSetParameter(XMLUni::fgDOMWRTFormatPrettyPrint, true)) {
382  ser->getDomConfig()->setParameter(XMLUni::fgDOMWRTFormatPrettyPrint, true);
383  }
384  XMLFileErrorHandler eh;
385  ser->setErrorHandler((DOMErrorHandler*)&eh);
386  ser->writeNode(new StdOutFormatTarget(), *doc);
387 
388  doc->release();
390  }
391 
392 #endif
393 
394 #ifdef DQMGLOBAL
395 
401  void load(const edm::ParameterSet& ps) {
402  BOOST_PP_SEQ_FOR_EACH_I(CONFIG_PARAMETER_LOADPS_MACRO, _, CONFIG_PARAMETERS_SEQ)
403  std::vector<std::string> moFilter = ps.getUntrackedParameter<std::vector<std::string> >("MO_FILTER");
404  for (std::vector<std::string>::iterator it = moFilter.begin(); it != moFilter.end(); it++) {
405  std::string f = *it;
406  if (!Utility::regexMatch("^[-+]/.*/$", f)) {
407  LOG_WARN << "MO_FILTER item " << f << " does not recognized to be a valid one. Skipping...";
408  continue;
409  }
410  bool include = Utility::regexMatch("^[+]", f);
411  Utility::regexReplace("^./(.*)/$", f, "$1");
412  MOFilterItems.insert(MOFilterItems.end(), MOFilterItem(f, include));
413  }
414  }
415 
416 #endif
417 
422  private:
424  std::clock_t globalTimer;
425 
427  std::clock_t eventTimer;
428 
430  std::clock_t fraTimer;
431 
433  std::clock_t effTimer;
434 
436  double eventTimeSum;
437 
439  double fraTimeSum;
440 
442  double effTimeSum;
443 
444  public:
446 #define STATFIELD(caption, value, units) \
447  logger << std::setfill(' '); \
448  logger << std::setiosflags(std::ios::right) << std::setw(25) << caption << " : "; \
449  logger << std::setiosflags(std::ios::right) << std::setw(12); \
450  if (((double)value) < 0) { \
451  logger << "NA"; \
452  } else { \
453  logger << value; \
454  } \
455  logger << std::setiosflags(std::ios::left) << std::setw(2) << units; \
456  logger << std::endl;
457 
459 #define SEPFIELD \
460  logger << std::setfill('-'); \
461  logger << std::setw(25) << ""; \
462  logger << std::setw(10) << ""; \
463  logger << std::setw(2) << ""; \
464  logger << std::endl;
465 
470  void printStats() {
471  double allTime = double(std::clock() - globalTimer) / CLOCKS_PER_SEC;
472  LogInfo logger;
473  logger << std::endl;
474 
475  STATFIELD("Events processed", nEvents, "")
476  STATFIELD("Bad events", nEventsBad, "")
477  STATFIELD("Good events", nEventsGood, "")
478  STATFIELD("CSC DCC events", nEventsCSC, "")
479  STATFIELD("Unpacked CSCs", nUnpackedCSC, "")
480 
481  SEPFIELD
482 
483  STATFIELD("All event time", eventTimeSum, "s")
484  double eventTimeAverage = (nEvents > 0 ? eventTimeSum / nEvents : -1.0);
485  STATFIELD("Avg. event time", eventTimeAverage, "s")
486  double eventRateAverage = (eventTimeSum > 0 ? nEvents / eventTimeSum : -1.0);
487  STATFIELD("Avg. event rate", eventRateAverage, "Hz")
488  double chamberRateAverage = (eventTimeSum > 0 ? nUnpackedCSC / eventTimeSum : -1.0);
489  STATFIELD("Avg. chamber rate", chamberRateAverage, "Hz")
490 
491  SEPFIELD
492 
493  STATFIELD("All fra update time", fraTimeSum, "s")
494  STATFIELD("All fra update count", fraCount, "")
495  double fraTimeAverage = (fraCount > 0 ? fraTimeSum / fraCount : -1.0);
496  STATFIELD("Avg. fra update time", fraTimeAverage, "s")
497 
498  SEPFIELD
499 
500  STATFIELD("All eff update time", effTimeSum, "s")
501  STATFIELD("All eff update count", effCount, "")
502  double effTimeAverage = (effCount > 0 ? effTimeSum / effCount : -1.0);
503  STATFIELD("Avg. eff update time", effTimeAverage, "s")
504 
505  SEPFIELD
506 
507  STATFIELD("All time", allTime, "s")
508  double allTimeAverage = (nEvents > 0 ? allTime / nEvents : -1.0);
509  STATFIELD("Avg. event all time", allTimeAverage, "s")
510  double allRateAverage = (allTime > 0 ? nEvents / allTime : -1.0);
511  STATFIELD("Avg. event all rate", allRateAverage, "Hz")
512  double chamberAllRateAverage = (allTime > 0 ? nUnpackedCSC / allTime : -1.0);
513  STATFIELD("Avg. chamber all rate", chamberAllRateAverage, "Hz")
514  }
515 
516 #undef STATFIELD
517 #undef SEPFIELD
518 
524  void eventProcessTimer(const bool start) {
525  if (start) {
526  eventTimer = std::clock();
527  } else {
528  eventTimeSum += double(std::clock() - eventTimer) / CLOCKS_PER_SEC;
529  }
530  }
531 
537  void updateFraTimer(const bool start) {
538  if (start) {
539  fraTimer = std::clock();
540  } else {
541  fraTimeSum += double(std::clock() - fraTimer) / CLOCKS_PER_SEC;
542  fraCount++;
543  }
544  }
545 
551  void updateEffTimer(const bool start) {
552  if (start) {
553  effTimer = std::clock();
554  } else {
555  effTimeSum += double(std::clock() - effTimer) / CLOCKS_PER_SEC;
556  effCount++;
557  }
558  }
559 
565  const bool needBookMO(const std::string name) const {
566  bool result = true;
567  for (unsigned int i = 0; i < MOFilterItems.size(); i++) {
568  const MOFilterItem* filter = &MOFilterItems.at(i);
569  if (Utility::regexMatch(filter->pattern, name))
570  result = filter->include;
571  }
572  return result;
573  }
574 
579  public:
584  void reset() {
585  nEvents = 0;
586  nEventsBad = 0;
587  nEventsGood = 0;
588  nEventsCSC = 0;
589  nUnpackedCSC = 0;
590  fraCount = 0;
591  effCount = 0;
592  eventTimeSum = 0.0;
593  fraTimeSum = 0.0;
594  effTimeSum = 0.0;
595  }
596 
601  const unsigned long getNEvents() const { return nEvents; }
602  const unsigned long getNEventsBad() const { return nEventsBad; }
603  const unsigned long getNEventsGood() const { return nEventsGood; }
604  const unsigned long getNEventsCSC() const { return nEventsCSC; }
605  const unsigned long getNUnpackedCSC() const { return nUnpackedCSC; }
606 
611  void incNEvents() {
612  nEvents++;
613  if (getEVENTS_ECHO() > 0) {
614  if (getNEvents() % getEVENTS_ECHO() == 0) {
615  LOG_INFO << "(echo) Events processed: " << std::setw(12) << getNEvents();
616  }
617  }
618  }
619  void incNEventsBad() { nEventsBad++; }
621  void incNEventsCSC() { nEventsCSC++; }
623 
631  void incChamberCounter(const ChamberCounterType counter, const HwId crateId, const HwId dmbId) {
632  setChamberCounterValue(counter, crateId, dmbId, getChamberCounterValue(counter, crateId, dmbId) + 1);
633  }
634 
644  const HwId crateId,
645  const HwId dmbId,
646  const uint32_t value) {
647  ChamberMapCounterMapType::iterator it = chamberCounters.find(boost::make_tuple(crateId, dmbId));
648  if (it == chamberCounters.end()) {
649  it = chamberCounters.insert(chamberCounters.end(),
650  ChamberCounterKeyType(crateId, dmbId, ChamberCounterMapType()));
651  }
652  ChamberCounterMapType* cs = const_cast<ChamberCounterMapType*>(&it->counters);
653  ChamberCounterMapType::iterator itc = cs->find(counter);
654  if (itc == cs->end()) {
655  cs->insert(std::make_pair(counter, value));
656  } else {
657  itc->second = value;
658  }
659  }
660 
670  const ChamberCounterType counter_to,
671  const HwId crateId,
672  const HwId dmbId) {
673  setChamberCounterValue(counter_from, crateId, dmbId, getChamberCounterValue(counter_from, crateId, dmbId));
674  }
675 
684  const HwId crateId,
685  const HwId dmbId) const {
686  ChamberMapCounterMapType::iterator it = chamberCounters.find(boost::make_tuple(crateId, dmbId));
687  if (it == chamberCounters.end())
688  return 0;
689  ChamberCounterMapType::const_iterator itc = it->counters.find(counter);
690  if (itc == it->counters.end())
691  return 0;
692  return itc->second;
693  }
694 
695  private:
701  unsigned long nEvents;
702 
704  unsigned long nEventsBad;
705 
707  unsigned long nEventsGood;
708 
710  unsigned long nEventsCSC;
711 
713  unsigned long nUnpackedCSC;
714 
716  unsigned long fraCount;
717 
719  unsigned long effCount;
720 
723  };
724 
725 } // namespace cscdqm
726 
727 #undef CONFIG_PARAMETERS_SEQ_LEN
728 #undef CONFIG_PARAMETERS_SEQ
729 #undef CONFIG_PARAMETER_DEFINE_MACRO
730 #undef CONFIG_PARAMETER_DEFAULT_MACRO
731 #undef CONFIG_PARAMETER_GETTER_MACRO
732 #undef CONFIG_PARAMETER_SETTER_MACRO
733 #undef CONFIG_PARAMETER_LOADPS_MACRO
734 #undef CONFIG_PARAMETER_LOADXML_MACRO
735 #undef CONFIG_PARAMETER_PRINTXML_MACRO
736 
737 #endif
void updateFraTimer(const bool start)
Switch on/off fractional MO processing timer.
Definition: start.py:1
const bool needBookMO(const std::string name) const
Check if MO is not excluded by MO Filter.
Configuration(const bool printStats)
Constructor.
Chamber Counters key type.
MOFilterItem(const std::string pattern_, const bool include_)
unsigned int HwId
void incChamberCounter(const ChamberCounterType counter, const HwId crateId, const HwId dmbId)
Increment Chamber counter by 1.
std::function< MonitorObject *(const HistoBookRequest &)> fnBook
#define CONFIG_PARAMETER_GETTER_MACRO(r, data, i, elem)
#define LOG_INFO
Definition: CSCDQM_Logger.h:42
std::function< void(const HistoDef &histoT, MonitorObject *&)> fnPutHisto
Information level logger. Use LOG_INFO macros instead, i.e. LOG_INFO << "x = " << x;...
Definition: CSCDQM_Logger.h:58
std::function< bool(const HistoId id, const HwId &id1, MonitorObject *&mo)> fnGetCacheDDUHisto
void xercesTerminate()
Definition: Xerces.cc:23
std::function< bool(const HistoId id, MonitorObject *&mo)> fnGetCacheParHisto
std::function< bool(const unsigned int, const unsigned int, CSCDetId &)> fnGetCSCDetId
#define CONFIG_PARAMETERS_SEQ
std::function< bool(unsigned int &)> fnIsBookedDDU
void eventProcessTimer(const bool start)
Switch on/off event processing timer.
std::function< bool(unsigned int &, unsigned int &, unsigned int &)> fnNextBookedCSC
std::function< bool(const HistoId id, const HwId &id1, const HwId &id2, const HwId &id3, MonitorObject *&mo)> fnGetCacheCSCHisto
void updateEffTimer(const bool start)
Switch on/off efficiency MO processing timer.
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)
TEMPL(T2) struct Divides void
Definition: Factorize.h:24
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
T getUntrackedParameter(std::string const &, T const &) const
const unsigned long getNEventsBad() const
const unsigned long getNEventsCSC() const
ChamberCounterType
Chamber level counter types.
CSCDQM Framework Global Configuration.
std::function< bool(const HistoDef &histoT, MonitorObject *&)> fnGetHisto
#define STATFIELD(caption, value, units)
#define CONFIG_PARAMETER_DEFAULT_MACRO(r, data, i, elem)
ChamberMapCounterMapType chamberCounters
#define SEPFIELD
std::function< bool(const HistoId id, MonitorObject *&mo)> fnGetCacheEMUHisto
const unsigned long getNUnpackedCSC() const
double f[11][100]
const unsigned long getNEvents() const
Definition: value.py:1
void setChamberCounterValue(const ChamberCounterType counter, const HwId crateId, const HwId dmbId, const uint32_t value)
Set Chamber counter value.
const unsigned long getNEventsGood() const
Definition: logger.py:1
std::function< bool(unsigned int &)> fnIsBookedFED
Definition: init.py:1
def load(fileName)
Definition: svgfig.py:547
void init()
Initialize parameter values and reset counters (used by constructors)
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:41
std::vector< MOFilterItem > MOFilterItems
static void regexReplace(const std::string &expression, std::string &message, const std::string replace="")
Replace string part that matches RegExp expression with some string.
std::function< bool(const HistoId id, const HwId &id1, MonitorObject *&mo)> fnGetCacheFEDHisto
#define CONFIG_PARAMETER_SETTER_MACRO(r, data, i, elem)
bool include(const CollT &coll, const ItemT &item)
Takes care of errors and warnings while parsing XML files file in XML format.
MO filter Item definition (loaded from XML/PSet)
void reset()
Reset counters.
std::function< bool(unsigned int &, unsigned int &)> fnIsBookedCSC
const uint32_t getChamberCounterValue(const ChamberCounterType counter, const HwId crateId, const HwId dmbId) const
Get Chamber counter value.