CMS 3D CMS Logo

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") << " Creating SiPixelLayoutParser "
14  << "\n";
15  cout << " Creating SiPixelLayoutParser " << endl;
16 }
17 //
18 // -- Destructor
19 //
21  edm::LogInfo("SiPixelActionExecutor") << " Deleting SiPixelLayoutParser "
22  << "\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 = doc()->getElementsByTagName(qtxml::_toDOMS("layout"));
36 
37  unsigned int nlayout = layoutList->getLength();
38  if (nlayout == 0)
39  return false;
40 
41  for (unsigned int k = 0; k < layoutList->getLength(); k++) {
42  DOMNode *layoutNode = layoutList->item(k);
43  if (!layoutNode)
44  return false;
45 
46  DOMElement *layoutElement = static_cast<DOMElement *>(layoutNode);
47  if (!layoutElement)
48  return false;
49  string layoutName = qtxml::_toString(layoutElement->getAttribute(qtxml::_toDOMS("name")));
50 
51  DOMNodeList *meList = 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)
56  return false;
57  DOMElement *meElement = static_cast<DOMElement *>(meNode);
58  if (!meElement)
59  return false;
60  string meName = qtxml::_toString(meElement->getAttribute(qtxml::_toDOMS("name")));
61  me_names.push_back(meName);
62  }
63  if (!me_names.empty())
64  layouts[layoutName] = me_names;
65  }
66  if (!layouts.empty())
67  return true;
68  else
69  return false;
70 }
std::string _toString(const XMLCh *toTranscode)
int k[5][pyjets_maxn]
XMLCh * _toDOMS(std::string temp)
xercesc::DOMDocument * doc()
DOM Document.
Definition: DQMParserBase.h:45
bool getAllLayouts(std::map< std::string, std::vector< std::string >> &me_names)