00001 #include "DQM/SiStripMonitorClient/interface/SiStripLayoutParser.h"
00002 #include "DQMServices/ClientConfig/interface/ParserFunctions.h"
00003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00004 #include <iostream>
00005
00006 using namespace xercesc;
00007 using namespace std;
00008
00009
00010
00011
00012 SiStripLayoutParser::SiStripLayoutParser() : DQMParserBase() {
00013 edm::LogInfo("SiStripLayoutParser") <<
00014 " Creating SiStripLayoutParser " << "\n" ;
00015 }
00016
00017
00018
00019 SiStripLayoutParser::~SiStripLayoutParser() {
00020 edm::LogInfo("SiStripActionExecutor") <<
00021 " Deleting SiStripLayoutParser " << "\n" ;
00022 }
00023
00024
00025
00026 bool SiStripLayoutParser::getAllLayouts(map<string, vector< string > >& layouts){
00027 if (!doc) {
00028 cout << " SiStripLayoutParser::Configuration File is not set!!! " << endl;
00029 return false;
00030 }
00031
00032 layouts.clear();
00033
00034 DOMNodeList * layoutList
00035 = doc->getElementsByTagName(qtxml::_toDOMS("layout"));
00036
00037 unsigned int nlayout = layoutList->getLength();
00038 if (nlayout == 0) return false;
00039
00040 for (unsigned int k = 0; k < layoutList->getLength(); k++) {
00041 DOMNode* layoutNode = layoutList->item(k);
00042 if (!layoutNode) return false;
00043
00044 DOMElement* layoutElement = static_cast<DOMElement *>(layoutNode);
00045 if (!layoutElement) return false;
00046 string layoutName = qtxml::_toString(layoutElement->getAttribute (qtxml::_toDOMS ("name")));
00047
00048 DOMNodeList * meList
00049 = layoutElement->getElementsByTagName(qtxml::_toDOMS("monitorable"));
00050 vector<string> me_names;
00051 for (unsigned int l = 0; l < meList->getLength(); l++) {
00052 DOMNode* meNode = meList->item(l);
00053 if (!meNode) return false;
00054 DOMElement* meElement = static_cast<DOMElement *>(meNode);
00055 if (!meElement) return false;
00056 string meName = qtxml::_toString(meElement->getAttribute (qtxml::_toDOMS ("name")));
00057 me_names.push_back(meName);
00058 }
00059 if (me_names.size() > 0) layouts[layoutName] = me_names;
00060 }
00061 if ( layouts.size() > 0) return true;
00062 else return false;
00063 }