test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiStripLayoutParser.cc
Go to the documentation of this file.
4 #include <iostream>
5 
6 //
7 // -- Constructor
8 //
10  edm::LogInfo("SiStripLayoutParser") <<
11  " Creating SiStripLayoutParser " << "\n" ;
12 }
13 //
14 // -- Destructor
15 //
17  edm::LogInfo("SiStripActionExecutor") <<
18  " Deleting SiStripLayoutParser " << "\n" ;
19 }
20 //
21 // -- Get list of Layouts for ME groups
22 //
23 bool SiStripLayoutParser::getAllLayouts(std::map<std::string, std::vector< std::string > >& layouts){
24  if (!doc()) {
25  std::cout << " SiStripLayoutParser::Configuration File is not set!!! " << std::endl;
26  return false;
27  }
28 
29  layouts.clear();
30 
31  xercesc::DOMNodeList * layoutList
32  = doc()->getElementsByTagName(qtxml::_toDOMS("layout"));
33 
34  unsigned int nlayout = layoutList->getLength();
35  if (nlayout == 0) return false;
36 
37  for (unsigned int k = 0; k < layoutList->getLength(); k++) {
38  xercesc::DOMNode* layoutNode = layoutList->item(k);
39  if (!layoutNode) return false;
40 
41  xercesc::DOMElement* layoutElement = static_cast<xercesc::DOMElement *>(layoutNode);
42  if (!layoutElement) return false;
43  std::string layoutName = qtxml::_toString(layoutElement->getAttribute (qtxml::_toDOMS ("name")));
44 
45  xercesc::DOMNodeList * meList
46  = layoutElement->getElementsByTagName(qtxml::_toDOMS("monitorable"));
47  std::vector<std::string> me_names;
48  for (unsigned int l = 0; l < meList->getLength(); l++) {
49  xercesc::DOMNode* meNode = meList->item(l);
50  if (!meNode) return false;
51  xercesc::DOMElement* meElement = static_cast<xercesc::DOMElement *>(meNode);
52  if (!meElement) return false;
53  std::string meName = qtxml::_toString(meElement->getAttribute (qtxml::_toDOMS ("name")));
54  me_names.push_back(meName);
55  }
56  if (me_names.size() > 0) layouts[layoutName] = me_names;
57  }
58  if ( layouts.size() > 0) return true;
59  else return false;
60 }
std::string _toString(const XMLCh *toTranscode)
XMLCh * _toDOMS(std::string temp)
bool getAllLayouts(std::map< std::string, std::vector< std::string > > &me_names)
tuple cout
Definition: gather_cfg.py:145
xercesc::DOMDocument * doc()
DOM Document.
Definition: DQMParserBase.h:45