CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 73 of file CSCDQM_Collection.h.

Member Typedef Documentation

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

Definition at line 76 of file CSCDQM_Collection.h.

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

Definition at line 77 of file CSCDQM_Collection.h.

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

Definition at line 80 of file CSCDQM_Collection.h.

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

Definition at line 78 of file CSCDQM_Collection.h.

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

Definition at line 79 of file CSCDQM_Collection.h.

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

Definition at line 84 of file CSCDQM_Collection.h.

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

Definition at line 81 of file CSCDQM_Collection.h.

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

Definition at line 83 of file CSCDQM_Collection.h.

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

Definition at line 82 of file CSCDQM_Collection.h.

Constructor & Destructor Documentation

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

Constructor.

Parameters
p_configPointer to Global configuration object

Definition at line 27 of file CSCDQM_Collection.cc.

References config.

27  {
28  config = p_config;
29  }
Configuration * config

Member Function Documentation

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 415 of file CSCDQM_Collection.cc.

References checkHistoValue(), config, cscdqm::DEF_HISTO_COLOR, edm::hlt::Exception, cscdqm::Configuration::fnBook, cscdqm::Configuration::fnPutHisto, cscdqm::HistoDef::getFullPath(), getHistoValue(), cscdqm::HistoDef::getName(), cscdqm::MonitorObject::getTH1Lock(), cscdqm::H1D, cscdqm::H2D, cscdqm::H3D, reco_calib_source_client_cfg::labels, CommonMethods::lock(), LOG_INFO, cscdqm::Lock::mutex, mergeVDriftHistosByStation::name, cscdqm::Configuration::needBookMO(), NULL, ParseAxisLabels(), cscdqm::HistoDef::processTitle(), cscdqm::PROFILE, cscdqm::PROFILE2D, alignCSCRings::s, cscdqm::MonitorObject::setAxisTitle(), cscdqm::MonitorObject::SetMaximum(), AlCaHLTBitMon_QueryRunRegistry::string, indexGen::title, cscdqm::Utility::tokenize(), cscdqm::LockType::unlock(), 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().

415  {
416 
417  MonitorObject* me = NULL;
418  std::string name = h.getName(), type, title, s;
419 
421  if (!config->needBookMO(h.getFullPath())) {
422  LOG_INFO << "MOFilter excluded " << name << " from booking";
423  config->fnPutHisto(h, me);
424  return;
425  }
426 
427  int i1, i2, i3;
428  double d1, d2, d3, d4, d5, d6;
429  bool ondemand = (getHistoValue(p, XML_BOOK_ONDEMAND, s, XML_BOOK_ONDEMAND_FALSE) == XML_BOOK_ONDEMAND_TRUE ? true : false);
430 
431  if (!checkHistoValue(p, XML_BOOK_HISTO_TYPE, type)) { throw Exception("Histogram does not have type!"); }
433 
434  if (ondemand) {
435  title = h.processTitle(title);
436  }
437 
438  if (type == "h1") {
439  me = config->fnBook(
440  HistoBookRequest(h, H1D, type, folder, title,
441  getHistoValue(p, "XBins", i1, 1),
442  getHistoValue(p, "XMin", d1, 0),
443  getHistoValue(p, "XMax", d2, 1)));
444  } else
445  if(type == "h2") {
446  me = config->fnBook(
447  HistoBookRequest(h, H2D, type, folder, title,
448  getHistoValue(p, "XBins", i1, 1),
449  getHistoValue(p, "XMin", d1, 0),
450  getHistoValue(p, "XMax", d2, 1),
451  getHistoValue(p, "YBins", i2, 1),
452  getHistoValue(p, "YMin", d3, 0),
453  getHistoValue(p, "YMax", d4, 1)));
454  } else
455  if(type == "h3") {
456  me = config->fnBook(
457  HistoBookRequest(h, H3D, type, folder, title,
458  getHistoValue(p, "XBins", i1, 1),
459  getHistoValue(p, "XMin", d1, 0),
460  getHistoValue(p, "XMax", d2, 1),
461  getHistoValue(p, "YBins", i2, 1),
462  getHistoValue(p, "YMin", d3, 0),
463  getHistoValue(p, "YMax", d4, 1),
464  getHistoValue(p, "ZBins", i3, 1),
465  getHistoValue(p, "ZMin", d5, 0),
466  getHistoValue(p, "ZMax", d6, 1)));
467  } else
468  if(type == "hp") {
469  me = config->fnBook(
470  HistoBookRequest(h, PROFILE, type, folder, title,
471  getHistoValue(p, "XBins", i1, 1),
472  getHistoValue(p, "XMin", d1, 0),
473  getHistoValue(p, "XMax", d2, 1)));
474  /*
475  HistoBookRequest(h, PROFILE, type, folder, 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  */
483  } else
484  if(type == "hp2") {
485  me = config->fnBook(
486  HistoBookRequest(h, PROFILE2D, type, folder, title,
487  getHistoValue(p, "XBins", i1, 1),
488  getHistoValue(p, "XMin", d1, 0),
489  getHistoValue(p, "XMax", d2, 1),
490  getHistoValue(p, "YBins", i2, 1),
491  getHistoValue(p, "YMin", d3, 0),
492  getHistoValue(p, "YMax", d4, 1),
493  getHistoValue(p, "ZBins", i3, 1),
494  getHistoValue(p, "ZMin", d5, 0),
495  getHistoValue(p, "ZMax", d6, 1)));
496  } else {
497  throw Exception("Can not book histogram with type: " + type);
498  }
499 
500  if(me != NULL) {
501 
502  LockType lock(me->mutex);
503  TH1 *th = me->getTH1Lock();
504 
505  if(checkHistoValue(p, "XTitle", s)) {
506  if (ondemand) {
507  s = h.processTitle(s);
508  }
509  me->setAxisTitle(s, 1);
510  }
511 
512  if(checkHistoValue(p, "YTitle", s)) {
513  if (ondemand) {
514  s = h.processTitle(s);
515  }
516  me->setAxisTitle(s, 2);
517  }
518 
519  if(checkHistoValue(p, "ZTitle", s)) {
520  if (ondemand) {
521  s = h.processTitle(s);
522  }
523  me->setAxisTitle(s, 3);
524  }
525 
526  if(checkHistoValue(p, "SetOption", s)) th->SetOption(s.c_str());
527  if(checkHistoValue(p, "SetStats", i1)) th->SetStats(i1);
528  th->SetFillColor(getHistoValue(p, "SetFillColor", i1, DEF_HISTO_COLOR));
529  if(checkHistoValue(p, "SetXLabels", s)) {
530  std::map<int, std::string> labels;
531  ParseAxisLabels(s, labels);
532  for (std::map<int, std::string>::iterator l_itr = labels.begin(); l_itr != labels.end(); ++l_itr) {
533  th->GetXaxis()->SetBinLabel(l_itr->first, l_itr->second.c_str());
534  }
535  }
536  if(checkHistoValue(p, "SetYLabels", s)) {
537  std::map<int, std::string> labels;
538  ParseAxisLabels(s, labels);
539  for (std::map<int, std::string>::iterator l_itr = labels.begin(); l_itr != labels.end(); ++l_itr) {
540  th->GetYaxis()->SetBinLabel(l_itr->first, l_itr->second.c_str());
541  }
542  }
543  if(checkHistoValue(p, "LabelOption", s)) {
544  std::vector<std::string> v;
545  if(2 == Utility::tokenize(s, v, ",")) {
546  th->LabelsOption(v[0].c_str(), v[1].c_str());
547  }
548  }
549  if(checkHistoValue(p, "SetLabelSize", s)) {
550  std::vector<std::string> v;
551  if(2 == Utility::tokenize(s, v, ",")) {
552  th->SetLabelSize((double) atof(v[0].c_str()), v[1].c_str());
553  }
554  }
555  if(checkHistoValue(p, "SetTitleOffset", s)) {
556  std::vector<std::string> v;
557  if(2 == Utility::tokenize(s, v, ",")) {
558  th->SetTitleOffset((double) atof(v[0].c_str()), v[1].c_str());
559  }
560  }
561  if(checkHistoValue(p, "SetMinimum", d1)) th->SetMinimum(d1);
562  if(checkHistoValue(p, "SetMaximum", d1)) me->SetMaximum(d1);
563  if(checkHistoValue(p, "SetNdivisionsX", i1)) {
564  th->SetNdivisions(i1, "X");
565  th->GetXaxis()->CenterLabels(true);
566  }
567  if(checkHistoValue(p, "SetNdivisionsY", i1)) {
568  th->SetNdivisions(i1, "Y");
569  th->GetYaxis()->CenterLabels(true);
570  }
571  if(checkHistoValue(p, "SetTickLengthX", d1)) th->SetTickLength(d1, "X");
572  if(checkHistoValue(p, "SetTickLengthY", d1)) th->SetTickLength(d1, "Y");
573  if(checkHistoValue(p, "SetLabelSizeX", d1)) th->SetLabelSize(d1, "X");
574  if(checkHistoValue(p, "SetLabelSizeY", d1)) th->SetLabelSize(d1, "Y");
575  if(checkHistoValue(p, "SetLabelSizeZ", d1)) th->SetLabelSize(d1, "Z");
576  if(checkHistoValue(p, "SetErrorOption", s)) reinterpret_cast<TProfile*>(th)->SetErrorOption(s.c_str());
577 
578  lock.unlock();
579 
580  }
581 
582  LOG_DEBUG << "[Collection::book] booked " << h.getFullPath() << " (" << me << ")";
583 
585  config->fnPutHisto(h, me);
586 
587  }
type
Definition: HCALResponse.h:21
static const char XML_BOOK_ONDEMAND_FALSE[]
static const char XML_BOOK_HISTO_TYPE[]
#define LOG_INFO
Definition: CSCDQM_Logger.h:43
static const char XML_BOOK_ONDEMAND[]
#define NULL
Definition: scimark2.h:8
Configuration * config
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.
const bool needBookMO(const std::string name) const
Check if MO is not excluded by MO Filter.
static const bool checkHistoValue(const CoHistoProps &h, const std::string &name, std::string &value)
Find string histogram value in map.
boost::function< MonitorObject *(const HistoBookRequest &) > fnBook
static const char XML_BOOK_ONDEMAND_TRUE[]
static const int DEF_HISTO_COLOR
boost::function< void(const HistoDef &histoT, MonitorObject *&) > fnPutHisto
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 int tokenize(const std::string &str, std::vector< std::string > &tokens, const std::string &delimiters=" ")
Break string into tokens.
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 364 of file CSCDQM_Collection.cc.

References book(), checkHistoValue(), collection, config, cscdqm::HistoDef::getHistoIdByName(), getHistoValue(), i, j, gen::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::getHisto().

364  {
365  CoHistoMap::const_iterator i = collection.find("CSC");
366  if (i != collection.end()) {
367  const CoHisto hs = i->second;
368  for (CoHisto::const_iterator j = hs.begin(); j != hs.end(); j++) {
369  std::string s = "";
370  HistoId hid = 0;
371  if (HistoDef::getHistoIdByName(j->first, hid)) {
373  CSCHistoDef hdef(hid, crateId, dmbId);
374  book(hdef, j->second, config->getFOLDER_CSC());
375  } else {
376  int from = 0, to = 0;
377  if (checkHistoValue(j->second, XML_BOOK_NAME_FROM, from) && checkHistoValue(j->second, XML_BOOK_NAME_TO, to)) {
378  for (int k = from; k <= to; k++) {
379  CSCHistoDef hdef(hid, crateId, dmbId, k);
380  book(hdef, j->second, config->getFOLDER_CSC());
381  }
382  }
383  }
384  }
385  }
386  }
387  }
static const bool getHistoIdByName(const std::string &p_name, HistoId &p_id)
Get Histogram ID by name.
int i
Definition: DBlmapReader.cc:9
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[]
unsigned int HistoId
Configuration * config
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.
int j
Definition: DBlmapReader.cc:9
static const bool checkHistoValue(const CoHistoProps &h, const std::string &name, std::string &value)
Find string histogram value in map.
int k[5][pyjets_maxn]
std::map< std::string, CoHistoProps > CoHisto
void book(const HistoDef &h, const CoHistoProps &p, const std::string &folder) const
Book histogram.
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 397 of file CSCDQM_Collection.cc.

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

397  {
398  CoHistoMap::const_iterator i = collection.find("CSC");
399  if (i != collection.end()) {
400  CoHisto::const_iterator j = i->second.find(h::names[hid]);
401  if (j != i->second.end()) {
402  CSCHistoDef hdef(hid, crateId, dmbId, addId);
403  book(hdef, j->second, config->getFOLDER_CSC());
404  }
405  }
406  }
int i
Definition: DBlmapReader.cc:9
static const HistoName names[]
Configuration * config
int j
Definition: DBlmapReader.cc:9
void book(const HistoDef &h, const CoHistoProps &p, const std::string &folder) const
Book histogram.
void cscdqm::Collection::bookDDUHistos ( const HwId  dduId) const

Book DDU histograms.

Parameters
dduIdDDU Id
Returns

Definition at line 341 of file CSCDQM_Collection.cc.

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

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

341  {
342  CoHistoMap::const_iterator i = collection.find("DDU");
343  if (i != collection.end()) {
344  const CoHisto hs = i->second;
345  for (CoHisto::const_iterator j = hs.begin(); j != hs.end(); j++) {
346  std::string s = "";
348  HistoId hid = 0;
349  if (HistoDef::getHistoIdByName(j->first, hid)) {
350  DDUHistoDef hdef(hid, dduId);
351  book(hdef, j->second, config->getFOLDER_DDU());
352  }
353  }
354  }
355  }
356  }
static const bool getHistoIdByName(const std::string &p_name, HistoId &p_id)
Get Histogram ID by name.
int i
Definition: DBlmapReader.cc:9
static const char XML_BOOK_ONDEMAND_FALSE[]
static const char XML_BOOK_ONDEMAND[]
unsigned int HistoId
Configuration * config
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.
int j
Definition: DBlmapReader.cc:9
std::map< std::string, CoHistoProps > CoHisto
void book(const HistoDef &h, const CoHistoProps &p, const std::string &folder) const
Book histogram.
void cscdqm::Collection::bookEMUHistos ( ) const

Book EMU histograms.

Returns

Definition at line 297 of file CSCDQM_Collection.cc.

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

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

297  {
298  CoHistoMap::const_iterator i = collection.find("EMU");
299  if (i != collection.end()) {
300  const CoHisto hs = i->second;
301  for (CoHisto::const_iterator j = hs.begin(); j != hs.end(); j++) {
302  std::string s = "";
304  HistoId hid = 0;
305  if (HistoDef::getHistoIdByName(j->first, hid)) {
306  EMUHistoDef hdef(hid);
307  book(hdef, j->second, config->getFOLDER_EMU());
308  }
309  }
310  }
311  }
312  }
static const bool getHistoIdByName(const std::string &p_name, HistoId &p_id)
Get Histogram ID by name.
int i
Definition: DBlmapReader.cc:9
static const char XML_BOOK_ONDEMAND_FALSE[]
static const char XML_BOOK_ONDEMAND[]
unsigned int HistoId
Configuration * config
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.
int j
Definition: DBlmapReader.cc:9
std::map< std::string, CoHistoProps > CoHisto
void book(const HistoDef &h, const CoHistoProps &p, const std::string &folder) const
Book histogram.
void cscdqm::Collection::bookFEDHistos ( const HwId  fedId) const

Book FED histograms.

Parameters
fedIdFED Id
Returns

Definition at line 319 of file CSCDQM_Collection.cc.

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

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

319  {
320  CoHistoMap::const_iterator i = collection.find("FED");
321  if (i != collection.end()) {
322  const CoHisto hs = i->second;
323  for (CoHisto::const_iterator j = hs.begin(); j != hs.end(); j++) {
324  std::string s = "";
326  HistoId hid = 0;
327  if (HistoDef::getHistoIdByName(j->first, hid)) {
328  FEDHistoDef hdef(hid, fedId);
329  book(hdef, j->second, config->getFOLDER_FED());
330  }
331  }
332  }
333  }
334  }
static const bool getHistoIdByName(const std::string &p_name, HistoId &p_id)
Get Histogram ID by name.
int i
Definition: DBlmapReader.cc:9
static const char XML_BOOK_ONDEMAND_FALSE[]
static const char XML_BOOK_ONDEMAND[]
unsigned int HistoId
Configuration * config
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.
int j
Definition: DBlmapReader.cc:9
std::map< std::string, CoHistoProps > CoHisto
void book(const HistoDef &h, const CoHistoProps &p, const std::string &folder) const
Book histogram.
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 175 of file CSCDQM_Collection.cc.

References i.

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

175  {
176  CoHistoProps::const_iterator i = h.find(name);
177  if(i == h.end()) {
178  return false;
179  }
180  value = i->second;
181  return true;
182  }
int i
Definition: DBlmapReader.cc:9
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
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 191 of file CSCDQM_Collection.cc.

References i, and relativeConstraints::value.

191  {
192  CoHistoProps::const_iterator i = h.find(name);
193  if(i == h.end()) {
194  return false;
195  }
196  if(EOF == std::sscanf(i->second.c_str(), "%d", &value)) {
197  return false;
198  }
199  return true;
200  }
int i
Definition: DBlmapReader.cc:9
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
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 210 of file CSCDQM_Collection.cc.

References i, and relativeConstraints::value.

210  {
211  CoHistoProps::const_iterator i = h.find(name);
212  if(i == h.end()) {
213  return false;
214  }
215  if(EOF == std::sscanf(i->second.c_str(), "%lf", &value)) {
216  return false;
217  }
218  return true;
219  }
int i
Definition: DBlmapReader.cc:9
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
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 229 of file CSCDQM_Collection.cc.

References checkHistoValue(), and relativeConstraints::value.

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

229  {
230  if (!checkHistoValue(h, name, value)) {
231  value = def_value;
232  }
233  return value;
234  }
static const bool checkHistoValue(const CoHistoProps &h, const std::string &name, std::string &value)
Find string histogram value in map.
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
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 244 of file CSCDQM_Collection.cc.

References checkHistoValue(), and relativeConstraints::value.

244  {
245  if (!checkHistoValue(h, name, value)) {
246  value = def_value;
247  }
248  return value;
249  }
static const bool checkHistoValue(const CoHistoProps &h, const std::string &name, std::string &value)
Find string histogram value in map.
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
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 259 of file CSCDQM_Collection.cc.

References checkHistoValue(), and relativeConstraints::value.

259  {
260  if (!checkHistoValue(h, name, value)) {
261  value = def_value;
262  }
263  return value;
264  }
static const bool checkHistoValue(const CoHistoProps &h, const std::string &name, std::string &value)
Find string histogram value in map.
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
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 148 of file CSCDQM_Collection.cc.

References asciidump::attributes, i, j, mergeVDriftHistosByStation::name, AlCaHLTBitMon_QueryRunRegistry::string, and relativeConstraints::value.

Referenced by load().

148  {
149  DOMNodeList *props = node->getChildNodes();
150  for(uint32_t j = 0; j < props->getLength(); j++) {
151  DOMNode* node = props->item(j);
152  if (node->getNodeType() != DOMNode::ELEMENT_NODE) { continue; }
153  std::string name = XMLString::transcode(node->getNodeName());
154  std::string value = XMLString::transcode(node->getTextContent());
155  DOMNamedNodeMap* attributes = node->getAttributes();
156  if (attributes) {
157  for (uint32_t i = 0; i < attributes->getLength(); i++) {
158  DOMNode* attribute = attributes->item(i);
159  std::string aname = XMLString::transcode(attribute->getNodeName());
160  std::string avalue = XMLString::transcode(attribute->getNodeValue());
161  p[name + "_" + aname] = avalue;
162  }
163  }
164  p[name] = value;
165  }
166  }
int i
Definition: DBlmapReader.cc:9
tuple node
Definition: Node.py:50
list attributes
Definition: asciidump.py:415
xercesc::DOMNode DOMNode
int j
Definition: DBlmapReader.cc:9
xercesc::DOMNodeList DOMNodeList
xercesc::DOMNamedNodeMap DOMNamedNodeMap
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 594 of file CSCDQM_Collection.cc.

References collection, getHistoValue(), i, j, 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().

594  {
595  CoHistoMap::const_iterator i = collection.find("CSC");
596  if (i != collection.end()) {
597  CoHisto hs = i->second;
598  CoHisto::const_iterator j = hs.find(name);
599  if (j != hs.end()) {
600  std::string s;
602  }
603  }
604  return false;
605  }
int i
Definition: DBlmapReader.cc:9
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.
int j
Definition: DBlmapReader.cc:9
static const char XML_BOOK_ONDEMAND_TRUE[]
std::map< std::string, CoHistoProps > CoHisto
void cscdqm::Collection::load ( )

Load XML file and fill definition map(s)

Returns

Load histogram definition

Load histogram

Definition at line 36 of file CSCDQM_Collection.cc.

References collection, config, asciidump::doc, reco::dp, alignCSCRings::e, edm::hlt::Exception, getNodeProperties(), h, i, LOG_INFO, python.rootplot.argparse::message, mergeVDriftHistosByStation::name, python.Node::node, geometryXMLtoCSV::parser, prof2calltree::prefix, cscdqm::Utility::regexMatch(), cscdqm::REGEXP_ONDEMAND(), AlCaHLTBitMon_QueryRunRegistry::string, 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().

36  {
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 {
45 
46  XMLPlatformUtils::Initialize();
47 
48  {
49 
51 
52  parser.setValidationScheme(XercesDOMParser::Val_Always);
53  parser.setDoNamespaces(true);
54  parser.setDoSchema(true);
55  parser.setExitOnFirstFatalError(true);
56  parser.setValidationConstraintFatal(true);
57  XMLFileErrorHandler eh;
58  parser.setErrorHandler(&eh);
59 
60  parser.parse(config->getBOOKING_XML_FILE().c_str());
61  DOMDocument *doc = parser.getDocument();
62  DOMNode *docNode = (DOMNode*) doc->getDocumentElement();
63 
64  DOMNodeList *itemList = docNode->getChildNodes();
65 
66  CoHisto definitions;
67  for (uint32_t i = 0; i < itemList->getLength(); i++) {
68 
69  DOMNode* node = itemList->item(i);
70  if (node->getNodeType() != DOMNode::ELEMENT_NODE) { continue; }
71 
72  std::string nodeName = XMLString::transcode(node->getNodeName());
73 
77  if (nodeName.compare(XML_BOOK_DEFINITION) == 0) {
78 
80  getNodeProperties(node, dp);
81 
82  DOMElement* el = dynamic_cast<DOMElement*>(node);
83  std::string id(XMLString::transcode(el->getAttribute(XMLString::transcode(XML_BOOK_DEFINITION_ID))));
84  definitions.insert(make_pair(id, dp));
85 
86  } else
87 
91  if (nodeName.compare(XML_BOOK_HISTOGRAM) == 0) {
92 
93  CoHistoProps hp;
94 
95  DOMElement* el = dynamic_cast<DOMElement*>(node);
96  if (el->hasAttribute(XMLString::transcode(XML_BOOK_DEFINITION_REF))) {
97  std::string id(XMLString::transcode(el->getAttribute(XMLString::transcode(XML_BOOK_DEFINITION_REF))));
98  CoHistoProps d = definitions[id];
99  for (CoHistoProps::iterator it = d.begin(); it != d.end(); it++) {
100  hp[it->first] = it->second;
101  }
102  }
103 
104  getNodeProperties(node, hp);
105 
108 
109  // Check if this histogram is an ON DEMAND histogram?
111 
112  LOG_DEBUG << "[Collection::load] loading " << prefix << "::" << name << " XML_BOOK_ONDEMAND = " << hp[XML_BOOK_ONDEMAND];
113 
114  CoHistoMap::iterator it = collection.find(prefix);
115  if (it == collection.end()) {
116  CoHisto h;
117  h[name] = hp;
118  collection[prefix] = h;
119  } else {
120  it->second.insert(make_pair(name, hp));
121  }
122 
123  }
124  }
125 
126  }
127 
128  XMLPlatformUtils::Terminate();
129 
130  } catch (XMLException& e) {
131  char* message = XMLString::transcode(e.getMessage());
132  throw Exception(message);
133  }
134 
135  for (CoHistoMap::const_iterator i = collection.begin(); i != collection.end(); i++) {
136  LOG_INFO << i->second.size() << " " << i->first << " histograms defined";
137  }
138 
139  }
int i
Definition: DBlmapReader.cc:9
static const char XML_BOOK_DEFINITION_ID[]
static const char XML_BOOK_ONDEMAND_FALSE[]
#define LOG_INFO
Definition: CSCDQM_Logger.h:43
static const char XML_BOOK_ONDEMAND[]
static const char XML_BOOK_DEFINITION_REF[]
static const char XML_BOOK_HISTOGRAM[]
xercesc::DOMDocument DOMDocument
static bool regexMatch(const std::string &expression, const std::string &message)
Match RegExp expression string against string message and return result.
tuple node
Definition: Node.py:50
static const char XML_BOOK_HISTO_PREFIX[]
Configuration * config
static void getNodeProperties(DOMNode *&node, CoHistoProps &hp)
Extract and write single histogram properties from XML node to map.
xercesc::DOMNode DOMNode
xercesc::DOMElement DOMElement
tuple doc
Definition: asciidump.py:381
xercesc::DOMNodeList DOMNodeList
static const char XML_BOOK_ONDEMAND_TRUE[]
xercesc::XercesDOMParser XercesDOMParser
std::map< std::string, CoHistoProps > CoHisto
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
auto dp
Definition: deltaR.h:24
static const char XML_BOOK_DEFINITION[]
static const TPRegexp REGEXP_ONDEMAND("^.*%d.*$")
static const char XML_BOOK_HISTO_NAME[]
std::map< std::string, std::string > CoHistoProps
xercesc::XMLException XMLException
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 272 of file CSCDQM_Collection.cc.

References diffTwoXMLs::label, NULL, pos, alignCSCRings::s, AlCaHLTBitMon_QueryRunRegistry::string, and tmp.

Referenced by book().

272  {
273  std::string tmp = s;
274  std::string::size_type pos = tmp.find("|");
275  char* stopstring = NULL;
276 
277  while (pos != std::string::npos) {
278  std::string label_pair = tmp.substr(0, pos);
279  tmp.replace(0, pos + 1, "");
280  if (label_pair.find("=") != std::string::npos) {
281  int nbin = strtol(label_pair.substr(0, label_pair.find("=")).c_str(), &stopstring, 10);
282  std::string label = label_pair.substr(label_pair.find("=") + 1, label_pair.length());
283  while (label.find("\'") != std::string::npos) {
284  label.erase(label.find("\'"), 1);
285  }
286  labels[nbin] = label;
287  }
288  pos = tmp.find("|");
289  }
290  return labels.size();
291  }
#define NULL
Definition: scimark2.h:8
uint16_t size_type
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
void cscdqm::Collection::printCollection ( ) const

Print collection of available histograms and their parameters.

Returns

Definition at line 611 of file CSCDQM_Collection.cc.

References collection, and LOG_INFO.

611  {
612 
613  std::ostringstream buffer;
614  for(CoHistoMap::const_iterator hdmi = collection.begin(); hdmi != collection.end(); hdmi++) {
615  buffer << hdmi->first << " [" << std::endl;
616  for(CoHisto::const_iterator hdi = hdmi->second.begin(); hdi != hdmi->second.end(); hdi++) {
617  buffer << " " << hdi->first << " [" << std::endl;
618  for(CoHistoProps::const_iterator hi = hdi->second.begin(); hi != hdi->second.end(); hi++) {
619  buffer << " " << hi->first << " = " << hi->second << std::endl;
620  }
621  buffer << " ]" << std::endl;
622  }
623  buffer << " ]" << std::endl;
624  }
625  LOG_INFO << buffer.str();
626  }
#define LOG_INFO
Definition: CSCDQM_Logger.h:43

Member Data Documentation

CoHistoMap cscdqm::Collection::collection
private
Configuration* cscdqm::Collection::config
private