Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Bins1DBase Class Reference

#include <Bins1DBase.h>

Inheritance diagram for Bins1DBase:

Inheritance graph
[legend]
Collaboration diagram for Bins1DBase:

Collaboration graph
[legend]
List of all members.

Detailed Description

The base class for the one-dimensional binner hierarchy.

Requests:
Need feature to rebin those consecutive bins whose number of entries fall below some threshold.
This is so fitting can properly be done when otherwise bins of zero content or too few for meaningful error. Need to follow known ways of handling Poisson statistics with low values of number of entries per bin.

Author:
Stephane Bonneaud <gandalf@slac.stanford.edu>

Paul_Kunz@slac.stanford.edu>

Oded Wurman <owurman@stanford.edu>

Matan Shacham <matan@slac.stanford.edu>

Definition at line 34 of file 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.
virtual double binWidth (hippodraw::Axes::Type axis) const
 Returns the bin width parameter on the specified axis.
double binWidth (int i) const
 Returns the width of each bin.
double calcBinWidth (const std::string &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 BinsBaseclone () const =0
 The virtual function to make copy of concrete derived class.
virtual NTuplecreateNTuple () const =0
 Creates an NTuple.
virtual void fillDataSource (DataSource *ntuple) const =0
 Fills the DataSource.
virtual void fillProjectedValues (DataSource *ntuple) const =0
 Fills the NTuple.
virtual const BinnerAxisgetBinnerOn (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 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 const RangegetRange (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::stringname () 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 RangesetBinWidth (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 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 RangesetRange (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 Bins1DBase &binner)
 The copy constructor.
 Bins1DBase (const char *name)
 A constructor taking a bins container name.
virtual double getLow (hippodraw::Axes::Type axis) const
 Returns the low value of the bins on the specified axis.
virtual NTupleprepareNTuple (unsigned int rows) const
 Prepares the NTuple.
virtual void resize (int number)=0
 Resizes the internal arrays for number bins.

Protected Attributes

BinnerAxisbinner_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.


Constructor & Destructor Documentation

Bins1DBase::Bins1DBase const char *  name  )  [protected]
 

A constructor taking a bins container name.

Definition at line 34 of file Bins1DBase.cxx.

Bins1DBase::Bins1DBase const Bins1DBase binner  )  [protected]
 

The copy constructor.

Definition at line 41 of file Bins1DBase.cxx.

References binner_axis, BinnerAxis::clone(), and BinsBase::m_values_dirty.

Bins1DBase::~Bins1DBase  )  [virtual]
 

The destructor.

Definition at line 52 of file Bins1DBase.cxx.

References binner_axis.


Member Function Documentation

virtual void BinsBase::accumulate double  x,
double  w_or_y = 1.0,
double  z = 1.0,
double  w = 1.0
[pure virtual, inherited]
 

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 Bins1DHist, Bins1DProfile, Bins2DHist, and Bins2DProfile.

Referenced by ProfileProjector::execute(), Profile2DProjector::execute(), DyHist2DProjector::execute(), and DyHist1DProjector::execute().

int Bins1DBase::binNumber double  x  )  [inline]
 

Returns the number of the bin in which the x value is situated.

Definition at line 140 of file Bins1DBase.h.

References BinnerAxis::axisBinNumber(), and binner_axis.

Referenced by Bins1DProfile::accumulate(), and Bins1DHist::accumulate().

double Bins1DBase::binWidth hippodraw::Axes::Type  axis  )  const [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 133 of file Bins1DBase.cxx.

References binner_axis, BinnerAxis::getConstWid(), and hippodraw::Axes::X.

double Bins1DBase::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 120 of file Bins1DBase.cxx.

References BinnerAxis::axisBinWidth(), and binner_axis.

Referenced by Bins1DProfile::fillDataSource(), Bins1DHist::fillDataSource(), Bins1DProfile::fillProjectedValues(), and Bins1DHist::fillProjectedValues().

double Bins1DBase::calcBinWidth const std::string axis,
int  parm,
bool  dragging
const [virtual]
 

Calculates the bin width from dragging slider.

Implements BinsBase.

Definition at line 153 of file Bins1DBase.cxx.

References binner_axis, and BinnerAxis::calcBinWidth().

double Bins1DBase::calcOffset const std::string ,
int  parm,
bool  dragging
const [virtual]
 

Calculates and returns a new range from dragging slider.

Implements BinsBase.

Definition at line 166 of file Bins1DBase.cxx.

References binner_axis, and BinnerAxis::calcOffset().

virtual BinsBase* BinsBase::clone  )  const [pure virtual, inherited]
 

The virtual function to make copy of concrete derived class.

Implemented in Bins1DHist, Bins1DProfile, Bins2DHist, and Bins2DProfile.

Referenced by BinningProjector::BinningProjector().

virtual NTuple* BinsBase::createNTuple  )  const [pure virtual, inherited]
 

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, Bins2DHist, and Bins2DProfile.

Referenced by BinningProjector::createNTuple().

virtual void BinsBase::fillDataSource DataSource ntuple  )  const [pure virtual, inherited]
 

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, Bins2DHist, and Bins2DProfile.

virtual void BinsBase::fillProjectedValues DataSource ntuple  )  const [pure virtual, inherited]
 

Fills the NTuple.

Clears and fills the ntuple from the contents of the bins.

Implemented in Bins1DHist, Bins1DProfile, Bins2DHist, and Bins2DProfile.

const BinnerAxis * Bins1DBase::getBinnerOn hippodraw::Axes::Type  axis  )  const [virtual]
 

Returns the BinnerAxis object used by this object.

Implements BinsBase.

Definition at line 65 of file Bins1DBase.cxx.

References binner_axis, and hippodraw::Axes::X.

double Bins1DBase::getHigh  )  const
 

Returns the lower edge of the last + 1 bin through binner_axis.

Definition at line 92 of file Bins1DBase.cxx.

References BinnerAxis::axisGetHigh(), and binner_axis.

double Bins1DBase::getLow hippodraw::Axes::Type  axis  )  const [protected, virtual]
 

Returns the low value of the bins on the specified axis.

Implements BinsBase.

Definition at line 85 of file Bins1DBase.cxx.

References BinnerAxis::axisGetLow(), binner_axis, and hippodraw::Axes::X.

Referenced by Bins1DProfile::fillDataSource(), Bins1DHist::fillDataSource(), Bins1DProfile::fillProjectedValues(), and Bins1DHist::fillProjectedValues().

int Bins1DBase::getNumberOfAxes  )  const [virtual]
 

Returns the number of axes handled by the BinsBase derived class.

Implements BinsBase.

Definition at line 59 of file Bins1DBase.cxx.

virtual int BinsBase::getNumberOfEntries  )  const [pure virtual, inherited]
 

Returns the true number of entries.

Returns the sum of the weight parameter of the accumulate member function.

Implemented in Bins1DHist, Bins1DProfile, and Bins2DBase.

Referenced by StHist2DProjector::getNumberOfEntries(), and StHist1DProjector::getNumberOfEntries().

virtual int Bins1DBase::getNumberOfEntries int  i  )  const [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 Bins1DHist, and Bins1DProfile.

double Bins1DBase::getOffset hippodraw::Axes::Type  axis  )  const [virtual]
 

Returns the offset parameter on specific axis.

Implements BinsBase.

Definition at line 177 of file Bins1DBase.cxx.

References binner_axis, BinnerAxis::getOffset(), and hippodraw::Axes::X.

const Range & Bins1DBase::getRange hippodraw::Axes::Type  axis  )  [virtual]
 

Returns range from binner axis.

Implements BinsBase.

Definition at line 209 of file Bins1DBase.cxx.

References binner_axis, BinnerAxis::getRange(), and hippodraw::Axes::X.

double BinsBase::getZValue double  x,
double  y
const [virtual, inherited]
 

Get the z value at the specified point (x,y).

Reimplemented in Bins2DHist, and Bins2DProfile.

Definition at line 72 of file BinsBase.cxx.

Referenced by BinningProjector::getZValue().

bool Bins1DBase::hasEqualWidths  )  const [virtual]
 

Returns true if all bins have the same width.

See also:
BinnerAxis::hasEqualWidths.

Implements BinsBase.

Definition at line 114 of file Bins1DBase.cxx.

References binner_axis, and BinnerAxis::hasEqualWidths().

bool BinsBase::isDirty  )  [inherited]
 

Returns true if the re-accumulation is needed.

Definition at line 57 of file BinsBase.cxx.

References BinsBase::m_values_dirty.

bool BinsBase::isEmpty  )  const [inherited]
 

Returns true if no accumulation has yet occurred, otherwise returns false.

Definition at line 79 of file BinsBase.cxx.

References BinsBase::m_empty.

const string & BinsBase::name  )  const [inherited]
 

Returns the name of the Bins container object.

Definition at line 52 of file BinsBase.cxx.

References BinsBase::m_name.

Referenced by BinsBaseXML::createElement().

int Bins1DBase::numberOfBins hippodraw::Axes::Type  axis  )  const [virtual]
 

Returns the number of bins on specified axis.

If a BinnerAxis object does not exist, returns 0.

Implements BinsBase.

Definition at line 97 of file Bins1DBase.cxx.

References BinnerAxis::axisNumberOfBins(), binner_axis, and hippodraw::Axes::X.

Referenced by Bins1DProfile::fillDataSource(), Bins1DProfile::fillProjectedValues(), and resize().

NTuple * Bins1DBase::prepareNTuple unsigned int  rows  )  const [protected, virtual]
 

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 226 of file Bins1DBase.cxx.

References hippodraw::DataPoint2DTuple::ERROR, NTuple::setLabels(), and hippodraw::DataPoint2DTuple::WIDTH.

Referenced by Bins1DProfile::createNTuple(), and Bins1DHist::createNTuple().

virtual void BinsBase::reset  )  [pure virtual, inherited]
 

Resets the accumulation to zero.

Implemented in Bins1DHist, Bins1DProfile, Bins2DHist, and Bins2DProfile.

Referenced by ProfileProjector::execute(), Profile2DProjector::execute(), DyHist2DProjector::execute(), and DyHist1DProjector::execute().

virtual void Bins1DBase::resize int  number  )  [protected, pure virtual]
 

Resizes the internal arrays for number bins.

Implemented in Bins1DHist, and Bins1DProfile.

void Bins1DBase::resize  )  [private]
 

Resizes the internal arrays.

Definition at line 216 of file Bins1DBase.cxx.

References numberOfBins(), and hippodraw::Axes::X.

Referenced by setBinnerOn(), setBinWidth(), setNumberOfBins(), and setRange().

double Bins1DBase::scaleFactor  )  const [virtual]
 

Returns the scale factor.

Used to convert the projected values to number of entries in a bin.

Reimplemented from BinsBase.

Definition at line 127 of file Bins1DBase.cxx.

References binner_axis, and BinnerAxis::scaleFactorWid().

void BinsBase::scaleNumberOfEntries double  number  )  [virtual, inherited]
 

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.

virtual void BinsBase::setBinContents const DataSource ntuple  )  [pure virtual, inherited]
 

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.

Implemented in Bins1DHist, Bins1DProfile, Bins2DHist, and Bins2DProfile.

void Bins1DBase::setBinnerOn BinnerAxis ,
hippodraw::Axes::Type  axis
[virtual]
 

Sets a new BinnerAxis for the binner to use.

The old one, if any, will be destroyed.

Implements BinsBase.

Definition at line 72 of file Bins1DBase.cxx.

References binner_axis, BinsBase::m_values_dirty, resize(), and hippodraw::Axes::X.

const Range & Bins1DBase::setBinWidth hippodraw::Axes::Type  axis,
double  value
[virtual]
 

Sets the bin width parameter on the specified axis.

Implements BinsBase.

Definition at line 141 of file Bins1DBase.cxx.

References binner_axis, resize(), BinnerAxis::setBinWidth(), and hippodraw::Axes::X.

void BinsBase::setDirty  )  [inherited]
 

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().

void BinsBase::setEntriesScaling bool  on  )  [virtual, inherited]
 

Sets the scaling number of entries on if on is true, otherwise turns if off.

Definition at line 93 of file BinsBase.cxx.

References BinsBase::m_is_scaling.

void Bins1DBase::setNumberOfBins hippodraw::Axes::Type  axis,
int  num_bins
[virtual]
 

Sets the number of bins on the the specified axis.

Implements BinsBase.

Definition at line 104 of file Bins1DBase.cxx.

References BinnerAxis::axisSetNumberOfBins(), binner_axis, resize(), and hippodraw::Axes::X.

void Bins1DBase::setOffset hippodraw::Axes::Type  axis,
double  value
[virtual]
 

Sets the offset parameter on the specified axis.

Implements BinsBase.

Definition at line 186 of file Bins1DBase.cxx.

References binner_axis, BinnerAxis::setOffset(), and hippodraw::Axes::X.

const Range & Bins1DBase::setRange hippodraw::Axes::Type  axis,
const Range ,
bool  hold_width = true
[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 196 of file Bins1DBase.cxx.

References binner_axis, resize(), BinnerAxis::setRange(), and hippodraw::Axes::X.


Member Data Documentation

BinnerAxis* Bins1DBase::binner_axis [protected]
 

The binner axis object.

Definition at line 44 of file Bins1DBase.h.

Referenced by binNumber(), Bins1DBase(), binWidth(), calcBinWidth(), calcOffset(), getBinnerOn(), getHigh(), getLow(), getOffset(), getRange(), hasEqualWidths(), numberOfBins(), scaleFactor(), setBinnerOn(), setBinWidth(), setNumberOfBins(), setOffset(), setRange(), and ~Bins1DBase().

bool BinsBase::m_empty [protected, inherited]
 

A flag set to true, when no accumulation has yet occurred, otherwise is set false.

Definition at line 57 of file BinsBase.h.

Referenced by Bins2DProfile::accumulate(), Bins2DHist::accumulate(), Bins1DProfile::accumulate(), Bins1DHist::accumulate(), BinsBase::isEmpty(), Bins2DProfile::reset(), Bins2DHist::reset(), Bins1DProfile::reset(), and Bins1DHist::reset().

bool BinsBase::m_is_scaling [protected, inherited]
 

A flag which is set true to enable scaling the output.

Definition at line 49 of file BinsBase.h.

Referenced by Bins2DHist::fillDataSource(), Bins1DHist::fillDataSource(), Bins2DHist::fillProjectedValues(), Bins1DHist::fillProjectedValues(), and BinsBase::setEntriesScaling().

double BinsBase::m_scale_factor [protected, inherited]
 

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 Bins2DHist::fillDataSource(), Bins1DHist::fillDataSource(), Bins2DHist::fillProjectedValues(), Bins1DHist::fillProjectedValues(), and BinsBase::scaleNumberOfEntries().

bool BinsBase::m_values_dirty [mutable, protected, inherited]
 

A flag to indicate that the objects in m_values are not correct.

Definition at line 52 of file BinsBase.h.

Referenced by Bins1DBase(), Bins2DBase::Bins2DBase(), BinsBase::isDirty(), Bins1DHist::reset(), Bins2DBase::resize(), Bins1DProfile::resize(), Bins1DHist::resize(), Bins2DBase::setBinnerOn(), setBinnerOn(), Bins2DBase::setBinWidth(), BinsBase::setDirty(), and Bins2DBase::setOffset().


The documentation for this class was generated from the following files:
Generated for HippoDraw-1.14.8.5 by doxygen 1.4.3