CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_2_9_HLT1_bphpatch4/src/DQM/SiPixelMonitorClient/src/SiPixelLayoutParser.cc

Go to the documentation of this file.
00001 #include "DQM/SiPixelMonitorClient/interface/SiPixelLayoutParser.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 // -- Constructor
00011 // 
00012 SiPixelLayoutParser::SiPixelLayoutParser() : DQMParserBase() {
00013   edm::LogInfo("SiPixelLayoutParser") << 
00014     " Creating SiPixelLayoutParser " << "\n" ;
00015   cout << " Creating SiPixelLayoutParser " << endl;
00016 }
00017 //
00018 // --  Destructor
00019 // 
00020 SiPixelLayoutParser::~SiPixelLayoutParser() {
00021   edm::LogInfo("SiPixelActionExecutor") << 
00022     " Deleting SiPixelLayoutParser " << "\n" ;
00023 }
00024 //
00025 // -- Get list of Layouts for ME groups
00026 //
00027 bool SiPixelLayoutParser::getAllLayouts(map<string, vector< string > >& layouts){
00028   if (!doc()) {
00029     cout << " SiPixelLayoutParser::Configuration File is not set!!! " << endl;
00030     return false;
00031   }
00032 
00033   layouts.clear();
00034 
00035   DOMNodeList * layoutList 
00036     = doc()->getElementsByTagName(qtxml::_toDOMS("layout"));
00037 
00038   unsigned int nlayout = layoutList->getLength();
00039   if (nlayout == 0) return false;
00040 
00041   for (unsigned int k = 0; k < layoutList->getLength(); k++) {
00042     DOMNode* layoutNode 
00043       = layoutList->item(k);
00044     if (!layoutNode) return false;
00045     
00046     DOMElement* layoutElement = static_cast<DOMElement *>(layoutNode);          
00047     if (!layoutElement) return false;
00048     string layoutName = qtxml::_toString(layoutElement->getAttribute (qtxml::_toDOMS ("name"))); 
00049 
00050     DOMNodeList * meList 
00051       = layoutElement->getElementsByTagName(qtxml::_toDOMS("monitorable"));
00052     vector<string> me_names;
00053     for (unsigned int l = 0; l < meList->getLength(); l++) {
00054       DOMNode* meNode = meList->item(l);
00055       if (!meNode) return false;
00056       DOMElement* meElement = static_cast<DOMElement *>(meNode);          
00057       if (!meElement) return false;
00058       string meName = qtxml::_toString(meElement->getAttribute (qtxml::_toDOMS ("name"))); 
00059       me_names.push_back(meName);    
00060     }
00061     if (me_names.size() > 0) layouts[layoutName] = me_names;
00062   }
00063   if ( layouts.size() > 0) return true;
00064   else return false; 
00065 }