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 
62 #include "CSCDQM_Exception.h"
63 #include "CSCDQM_Utility.h"
64 #include "CSCDQM_Logger.h"
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  (( std::string, FOLDER_FED, "" , "root file folder name to be used for FED histograms (EventProcessor)" )) \
109  (( bool, PREBOOK_ALL_HISTOS, true, "pre-book all FED, DDU, CSC histogragrams before run begins" )) \
110  \
111  \
112 
113 
118 #define CONFIG_PARAMETER_DEFINE_MACRO(r, data, i, elem) \
119  BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 0, elem) BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 1, elem);
120 
122 #define CONFIG_PARAMETER_DEFAULT_MACRO(r, data, i, elem) \
123  BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 1, elem) = BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 2, elem);
124 
126 #define CONFIG_PARAMETER_GETTER_MACRO(r, data, i, elem) \
127  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 { \
128  return BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 1, elem); \
129  }
130 
132 #define CONFIG_PARAMETER_SETTER_MACRO(r, data, i, elem) \
133  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) { \
134  BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 1, elem) = p; \
135  }
136 
137 #ifdef DQMGLOBAL
138 
140 #define CONFIG_PARAMETER_LOADPS_MACRO(r, data, i, elem) \
141  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)));
142 
143 #endif
144 
145 #ifdef DQMLOCAL
146 
148 #define CONFIG_PARAMETER_LOADXML_MACRO(r, data, i, elem) \
149  if (nodeName.compare(BOOST_PP_STRINGIZE(BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 1, elem))) == 0) { \
150  stm >> BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 1, elem); \
151  continue; \
152  }
153 
155 #define CONFIG_PARAMETER_PRINTXML_MACRO(r, data, i, elem) \
156  { \
157  DOMComment* comment = doc->createComment(XERCES_TRANSCODE(BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 3, elem))); \
158  DOMElement* el = doc->createElement(XERCES_TRANSCODE(BOOST_PP_STRINGIZE(BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 1, elem)))); \
159  std::string value = toString(config.BOOST_PP_CAT(get, BOOST_PP_TUPLE_ELEM(CONFIG_PARAMETERS_SEQ_LEN, 1, elem))()); \
160  DOMText* tdata = doc->createTextNode(XERCES_TRANSCODE(value.c_str())); \
161  el->appendChild(tdata); \
162  rootElem->appendChild(comment); \
163  rootElem->appendChild(el); \
164  }
165 
166 #endif
167 
168 namespace cscdqm {
169 
171  struct MOFilterItem {
173  TPRegexp pattern;
175  bool include;
177  MOFilterItem(const std::string pattern_, const bool include_) :
178  pattern(pattern_.c_str()), include(include_) { }
179  };
180 
190  };
191 
193  typedef std::map<ChamberCounterType, uint32_t> ChamberCounterMapType;
194 
200  ChamberCounterKeyType(const HwId& crateId_, const HwId& dmbId_, const ChamberCounterMapType& c_) : crateId(crateId_), dmbId(dmbId_), counters(c_) { }
201  };
202 
204  typedef boost::multi_index_container<
205  ChamberCounterKeyType,
206  boost::multi_index::indexed_by<
207  boost::multi_index::ordered_unique<
208  boost::multi_index::composite_key<
209  ChamberCounterKeyType,
210  boost::multi_index::member<ChamberCounterKeyType, HwId, &ChamberCounterKeyType::crateId>,
211  boost::multi_index::member<ChamberCounterKeyType, HwId, &ChamberCounterKeyType::dmbId>
212  >
213  >
214  >
216 
222 
223  private:
224 
225  unsigned short printStatsLocal;
226 
228  std::vector<MOFilterItem> MOFilterItems;
229 
231  BOOST_PP_SEQ_FOR_EACH_I(CONFIG_PARAMETER_DEFINE_MACRO, _, CONFIG_PARAMETERS_SEQ)
232 
233 
237  void init() {
239  BOOST_PP_SEQ_FOR_EACH_I(CONFIG_PARAMETER_DEFAULT_MACRO, _, CONFIG_PARAMETERS_SEQ)
240  reset();
241  }
242 
243  public:
244 
250  boost::function< bool (const HistoDef& histoT, MonitorObject*&) > fnGetHisto;
251 
253  boost::function< bool (const HistoId id, MonitorObject*& mo) > fnGetCacheEMUHisto;
254  boost::function< bool (const HistoId id, const HwId& id1, MonitorObject*& mo) > fnGetCacheFEDHisto;
255  boost::function< bool (const HistoId id, const HwId& id1, MonitorObject*& mo) > fnGetCacheDDUHisto;
256  boost::function< bool (const HistoId id, const HwId& id1, const HwId& id2, const HwId& id3, MonitorObject*& mo) > fnGetCacheCSCHisto;
257  boost::function< bool (const HistoId id, MonitorObject*& mo) > fnGetCacheParHisto;
258  boost::function< void (const HistoDef& histoT, MonitorObject*&) > fnPutHisto;
259  boost::function< bool (unsigned int&, unsigned int&, unsigned int&) > fnNextBookedCSC;
260  boost::function< bool (unsigned int&, unsigned int&) > fnIsBookedCSC;
261  boost::function< bool (unsigned int&) > fnIsBookedDDU;
262  boost::function< bool (unsigned int&) > fnIsBookedFED;
263 
265  boost::function< MonitorObject* (const HistoBookRequest&) > fnBook;
266 
268  boost::function< bool (const unsigned int, const unsigned int, CSCDetId&) > fnGetCSCDetId;
269 
271  BOOST_PP_SEQ_FOR_EACH_I(CONFIG_PARAMETER_GETTER_MACRO, _, CONFIG_PARAMETERS_SEQ)
272 
273 
274  BOOST_PP_SEQ_FOR_EACH_I(CONFIG_PARAMETER_SETTER_MACRO, _, CONFIG_PARAMETERS_SEQ)
275 
280  init();
281  printStatsLocal = 0;
282  }
283 
288  Configuration(const bool printStats) {
289  init();
290  if (printStats) {
291  printStatsLocal = 1;
292  } else {
293  printStatsLocal = 2;
294  }
295  }
296 
301  if ((PRINT_STATS_ON_EXIT && printStatsLocal == 0) || printStatsLocal == 1) {
302  printStats();
303  }
304  }
305 
306 #ifdef DQMLOCAL
307 
313  void load(const std::string& configFile) {
315 
316  {
317  XercesDOMParser parser;
318 
320  parser.setErrorHandler(&eh);
321 
322  parser.parse(configFile.c_str());
323  DOMDocument *doc = parser.getDocument();
324  DOMNode *docNode = (DOMNode*) doc->getDocumentElement();
325 
326  DOMNodeList *itemList = docNode->getChildNodes();
327  for(uint32_t i = 0; i < itemList->getLength(); i++) {
328  DOMNode* node = itemList->item(i);
329  if (node->getNodeType() != DOMNode::ELEMENT_NODE) { continue; }
330 
331  std::string nodeName = XMLString::transcode(node->getNodeName());
332  std::string value = XMLString::transcode(node->getTextContent());
333  std::istringstream stm(value);
334 
335  BOOST_PP_SEQ_FOR_EACH_I(CONFIG_PARAMETER_LOADXML_MACRO, _, CONFIG_PARAMETERS_SEQ)
336 
337  if (nodeName.compare("MO_FILTER") == 0) {
338  DOMNodeList *filterList = node->getChildNodes();
339  for(uint32_t j = 0; j < filterList->getLength(); j++) {
340  DOMNode* filter = filterList->item(j);
341  if (filter->getNodeType() != DOMNode::ELEMENT_NODE) { continue; }
342  std::string filterName = XMLString::transcode(filter->getNodeName());
343  std::string filterValue = XMLString::transcode(filter->getTextContent());
344  MOFilterItems.insert(MOFilterItems.end(), MOFilterItem(filterValue, (filterName.compare("INCLUDE") == 0)));
345  }
346  }
347 
348  }
349  }
350 
352 
353  }
354 
360  static void printXML(const Configuration& config) {
362 
363  DOMImplementation* domImpl = DOMImplementationRegistry::getDOMImplementation(XERCES_TRANSCODE("core"));
364  DOMDocument *doc = domImpl->createDocument(0, XERCES_TRANSCODE("processor_configuration"), 0);
365  DOMElement* rootElem = doc->getDocumentElement();
366 
367  BOOST_PP_SEQ_FOR_EACH_I(CONFIG_PARAMETER_PRINTXML_MACRO, _, CONFIG_PARAMETERS_SEQ)
368 
369  DOMWriter *ser = domImpl->createDOMWriter();
370  if (ser->canSetFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true)) {
371  ser->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true);
372  }
373  XMLFileErrorHandler eh;
374  ser->setErrorHandler((DOMErrorHandler*) &eh);
375  ser->writeNode(new StdOutFormatTarget(), *doc);
376 
377  doc->release();
379  }
380 
381 #endif
382 
383 #ifdef DQMGLOBAL
384 
390  void load(const edm::ParameterSet& ps) {
391  BOOST_PP_SEQ_FOR_EACH_I(CONFIG_PARAMETER_LOADPS_MACRO, _, CONFIG_PARAMETERS_SEQ)
392  std::vector<std::string> moFilter = ps.getUntrackedParameter<std::vector<std::string> >("MO_FILTER");
393  for (std::vector<std::string>::iterator it = moFilter.begin(); it != moFilter.end(); it++) {
394  std::string f = *it;
395  if (!Utility::regexMatch("^[-+]/.*/$", f)) {
396  LOG_WARN << "MO_FILTER item " << f << " does not recognized to be a valid one. Skipping...";
397  continue;
398  }
399  bool include = Utility::regexMatch("^[+]", f);
400  Utility::regexReplace("^./(.*)/$", f, "$1");
401  MOFilterItems.insert(MOFilterItems.end(), MOFilterItem(f, include));
402  }
403  }
404 
405 #endif
406 
411  private:
412 
414  boost::timer globalTimer;
415 
417  boost::timer eventTimer;
418 
420  boost::timer fraTimer;
421 
423  boost::timer effTimer;
424 
426  double eventTimeSum;
427 
429  double fraTimeSum;
430 
432  double effTimeSum;
433 
434  public:
435 
437 #define STATFIELD(caption, value, units) \
438  logger << std::setfill(' '); \
439  logger << std::setiosflags(std::ios::right) << std::setw(25) << caption << " : "; \
440  logger << std::setiosflags(std::ios::right) << std::setw(12); \
441  if (((double) value) < 0) { \
442  logger << "NA"; \
443  } else { \
444  logger << value; \
445  } \
446  logger << std::setiosflags(std::ios::left) << std::setw(2) << units; \
447  logger << std::endl;
448 
450 #define SEPFIELD \
451  logger << std::setfill('-'); \
452  logger << std::setw(25) << ""; \
453  logger << std::setw(10) << ""; \
454  logger << std::setw(2) << ""; \
455  logger << std::endl;
456 
461  void printStats() {
462 
463  double allTime = globalTimer.elapsed();
464  LogInfo logger;
465  logger << std::endl;
466 
467  STATFIELD("Events processed", nEvents, "")
468  STATFIELD("Bad events", nEventsBad, "")
469  STATFIELD("Good events", nEventsGood, "")
470  STATFIELD("CSC DCC events", nEventsCSC, "")
471  STATFIELD("Unpacked CSCs", nUnpackedCSC, "")
472 
473  SEPFIELD
474 
475  STATFIELD("All event time", eventTimeSum, "s")
476  double eventTimeAverage = (nEvents > 0 ? eventTimeSum / nEvents : -1.0);
477  STATFIELD("Avg. event time", eventTimeAverage, "s")
478  double eventRateAverage = (eventTimeSum > 0 ? nEvents / eventTimeSum : -1.0);
479  STATFIELD("Avg. event rate", eventRateAverage, "Hz")
480  double chamberRateAverage = (eventTimeSum > 0 ? nUnpackedCSC / eventTimeSum : -1.0);
481  STATFIELD("Avg. chamber rate", chamberRateAverage, "Hz")
482 
483  SEPFIELD
484 
485  STATFIELD("All fra update time", fraTimeSum, "s")
486  STATFIELD("All fra update count", fraCount, "")
487  double fraTimeAverage = (fraCount > 0 ? fraTimeSum / fraCount : -1.0);
488  STATFIELD("Avg. fra update time", fraTimeAverage, "s")
489 
490  SEPFIELD
491 
492  STATFIELD("All eff update time", effTimeSum, "s")
493  STATFIELD("All eff update count", effCount, "")
494  double effTimeAverage = (effCount > 0 ? effTimeSum / effCount : -1.0);
495  STATFIELD("Avg. eff update time", effTimeAverage, "s")
496 
497  SEPFIELD
498 
499  STATFIELD("All time", allTime, "s")
500  double allTimeAverage = (nEvents > 0 ? allTime / nEvents : -1.0);
501  STATFIELD("Avg. event all time", allTimeAverage, "s")
502  double allRateAverage = (allTime > 0 ? nEvents / allTime : -1.0);
503  STATFIELD("Avg. event all rate", allRateAverage, "Hz")
504  double chamberAllRateAverage = (allTime > 0 ? nUnpackedCSC / allTime : -1.0);
505  STATFIELD("Avg. chamber all rate", chamberAllRateAverage, "Hz")
506 
507  }
508 
509 #undef STATFIELD
510 #undef SEPFIELD
511 
517  void eventProcessTimer(const bool start) {
518  if (start) {
519  eventTimer.restart();
520  } else {
521  eventTimeSum += eventTimer.elapsed();
522  }
523  }
524 
530  void updateFraTimer(const bool start) {
531  if (start) {
532  fraTimer.restart();
533  } else {
534  fraTimeSum += fraTimer.elapsed();
535  fraCount++;
536  }
537  }
538 
544  void updateEffTimer(const bool start) {
545  if (start) {
546  effTimer.restart();
547  } else {
548  effTimeSum += effTimer.elapsed();
549  effCount++;
550  }
551  }
552 
558  const bool needBookMO(const std::string name) const {
559  bool result = true;
560  for (unsigned int i = 0; i < MOFilterItems.size(); i++) {
561  const MOFilterItem* filter = &MOFilterItems.at(i);
562  if (Utility::regexMatch(filter->pattern, name)) result = filter->include;
563  }
564  return result;
565  }
566 
571  public:
572 
577  void reset() {
578  nEvents = 0;
579  nEventsBad = 0;
580  nEventsGood = 0;
581  nEventsCSC = 0;
582  nUnpackedCSC = 0;
583  fraCount = 0;
584  effCount = 0;
585  eventTimeSum = 0.0;
586  fraTimeSum = 0.0;
587  effTimeSum = 0.0;
588  }
589 
594  const unsigned long getNEvents() const { return nEvents; }
595  const unsigned long getNEventsBad() const { return nEventsBad; }
596  const unsigned long getNEventsGood() const { return nEventsGood; }
597  const unsigned long getNEventsCSC() const { return nEventsCSC; }
598  const unsigned long getNUnpackedCSC() const { return nUnpackedCSC; }
599 
604  void incNEvents() {
605  nEvents++;
606  if (getEVENTS_ECHO() > 0) {
607  if (getNEvents() % getEVENTS_ECHO() == 0) {
608  LOG_INFO << "(echo) Events processed: " << std::setw(12) << getNEvents();
609  }
610  }
611  }
612  void incNEventsBad() { nEventsBad++; }
614  void incNEventsCSC() { nEventsCSC++; }
616 
624  void incChamberCounter(const ChamberCounterType counter, const HwId crateId, const HwId dmbId) {
625  setChamberCounterValue(counter, crateId, dmbId, getChamberCounterValue(counter, crateId, dmbId) + 1);
626  }
627 
636  void setChamberCounterValue(const ChamberCounterType counter, const HwId crateId, const HwId dmbId, const uint32_t value) {
637  ChamberMapCounterMapType::iterator it = chamberCounters.find(boost::make_tuple(crateId, dmbId));
638  if (it == chamberCounters.end()) {
639  it = chamberCounters.insert(chamberCounters.end(), ChamberCounterKeyType(crateId, dmbId, ChamberCounterMapType()));
640  }
641  ChamberCounterMapType* cs = const_cast<ChamberCounterMapType*>(&it->counters);
642  ChamberCounterMapType::iterator itc = cs->find(counter);
643  if (itc == cs->end()) {
644  cs->insert(std::make_pair(counter, value));
645  } else {
646  itc->second = value;
647  }
648  }
649 
658  void copyChamberCounterValue(const ChamberCounterType counter_from, const ChamberCounterType counter_to, const HwId crateId, const HwId dmbId) {
659  setChamberCounterValue(counter_from, crateId, dmbId, getChamberCounterValue(counter_from, crateId, dmbId));
660  }
661 
669  const uint32_t getChamberCounterValue(const ChamberCounterType counter, const HwId crateId, const HwId dmbId) const {
670  ChamberMapCounterMapType::iterator it = chamberCounters.find(boost::make_tuple(crateId, dmbId));
671  if (it == chamberCounters.end()) return 0;
672  ChamberCounterMapType::const_iterator itc = it->counters.find(counter);
673  if (itc == it->counters.end()) return 0;
674  return itc->second;
675  }
676 
677  private:
678 
684  unsigned long nEvents;
685 
687  unsigned long nEventsBad;
688 
690  unsigned long nEventsGood;
691 
693  unsigned long nEventsCSC;
694 
696  unsigned long nUnpackedCSC;
697 
699  unsigned long fraCount;
700 
702  unsigned long effCount;
703 
706 
707  };
708 
709 }
710 
711 #undef CONFIG_PARAMETERS_SEQ_LEN
712 #undef CONFIG_PARAMETERS_SEQ
713 #undef CONFIG_PARAMETER_DEFINE_MACRO
714 #undef CONFIG_PARAMETER_DEFAULT_MACRO
715 #undef CONFIG_PARAMETER_GETTER_MACRO
716 #undef CONFIG_PARAMETER_SETTER_MACRO
717 #undef CONFIG_PARAMETER_LOADPS_MACRO
718 #undef CONFIG_PARAMETER_LOADXML_MACRO
719 #undef CONFIG_PARAMETER_PRINTXML_MACRO
720 
721 #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.
tuple start
Check for commandline option errors.
Definition: dqm_diff.py:58
auto_ptr< ClusterSequence > cs
tuple logger
Definition: conddblib.py:20
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
void xercesTerminate()
Definition: Xerces.cc:22
const unsigned long getNEventsGood() const
#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.
void xercesInitialize()
Definition: Xerces.cc:17
#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
tuple result
Definition: query.py:137
boost::function< bool(const HistoDef &histoT, MonitorObject *&) > fnGetHisto
XMLCh * transcode(const T &fInput)
boost::function< bool(const unsigned int, const unsigned int, CSCDetId &) > fnGetCSCDetId
int j
Definition: DBlmapReader.cc:9
void compare(std::vector< std::string > const &old_files, std::string const &old_process, std::vector< std::string > const &new_files, std::string const &new_process, unsigned int max_events, bool ignore_prescales, int verbose, int quiet)
Definition: hltDiff.cc:497
const bool needBookMO(const std::string name) const
Check if MO is not excluded by MO Filter.
double f[11][100]
#define end
Definition: vmac.h:37
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)
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
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
void load(int perCUT=90)
Definition: getMaxPt.h:59
#define begin
Definition: vmac.h:30
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)
if(dp >Float(M_PI)) dp-
static std::atomic< unsigned int > counter
bool include(const CollT &coll, const ItemT &item)
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)
for(const auto &isodef:isoDefs)
void reset()
Reset counters.
boost::function< bool(const HistoId id, MonitorObject *&mo) > fnGetCacheEMUHisto