test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions
CalibratedHistogramXML Class Reference

#include <CalibratedHistogramXML.h>

Inheritance diagram for CalibratedHistogramXML:
PhysicsTools::Calibration::Histogram< float > CalibratedObject

Public Types

typedef
XERCES_CPP_NAMESPACE::DOMElement 
DOMElement
 
typedef
XERCES_CPP_NAMESPACE::DOMNode 
DOMNode
 
- Public Types inherited from PhysicsTools::Calibration::Histogram< float >
typedef
PhysicsTools::Calibration::Range
< float > 
Range
 

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 ()
 
- Public Member Functions inherited from PhysicsTools::Calibration::Histogram< float >
float binContent (int bin) const
 
float binError (int bin) const
 
Range binRange (int bin) const
 
bool empty () const
 
float error (floatx) const
 
void fill (floatx, floatweight=1.0)
 
int findBin (floatx) const
 
bool hasEquidistantBins () const
 
 Histogram ()
 
 Histogram (const Histogram &orig)
 
 Histogram (const Histogram< OValue_t, OAxis_t > &orig)
 
 Histogram (const std::vector< float > &binULimits)
 
 Histogram (const std::vector< OAxis_t > &binULimits)
 
 Histogram (unsigned int nBins, const PhysicsTools::Calibration::Range< OAxis_t > &range)
 
 Histogram (unsigned int nBins, floatmin, floatmax)
 
float integral (floathBound, floatlBound=0.0, int mode=1) const
 
float normalization () const
 
float normalizedError (floatx) const
 
float normalizedIntegral (floathBound, floatlBound=0.0, int mode=1) const
 
float normalizedValue (floatx) const
 
int numberOfBins () const
 
Histogramoperator= (const Histogram &orig)
 
Histogramoperator= (const Histogram< OValue_t, OAxis_t > &orig)
 
Range range () const
 
void reset ()
 
void setBinContent (int bin, floatvalue)
 
void setValues (const std::vector< float > &values)
 
void setValues (const std::vector< OValue_t > &values)
 
const std::vector< float > upperLimits () const
 
float value (floatx) const
 
const std::vector< float > & values () const
 
 ~Histogram ()
 

Additional Inherited Members

- Protected Attributes inherited from PhysicsTools::Calibration::Histogram< float >
std::vector< float > binULimits
 
std::vector< float > binValues
 
Range limits
 
float total
 
std::atomic< bool > totalValid
 
- Private Member Functions inherited from CalibratedObject
virtual void finishCalibration ()
 
virtual void startCalibration ()
 
virtual void updateCalibration ()
 

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.

24 {}
CalibratedHistogramXML::CalibratedHistogramXML ( const CalibratedHistogram h)
inline

Definition at line 25 of file CalibratedHistogramXML.h.

25 :CalibratedHistogram(h) {}
PhysicsTools::Calibration::HistogramF CalibratedHistogram
CalibratedHistogramXML::CalibratedHistogramXML ( const std::vector< float > &  ulimits)
inline

Definition at line 26 of file CalibratedHistogramXML.h.

26  :
27  CalibratedHistogram ( ulimits) {}
PhysicsTools::Calibration::HistogramF CalibratedHistogram
virtual CalibratedHistogramXML::~CalibratedHistogramXML ( )
inlinevirtual

Definition at line 28 of file CalibratedHistogramXML.h.

28 {}

Member Function Documentation

std::string CalibratedHistogramXML::name ( ) const
inlinevirtual

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.

Referenced by cuy.divideElement::__init__(), cuy.plotElement::__init__(), cuy.additionElement::__init__(), cuy.superimposeElement::__init__(), cuy.graphElement::__init__(), config.CFG::__str__(), and validation.Sample::digest().

36  {
37  return "CalibratedHistogramXML";
38  }
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, contentValuesFiles::dom, and findQualityFiles::size.

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  }
PhysicsTools::Calibration::Range< float > Range
Definition: Histogram.h:38
XERCES_CPP_NAMESPACE::DOMNode DOMNode
XERCES_CPP_NAMESPACE::DOMElement DOMElement
tuple size
Write out results.
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().

34  {
35 
36  int size=binULimits.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  }
static void writeAttribute(DOMElement *dom, const std::string &name, const T &value)
static DOMElement * addChild(DOMNode *dom, const std::string &name)
XERCES_CPP_NAMESPACE::DOMElement DOMElement
tuple size
Write out results.