CMS 3D CMS Logo

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