CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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/dom/DOMWriter.hpp>
33 #include <xercesc/framework/StdOutFormatTarget.hpp>
34 #include <xercesc/dom/DOM.hpp>
35 
36 #include <boost/multi_index_container.hpp>
37 #include <boost/multi_index/member.hpp>
38 #include <boost/multi_index/composite_key.hpp>
39 #include <boost/multi_index/ordered_index.hpp>
40 #include "boost/tuple/tuple.hpp"
41 
42 #include <boost/preprocessor/tuple/elem.hpp>
43 #include <boost/preprocessor/seq/for_each_i.hpp>
44 #include <boost/preprocessor/stringize.hpp>
45 #include <boost/preprocessor/cat.hpp>
46 #include <boost/preprocessor/comparison/equal.hpp>
47 
48 #include <boost/shared_ptr.hpp>
49 #include <boost/function.hpp>
50 #include <boost/bind.hpp>
51 
52 #include <boost/timer.hpp>
53 
55 #ifdef DQMGLOBAL
56 
58 
59 #endif
60 
65 
67 #define CONFIG_PARAMETERS_SEQ_LEN 4
68 
73 #define CONFIG_PARAMETERS_SEQ \
74  \
75  \
76  (( bool, PROCESS_DDU, true, "enter DDU (and latter Chamber) sections (EventProcessor flag)" )) \
77  (( bool, PROCESS_CSC, true, "enter Chamber section (EventProcessor flag)" )) \
78  (( bool, PROCESS_EFF_HISTOS, true, "calculate efficiency histograms (Dispatcher flag)" )) \
79  (( bool, PROCESS_EFF_PARAMETERS, true, "calculate efficiency parameters (EventProcessor flag)" )) \
80  (( bool, BINCHECKER_CRC_ALCT, false , "check ALCT CRC (CSCDCCExaminer flag)" )) \
81  (( bool, BINCHECKER_CRC_CLCT, false , "check CLCT CRC (CSCDCCExaminer flag)" )) \
82  (( bool, BINCHECKER_CRC_CFEB, false , "check CFEB CRC (CSCDCCExaminer flag)" )) \
83  (( bool, BINCHECKER_MODE_DDU, true , "set DDU mode (CSCDCCExaminer flag)" )) \
84  (( bool, BINCHECKER_OUTPUT, false , "print 1 and 2 output (CSCDCCExaminer flag)" )) \
85  (( bool, FRAEFF_AUTO_UPDATE, false , "start fractional and efficiency histogram update automatically (Dispatcher flag)" )) \
86  (( bool, FRAEFF_SEPARATE_THREAD, false , "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, FRAEFF_AUTO_UPDATE_START, 5 , "event number to start automatic fractional and efficiency histogram updates from (Dispatcer)" )) \
98  (( unsigned int, FRAEFF_AUTO_UPDATE_FREQ, 1 , "frequency in events to perform automatic fractional and efficiency histogram updates (Dispatcher)" )) \
99  (( double, EFF_COLD_THRESHOLD, 0.1 , "threshold in fraction to check for cold (not reporting) HW (EventProcessor)" )) \
100  (( double, EFF_COLD_SIGFAIL, 5.0 , "statistical significance for cold (not reporting) HW (EventProcessor)" )) \
101  (( double, EFF_HOT_THRESHOLD, 0.1 , "threshold in fraction to check for hot HW (EventProcessor)" )) \
102  (( double, EFF_HOT_SIGFAIL, 5.0 , "statistical significance for hot HW (EventProcessor)" )) \
103  (( double, EFF_ERR_THRESHOLD, 0.1 , "threshold in fraction to check for errors in HW (EventProcessor)" )) \
104  (( double, EFF_ERR_SIGFAIL, 5.0 , "statistical significance for errors in HW (EventProcessor)" )) \
105  (( double, EFF_NODATA_THRESHOLD, 0.1 , "threshold in fraction to check for not reporting elements in HW (EventProcessor)" )) \
106  (( double, EFF_NODATA_SIGFAIL, 5.0 , "statistical significance for not reportingelements in HW (EventProcessor)" )) \
107  (( unsigned int, EVENTS_ECHO, 1000, "frequency in events to print echo message (EventProcessor)" )) \
108  \
109  \
110 
111 
116 #define CONFIG_PARAMETER_DEFINE_MACRO(r, data, i, elem) \
117  BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 0, elem) BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 1, elem);
118 
120 #define CONFIG_PARAMETER_DEFAULT_MACRO(r, data, i, elem) \
121  BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 1, elem) = BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 2, elem);
122 
124 #define CONFIG_PARAMETER_GETTER_MACRO(r, data, i, elem) \
125  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 { \
126  return BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 1, elem); \
127  }
128 
130 #define CONFIG_PARAMETER_SETTER_MACRO(r, data, i, elem) \
131  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) { \
132  BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 1, elem) = p; \
133  }
134 
135 #ifdef DQMGLOBAL
136 
138 #define CONFIG_PARAMETER_LOADPS_MACRO(r, data, i, elem) \
139  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)));
140 
141 #endif
142 
143 #ifdef DQMLOCAL
144 
146 #define CONFIG_PARAMETER_LOADXML_MACRO(r, data, i, elem) \
147  if (nodeName.compare(BOOST_PP_STRINGIZE(BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 1, elem))) == 0) { \
148  stm >> BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 1, elem); \
149  continue; \
150  }
151 
153 #define CONFIG_PARAMETER_PRINTXML_MACRO(r, data, i, elem) \
154  { \
155  DOMComment* comment = doc->createComment(XERCES_TRANSCODE(BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 3, elem))); \
156  DOMElement* el = doc->createElement(XERCES_TRANSCODE(BOOST_PP_STRINGIZE(BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 1, elem)))); \
157  std::string value = toString(config.BOOST_PP_CAT(get, BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 1, elem))()); \
158  DOMText* tdata = doc->createTextNode(XERCES_TRANSCODE(value.c_str())); \
159  el->appendChild(tdata); \
160  rootElem->appendChild(comment); \
161  rootElem->appendChild(el); \
162  }
163 
164 #endif
165 
166 namespace cscdqm {
167 
169  struct MOFilterItem {
171  TPRegexp pattern;
173  bool include;
175  MOFilterItem(const std::string pattern_, const bool include_) :
176  pattern(pattern_.c_str()), include(include_) { }
177  };
178 
188  };
189 
191  typedef std::map<ChamberCounterType, uint32_t> ChamberCounterMapType;
192 
198  ChamberCounterKeyType(const HwId& crateId_, const HwId& dmbId_, const ChamberCounterMapType& c_) : crateId(crateId_), dmbId(dmbId_), counters(c_) { }
199  };
200 
202  typedef boost::multi_index_container<
203  ChamberCounterKeyType,
204  boost::multi_index::indexed_by<
205  boost::multi_index::ordered_unique<
206  boost::multi_index::composite_key<
207  ChamberCounterKeyType,
208  boost::multi_index::member<ChamberCounterKeyType, HwId, &ChamberCounterKeyType::crateId>,
209  boost::multi_index::member<ChamberCounterKeyType, HwId, &ChamberCounterKeyType::dmbId>
210  >
211  >
212  >
214 
220 
221  private:
222 
223  unsigned short printStatsLocal;
224 
226  std::vector<MOFilterItem> MOFilterItems;
227 
229  BOOST_PP_SEQ_FOR_EACH_I(CONFIG_PARAMETER_DEFINE_MACRO, _, CONFIG_PARAMETERS_SEQ)
230 
231 
235  void init() {
237  BOOST_PP_SEQ_FOR_EACH_I(CONFIG_PARAMETER_DEFAULT_MACRO, _, CONFIG_PARAMETERS_SEQ)
238  reset();
239  }
240 
241  public:
242 
248  boost::function< bool (const HistoDef& histoT, MonitorObject*&) > fnGetHisto;
249 
251  boost::function< bool (const HistoId id, MonitorObject*& mo) > fnGetCacheEMUHisto;
252  boost::function< bool (const HistoId id, const HwId& id1, MonitorObject*& mo) > fnGetCacheDDUHisto;
253  boost::function< bool (const HistoId id, const HwId& id1, const HwId& id2, const HwId& id3, MonitorObject*& mo) > fnGetCacheCSCHisto;
254  boost::function< bool (const HistoId id, MonitorObject*& mo) > fnGetCacheParHisto;
255  boost::function< void (const HistoDef& histoT, MonitorObject*&) > fnPutHisto;
256  boost::function< bool (unsigned int&, unsigned int&, unsigned int&) > fnNextBookedCSC;
257  boost::function< bool (unsigned int&, unsigned int&) > fnIsBookedCSC;
258  boost::function< bool (unsigned int&) > fnIsBookedDDU;
259 
261  boost::function< MonitorObject* (const HistoBookRequest&) > fnBook;
262 
264  boost::function< bool (const unsigned int, const unsigned int, CSCDetId&) > fnGetCSCDetId;
265 
267  BOOST_PP_SEQ_FOR_EACH_I(CONFIG_PARAMETER_GETTER_MACRO, _, CONFIG_PARAMETERS_SEQ)
268 
269 
270  BOOST_PP_SEQ_FOR_EACH_I(CONFIG_PARAMETER_SETTER_MACRO, _, CONFIG_PARAMETERS_SEQ)
271 
276  init();
277  printStatsLocal = 0;
278  }
279 
284  Configuration(const bool printStats) {
285  init();
286  if (printStats) {
287  printStatsLocal = 1;
288  } else {
289  printStatsLocal = 2;
290  }
291  }
292 
297  if ((PRINT_STATS_ON_EXIT && printStatsLocal == 0) || printStatsLocal == 1) {
298  printStats();
299  }
300  }
301 
302 #ifdef DQMLOCAL
303 
309  void load(const std::string& configFile) {
310  XMLPlatformUtils::Initialize();
311 
312  {
313  XercesDOMParser parser;
314 
316  parser.setErrorHandler(&eh);
317 
318  parser.parse(configFile.c_str());
319  DOMDocument *doc = parser.getDocument();
320  DOMNode *docNode = (DOMNode*) doc->getDocumentElement();
321 
322  DOMNodeList *itemList = docNode->getChildNodes();
323  for(uint32_t i = 0; i < itemList->getLength(); i++) {
324  DOMNode* node = itemList->item(i);
325  if (node->getNodeType() != DOMNode::ELEMENT_NODE) { continue; }
326 
327  std::string nodeName = XMLString::transcode(node->getNodeName());
328  std::string value = XMLString::transcode(node->getTextContent());
329  std::istringstream stm(value);
330 
331  BOOST_PP_SEQ_FOR_EACH_I(CONFIG_PARAMETER_LOADXML_MACRO, _, CONFIG_PARAMETERS_SEQ)
332 
333  if (nodeName.compare("MO_FILTER") == 0) {
334  DOMNodeList *filterList = node->getChildNodes();
335  for(uint32_t j = 0; j < filterList->getLength(); j++) {
336  DOMNode* filter = filterList->item(j);
337  if (filter->getNodeType() != DOMNode::ELEMENT_NODE) { continue; }
338  std::string filterName = XMLString::transcode(filter->getNodeName());
339  std::string filterValue = XMLString::transcode(filter->getTextContent());
340  MOFilterItems.insert(MOFilterItems.end(), MOFilterItem(filterValue, (filterName.compare("INCLUDE") == 0)));
341  }
342  }
343 
344  }
345  }
346 
347  XMLPlatformUtils::Terminate();
348 
349  }
350 
356  static void printXML(const Configuration& config) {
357  XMLPlatformUtils::Initialize();
358 
359  DOMImplementation* domImpl = DOMImplementationRegistry::getDOMImplementation(XERCES_TRANSCODE("core"));
360  DOMDocument *doc = domImpl->createDocument(0, XERCES_TRANSCODE("processor_configuration"), 0);
361  DOMElement* rootElem = doc->getDocumentElement();
362 
363  BOOST_PP_SEQ_FOR_EACH_I(CONFIG_PARAMETER_PRINTXML_MACRO, _, CONFIG_PARAMETERS_SEQ)
364 
365  DOMWriter *ser = domImpl->createDOMWriter();
366  if (ser->canSetFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true)) {
367  ser->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true);
368  }
369  XMLFileErrorHandler eh;
370  ser->setErrorHandler((DOMErrorHandler*) &eh);
371  ser->writeNode(new StdOutFormatTarget(), *doc);
372 
373  doc->release();
374  XMLPlatformUtils::Terminate();
375  }
376 
377 #endif
378 
379 #ifdef DQMGLOBAL
380 
386  void load(const edm::ParameterSet& ps) {
387  BOOST_PP_SEQ_FOR_EACH_I(CONFIG_PARAMETER_LOADPS_MACRO, _, CONFIG_PARAMETERS_SEQ)
388  std::vector<std::string> moFilter = ps.getUntrackedParameter<std::vector<std::string> >("MO_FILTER");
389  for (std::vector<std::string>::iterator it = moFilter.begin(); it != moFilter.end(); it++) {
390  std::string f = *it;
391  if (!Utility::regexMatch("^[-+]/.*/$", f)) {
392  LOG_WARN << "MO_FILTER item " << f << " does not recognized to be a valid one. Skipping...";
393  continue;
394  }
395  bool include = Utility::regexMatch("^[+]", f);
396  Utility::regexReplace("^./(.*)/$", f, "$1");
397  MOFilterItems.insert(MOFilterItems.end(), MOFilterItem(f, include));
398  }
399  }
400 
401 #endif
402 
407  private:
408 
410  boost::timer globalTimer;
411 
413  boost::timer eventTimer;
414 
416  boost::timer fraTimer;
417 
419  boost::timer effTimer;
420 
422  double eventTimeSum;
423 
425  double fraTimeSum;
426 
428  double effTimeSum;
429 
430  public:
431 
433 #define STATFIELD(caption, value, units) \
434  logger << std::setfill(' '); \
435  logger << std::setiosflags(std::ios::right) << std::setw(25) << caption << " : "; \
436  logger << std::setiosflags(std::ios::right) << std::setw(12); \
437  if (((double) value) < 0) { \
438  logger << "NA"; \
439  } else { \
440  logger << value; \
441  } \
442  logger << std::setiosflags(std::ios::left) << std::setw(2) << units; \
443  logger << std::endl;
444 
446 #define SEPFIELD \
447  logger << std::setfill('-'); \
448  logger << std::setw(25) << ""; \
449  logger << std::setw(10) << ""; \
450  logger << std::setw(2) << ""; \
451  logger << std::endl;
452 
457  void printStats() {
458 
459  double allTime = globalTimer.elapsed();
460  LogInfo logger;
461  logger << std::endl;
462 
463  STATFIELD("Events processed", nEvents, "")
464  STATFIELD("Bad events", nEventsBad, "")
465  STATFIELD("Good events", nEventsGood, "")
466  STATFIELD("CSC DCC events", nEventsCSC, "")
467  STATFIELD("Unpacked CSCs", nUnpackedCSC, "")
468 
469  SEPFIELD
470 
471  STATFIELD("All event time", eventTimeSum, "s")
472  double eventTimeAverage = (nEvents > 0 ? eventTimeSum / nEvents : -1.0);
473  STATFIELD("Avg. event time", eventTimeAverage, "s")
474  double eventRateAverage = (eventTimeSum > 0 ? nEvents / eventTimeSum : -1.0);
475  STATFIELD("Avg. event rate", eventRateAverage, "Hz")
476  double chamberRateAverage = (eventTimeSum > 0 ? nUnpackedCSC / eventTimeSum : -1.0);
477  STATFIELD("Avg. chamber rate", chamberRateAverage, "Hz")
478 
479  SEPFIELD
480 
481  STATFIELD("All fra update time", fraTimeSum, "s")
482  STATFIELD("All fra update count", fraCount, "")
483  double fraTimeAverage = (fraCount > 0 ? fraTimeSum / fraCount : -1.0);
484  STATFIELD("Avg. fra update time", fraTimeAverage, "s")
485 
486  SEPFIELD
487 
488  STATFIELD("All eff update time", effTimeSum, "s")
489  STATFIELD("All eff update count", effCount, "")
490  double effTimeAverage = (effCount > 0 ? effTimeSum / effCount : -1.0);
491  STATFIELD("Avg. eff update time", effTimeAverage, "s")
492 
493  SEPFIELD
494 
495  STATFIELD("All time", allTime, "s")
496  double allTimeAverage = (nEvents > 0 ? allTime / nEvents : -1.0);
497  STATFIELD("Avg. event all time", allTimeAverage, "s")
498  double allRateAverage = (allTime > 0 ? nEvents / allTime : -1.0);
499  STATFIELD("Avg. event all rate", allRateAverage, "Hz")
500  double chamberAllRateAverage = (allTime > 0 ? nUnpackedCSC / allTime : -1.0);
501  STATFIELD("Avg. chamber all rate", chamberAllRateAverage, "Hz")
502 
503  }
504 
505 #undef STATFIELD
506 #undef SEPFIELD
507 
513  void eventProcessTimer(const bool start) {
514  if (start) {
515  eventTimer.restart();
516  } else {
517  eventTimeSum += eventTimer.elapsed();
518  }
519  }
520 
526  void updateFraTimer(const bool start) {
527  if (start) {
528  fraTimer.restart();
529  } else {
530  fraTimeSum += fraTimer.elapsed();
531  fraCount++;
532  }
533  }
534 
540  void updateEffTimer(const bool start) {
541  if (start) {
542  effTimer.restart();
543  } else {
544  effTimeSum += effTimer.elapsed();
545  effCount++;
546  }
547  }
548 
554  const bool needBookMO(const std::string name) const {
555  bool result = true;
556  for (unsigned int i = 0; i < MOFilterItems.size(); i++) {
557  const MOFilterItem* filter = &MOFilterItems.at(i);
558  if (Utility::regexMatch(filter->pattern, name)) result = filter->include;
559  }
560  return result;
561  }
562 
567  public:
568 
573  void reset() {
574  nEvents = 0;
575  nEventsBad = 0;
576  nEventsGood = 0;
577  nEventsCSC = 0;
578  nUnpackedCSC = 0;
579  fraCount = 0;
580  effCount = 0;
581  eventTimeSum = 0.0;
582  fraTimeSum = 0.0;
583  effTimeSum = 0.0;
584  }
585 
590  const unsigned long getNEvents() const { return nEvents; }
591  const unsigned long getNEventsBad() const { return nEventsBad; }
592  const unsigned long getNEventsGood() const { return nEventsGood; }
593  const unsigned long getNEventsCSC() const { return nEventsCSC; }
594  const unsigned long getNUnpackedCSC() const { return nUnpackedCSC; }
595 
600  void incNEvents() {
601  nEvents++;
602  if (getEVENTS_ECHO() > 0) {
603  if (getNEvents() % getEVENTS_ECHO() == 0) {
604  LOG_INFO << "(echo) Events processed: " << std::setw(12) << getNEvents();
605  }
606  }
607  }
608  void incNEventsBad() { nEventsBad++; }
610  void incNEventsCSC() { nEventsCSC++; }
612 
620  void incChamberCounter(const ChamberCounterType counter, const HwId crateId, const HwId dmbId) {
621  setChamberCounterValue(counter, crateId, dmbId, getChamberCounterValue(counter, crateId, dmbId) + 1);
622  }
623 
632  void setChamberCounterValue(const ChamberCounterType counter, const HwId crateId, const HwId dmbId, const uint32_t value) {
633  ChamberMapCounterMapType::iterator it = chamberCounters.find(boost::make_tuple(crateId, dmbId));
634  if (it == chamberCounters.end()) {
635  it = chamberCounters.insert(chamberCounters.end(), ChamberCounterKeyType(crateId, dmbId, ChamberCounterMapType()));
636  }
637  ChamberCounterMapType* cs = const_cast<ChamberCounterMapType*>(&it->counters);
638  ChamberCounterMapType::iterator itc = cs->find(counter);
639  if (itc == cs->end()) {
640  cs->insert(std::make_pair(counter, value));
641  } else {
642  itc->second = value;
643  }
644  }
645 
654  void copyChamberCounterValue(const ChamberCounterType counter_from, const ChamberCounterType counter_to, const HwId crateId, const HwId dmbId) {
655  setChamberCounterValue(counter_from, crateId, dmbId, getChamberCounterValue(counter_from, crateId, dmbId));
656  }
657 
665  const uint32_t getChamberCounterValue(const ChamberCounterType counter, const HwId crateId, const HwId dmbId) const {
666  ChamberMapCounterMapType::iterator it = chamberCounters.find(boost::make_tuple(crateId, dmbId));
667  if (it == chamberCounters.end()) return 0;
668  ChamberCounterMapType::const_iterator itc = it->counters.find(counter);
669  if (itc == it->counters.end()) return 0;
670  return itc->second;
671  }
672 
673  private:
674 
680  unsigned long nEvents;
681 
683  unsigned long nEventsBad;
684 
686  unsigned long nEventsGood;
687 
689  unsigned long nEventsCSC;
690 
692  unsigned long nUnpackedCSC;
693 
695  unsigned long fraCount;
696 
698  unsigned long effCount;
699 
702 
703  };
704 
705 }
706 
707 #undef CONFIG_PARAMETERS_SEQ_LEN
708 #undef CONFIG_PARAMETERS_SEQ
709 #undef CONFIG_PARAMETER_DEFINE_MACRO
710 #undef CONFIG_PARAMETER_DEFAULT_MACRO
711 #undef CONFIG_PARAMETER_GETTER_MACRO
712 #undef CONFIG_PARAMETER_SETTER_MACRO
713 #undef CONFIG_PARAMETER_LOADPS_MACRO
714 #undef CONFIG_PARAMETER_LOADXML_MACRO
715 #undef CONFIG_PARAMETER_PRINTXML_MACRO
716 
717 #endif
void updateFraTimer(const bool start)
Switch on/off fractional MO processing timer.
Configuration(const bool printStats)
Constructor.
int i
Definition: DBlmapReader.cc:9
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.
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 &lt;&lt; &quot;x = &quot; &lt;&lt; x;...
Definition: CSCDQM_Logger.h:59
const unsigned long getNEventsGood() const
std::ostream & logger()
Definition: fwLog.cc:41
#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
static bool regexMatch(const std::string &expression, const std::string &message)
Match RegExp expression string against string message and return result.
#define CONFIG_PARAMETER_DEFINE_MACRO(r, data, i, elem)
tuple node
Definition: Node.py:50
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
tuple result
Definition: query.py:137
boost::function< bool(const HistoDef &histoT, MonitorObject *&) > fnGetHisto
def load
Definition: svgfig.py:546
boost::function< bool(const unsigned int, const unsigned int, CSCDetId &) > fnGetCSCDetId
int j
Definition: DBlmapReader.cc:9
const bool needBookMO(const std::string name) const
Check if MO is not excluded by MO Filter.
double f[11][100]
tuple doc
Definition: asciidump.py:381
#define end
Definition: vmac.h:38
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
#define XERCES_TRANSCODE(str)
tuple filter
USE THIS FOR SKIMMED TRACKS process.p = cms.Path(process.hltLevel1GTSeed*process.skimming*process.offlineBeamSpot*process.TrackRefitter2) OTHERWISE USE THIS.
Definition: align_tpl.py:86
boost::function< bool(unsigned int &) > fnIsBookedDDU
void init()
Initialize parameter values and reset counters (used by constructors)
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
std::vector< MOFilterItem > MOFilterItems
boost::function< void(const HistoDef &histoT, MonitorObject *&) > fnPutHisto
#define begin
Definition: vmac.h:31
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)
bool include(const CollT &coll, const ItemT &item)
perl if(1 lt scalar(@::datatypes))
Definition: edlooper.cc:31
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
MO filter Item definition (loaded from XML/PSet)
void reset()
Reset counters.
boost::function< bool(const HistoId id, MonitorObject *&mo) > fnGetCacheEMUHisto