#include <RecoBTag/XMLCalibration/interface/CalibratedHistogramXML.h>
Public Member Functions | |
CalibratedHistogramXML (const std::vector< float > &ulimits) | |
CalibratedHistogramXML (const CalibratedHistogram &h) | |
CalibratedHistogramXML () | |
std::string | name () const |
Return a name for your calibrated object. | |
void | read (XERCES_CPP_NAMESPACE::DOMElement *dom) |
This function has to be implemented in derived class. | |
void | write (XERCES_CPP_NAMESPACE::DOMElement *dom) const |
This function has to be implemented in derived class. | |
virtual | ~CalibratedHistogramXML () |
This class does not provide methdos for calibration, i.e. [start|update|finish]Calibration() functions. If you want to use it in a calibration program you have to implement those methods in a child class.
Definition at line 18 of file CalibratedHistogramXML.h.
CalibratedHistogramXML::CalibratedHistogramXML | ( | ) | [inline] |
CalibratedHistogramXML::CalibratedHistogramXML | ( | const CalibratedHistogram & | h | ) | [inline] |
CalibratedHistogramXML::CalibratedHistogramXML | ( | const std::vector< float > & | ulimits | ) | [inline] |
Definition at line 23 of file CalibratedHistogramXML.h.
00023 : 00024 CalibratedHistogram ( ulimits) {} virtual ~CalibratedHistogramXML() {}
virtual CalibratedHistogramXML::~CalibratedHistogramXML | ( | ) | [inline, virtual] |
std::string CalibratedHistogramXML::name | ( | ) | const [inline, virtual] |
Return a name for your calibrated object.
It is used as XML tag name in reading and writing.
Implements CalibratedObject.
Definition at line 32 of file CalibratedHistogramXML.h.
void CalibratedHistogramXML::read | ( | XERCES_CPP_NAMESPACE::DOMElement * | dom | ) | [virtual] |
This function has to be implemented in derived class.
It should read all the information the calibrated objects need to load to be initialized from the xml file. It is possible to use CalibrationXML::readAttribute<type>() to read an attribute from the passed DOMElement.
Implements CalibratedObject.
Definition at line 6 of file CalibratedHistogramXML.cc.
References PhysicsTools::Calibration::Histogram< float >::binULimits, PhysicsTools::Calibration::Histogram< float >::binValues, PhysicsTools::Calibration::Histogram< float >::limits, size, and PhysicsTools::Calibration::Histogram< float >::totalValid.
00007 { 00008 binValues.clear(); 00009 binULimits.clear(); 00010 int size= CalibrationXML::readAttribute<int>(dom,"size"); 00011 00012 DOMNode * n1 = dom->getFirstChild(); 00013 int bin; 00014 for(bin=0; bin < size; bin ++) 00015 { 00016 while( ( n1->getNodeType() != DOMNode::ELEMENT_NODE ) && ( n1 != 0 ) ) n1 = n1->getNextSibling(); 00017 if (n1) 00018 { 00019 DOMElement * binElement = (DOMElement *) n1; 00020 binValues.push_back(CalibrationXML::readAttribute<double>(binElement,"value")); 00021 00022 binULimits.push_back(CalibrationXML::readAttribute<double>(binElement,"uLimit")); 00023 n1 = n1->getNextSibling(); 00024 } 00025 } 00026 if(bin>0) 00027 binValues.push_back(CalibrationXML::readAttribute<int>(dom,"overFlowValue")); 00028 00029 limits = Range(binULimits.front(), binULimits.back()); 00030 totalValid = false; 00031 }
void CalibratedHistogramXML::write | ( | XERCES_CPP_NAMESPACE::DOMElement * | dom | ) | const [virtual] |
This function has to be implemented in derived class.
It should write all the information the calibrated objects need to\ save/load. It is possible to use CalibrationXML::writeAttribute() to write an attribute in the passed DOMElement.
Implements CalibratedObject.
Definition at line 33 of file CalibratedHistogramXML.cc.
References CalibrationXML::addChild(), PhysicsTools::Calibration::Histogram< float >::binULimits, PhysicsTools::Calibration::Histogram< float >::binValues, size, and CalibrationXML::writeAttribute().
00034 { 00035 00036 int size=binULimits.size(); 00037 CalibrationXML::writeAttribute(dom,"size",size); 00038 DOMElement * binElement; 00039 for(int bin=0; bin < size; bin ++) 00040 { 00041 binElement = CalibrationXML::addChild(dom,"Bin"); 00042 CalibrationXML::writeAttribute(binElement,"value",binValues[bin]); 00043 CalibrationXML::writeAttribute(binElement,"uLimit",binULimits[bin]); 00044 } 00045 CalibrationXML::writeAttribute(dom,"overFlowValue",binValues[size]); 00046 00047 }