27 }
catch (
const XMLException&
f) {
28 throw(std::runtime_error(
"Standard pool exception : Fatal Error on pool::TrivialFileCatalog"));
37 <<
" You have not called the parseXML function," 38 <<
" or your XML file is erronious" << std::endl;
40 if (plots_.find(run_type) != plots_.end()) {
41 return plots_[run_type];
43 return std::vector<SummaryPlot>();
57 DOMElement*
root = this->
doc()->getDocumentElement();
60 ss <<
"[SummaryPlotXmlParser::" << __func__ <<
"]" 61 <<
" Unable to find any elements!" 62 <<
" Empty xml document?...";
63 throw(std::runtime_error(ss.str()));
67 if (!
XMLString::equals(root->getTagName(), XMLString::transcode(rootTag_.c_str()))) {
69 ss <<
"[SummaryPlotXmlParser::" << __func__ <<
"]" 70 <<
" Did not find \"" << rootTag_ <<
"\" tag! " 71 <<
" Tag name is " << XMLString::transcode(root->getNodeName());
77 DOMNodeList*
nodes = root->getChildNodes();
78 if (nodes->getLength() == 0) {
80 ss <<
"[SummaryPlotXmlParser::" << __func__ <<
"]" 81 <<
" Unable to find any children nodes!" 82 <<
" Empty xml document?...";
83 throw(std::runtime_error(ss.str()));
97 for (XMLSize_t inode = 0; inode < nodes->getLength(); ++inode) {
99 DOMNode* node = nodes->item(inode);
100 if (node->getNodeType() && node->getNodeType() == DOMNode::ELEMENT_NODE) {
101 DOMElement* element =
dynamic_cast<DOMElement*
>(node);
106 if (
XMLString::equals(element->getTagName(), XMLString::transcode(runTypeTag_.c_str()))) {
107 const XMLCh* attr = element->getAttribute(XMLString::transcode(runTypeAttr_.c_str()));
118 DOMNodeList*
children = node->getChildNodes();
119 if (nodes->getLength() == 0) {
120 std::stringstream
ss;
121 ss <<
"[SummaryPlotXmlParser::" << __func__ <<
"]" 122 <<
" Unable to find any children nodes!" 123 <<
" Empty xml document?...";
124 throw(std::runtime_error(ss.str()));
129 for (XMLSize_t jnode = 0; jnode < children->getLength(); ++jnode) {
131 DOMNode*
child = children->item(jnode);
132 if (child->getNodeType() && child->getNodeType() == DOMNode::ELEMENT_NODE) {
133 DOMElement*
elem =
dynamic_cast<DOMElement*
>(
child);
138 if (
XMLString::equals(elem->getTagName(), XMLString::transcode(summaryPlotTag_.c_str()))) {
139 const XMLCh*
mon = elem->getAttribute(XMLString::transcode(monitorableAttr_.c_str()));
140 const XMLCh* pres = elem->getAttribute(XMLString::transcode(presentationAttr_.c_str()));
141 const XMLCh*
level = elem->getAttribute(XMLString::transcode(levelAttr_.c_str()));
142 const XMLCh* gran = elem->getAttribute(XMLString::transcode(granularityAttr_.c_str()));
145 XMLString::transcode(pres),
146 XMLString::transcode(gran),
147 XMLString::transcode(level));
148 plots_[run_type].push_back(plot);
169 }
catch (XMLException&
e) {
170 char* message = XMLString::transcode(e.getMessage());
171 std::ostringstream
ss;
172 ss <<
"[SummaryPlotXmlParser::" << __func__ <<
"]" 173 <<
" Error parsing file: " << message << std::flush;
181 std::stringstream
ss;
190 ss <<
"[SummaryPlotXmlParser::SummaryPlot::" << __func__ <<
"]" 191 <<
" Dumping contents of parsed XML file: " << std::endl;
193 typedef std::vector<SummaryPlot>
Plots;
194 std::map<RunType, Plots>::const_iterator irun = plots_.begin();
195 for (; irun != plots_.end(); irun++) {
197 if (irun->second.empty()) {
198 ss <<
" No summary plots for this RunType!";
200 Plots::const_iterator iplot = irun->second.begin();
201 for (; iplot != irun->second.end(); iplot++) {
202 ss << *iplot << std::endl;
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_
void parseXML(const std::string &xml_file)
static const std::string granularityAttr_
static const char mlDqmClient_[]
static std::string runType(const sistrip::RunType &)
void print(std::stringstream &) const
Parses the "summary plot" xml configuration file.
static const std::string viewAttr_
std::ostream & operator<<(std::ostream &os, const SummaryPlotXmlParser &parser)
Class holding info that defines a summary plot.
static const std::string summaryPlotTag_
def elem(elemtype, innerHTML='', html_class='', kwargs)
bool equals(const edm::RefToBase< Jet > &j1, const edm::RefToBase< Jet > &j2)
std::vector< SummaryPlot > summaryPlots(const sistrip::RunType &)
static const std::string levelAttr_