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

BinsBase Class Reference

#include <BinsBase.h>

Inheritance diagram for BinsBase:

Inheritance graph
[legend]
Collaboration diagram for BinsBase:

Collaboration graph
[legend]
List of all members.

Detailed Description

The base class for the binner hierarchy.

Author:
<Paul_Kunz@slac.stanford.edu>

Definition at line 32 of file BinsBase.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.
virtual double binWidth (hippodraw::Axes::Type axis) const =0
 Returns the bin width parameter on the specified axis.
virtual double calcBinWidth (const std::string &axis, int parm, bool dragging) const =0
 Calculates a new bin width base on dragging slider value.
virtual double calcOffset (const std::string &, int parm, bool dragging) const =0
 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 =0
 Returns the BinnerAxis object used by this object.
virtual int getNumberOfAxes () const =0
 Returns the number of axes handled by the BinsBase derived class.
virtual int getNumberOfEntries () const =0
 Returns the true number of entries.
virtual double getOffset (hippodraw::Axes::Type axis) const =0
 Returns the offset parameter on specific axis.
virtual const RangegetRange (hippodraw::Axes::Type axis)=0
virtual double getZValue (double x, double y) const
 Get the z value at the specified point (x,y).
virtual bool hasEqualWidths () const =0
 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 =0
 Returns the number of bins on specified axis.
virtual NTupleprepareNTuple (unsigned int rows) const =0
 Prepare NTuple representation of projected values.
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)=0
 Sets the bin calculator on specified axis.
virtual const RangesetBinWidth (hippodraw::Axes::Type axis, double value)=0
 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 setOffset (hippodraw::Axes::Type axis, double value)=0
 Sets the offset parameter on the specified axis.
virtual const RangesetRange (hippodraw::Axes::Type axis, const Range &, bool hold_width=true)=0
 Sets the Range on the specified axis.
virtual ~BinsBase ()
 The virtual destructor.

Protected Member Functions

 BinsBase (const BinsBase &binner)
 The copy constructor.
 BinsBase (const char *name)
 The constructor taking the bins container name as argument.
virtual double getLow (hippodraw::Axes::Type axis) const =0
 Returns the low value of the bins on the specified axis.
virtual void setNumberOfBins (hippodraw::Axes::Type axis, int number)=0
 Sets the number of bins on the the specified axis.

Protected Attributes

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 Attributes

const std::string m_name
 The name of the object in the Factory.


Constructor & Destructor Documentation

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

The constructor taking the bins container name as argument.

Definition at line 28 of file BinsBase.cxx.

BinsBase::BinsBase const BinsBase binner  )  [protected]
 

The copy constructor.

Definition at line 37 of file BinsBase.cxx.

BinsBase::~BinsBase  )  [virtual]
 

The virtual destructor.

Definition at line 46 of file BinsBase.cxx.


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]
 

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

virtual double BinsBase::binWidth hippodraw::Axes::Type  axis  )  const [pure 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.

Implemented in Bins1DBase, and Bins2DBase.

Referenced by BinningProjector::getBinWidth().

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

Calculates a new bin width base on dragging slider value.

Implemented in Bins1DBase, and Bins2DBase.

Referenced by Profile2DProjector::setBinWidth(), DyHist2DProjector::setBinWidth(), and BinningProjector::setBinWidth().

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

Calculates and returns a new range from dragging slider.

Implemented in Bins1DBase, and Bins2DBase.

Referenced by Profile2DProjector::setOffset(), DyHist2DProjector::setOffset(), and BinningProjector::setOffset().

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

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]
 

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]
 

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]
 

Fills the NTuple.

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

Implemented in Bins1DHist, Bins1DProfile, Bins2DHist, and Bins2DProfile.

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

Returns the BinnerAxis object used by this object.

Implemented in Bins1DBase, and Bins2DBase.

Referenced by BinsBaseXML::createChildren().

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

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

Implemented in Bins1DBase, and Bins2DBase.

virtual int BinsBase::getNumberOfAxes  )  const [pure virtual]
 

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

Implemented in Bins1DBase, and Bins2DBase.

Referenced by BinsBaseXML::createChildren().

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

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 double BinsBase::getOffset hippodraw::Axes::Type  axis  )  const [pure virtual]
 

Returns the offset parameter on specific axis.

Implemented in Bins1DBase, and Bins2DBase.

Referenced by BinningProjector::getOffset().

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

Implemented in Bins1DBase, and Bins2DBase.

Referenced by StHist2DProjector::dataRangeOn(), StHist1DProjector::dataRangeOn(), Profile2DProjector::setOffset(), Hist2DProjImp::setOffset(), and BinningProjector::setOffset().

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

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

virtual bool BinsBase::hasEqualWidths  )  const [pure virtual]
 

Returns true if all bins have the same width.

See also:
BinnerAxis::hasEqualWidths.

Implemented in Bins1DBase, and Bins2DBase.

Referenced by Hist2DProjImp::checkScaling(), and Hist1DProjImp::checkScaling().

bool BinsBase::isDirty  ) 
 

Returns true if the re-accumulation is needed.

Definition at line 57 of file BinsBase.cxx.

References m_values_dirty.

bool BinsBase::isEmpty  )  const
 

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

Definition at line 79 of file BinsBase.cxx.

References m_empty.

const string & BinsBase::name  )  const
 

Returns the name of the Bins container object.

Definition at line 52 of file BinsBase.cxx.

References m_name.

Referenced by BinsBaseXML::createElement().

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

Returns the number of bins on specified axis.

If a BinnerAxis object does not exist, returns 0.

Implemented in Bins1DBase, and Bins2DBase.

Referenced by BinningProjector::getNumberOfBins().

virtual NTuple* BinsBase::prepareNTuple unsigned int  rows  )  const [pure virtual]
 

Prepare NTuple representation of projected values.

The NTuple will have rows reserved and appropriate number of columns.

Implemented in Bins1DBase, and Bins2DBase.

virtual void BinsBase::reset  )  [pure virtual]
 

Resets the accumulation to zero.

Implemented in Bins1DHist, Bins1DProfile, Bins2DHist, and Bins2DProfile.

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

double BinsBase::scaleFactor  )  const [virtual]
 

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 in Bins1DBase, and Bins2DBase.

Definition at line 67 of file BinsBase.cxx.

Referenced by Hist2DProjImp::checkScaling(), and Hist1DProjImp::checkScaling().

void BinsBase::scaleNumberOfEntries double  number  )  [virtual]
 

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

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

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.

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

Sets the bin calculator on specified axis.

Implemented in Bins1DBase, and Bins2DBase.

Referenced by BinsBaseXML::createObject(), Hist1DProjImp::Hist1DProjImp(), Hist2DProjImp::Hist2DProjImp(), Profile2DProjector::Profile2DProjector(), ProfileProjector::ProfileProjector(), and BinningProjector::setBinnerOn().

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

Sets the bin width parameter on the specified axis.

Implemented in Bins1DBase, and Bins2DBase.

Referenced by Profile2DProjector::setBinWidth(), Hist2DProjImp::setBinWidth(), and BinningProjector::setBinWidth().

void BinsBase::setDirty  ) 
 

Sets a flag to indicate that re-binning needs to be done.

Definition at line 62 of file BinsBase.cxx.

References m_values_dirty.

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

void BinsBase::setEntriesScaling bool  on  )  [virtual]
 

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

Definition at line 93 of file BinsBase.cxx.

References m_is_scaling.

virtual void BinsBase::setNumberOfBins hippodraw::Axes::Type  axis,
int  number
[protected, pure virtual]
 

Sets the number of bins on the the specified axis.

Implemented in Bins1DBase, Bins2DBase, Bins2DHist, and Bins2DProfile.

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

Sets the offset parameter on the specified axis.

Implemented in Bins1DBase, and Bins2DBase.

Referenced by Profile2DProjector::setOffset(), Hist2DProjImp::setOffset(), and BinningProjector::setOffset().

virtual const Range& BinsBase::setRange hippodraw::Axes::Type  axis,
const Range ,
bool  hold_width = true
[pure 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.

Implemented in Bins1DBase, and Bins2DBase.

Referenced by BinningProjector::setRange().


Member Data Documentation

bool BinsBase::m_empty [protected]
 

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(), isEmpty(), Bins2DProfile::reset(), Bins2DHist::reset(), Bins1DProfile::reset(), and Bins1DHist::reset().

bool BinsBase::m_is_scaling [protected]
 

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

const std::string BinsBase::m_name [private]
 

The name of the object in the Factory.

Definition at line 38 of file BinsBase.h.

Referenced by name().

double BinsBase::m_scale_factor [protected]
 

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

bool BinsBase::m_values_dirty [mutable, protected]
 

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(), isDirty(), Bins1DHist::reset(), Bins2DBase::resize(), Bins1DProfile::resize(), Bins1DHist::resize(), Bins2DBase::setBinnerOn(), Bins1DBase::setBinnerOn(), Bins2DBase::setBinWidth(), 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