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

BinnerAxis Class Reference

#include <BinnerAxis.h>

Inheritance diagram for BinnerAxis:

Inheritance graph
[legend]
Collaboration diagram for BinnerAxis:

Collaboration graph
[legend]
List of all members.

Detailed Description

The base class for the BinnerAxis hierarchy.

The base class of a hierarchy to to maintain information on the binned axis. It is a helper class to the BinsBase hierarchy. The purpose of this hierarchy is two fold. One is given a value, to return the index of the bin. Second, give the index of a bin, to return the information on that bin such as its mean coordinate value and its width.

Author:
Paul F. Kunz <Paul_Kunz@slac.stanford.edu>

Matan Shacham <matan@slac.stanford.edu>

Oded Wurman <owurman@stanford.edu>

Definition at line 33 of file BinnerAxis.h.

Public Member Functions

virtual int axisBinNumber (double x) const =0
 Returns the number of the bin in which the x value is situated.
virtual double axisBinWidth (int i) const =0
 Returns the width of each bin.
double axisGetHigh () const
 Returns the lower edge of the last + 1 bin.
double axisGetLow () const
 Returns the lower edge of the first bin.
int axisNumberOfBins () const
 Returns the number of bins.
virtual void axisSetNumberOfBins (int nb)=0
 Sets m_num_bins.
virtual const std::vector<
double > & 
binEdges ()
 Returns the vector of cordinates of the bin edges i.e returns the member m_edges.
virtual double calcBinWidth (int parm, bool dragging) const =0
 Calculates the bin width parameter when dragging a slider control.
virtual double calcOffset (int parm, bool dragging) const =0
 Calculates and returns a double corresponding to a bin offset when dragging a slider control.
virtual BinnerAxisclone ()=0
 The clone function returns an object of its own kind which is a copy of this object at this moment.
virtual double getBinWidth () const =0
 Returns the bin width parameter.
virtual double getConstWid () const =0
 Returns the constant width parameter.
virtual double getCoordinate (int i) const =0
 Returns the coordinate.
virtual double getOffset () const =0
 Returns the offset.
const RangegetRange () const
 Returns the range.
virtual bool hasEqualWidths () const
 Returns true if all the bins have the same width.
const std::stringname () const
 Returns the name of this binner.
virtual double scaleFactorWid ()=0
 Returns the bin width associated with the scale factor.
virtual const RangesetBinWidth (double width)=0
 Sets the bin width and adjusts the range and number of bins accordingly.
virtual const void setOffset (double offset)=0
 Sets the offset and adjusts the range accordingly.
virtual const RangesetRange (const Range &, bool hold_width=true)=0
 Sets the range.
void setStartRange (bool dragging) const
 Sets the starting Range.
void setStartWidth (bool dragging) const
 Sets the starting width parameter.
virtual ~BinnerAxis ()
 The destructor.

Protected Member Functions

 BinnerAxis (const char *name)
 A constructor taking binner name as argument.
 BinnerAxis (const BinnerAxis &binner)
 The copy constructor.

Protected Attributes

std::vector< double > m_bin_edges
 The coordintes of the edges of bins.
int m_num_bins
 The number of bins.
double m_offset
 The offset.
Range m_range
 The range of the bins.
Range m_range_start
 The Range at the start of dragging.
double m_width
 The width parameter for the binning.
double m_width_start
 The width parameter at the start of dragging.

Static Protected Attributes

static double s_bin_factor = 0.75
 The scale factor used to calculate new bin width from slider.
static int s_num_bins = 50
 The default number of bins.

Private Member Functions

virtual int getNob (const Range &range) const =0
 Gets the number of bins from range.
virtual int getNob (double width) const =0
 Returns the number of bins given the width parameter width.

Private Attributes

bool m_dragging
 The status of dragging.
const std::string m_name
 The name of the binner.


Constructor & Destructor Documentation

BinnerAxis::BinnerAxis const BinnerAxis binner  )  [protected]
 

The copy constructor.

Definition at line 35 of file BinnerAxis.cxx.

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

A constructor taking binner name as argument.

Definition at line 25 of file BinnerAxis.cxx.

BinnerAxis::~BinnerAxis  )  [virtual]
 

The destructor.

Definition at line 45 of file BinnerAxis.cxx.


Member Function Documentation

virtual int BinnerAxis::axisBinNumber double  x  )  const [pure virtual]
 

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

Implemented in BinnerAxisLinear, and BinnerAxisLog.

Referenced by Bins1DBase::binNumber(), Bins2DBase::binNumberX(), and Bins2DBase::binNumberY().

virtual double BinnerAxis::axisBinWidth int  i  )  const [pure virtual]
 

Returns the width of each bin.

Implemented in BinnerAxisLinear, and BinnerAxisLog.

Referenced by binEdges(), Bins1DBase::binWidth(), Bins2DBase::binWidthX(), Bins2DBase::binWidthY(), and Bins2DBase::scaleFactor().

double BinnerAxis::axisGetHigh  )  const
 

Returns the lower edge of the last + 1 bin.

Definition at line 69 of file BinnerAxis.cxx.

References Range::high(), and m_range.

Referenced by Bins1DBase::getHigh().

double BinnerAxis::axisGetLow  )  const
 

Returns the lower edge of the first bin.

Definition at line 63 of file BinnerAxis.cxx.

References Range::low(), and m_range.

Referenced by Bins2DBase::getLow(), and Bins1DBase::getLow().

int BinnerAxis::axisNumberOfBins  )  const
 

Returns the number of bins.

Definition at line 82 of file BinnerAxis.cxx.

References m_num_bins.

Referenced by Bins2DBase::numberOfBins(), and Bins1DBase::numberOfBins().

virtual void BinnerAxis::axisSetNumberOfBins int  nb  )  [pure virtual]
 

Sets m_num_bins.

Implemented in BinnerAxisLinear, and BinnerAxisLog.

Referenced by Bins2DBase::setNumberOfBins(), and Bins1DBase::setNumberOfBins().

const vector< double > & BinnerAxis::binEdges  )  [virtual]
 

Returns the vector of cordinates of the bin edges i.e returns the member m_edges.

If m_edges is not set it sets it too

Definition at line 108 of file BinnerAxis.cxx.

References axisBinWidth(), Range::high(), Range::low(), m_bin_edges, m_num_bins, and m_range.

virtual double BinnerAxis::calcBinWidth int  parm,
bool  dragging
const [pure virtual]
 

Calculates the bin width parameter when dragging a slider control.

This member saves the current width parameter when first called with dragging is true. The width is then calculated with the parameter parm whose range is expected to be from 0 to 99. Returns the calculated width parameter, but does not change with current parameter.

Implemented in BinnerAxisLinear, and BinnerAxisLog.

Referenced by Bins2DBase::calcBinWidth(), and Bins1DBase::calcBinWidth().

virtual double BinnerAxis::calcOffset int  parm,
bool  dragging
const [pure virtual]
 

Calculates and returns a double corresponding to a bin offset when dragging a slider control.

The current range is saved when first called with dragging true. The parm is expected to range from 0 to 50 and offsets are calculated with respect the the bin width parameter.

Implemented in BinnerAxisLinear, and BinnerAxisLog.

Referenced by Bins2DBase::calcOffset(), and Bins1DBase::calcOffset().

virtual BinnerAxis* BinnerAxis::clone  )  [pure virtual]
 

The clone function returns an object of its own kind which is a copy of this object at this moment.

Implemented in BinnerAxisLinear, and BinnerAxisLog.

Referenced by Bins1DBase::Bins1DBase(), and Bins2DBase::Bins2DBase().

virtual double BinnerAxis::getBinWidth  )  const [pure virtual]
 

Returns the bin width parameter.

If the bin widths are not equal, then return a parameter used to calculate the bin widths.

Implemented in BinnerAxisLinear, and BinnerAxisLog.

Referenced by BinnerAxisXML::setAttributes().

virtual double BinnerAxis::getConstWid  )  const [pure virtual]
 

Returns the constant width parameter.

Implemented in BinnerAxisLinear, and BinnerAxisLog.

Referenced by Bins2DBase::binWidth(), and Bins1DBase::binWidth().

virtual double BinnerAxis::getCoordinate int  i  )  const [pure virtual]
 

Returns the coordinate.

Returns the coordinate of the bin at index i. The coordinate is not necessarily midway between the bin edges.

Implemented in BinnerAxisLinear, and BinnerAxisLog.

virtual int BinnerAxis::getNob const Range range  )  const [private, pure virtual]
 

Gets the number of bins from range.

Implemented in BinnerAxisLinear, and BinnerAxisLog.

virtual int BinnerAxis::getNob double  width  )  const [private, pure virtual]
 

Returns the number of bins given the width parameter width.

Implemented in BinnerAxisLinear, and BinnerAxisLog.

virtual double BinnerAxis::getOffset  )  const [pure virtual]
 

Returns the offset.

Implemented in BinnerAxisLinear, and BinnerAxisLog.

Referenced by Bins2DBase::getOffset(), and Bins1DBase::getOffset().

const Range & BinnerAxis::getRange  )  const
 

Returns the range.

Definition at line 76 of file BinnerAxis.cxx.

References m_range.

Referenced by Bins2DBase::getRange(), Bins1DBase::getRange(), and BinnerAxisXML::setAttributes().

bool BinnerAxis::hasEqualWidths  )  const [virtual]
 

Returns true if all the bins have the same width.

The implementation in this base class is to return false. In the special case where all bins have equal widths, this function should be overridden in a derived class. The intent is to allow classes that use such special case to display an alternate label for an axis, such as Entries per bin.

Reimplemented in BinnerAxisLinear.

Definition at line 57 of file BinnerAxis.cxx.

Referenced by Bins2DBase::hasEqualWidths(), Bins1DBase::hasEqualWidths(), and Bins2DBase::scaleFactor().

const string & BinnerAxis::name  )  const
 

Returns the name of this binner.

Definition at line 51 of file BinnerAxis.cxx.

References m_name.

Referenced by BinnerAxisXML::setAttributes().

virtual double BinnerAxis::scaleFactorWid  )  [pure virtual]
 

Returns the bin width associated with the scale factor.

Implemented in BinnerAxisLinear, and BinnerAxisLog.

Referenced by Bins1DBase::scaleFactor().

virtual const Range& BinnerAxis::setBinWidth double  width  )  [pure virtual]
 

Sets the bin width and adjusts the range and number of bins accordingly.

Returns the adjusted range.

Implemented in BinnerAxisLinear, and BinnerAxisLog.

Referenced by BinnerAxisXML::createObject(), Bins2DBase::setBinWidth(), and Bins1DBase::setBinWidth().

virtual const void BinnerAxis::setOffset double  offset  )  [pure virtual]
 

Sets the offset and adjusts the range accordingly.

Implemented in BinnerAxisLinear, and BinnerAxisLog.

Referenced by Bins2DBase::setOffset(), and Bins1DBase::setOffset().

virtual const Range& BinnerAxis::setRange const Range ,
bool  hold_width = true
[pure virtual]
 

Sets the range.

Adjusts the number of bins if hold_width is true, otherwise adjusts the width parameter. Returns the adjusted range.

Implemented in BinnerAxisLinear, and BinnerAxisLog.

Referenced by BinnerAxisXML::createObject(), DisplayController::setBinner(), Bins2DBase::setRange(), and Bins1DBase::setRange().

void BinnerAxis::setStartRange bool  dragging  )  const
 

Sets the starting Range.

Definition at line 88 of file BinnerAxis.cxx.

References m_dragging, m_range, and m_range_start.

Referenced by BinnerAxisLog::calcOffset(), and BinnerAxisLinear::calcOffset().

void BinnerAxis::setStartWidth bool  dragging  )  const
 

Sets the starting width parameter.

Definition at line 98 of file BinnerAxis.cxx.

References m_dragging, m_width, and m_width_start.

Referenced by BinnerAxisLog::calcBinWidth(), and BinnerAxisLinear::calcBinWidth().


Member Data Documentation

std::vector< double > BinnerAxis::m_bin_edges [protected]
 

The coordintes of the edges of bins.

Since there are m_num_bins this is a vector of size 1 + m_num_bins. A size zero indicates that no value has been set yet.

Definition at line 78 of file BinnerAxis.h.

Referenced by binEdges().

bool BinnerAxis::m_dragging [mutable, private]
 

The status of dragging.

Definition at line 42 of file BinnerAxis.h.

Referenced by setStartRange(), and setStartWidth().

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

The name of the binner.

Definition at line 39 of file BinnerAxis.h.

Referenced by name().

int BinnerAxis::m_num_bins [protected]
 

The number of bins.

Definition at line 62 of file BinnerAxis.h.

Referenced by BinnerAxisLog::axisBinNumber(), BinnerAxisLinear::axisBinNumber(), BinnerAxisLog::axisBinWidth(), BinnerAxisLinear::axisBinWidth(), axisNumberOfBins(), BinnerAxisLog::axisSetNumberOfBins(), BinnerAxisLinear::axisSetNumberOfBins(), binEdges(), BinnerAxisLinear::BinnerAxisLinear(), BinnerAxisLog::getCoordinate(), BinnerAxisLinear::getCoordinate(), BinnerAxisLog::setBinWidth(), BinnerAxisLinear::setBinWidth(), BinnerAxisLog::setConstWid(), BinnerAxisLog::setRange(), and BinnerAxisLinear::setRange().

double BinnerAxis::m_offset [protected]
 

The offset.

Definition at line 69 of file BinnerAxis.h.

Referenced by BinnerAxisLog::getOffset(), BinnerAxisLinear::getOffset(), BinnerAxisLog::setOffset(), and BinnerAxisLinear::setOffset().

Range BinnerAxis::m_range [protected]
 

The range of the bins.

The lower edge of the first bin and the upper edge of the last bin are represented by this range.

Definition at line 66 of file BinnerAxis.h.

Referenced by BinnerAxisLinear::axisBinNumber(), BinnerAxisLinear::axisBinWidth(), axisGetHigh(), axisGetLow(), BinnerAxisLinear::axisSetNumberOfBins(), binEdges(), BinnerAxisLinear::BinnerAxisLinear(), BinnerAxisLog::calcWidthParm(), BinnerAxisLinear::getCoordinate(), BinnerAxisLog::getNob(), BinnerAxisLinear::getNob(), getRange(), BinnerAxisLog::setBins(), BinnerAxisLog::setBinWidth(), BinnerAxisLinear::setBinWidth(), BinnerAxisLinear::setOffset(), BinnerAxisLog::setRange(), BinnerAxisLinear::setRange(), and setStartRange().

Range BinnerAxis::m_range_start [mutable, protected]
 

The Range at the start of dragging.

Definition at line 81 of file BinnerAxis.h.

Referenced by BinnerAxisLog::setOffset(), and setStartRange().

double BinnerAxis::m_width [protected]
 

The width parameter for the binning.

A negative number indicates that no value has been set yet.

Definition at line 73 of file BinnerAxis.h.

Referenced by BinnerAxisLinear::axisSetNumberOfBins(), BinnerAxisLinear::BinnerAxisLinear(), BinnerAxisLog::getBinWidth(), BinnerAxisLog::getConstWid(), BinnerAxisLog::getNob(), BinnerAxisLog::setBins(), BinnerAxisLog::setBinWidth(), BinnerAxisLinear::setBinWidth(), BinnerAxisLog::setConstWid(), BinnerAxisLinear::setConstWid(), BinnerAxisLog::setOffset(), BinnerAxisLinear::setOffset(), BinnerAxisLog::setRange(), BinnerAxisLinear::setRange(), and setStartWidth().

double BinnerAxis::m_width_start [mutable, protected]
 

The width parameter at the start of dragging.

Definition at line 84 of file BinnerAxis.h.

Referenced by BinnerAxisLog::calcBinWidth(), BinnerAxisLinear::calcBinWidth(), and setStartWidth().

double BinnerAxis::s_bin_factor = 0.75 [static, protected]
 

The scale factor used to calculate new bin width from slider.

Definition at line 23 of file BinnerAxis.cxx.

Referenced by BinnerAxisLog::calcBinWidth(), and BinnerAxisLinear::calcBinWidth().

int BinnerAxis::s_num_bins = 50 [static, protected]
 

The default number of bins.

The default number of bins used by the default constructor.

Definition at line 22 of file BinnerAxis.cxx.


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