Class for 2d histogram type representation of data. More...
#include <histogram.hpp>
Public Member Functions | |
Histogram2D (size_t n, size_t m, const double range[4]) | |
Constructor for n x m histogram with ranges. | |
Histogram2D (size_t n, size_t m, const std::vector< double > &xdata, const std::vector< double > &ydata) | |
Constructor for n x m histogram from scatter xy-data with even weights. | |
Histogram2D (size_t n, size_t m, const std::vector< double > &xdata, const std::vector< double > &ydata, const std::vector< double > &wdata) | |
Constructor for n x m histogram from scatter xy-data with weights from wdata. | |
virtual | ~Histogram2D () |
Destructor. | |
size_t | n (void) const |
Return the number of bins along the first axis. | |
size_t | m (void) const |
Return the number of bins along the second axis. | |
double | nstep (void) const |
Return the step size along along the first axis. | |
double | mstep (void) const |
Return the step size along along the second axis. | |
double | icoord (size_t i) const |
Return the coordinate along the first axis on bin i. | |
double | jcoord (size_t j) const |
Return the coordinate along the second axis on bin j. | |
void | accumulate (size_t i, size_t j, double weight) |
Accumulate weight on bin (i,j). | |
void | accumulate_linear (double x, double y, double weight) |
Accumulate weight on bins around (x,y) linearly. | |
void | get_range (double range[4]) const |
Return data range. | |
void | get_bin_range (double &min, double &max) const |
Return bin range. | |
std::vector< double > & | get_data (void) |
Return a reference to the histogram data. | |
const std::vector< double > & | get_data (void) const |
Return a reference to the histogram data. | |
const double & | operator() (size_t i, size_t j) const |
Return a const reference to the weight on bin (i,j). | |
double & | operator() (size_t i, size_t j) |
Return a reference to the weight on bin (i,j). |
Class for 2d histogram type representation of data.
Histogram2D::Histogram2D | ( | size_t | n, | |
size_t | m, | |||
const double | range[4] | |||
) |
Constructor for n x m histogram with ranges.
Histogram2D::Histogram2D | ( | size_t | n, | |
size_t | m, | |||
const std::vector< double > & | xdata, | |||
const std::vector< double > & | ydata | |||
) |
Constructor for n x m histogram from scatter xy-data with even weights.
Histogram2D::Histogram2D | ( | size_t | n, | |
size_t | m, | |||
const std::vector< double > & | xdata, | |||
const std::vector< double > & | ydata, | |||
const std::vector< double > & | wdata | |||
) |
Constructor for n x m histogram from scatter xy-data with weights from wdata.
virtual Histogram2D::~Histogram2D | ( | ) | [virtual] |
Destructor.
void Histogram2D::accumulate | ( | size_t | i, | |
size_t | j, | |||
double | weight | |||
) | [inline] |
Accumulate weight on bin (i,j).
Not a safe function. Input not checked.
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::get_bin_range | ( | double & | min, | |
double & | max | |||
) | const |
Return bin range.
Returns minimum and maximum values on any bin in histogram.
const std::vector<double>& Histogram2D::get_data | ( | void | ) | const [inline] |
Return a reference to the histogram data.
std::vector<double>& Histogram2D::get_data | ( | void | ) | [inline] |
Return a reference to the histogram data.
void Histogram2D::get_range | ( | double | range[4] | ) | const [inline] |
Return data range.
double Histogram2D::icoord | ( | size_t | i | ) | const [inline] |
Return the coordinate along the first axis on bin i.
double Histogram2D::jcoord | ( | size_t | j | ) | const [inline] |
Return the coordinate along the second axis on bin j.
size_t Histogram2D::m | ( | void | ) | const [inline] |
Return the number of bins along the second axis.
double Histogram2D::mstep | ( | void | ) | const [inline] |
Return the step size along along the second axis.
size_t Histogram2D::n | ( | void | ) | const [inline] |
Return the number of bins along the first axis.
double Histogram2D::nstep | ( | void | ) | const [inline] |
Return the step size along along the first axis.
double& Histogram2D::operator() | ( | size_t | i, | |
size_t | j | |||
) | [inline] |
Return a reference to the weight on bin (i,j).
const double& Histogram2D::operator() | ( | size_t | i, | |
size_t | j | |||
) | const [inline] |
Return a const reference to the weight on bin (i,j).