Pandora
Pandora source code navigator
Loading...
Searching...
No Matches
pandora::Histogram Class Reference

Histogram class. More...

#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.
 

Detailed Description

Histogram class.

Definition at line 24 of file Histograms.h.

Member Typedef Documentation

◆ HistogramMap

typedef std::map<int, float> pandora::Histogram::HistogramMap
private

Definition at line 236 of file Histograms.h.

Constructor & Destructor Documentation

◆ Histogram() [1/3]

pandora::Histogram::Histogram ( const unsigned int  nBinsX,
const float  xLow,
const float  xHigh 
)

Constructor.

Parameters
nBinsXnumber of x bins
xLowmin binned x value
xHighmax binned x value

Definition at line 23 of file Histograms.cc.

◆ Histogram() [2/3]

pandora::Histogram::Histogram ( const TiXmlHandle *const  pXmlHandle,
const std::string &  xmlElementName 
)

Constructor.

Parameters
pXmlHandleaddress of the handle for the xml element describing the histogram
xmlElementNamethe xml element name for the histogram

Definition at line 40 of file Histograms.cc.

Here is the call graph for this function:

◆ Histogram() [3/3]

pandora::Histogram::Histogram ( const Histogram rhs)

Copy constructor.

Parameters
rhsthe histogram to copy

Definition at line 80 of file Histograms.cc.

Member Function Documentation

◆ Fill()

void pandora::Histogram::Fill ( const float  valueX,
const float  weight = 1.f 
)

Add an entry to the histogram.

Parameters
valueXthe value for the entry
weightthe weight associated with this entry

Definition at line 232 of file Histograms.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetBinContent()

float pandora::Histogram::GetBinContent ( const int  binX) const

Get the content of a specified bin.

Parameters
binXthe specified bin number
Returns
The content of the specified bin

Definition at line 91 of file Histograms.cc.

Here is the caller graph for this function:

◆ GetBinNumber()

int pandora::Histogram::GetBinNumber ( const float  valueX) const

Get the bin number for a specified value.

Parameters
valueXthe specified value
Returns
The bin number

Definition at line 103 of file Histograms.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetCumulativeSum() [1/2]

float pandora::Histogram::GetCumulativeSum ( ) const
inline

Get the cumulative sum of bin entries in the histogram (ignores overflow and underflow bins)

Returns
The cumulative sum

Definition at line 667 of file Histograms.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetCumulativeSum() [2/2]

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)

Parameters
xLowBinbin at start of specified x range
xHighBinbin at end of specified x range
Returns
The cumulative sum

Definition at line 121 of file Histograms.cc.

Here is the call graph for this function:

◆ GetMaxBinNumber()

int pandora::Histogram::GetMaxBinNumber ( ) const
inline

Get the max bin number of the histogram (ignores overflow and underflow bins)

Returns
The max bin number

Definition at line 646 of file Histograms.h.

Here is the caller graph for this function:

◆ GetMaximum() [1/2]

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)

Parameters
xLowBinbin at start of specified x range
xHighBinbin at end of specified x range
maximumValueto receive the maximum value
maximumBinXto receive the coordinate of the bin containing the maximum value

Definition at line 140 of file Histograms.cc.

Here is the call graph for this function:

◆ GetMaximum() [2/2]

void pandora::Histogram::GetMaximum ( float &  maximumValue,
int &  maximumBinX 
) const
inline

Get the maximum value in the histogram and the corresponding bin number (ignores overflow and underflow bins)

Parameters
maximumValueto receive the maximum value
maximumBinXto receive the coordinate of the bin containing the maximum value

Definition at line 674 of file Histograms.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetMeanX() [1/2]

float pandora::Histogram::GetMeanX ( ) const
inline

Get the mean x value of entries in the histogram (ignores overflow and underflow bins)

Returns
The mean x value

Definition at line 681 of file Histograms.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetMeanX() [2/2]

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)

Parameters
xLowBinbin at start of specified x range
xHighBinbin at end of specified x range
Returns
The mean x value

Definition at line 164 of file Histograms.cc.

Here is the call graph for this function:

◆ GetMinBinNumber()

int pandora::Histogram::GetMinBinNumber ( ) const
inline

Get the min bin number of the histogram (ignores overflow and underflow bins)

Returns
The min bin number

Definition at line 639 of file Histograms.h.

Here is the caller graph for this function:

◆ GetNBinsX()

int pandora::Histogram::GetNBinsX ( ) const
inline

Get the number of x bins.

Returns
The number of x bins

Definition at line 611 of file Histograms.h.

Here is the caller graph for this function:

◆ GetOverflowBinNumber()

int pandora::Histogram::GetOverflowBinNumber ( ) const
inline

Get the overflow bin number of the histogram.

Returns
The overflow bin number

Definition at line 660 of file Histograms.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetStandardDeviationX() [1/2]

float pandora::Histogram::GetStandardDeviationX ( ) const
inline

Get the standard deviation of entries in the histogram (ignores overflow and underflow bins)

Returns
The standard deviation of x entries

Definition at line 688 of file Histograms.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetStandardDeviationX() [2/2]

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)

Parameters
xLowBinbin at start of specified x range
xHighBinbin at end of specified x range
Returns
The standard deviation of x entries

Definition at line 191 of file Histograms.cc.

Here is the call graph for this function:

◆ GetUnderflowBinNumber()

int pandora::Histogram::GetUnderflowBinNumber ( ) const
inline

Get the underflow bin number of the histogram.

Returns
The underflow bin number

Definition at line 653 of file Histograms.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetXBinWidth()

float pandora::Histogram::GetXBinWidth ( ) const
inline

Get the x bin width.

Returns
The x bin width

Definition at line 632 of file Histograms.h.

Here is the caller graph for this function:

◆ GetXHigh()

float pandora::Histogram::GetXHigh ( ) const
inline

Get the max binned x value.

Returns
The max binned x value

Definition at line 625 of file Histograms.h.

◆ GetXLow()

float pandora::Histogram::GetXLow ( ) const
inline

Get the min binned x value.

Returns
The min binned x value

Definition at line 618 of file Histograms.h.

Here is the caller graph for this function:

◆ Scale()

void pandora::Histogram::Scale ( const float  scaleFactor)

Scale contents of all histogram bins by a specified factor.

Parameters
scaleFactorthe scale factor

Definition at line 251 of file Histograms.cc.

Here is the caller graph for this function:

◆ SetBinContent()

void pandora::Histogram::SetBinContent ( const int  binX,
const float  value 
)

Set the contents of a specified bin.

Parameters
binXthe specified bin number
valuethe new value for the specified bin

Definition at line 222 of file Histograms.cc.

Here is the call graph for this function:

◆ WriteToXml()

void pandora::Histogram::WriteToXml ( TiXmlDocument *const  pTiXmlDocument,
const std::string &  xmlElementName 
) const

Write the histogram to an xml document.

Parameters
pTiXmlDocumentaddress of the xml document
xmlElementNamethe xml element name for the histogram

Definition at line 261 of file Histograms.cc.

Here is the call graph for this function:

Member Data Documentation

◆ m_histogramMap

HistogramMap pandora::Histogram::m_histogramMap
private

The histogram map.

Definition at line 238 of file Histograms.h.

◆ m_nBinsX

int pandora::Histogram::m_nBinsX
private

The number of x bins.

Definition at line 240 of file Histograms.h.

◆ m_xBinWidth

float pandora::Histogram::m_xBinWidth
private

The x bin width.

Definition at line 243 of file Histograms.h.

◆ m_xHigh

float pandora::Histogram::m_xHigh
private

The max binned x value.

Definition at line 242 of file Histograms.h.

◆ m_xLow

float pandora::Histogram::m_xLow
private

The min binned x value.

Definition at line 241 of file Histograms.h.


The documentation for this class was generated from the following files: