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  binValues.clear();
8  binULimits.clear();
9  int size = CalibrationXML::readAttribute<int>(dom, "size");
10 
11  DOMNode *n1 = dom->getFirstChild();
12  int bin;
13  for (bin = 0; bin < size; bin++) {
14  while ((n1->getNodeType() != DOMNode::ELEMENT_NODE) && (n1 != nullptr))
15  n1 = n1->getNextSibling();
16  if (n1) {
17  DOMElement *binElement = (DOMElement *)n1;
18  binValues.push_back(CalibrationXML::readAttribute<double>(binElement, "value"));
19 
20  binULimits.push_back(CalibrationXML::readAttribute<double>(binElement, "uLimit"));
21  n1 = n1->getNextSibling();
22  }
23  }
24  if (bin > 0)
25  binValues.push_back(CalibrationXML::readAttribute<int>(dom, "overFlowValue"));
26 
27  limits = Range(binULimits.front(), binULimits.back());
28  totalValid = false;
29 }
30 
31 void CalibratedHistogramXML::write(XERCES_CPP_NAMESPACE::DOMElement *dom) const {
32  int size = binULimits.size();
34  DOMElement *binElement;
35  for (int bin = 0; bin < size; bin++) {
36  binElement = CalibrationXML::addChild(dom, "Bin");
37  CalibrationXML::writeAttribute(binElement, "value", binValues[bin]);
38  CalibrationXML::writeAttribute(binElement, "uLimit", binULimits[bin]);
39  }
40  CalibrationXML::writeAttribute(dom, "overFlowValue", binValues[size]);
41 }
contentValuesFiles.dom
dom
Definition: contentValuesFiles.py:50
Range
PixelRecoRange< float > Range
Definition: PixelTripletHLTGenerator.cc:31
CalibratedHistogramXML::write
void write(DOMElement *dom) const override
Definition: CalibratedHistogramXML.cc:31
CalibrationXML.h
CalibrationXML::addChild
static DOMElement * addChild(DOMNode *dom, const std::string &name)
Definition: CalibrationXML.cc:114
CalibrationXML::writeAttribute
static void writeAttribute(DOMElement *dom, const std::string &name, const T &value)
Definition: CalibrationXML.h:53
CalibratedHistogramXML::read
void read(DOMElement *dom) override
Definition: CalibratedHistogramXML.cc:6
CalibratedHistogramXML::DOMElement
XERCES_CPP_NAMESPACE::DOMElement DOMElement
Definition: CalibratedHistogramXML.h:19
newFWLiteAna.bin
bin
Definition: newFWLiteAna.py:161
TH2PolyOfflineMaps.limits
limits
Definition: TH2PolyOfflineMaps.py:44
std
Definition: JetResolutionObject.h:76
CalibratedHistogramXML::DOMNode
XERCES_CPP_NAMESPACE::DOMNode DOMNode
Definition: CalibratedHistogramXML.h:20
CalibratedHistogramXML.h
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443