CMS 3D CMS Logo

CSCDQM_Collection.h
Go to the documentation of this file.
1 /*
2  * =====================================================================================
3  *
4  * Filename: CSCDQM_Collection.h
5  *
6  * Description: Histogram Booking Collection Management Class
7  *
8  * Version: 1.0
9  * Created: 10/30/2008 04:40:38 PM
10  * Revision: none
11  * Compiler: gcc
12  *
13  * Author: Valdas Rapsevicius (VR), valdas.rapsevicius@cern.ch
14  * Company: CERN, CH
15  *
16  * =====================================================================================
17  */
18 
19 #ifndef CSCDQM_Collection_H
20 #define CSCDQM_Collection_H
21 
22 #include <string>
23 #include <map>
24 #include <vector>
25 #include <sstream>
26 #include <TProfile.h>
27 
28 #include <xercesc/parsers/XercesDOMParser.hpp>
29 #include <xercesc/dom/DOMNodeList.hpp>
30 #include <xercesc/dom/DOMElement.hpp>
31 
32 #include "CSCDQM_Exception.h"
33 #include "CSCDQM_Logger.h"
34 #include "CSCDQM_Utility.h"
35 #include "CSCDQM_Configuration.h"
36 
37 namespace cscdqm {
38 
42  static const char XML_BOOK_DEFINITION[] = "Definition";
43  static const char XML_BOOK_DEFINITION_ID[] = "id";
44  static const char XML_BOOK_HISTOGRAM[] = "Histogram";
45  static const char XML_BOOK_DEFINITION_REF[] = "ref";
46  static const char XML_BOOK_HISTO_NAME[] = "Name";
47  static const char XML_BOOK_HISTO_PREFIX[] = "Prefix";
48  static const char XML_BOOK_HISTO_TYPE[] = "Type";
49  static const char XML_BOOK_HISTO_TITLE[] = "Title";
50  static const char XML_BOOK_ONDEMAND[] = "OnDemand";
51  static const char XML_BOOK_ONDEMAND_TRUE[] = "1";
52  static const char XML_BOOK_ONDEMAND_FALSE[] = "0";
53  static const char XML_BOOK_NAME_FROM[] = "Name_from";
54  static const char XML_BOOK_NAME_TO[] = "Name_to";
55 
57  static const int DEF_HISTO_COLOR = 48;
58 
60  typedef std::map<std::string, std::string> CoHistoProps;
62  typedef std::map<std::string, CoHistoProps> CoHisto;
64  typedef std::map<std::string, CoHisto> CoHistoMap;
65 
71  class Collection {
72  public:
73  typedef xercesc::DOMDocument DOMDocument;
74  typedef xercesc::DOMElement DOMElement;
75  typedef xercesc::DOMNode DOMNode;
76  typedef xercesc::DOMNodeList DOMNodeList;
77  typedef xercesc::DOMNamedNodeMap DOMNamedNodeMap;
78  typedef xercesc::XMLException XMLException;
79  typedef xercesc::XMLString XMLString;
80  typedef xercesc::XMLPlatformUtils XMLPlatformUtils;
81  typedef xercesc::XercesDOMParser XercesDOMParser;
82  Collection(Configuration* const p_config);
83  void load();
84 
85  void bookEMUHistos() const;
86  void bookFEDHistos(const HwId fedId) const;
87  void bookDDUHistos(const HwId dduId) const;
88  void bookCSCHistos(const HwId crateId, const HwId dmbId) const;
89  void bookCSCHistos(const HistoId hid, const HwId crateId, const HwId dmbId, const HwId addId) const;
90 
91  const bool isOnDemand(const HistoName& name) const;
92 
93  void printCollection() const;
94 
95  private:
96  static const bool checkHistoValue(const CoHistoProps& h, const std::string& name, std::string& value);
97  static const bool checkHistoValue(const CoHistoProps& h, const std::string& name, int& value);
98  static const bool checkHistoValue(const CoHistoProps& h, const std::string name, double& value);
99 
100  static std::string& getHistoValue(const CoHistoProps& h,
101  const std::string& name,
103  const std::string& def_value = "");
104  static int& getHistoValue(const CoHistoProps& h, const std::string& name, int& value, const int& def_value = 0);
105  static double& getHistoValue(const CoHistoProps& h,
106  const std::string name,
107  double& value,
108  const int def_value = 0.0);
109 
110  void book(const HistoDef& h, const CoHistoProps& p, const std::string& folder) const;
111  static const int ParseAxisLabels(const std::string& s, std::map<int, std::string>& labels);
112  static void getNodeProperties(DOMNode*& node, CoHistoProps& hp);
113 
116  };
117 
118 } // namespace cscdqm
119 
120 #endif
SummaryClient_cfi.labels
labels
Definition: SummaryClient_cfi.py:61
CSCDQM_Logger.h
cscdqm::CoHisto
std::map< std::string, CoHistoProps > CoHisto
Definition: CSCDQM_Collection.h:62
cscdqm::HistoDef
Abstract Base Histogram Definition.
Definition: CSCDQM_HistoDef.h:62
cscdqm::HistoId
unsigned int HistoId
Definition: CSCDQM_HistoDef.h:35
cscdqm::Collection::DOMElement
xercesc::DOMElement DOMElement
Definition: CSCDQM_Collection.h:74
cscdqm::Collection::bookCSCHistos
void bookCSCHistos(const HwId crateId, const HwId dmbId) const
Book Chamber Histograms.
Definition: CSCDQM_Collection.cc:372
cscdqm::XML_BOOK_HISTO_TYPE
static const char XML_BOOK_HISTO_TYPE[]
Definition: CSCDQM_Collection.h:48
printsummarytable.folder
folder
Definition: printsummarytable.py:7
cscdqm::Collection::XMLException
xercesc::XMLException XMLException
Definition: CSCDQM_Collection.h:78
cscdqm::Collection::XercesDOMParser
xercesc::XercesDOMParser XercesDOMParser
Definition: CSCDQM_Collection.h:81
cscdqm::XML_BOOK_HISTO_TITLE
static const char XML_BOOK_HISTO_TITLE[]
Definition: CSCDQM_Collection.h:49
cscdqm::XML_BOOK_NAME_TO
static const char XML_BOOK_NAME_TO[]
Definition: CSCDQM_Collection.h:54
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
cscdqm::XML_BOOK_DEFINITION_ID
static const char XML_BOOK_DEFINITION_ID[]
Definition: CSCDQM_Collection.h:43
cscdqm::Collection
Manage collection of histograms, load histogram definitions from XML file and book histograms by call...
Definition: CSCDQM_Collection.h:71
CSCDQM_Utility.h
cscdqm::XML_BOOK_DEFINITION_REF
static const char XML_BOOK_DEFINITION_REF[]
Definition: CSCDQM_Collection.h:45
cscdqm::XML_BOOK_ONDEMAND
static const char XML_BOOK_ONDEMAND[]
Definition: CSCDQM_Collection.h:50
cscdqm::Collection::getHistoValue
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.
Definition: CSCDQM_Collection.cc:234
cscdqm::Collection::Collection
Collection(Configuration *const p_config)
Constructor.
Definition: CSCDQM_Collection.cc:31
cscdqm::Collection::DOMNodeList
xercesc::DOMNodeList DOMNodeList
Definition: CSCDQM_Collection.h:76
cscdqm::Collection::DOMDocument
xercesc::DOMDocument DOMDocument
Definition: CSCDQM_Collection.h:73
cscdqm::Collection::DOMNamedNodeMap
xercesc::DOMNamedNodeMap DOMNamedNodeMap
Definition: CSCDQM_Collection.h:77
alignCSCRings.s
s
Definition: alignCSCRings.py:92
cscdqm::DEF_HISTO_COLOR
static const int DEF_HISTO_COLOR
Definition: CSCDQM_Collection.h:57
cscdqm::Collection::DOMNode
xercesc::DOMNode DOMNode
Definition: CSCDQM_Collection.h:75
trackingPlots.hp
hp
Definition: trackingPlots.py:1248
CSCDQM_Configuration.h
cscdqm::XML_BOOK_ONDEMAND_FALSE
static const char XML_BOOK_ONDEMAND_FALSE[]
Definition: CSCDQM_Collection.h:52
cscdqm::HwId
unsigned int HwId
Definition: CSCDQM_HistoDef.h:38
CSCDQM_Exception.h
cscdqm::Collection::checkHistoValue
static const bool checkHistoValue(const CoHistoProps &h, const std::string &name, std::string &value)
Find string histogram value in map.
Definition: CSCDQM_Collection.cc:180
h
cscdqm::XML_BOOK_NAME_FROM
static const char XML_BOOK_NAME_FROM[]
Definition: CSCDQM_Collection.h:53
cscdqm::Collection::book
void book(const HistoDef &h, const CoHistoProps &p, const std::string &folder) const
Book histogram.
Definition: CSCDQM_Collection.cc:424
cscdqm::Collection::config
Configuration * config
Definition: CSCDQM_Collection.h:114
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cscdqm::Collection::ParseAxisLabels
static const int ParseAxisLabels(const std::string &s, std::map< int, std::string > &labels)
Parse Axis label string and return values in vector.
Definition: CSCDQM_Collection.cc:280
cscdqm::Collection::bookDDUHistos
void bookDDUHistos(const HwId dduId) const
Book DDU histograms.
Definition: CSCDQM_Collection.cc:349
cscdqm::Collection::XMLString
xercesc::XMLString XMLString
Definition: CSCDQM_Collection.h:79
cscdqm
Definition: CSCDQM_DCSBase.h:29
cscdqm::XML_BOOK_ONDEMAND_TRUE
static const char XML_BOOK_ONDEMAND_TRUE[]
Definition: CSCDQM_Collection.h:51
value
Definition: value.py:1
cscdqm::HistoName
std::string HistoName
Definition: CSCDQM_HistoDef.h:32
cscdqm::Collection::getNodeProperties
static void getNodeProperties(DOMNode *&node, CoHistoProps &hp)
Extract and write single histogram properties from XML node to map.
Definition: CSCDQM_Collection.cc:144
cscdqm::Collection::bookFEDHistos
void bookFEDHistos(const HwId fedId) const
Book FED histograms.
Definition: CSCDQM_Collection.cc:327
cscdqm::Collection::load
void load()
Load XML file and fill definition map(s)
Definition: CSCDQM_Collection.cc:37
l1tstage2_dqm_sourceclient-live_cfg.fedId
fedId
Definition: l1tstage2_dqm_sourceclient-live_cfg.py:88
cscdqm::Configuration
CSCDQM Framework Global Configuration.
Definition: CSCDQM_Configuration.h:231
cscdqm::Collection::isOnDemand
const bool isOnDemand(const HistoName &name) const
Check if the histogram is on demand (by histogram name)
Definition: CSCDQM_Collection.cc:625
cscdqm::Collection::XMLPlatformUtils
xercesc::XMLPlatformUtils XMLPlatformUtils
Definition: CSCDQM_Collection.h:80
cscdqm::XML_BOOK_HISTO_PREFIX
static const char XML_BOOK_HISTO_PREFIX[]
Definition: CSCDQM_Collection.h:47
cscdqm::Collection::bookEMUHistos
void bookEMUHistos() const
Book EMU histograms.
Definition: CSCDQM_Collection.cc:305
cscdqm::CoHistoMap
std::map< std::string, CoHisto > CoHistoMap
Definition: CSCDQM_Collection.h:64
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
cscdqm::XML_BOOK_HISTO_NAME
static const char XML_BOOK_HISTO_NAME[]
Definition: CSCDQM_Collection.h:46
cscdqm::Collection::printCollection
void printCollection() const
Print collection of available histograms and their parameters.
Definition: CSCDQM_Collection.cc:642
cscdqm::XML_BOOK_DEFINITION
static const char XML_BOOK_DEFINITION[]
Definition: CSCDQM_Collection.h:42
cscdqm::XML_BOOK_HISTOGRAM
static const char XML_BOOK_HISTOGRAM[]
Definition: CSCDQM_Collection.h:44
cscdqm::CoHistoProps
std::map< std::string, std::string > CoHistoProps
Definition: CSCDQM_Collection.h:60
cscdqm::Collection::collection
CoHistoMap collection
Definition: CSCDQM_Collection.h:115