File indexing completed on 2024-04-06 12:06:55
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #ifndef CSCDQM_Collection_H
0020 #define CSCDQM_Collection_H
0021
0022 #include <string>
0023 #include <map>
0024 #include <vector>
0025 #include <sstream>
0026 #include <TProfile.h>
0027
0028 #include <xercesc/parsers/XercesDOMParser.hpp>
0029 #include <xercesc/dom/DOMNodeList.hpp>
0030 #include <xercesc/dom/DOMElement.hpp>
0031
0032 #include "CSCDQM_Exception.h"
0033 #include "CSCDQM_Logger.h"
0034 #include "CSCDQM_Utility.h"
0035 #include "CSCDQM_Configuration.h"
0036
0037 namespace cscdqm {
0038
0039
0040
0041
0042 static const char XML_BOOK_DEFINITION[] = "Definition";
0043 static const char XML_BOOK_DEFINITION_ID[] = "id";
0044 static const char XML_BOOK_HISTOGRAM[] = "Histogram";
0045 static const char XML_BOOK_DEFINITION_REF[] = "ref";
0046 static const char XML_BOOK_HISTO_NAME[] = "Name";
0047 static const char XML_BOOK_HISTO_PREFIX[] = "Prefix";
0048 static const char XML_BOOK_HISTO_TYPE[] = "Type";
0049 static const char XML_BOOK_HISTO_TITLE[] = "Title";
0050 static const char XML_BOOK_ONDEMAND[] = "OnDemand";
0051 static const char XML_BOOK_ONDEMAND_TRUE[] = "1";
0052 static const char XML_BOOK_ONDEMAND_FALSE[] = "0";
0053 static const char XML_BOOK_NAME_FROM[] = "Name_from";
0054 static const char XML_BOOK_NAME_TO[] = "Name_to";
0055
0056
0057 static const int DEF_HISTO_COLOR = 48;
0058
0059
0060 typedef std::map<std::string, std::string> CoHistoProps;
0061
0062 typedef std::map<std::string, CoHistoProps> CoHisto;
0063
0064 typedef std::map<std::string, CoHisto> CoHistoMap;
0065
0066
0067
0068
0069
0070
0071 class Collection {
0072 public:
0073 typedef xercesc::DOMDocument DOMDocument;
0074 typedef xercesc::DOMElement DOMElement;
0075 typedef xercesc::DOMNode DOMNode;
0076 typedef xercesc::DOMNodeList DOMNodeList;
0077 typedef xercesc::DOMNamedNodeMap DOMNamedNodeMap;
0078 typedef xercesc::XMLException XMLException;
0079 typedef xercesc::XMLString XMLString;
0080 typedef xercesc::XMLPlatformUtils XMLPlatformUtils;
0081 typedef xercesc::XercesDOMParser XercesDOMParser;
0082 Collection(Configuration* const p_config);
0083 void load();
0084
0085 void bookEMUHistos() const;
0086 void bookFEDHistos(const HwId fedId) const;
0087 void bookDDUHistos(const HwId dduId) const;
0088 void bookCSCHistos(const HwId crateId, const HwId dmbId) const;
0089 void bookCSCHistos(const HistoId hid, const HwId crateId, const HwId dmbId, const HwId addId) const;
0090
0091 const bool isOnDemand(const HistoName& name) const;
0092
0093 void printCollection() const;
0094
0095 private:
0096 static const bool checkHistoValue(const CoHistoProps& h, const std::string& name, std::string& value);
0097 static const bool checkHistoValue(const CoHistoProps& h, const std::string& name, int& value);
0098 static const bool checkHistoValue(const CoHistoProps& h, const std::string name, double& value);
0099
0100 static std::string& getHistoValue(const CoHistoProps& h,
0101 const std::string& name,
0102 std::string& value,
0103 const std::string& def_value = "");
0104 static int& getHistoValue(const CoHistoProps& h, const std::string& name, int& value, const int& def_value = 0);
0105 static double& getHistoValue(const CoHistoProps& h,
0106 const std::string name,
0107 double& value,
0108 const int def_value = 0.0);
0109
0110 void book(const HistoDef& h, const CoHistoProps& p, const std::string& folder) const;
0111 static const int ParseAxisLabels(const std::string& s, std::map<int, std::string>& labels);
0112 static void getNodeProperties(DOMNode*& node, CoHistoProps& hp);
0113
0114 Configuration* config;
0115 CoHistoMap collection;
0116 };
0117
0118 }
0119
0120 #endif