CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/DQM/CSCMonitorModule/interface/CSCDQM_Collection.h

Go to the documentation of this file.
00001 /*
00002  * =====================================================================================
00003  *
00004  *       Filename:  CSCDQM_Collection.h
00005  *
00006  *    Description:  Histogram Booking Collection Management Class
00007  *
00008  *        Version:  1.0
00009  *        Created:  10/30/2008 04:40:38 PM
00010  *       Revision:  none
00011  *       Compiler:  gcc
00012  *
00013  *         Author:  Valdas Rapsevicius (VR), valdas.rapsevicius@cern.ch
00014  *        Company:  CERN, CH
00015  *
00016  * =====================================================================================
00017  */
00018 
00019 #ifndef CSCDQM_Collection_H
00020 #define CSCDQM_Collection_H
00021 
00022 #include <string>
00023 #include <map>
00024 #include <vector>
00025 #include <sstream>
00026 #include <TProfile.h>
00027 
00028 #include <xercesc/parsers/XercesDOMParser.hpp>
00029 #include <xercesc/dom/DOMNodeList.hpp>
00030 #include <xercesc/dom/DOMElement.hpp>
00031 
00032 #include <boost/shared_ptr.hpp>
00033 
00034 #include "DQM/CSCMonitorModule/interface/CSCDQM_Exception.h"
00035 #include "DQM/CSCMonitorModule/interface/CSCDQM_Logger.h"
00036 #include "DQM/CSCMonitorModule/interface/CSCDQM_Utility.h"
00037 #include "DQM/CSCMonitorModule/interface/CSCDQM_Configuration.h"
00038 
00039 namespace cscdqm {
00040 
00044   static const char XML_BOOK_DEFINITION[]     =  "Definition";
00045   static const char XML_BOOK_DEFINITION_ID[]  =  "id";
00046   static const char XML_BOOK_HISTOGRAM[]      =  "Histogram";
00047   static const char XML_BOOK_DEFINITION_REF[] =  "ref";
00048   static const char XML_BOOK_HISTO_NAME[]     =  "Name";
00049   static const char XML_BOOK_HISTO_PREFIX[]   =  "Prefix";
00050   static const char XML_BOOK_HISTO_TYPE[]     =  "Type";
00051   static const char XML_BOOK_HISTO_TITLE[]    =  "Title";
00052   static const char XML_BOOK_ONDEMAND[]       =  "OnDemand";
00053   static const char XML_BOOK_ONDEMAND_TRUE[]  =  "1";
00054   static const char XML_BOOK_ONDEMAND_FALSE[] =  "0";
00055   static const char XML_BOOK_NAME_FROM[]      =  "Name_from";
00056   static const char XML_BOOK_NAME_TO[]        =  "Name_to";
00057 
00059   static const int  DEF_HISTO_COLOR           =  48;
00060 
00062   typedef std::map<std::string, std::string>     CoHistoProps;
00064   typedef std::map<std::string, CoHistoProps>    CoHisto;
00066   typedef std::map<std::string, CoHisto>         CoHistoMap;
00067   
00073   class Collection {
00074 
00075     public:
00076       typedef xercesc::DOMDocument DOMDocument;
00077       typedef xercesc::DOMElement DOMElement;
00078       typedef xercesc::DOMNode DOMNode;
00079       typedef xercesc::DOMNodeList DOMNodeList;
00080       typedef xercesc::DOMNamedNodeMap DOMNamedNodeMap;
00081       typedef xercesc::XMLException XMLException;
00082       typedef xercesc::XMLString XMLString;
00083       typedef xercesc::XMLPlatformUtils XMLPlatformUtils;
00084       typedef xercesc::XercesDOMParser XercesDOMParser;
00085       Collection(Configuration* const p_config);
00086       void load();
00087 
00088       void bookEMUHistos() const;
00089       void bookDDUHistos(const HwId dduId) const;
00090       void bookCSCHistos(const HwId crateId, const HwId dmbId) const;
00091       void bookCSCHistos(const HistoId hid, const HwId crateId, const HwId dmbId, const HwId addId) const;
00092 
00093       const bool isOnDemand(const HistoName& name) const;
00094 
00095       void printCollection() const;
00096 
00097     private:
00098       
00099       static const bool checkHistoValue(const CoHistoProps& h, const std::string& name, std::string& value);
00100       static const bool checkHistoValue(const CoHistoProps& h, const std::string& name, int& value);
00101       static const bool checkHistoValue(const CoHistoProps& h, const std::string name, double& value);
00102 
00103       static std::string& getHistoValue(const CoHistoProps& h, const std::string& name, std::string& value, const std::string& def_value = "");
00104       static int&         getHistoValue(const CoHistoProps& h, const std::string& name, int& value, const int& def_value = 0);
00105       static double&      getHistoValue(const CoHistoProps& h, const std::string name, double& value, const int def_value = 0.0);
00106       
00107       void book(const HistoDef& h, const CoHistoProps& p, const std::string& folder) const;
00108       static const int ParseAxisLabels(const std::string& s, std::map<int, std::string>& labels);
00109       static void getNodeProperties(DOMNode*& node, CoHistoProps& hp);
00110       
00111       Configuration*         config;
00112       CoHistoMap             collection;
00113 
00114   };
00115 
00116 }
00117 
00118 #endif