CMS 3D CMS Logo

CalibratedHistogramXML.cc
Go to the documentation of this file.
3 #include <iostream>
4 
5 using namespace std;
6 void CalibratedHistogramXML::read (XERCES_CPP_NAMESPACE::DOMElement * dom)
7  {
8  binValues.clear();
9  binULimits.clear();
10  int size= CalibrationXML::readAttribute<int>(dom,"size");
11 
12  DOMNode * n1 = dom->getFirstChild();
13  int bin;
14  for(bin=0; bin < size; bin ++)
15  {
16  while( ( n1->getNodeType() != DOMNode::ELEMENT_NODE ) && ( n1 != 0 ) ) n1 = n1->getNextSibling();
17  if (n1)
18  {
19  DOMElement * binElement = (DOMElement *) n1;
20  binValues.push_back(CalibrationXML::readAttribute<double>(binElement,"value"));
21 
22  binULimits.push_back(CalibrationXML::readAttribute<double>(binElement,"uLimit"));
23  n1 = n1->getNextSibling();
24  }
25  }
26  if(bin>0)
27  binValues.push_back(CalibrationXML::readAttribute<int>(dom,"overFlowValue"));
28 
29  limits = Range(binULimits.front(), binULimits.back());
30  totalValid = false;
31  }
32 
33 void CalibratedHistogramXML::write (XERCES_CPP_NAMESPACE::DOMElement * dom) const
34  {
35 
36  int size=binULimits.size();
37  CalibrationXML::writeAttribute(dom,"size",size);
38  DOMElement * binElement;
39  for(int bin=0; bin < size; bin ++)
40  {
41  binElement = CalibrationXML::addChild(dom,"Bin");
42  CalibrationXML::writeAttribute(binElement,"value",binValues[bin]);
43  CalibrationXML::writeAttribute(binElement,"uLimit",binULimits[bin]);
44  }
45  CalibrationXML::writeAttribute(dom,"overFlowValue",binValues[size]);
46 
47  }
48 
size
Write out results.
static void writeAttribute(DOMElement *dom, const std::string &name, const T &value)
static DOMElement * addChild(DOMNode *dom, const std::string &name)
XERCES_CPP_NAMESPACE::DOMNode DOMNode
PixelRecoRange< float > Range
void write(DOMElement *dom) const
bin
set the eta bin as selection string.
void read(DOMElement *dom)
XERCES_CPP_NAMESPACE::DOMElement DOMElement