CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 <boost/shared_ptr.hpp>
33 
34 #include "CSCDQM_Exception.h"
35 #include "CSCDQM_Logger.h"
36 #include "CSCDQM_Utility.h"
37 #include "CSCDQM_Configuration.h"
38 
39 namespace cscdqm {
40 
44  static const char XML_BOOK_DEFINITION[] = "Definition";
45  static const char XML_BOOK_DEFINITION_ID[] = "id";
46  static const char XML_BOOK_HISTOGRAM[] = "Histogram";
47  static const char XML_BOOK_DEFINITION_REF[] = "ref";
48  static const char XML_BOOK_HISTO_NAME[] = "Name";
49  static const char XML_BOOK_HISTO_PREFIX[] = "Prefix";
50  static const char XML_BOOK_HISTO_TYPE[] = "Type";
51  static const char XML_BOOK_HISTO_TITLE[] = "Title";
52  static const char XML_BOOK_ONDEMAND[] = "OnDemand";
53  static const char XML_BOOK_ONDEMAND_TRUE[] = "1";
54  static const char XML_BOOK_ONDEMAND_FALSE[] = "0";
55  static const char XML_BOOK_NAME_FROM[] = "Name_from";
56  static const char XML_BOOK_NAME_TO[] = "Name_to";
57 
59  static const int DEF_HISTO_COLOR = 48;
60 
62  typedef std::map<std::string, std::string> CoHistoProps;
64  typedef std::map<std::string, CoHistoProps> CoHisto;
66  typedef std::map<std::string, CoHisto> CoHistoMap;
67 
73  class Collection {
74 
75  public:
76  typedef xercesc::DOMDocument DOMDocument;
77  typedef xercesc::DOMElement DOMElement;
78  typedef xercesc::DOMNode DOMNode;
79  typedef xercesc::DOMNodeList DOMNodeList;
80  typedef xercesc::DOMNamedNodeMap DOMNamedNodeMap;
81  typedef xercesc::XMLException XMLException;
82  typedef xercesc::XMLString XMLString;
83  typedef xercesc::XMLPlatformUtils XMLPlatformUtils;
84  typedef xercesc::XercesDOMParser XercesDOMParser;
85  Collection(Configuration* const p_config);
86  void load();
87 
88  void bookEMUHistos() const;
89  void bookFEDHistos(const HwId fedId) const;
90  void bookDDUHistos(const HwId dduId) const;
91  void bookCSCHistos(const HwId crateId, const HwId dmbId) const;
92  void bookCSCHistos(const HistoId hid, const HwId crateId, const HwId dmbId, const HwId addId) const;
93 
94  const bool isOnDemand(const HistoName& name) const;
95 
96  void printCollection() const;
97 
98  private:
99 
100  static const bool checkHistoValue(const CoHistoProps& h, const std::string& name, std::string& value);
101  static const bool checkHistoValue(const CoHistoProps& h, const std::string& name, int& value);
102  static const bool checkHistoValue(const CoHistoProps& h, const std::string name, double& value);
103 
104  static std::string& getHistoValue(const CoHistoProps& h, const std::string& name, std::string& value, const std::string& def_value = "");
105  static int& getHistoValue(const CoHistoProps& h, const std::string& name, int& value, const int& def_value = 0);
106  static double& getHistoValue(const CoHistoProps& h, const std::string name, double& value, const int def_value = 0.0);
107 
108  void book(const HistoDef& h, const CoHistoProps& p, const std::string& folder) const;
109  static const int ParseAxisLabels(const std::string& s, std::map<int, std::string>& labels);
110  static void getNodeProperties(DOMNode*& node, CoHistoProps& hp);
111 
114 
115  };
116 
117 }
118 
119 #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.
tuple node
Definition: Node.py:50
CSCDQM Framework Global Configuration.
unsigned int HistoId
static const char XML_BOOK_HISTO_PREFIX[]
xercesc::XMLPlatformUtils XMLPlatformUtils
susybsm::HSCParticleRefProd hp
Definition: classes.h:27
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
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
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.
std::map< std::string, CoHisto > CoHistoMap
std::map< std::string, std::string > CoHistoProps
xercesc::XMLException XMLException