gslmm::histogram< double, size_t > Class Template Reference
[Histograms.]

#include <histogram_1d.hh>

Collaboration diagram for gslmm::histogram< double, size_t >:

Collaboration graph
[legend]
List of all members.

Detailed Description

template<>
class gslmm::histogram< double, size_t >

A 1D histogram class.


Public Types

typedef double value_type
typedef size_t bin_type
typedef size_t size_type

Public Member Functions

 histogram (const size_type &bins, bool zero=true)
 histogram (const size_type &bins, const value_type &min, const value_type &max)
 histogram (const size_type &bins, const value_type *ranges)
 histogram (const std::vector< value_type > &ranges)
 histogram (const histogram< value_type, bin_type > &other)
virtual ~histogram ()
bool range (const value_type &min, const value_type &max)
bool range (const value_type *ranges)
bool range (const std::vector< value_type > &ranges)
value_type max () const
value_type min () const
size_type bins () const
void reset ()
bool fill (const value_type &x)
bool fill (const value_type &x, double w)
double bin_content (const bin_type &bin) const
bool bin_range (const bin_type &bin, value_type &min, value_type &max) const
value_type bin_min (const bin_type &bin) const
value_type bin_max (const bin_type &bin) const
bin_type bin_number (const value_type &x) const
double max_content () const
double min_content () const
bin_type max_content_bin () const
bin_type min_content_bin () const
value_type mean () const
value_type sigma () const
double covariance () const
double sum () const
bool compatible (const histogram< value_type, bin_type > &other)
const value_typeoperator[] (const bin_type &bin) const
value_typeoperator[] (const bin_type &bin)
histogram< value_type, bin_type > & operator= (const histogram< value_type, bin_type > &other)
histogram< value_type, bin_type > & operator+= (const histogram< value_type, bin_type > &other)
histogram< value_type, bin_type > & operator-= (const histogram< value_type, bin_type > &other)
histogram< value_type, bin_type > & operator *= (const histogram< value_type, bin_type > &other)
histogram< value_type, bin_type > & operator/= (const histogram< value_type, bin_type > &other)
histogram< value_type, bin_type > & operator+= (value_type x)
histogram< value_type, bin_type > & operator-= (value_type x)
histogram< value_type, bin_type > & operator *= (value_type x)
histogram< value_type, bin_type > & operator/= (value_type x)
bool write (FILE *f) const
bool read (FILE *f)
bool print (FILE *s, const char *r="%g", const char *b="%f") const
bool scan (FILE *s)

Protected Attributes

gsl_histogram * _histogram

Friends

class ntuple
class pdf

Classes

class  pdf
 Probablity distribution function from a 1D histogram. More...


Member Typedef Documentation

typedef size_t gslmm::histogram< double, size_t >::bin_type
 

Bin type.

typedef size_t gslmm::histogram< double, size_t >::size_type
 

The size type.

typedef double gslmm::histogram< double, size_t >::value_type
 

Value type.


Constructor & Destructor Documentation

gslmm::histogram< double, size_t >::histogram const size_type bins,
bool  zero = true
[inline]
 

Constructor.

The bin ranges is not set. Set the bin ranges with the member function range.

Parameters:
bins the number of bins
zero is true, then the bins are zeroed.

gslmm::histogram< double, size_t >::histogram const size_type bins,
const value_type min,
const value_type max
[inline]
 

Constructor.

Construct a histogram with bins bins uniformly distributed between min and max.

Parameters:
bins The number of bins.
min The minimum of the range.
max The maximum of the range. Must be larger than min.

gslmm::histogram< double, size_t >::histogram const size_type bins,
const value_type ranges
[inline]
 

Constructor Create a histogram with bins, with the (variable) ranges given by ranges.

For example:

        double x[] = { 1, 10, 100, 1000 };
        gslmm::histogram<double>::histogram h(3, x);
This will allocate a histogram with 3 bins, distributed between 1 and 1000 logarithimicly
Parameters:
bins The number of bins
ranges Array of bins + 1 ranges. The limits must be in increasing order.

gslmm::histogram< double, size_t >::histogram const std::vector< value_type > &  ranges  )  [inline]
 

Constructor Allocates a histogram with $ N$ bins, where $ N$ is ranges.size() - 1.

For example:

        std::vector<double> x(4);
        for (size_t i = 0; i < x.size(); ++i) x[i]  = pow(10,i);
        gslmm::histogram<double> h(x);
This makes a histogram with the bins $ [1,10), [10, 100), [100, 1000] $
Parameters:
ranges Array of the bin limits.

gslmm::histogram< double, size_t >::histogram const histogram< value_type, bin_type > &  other  )  [inline]
 

Copy constructor.

gslmm::histogram< double, size_t >::~histogram  )  [inline, virtual]
 

Destructor.


Member Function Documentation

double gslmm::histogram< double, size_t >::bin_content const bin_type bin  )  const [inline]
 

Get the bin contents.

histogram< double, size_t >::value_type gslmm::histogram< double, size_t >::bin_max const bin_type bin  )  const [inline]
 

Get the bin range.

histogram< double, size_t >::value_type gslmm::histogram< double, size_t >::bin_min const bin_type bin  )  const [inline]
 

Get the bin range.

histogram< double, size_t >::bin_type gslmm::histogram< double, size_t >::bin_number const value_type x  )  const [inline]
 

Get bin number corresponding to x and y.

bool gslmm::histogram< double, size_t >::bin_range const bin_type bin,
value_type min,
value_type max
const [inline]
 

Get the bin range.

histogram< double, size_t >::size_type gslmm::histogram< double, size_t >::bins  )  const [inline]
 

Get the number of bins.

bool gslmm::histogram< double, size_t >::compatible const histogram< value_type, bin_type > &  other  )  [inline]
 

Check if to histograms have compatible ranges.

histogram< double, size_t >::value_type gslmm::histogram< double, size_t >::covariance  )  const [inline]
 

Get x,y covariance.

bool gslmm::histogram< double, size_t >::fill const value_type x,
double  w
[inline]
 

Increment a bin with a weight.

bool gslmm::histogram< double, size_t >::fill const value_type x  )  [inline]
 

Increment a bin.

histogram< double, size_t >::value_type gslmm::histogram< double, size_t >::max  )  const [inline]
 

Get the maximum of the range.

double gslmm::histogram< double, size_t >::max_content  )  const [inline]
 

Get the value of the maximal bin.

histogram< double, size_t >::bin_type gslmm::histogram< double, size_t >::max_content_bin  )  const [inline]
 

Get the bin number of the maximal bin.

histogram< double, size_t >::value_type gslmm::histogram< double, size_t >::mean  )  const [inline]
 

Get the mean of the histogram.

histogram< double, size_t >::value_type gslmm::histogram< double, size_t >::min  )  const [inline]
 

Get the minimum of the range.

double gslmm::histogram< double, size_t >::min_content  )  const [inline]
 

Get the value of the minimal bin.

histogram< double, size_t >::bin_type gslmm::histogram< double, size_t >::min_content_bin  )  const [inline]
 

Get the bin number of the minimal bin.

histogram< double, size_t > & gslmm::histogram< double, size_t >::operator *= value_type  x  )  [inline]
 

Scale this histogram with a constant.

histogram< double, size_t > & gslmm::histogram< double, size_t >::operator *= const histogram< value_type, bin_type > &  other  )  [inline]
 

Multiply by the contents of a compatible histogram.

histogram< double, size_t > & gslmm::histogram< double, size_t >::operator+= value_type  x  )  [inline]
 

Add a constant to the bins.

histogram< double, size_t > & gslmm::histogram< double, size_t >::operator+= const histogram< value_type, bin_type > &  other  )  [inline]
 

Add the contents of a compatible histogram.

histogram< double, size_t > & gslmm::histogram< double, size_t >::operator-= value_type  x  )  [inline]
 

Subtract a constant from this histogram.

histogram< double, size_t > & gslmm::histogram< double, size_t >::operator-= const histogram< value_type, bin_type > &  other  )  [inline]
 

Subtract the contents of a compatible histogram.

histogram< double, size_t > & gslmm::histogram< double, size_t >::operator/= value_type  x  )  [inline]
 

Scale this histogram with a constant.

histogram< double, size_t > & gslmm::histogram< double, size_t >::operator/= const histogram< value_type, bin_type > &  other  )  [inline]
 

Divide with the contents of a compatible histogram.

histogram< double, size_t > & gslmm::histogram< double, size_t >::operator= const histogram< value_type, bin_type > &  other  )  [inline]
 

Assign one histogram to another.

histogram< double, size_t >::value_type & gslmm::histogram< double, size_t >::operator[] const bin_type bin  )  [inline]
 

Bin content.

const histogram< double, size_t >::value_type & gslmm::histogram< double, size_t >::operator[] const bin_type bin  )  const [inline]
 

Bin content.

bool gslmm::histogram< double, size_t >::print FILE *  s,
const char *  r = "%g",
const char *  b = "%f"
const [inline]
 

print to a (C) stream.

Parameters:
s The stream to print on.
r The format of the write for the ranges.
b The format of the write for the bins.
Returns:
true on success, false otherwise

bool gslmm::histogram< double, size_t >::range const std::vector< value_type > &  ranges  )  [inline]
 

Set the ranges.

bool gslmm::histogram< double, size_t >::range const value_type ranges  )  [inline]
 

Set the ranges.

bool gslmm::histogram< double, size_t >::range const value_type min,
const value_type max
[inline]
 

Set the ranges.

bool gslmm::histogram< double, size_t >::read FILE *  f  )  [inline]
 

Read into this object from a (C) file.

Parameters:
f The (C) file to read from.
Returns:
true on success, false otherwise

void gslmm::histogram< double, size_t >::reset  )  [inline]
 

Reset all bins to zero.

bool gslmm::histogram< double, size_t >::scan FILE *  s  )  [inline]
 

Read into this object from a (C) stream.

Parameters:
s Stream to read from.
Returns:
true on success, false otherwise

histogram< double, size_t >::value_type gslmm::histogram< double, size_t >::sigma  )  const [inline]
 

Get the spread of the histogram.

double gslmm::histogram< double, size_t >::sum  )  const [inline]
 

Get the sum of the histogram.

bool gslmm::histogram< double, size_t >::write FILE *  f  )  const [inline]
 

Write this object to a (C) file.

Parameters:
f The (C) file to write to
Returns:
true on success, false otherwise


Friends And Related Function Documentation

friend class ntuple [friend]
 

friend class pdf [friend]
 


Member Data Documentation

gsl_histogram* gslmm::histogram< double, size_t >::_histogram [protected]
 

The low level histogram.


The documentation for this class was generated from the following file:
Top of page Last update Tue May 9 10:11:31 2006
Christian Holm
Created by DoxyGen 1.4.6