IBSimu
1.0.4
|
Class for 1D histogram type representation of data. More...
#include <histogram.hpp>
Public Member Functions | |
Histogram1D (size_t n, const double range[2]) | |
Constructor for n bin histogram with ranges. | |
Histogram1D (size_t n, const std::vector< double > &xdata) | |
Constructor for n bin histogram from scatter data with even weights. | |
Histogram1D (size_t n, const std::vector< double > &xdata, const std::vector< double > &wdata) | |
Constructor for n bin histogram from scatter data with weights wrom wdata. | |
virtual | ~Histogram1D () |
Destructor. | |
size_t | n (void) const |
Return the number of bins. | |
double | step (void) const |
Return the step size. | |
double | coord (size_t i) const |
Return the coordinate on bin i. | |
void | accumulate (size_t i, double weight) |
Accumulate weight on bin i. | |
void | accumulate_linear (double x, double weight) |
Accumulate weight on bins around x linearly. | |
void | get_range (double range[2]) 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) const |
Return a const reference to the weight on bin i. | |
double & | operator() (size_t i) |
Return a reference to the weight on bin i. |
Class for 1D histogram type representation of data.
Histogram1D::Histogram1D | ( | size_t | n, |
const double | range[2] | ||
) |
Constructor for n bin histogram with ranges.
Histogram1D::Histogram1D | ( | size_t | n, |
const std::vector< double > & | xdata | ||
) |
Constructor for n bin histogram from scatter data with even weights.
Histogram1D::Histogram1D | ( | size_t | n, |
const std::vector< double > & | xdata, | ||
const std::vector< double > & | wdata | ||
) |
Constructor for n bin histogram from scatter data with weights wrom wdata.
virtual Histogram1D::~Histogram1D | ( | ) | [virtual] |
Destructor.
void Histogram1D::accumulate | ( | size_t | i, |
double | weight | ||
) | [inline] |
Accumulate weight on bin i.
Not a safe function. Input not checked.
void Histogram1D::accumulate_linear | ( | double | x, |
double | weight | ||
) |
Accumulate weight on bins around x linearly.
Accumulation is done on two neighbouring bins around point x. The distribution of weight is done using inverse linear interpolation.
This is a safe function. Accumulation outside histogram range is discarded.
double Histogram1D::coord | ( | size_t | i | ) | const [inline] |
Return the coordinate on bin i.
void Histogram1D::get_bin_range | ( | double & | min, |
double & | max | ||
) | const |
Return bin range.
Returns minimum and maximum values on any bin in histogram.
std::vector<double>& Histogram1D::get_data | ( | void | ) | [inline] |
Return a reference to the histogram data.
const std::vector<double>& Histogram1D::get_data | ( | void | ) | const [inline] |
Return a reference to the histogram data.
void Histogram1D::get_range | ( | double | range[2] | ) | const [inline] |
Return data range.
size_t Histogram1D::n | ( | void | ) | const [inline] |
Return the number of bins.
const double& Histogram1D::operator() | ( | size_t | i | ) | const [inline] |
Return a const reference to the weight on bin i.
double& Histogram1D::operator() | ( | size_t | i | ) | [inline] |
Return a reference to the weight on bin i.
double Histogram1D::step | ( | void | ) | const [inline] |
Return the step size.