lsseg::Histogram Class Reference

Class representing a histogram. Its main use is in the ParzenDistributionForce class. More...

#include <Histogram.h>

List of all members.

Public Member Functions

 Histogram ()
 Constructor, making an undefined histogram.
 Histogram (double min, double max, int num_bins)
 Constructor which explicitly defines the range and number of histogram bins.
void init (double min, double max, int num_bins)
 Initialize an already-existing Histogram with a new range and number of bins.
int numBins () const
 get the total number of bins in the Histogram
double rangeMin () const
 get the lower bound of the Histogram's value range
double rangeMax () const
 get the upper bound of the Histogram's value range
std::vector< double > & binValues ()
void blur (double sigma)
 blur the histogram
int getBin (double val) const
 Get the index of the appropriate bin for a given value.
double valueFor (double val) const
 Get the "histogram value" for a given value in the Histogram's range.
void write (std::ostream &os) const
 write the complete Histogram object to a stream
void read (std::istream &is)
 read the complete Histogram object from a stream

Private Attributes

double range_min_
 defines the lower bound on the continous value range
double range_max_
 definies the upper bound on the continuous value range
double bin_factor_
 expresses the "width" of each bin
std::vector< double > dist_
 STL vector holding the value of each individual bin's contents.


Detailed Description

Class representing a histogram. Its main use is in the ParzenDistributionForce class.

A histogram class, representing the distribution of a continuous range of values into a discrete set of bins.

Definition at line 65 of file Histogram.h.


Constructor & Destructor Documentation

lsseg::Histogram::Histogram (  )  [inline]

Constructor, making an undefined histogram.

The constructed Histogram is useless, but can be initialized using the init() function.

Definition at line 73 of file Histogram.h.

lsseg::Histogram::Histogram ( double  min,
double  max,
int  num_bins 
) [inline]

Constructor which explicitly defines the range and number of histogram bins.

Upon successful construction, the bins will all be empty.

Parameters:
min lower bound of the continuous value range that should be split up into discrete bins
max upped bound of the continuous value range that should be split up into discrete bins
num_bins number of discrete bins of this histogram.

Definition at line 84 of file Histogram.h.


Member Function Documentation

std::vector<double>& lsseg::Histogram::binValues (  )  [inline]

Definition at line 113 of file Histogram.h.

void lsseg::Histogram::blur ( double  sigma  ) 

blur the histogram

The contents of the histogram's bins will be "smoothed" with a factor determined by the argument sigma. (sigma is a positive value - and higher values will result in more smoothing).

Definition at line 100 of file Histogram.C.

int lsseg::Histogram::getBin ( double  val  )  const

Get the index of the appropriate bin for a given value.

Parameters:
val the value for which we want the correct bin index. It is supposed that val is within the continuous value range, which is the closed interval defined by rangeMin() and rangeMax().

Definition at line 91 of file Histogram.C.

void lsseg::Histogram::init ( double  min,
double  max,
int  num_bins 
) [inline]

Initialize an already-existing Histogram with a new range and number of bins.

Parameters:
min lower bound of the continuous value range that should be split up into discrete bins
max upped bound of the continuous value range that should be split up into discrete bins
num_bins number of discrete bins of this histogram.

Definition at line 97 of file Histogram.h.

int lsseg::Histogram::numBins (  )  const [inline]

get the total number of bins in the Histogram

Definition at line 106 of file Histogram.h.

double lsseg::Histogram::rangeMax (  )  const [inline]

get the upper bound of the Histogram's value range

Definition at line 112 of file Histogram.h.

double lsseg::Histogram::rangeMin (  )  const [inline]

get the lower bound of the Histogram's value range

Definition at line 109 of file Histogram.h.

void lsseg::Histogram::read ( std::istream &  is  ) 

read the complete Histogram object from a stream

Definition at line 72 of file Histogram.C.

double lsseg::Histogram::valueFor ( double  val  )  const

Get the "histogram value" for a given value in the Histogram's range.

The "histogram value" is a value we have defined to be the product of the value of the bin in which the argment val falls, multiplied by the width of the bin.

Definition at line 107 of file Histogram.C.

void lsseg::Histogram::write ( std::ostream &  os  )  const

write the complete Histogram object to a stream

Definition at line 57 of file Histogram.C.


Member Data Documentation

double lsseg::Histogram::bin_factor_ [private]

expresses the "width" of each bin

Definition at line 152 of file Histogram.h.

std::vector<double> lsseg::Histogram::dist_ [private]

STL vector holding the value of each individual bin's contents.

Definition at line 155 of file Histogram.h.

double lsseg::Histogram::range_max_ [private]

definies the upper bound on the continuous value range

Definition at line 149 of file Histogram.h.

double lsseg::Histogram::range_min_ [private]

defines the lower bound on the continous value range

Definition at line 147 of file Histogram.h.


The documentation for this class was generated from the following files:
Generated on Tue Nov 28 18:35:47 2006 for lsseg by  doxygen 1.4.7