#include <Bins2DHist.h>
Inheritance diagram for Bins2DHist:
Paul F. Kunz <Paul_Kunz@slac.stanford.edu>
Matan Shacham <matan@slac.stanford.edu>
Oded Wurman <owurman@stanford.edu>
Definition at line 26 of file Bins2DHist.h.
Public Member Functions | |
virtual void | accumulate (double x, double y, double w=1.0, double dummy=0.) |
Accumulates the data point (x, y) with weight w. | |
Bins2DHist (const Bins2DHist &binner) | |
The copy constructor. | |
Bins2DHist () | |
The default constructor. | |
virtual double | binWidth (hippodraw::Axes::Type axis) const |
Returns the bin width parameter on the specified axis. | |
double | binWidthX (int i) const |
Gets the bin width of the X bin for the i bin. | |
double | binWidthY (int i) const |
Gets the bin width of the Y bin for the i bin. | |
double | calcBinWidth (const std::string &axis, int parm, bool dragging) const |
Calculates the bin width parameter from dragging slider. | |
virtual double | calcOffset (const std::string &, int parm, bool dragging) const |
Calculates and returns a new range from dragging slider. | |
BinsBase * | clone () const |
The clone function returns an object of its own kind which is a copy of this object at this moment. | |
virtual NTuple * | createNTuple () const |
Creates an NTuple. | |
virtual void | fillDataSource (DataSource *ntuple) const |
Fills the DataSource. | |
virtual void | fillProjectedValues (DataSource *ntuple) const |
Fills the NTuple. | |
virtual const BinnerAxis * | getBinnerOn (hippodraw::Axes::Type axis) const |
Returns the BinnerAxis object used by this object. | |
virtual int | getNumberOfAxes () const |
Returns the number of axes handled by the BinsBase derived class. | |
virtual int | getNumberOfEntries () const |
Returns the true number of entries. | |
virtual double | getOffset (hippodraw::Axes::Type axis) const |
Returns the offset parameter on specific axis. | |
virtual const Range & | getRange (hippodraw::Axes::Type axis) |
Returns range from binner axis. | |
virtual double | getZValue (double x, double y) const |
Get the z value at the specified point (x,y). | |
virtual bool | hasEqualWidths () const |
Returns true if all bins have the same width. | |
bool | isDirty () |
Returns true if the re-accumulation is needed. | |
bool | isEmpty () const |
Returns true if no accumulation has yet occurred, otherwise returns false . | |
const std::string & | name () const |
Returns the name of the Bins container object. | |
int | numberOfBins () const |
Returns the number of bins. | |
virtual int | numberOfBins (hippodraw::Axes::Type axis) const |
Returns the number of bins on specified axis. | |
virtual void | reset () |
Resets the accumulation to zero. | |
virtual double | scaleFactor () const |
Returns the scale factor. | |
virtual void | scaleNumberOfEntries (double number) |
Sets a scale factor on the output so that the number of entries appears to be number. | |
virtual void | setBinContents (const DataSource *ntuple) |
Sets the contents of the bins from the ntuple. | |
void | setBinnerOn (BinnerAxis *, hippodraw::Axes::Type axis) |
Sets a new BinnerAxis on the axis axis for the binner to use. | |
virtual const Range & | setBinWidth (hippodraw::Axes::Type axis, double value) |
Sets the bin width parameter on the specified axis. | |
void | setDirty () |
Sets a flag to indicate that re-binning needs to be done. | |
virtual void | setEntriesScaling (bool on) |
Sets the scaling number of entries on if on is true , otherwise turns if off. | |
virtual void | setNumberOfBins (hippodraw::Axes::Type axis, int number) |
Sets the number of bins on the the specified axis. | |
virtual void | setOffset (hippodraw::Axes::Type axis, double value) |
Sets the offset parameter on the specified axis. | |
virtual const Range & | setRange (hippodraw::Axes::Type axis, const Range &, bool hold_width=true) |
Sets the Range on the specified axis. | |
~Bins2DHist () | |
The destructor. | |
Protected Member Functions | |
int | binNumberX (double x) const |
Returns the number of the bin in which the x value is situated. | |
int | binNumberY (double y) const |
Returns the number of the bin in which the y value is situated. | |
virtual double | getLow (hippodraw::Axes::Type axis) const |
Returns the low value of the bins on the specified axis. | |
virtual NTuple * | prepareNTuple (unsigned int rows) const |
Prepares the NTuple. | |
virtual void | resize (int nx, int ny) |
Resizes the two dimensional arrays. | |
void | resize () |
Resizes the internal arrays. | |
Protected Attributes | |
std::vector< std::vector< double > > | m_data |
The accumulated sum of weights. | |
bool | m_empty |
A flag set to true , when no accumulation has yet occurred, otherwise is set false . | |
bool | m_is_scaling |
A flag which is set true to enable scaling the output. | |
int | m_num_bins |
Total number of bins not including overflow and underflow. | |
double | m_scale_factor |
The scale factor. | |
bool | m_values_dirty |
A flag to indicate that the objects in m_values are not correct. | |
Private Attributes | |
std::vector< std::vector< double > > | m_variance |
The accumulated square of the weights. | |
double | m_x_moments [3] |
The X moments. | |
double | m_y_moments [3] |
The Y moments. |
|
The default constructor.
Definition at line 49 of file Bins2DHist.cxx. Referenced by clone(). |
|
The copy constructor.
Definition at line 54 of file Bins2DHist.cxx. References Bins2DBase::m_num_bins, m_x_moments, and m_y_moments. |
|
The destructor.
Definition at line 72 of file Bins2DHist.cxx. |
|
Accumulates the data point (x, y) with weight w. The remaining argument is ignored. Implements BinsBase. Definition at line 122 of file Bins2DHist.cxx. References Bins2DBase::binNumberX(), Bins2DBase::binNumberY(), Bins2DBase::m_data, BinsBase::m_empty, m_variance, m_x_moments, m_y_moments, Bins2DBase::numberOfBins(), hippodraw::Axes::X, and hippodraw::Axes::Y. |
|
Returns the number of the bin in which the x value is situated.
Definition at line 168 of file Bins2DBase.cxx. References BinnerAxis::axisBinNumber(), and Bins2DBase::binner_axisX. Referenced by Bins2DProfile::accumulate(), accumulate(), Bins2DProfile::getZValue(), and getZValue(). |
|
Returns the number of the bin in which the y value is situated.
Definition at line 173 of file Bins2DBase.cxx. References BinnerAxis::axisBinNumber(), and Bins2DBase::binner_axisY. Referenced by Bins2DProfile::accumulate(), accumulate(), Bins2DProfile::getZValue(), and getZValue(). |
|
Returns the bin width parameter on the specified axis. If the bins have all the same width, then returns the bin width. If the bin width are determined by some algorithm, then returns a parameter used to calculate the bin widths. Implements BinsBase. Definition at line 180 of file Bins2DBase.cxx. References Bins2DBase::binner_axisX, Bins2DBase::binner_axisY, BinnerAxis::getConstWid(), hippodraw::Axes::X, and hippodraw::Axes::Y. |
|
Gets the bin width of the X bin for the i bin.
Definition at line 189 of file Bins2DBase.cxx. References BinnerAxis::axisBinWidth(), and Bins2DBase::binner_axisX. Referenced by Bins2DProfile::fillDataSource(), fillDataSource(), Bins2DProfile::fillProjectedValues(), fillProjectedValues(), getZValue(), and setBinContents(). |
|
Gets the bin width of the Y bin for the i bin.
Definition at line 194 of file Bins2DBase.cxx. References BinnerAxis::axisBinWidth(), and Bins2DBase::binner_axisY. Referenced by Bins2DProfile::fillDataSource(), fillDataSource(), Bins2DProfile::fillProjectedValues(), fillProjectedValues(), getZValue(), and setBinContents(). |
|
Calculates the bin width parameter from dragging slider.
Implements BinsBase. Definition at line 239 of file Bins2DBase.cxx. References Bins2DBase::binner_axisX, Bins2DBase::binner_axisY, and BinnerAxis::calcBinWidth(). |
|
Calculates and returns a new range from dragging slider.
Implements BinsBase. Definition at line 257 of file Bins2DBase.cxx. References Bins2DBase::binner_axisX, Bins2DBase::binner_axisY, and BinnerAxis::calcOffset(). |
|
The clone function returns an object of its own kind which is a copy of this object at this moment.
Implements BinsBase. Definition at line 67 of file Bins2DHist.cxx. References Bins2DHist(). |
|
Creates an NTuple. Derived classes will return an NTuple appropriate to their binned data. They should at least contain the coordinates, error on the coordinates, the value, and error on the value. Implements BinsBase. Definition at line 154 of file Bins2DHist.cxx. References fillProjectedValues(), Bins2DBase::numberOfBins(), Bins2DBase::prepareNTuple(), num_util::size(), hippodraw::Axes::X, and hippodraw::Axes::Y. |
|
Fills the DataSource. Clears and fills the DataSource based on the contents of the bins. The resulting DataSource is follows the standard defined in hippodraw::DataPoint2DTuple or hippodraw::DataPoint3DTuple. Implements BinsBase. Definition at line 223 of file Bins2DHist.cxx. References Bins2DBase::binWidthX(), Bins2DBase::binWidthY(), Bins2DBase::getLow(), Bins2DBase::getNumberOfEntries(), Bins2DBase::m_data, BinsBase::m_is_scaling, BinsBase::m_scale_factor, m_variance, Bins2DBase::numberOfBins(), num_util::shape(), hippodraw::DataPoint2DTuple::SIZE, std::sqrt(), hippodraw::Axes::X, hippodraw::DataPoint2DTuple::XERR, hippodraw::Axes::Y, hippodraw::DataPoint2DTuple::YERR, hippodraw::Axes::Z, and hippodraw::DataPoint3DTuple::ZERR. |
|
Fills the NTuple. Clears and fills the ntuple from the contents of the bins. Implements BinsBase. Definition at line 168 of file Bins2DHist.cxx. References Bins2DBase::binWidthX(), Bins2DBase::binWidthY(), Bins2DBase::getLow(), Bins2DBase::getNumberOfEntries(), Bins2DBase::m_data, BinsBase::m_is_scaling, BinsBase::m_scale_factor, m_variance, Bins2DBase::numberOfBins(), num_util::shape(), hippodraw::DataPoint2DTuple::SIZE, std::sqrt(), hippodraw::Axes::X, hippodraw::DataPoint2DTuple::XERR, hippodraw::Axes::Y, hippodraw::DataPoint2DTuple::YERR, hippodraw::Axes::Z, and hippodraw::DataPoint3DTuple::ZERR. Referenced by createNTuple(). |
|
Returns the BinnerAxis object used by this object.
Implements BinsBase. Definition at line 88 of file Bins2DBase.cxx. References Bins2DBase::binner_axisX, Bins2DBase::binner_axisY, hippodraw::Axes::X, and hippodraw::Axes::Y. |
|
Returns the low value of the bins on the specified axis.
Implements BinsBase. Definition at line 120 of file Bins2DBase.cxx. References BinnerAxis::axisGetLow(), Bins2DBase::binner_axisX, Bins2DBase::binner_axisY, hippodraw::Axes::X, and hippodraw::Axes::Y. Referenced by Bins2DProfile::fillDataSource(), fillDataSource(), Bins2DProfile::fillProjectedValues(), and fillProjectedValues(). |
|
Returns the number of axes handled by the BinsBase derived class.
Implements BinsBase. Definition at line 70 of file Bins2DBase.cxx. |
|
Returns the true number of entries. Returns the sum of the weight parameter of the accumulate member function. Implements BinsBase. Definition at line 347 of file Bins2DBase.cxx. References std::accumulate(), and Bins2DBase::m_data. Referenced by fillDataSource(), and fillProjectedValues(). |
|
Returns the offset parameter on specific axis.
Implements BinsBase. Definition at line 270 of file Bins2DBase.cxx. References Bins2DBase::binner_axisX, Bins2DBase::binner_axisY, BinnerAxis::getOffset(), hippodraw::Axes::X, and hippodraw::Axes::Y. |
|
Returns range from binner axis.
Implements BinsBase. Definition at line 315 of file Bins2DBase.cxx. References Bins2DBase::binner_axisX, Bins2DBase::binner_axisY, BinnerAxis::getRange(), hippodraw::Axes::X, and hippodraw::Axes::Y. |
|
Get the z value at the specified point (x,y).
Reimplemented from BinsBase. Definition at line 142 of file Bins2DHist.cxx. References Bins2DBase::binNumberX(), Bins2DBase::binNumberY(), Bins2DBase::binWidthX(), Bins2DBase::binWidthY(), and Bins2DBase::m_data. |
|
Returns
Implements BinsBase. Definition at line 200 of file Bins2DBase.cxx. References Bins2DBase::binner_axisX, Bins2DBase::binner_axisY, and BinnerAxis::hasEqualWidths(). |
|
Returns
Definition at line 57 of file BinsBase.cxx. References BinsBase::m_values_dirty. |
|
Returns
Definition at line 79 of file BinsBase.cxx. References BinsBase::m_empty. |
|
Returns the name of the Bins container object.
Definition at line 52 of file BinsBase.cxx. References BinsBase::m_name. Referenced by BinsBaseXML::createElement(). |
|
Returns the number of bins.
Definition at line 149 of file Bins2DBase.cxx. References Bins2DBase::m_num_bins. Referenced by Bins2DProfile::accumulate(), accumulate(), Bins2DProfile::createNTuple(), createNTuple(), Bins2DProfile::fillDataSource(), fillDataSource(), Bins2DProfile::fillProjectedValues(), fillProjectedValues(), Bins2DBase::resize(), setBinContents(), Bins2DProfile::setNumberOfBins(), setNumberOfBins(), and Bins2DBase::setNumberOfBins(). |
|
Returns the number of bins on specified axis. If a BinnerAxis object does not exist, returns 0. Implements BinsBase. Definition at line 156 of file Bins2DBase.cxx. References BinnerAxis::axisNumberOfBins(), Bins2DBase::binner_axisX, Bins2DBase::binner_axisY, hippodraw::Axes::X, and hippodraw::Axes::Y. |
|
Prepares the NTuple. Creates and returns the NTuple that will be filled from the binner's values. The NTuple will have rows rows and 6 columns. Implements BinsBase. Definition at line 359 of file Bins2DBase.cxx. References NTuple::setLabels(). Referenced by Bins2DProfile::createNTuple(), and createNTuple(). |
|
Resets the accumulation to zero.
Implements BinsBase. Definition at line 105 of file Bins2DHist.cxx. References std::fill(), Bins2DBase::m_data, BinsBase::m_empty, m_variance, m_x_moments, and m_y_moments. Referenced by setNumberOfBins(). |
|
Resizes the two dimensional arrays.
Definition at line 336 of file Bins2DBase.cxx. References BinsBase::m_values_dirty, Bins2DBase::setNumberOfBins(), hippodraw::Axes::X, and hippodraw::Axes::Y. |
|
Resizes the internal arrays.
Takes the size in each dimension from the BinnerAxis objects. If either size is Definition at line 75 of file Bins2DBase.cxx. References Bins2DBase::numberOfBins(), hippodraw::Axes::X, and hippodraw::Axes::Y. Referenced by Bins2DBase::setBinnerOn(), Bins2DBase::setBinWidth(), and Bins2DBase::setRange(). |
|
Returns the scale factor. Used to convert the ProjValue value to number of entries in a bin. The default, implemented here, is to return 1.0. Derived class, such as those that do binning, may return a value to reflect their binning algorithm. Reimplemented from BinsBase. Definition at line 206 of file Bins2DBase.cxx. References BinnerAxis::axisBinWidth(), Bins2DBase::binner_axisX, Bins2DBase::binner_axisY, and BinnerAxis::hasEqualWidths(). |
|
Sets a scale factor on the output so that the number of entries appears to be number. This feature might be used, for example, to compare two histograms that have different number of entires by normalizing one to the other. Definition at line 86 of file BinsBase.cxx. References BinsBase::m_scale_factor. |
|
Sets the contents of the bins from the ntuple. Sets the contents of the bins from the ntuple. The purpose of this method is to restore a histogram from archived file. The ntuple should be cone filled by the fillProjectedValues method. Implements BinsBase. Definition at line 285 of file Bins2DHist.cxx. References Bins2DBase::binWidthX(), Bins2DBase::binWidthY(), Bins2DBase::m_data, m_variance, Bins2DBase::numberOfBins(), hippodraw::Axes::X, hippodraw::Axes::Y, hippodraw::Axes::Z, and hippodraw::DataPoint3DTuple::ZERR. |
|
Sets a new BinnerAxis on the axis axis for the binner to use.
The old one, if any, will be destroyed. Raises an assertion if axis is not Implements BinsBase. Definition at line 101 of file Bins2DBase.cxx. References Bins2DBase::binner_axisX, Bins2DBase::binner_axisY, BinsBase::m_values_dirty, Bins2DBase::resize(), hippodraw::Axes::X, and hippodraw::Axes::Y. |
|
Sets the bin width parameter on the specified axis.
Implements BinsBase. Definition at line 221 of file Bins2DBase.cxx. References Bins2DBase::binner_axisX, Bins2DBase::binner_axisY, BinsBase::m_values_dirty, Bins2DBase::resize(), BinnerAxis::setBinWidth(), hippodraw::Axes::X, and hippodraw::Axes::Y. |
|
Sets a flag to indicate that re-binning needs to be done.
Definition at line 62 of file BinsBase.cxx. References BinsBase::m_values_dirty. Referenced by ProfileProjector::changedNTuple(), Profile2DProjector::changedNTuple(), DyHist2DProjector::changedNTuple(), and DyHist1DProjector::changedNTuple(). |
|
Sets the scaling number of entries on if on is
Definition at line 93 of file BinsBase.cxx. References BinsBase::m_is_scaling. |
|
Sets the number of bins on the the specified axis.
Reimplemented from Bins2DBase. Definition at line 78 of file Bins2DHist.cxx. References Bins2DBase::m_data, m_variance, Bins2DBase::numberOfBins(), reset(), Bins2DBase::setNumberOfBins(), hippodraw::Axes::X, and hippodraw::Axes::Y. |
|
Sets the offset parameter on the specified axis.
Implements BinsBase. Definition at line 281 of file Bins2DBase.cxx. References Bins2DBase::binner_axisX, Bins2DBase::binner_axisY, BinsBase::m_values_dirty, BinnerAxis::setOffset(), hippodraw::Axes::X, and hippodraw::Axes::Y. |
|
Sets the Range on the specified axis.
If hold_width is Implements BinsBase. Definition at line 296 of file Bins2DBase.cxx. References Bins2DBase::binner_axisX, Bins2DBase::binner_axisY, Bins2DBase::resize(), BinnerAxis::setRange(), hippodraw::Axes::X, and hippodraw::Axes::Y. |
|
The accumulated sum of weights.
If all calls to accumulate have weight of 1.0, the default, then will be number of entries. For each vector, index Definition at line 46 of file Bins2DBase.h. Referenced by Bins2DProfile::accumulate(), accumulate(), Bins2DProfile::fillDataSource(), fillDataSource(), Bins2DProfile::fillProjectedValues(), fillProjectedValues(), Bins2DBase::getNumberOfEntries(), Bins2DProfile::getZValue(), getZValue(), Bins2DProfile::reset(), reset(), setBinContents(), Bins2DProfile::setNumberOfBins(), and setNumberOfBins(). |
|
A flag set to
Definition at line 57 of file BinsBase.h. Referenced by Bins2DProfile::accumulate(), accumulate(), Bins1DProfile::accumulate(), Bins1DHist::accumulate(), BinsBase::isEmpty(), Bins2DProfile::reset(), reset(), Bins1DProfile::reset(), and Bins1DHist::reset(). |
|
A flag which is set
Definition at line 49 of file BinsBase.h. Referenced by fillDataSource(), Bins1DHist::fillDataSource(), fillProjectedValues(), Bins1DHist::fillProjectedValues(), and BinsBase::setEntriesScaling(). |
|
Total number of bins not including overflow and underflow.
Definition at line 55 of file Bins2DBase.h. Referenced by Bins2DHist(), Bins2DProfile::Bins2DProfile(), Bins2DBase::numberOfBins(), Bins2DProfile::setNumberOfBins(), and Bins2DBase::setNumberOfBins(). |
|
The scale factor. This data member is used to scale the output so that the total number of entries has this value. Definition at line 45 of file BinsBase.h. Referenced by fillDataSource(), Bins1DHist::fillDataSource(), fillProjectedValues(), Bins1DHist::fillProjectedValues(), and BinsBase::scaleNumberOfEntries(). |
|
A flag to indicate that the objects in m_values are not correct.
Definition at line 52 of file BinsBase.h. Referenced by Bins1DBase::Bins1DBase(), Bins2DBase::Bins2DBase(), BinsBase::isDirty(), Bins1DHist::reset(), Bins2DBase::resize(), Bins1DProfile::resize(), Bins1DHist::resize(), Bins2DBase::setBinnerOn(), Bins1DBase::setBinnerOn(), Bins2DBase::setBinWidth(), BinsBase::setDirty(), and Bins2DBase::setOffset(). |
|
The accumulated square of the weights. Use [X][Y]. Definition at line 32 of file Bins2DHist.h. Referenced by accumulate(), fillDataSource(), fillProjectedValues(), reset(), setBinContents(), and setNumberOfBins(). |
|
The X moments.
Definition at line 35 of file Bins2DHist.h. Referenced by accumulate(), Bins2DHist(), and reset(). |
|
The Y moments.
Definition at line 38 of file Bins2DHist.h. Referenced by accumulate(), Bins2DHist(), and reset(). |