CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes | Static Private Attributes
SummaryPlotXmlParser Class Reference

Parses the "summary plot" xml configuration file. More...

#include <SummaryPlotXmlParser.h>

Public Member Functions

void parseXML (const std::string &xml_file)
 
void print (std::stringstream &) const
 
std::vector< SummaryPlotsummaryPlots (const sistrip::RunType &)
 
 SummaryPlotXmlParser ()
 
 ~SummaryPlotXmlParser ()
 

Private Attributes

std::map< sistrip::RunType, std::vector< SummaryPlot > > plots_
 

Static Private Attributes

static const std::string granularityAttr_ = "granularity"
 
static const std::string levelAttr_ = "level"
 
static const std::string monitorableAttr_ = "monitorable"
 
static const std::string presentationAttr_ = "presentation"
 
static const std::string rootTag_ = "root"
 
static const std::string runTypeAttr_ = "name"
 
static const std::string runTypeTag_ = "RunType"
 
static const std::string summaryPlotTag_ = "SummaryPlot"
 
static const std::string viewAttr_ = "view"
 

Detailed Description

Parses the "summary plot" xml configuration file.

Author
P.Kalavase, R.Bainbridge

Definition at line 26 of file SummaryPlotXmlParser.h.

Constructor & Destructor Documentation

◆ SummaryPlotXmlParser()

SummaryPlotXmlParser::SummaryPlotXmlParser ( )

Default constructor.

Definition at line 22 of file SummaryPlotXmlParser.cc.

22 { plots_.clear(); }
std::map< sistrip::RunType, std::vector< SummaryPlot > > plots_

◆ ~SummaryPlotXmlParser()

SummaryPlotXmlParser::~SummaryPlotXmlParser ( )
inline

Default destructor.

Definition at line 34 of file SummaryPlotXmlParser.h.

34 { ; }

Member Function Documentation

◆ parseXML()

void SummaryPlotXmlParser::parseXML ( const std::string &  xml_file)

Fill the map with the required tag/names and values

Definition at line 41 of file SummaryPlotXmlParser.cc.

References relativeConstraints::empty, corrVsCorr::filename, gammaJetAnalysis_CHSJECs_cff::level, LaserDQM_cfi::mon, plotFactory::plot, writedatasetfile::runs, SiStripCommissioningClient_cfg::runtype, SiStripEnumsAndStrings::runType(), contentValuesCheck::ss, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by SiStripCommissioningOfflineClient::beginRun().

41  {
42  plots_.clear();
43 
44  boost::property_tree::ptree xmltree;
45  boost::property_tree::read_xml(filename, xmltree);
46 
47  auto runs = xmltree.find(rootTag_);
48  if (runs == xmltree.not_found()) {
49  }
50 
51  // Iterate through nodes
52  for (auto& xml : xmltree) {
53  if (xml.first == rootTag_) { // find main root
54  for (auto& runtype : xml.second) {
55  if (runtype.first == runTypeTag_) { // enter in the run type
56  sistrip::RunType run_type =
58  for (auto& sumplot : runtype.second) {
59  if (sumplot.first == summaryPlotTag_) {
60  std::string mon = sumplot.second.get<std::string>("<xmlattr>." + monitorableAttr_);
61  std::string pres = sumplot.second.get<std::string>("<xmlattr>." + presentationAttr_);
62  std::string level = sumplot.second.get<std::string>("<xmlattr>." + levelAttr_);
63  std::string gran = sumplot.second.get<std::string>("<xmlattr>." + granularityAttr_);
64  SummaryPlot plot(mon, pres, gran, level);
65  plots_[run_type].push_back(plot);
66  }
67  }
68  if (plots_[run_type].empty()) {
69  std::stringstream ss;
70  ss << "[SummaryPlotXmlParser::" << __func__ << "]"
71  << " Unable to find any summary plot for " << runTypeTag_ << " nodes!"
72  << " Empty xml summary histo block?";
73  throw(std::runtime_error(ss.str()));
74  return;
75  }
76  } else {
77  std::stringstream ss;
78  ss << "[SummaryPlotXmlParser::" << __func__ << "]"
79  << " Unable to find any " << runTypeTag_ << " nodes!"
80  << " Empty xml run-type block?";
81  throw(std::runtime_error(ss.str()));
82  return;
83  }
84  }
85  } else {
86  std::stringstream ss;
87  ss << "[SummaryPlotXmlParser::" << __func__ << "]"
88  << " Did not find \"" << rootTag_ << "\" tag! "
89  << " Tag name is " << rootTag_;
90  throw(std::runtime_error(ss.str()));
91  return;
92  }
93  }
94 }
static const std::string monitorableAttr_
static const std::string rootTag_
static const std::string runTypeTag_
static const std::string presentationAttr_
static const std::string runTypeAttr_
static const std::string granularityAttr_
static std::string runType(const sistrip::RunType &)
Class holding info that defines a summary plot.
Definition: SummaryPlot.h:19
std::map< sistrip::RunType, std::vector< SummaryPlot > > plots_
static const std::string summaryPlotTag_
static const std::string levelAttr_

◆ print()

void SummaryPlotXmlParser::print ( std::stringstream &  ss) const

Debug print method.

Definition at line 107 of file SummaryPlotXmlParser.cc.

References heavyFlavorValidationHarvestingSequence_cff::Plots, SiStripEnumsAndStrings::runType(), and contentValuesCheck::ss.

107  {
108  ss << "[SummaryPlotXmlParser::SummaryPlot::" << __func__ << "]"
109  << " Dumping contents of parsed XML file: " << std::endl;
110  using namespace sistrip;
111  typedef std::vector<SummaryPlot> Plots;
112  std::map<RunType, Plots>::const_iterator irun = plots_.begin();
113  for (; irun != plots_.end(); irun++) {
114  ss << " RunType=\"" << SiStripEnumsAndStrings::runType(irun->first) << "\"" << std::endl;
115  if (irun->second.empty()) {
116  ss << " No summary plots for this RunType!";
117  } else {
118  Plots::const_iterator iplot = irun->second.begin();
119  for (; iplot != irun->second.end(); iplot++) {
120  ss << *iplot << std::endl;
121  }
122  }
123  }
124 }
sistrip classes
static std::string runType(const sistrip::RunType &)
std::map< sistrip::RunType, std::vector< SummaryPlot > > plots_

◆ summaryPlots()

std::vector< SummaryPlot > SummaryPlotXmlParser::summaryPlots ( const sistrip::RunType run_type)

Returns SummaryPlot objects for given commissioning task.

Definition at line 26 of file SummaryPlotXmlParser.cc.

References sistrip::mlDqmClient_.

Referenced by SiStripCommissioningOfflineClient::beginRun().

26  {
27  if (plots_.empty()) {
28  edm::LogWarning(mlDqmClient_) << "[SummaryPlotXmlParser" << __func__ << "]"
29  << " You have not called the parseXML function,"
30  << " or your XML file is erronious" << std::endl;
31  }
32  if (plots_.find(run_type) != plots_.end()) {
33  return plots_[run_type];
34  } else {
35  return std::vector<SummaryPlot>();
36  }
37 }
static const char mlDqmClient_[]
std::map< sistrip::RunType, std::vector< SummaryPlot > > plots_
Log< level::Warning, false > LogWarning

Member Data Documentation

◆ granularityAttr_

const std::string SummaryPlotXmlParser::granularityAttr_ = "granularity"
staticprivate

Definition at line 64 of file SummaryPlotXmlParser.h.

◆ levelAttr_

const std::string SummaryPlotXmlParser::levelAttr_ = "level"
staticprivate

Definition at line 63 of file SummaryPlotXmlParser.h.

◆ monitorableAttr_

const std::string SummaryPlotXmlParser::monitorableAttr_ = "monitorable"
staticprivate

Definition at line 60 of file SummaryPlotXmlParser.h.

◆ plots_

std::map<sistrip::RunType, std::vector<SummaryPlot> > SummaryPlotXmlParser::plots_
private

Container holding the SummaryPlot objects.

Definition at line 51 of file SummaryPlotXmlParser.h.

◆ presentationAttr_

const std::string SummaryPlotXmlParser::presentationAttr_ = "presentation"
staticprivate

Definition at line 61 of file SummaryPlotXmlParser.h.

◆ rootTag_

const std::string SummaryPlotXmlParser::rootTag_ = "root"
staticprivate

Definition at line 54 of file SummaryPlotXmlParser.h.

◆ runTypeAttr_

const std::string SummaryPlotXmlParser::runTypeAttr_ = "name"
staticprivate

Definition at line 56 of file SummaryPlotXmlParser.h.

◆ runTypeTag_

const std::string SummaryPlotXmlParser::runTypeTag_ = "RunType"
staticprivate

Definition at line 55 of file SummaryPlotXmlParser.h.

◆ summaryPlotTag_

const std::string SummaryPlotXmlParser::summaryPlotTag_ = "SummaryPlot"
staticprivate

Definition at line 59 of file SummaryPlotXmlParser.h.

◆ viewAttr_

const std::string SummaryPlotXmlParser::viewAttr_ = "view"
staticprivate

Definition at line 62 of file SummaryPlotXmlParser.h.