Class for 2d histogram type representation of data. More...
#include <histogram.hpp>
Public Member Functions | |
| Histogram2D (uint32_t n, uint32_t m, const double range[4]) | |
| Constructor for n x m histogram with ranges. More... | |
| Histogram2D (uint32_t n, uint32_t m, const std::vector< double > &xdata, const std::vector< double > &ydata, histogram_accumulation_e type=HISTOGRAM_ACCUMULATION_CLOSEST) | |
| Constructor for n x m histogram from scatter xy-data with even weights. More... | |
| Histogram2D (uint32_t n, uint32_t m, const std::vector< double > &xdata, const std::vector< double > &ydata, const std::vector< double > &wdata, histogram_accumulation_e type=HISTOGRAM_ACCUMULATION_CLOSEST) | |
| Constructor for n x m histogram from scatter xy-data with weights from wdata. More... | |
| virtual | ~Histogram2D () |
| Destructor. More... | |
| uint32_t | n (void) const |
| Return the number of bins along the first axis. More... | |
| uint32_t | m (void) const |
| Return the number of bins along the second axis. More... | |
| double | nstep (void) const |
| Return the step size along along the first axis. More... | |
| double | mstep (void) const |
| Return the step size along along the second axis. More... | |
| double | icoord (uint32_t i) const |
| Return the coordinate along the first axis on bin i. More... | |
| double | jcoord (uint32_t j) const |
| Return the coordinate along the second axis on bin j. More... | |
| void | accumulate (uint32_t i, uint32_t j, double weight) |
| Accumulate weight on bin (i,j). More... | |
| void | accumulate_closest (double x, double y, double weight) |
| Accumulate weight to closest bin to (x,y). More... | |
| void | accumulate_linear (double x, double y, double weight) |
| Accumulate weight on bins around (x,y) linearly. More... | |
| void | convert_to_density (void) |
| Convert histogram to density. More... | |
| void | get_range (double range[4]) const |
| Return data range. More... | |
| void | get_bin_range (double &min, double &max) const |
| Return bin range. More... | |
| std::vector< double > & | get_data (void) |
| Return a reference to the histogram data. More... | |
| const std::vector< double > & | get_data (void) const |
| Return a reference to the histogram data. More... | |
| const double & | operator() (uint32_t i, uint32_t j) const |
| Return a const reference to the weight on bin (i,j). More... | |
| double & | operator() (uint32_t i, uint32_t j) |
| Return a reference to the weight on bin (i,j). More... | |
| const Histogram2D & | operator*= (double x) |
| Scale histogram. More... | |
Public Member Functions inherited from Histogram | |
| virtual | ~Histogram () |
| Destructor. More... | |
Detailed Description
Class for 2d histogram type representation of data.
Constructor & Destructor Documentation
| Histogram2D::Histogram2D | ( | uint32_t | n, |
| uint32_t | m, | ||
| const double | range[4] | ||
| ) |
Constructor for n x m histogram with ranges.
| Histogram2D::Histogram2D | ( | uint32_t | n, |
| uint32_t | m, | ||
| const std::vector< double > & | xdata, | ||
| const std::vector< double > & | ydata, | ||
| histogram_accumulation_e | type = HISTOGRAM_ACCUMULATION_CLOSEST |
||
| ) |
Constructor for n x m histogram from scatter xy-data with even weights.
Selected accumulation operator type is used. Defaults to closest bin accumulation.
| Histogram2D::Histogram2D | ( | uint32_t | n, |
| uint32_t | m, | ||
| const std::vector< double > & | xdata, | ||
| const std::vector< double > & | ydata, | ||
| const std::vector< double > & | wdata, | ||
| histogram_accumulation_e | type = HISTOGRAM_ACCUMULATION_CLOSEST |
||
| ) |
Constructor for n x m histogram from scatter xy-data with weights from wdata.
Selected accumulation operator type is used. Defaults to closest bin accumulation.
|
virtual |
Destructor.
Member Function Documentation
|
inline |
Accumulate weight on bin (i,j).
Not a safe function. Input not checked.
| void Histogram2D::accumulate_closest | ( | double | x, |
| double | y, | ||
| double | weight | ||
| ) |
Accumulate weight to closest bin to (x,y).
| void Histogram2D::accumulate_linear | ( | double | x, |
| double | y, | ||
| double | weight | ||
| ) |
Accumulate weight on bins around (x,y) linearly.
Accumulation is done on four neighbouring bins around point (x,y). The distribution of weight is done using inverse bilinear interpolation.
This is a safe function. Accumulation outside histogram range is discarded.
| void Histogram2D::convert_to_density | ( | void | ) |
Convert histogram to density.
Assuming the histogram has been filled with "counts", this function scales the counts to count density.
| void Histogram2D::get_bin_range | ( | double & | min, |
| double & | max | ||
| ) | const |
Return bin range.
Returns minimum and maximum values on any bin in histogram.
|
inline |
Return a reference to the histogram data.
The data is sored in x major order (data[i+j*n]).
|
inline |
Return a reference to the histogram data.
The data is sored in x major order (data[i+j*n]).
| void Histogram2D::get_range | ( | double | range[4] | ) | const |
Return data range.
| double Histogram2D::icoord | ( | uint32_t | i | ) | const |
Return the coordinate along the first axis on bin i.
| double Histogram2D::jcoord | ( | uint32_t | j | ) | const |
Return the coordinate along the second axis on bin j.
|
inline |
Return the number of bins along the second axis.
|
inline |
Return the step size along along the second axis.
|
inline |
Return the number of bins along the first axis.
|
inline |
Return the step size along along the first axis.
|
inline |
Return a const reference to the weight on bin (i,j).
|
inline |
Return a reference to the weight on bin (i,j).
| const Histogram2D & Histogram2D::operator*= | ( | double | x | ) |
Scale histogram.
The documentation for this class was generated from the following files:
Public Member Functions inherited from