Pandora
Pandora source code navigator
|
#include "Histograms.h"
Public Member Functions | |
Histogram (const unsigned int nBinsX, const float xLow, const float xHigh) | |
Constructor. | |
Histogram (const TiXmlHandle *const pXmlHandle, const std::string &xmlElementName) | |
Constructor. | |
Histogram (const Histogram &rhs) | |
Copy constructor. | |
int | GetNBinsX () const |
Get the number of x bins. | |
float | GetXLow () const |
Get the min binned x value. | |
float | GetXHigh () const |
Get the max binned x value. | |
float | GetXBinWidth () const |
Get the x bin width. | |
float | GetBinContent (const int binX) const |
Get the content of a specified bin. | |
int | GetBinNumber (const float valueX) const |
Get the bin number for a specified value. | |
int | GetMinBinNumber () const |
Get the min bin number of the histogram (ignores overflow and underflow bins) | |
int | GetMaxBinNumber () const |
Get the max bin number of the histogram (ignores overflow and underflow bins) | |
int | GetUnderflowBinNumber () const |
Get the underflow bin number of the histogram. | |
int | GetOverflowBinNumber () const |
Get the overflow bin number of the histogram. | |
float | GetCumulativeSum () const |
Get the cumulative sum of bin entries in the histogram (ignores overflow and underflow bins) | |
float | GetCumulativeSum (const int xLowBin, const int xHighBin) const |
Get the cumulative sum of bin entries in a specified range of the histogram (includes overflow and underflow bins if specified) | |
void | GetMaximum (float &maximumValue, int &maximumBinX) const |
Get the maximum value in the histogram and the corresponding bin number (ignores overflow and underflow bins) | |
void | GetMaximum (const int xLowBin, const int xHighBin, float &maximumValue, int &maximumBinX) const |
Get the maximum value in a specified range of the histogram and the corresponding bin numbers (includes overflow and underflow bins if specified) | |
float | GetMeanX () const |
Get the mean x value of entries in the histogram (ignores overflow and underflow bins) | |
float | GetMeanX (const int xLowBin, const int xHighBin) const |
Get the mean x value of entries in a specified range of the histogram (ignores overflow and underflow bins) | |
float | GetStandardDeviationX () const |
Get the standard deviation of entries in the histogram (ignores overflow and underflow bins) | |
float | GetStandardDeviationX (const int xLowBin, const int xHighBin) const |
Get the standard deviation of x entries in a specified range of the histogram (ignores overflow and underflow bins) | |
void | SetBinContent (const int binX, const float value) |
Set the contents of a specified bin. | |
void | Fill (const float valueX, const float weight=1.f) |
Add an entry to the histogram. | |
void | Scale (const float scaleFactor) |
Scale contents of all histogram bins by a specified factor. | |
void | WriteToXml (TiXmlDocument *const pTiXmlDocument, const std::string &xmlElementName) const |
Write the histogram to an xml document. | |
Private Types | |
typedef std::map< int, float > | HistogramMap |
Private Attributes | |
HistogramMap | m_histogramMap |
The histogram map. | |
int | m_nBinsX |
The number of x bins. | |
float | m_xLow |
The min binned x value. | |
float | m_xHigh |
The max binned x value. | |
float | m_xBinWidth |
The x bin width. | |
Histogram class.
Definition at line 24 of file Histograms.h.
|
private |
Definition at line 236 of file Histograms.h.
pandora::Histogram::Histogram | ( | const unsigned int | nBinsX, |
const float | xLow, | ||
const float | xHigh | ||
) |
Constructor.
nBinsX | number of x bins |
xLow | min binned x value |
xHigh | max binned x value |
Definition at line 23 of file Histograms.cc.
pandora::Histogram::Histogram | ( | const TiXmlHandle *const | pXmlHandle, |
const std::string & | xmlElementName | ||
) |
Constructor.
pXmlHandle | address of the handle for the xml element describing the histogram |
xmlElementName | the xml element name for the histogram |
Definition at line 40 of file Histograms.cc.
pandora::Histogram::Histogram | ( | const Histogram & | rhs | ) |
void pandora::Histogram::Fill | ( | const float | valueX, |
const float | weight = 1.f |
||
) |
Add an entry to the histogram.
valueX | the value for the entry |
weight | the weight associated with this entry |
Definition at line 232 of file Histograms.cc.
float pandora::Histogram::GetBinContent | ( | const int | binX | ) | const |
Get the content of a specified bin.
binX | the specified bin number |
Definition at line 91 of file Histograms.cc.
int pandora::Histogram::GetBinNumber | ( | const float | valueX | ) | const |
Get the bin number for a specified value.
valueX | the specified value |
Definition at line 103 of file Histograms.cc.
|
inline |
Get the cumulative sum of bin entries in the histogram (ignores overflow and underflow bins)
Definition at line 667 of file Histograms.h.
float pandora::Histogram::GetCumulativeSum | ( | const int | xLowBin, |
const int | xHighBin | ||
) | const |
Get the cumulative sum of bin entries in a specified range of the histogram (includes overflow and underflow bins if specified)
xLowBin | bin at start of specified x range |
xHighBin | bin at end of specified x range |
Definition at line 121 of file Histograms.cc.
|
inline |
Get the max bin number of the histogram (ignores overflow and underflow bins)
Definition at line 646 of file Histograms.h.
void pandora::Histogram::GetMaximum | ( | const int | xLowBin, |
const int | xHighBin, | ||
float & | maximumValue, | ||
int & | maximumBinX | ||
) | const |
Get the maximum value in a specified range of the histogram and the corresponding bin numbers (includes overflow and underflow bins if specified)
xLowBin | bin at start of specified x range |
xHighBin | bin at end of specified x range |
maximumValue | to receive the maximum value |
maximumBinX | to receive the coordinate of the bin containing the maximum value |
Definition at line 140 of file Histograms.cc.
|
inline |
Get the maximum value in the histogram and the corresponding bin number (ignores overflow and underflow bins)
maximumValue | to receive the maximum value |
maximumBinX | to receive the coordinate of the bin containing the maximum value |
Definition at line 674 of file Histograms.h.
|
inline |
Get the mean x value of entries in the histogram (ignores overflow and underflow bins)
Definition at line 681 of file Histograms.h.
float pandora::Histogram::GetMeanX | ( | const int | xLowBin, |
const int | xHighBin | ||
) | const |
Get the mean x value of entries in a specified range of the histogram (ignores overflow and underflow bins)
xLowBin | bin at start of specified x range |
xHighBin | bin at end of specified x range |
Definition at line 164 of file Histograms.cc.
|
inline |
Get the min bin number of the histogram (ignores overflow and underflow bins)
Definition at line 639 of file Histograms.h.
|
inline |
Get the number of x bins.
Definition at line 611 of file Histograms.h.
|
inline |
Get the overflow bin number of the histogram.
Definition at line 660 of file Histograms.h.
|
inline |
Get the standard deviation of entries in the histogram (ignores overflow and underflow bins)
Definition at line 688 of file Histograms.h.
float pandora::Histogram::GetStandardDeviationX | ( | const int | xLowBin, |
const int | xHighBin | ||
) | const |
Get the standard deviation of x entries in a specified range of the histogram (ignores overflow and underflow bins)
xLowBin | bin at start of specified x range |
xHighBin | bin at end of specified x range |
Definition at line 191 of file Histograms.cc.
|
inline |
Get the underflow bin number of the histogram.
Definition at line 653 of file Histograms.h.
|
inline |
Get the x bin width.
Definition at line 632 of file Histograms.h.
|
inline |
Get the max binned x value.
Definition at line 625 of file Histograms.h.
|
inline |
Get the min binned x value.
Definition at line 618 of file Histograms.h.
void pandora::Histogram::Scale | ( | const float | scaleFactor | ) |
Scale contents of all histogram bins by a specified factor.
scaleFactor | the scale factor |
Definition at line 251 of file Histograms.cc.
void pandora::Histogram::SetBinContent | ( | const int | binX, |
const float | value | ||
) |
Set the contents of a specified bin.
binX | the specified bin number |
value | the new value for the specified bin |
Definition at line 222 of file Histograms.cc.
void pandora::Histogram::WriteToXml | ( | TiXmlDocument *const | pTiXmlDocument, |
const std::string & | xmlElementName | ||
) | const |
Write the histogram to an xml document.
pTiXmlDocument | address of the xml document |
xmlElementName | the xml element name for the histogram |
Definition at line 261 of file Histograms.cc.
|
private |
The histogram map.
Definition at line 238 of file Histograms.h.
|
private |
The number of x bins.
Definition at line 240 of file Histograms.h.
|
private |
The x bin width.
Definition at line 243 of file Histograms.h.
|
private |
The max binned x value.
Definition at line 242 of file Histograms.h.
|
private |
The min binned x value.
Definition at line 241 of file Histograms.h.