CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
static const char XML_BOOK_DEFINITION_ID[]
static const char XML_BOOK_ONDEMAND_FALSE[]
unsigned int HwId
static const char XML_BOOK_HISTO_TYPE[]
static const char XML_BOOK_NAME_FROM[]
void bookEMUHistos() const
Book EMU histograms.
Abstract Base Histogram Definition.
static const char XML_BOOK_NAME_TO[]
static const char XML_BOOK_ONDEMAND[]
static const char XML_BOOK_DEFINITION_REF[]
static const char XML_BOOK_HISTOGRAM[]
xercesc::DOMDocument DOMDocument
const bool isOnDemand(const HistoName &name) const
Check if the histogram is on demand (by histogram name)
Collection(Configuration *const p_config)
Constructor.
CSCDQM Framework Global Configuration.
unsigned int HistoId
static const char XML_BOOK_HISTO_PREFIX[]
xercesc::XMLPlatformUtils XMLPlatformUtils
Configuration * config
static void getNodeProperties(DOMNode *&node, CoHistoProps &hp)
Extract and write single histogram properties from XML node to map.
xercesc::DOMNode DOMNode
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.
xercesc::DOMElement DOMElement
Manage collection of histograms, load histogram definitions from XML file and book histograms by call...
void load()
Load XML file and fill definition map(s)
static const bool checkHistoValue(const CoHistoProps &h, const std::string &name, std::string &value)
Find string histogram value in map.
xercesc::DOMNodeList DOMNodeList
static const char XML_BOOK_ONDEMAND_TRUE[]
xercesc::XercesDOMParser XercesDOMParser
void bookFEDHistos(const HwId fedId) const
Book FED histograms.
std::map< std::string, CoHistoProps > CoHisto
static const int DEF_HISTO_COLOR
static const char XML_BOOK_DEFINITION[]
void bookDDUHistos(const HwId dduId) const
Book DDU histograms.
void book(const HistoDef &h, const CoHistoProps &p, const std::string &folder) const
Book histogram.
xercesc::DOMNamedNodeMap DOMNamedNodeMap
std::string HistoName
xercesc::XMLString XMLString
void bookCSCHistos(const HwId crateId, const HwId dmbId) const
Book Chamber Histograms.
static const char XML_BOOK_HISTO_NAME[]
void printCollection() const
Print collection of available histograms and their parameters.
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.
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, CoHisto > CoHistoMap
std::map< std::string, std::string > CoHistoProps
xercesc::XMLException XMLException