CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/src/DQM/SiStripMonitorClient/src/SiStripLayoutParser.cc

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