The base class for the one-dimensional binner hierarchy. More...
#include <Bins1DBase.h>
Public Member Functions | |
virtual void | accumulate (double x, double w_or_y=1.0, double z=1.0, double w=1.0)=0 |
Accumulates the data point with weight w. | |
int | binNumber (double x) |
Returns the number of the bin in which the x value is situated. | |
double | binWidth (int i) const |
Returns the width of each bin. | |
virtual double | binWidth (hippodraw::Axes::Type axis) const |
Returns the bin width parameter on the specified axis. | |
double | calcBinWidth (hippodraw::Axes::Type axis, int parm, bool dragging) const |
Calculates the bin width from dragging slider. | |
virtual double | calcOffset (const std::string &, int parm, bool dragging) const |
Calculates and returns a new range from dragging slider. | |
virtual BinsBase * | clone () const =0 |
The virtual function to make copy of concrete derived class. | |
virtual NTuple * | createNTuple () const =0 |
Creates an NTuple. | |
virtual void | fillDataSource (DataSource *ntuple) const =0 |
Fills the DataSource. | |
virtual const BinnerAxis * | getBinnerOn (hippodraw::Axes::Type axis) const |
Returns the BinnerAxis object used by this object. | |
double | getHigh () const |
Returns the lower edge of the last + 1 bin through binner_axis. | |
virtual int | getMinEntries () |
Get the minimum entries/bin. | |
virtual int | getNumberOfAxes () const |
Returns the number of axes handled by the BinsBase derived class. | |
virtual int | getNumberOfEntries () const =0 |
Returns the true number of entries. | |
virtual int | getNumberOfEntries (int i) const =0 |
Returns the number of entries in ith bin. | |
virtual double | getOffset (hippodraw::Axes::Type axis) const |
Returns the offset parameter on specific axis. | |
virtual int | getOverflow () const =0 |
Returns the overflow. | |
virtual const Range & | getRange (hippodraw::Axes::Type axis) |
Returns range from binner axis. | |
virtual int | getUnderflow () const =0 |
Returns the underflow. | |
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. | |
virtual int | numberOfBins (hippodraw::Axes::Type axis) const |
Returns the number of bins on specified axis. | |
virtual void | reset ()=0 |
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)=0 |
Sets the contents of the bins from the ntuple. | |
virtual void | setBinnerOn (BinnerAxis *, hippodraw::Axes::Type axis) |
Sets a new BinnerAxis 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 | setMinEntries (int entries) |
Set the minimum entries/bin. | |
virtual void | setNumberOfBins (hippodraw::Axes::Type axis, int num_bins) |
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. | |
virtual | ~Bins1DBase () |
The destructor. |
Protected Member Functions | |
Bins1DBase (const char *name) | |
A constructor taking a bins container name. | |
Bins1DBase (const Bins1DBase &binner) | |
The copy constructor. | |
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 number)=0 |
Resizes the internal arrays for number bins. |
Protected Attributes | |
BinnerAxis * | binner_axis |
The binner axis object. | |
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. | |
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 Member Functions | |
void | resize () |
Resizes the internal arrays. |
The base class for the one-dimensional binner hierarchy.
Definition at line 30 of file Bins1DBase.h.
|
protected |
A constructor taking a bins container name.
Definition at line 29 of file Bins1DBase.cxx.
|
protected |
The copy constructor.
Definition at line 35 of file Bins1DBase.cxx.
References Bins1DBase::binner_axis, BinnerAxis::clone(), and BinsBase::m_values_dirty.
|
virtual |
|
pure virtualinherited |
Accumulates the data point with weight w.
Some derived class implementations make take second argument as the weight and ignore the remaining. Similarly for the third and fourth arguments.
Implemented in Bins1DProfile, Bins1DHist, Bins2DProfile, and Bins2DHist.
Referenced by ProfileProjector::execute(), DyHist1DProjector::execute(), Profile2DProjector::execute(), DyHist2DProjector::execute(), and Bins2DBase::getNumberOfEntries().
|
inline |
Returns the number of the bin in which the x value is situated.
Definition at line 137 of file Bins1DBase.h.
References BinnerAxis::axisBinNumber(), and Bins1DBase::binner_axis.
Referenced by Bins1DHist::accumulate(), and Bins1DProfile::accumulate().
double binWidth | ( | int | i | ) | const |
Returns the width of each bin.
Returns the width of the bin with index i. The first bin has index 0 and the last bin has index of number of bins minus 1.
Definition at line 113 of file Bins1DBase.cxx.
References BinnerAxis::axisBinWidth(), and Bins1DBase::binner_axis.
Referenced by Bins1DProfile::fillDataSource(), and Bins1DHist::fillDataSource().
|
virtual |
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 125 of file Bins1DBase.cxx.
References Bins1DBase::binner_axis, BinnerAxis::getConstWid(), and hippodraw::Axes::X.
|
virtual |
Calculates the bin width from dragging slider.
Implements BinsBase.
Definition at line 146 of file Bins1DBase.cxx.
References Bins1DBase::binner_axis, BinnerAxis::calcBinWidth(), and hippodraw::Axes::X.
|
virtual |
Calculates and returns a new range from dragging slider.
Implements BinsBase.
Definition at line 155 of file Bins1DBase.cxx.
References Bins1DBase::binner_axis, and BinnerAxis::calcOffset().
|
pure virtualinherited |
The virtual function to make copy of concrete derived class.
Implemented in Bins1DHist, Bins1DProfile, Bins2DProfile, and Bins2DHist.
Referenced by BinningProjector::BinningProjector().
|
pure virtualinherited |
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.
Implemented in Bins1DHist, Bins1DProfile, Bins2DProfile, and Bins2DHist.
Referenced by BinningProjector::createNTuple().
|
pure virtualinherited |
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.
Implemented in Bins1DHist, Bins1DProfile, Bins2DProfile, and Bins2DHist.
|
virtual |
Returns the BinnerAxis object used by this object.
Implements BinsBase.
Definition at line 59 of file Bins1DBase.cxx.
References Bins1DBase::binner_axis, and hippodraw::Axes::X.
double getHigh | ( | ) | const |
Returns the lower edge of the last + 1 bin through binner_axis.
Definition at line 85 of file Bins1DBase.cxx.
References BinnerAxis::axisGetHigh(), and Bins1DBase::binner_axis.
|
protectedvirtual |
Returns the low value of the bins on the specified axis.
Implements BinsBase.
Definition at line 78 of file Bins1DBase.cxx.
References BinnerAxis::axisGetLow(), Bins1DBase::binner_axis, and hippodraw::Axes::X.
Referenced by Bins1DProfile::fillDataSource(), and Bins1DHist::fillDataSource().
|
virtualinherited |
Get the minimum entries/bin.
Reimplemented in Bins1DHist.
Definition at line 109 of file BinsBase.cxx.
|
virtual |
Returns the number of axes handled by the BinsBase derived class.
Implements BinsBase.
Definition at line 53 of file Bins1DBase.cxx.
|
pure virtualinherited |
Returns the true number of entries.
Returns the sum of the weight parameter of the accumulate member function.
Implemented in Bins2DBase, Bins1DProfile, and Bins1DHist.
Referenced by StHist1DProjector::getNumberOfEntries(), and StHist2DProjector::getNumberOfEntries().
|
pure virtual |
Returns the number of entries in ith bin.
Returns the sum of the weight parameter of the accumulate member function. Indexing is such that first proper bin (i.e. one which is NOT underflow ) is numbered 0.
Implemented in Bins1DProfile, and Bins1DHist.
|
virtual |
Returns the offset parameter on specific axis.
Implements BinsBase.
Definition at line 165 of file Bins1DBase.cxx.
References Bins1DBase::binner_axis, BinnerAxis::getOffset(), and hippodraw::Axes::X.
|
pure virtualinherited |
Returns the overflow.
Implemented in Bins2DBase, Bins1DHist, and Bins1DProfile.
Referenced by StHist1DProjector::getOverflow(), StHist2DProjector::getOverflow(), and DyHist1DProjector::getOverflow().
|
virtual |
Returns range from binner axis.
Implements BinsBase.
Definition at line 195 of file Bins1DBase.cxx.
References Bins1DBase::binner_axis, BinnerAxis::getRange(), and hippodraw::Axes::X.
|
pure virtualinherited |
Returns the underflow.
Implemented in Bins2DBase, Bins1DProfile, and Bins1DHist.
Referenced by StHist1DProjector::getUnderflow(), StHist2DProjector::getUnderflow(), and DyHist1DProjector::getUnderflow().
|
virtualinherited |
Get the z value at the specified point (x,y).
Reimplemented in Bins2DProfile, and Bins2DHist.
Definition at line 74 of file BinsBase.cxx.
Referenced by BinningProjector::getZValue().
|
virtual |
Returns true
if all bins have the same width.
Implements BinsBase.
Definition at line 107 of file Bins1DBase.cxx.
References Bins1DBase::binner_axis, and BinnerAxis::hasEqualWidths().
|
inherited |
Returns true
if the re-accumulation is needed.
Definition at line 59 of file BinsBase.cxx.
References BinsBase::m_values_dirty.
|
inherited |
Returns true
if no accumulation has yet occurred, otherwise returns false
.
Definition at line 81 of file BinsBase.cxx.
References BinsBase::m_empty.
|
inherited |
Returns the name of the Bins container object.
Definition at line 54 of file BinsBase.cxx.
References BinsBase::m_name.
Referenced by BinsBaseXML::createElement().
|
virtual |
Returns the number of bins on specified axis.
If a BinnerAxis object does not exist, returns 0.
Implements BinsBase.
Definition at line 90 of file Bins1DBase.cxx.
References BinnerAxis::axisNumberOfBins(), Bins1DBase::binner_axis, and hippodraw::Axes::X.
Referenced by Bins1DProfile::fillDataSource(), and Bins1DBase::resize().
|
protectedvirtual |
Prepares the NTuple.
Creates and returns the NTuple that will be filled from the binner's values. The NTuple will have rows rows and 4 columns.
Implements BinsBase.
Definition at line 212 of file Bins1DBase.cxx.
References hippodraw::DataPoint2DTuple::ERROR, NTuple::setLabels(), and hippodraw::DataPoint2DTuple::WIDTH.
Referenced by Bins1DProfile::createNTuple(), and Bins1DHist::createNTuple().
|
pure virtualinherited |
Resets the accumulation to zero.
Implemented in Bins1DHist, Bins1DProfile, Bins2DProfile, and Bins2DHist.
Referenced by ProfileProjector::execute(), DyHist1DProjector::execute(), Profile2DProjector::execute(), and DyHist2DProjector::execute().
|
private |
Resizes the internal arrays.
Definition at line 202 of file Bins1DBase.cxx.
References Bins1DBase::numberOfBins(), and hippodraw::Axes::X.
Referenced by Bins1DBase::setBinnerOn(), Bins1DBase::setBinWidth(), Bins1DBase::setNumberOfBins(), and Bins1DBase::setRange().
|
protectedpure virtual |
Resizes the internal arrays for number bins.
|
virtual |
Returns the scale factor.
Used to convert the projected values to number of entries in a bin.
Reimplemented from BinsBase.
Definition at line 119 of file Bins1DBase.cxx.
References Bins1DBase::binner_axis, and BinnerAxis::scaleFactorWid().
|
virtualinherited |
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 88 of file BinsBase.cxx.
References BinsBase::m_scale_factor.
|
pure virtualinherited |
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 fillDataSource method.
Implemented in Bins1DHist, Bins1DProfile, Bins2DProfile, and Bins2DHist.
|
virtual |
Sets a new BinnerAxis for the binner to use.
The old one, if any, will be destroyed.
Implements BinsBase.
Definition at line 66 of file Bins1DBase.cxx.
References Bins1DBase::binner_axis, BinsBase::m_values_dirty, Bins1DBase::resize(), and hippodraw::Axes::X.
|
virtual |
Sets the bin width parameter on the specified axis.
Implements BinsBase.
Definition at line 133 of file Bins1DBase.cxx.
References Bins1DBase::binner_axis, Bins1DBase::resize(), BinnerAxis::setBinWidth(), and hippodraw::Axes::X.
|
inherited |
Sets a flag to indicate that re-binning needs to be done.
Definition at line 64 of file BinsBase.cxx.
References BinsBase::m_values_dirty.
Referenced by ProfileProjector::changedNTuple(), Profile2DProjector::changedNTuple(), DyHist2DProjector::changedNTuple(), and DyHist1DProjector::changedNTuple().
|
virtualinherited |
Sets the scaling number of entries on if on is true
, otherwise turns if off.
Definition at line 95 of file BinsBase.cxx.
References BinsBase::m_is_scaling.
|
virtualinherited |
Set the minimum entries/bin.
Reimplemented in Bins1DHist.
Definition at line 103 of file BinsBase.cxx.
|
virtual |
Sets the number of bins on the the specified axis.
Implements BinsBase.
Definition at line 97 of file Bins1DBase.cxx.
References BinnerAxis::axisSetNumberOfBins(), Bins1DBase::binner_axis, Bins1DBase::resize(), and hippodraw::Axes::X.
|
virtual |
Sets the offset parameter on the specified axis.
Implements BinsBase.
Definition at line 174 of file Bins1DBase.cxx.
References Bins1DBase::binner_axis, BinnerAxis::setOffset(), and hippodraw::Axes::X.
|
virtual |
Sets the Range on the specified axis.
If hold_width is true
, the bin width parameter will be held constant, otherwise it is adjusted to keep the same number of bins for the new range.
Implements BinsBase.
Definition at line 183 of file Bins1DBase.cxx.
References Bins1DBase::binner_axis, Bins1DBase::resize(), BinnerAxis::setRange(), and hippodraw::Axes::X.
|
protected |
The binner axis object.
Definition at line 40 of file Bins1DBase.h.
Referenced by Bins1DBase::binNumber(), Bins1DBase::Bins1DBase(), Bins1DBase::binWidth(), Bins1DBase::calcBinWidth(), Bins1DBase::calcOffset(), Bins1DBase::getBinnerOn(), Bins1DBase::getHigh(), Bins1DBase::getLow(), Bins1DBase::getOffset(), Bins1DBase::getRange(), Bins1DBase::hasEqualWidths(), Bins1DBase::numberOfBins(), Bins1DBase::scaleFactor(), Bins1DBase::setBinnerOn(), Bins1DBase::setBinWidth(), Bins1DBase::setNumberOfBins(), Bins1DBase::setOffset(), Bins1DBase::setRange(), and Bins1DBase::~Bins1DBase().
|
protectedinherited |
A flag set to true
, when no accumulation has yet occurred, otherwise is set false
.
Definition at line 58 of file BinsBase.h.
Referenced by Bins2DHist::accumulate(), Bins2DProfile::accumulate(), Bins1DHist::accumulate(), Bins1DProfile::accumulate(), BinsBase::isEmpty(), Bins2DHist::reset(), Bins2DProfile::reset(), Bins1DHist::reset(), and Bins1DProfile::reset().
|
protectedinherited |
A flag which is set true
to enable scaling the output.
Definition at line 50 of file BinsBase.h.
Referenced by Bins2DHist::fillDataSource(), Bins1DHist::fillDataSource(), and BinsBase::setEntriesScaling().
|
protectedinherited |
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 46 of file BinsBase.h.
Referenced by Bins2DHist::fillDataSource(), Bins1DHist::fillDataSource(), and BinsBase::scaleNumberOfEntries().
|
mutableprotectedinherited |
A flag to indicate that the objects in m_values are not correct.
Definition at line 53 of file BinsBase.h.
Referenced by Bins1DBase::Bins1DBase(), Bins2DBase::Bins2DBase(), BinsBase::isDirty(), Bins1DHist::reset(), Bins1DProfile::resize(), Bins1DHist::resize(), Bins2DBase::resize(), Bins1DBase::setBinnerOn(), Bins2DBase::setBinnerOn(), Bins2DBase::setBinWidth(), BinsBase::setDirty(), and Bins2DBase::setOffset().