CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions
CalibratedHistogramXML Class Reference

#include <CalibratedHistogramXML.h>

Inheritance diagram for CalibratedHistogramXML:
PhysicsTools::Calibration::Histogram< Value_t, Axis_t > CalibratedObject

Public Types

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

Public Member Functions

 CalibratedHistogramXML ()
 
 CalibratedHistogramXML (const CalibratedHistogram &h)
 
 CalibratedHistogramXML (const std::vector< float > &ulimits)
 
std::string name () const override
 
void read (DOMElement *dom) override
 
void write (DOMElement *dom) const override
 
 ~CalibratedHistogramXML () override
 
- Public Member Functions inherited from PhysicsTools::Calibration::Histogram< Value_t, Axis_t >
Value_t binContent (int bin) const
 
Value_t binError (int bin) const
 
Range binRange (int bin) const
 
bool empty () const
 
Value_t error (Axis_t x) const
 
void fill (Axis_t x, Value_t weight=1.0)
 
int findBin (Axis_t x) const
 
bool hasEquidistantBins () const
 
 Histogram ()
 
 Histogram (const Histogram &orig)
 
template<typename OValue_t , typename OAxis_t >
 Histogram (const Histogram< OValue_t, OAxis_t > &orig)
 
 Histogram (const std::vector< Axis_t > &binULimits)
 
template<typename OAxis_t >
 Histogram (const std::vector< OAxis_t > &binULimits)
 
 Histogram (unsigned int nBins, Axis_t min, Axis_t max)
 
template<typename OAxis_t >
 Histogram (unsigned int nBins, const PhysicsTools::Calibration::Range< OAxis_t > &range)
 
Value_t integral (Axis_t hBound, Axis_t lBound=0.0, int mode=1) const
 
Value_t normalization () const
 
Value_t normalizedError (Axis_t x) const
 
Value_t normalizedIntegral (Axis_t hBound, Axis_t lBound=0.0, int mode=1) const
 
Value_t normalizedValue (Axis_t x) const
 
int numberOfBins () const
 
Histogramoperator= (const Histogram &orig)
 
template<typename OValue_t , typename OAxis_t >
Histogramoperator= (const Histogram< OValue_t, OAxis_t > &orig)
 
Range range () const
 
void reset ()
 
void setBinContent (int bin, Value_t value)
 
template<typename OValue_t >
void setValues (const std::vector< OValue_t > &values)
 
void setValues (const std::vector< Value_t > &values)
 
const std::vector< Axis_t > upperLimits () const
 
Value_t value (Axis_t x) const
 
const std::vector< Value_t > & values () const
 
 ~Histogram ()
 

Additional Inherited Members

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

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

Member Typedef Documentation

◆ DOMElement

typedef XERCES_CPP_NAMESPACE::DOMElement CalibratedHistogramXML::DOMElement

Definition at line 19 of file CalibratedHistogramXML.h.

◆ DOMNode

typedef XERCES_CPP_NAMESPACE::DOMNode CalibratedHistogramXML::DOMNode

Definition at line 20 of file CalibratedHistogramXML.h.

Constructor & Destructor Documentation

◆ CalibratedHistogramXML() [1/3]

CalibratedHistogramXML::CalibratedHistogramXML ( )
inline

Definition at line 22 of file CalibratedHistogramXML.h.

22 {}

◆ CalibratedHistogramXML() [2/3]

CalibratedHistogramXML::CalibratedHistogramXML ( const CalibratedHistogram h)
inline

Definition at line 23 of file CalibratedHistogramXML.h.

◆ CalibratedHistogramXML() [3/3]

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

Definition at line 24 of file CalibratedHistogramXML.h.

24 : CalibratedHistogram(ulimits) {}

◆ ~CalibratedHistogramXML()

CalibratedHistogramXML::~CalibratedHistogramXML ( )
inlineoverride

Definition at line 25 of file CalibratedHistogramXML.h.

25 {}

Member Function Documentation

◆ name()

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

Return a name for your calibrated object. It is used as XML tag name in reading and writing.

Implements CalibratedObject.

Definition at line 31 of file CalibratedHistogramXML.h.

31 { return "CalibratedHistogramXML"; }

Referenced by config.CFG::__str__(), and validation.Sample::digest().

◆ read()

void CalibratedHistogramXML::read ( DOMElement dom)
overridevirtual

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.

6  {
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 }

References newFWLiteAna::bin, contentValuesFiles::dom, TH2PolyOfflineMaps::limits, and std::size().

◆ write()

void CalibratedHistogramXML::write ( DOMElement dom) const
overridevirtual

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 31 of file CalibratedHistogramXML.cc.

31  {
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  }
41 }

References CalibrationXML::addChild(), newFWLiteAna::bin, contentValuesFiles::dom, std::size(), and CalibrationXML::writeAttribute().

PhysicsTools::Calibration::Histogram::limits
Range limits
Definition: Histogram.h:103
contentValuesFiles.dom
dom
Definition: contentValuesFiles.py:50
PhysicsTools::Calibration::Histogram::Range
PhysicsTools::Calibration::Range< Axis_t > Range
Definition: Histogram.h:37
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
PhysicsTools::Calibration::Histogram::totalValid
std::atomic< bool > totalValid
Definition: Histogram.h:108
CalibratedHistogramXML::DOMElement
XERCES_CPP_NAMESPACE::DOMElement DOMElement
Definition: CalibratedHistogramXML.h:19
CalibratedHistogram
PhysicsTools::Calibration::HistogramF CalibratedHistogram
Definition: CalibratedHistogram.h:6
h
PhysicsTools::Calibration::Histogram::binValues
std::vector< Value_t > binValues
Definition: Histogram.h:102
newFWLiteAna.bin
bin
Definition: newFWLiteAna.py:161
PhysicsTools::Calibration::Histogram::binULimits
std::vector< Axis_t > binULimits
Definition: Histogram.h:101
CalibratedHistogramXML::DOMNode
XERCES_CPP_NAMESPACE::DOMNode DOMNode
Definition: CalibratedHistogramXML.h:20
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443