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

TwoDHistogram class. More...

#include "Histograms.h"

Public Member Functions

 TwoDHistogram (const unsigned int nBinsX, const float xLow, const float xHigh, const unsigned int nBinsY, const float yLow, const float yHigh)
 Constructor.
 
 TwoDHistogram (const TiXmlHandle *const pXmlHandle, const std::string &xmlElementName)
 Constructor.
 
 TwoDHistogram (const TwoDHistogram &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.
 
int GetNBinsY () const
 Get the number of y bins.
 
float GetYLow () const
 Get the min binned y value.
 
float GetYHigh () const
 Get the max binned y value.
 
float GetYBinWidth () const
 Get the y bin width.
 
float GetBinContent (const int binX, const int binY) const
 Get the content of a specified bin.
 
int GetBinNumberX (const float valueX) const
 Get the x bin number for a specified x value.
 
int GetMinBinNumberX () const
 Get the min x bin number of the histogram (ignores overflow and underflow bins)
 
int GetMaxBinNumberX () const
 Get the max x bin number of the histogram (ignores overflow and underflow bins)
 
int GetUnderflowBinNumberX () const
 Get the underflow x bin number of the histogram.
 
int GetOverflowBinNumberX () const
 Get the overflow x bin number of the histogram.
 
int GetBinNumberY (const float valueY) const
 Get the y bin number for a specified value.
 
int GetMinBinNumberY () const
 Get the min y bin number of the histogram (ignores overflow and underflow bins)
 
int GetMaxBinNumberY () const
 Get the max y bin number of the histogram (ignores overflow and underflow bins)
 
int GetUnderflowBinNumberY () const
 Get the underflow y bin number of the histogram.
 
int GetOverflowBinNumberY () const
 Get the overflow y 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 int yLowBin, const int yHighBin) 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, int &maximumBinY) const
 Get the maximum value in the histogram and the corresponding bin numbers (ignores overflow and underflow bins)
 
void GetMaximum (const int xLowBin, const int xHighBin, const int yLowBin, const int yHighBin, float &maximumValue, int &maximumBinX, int &maximumBinY) 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 int yLowBin, const int yHighBin) 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 x entries in the histogram (ignores overflow and underflow bins)
 
float GetStandardDeviationX (const int xLowBin, const int xHighBin, const int yLowBin, const int yHighBin) const
 Get the standard deviation of x entries in a specified range of the histogram (ignores overflow and underflow bins)
 
float GetMeanY () const
 Get the mean y value of entries in the histogram (ignores overflow and underflow bins)
 
float GetMeanY (const int xLowBin, const int xHighBin, const int yLowBin, const int yHighBin) const
 Get the mean y value of entries in a specified range of the histogram (ignores overflow and underflow bins)
 
float GetStandardDeviationY () const
 Get the standard deviation of y entries in the histogram (ignores overflow and underflow bins)
 
float GetStandardDeviationY (const int xLowBin, const int xHighBin, const int yLowBin, const int yHighBin) const
 Get the standard deviation of y entries in a specified range of the histogram (ignores overflow and underflow bins)
 
void SetBinContent (const int binX, const int binY, const float value)
 Set the contents of a specified bin.
 
void Fill (const float valueX, const float valueY, 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
 
typedef std::map< int, HistogramMapTwoDHistogramMap
 

Private Attributes

TwoDHistogramMap m_xyHistogramMap
 The x->y->value 2d histogram map.
 
TwoDHistogramMap m_yxHistogramMap
 The y->x->value 2d 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.
 
int m_nBinsY
 The number of y bins.
 
float m_yLow
 The min binned y value.
 
float m_yHigh
 The max binned y value.
 
float m_yBinWidth
 The y bin width.
 

Detailed Description

TwoDHistogram class.

Definition at line 252 of file Histograms.h.

Member Typedef Documentation

◆ HistogramMap

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

Definition at line 591 of file Histograms.h.

◆ TwoDHistogramMap

Definition at line 592 of file Histograms.h.

Constructor & Destructor Documentation

◆ TwoDHistogram() [1/3]

pandora::TwoDHistogram::TwoDHistogram ( const unsigned int  nBinsX,
const float  xLow,
const float  xHigh,
const unsigned int  nBinsY,
const float  yLow,
const float  yHigh 
)

Constructor.

Parameters
nBinsXnumber of x bins
xLowmin binned x value
xHighmax binned x value
nBinsYnumber of y bins
yLowmin binned y value
yHighmax binned y value

Definition at line 293 of file Histograms.cc.

◆ TwoDHistogram() [2/3]

pandora::TwoDHistogram::TwoDHistogram ( 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 315 of file Histograms.cc.

Here is the call graph for this function:

◆ TwoDHistogram() [3/3]

pandora::TwoDHistogram::TwoDHistogram ( const TwoDHistogram rhs)

Copy constructor.

Parameters
rhsthe histogram to copy

Definition at line 378 of file Histograms.cc.

Member Function Documentation

◆ Fill()

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

Add an entry to the histogram.

Parameters
valueXthe x value for the entry
valueYthe y value for the entry
weightthe weight associated with this entry

Definition at line 665 of file Histograms.cc.

Here is the call graph for this function:

◆ GetBinContent()

float pandora::TwoDHistogram::GetBinContent ( const int  binX,
const int  binY 
) const

Get the content of a specified bin.

Parameters
binXthe specified x bin number
binYthe specified y bin number
Returns
The content of the specified bin

Definition at line 394 of file Histograms.cc.

Here is the caller graph for this function:

◆ GetBinNumberX()

int pandora::TwoDHistogram::GetBinNumberX ( const float  valueX) const

Get the x bin number for a specified x value.

Parameters
valueXthe specified x value
Returns
The x bin number

Definition at line 410 of file Histograms.cc.

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

◆ GetBinNumberY()

int pandora::TwoDHistogram::GetBinNumberY ( const float  valueY) const

Get the y bin number for a specified value.

Parameters
valueYthe specified y value
Returns
The y bin number

Definition at line 427 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::TwoDHistogram::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 806 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::TwoDHistogram::GetCumulativeSum ( const int  xLowBin,
const int  xHighBin,
const int  yLowBin,
const int  yHighBin 
) 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
yLowBinbin at start of specified y range
yHighBinbin at end of specified y range
Returns
The cumulative sum

Definition at line 445 of file Histograms.cc.

Here is the call graph for this function:

◆ GetMaxBinNumberX()

int pandora::TwoDHistogram::GetMaxBinNumberX ( ) const
inline

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

Returns
The max x bin number

Definition at line 758 of file Histograms.h.

Here is the caller graph for this function:

◆ GetMaxBinNumberY()

int pandora::TwoDHistogram::GetMaxBinNumberY ( ) const
inline

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

Returns
The max y bin number

Definition at line 785 of file Histograms.h.

Here is the caller graph for this function:

◆ GetMaximum() [1/2]

void pandora::TwoDHistogram::GetMaximum ( const int  xLowBin,
const int  xHighBin,
const int  yLowBin,
const int  yHighBin,
float &  maximumValue,
int &  maximumBinX,
int &  maximumBinY 
) 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
yLowBinbin at start of specified y range
yHighBinbin at end of specified y range
maximumValueto receive the maximum value
maximumBinXto receive the x coordinate of the bin containing the maximum value
maximumBinYto receive the y coordinate of the bin containing the maximum value

Definition at line 472 of file Histograms.cc.

Here is the call graph for this function:

◆ GetMaximum() [2/2]

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

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

Parameters
maximumValueto receive the maximum value
maximumBinXto receive the x coordinate of the bin containing the maximum value
maximumBinYto receive the y coordinate of the bin containing the maximum value

Definition at line 813 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::TwoDHistogram::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 820 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::TwoDHistogram::GetMeanX ( const int  xLowBin,
const int  xHighBin,
const int  yLowBin,
const int  yHighBin 
) 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
yLowBinbin at start of specified y range
yHighBinbin at end of specified y range
Returns
The mean x value

Definition at line 506 of file Histograms.cc.

Here is the call graph for this function:

◆ GetMeanY() [1/2]

float pandora::TwoDHistogram::GetMeanY ( ) const
inline

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

Returns
The mean y value

Definition at line 834 of file Histograms.h.

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

◆ GetMeanY() [2/2]

float pandora::TwoDHistogram::GetMeanY ( const int  xLowBin,
const int  xHighBin,
const int  yLowBin,
const int  yHighBin 
) const

Get the mean y 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
yLowBinbin at start of specified y range
yHighBinbin at end of specified y range
Returns
The mean y value

Definition at line 580 of file Histograms.cc.

Here is the call graph for this function:

◆ GetMinBinNumberX()

int pandora::TwoDHistogram::GetMinBinNumberX ( ) const
inline

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

Returns
The min x bin number

Definition at line 751 of file Histograms.h.

Here is the caller graph for this function:

◆ GetMinBinNumberY()

int pandora::TwoDHistogram::GetMinBinNumberY ( ) const
inline

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

Returns
The min y bin number

Definition at line 778 of file Histograms.h.

Here is the caller graph for this function:

◆ GetNBinsX()

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

Get the number of x bins.

Returns
The number of x bins

Definition at line 696 of file Histograms.h.

◆ GetNBinsY()

int pandora::TwoDHistogram::GetNBinsY ( ) const
inline

Get the number of y bins.

Returns
The number of y bins

Definition at line 724 of file Histograms.h.

◆ GetOverflowBinNumberX()

int pandora::TwoDHistogram::GetOverflowBinNumberX ( ) const
inline

Get the overflow x bin number of the histogram.

Returns
The overflow x bin number

Definition at line 772 of file Histograms.h.

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

◆ GetOverflowBinNumberY()

int pandora::TwoDHistogram::GetOverflowBinNumberY ( ) const
inline

Get the overflow y bin number of the histogram.

Returns
The overflow y bin number

Definition at line 799 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::TwoDHistogram::GetStandardDeviationX ( ) const
inline

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

Returns
The standard deviation of x entries

Definition at line 827 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::TwoDHistogram::GetStandardDeviationX ( const int  xLowBin,
const int  xHighBin,
const int  yLowBin,
const int  yHighBin 
) 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
yLowBinbin at start of specified y range
yHighBinbin at end of specified y range
Returns
The standard deviation of x entries

Definition at line 541 of file Histograms.cc.

Here is the call graph for this function:

◆ GetStandardDeviationY() [1/2]

float pandora::TwoDHistogram::GetStandardDeviationY ( ) const
inline

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

Returns
The standard deviation of y entries

Definition at line 841 of file Histograms.h.

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

◆ GetStandardDeviationY() [2/2]

float pandora::TwoDHistogram::GetStandardDeviationY ( const int  xLowBin,
const int  xHighBin,
const int  yLowBin,
const int  yHighBin 
) const

Get the standard deviation of y 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
yLowBinbin at start of specified y range
yHighBinbin at end of specified y range
Returns
The standard deviation of y entries

Definition at line 615 of file Histograms.cc.

Here is the call graph for this function:

◆ GetUnderflowBinNumberX()

int pandora::TwoDHistogram::GetUnderflowBinNumberX ( ) const
inline

Get the underflow x bin number of the histogram.

Returns
The underflow x bin number

Definition at line 765 of file Histograms.h.

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

◆ GetUnderflowBinNumberY()

int pandora::TwoDHistogram::GetUnderflowBinNumberY ( ) const
inline

Get the underflow y bin number of the histogram.

Returns
The underflow y bin number

Definition at line 792 of file Histograms.h.

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

◆ GetXBinWidth()

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

Get the x bin width.

Returns
The x bin width

Definition at line 717 of file Histograms.h.

◆ GetXHigh()

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

Get the max binned x value.

Returns
The max binned x value

Definition at line 710 of file Histograms.h.

◆ GetXLow()

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

Get the min binned x value.

Returns
The min binned x value

Definition at line 703 of file Histograms.h.

◆ GetYBinWidth()

float pandora::TwoDHistogram::GetYBinWidth ( ) const
inline

Get the y bin width.

Returns
The y bin width

Definition at line 745 of file Histograms.h.

◆ GetYHigh()

float pandora::TwoDHistogram::GetYHigh ( ) const
inline

Get the max binned y value.

Returns
The max binned y value

Definition at line 738 of file Histograms.h.

◆ GetYLow()

float pandora::TwoDHistogram::GetYLow ( ) const
inline

Get the min binned y value.

Returns
The min binned y value

Definition at line 731 of file Histograms.h.

◆ Scale()

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

Scale contents of all histogram bins by a specified factor.

Parameters
scaleFactorthe scale factor

Definition at line 688 of file Histograms.cc.

◆ SetBinContent()

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

Set the contents of a specified bin.

Parameters
binXthe specified x bin number
binYthe specified y bin number
valuethe new value for the specified bin

Definition at line 654 of file Histograms.cc.

Here is the call graph for this function:

◆ WriteToXml()

void pandora::TwoDHistogram::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 709 of file Histograms.cc.

Here is the call graph for this function:

Member Data Documentation

◆ m_nBinsX

int pandora::TwoDHistogram::m_nBinsX
private

The number of x bins.

Definition at line 597 of file Histograms.h.

◆ m_nBinsY

int pandora::TwoDHistogram::m_nBinsY
private

The number of y bins.

Definition at line 602 of file Histograms.h.

◆ m_xBinWidth

float pandora::TwoDHistogram::m_xBinWidth
private

The x bin width.

Definition at line 600 of file Histograms.h.

◆ m_xHigh

float pandora::TwoDHistogram::m_xHigh
private

The max binned x value.

Definition at line 599 of file Histograms.h.

◆ m_xLow

float pandora::TwoDHistogram::m_xLow
private

The min binned x value.

Definition at line 598 of file Histograms.h.

◆ m_xyHistogramMap

TwoDHistogramMap pandora::TwoDHistogram::m_xyHistogramMap
private

The x->y->value 2d histogram map.

Definition at line 594 of file Histograms.h.

◆ m_yBinWidth

float pandora::TwoDHistogram::m_yBinWidth
private

The y bin width.

Definition at line 605 of file Histograms.h.

◆ m_yHigh

float pandora::TwoDHistogram::m_yHigh
private

The max binned y value.

Definition at line 604 of file Histograms.h.

◆ m_yLow

float pandora::TwoDHistogram::m_yLow
private

The min binned y value.

Definition at line 603 of file Histograms.h.

◆ m_yxHistogramMap

TwoDHistogramMap pandora::TwoDHistogram::m_yxHistogramMap
private

The y->x->value 2d histogram map.

Definition at line 595 of file Histograms.h.


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