CMS 3D CMS Logo

Public Types | Public Member Functions

CalibratedHistogramXML Class Reference

#include <CalibratedHistogramXML.h>

Inheritance diagram for CalibratedHistogramXML:
CalibratedObject

List of all members.

Public Types

typedef
XERCES_CPP_NAMESPACE::DOMElement 
DOMElement
typedef
XERCES_CPP_NAMESPACE::DOMNode 
DOMNode

Public Member Functions

 CalibratedHistogramXML ()
 CalibratedHistogramXML (const CalibratedHistogram &h)
 CalibratedHistogramXML (const std::vector< float > &ulimits)
std::string name () const
void read (DOMElement *dom)
void write (DOMElement *dom) const
virtual ~CalibratedHistogramXML ()

Detailed Description

This class implements some methods of the CalibratedObject. 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.


Member Typedef Documentation

typedef XERCES_CPP_NAMESPACE::DOMElement CalibratedHistogramXML::DOMElement

Definition at line 21 of file CalibratedHistogramXML.h.

typedef XERCES_CPP_NAMESPACE::DOMNode CalibratedHistogramXML::DOMNode

Definition at line 22 of file CalibratedHistogramXML.h.


Constructor & Destructor Documentation

CalibratedHistogramXML::CalibratedHistogramXML ( ) [inline]

Definition at line 24 of file CalibratedHistogramXML.h.

{} 
CalibratedHistogramXML::CalibratedHistogramXML ( const CalibratedHistogram h) [inline]

Definition at line 25 of file CalibratedHistogramXML.h.

CalibratedHistogramXML::CalibratedHistogramXML ( const std::vector< float > &  ulimits) [inline]

Definition at line 26 of file CalibratedHistogramXML.h.

                                                                :
   CalibratedHistogram ( ulimits) {}
virtual CalibratedHistogramXML::~CalibratedHistogramXML ( ) [inline, virtual]

Definition at line 28 of file CalibratedHistogramXML.h.

{} 

Member Function Documentation

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 35 of file CalibratedHistogramXML.h.

  {
    return "CalibratedHistogramXML";
  }
void CalibratedHistogramXML::read ( 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 newFWLiteAna::bin, and findQualityFiles::size.

  {
    binValues.clear();
    binULimits.clear();
    int size=  CalibrationXML::readAttribute<int>(dom,"size");
    
    DOMNode * n1 = dom->getFirstChild();
    int bin;
    for(bin=0; bin < size; bin ++)
    {
        while( ( n1->getNodeType() != DOMNode::ELEMENT_NODE ) && ( n1 != 0 ) )   n1 = n1->getNextSibling();
          if (n1)
          {
              DOMElement * binElement = (DOMElement *) n1;
              binValues.push_back(CalibrationXML::readAttribute<double>(binElement,"value"));
        
              binULimits.push_back(CalibrationXML::readAttribute<double>(binElement,"uLimit"));      
               n1 = n1->getNextSibling();
          }             
    }
    if(bin>0)
      binValues.push_back(CalibrationXML::readAttribute<int>(dom,"overFlowValue"));

    limits = Range(binULimits.front(), binULimits.back());
    totalValid = false;
  }
void CalibratedHistogramXML::write ( 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(), newFWLiteAna::bin, findQualityFiles::size, and CalibrationXML::writeAttribute().

  {

    int size=binULimits.size();
    CalibrationXML::writeAttribute(dom,"size",size);
    DOMElement * binElement;
    for(int bin=0; bin < size; bin ++)
    {
       binElement = CalibrationXML::addChild(dom,"Bin");
       CalibrationXML::writeAttribute(binElement,"value",binValues[bin]);
       CalibrationXML::writeAttribute(binElement,"uLimit",binULimits[bin]);
    }
    CalibrationXML::writeAttribute(dom,"overFlowValue",binValues[size]);

  }