SynAPSE  0.6.0
Synergistic Analysis of Phase Space Evolution
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
Public Member Functions | Private Attributes
Histogram Class Reference

Data stucture for histograms of arbitray large dimensions. More...

#include <Histogram.hh>

Public Member Functions

 Histogram ()
 Default constructor, initilizes everything to 0. More...
 
 Histogram (std::vector< size_t > number, const std::vector< double > &lower, const std::vector< double > &upper)
 Empty constructor, builds a histogram from the requested binning. More...
 
 Histogram (const Histogram &hist)
 Copy constructor. More...
 
Histogram & operator= (const Histogram &hist)
 Equality operator. More...
 
 ~Histogram ()
 Destructor. More...
 
void Initialize ()
 Initializes the histogram from the produced grid. More...
 
void Fill (const std::vector< double > &point, const double w=1.)
 Fills the histogram with a given point and weight w. More...
 
void FillN (const std::vector< std::vector< double >> &points, const std::vector< double > w=std::vector< double >())
 Fills the histogram with an array of points with weights w. More...
 
Bin GetBin (const std::vector< size_t > &indices) const
 Returns the bin as a Bin object (knows its indices, bounds and content) More...
 
std::vector< Bin > GetBinArray () const
 Returns all the bins as an array of Bin objects. More...
 
std::vector< double > GetBinBarycentre (const std::vector< size_t > &indices) const
 Returns the bin barycentre in the dimension of the space. More...
 
double GetBinCentre (const size_t index, const size_t i=0) const
 Returns the bin centre in a particular dimension. More...
 
void SetBinContent (const std::vector< size_t > &indices, const double value)
 Sets the content of bin indices. More...
 
const double & GetBinContent (const std::vector< size_t > &indices) const
 Returns the content of bin indices. More...
 
double GetBinDensity (const std::vector< size_t > &indices) const
 Returns an estimation of the probability density function in bin indices. More...
 
std::vector< size_t > GetBinID (const std::vector< double > &point) const
 Returns the ids of the bin that contains the requested point. More...
 
double GetBinVolume () const
 Returns the volume of a bin in this bucketting. More...
 
const double & GetBinWidth (const size_t i=0) const
 Returns the bin width in a particular dimension. More...
 
const size_t GetEntries () const
 Returns the amount of entries. More...
 
const size_t & GetDimension () const
 Returns the dimension of the space. More...
 
const std::vector< double > & GetLowerBoundArray () const
 Returns the array of lower bounds in each dimension. More...
 
const double & GetLowerBound (const size_t i=0) const
 Returns the lower bound in dimension i. More...
 
const std::vector< double > & GetUpperBoundArray () const
 Returns the array of upper bounds in each dimension. More...
 
const double & GetUpperBound (const size_t i=0) const
 Returns the upper bound in dimension i. More...
 
const Grid & GetGrid () const
 Returns the grid that encompasses the bins. More...
 
Grid GetInterpolationGrid () const
 Returns a grid of the bin centres on which to interpolate. More...
 
size_t GetNbins () const
 Returns the amount of total amount of bins (n-dimensional buckets) More...
 
size_t GetNbins (const size_t i=0) const
 Returns the amount of bins in one projection. More...
 
void Scale (const double factor)
 Scales the histogram by a certain factor. More...
 
void ScaleToDensity (const double norm=1.)
 Scales the histogram contents to the estimated density. More...
 
TObject * ToROOT (const std::string name="") const
 Returns a ROOT histogram for dimensions below 3. More...
 

Private Attributes

Grid _grid
 Grid that contains the space division. More...
 
std::vector< std::vector
< double > > 
_points
 Points that filled the histogram. More...
 
std::vector< double > _contents
 Binned data. More...
 
std::vector< double > _outflows
 Under/overflow bins (3^_dim-1 bins) More...
 

Detailed Description

Data stucture for histograms of arbitray large dimensions.

Produces a bucketing, provided with a set of data points in n dimensions. Returns the binning, their contents and densities.

The underlying structure is a Grid object. A histogram of $N_1\times...\times N_n$ bins is simply a grid of $(N_1+1)\times...\times(N_n+1)$ points that separates the right amount of cells.

Constructor & Destructor Documentation

Histogram::Histogram ( )

Default constructor, initilizes everything to 0.

Histogram::Histogram ( std::vector< size_t >  number,
const std::vector< double > &  lower,
const std::vector< double > &  upper 
)

Empty constructor, builds a histogram from the requested binning.

Parameters
numberNumber of bins in each projection
lowerLower boundaries in each projection
upperUpper boundaries in each projection
Histogram::Histogram ( const Histogram &  hist)

Copy constructor.

Histogram::~Histogram ( )

Destructor.

Member Function Documentation

void Histogram::Fill ( const std::vector< double > &  point,
const double  w = 1. 
)

Fills the histogram with a given point and weight w.

void Histogram::FillN ( const std::vector< std::vector< double >> &  points,
const std::vector< double >  w = std::vector<double>() 
)

Fills the histogram with an array of points with weights w.

Bin Histogram::GetBin ( const std::vector< size_t > &  indices) const

Returns the bin as a Bin object (knows its indices, bounds and content)

std::vector< Bin > Histogram::GetBinArray ( ) const

Returns all the bins as an array of Bin objects.

std::vector< double > Histogram::GetBinBarycentre ( const std::vector< size_t > &  indices) const

Returns the bin barycentre in the dimension of the space.

double Histogram::GetBinCentre ( const size_t  index,
const size_t  i = 0 
) const

Returns the bin centre in a particular dimension.

const double & Histogram::GetBinContent ( const std::vector< size_t > &  indices) const

Returns the content of bin indices.

double Histogram::GetBinDensity ( const std::vector< size_t > &  indices) const

Returns an estimation of the probability density function in bin indices.

std::vector< size_t > Histogram::GetBinID ( const std::vector< double > &  point) const

Returns the ids of the bin that contains the requested point.

double Histogram::GetBinVolume ( ) const

Returns the volume of a bin in this bucketting.

const double& Histogram::GetBinWidth ( const size_t  i = 0) const
inline

Returns the bin width in a particular dimension.

const size_t& Histogram::GetDimension ( ) const
inline

Returns the dimension of the space.

const size_t Histogram::GetEntries ( ) const
inline

Returns the amount of entries.

const Grid& Histogram::GetGrid ( ) const
inline

Returns the grid that encompasses the bins.

Grid Histogram::GetInterpolationGrid ( ) const

Returns a grid of the bin centres on which to interpolate.

const double& Histogram::GetLowerBound ( const size_t  i = 0) const
inline

Returns the lower bound in dimension i.

const std::vector<double>& Histogram::GetLowerBoundArray ( ) const
inline

Returns the array of lower bounds in each dimension.

size_t Histogram::GetNbins ( ) const

Returns the amount of total amount of bins (n-dimensional buckets)

size_t Histogram::GetNbins ( const size_t  i = 0) const
inline

Returns the amount of bins in one projection.

const double& Histogram::GetUpperBound ( const size_t  i = 0) const
inline

Returns the upper bound in dimension i.

const std::vector<double>& Histogram::GetUpperBoundArray ( ) const
inline

Returns the array of upper bounds in each dimension.

void Histogram::Initialize ( )

Initializes the histogram from the produced grid.

Histogram & Histogram::operator= ( const Histogram &  hist)

Equality operator.

void Histogram::Scale ( const double  factor)

Scales the histogram by a certain factor.

void Histogram::ScaleToDensity ( const double  norm = 1.)

Scales the histogram contents to the estimated density.

void Histogram::SetBinContent ( const std::vector< size_t > &  indices,
const double  value 
)

Sets the content of bin indices.

TObject * Histogram::ToROOT ( const std::string  name = "") const

Returns a ROOT histogram for dimensions below 3.

Field Documentation

std::vector<double> Histogram::_contents
private

Binned data.

Grid Histogram::_grid
private

Grid that contains the space division.

std::vector<double> Histogram::_outflows
private

Under/overflow bins (3^_dim-1 bins)

std::vector<std::vector<double> > Histogram::_points
private

Points that filled the histogram.


The documentation for this class was generated from the following files: