CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/DQM/SiStripMonitorClient/src/SiStripConfigParser.cc

Go to the documentation of this file.
00001 #include "DQM/SiStripMonitorClient/interface/SiStripConfigParser.h"
00002 #include "DQMServices/ClientConfig/interface/ParserFunctions.h"
00003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00004 #include <iostream>
00005 
00006 //
00007 // -- Constructor
00008 // 
00009 SiStripConfigParser::SiStripConfigParser() : DQMParserBase() {
00010   edm::LogInfo("SiStripConfigParser") << 
00011     " Creating SiStripConfigParser " << "\n" ;
00012 }
00013 //
00014 // --  Destructor
00015 // 
00016 SiStripConfigParser::~SiStripConfigParser() {
00017   edm::LogInfo("SiStripConfigParser") << 
00018     " Deleting SiStripConfigParser " << "\n" ;
00019 }
00020 //
00021 // -- Get List of MEs for the summary plot and the
00022 //
00023 bool SiStripConfigParser::getMENamesForSummary(std::map<std::string, std::string>& me_names) {
00024   if (!doc()) {
00025     std::cout << " SiStripConfigParser::Configuration File is not set!!! " << std::endl;
00026     return false;
00027   }
00028 
00029   me_names.clear();
00030   unsigned int summaryNodes = doc()->getElementsByTagName(qtxml::_toDOMS("SummaryPlot"))->getLength();
00031   if (summaryNodes == 0) return false;
00033   xercesc::DOMNode* summaryNode = doc()->getElementsByTagName(qtxml::_toDOMS("SummaryPlot"))->item(0);
00034  //Get Summary ME name and type
00035   if (! summaryNode) return false;
00036   xercesc::DOMElement* summaryElement = static_cast<xercesc::DOMElement *>(summaryNode);          
00037   if (! summaryElement) return false;            
00038                 
00039 
00040   xercesc::DOMNodeList * meList 
00041                   = summaryElement->getElementsByTagName(qtxml::_toDOMS("MonElement"));
00042   for (unsigned int k = 0; k < meList->getLength(); k++) {
00043     xercesc::DOMNode* meNode = meList->item(k);
00044     if (!meNode) return false;
00045     xercesc::DOMElement* meElement = static_cast<xercesc::DOMElement *>(meNode);          
00046     if (!meElement) return false;
00047     std::string me_name = qtxml::_toString(meElement->getAttribute (qtxml::_toDOMS ("name"))); 
00048     std::string me_type = qtxml::_toString(meElement->getAttribute (qtxml::_toDOMS ("type"))); 
00049     me_names.insert(std::pair<std::string,std::string>(me_name,me_type));    
00050   }
00051   if (me_names.size() == 0) return false;
00052   else return true;
00053   
00054 }
00055 //
00056 // -- Get List of MEs for the summary plot and the
00057 //
00058 bool SiStripConfigParser::getFrequencyForSummary(int& u_freq) {
00059   if (!doc()) {
00060     std::cout << " SiStripConfigParser::Configuration File is not set!!! " << std::endl;
00061     return false;
00062   }
00063 
00064   unsigned int summaryNodes = doc()->getElementsByTagName(qtxml::_toDOMS("SummaryPlot"))->getLength();
00065   if (summaryNodes != 1 ) return false;
00067   xercesc::DOMNode* summaryNode = doc()->getElementsByTagName(qtxml::_toDOMS("SummaryPlot"))->item(0);
00068  //Get Node name
00069   if (! summaryNode) return false;
00070   xercesc::DOMElement* summaryElement = static_cast<xercesc::DOMElement *>(summaryNode);          
00071   if (! summaryElement) return false;            
00072                 
00073   u_freq = atoi(qtxml::_toString(summaryElement->getAttribute(qtxml::_toDOMS("update_frequency"))).c_str());
00074   return true;
00075 }