CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
cscdqm::Collection Class Reference

Manage collection of histograms, load histogram definitions from XML file and book histograms by calling MonitorObjectProvider routines.
More...

#include <CSCDQM_Collection.h>

Public Types

typedef xercesc::DOMDocument DOMDocument
 
typedef xercesc::DOMElement DOMElement
 
typedef xercesc::DOMNamedNodeMap DOMNamedNodeMap
 
typedef xercesc::DOMNode DOMNode
 
typedef xercesc::DOMNodeList DOMNodeList
 
typedef xercesc::XercesDOMParser XercesDOMParser
 
typedef xercesc::XMLException XMLException
 
typedef xercesc::XMLPlatformUtils XMLPlatformUtils
 
typedef xercesc::XMLString XMLString
 

Public Member Functions

void bookCSCHistos (const HwId crateId, const HwId dmbId) const
 Book Chamber Histograms. More...
 
void bookCSCHistos (const HistoId hid, const HwId crateId, const HwId dmbId, const HwId addId) const
 Book Chamber Histogram with additional identifier (On Demand) More...
 
void bookDDUHistos (const HwId dduId) const
 Book DDU histograms. More...
 
void bookEMUHistos () const
 Book EMU histograms. More...
 
void bookFEDHistos (const HwId fedId) const
 Book FED histograms. More...
 
 Collection (Configuration *const p_config)
 Constructor. More...
 
const bool isOnDemand (const HistoName &name) const
 Check if the histogram is on demand (by histogram name) More...
 
void load ()
 Load XML file and fill definition map(s) More...
 
void printCollection () const
 Print collection of available histograms and their parameters. More...
 

Private Member Functions

void book (const HistoDef &h, const CoHistoProps &p, const std::string &folder) const
 Book histogram. More...
 

Static Private Member Functions

static const bool checkHistoValue (const CoHistoProps &h, const std::string &name, std::string &value)
 Find string histogram value in map. More...
 
static const bool checkHistoValue (const CoHistoProps &h, const std::string &name, int &value)
 get Histogram int value out of the map and return boolean result More...
 
static const bool checkHistoValue (const CoHistoProps &h, const std::string name, double &value)
 get Histogram double value out of the map and return boolean result More...
 
static std::string & getHistoValue (const CoHistoProps &h, const std::string &name, std::string &value, const std::string &def_value="")
 Find string histogram value in map. More...
 
static int & getHistoValue (const CoHistoProps &h, const std::string &name, int &value, const int &def_value=0)
 get Histogram int value out of the map and More...
 
static double & getHistoValue (const CoHistoProps &h, const std::string name, double &value, const int def_value=0.0)
 get Histogram double value out of the map and More...
 
static void getNodeProperties (DOMNode *&node, CoHistoProps &hp)
 Extract and write single histogram properties from XML node to map. More...
 
static const int ParseAxisLabels (const std::string &s, std::map< int, std::string > &labels)
 Parse Axis label string and return values in vector. More...
 

Private Attributes

CoHistoMap collection
 
Configurationconfig
 

Detailed Description

Manage collection of histograms, load histogram definitions from XML file and book histograms by calling MonitorObjectProvider routines.

Definition at line 71 of file CSCDQM_Collection.h.

Member Typedef Documentation

◆ DOMDocument

typedef xercesc::DOMDocument cscdqm::Collection::DOMDocument

Definition at line 73 of file CSCDQM_Collection.h.

◆ DOMElement

typedef xercesc::DOMElement cscdqm::Collection::DOMElement

Definition at line 74 of file CSCDQM_Collection.h.

◆ DOMNamedNodeMap

typedef xercesc::DOMNamedNodeMap cscdqm::Collection::DOMNamedNodeMap

Definition at line 77 of file CSCDQM_Collection.h.

◆ DOMNode

typedef xercesc::DOMNode cscdqm::Collection::DOMNode

Definition at line 75 of file CSCDQM_Collection.h.

◆ DOMNodeList

typedef xercesc::DOMNodeList cscdqm::Collection::DOMNodeList

Definition at line 76 of file CSCDQM_Collection.h.

◆ XercesDOMParser

typedef xercesc::XercesDOMParser cscdqm::Collection::XercesDOMParser

Definition at line 81 of file CSCDQM_Collection.h.

◆ XMLException

typedef xercesc::XMLException cscdqm::Collection::XMLException

Definition at line 78 of file CSCDQM_Collection.h.

◆ XMLPlatformUtils

typedef xercesc::XMLPlatformUtils cscdqm::Collection::XMLPlatformUtils

Definition at line 80 of file CSCDQM_Collection.h.

◆ XMLString

typedef xercesc::XMLString cscdqm::Collection::XMLString

Definition at line 79 of file CSCDQM_Collection.h.

Constructor & Destructor Documentation

◆ Collection()

cscdqm::Collection::Collection ( Configuration *const  p_config)

Constructor.

Parameters
p_configPointer to Global configuration object

Definition at line 31 of file CSCDQM_Collection.cc.

31 { config = p_config; }
Definition: config.py:1

Member Function Documentation

◆ book()

void cscdqm::Collection::book ( const HistoDef h,
const CoHistoProps p,
const std::string &  folder 
) const
private

Book histogram.

Parameters
hHistogram definition to book
pMap of Histogram properties
folderfolder to book histograms to
Returns

Check if this histogram is included in booking by filters
Put histogram into cache

Definition at line 424 of file CSCDQM_Collection.cc.

References checkHistoValue(), d1, cscdqm::DEF_HISTO_COLOR, Exception, printsummarytable::folder, getHistoValue(), h, cscdqm::H1D, cscdqm::H2D, cscdqm::H3D, testProducerWithPsetDescEmpty_cfi::i1, testProducerWithPsetDescEmpty_cfi::i2, testProducerWithPsetDescEmpty_cfi::i3, SummaryClient_cfi::labels, CommonMethods::lock(), LOG_INFO, hlt_dqm_clientPB-live_cfg::me, mergeVDriftHistosByStation::name, AlCaHLTBitMon_ParallelJobs::p, ParseAxisLabels(), cscdqm::PROFILE, cscdqm::PROFILE2D, alignCSCRings::s, AlCaHLTBitMon_QueryRunRegistry::string, runGCPTkAlMap::title, cscdqm::Utility::tokenize(), funct::true, findQualityFiles::v, cscdqm::XML_BOOK_HISTO_TITLE, cscdqm::XML_BOOK_HISTO_TYPE, cscdqm::XML_BOOK_ONDEMAND, cscdqm::XML_BOOK_ONDEMAND_FALSE, and cscdqm::XML_BOOK_ONDEMAND_TRUE.

Referenced by bookCSCHistos(), bookDDUHistos(), bookEMUHistos(), and bookFEDHistos().

424  {
425  MonitorObject* me = nullptr;
426  std::string name = h.getName(), type, title, s;
427 
429  if (!config->needBookMO(h.getFullPath())) {
430  LOG_INFO << "MOFilter excluded " << name << " from booking";
431  config->fnPutHisto(h, me);
432  return;
433  }
434 
435  int i1, i2, i3;
436  double d1, d2, d3, d4, d5, d6;
437  bool ondemand =
439 
441  throw Exception("Histogram does not have type!");
442  }
444 
445  if (ondemand) {
446  title = h.processTitle(title);
447  }
448 
449  if (type == "h1") {
450  me = config->fnBook(HistoBookRequest(h,
451  H1D,
452  type,
453  folder,
454  title,
455  getHistoValue(p, "XBins", i1, 1),
456  getHistoValue(p, "XMin", d1, 0),
457  getHistoValue(p, "XMax", d2, 1)));
458  } else if (type == "h2") {
459  me = config->fnBook(HistoBookRequest(h,
460  H2D,
461  type,
462  folder,
463  title,
464  getHistoValue(p, "XBins", i1, 1),
465  getHistoValue(p, "XMin", d1, 0),
466  getHistoValue(p, "XMax", d2, 1),
467  getHistoValue(p, "YBins", i2, 1),
468  getHistoValue(p, "YMin", d3, 0),
469  getHistoValue(p, "YMax", d4, 1)));
470  } else if (type == "h3") {
471  me = config->fnBook(HistoBookRequest(h,
472  H3D,
473  type,
474  folder,
475  title,
476  getHistoValue(p, "XBins", i1, 1),
477  getHistoValue(p, "XMin", d1, 0),
478  getHistoValue(p, "XMax", d2, 1),
479  getHistoValue(p, "YBins", i2, 1),
480  getHistoValue(p, "YMin", d3, 0),
481  getHistoValue(p, "YMax", d4, 1),
482  getHistoValue(p, "ZBins", i3, 1),
483  getHistoValue(p, "ZMin", d5, 0),
484  getHistoValue(p, "ZMax", d6, 1)));
485  } else if (type == "hp") {
486  me = config->fnBook(HistoBookRequest(h,
487  PROFILE,
488  type,
489  folder,
490  title,
491  getHistoValue(p, "XBins", i1, 1),
492  getHistoValue(p, "XMin", d1, 0),
493  getHistoValue(p, "XMax", d2, 1)));
494  /*
495  HistoBookRequest(h, PROFILE, type, folder, title,
496  getHistoValue(p, "XBins", i1, 1),
497  getHistoValue(p, "XMin", d1, 0),
498  getHistoValue(p, "XMax", d2, 1),
499  getHistoValue(p, "YBins", i2, 1),
500  getHistoValue(p, "YMin", d3, 0),
501  getHistoValue(p, "YMax", d4, 1)));
502  */
503  } else if (type == "hp2") {
504  me = config->fnBook(HistoBookRequest(h,
505  PROFILE2D,
506  type,
507  folder,
508  title,
509  getHistoValue(p, "XBins", i1, 1),
510  getHistoValue(p, "XMin", d1, 0),
511  getHistoValue(p, "XMax", d2, 1),
512  getHistoValue(p, "YBins", i2, 1),
513  getHistoValue(p, "YMin", d3, 0),
514  getHistoValue(p, "YMax", d4, 1),
515  getHistoValue(p, "ZBins", i3, 1),
516  getHistoValue(p, "ZMin", d5, 0),
517  getHistoValue(p, "ZMax", d6, 1)));
518  } else {
519  throw Exception("Can not book histogram with type: " + type);
520  }
521 
522  if (me != nullptr) {
523  LockType lock(me->mutex);
524  TH1* th = me->getTH1Lock();
525 
526  if (checkHistoValue(p, "XTitle", s)) {
527  if (ondemand) {
528  s = h.processTitle(s);
529  }
530  me->setAxisTitle(s, 1);
531  }
532 
533  if (checkHistoValue(p, "YTitle", s)) {
534  if (ondemand) {
535  s = h.processTitle(s);
536  }
537  me->setAxisTitle(s, 2);
538  }
539 
540  if (checkHistoValue(p, "ZTitle", s)) {
541  if (ondemand) {
542  s = h.processTitle(s);
543  }
544  me->setAxisTitle(s, 3);
545  }
546 
547  if (checkHistoValue(p, "SetOption", s))
548  th->SetOption(s.c_str());
549  if (checkHistoValue(p, "SetStats", i1))
550  th->SetStats(i1);
551  th->SetFillColor(getHistoValue(p, "SetFillColor", i1, DEF_HISTO_COLOR));
552  if (checkHistoValue(p, "SetXLabels", s)) {
553  std::map<int, std::string> labels;
555  th->GetXaxis()->SetNoAlphanumeric(); // For ROOT6 to prevent getting zero means values
556  for (std::map<int, std::string>::iterator l_itr = labels.begin(); l_itr != labels.end(); ++l_itr) {
557  th->GetXaxis()->SetBinLabel(l_itr->first, l_itr->second.c_str());
558  }
559  }
560  if (checkHistoValue(p, "SetYLabels", s)) {
561  std::map<int, std::string> labels;
563  th->GetYaxis()->SetNoAlphanumeric(); // For ROOT6 to prevent getting zero means values
564  for (std::map<int, std::string>::iterator l_itr = labels.begin(); l_itr != labels.end(); ++l_itr) {
565  th->GetYaxis()->SetBinLabel(l_itr->first, l_itr->second.c_str());
566  }
567  }
568  if (checkHistoValue(p, "LabelOption", s)) {
569  std::vector<std::string> v;
570  if (2 == Utility::tokenize(s, v, ",")) {
571  th->LabelsOption(v[0].c_str(), v[1].c_str());
572  }
573  }
574  if (checkHistoValue(p, "SetLabelSize", s)) {
575  std::vector<std::string> v;
576  if (2 == Utility::tokenize(s, v, ",")) {
577  th->SetLabelSize((double)atof(v[0].c_str()), v[1].c_str());
578  }
579  }
580  if (checkHistoValue(p, "SetTitleOffset", s)) {
581  std::vector<std::string> v;
582  if (2 == Utility::tokenize(s, v, ",")) {
583  th->SetTitleOffset((double)atof(v[0].c_str()), v[1].c_str());
584  }
585  }
586  if (checkHistoValue(p, "SetMinimum", d1))
587  th->SetMinimum(d1);
588  if (checkHistoValue(p, "SetMaximum", d1))
589  me->SetMaximum(d1);
590  if (checkHistoValue(p, "SetNdivisionsX", i1)) {
591  th->SetNdivisions(i1, "X");
592  th->GetXaxis()->CenterLabels(true);
593  }
594  if (checkHistoValue(p, "SetNdivisionsY", i1)) {
595  th->SetNdivisions(i1, "Y");
596  th->GetYaxis()->CenterLabels(true);
597  }
598  if (checkHistoValue(p, "SetTickLengthX", d1))
599  th->SetTickLength(d1, "X");
600  if (checkHistoValue(p, "SetTickLengthY", d1))
601  th->SetTickLength(d1, "Y");
602  if (checkHistoValue(p, "SetLabelSizeX", d1))
603  th->SetLabelSize(d1, "X");
604  if (checkHistoValue(p, "SetLabelSizeY", d1))
605  th->SetLabelSize(d1, "Y");
606  if (checkHistoValue(p, "SetLabelSizeZ", d1))
607  th->SetLabelSize(d1, "Z");
608  if (checkHistoValue(p, "SetErrorOption", s))
609  reinterpret_cast<TProfile*>(th)->SetErrorOption(s.c_str());
610 
611  lock.unlock();
612  }
613 
614  LOG_DEBUG << "[Collection::book] booked " << h.getFullPath() << " (" << me << ")";
615 
617  config->fnPutHisto(h, me);
618  }
static const char XML_BOOK_ONDEMAND_FALSE[]
static const char XML_BOOK_HISTO_TYPE[]
#define LOG_INFO
Definition: CSCDQM_Logger.h:42
static const char XML_BOOK_ONDEMAND[]
Definition: config.py:1
static std::string & getHistoValue(const CoHistoProps &h, const std::string &name, std::string &value, const std::string &def_value="")
Find string histogram value in map.
static const bool checkHistoValue(const CoHistoProps &h, const std::string &name, std::string &value)
Find string histogram value in map.
static const char XML_BOOK_ONDEMAND_TRUE[]
static const int DEF_HISTO_COLOR
static const char XML_BOOK_HISTO_TITLE[]
static const int ParseAxisLabels(const std::string &s, std::map< int, std::string > &labels)
Parse Axis label string and return values in vector.
static constexpr float d1
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
static int tokenize(const std::string &str, std::vector< std::string > &tokens, const std::string &delimiters=" ")
Break string into tokens.

◆ bookCSCHistos() [1/2]

void cscdqm::Collection::bookCSCHistos ( const HwId  crateId,
const HwId  dmbId 
) const

Book Chamber Histograms.

Parameters
crateIdCSC Crate Id
dmbIdCSC DMB Id
Returns

Definition at line 372 of file CSCDQM_Collection.cc.

References book(), checkHistoValue(), collection, cscdqm::HistoDef::getHistoIdByName(), getHistoValue(), mps_fire::i, dqmiolumiharvest::j, isotrackApplyRegressor::k, alignCSCRings::s, AlCaHLTBitMon_QueryRunRegistry::string, cscdqm::XML_BOOK_NAME_FROM, cscdqm::XML_BOOK_NAME_TO, cscdqm::XML_BOOK_ONDEMAND, and cscdqm::XML_BOOK_ONDEMAND_FALSE.

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

372  {
373  CoHistoMap::const_iterator i = collection.find("CSC");
374  if (i != collection.end()) {
375  const CoHisto hs = i->second;
376  for (CoHisto::const_iterator j = hs.begin(); j != hs.end(); j++) {
377  std::string s = "";
378  HistoId hid = 0;
379  if (HistoDef::getHistoIdByName(j->first, hid)) {
381  CSCHistoDef hdef(hid, crateId, dmbId);
382  book(hdef, j->second, config->getFOLDER_CSC());
383  } else {
384  int from = 0, to = 0;
385  if (checkHistoValue(j->second, XML_BOOK_NAME_FROM, from) &&
386  checkHistoValue(j->second, XML_BOOK_NAME_TO, to)) {
387  for (int k = from; k <= to; k++) {
388  CSCHistoDef hdef(hid, crateId, dmbId, k);
389  book(hdef, j->second, config->getFOLDER_CSC());
390  }
391  }
392  }
393  }
394  }
395  }
396  }
static const bool getHistoIdByName(const std::string &p_name, HistoId &p_id)
Get Histogram ID by name.
static const char XML_BOOK_ONDEMAND_FALSE[]
static const char XML_BOOK_NAME_FROM[]
static const char XML_BOOK_NAME_TO[]
static const char XML_BOOK_ONDEMAND[]
Definition: config.py:1
unsigned int HistoId
static std::string & getHistoValue(const CoHistoProps &h, const std::string &name, std::string &value, const std::string &def_value="")
Find string histogram value in map.
void book(const HistoDef &h, const CoHistoProps &p, const std::string &folder) const
Book histogram.
static const bool checkHistoValue(const CoHistoProps &h, const std::string &name, std::string &value)
Find string histogram value in map.
std::map< std::string, CoHistoProps > CoHisto

◆ bookCSCHistos() [2/2]

void cscdqm::Collection::bookCSCHistos ( const HistoId  hid,
const HwId  crateId,
const HwId  dmbId,
const HwId  addId 
) const

Book Chamber Histogram with additional identifier (On Demand)

Parameters
hidHistogram Identifier
crateIdCSC Crate Id
dmbIdCSC DMB Id
addIdCSC Additional identifier, ex. Layer Id, ALCT Id, etc.
Returns

Definition at line 406 of file CSCDQM_Collection.cc.

References book(), collection, mps_fire::i, dqmiolumiharvest::j, and cscdqm::h::names.

406  {
407  CoHistoMap::const_iterator i = collection.find("CSC");
408  if (i != collection.end()) {
409  CoHisto::const_iterator j = i->second.find(h::names[hid]);
410  if (j != i->second.end()) {
411  CSCHistoDef hdef(hid, crateId, dmbId, addId);
412  book(hdef, j->second, config->getFOLDER_CSC());
413  }
414  }
415  }
static const HistoName names[]
Definition: config.py:1
void book(const HistoDef &h, const CoHistoProps &p, const std::string &folder) const
Book histogram.

◆ bookDDUHistos()

void cscdqm::Collection::bookDDUHistos ( const HwId  dduId) const

Book DDU histograms.

Parameters
dduIdDDU Id
Returns

Definition at line 349 of file CSCDQM_Collection.cc.

References book(), collection, cscdqm::HistoDef::getHistoIdByName(), getHistoValue(), mps_fire::i, dqmiolumiharvest::j, alignCSCRings::s, AlCaHLTBitMon_QueryRunRegistry::string, cscdqm::XML_BOOK_ONDEMAND, and cscdqm::XML_BOOK_ONDEMAND_FALSE.

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

349  {
350  CoHistoMap::const_iterator i = collection.find("DDU");
351  if (i != collection.end()) {
352  const CoHisto hs = i->second;
353  for (CoHisto::const_iterator j = hs.begin(); j != hs.end(); j++) {
354  std::string s = "";
356  HistoId hid = 0;
357  if (HistoDef::getHistoIdByName(j->first, hid)) {
358  DDUHistoDef hdef(hid, dduId);
359  book(hdef, j->second, config->getFOLDER_DDU());
360  }
361  }
362  }
363  }
364  }
static const bool getHistoIdByName(const std::string &p_name, HistoId &p_id)
Get Histogram ID by name.
static const char XML_BOOK_ONDEMAND_FALSE[]
static const char XML_BOOK_ONDEMAND[]
Definition: config.py:1
unsigned int HistoId
static std::string & getHistoValue(const CoHistoProps &h, const std::string &name, std::string &value, const std::string &def_value="")
Find string histogram value in map.
void book(const HistoDef &h, const CoHistoProps &p, const std::string &folder) const
Book histogram.
std::map< std::string, CoHistoProps > CoHisto

◆ bookEMUHistos()

void cscdqm::Collection::bookEMUHistos ( ) const

Book EMU histograms.

Returns

Definition at line 305 of file CSCDQM_Collection.cc.

References book(), collection, cscdqm::HistoDef::getHistoIdByName(), getHistoValue(), mps_fire::i, dqmiolumiharvest::j, alignCSCRings::s, AlCaHLTBitMon_QueryRunRegistry::string, cscdqm::XML_BOOK_ONDEMAND, and cscdqm::XML_BOOK_ONDEMAND_FALSE.

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

305  {
306  CoHistoMap::const_iterator i = collection.find("EMU");
307  if (i != collection.end()) {
308  const CoHisto hs = i->second;
309  for (CoHisto::const_iterator j = hs.begin(); j != hs.end(); j++) {
310  std::string s = "";
312  HistoId hid = 0;
313  if (HistoDef::getHistoIdByName(j->first, hid)) {
314  EMUHistoDef hdef(hid);
315  book(hdef, j->second, config->getFOLDER_EMU());
316  }
317  }
318  }
319  }
320  }
static const bool getHistoIdByName(const std::string &p_name, HistoId &p_id)
Get Histogram ID by name.
static const char XML_BOOK_ONDEMAND_FALSE[]
static const char XML_BOOK_ONDEMAND[]
Definition: config.py:1
unsigned int HistoId
static std::string & getHistoValue(const CoHistoProps &h, const std::string &name, std::string &value, const std::string &def_value="")
Find string histogram value in map.
void book(const HistoDef &h, const CoHistoProps &p, const std::string &folder) const
Book histogram.
std::map< std::string, CoHistoProps > CoHisto

◆ bookFEDHistos()

void cscdqm::Collection::bookFEDHistos ( const HwId  fedId) const

Book FED histograms.

Parameters
fedIdFED Id
Returns

Definition at line 327 of file CSCDQM_Collection.cc.

References book(), collection, l1tstage2_dqm_sourceclient-live_cfg::fedId, cscdqm::HistoDef::getHistoIdByName(), getHistoValue(), mps_fire::i, dqmiolumiharvest::j, alignCSCRings::s, AlCaHLTBitMon_QueryRunRegistry::string, cscdqm::XML_BOOK_ONDEMAND, and cscdqm::XML_BOOK_ONDEMAND_FALSE.

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

327  {
328  CoHistoMap::const_iterator i = collection.find("FED");
329  if (i != collection.end()) {
330  const CoHisto hs = i->second;
331  for (CoHisto::const_iterator j = hs.begin(); j != hs.end(); j++) {
332  std::string s = "";
334  HistoId hid = 0;
335  if (HistoDef::getHistoIdByName(j->first, hid)) {
336  FEDHistoDef hdef(hid, fedId);
337  book(hdef, j->second, config->getFOLDER_FED());
338  }
339  }
340  }
341  }
342  }
static const bool getHistoIdByName(const std::string &p_name, HistoId &p_id)
Get Histogram ID by name.
static const char XML_BOOK_ONDEMAND_FALSE[]
static const char XML_BOOK_ONDEMAND[]
Definition: config.py:1
unsigned int HistoId
static std::string & getHistoValue(const CoHistoProps &h, const std::string &name, std::string &value, const std::string &def_value="")
Find string histogram value in map.
void book(const HistoDef &h, const CoHistoProps &p, const std::string &folder) const
Book histogram.
std::map< std::string, CoHistoProps > CoHisto

◆ checkHistoValue() [1/3]

const bool cscdqm::Collection::checkHistoValue ( const CoHistoProps h,
const std::string &  name,
std::string &  value 
)
staticprivate

Find string histogram value in map.

Parameters
hHistogram map
nameparameter name
valuehandler for parameter value
Returns
true if parameter found and filled, false - otherwise

Definition at line 180 of file CSCDQM_Collection.cc.

References h, mps_fire::i, and mergeVDriftHistosByStation::name.

Referenced by book(), bookCSCHistos(), and getHistoValue().

180  {
181  CoHistoProps::const_iterator i = h.find(name);
182  if (i == h.end()) {
183  return false;
184  }
185  value = i->second;
186  return true;
187  }
Definition: value.py:1
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4

◆ checkHistoValue() [2/3]

const bool cscdqm::Collection::checkHistoValue ( const CoHistoProps h,
const std::string &  name,
int &  value 
)
staticprivate

get Histogram int value out of the map and return boolean result

Parameters
hHistogram map
nameparameter name
valuehandler for parameter value
Returns
true if parameter found and filled, false - otherwise

Definition at line 196 of file CSCDQM_Collection.cc.

References h, mps_fire::i, mergeVDriftHistosByStation::name, and relativeConstraints::value.

196  {
197  CoHistoProps::const_iterator i = h.find(name);
198  if (i == h.end()) {
199  return false;
200  }
201  if (EOF == std::sscanf(i->second.c_str(), "%d", &value)) {
202  return false;
203  }
204  return true;
205  }
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4

◆ checkHistoValue() [3/3]

const bool cscdqm::Collection::checkHistoValue ( const CoHistoProps h,
const std::string  name,
double &  value 
)
staticprivate

get Histogram double value out of the map and return boolean result

Parameters
hHistogram map
nameparameter name
valuehandler for parameter value
Returns
true if parameter found and filled, false - otherwise

Definition at line 215 of file CSCDQM_Collection.cc.

References h, mps_fire::i, mergeVDriftHistosByStation::name, and relativeConstraints::value.

215  {
216  CoHistoProps::const_iterator i = h.find(name);
217  if (i == h.end()) {
218  return false;
219  }
220  if (EOF == std::sscanf(i->second.c_str(), "%lf", &value)) {
221  return false;
222  }
223  return true;
224  }
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4

◆ getHistoValue() [1/3]

std::string & cscdqm::Collection::getHistoValue ( const CoHistoProps h,
const std::string &  name,
std::string &  value,
const std::string &  def_value = "" 
)
staticprivate

Find string histogram value in map.

Parameters
hHistogram map
nameparameter name
valuehandler for parameter value
def_valuedefault value if parameter not found
Returns
pointer to value

Definition at line 234 of file CSCDQM_Collection.cc.

References checkHistoValue(), h, mergeVDriftHistosByStation::name, and relativeConstraints::value.

Referenced by book(), bookCSCHistos(), bookDDUHistos(), bookEMUHistos(), bookFEDHistos(), and isOnDemand().

237  {
238  if (!checkHistoValue(h, name, value)) {
239  value = def_value;
240  }
241  return value;
242  }
static const bool checkHistoValue(const CoHistoProps &h, const std::string &name, std::string &value)
Find string histogram value in map.
Definition: value.py:1
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4

◆ getHistoValue() [2/3]

int & cscdqm::Collection::getHistoValue ( const CoHistoProps h,
const std::string &  name,
int &  value,
const int &  def_value = 0 
)
staticprivate

get Histogram int value out of the map and

Parameters
hHistogram map
nameparameter name
valuehandler for parameter value
def_valuedefault value if parameter not found
Returns
pointer to value

Definition at line 252 of file CSCDQM_Collection.cc.

References checkHistoValue(), h, mergeVDriftHistosByStation::name, and relativeConstraints::value.

252  {
253  if (!checkHistoValue(h, name, value)) {
254  value = def_value;
255  }
256  return value;
257  }
static const bool checkHistoValue(const CoHistoProps &h, const std::string &name, std::string &value)
Find string histogram value in map.
Definition: value.py:1
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4

◆ getHistoValue() [3/3]

double & cscdqm::Collection::getHistoValue ( const CoHistoProps h,
const std::string  name,
double &  value,
const int  def_value = 0.0 
)
staticprivate

get Histogram double value out of the map and

Parameters
hHistogram map
nameparameter name
valuehandler for parameter value
def_valuedefault value if parameter not found
Returns
pointer to value

Definition at line 267 of file CSCDQM_Collection.cc.

References checkHistoValue(), h, mergeVDriftHistosByStation::name, and relativeConstraints::value.

267  {
268  if (!checkHistoValue(h, name, value)) {
269  value = def_value;
270  }
271  return value;
272  }
static const bool checkHistoValue(const CoHistoProps &h, const std::string &name, std::string &value)
Find string histogram value in map.
Definition: value.py:1
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4

◆ getNodeProperties()

void cscdqm::Collection::getNodeProperties ( DOMNode *&  node,
CoHistoProps p 
)
staticprivate

Extract and write single histogram properties from XML node to map.

Parameters
nodeXML node
pList of properties to fill
Returns

Definition at line 144 of file CSCDQM_Collection.cc.

References edmScanValgrind::buffer, submitPVResolutionJobs::content, mps_fire::i, dqmiolumiharvest::j, mergeVDriftHistosByStation::name, AlCaHLTBitMon_ParallelJobs::p, AlCaHLTBitMon_QueryRunRegistry::string, relativeConstraints::value, and XERCES_CPP_NAMESPACE_QUALIFIER.

Referenced by load().

144  {
145  DOMNodeList* props = node->getChildNodes();
146 
147  for (XMLSize_t j = 0; j < props->getLength(); j++) {
148  DOMNode* node = props->item(j);
149  if (node->getNodeType() != DOMNode::ELEMENT_NODE) {
150  continue;
151  }
152  DOMElement* element = dynamic_cast<DOMElement*>(node);
153  std::string name = XMLString::transcode(element->getNodeName());
154 
155  const XMLCh* content = element->getTextContent();
156  XERCES_CPP_NAMESPACE_QUALIFIER TranscodeToStr tc(content, "UTF-8");
157  std::istringstream buffer((const char*)tc.str());
158  std::string value = buffer.str();
159 
160  DOMNamedNodeMap* attributes = node->getAttributes();
161  if (attributes) {
162  for (XMLSize_t i = 0; i < attributes->getLength(); i++) {
163  DOMNode* attribute = attributes->item(i);
164  std::string aname = XMLString::transcode(attribute->getNodeName());
165  std::string avalue = XMLString::transcode(attribute->getNodeValue());
166  p[name + "_" + aname] = avalue;
167  }
168  }
169  p[name] = value;
170  }
171  }
#define XERCES_CPP_NAMESPACE_QUALIFIER
Definition: LHERunInfo.h:16
xercesc::DOMNode DOMNode
xercesc::DOMElement DOMElement
Definition: value.py:1
xercesc::DOMNodeList DOMNodeList
xercesc::DOMNamedNodeMap DOMNamedNodeMap

◆ isOnDemand()

const bool cscdqm::Collection::isOnDemand ( const HistoName name) const

Check if the histogram is on demand (by histogram name)

Parameters
namename of the histogram
Returns
true if this histogram is on demand, false - otherwise

Definition at line 625 of file CSCDQM_Collection.cc.

References collection, getHistoValue(), mps_fire::i, dqmiolumiharvest::j, mergeVDriftHistosByStation::name, alignCSCRings::s, AlCaHLTBitMon_QueryRunRegistry::string, cscdqm::XML_BOOK_ONDEMAND, cscdqm::XML_BOOK_ONDEMAND_FALSE, and cscdqm::XML_BOOK_ONDEMAND_TRUE.

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

625  {
626  CoHistoMap::const_iterator i = collection.find("CSC");
627  if (i != collection.end()) {
628  CoHisto hs = i->second;
629  CoHisto::const_iterator j = hs.find(name);
630  if (j != hs.end()) {
631  std::string s;
633  }
634  }
635  return false;
636  }
static const char XML_BOOK_ONDEMAND_FALSE[]
static const char XML_BOOK_ONDEMAND[]
static std::string & getHistoValue(const CoHistoProps &h, const std::string &name, std::string &value, const std::string &def_value="")
Find string histogram value in map.
static const char XML_BOOK_ONDEMAND_TRUE[]
std::map< std::string, CoHistoProps > CoHisto

◆ load()

void cscdqm::Collection::load ( )

Load XML file and fill definition map(s)

Returns

Load histogram definition

Load histogram

Definition at line 37 of file CSCDQM_Collection.cc.

References collection, ztail::d, ALCARECOEcalPhiSym_cff::doc, Calorimetry_cff::dp, MillePedeFileConverter_cfg::e, Exception, getNodeProperties(), h, trackingPlots::hp, mps_fire::i, EcalPhiSymFlatTableProducers_cfi::id, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, LOG_INFO, mergeVDriftHistosByStation::name, writedatasetfile::parser, ConfigBuilder::prefix, cscdqm::Utility::regexMatch(), cscdqm::REGEXP_ONDEMAND(), AlCaHLTBitMon_QueryRunRegistry::string, cms::concurrency::xercesInitialize(), cms::concurrency::xercesTerminate(), cscdqm::XML_BOOK_DEFINITION, cscdqm::XML_BOOK_DEFINITION_ID, cscdqm::XML_BOOK_DEFINITION_REF, cscdqm::XML_BOOK_HISTO_NAME, cscdqm::XML_BOOK_HISTO_PREFIX, cscdqm::XML_BOOK_HISTOGRAM, cscdqm::XML_BOOK_ONDEMAND, cscdqm::XML_BOOK_ONDEMAND_FALSE, and cscdqm::XML_BOOK_ONDEMAND_TRUE.

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

37  {
38  LOG_INFO << "Reading histograms from " << config->getBOOKING_XML_FILE();
39 
40  if (config->getBOOKING_XML_FILE().empty()) {
41  return;
42  }
43 
44  try {
46  {
48 
49  parser.setValidationScheme(XercesDOMParser::Val_Always);
50  parser.setDoNamespaces(true);
51  parser.setDoSchema(true);
52  parser.setExitOnFirstFatalError(true);
53  parser.setValidationConstraintFatal(true);
54  XMLFileErrorHandler eh;
55  parser.setErrorHandler(&eh);
56  parser.parse(config->getBOOKING_XML_FILE().c_str());
57 
58  DOMDocument* doc = parser.getDocument();
59  DOMElement* docNode = doc->getDocumentElement();
60  DOMNodeList* itemList = docNode->getChildNodes();
61 
63  for (XMLSize_t i = 0; i < itemList->getLength(); i++) {
64  DOMNode* node = itemList->item(i);
65  if (node->getNodeType() != DOMNode::ELEMENT_NODE) {
66  continue;
67  }
68 
69  std::string nodeName = XMLString::transcode(node->getNodeName());
70 
74  if (nodeName == XML_BOOK_DEFINITION) {
76  getNodeProperties(node, dp);
77 
78  DOMElement* el = dynamic_cast<DOMElement*>(node);
79  std::string id(XMLString::transcode(el->getAttribute(XMLString::transcode(XML_BOOK_DEFINITION_ID))));
80  definitions.insert(make_pair(id, dp));
81 
82  } else
83 
87  if (nodeName == XML_BOOK_HISTOGRAM) {
89 
90  DOMElement* el = dynamic_cast<DOMElement*>(node);
91  if (el->hasAttribute(XMLString::transcode(XML_BOOK_DEFINITION_REF))) {
92  std::string id(XMLString::transcode(el->getAttribute(XMLString::transcode(XML_BOOK_DEFINITION_REF))));
93 
95  for (CoHistoProps::iterator it = d.begin(); it != d.end(); it++) {
96  hp[it->first] = it->second;
97  }
98  }
99 
100  getNodeProperties(node, hp);
101 
104 
105  // Check if this histogram is an ON DEMAND histogram?
108 
109  LOG_DEBUG << "[Collection::load] loading " << prefix << "::" << name
110  << " XML_BOOK_ONDEMAND = " << hp[XML_BOOK_ONDEMAND];
111 
112  CoHistoMap::iterator it = collection.find(prefix);
113  if (it == collection.end()) {
114  CoHisto h;
115  h[name] = hp;
116  collection[prefix] = h;
117  } else {
118  it->second.insert(make_pair(name, hp));
119  }
120  }
121  }
122  }
123 
125 
126  } catch (XMLException& e) {
127  char* message = XMLString::transcode(e.getMessage());
128  throw Exception(message);
129  }
130 
131  for (CoHistoMap::const_iterator i = collection.begin(); i != collection.end(); i++) {
132  LOG_INFO << i->second.size() << " " << i->first << " histograms defined";
133  }
134  }
static const char XML_BOOK_DEFINITION_ID[]
static const char XML_BOOK_ONDEMAND_FALSE[]
#define LOG_INFO
Definition: CSCDQM_Logger.h:42
void xercesTerminate()
Definition: Xerces.cc:23
static const char XML_BOOK_ONDEMAND[]
static const char XML_BOOK_DEFINITION_REF[]
static const char XML_BOOK_HISTOGRAM[]
xercesc::DOMDocument DOMDocument
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
static const char XML_BOOK_HISTO_PREFIX[]
static void getNodeProperties(DOMNode *&node, CoHistoProps &hp)
Extract and write single histogram properties from XML node to map.
xercesc::DOMNode DOMNode
xercesc::DOMElement DOMElement
xercesc::DOMNodeList DOMNodeList
d
Definition: ztail.py:151
static const char XML_BOOK_ONDEMAND_TRUE[]
xercesc::XercesDOMParser XercesDOMParser
std::map< std::string, CoHistoProps > CoHisto
static const char XML_BOOK_DEFINITION[]
static const TPRegexp REGEXP_ONDEMAND("^.*%d.*$")
static const char XML_BOOK_HISTO_NAME[]
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
std::map< std::string, std::string > CoHistoProps
xercesc::XMLException XMLException

◆ ParseAxisLabels()

const int cscdqm::Collection::ParseAxisLabels ( const std::string &  s,
std::map< int, std::string > &  labels 
)
staticprivate

Parse Axis label string and return values in vector.

Parameters
ssource string to parse
labelspointer to result vector
Returns
number of labels found

Definition at line 280 of file CSCDQM_Collection.cc.

References label, SummaryClient_cfi::labels, alignCSCRings::s, AlCaHLTBitMon_QueryRunRegistry::string, and createJobs::tmp.

Referenced by book().

280  {
281  std::string tmp = s;
282  std::string::size_type pos = tmp.find('|');
283  char* stopstring = nullptr;
284 
285  while (pos != std::string::npos) {
286  std::string label_pair = tmp.substr(0, pos);
287  tmp.replace(0, pos + 1, "");
288  if (label_pair.find('=') != std::string::npos) {
289  int nbin = strtol(label_pair.substr(0, label_pair.find('=')).c_str(), &stopstring, 10);
290  std::string label = label_pair.substr(label_pair.find('=') + 1, label_pair.length());
291  while (label.find('\'') != std::string::npos) {
292  label.erase(label.find('\''), 1);
293  }
294  labels[nbin] = label;
295  }
296  pos = tmp.find('|');
297  }
298  return labels.size();
299  }
uint16_t size_type
char const * label
tmp
align.sh
Definition: createJobs.py:716

◆ printCollection()

void cscdqm::Collection::printCollection ( ) const

Print collection of available histograms and their parameters.

Returns

Definition at line 642 of file CSCDQM_Collection.cc.

References edmScanValgrind::buffer, collection, and LOG_INFO.

642  {
643  std::ostringstream buffer;
644  for (CoHistoMap::const_iterator hdmi = collection.begin(); hdmi != collection.end(); hdmi++) {
645  buffer << hdmi->first << " [" << std::endl;
646  for (CoHisto::const_iterator hdi = hdmi->second.begin(); hdi != hdmi->second.end(); hdi++) {
647  buffer << " " << hdi->first << " [" << std::endl;
648  for (CoHistoProps::const_iterator hi = hdi->second.begin(); hi != hdi->second.end(); hi++) {
649  buffer << " " << hi->first << " = " << hi->second << std::endl;
650  }
651  buffer << " ]" << std::endl;
652  }
653  buffer << " ]" << std::endl;
654  }
655  LOG_INFO << buffer.str();
656  }
#define LOG_INFO
Definition: CSCDQM_Logger.h:42
Definition: EPCuts.h:4

Member Data Documentation

◆ collection

CoHistoMap cscdqm::Collection::collection
private

◆ config

Configuration* cscdqm::Collection::config
private