26 catch (
const XMLException &
f ) {
27 throw( std::runtime_error(
"Standard pool exception : Fatal Error on pool::TrivialFileCatalog") );
34 if( plots_.empty() ) {
36 <<
"[SummaryPlotXmlParser" << __func__ <<
"]" 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];
42 }
else {
return std::vector<SummaryPlot>(); }
58 DOMElement*
root = this->doc()->getDocumentElement();
61 ss <<
"[SummaryPlotXmlParser::" << __func__ <<
"]" 62 <<
" Unable to find any elements!" 63 <<
" Empty xml document?...";
64 throw( std::runtime_error( ss.str() ) );
68 if( !
XMLString::equals( root->getTagName(), XMLString::transcode(rootTag_.c_str()) ) ) {
70 ss <<
"[SummaryPlotXmlParser::" << __func__ <<
"]" 71 <<
" Did not find \"" << rootTag_ <<
"\" tag! " 73 << XMLString::transcode(root->getNodeName());
79 DOMNodeList*
nodes = root->getChildNodes();
80 if ( nodes->getLength() == 0 ) {
82 ss <<
"[SummaryPlotXmlParser::" << __func__ <<
"]" 83 <<
" Unable to find any children nodes!" 84 <<
" Empty xml document?...";
85 throw( std::runtime_error( ss.str() ) );
99 for( XMLSize_t inode = 0; inode < nodes->getLength(); ++inode ) {
102 DOMNode* node = nodes->item(inode);
103 if( node->getNodeType() &&
104 node->getNodeType() == DOMNode::ELEMENT_NODE ) {
106 DOMElement* element =
dynamic_cast<DOMElement*
>( node );
107 if ( !element ) {
continue; }
110 XMLString::transcode(runTypeTag_.c_str()) ) ) {
112 const XMLCh* attr = element->getAttribute( XMLString::transcode(runTypeAttr_.c_str()) );
123 DOMNodeList*
children = node->getChildNodes();
124 if ( nodes->getLength() == 0 ) {
125 std::stringstream ss;
126 ss <<
"[SummaryPlotXmlParser::" << __func__ <<
"]" 127 <<
" Unable to find any children nodes!" 128 <<
" Empty xml document?...";
129 throw( std::runtime_error( ss.str() ) );
134 for( XMLSize_t jnode = 0; jnode < children->getLength(); ++jnode ) {
137 DOMNode*
child = children->item(jnode);
138 if( child->getNodeType() &&
139 child->getNodeType() == DOMNode::ELEMENT_NODE ) {
141 DOMElement*
elem =
dynamic_cast<DOMElement*
>(
child );
142 if ( !elem ) {
continue; }
145 XMLString::transcode(summaryPlotTag_.c_str()) ) ) {
147 const XMLCh*
mon = elem->getAttribute( XMLString::transcode(monitorableAttr_.c_str()) );
148 const XMLCh* pres = elem->getAttribute( XMLString::transcode(presentationAttr_.c_str()) );
149 const XMLCh*
level = elem->getAttribute( XMLString::transcode(levelAttr_.c_str()) );
150 const XMLCh* gran = elem->getAttribute( XMLString::transcode(granularityAttr_.c_str()) );
153 XMLString::transcode(pres),
154 XMLString::transcode(gran),
155 XMLString::transcode(level) );
156 plots_[run_type].push_back( plot );
180 catch( XMLException&
e ) {
181 char*
message = XMLString::transcode(e.getMessage());
182 std::ostringstream ss;
183 ss <<
"[SummaryPlotXmlParser::" << __func__ <<
"]" 184 <<
" Error parsing file: " << message << std::flush;
193 std::stringstream ss;
202 ss <<
"[SummaryPlotXmlParser::SummaryPlot::" << __func__ <<
"]" 203 <<
" Dumping contents of parsed XML file: " << std::endl;
205 typedef std::vector<SummaryPlot> Plots;
206 std::map<RunType,Plots>::const_iterator irun = plots_.begin();
207 for ( ; irun != plots_.end(); irun++ ) {
210 <<
"\"" << std::endl;
211 if ( irun->second.empty() ) {
212 ss <<
" No summary plots for this RunType!";
214 Plots::const_iterator iplot = irun->second.begin();
215 for ( ; iplot != irun->second.end(); iplot++ ) {
216 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_