bin_size Class Reference

#include <bin_size.h>


Detailed Description

Determine bin size (CERNLIB).

This is adapted from the KERNLIB routine binsiz.f written by F. James.

This class computes an appropriate set of histogram bins given the upper and lower limits of the data and the maximum number of bins. The bin width is always an integral power of ten times 1, 2, 2.5 or 5. The bin width may also be specified by the user, in which case the class only computes the appropriate limits.

Todo:
Doesn't seem to be working yet.

Definition at line 47 of file bin_size.h.


Public Member Functions

 bin_size ()
int calc_bin (double al, double ah, int na, double &bl, double &bh, int &nb, double &bwid)
 Compute bin size.

Data Fields

bool cern_mode
 (default true)

Member Function Documentation

int calc_bin ( double  al,
double  ah,
int  na,
double &  bl,
double &  bh,
int &  nb,
double &  bwid 
)

Compute bin size.

If na=0 or na=-1, this function always makes exactly one bin.

If na=1, this function takes bwid as input and determines only bl, hb, and nb. This is especially useful when it is desired to have the same bin width for several histograms (or for the two axes of a scatter-plot).

If al > ah, this function takes al to be the upper limit and ah to be the lower limit, so that in fact al and ah may appear in any order. They are not changed by calc_bin(). If al = ah, the lower limit is taken to be al, and the upper limit is set to al+1.

If cern_mode is true (which is the default) the starting guess for the number of bins is na-1. Otherwise, the starting guess for the number of bins is na.


The documentation for this class was generated from the following file:
Documentation generated with Doxygen and provided under the GNU Free Documentation License. See License Information for details.