File indexing completed on 2024-04-06 12:08:43
0001 #include "DQM/SiStripMonitorClient/interface/SiStripConfigParser.h"
0002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0003 #include <iostream>
0004
0005
0006
0007
0008 SiStripConfigParser::SiStripConfigParser() {
0009 edm::LogInfo("SiStripConfigParser") << " Creating SiStripConfigParser "
0010 << "\n";
0011 }
0012
0013 void SiStripConfigParser::getDocument(std::string filename) {
0014 boost::property_tree::ptree xml;
0015 boost::property_tree::read_xml(filename, xml);
0016
0017 auto it = xml.find("MonElementConfiguration");
0018 if (it == xml.not_found()) {
0019 throw cms::Exception("SiPixelConfigParser")
0020 << "SiPixelConfigParser XML needs to have a MonElementConfiguration node.";
0021 }
0022 this->config_ = it->second;
0023 }
0024
0025
0026
0027 bool SiStripConfigParser::getMENamesForSummary(std::map<std::string, std::string>& me_names) {
0028 for (auto& kv : config_) {
0029 if (kv.first == "SummaryPlot") {
0030 for (auto& mekv : kv.second) {
0031 if (mekv.first == "MonElement") {
0032 auto name = mekv.second.get<std::string>("<xmlattr>.name");
0033 auto type = mekv.second.get<std::string>("<xmlattr>.type");
0034 me_names[name] = type;
0035 }
0036 }
0037 return true;
0038 }
0039 }
0040 return false;
0041 }
0042
0043
0044
0045
0046 bool SiStripConfigParser::getFrequencyForSummary(int& u_freq) {
0047 u_freq = config_.get<int>("SummaryPlot.<xmlattr>.update_frequency", -1);
0048 if (u_freq >= 0)
0049 return true;
0050 return false;
0051 }