27 const std::vector<double>& ybins)
101 const std::unique_ptr<IAxis> xaxis(
getXaxis().createClippedAxis(xmin, xmax));
102 const std::unique_ptr<IAxis> yaxis(
getYaxis().createClippedAxis(ymin, ymax));
111 *it_result = *it_origin;
128 const size_t nrows = shape.first;
129 const size_t ncols = shape.second;
132 std::ostringstream ostr;
133 ostr <<
"Histogram2D::addContent() -> Shape of input array [" << nrows <<
", " << ncols
134 <<
"] doesn't mach histogram axes. "
140 for (
size_t row = 0; row < nrows; ++row) {
141 for (
size_t col = 0; col < ncols; ++col) {
142 size_t globalbin = nrows - row - 1 + col * nrows;
143 m_data[globalbin].add(data[row][col]);
156 if (ybin >= ybinlow && ybin <= ybinup) {
171 if (xbin >= xbinlow && xbin <= xbinup) {
Defines class Histogram1D.
Defines class Histogram2D.
Defines class VariableBinAxis.
Axis with fixed bin size.
One dimensional histogram.
int fill(double x, double weight=1.0)
Increment bin with abscissa x with a weight.
Two dimensional histogram.
Histogram1D * create_projectionY(int xbinlow, int xbinup)
Creates projection along Y.
void setContent(const std::vector< std::vector< double >> &data)
Sets the values in histograms channels from numpy array,.
int fill(double x, double y, double weight=1.0)
Increment bin with abscissa x and ordinate y with a weight.
void addContent(const std::vector< std::vector< double >> &data)
Add to values in histograms channels from numpy array,.
Histogram1D * projectionY()
Project a 2D histogram into 1D histogram along Y.
void initFromShape(const T &data)
Histogram2D * crop(double xmin, double ymin, double xmax, double ymax)
Creates new histogram by applying rectangular clip.
Histogram1D * projectionX()
Project a 2D histogram into 1D histogram along X.
Histogram2D(int nbinsx, double xlow, double xup, int nbinsy, double ylow, double yup)
Constructor for fix bin size histograms.
Histogram1D * create_projectionX(int ybinlow, int ybinup)
Creates projection along X.
Histogram2D * clone() const
Returns clone of other histogram.
Interface for one-dimensional axes.
virtual bool contains(double value) const
Returns true if axis contains given point.
virtual size_t findClosestIndex(double value) const =0
find bin index which is best match for given value
virtual size_t size() const =0
retrieve the number of bins
Base class for 1D and 2D histograms holding values of double type.
double getYaxisValue(size_t i)
Returns the center of bin i of the y axis.
OutputData< CumulativeValue > m_data
double getBinContent(size_t i) const
Returns content (accumulated value) of bin i.
size_t getYaxisIndex(size_t i) const
Returns y-axis index for global bin index i.
size_t getTotalNumberOfBins() const
Returns total number of histogram bins.
size_t getXaxisIndex(size_t i) const
Returns x-axis index for global bin index i.
const IAxis & getYaxis() const
returns y-axis for 2D histograms
void reset()
Reset histogram content (axes remains)
double getXaxisValue(size_t i)
Returns the center of bin i of the x axis.
void init_from_data(const OutputData< double > &source)
const IAxis & getXaxis() const
returns x-axis
iterator end()
Returns read/write iterator that points to the one past last element.
size_t findGlobalIndex(const std::vector< double > &coordinates) const
Returns global index for specified axes values.
void addAxis(const IAxis &new_axis)
const IAxis & getAxis(size_t serial_number) const
returns axis with given serial number
iterator begin()
Returns read/write iterator that points to the first element.
double getAxisValue(size_t global_index, size_t i_selected_axis) const
Returns the value of selected axis for given global_index.
Axis with variable bin size.
std::pair< size_t, size_t > getShape(const T &data)
Returns shape nrows, ncols of 2D array.