CMS 3D CMS Logo

SiStripConfigParser.cc
Go to the documentation of this file.
4 #include <iostream>
5 
6 //
7 // -- Constructor
8 //
10  edm::LogInfo("SiStripConfigParser") << " Creating SiStripConfigParser "
11  << "\n";
12 }
13 //
14 // -- Destructor
15 //
17  edm::LogInfo("SiStripConfigParser") << " Deleting SiStripConfigParser "
18  << "\n";
19 }
20 //
21 // -- Get List of MEs for the summary plot and the
22 //
23 bool SiStripConfigParser::getMENamesForSummary(std::map<std::string, std::string>& me_names) {
24  if (!doc()) {
25  std::cout << " SiStripConfigParser::Configuration File is not set!!! " << std::endl;
26  return false;
27  }
28 
29  me_names.clear();
30  unsigned int summaryNodes = doc()->getElementsByTagName(qtxml::_toDOMS("SummaryPlot"))->getLength();
31  if (summaryNodes == 0)
32  return false;
34  xercesc::DOMNode* summaryNode = doc()->getElementsByTagName(qtxml::_toDOMS("SummaryPlot"))->item(0);
35  //Get Summary ME name and type
36  if (!summaryNode)
37  return false;
38  xercesc::DOMElement* summaryElement = static_cast<xercesc::DOMElement*>(summaryNode);
39  if (!summaryElement)
40  return false;
41 
42  xercesc::DOMNodeList* meList = summaryElement->getElementsByTagName(qtxml::_toDOMS("MonElement"));
43  for (unsigned int k = 0; k < meList->getLength(); k++) {
44  xercesc::DOMNode* meNode = meList->item(k);
45  if (!meNode)
46  return false;
47  xercesc::DOMElement* meElement = static_cast<xercesc::DOMElement*>(meNode);
48  if (!meElement)
49  return false;
50  std::string me_name = qtxml::_toString(meElement->getAttribute(qtxml::_toDOMS("name")));
51  std::string me_type = qtxml::_toString(meElement->getAttribute(qtxml::_toDOMS("type")));
52  me_names.insert(std::pair<std::string, std::string>(me_name, me_type));
53  }
54  if (me_names.empty())
55  return false;
56  else
57  return true;
58 }
59 //
60 // -- Get List of MEs for the summary plot and the
61 //
63  if (!doc()) {
64  std::cout << " SiStripConfigParser::Configuration File is not set!!! " << std::endl;
65  return false;
66  }
67 
68  unsigned int summaryNodes = doc()->getElementsByTagName(qtxml::_toDOMS("SummaryPlot"))->getLength();
69  if (summaryNodes != 1)
70  return false;
72  xercesc::DOMNode* summaryNode = doc()->getElementsByTagName(qtxml::_toDOMS("SummaryPlot"))->item(0);
73  //Get Node name
74  if (!summaryNode)
75  return false;
76  xercesc::DOMElement* summaryElement = static_cast<xercesc::DOMElement*>(summaryNode);
77  if (!summaryElement)
78  return false;
79 
80  u_freq = atoi(qtxml::_toString(summaryElement->getAttribute(qtxml::_toDOMS("update_frequency"))).c_str());
81  return true;
82 }
bool getFrequencyForSummary(int &u_freq)
std::string _toString(const XMLCh *toTranscode)
XMLCh * _toDOMS(std::string temp)
bool getMENamesForSummary(std::map< std::string, std::string > &me_names)
xercesc::DOMDocument * doc()
DOM Document.
Definition: DQMParserBase.h:39