TabulatedDist Class Reference

A Generic Tabulated distribution. More...

#include <XeStat.h>

Inheritance diagram for TabulatedDist:
XeSpectrum XeDist XeGraphics XeStat XeStat XeCore XeMath XeObject XeMath XeObject XeCore XeCore XeCore XeCore

List of all members.

Public Member Functions

void addDelta (double x, double w=1.)
 add one delta in the distribution, normalize and cumulate
double cdf (double x)
 returns cumulated probability density function
void drawCumulatedGraph (string options="C", string Xlab="", string Ylab="", XeStyle *style=NULL)
 Draw the cumulated distribution as a graph.
void drawCumulatedGraphWithFrame (string options="C", string Xlab="", string Ylab="", XeStyle *style=NULL)
 Draw the cumulatedDistribution as a graph with its frame.
void drawCumulatedHist (string options="C", string Xlab="", string Ylab="")
 Draw the cumulatedDistribution as an histogram.
virtual void fillValues (double *values, int nValues)
 Build the distribution from an list of realizations.
double generate ()
 generate a variable according to the distribution
map< double, int > * getCdfMap ()
vector< double > * getCdfVector ()
double * getCumulated ()
 Return cumulated values.
void importDistribution (XeDist *dist)
 Set the spectrum of the distribution from a distribution, normalize and cumulate.
void importSpectrum (XeSpectrum *spectrum)
 Copy content of distribution from a spectrum, normalize and cumulate.
void importSpectrum (vector< double > &spectrum)
 Copy content of distribution from a vector, normalize and cumulate.
void importSpectrum (double *array)
 Copy content of distribution from an array, normalize and cumulate.
XeGraphnewCumulatedGraph (string Xlab="", string Ylab="", XeStyle *style=NULL, string legend="")
TH1F * newCumulatedHistogram (string name="", int plot=NONE)
void normalizeAndCumulate ()
 Normalized to 1 then Cumulate the tabulated distribution.
double pdf (double x)
 returns probability density function
bool printCumulated (int level=1)
 print the cumulated distribution
bool printIt (int level=1)
 print the distribution
int quantileBin (double c)
 Convert cdf into a bin number (to find the top 10%, etc.
double quantileX (double c)
 Convert cdf into x (to find the top 10%, etc.
 TabulatedDist (string nam, int nBins, double min, double max, XeValues *values)
 Constructor from an XeValue of realizations.
 TabulatedDist (string nam, int nbins, double min, double max, double *spec=NULL, int nValues=0, int mode=SPECTRUM)
 Constructor from an array of either the spectrum of realizations.
 TabulatedDist (XeSpectrum *sp)
 Constructor from an XeSpectrum.
 TabulatedDist (string nam, LinearRange *lr, double *spec=NULL, int nValues=0, int mode=SPECTRUM)
 Constructor giving Linear Range.
 TabulatedDist (string n)
 Constructor with name only.
 TabulatedDist ()
 Empty Constructor for ROOT.

Protected Attributes

map< double, int > cdfMap
vector< double > cdfVector

Detailed Description

A Generic Tabulated distribution.

This is a virtual class. It is a untity normalized XeSpectrum


Constructor & Destructor Documentation

TabulatedDist::TabulatedDist ( string  nam,
LinearRange lr,
double *  spec = NULL,
int  nValues = 0,
int  mode = SPECTRUM 
)

Constructor giving Linear Range.

Parameters:
nam name of the original quantity
lr LinearRange describing the bins
TabulatedDist::TabulatedDist ( string  nam,
int  nbins,
double  min,
double  max,
double *  spec = NULL,
int  nValues = 0,
int  mode = SPECTRUM 
)

Constructor from an array of either the spectrum of realizations.

Parameters:
nam name of the original quantity
nBins Number of bins
min lowest value of lowest bin
max upper value of upper bin
spec pointer to the spectrum to be copied (mode SPECTRUM) , or the values to be histogrammed (mode VALUES) if NULL, nothing is done
nValues number of values
mode whether spec refer to SPECTRUM or VALUES
TabulatedDist::TabulatedDist ( string  nam,
int  nBins,
double  min,
double  max,
XeValues values 
)

Constructor from an XeValue of realizations.

Parameters:
nam name of the original quantity
nBins Number of bins
min lowest value of lowest bin
max upper value of upper bin
values Original vector of values

Member Function Documentation

void TabulatedDist::addDelta ( double  x,
double  w = 1. 
)

add one delta in the distribution, normalize and cumulate

Parameters:
x where
w weight
double TabulatedDist::cdf ( double  x  )  [virtual]

returns cumulated probability density function

Returns:
Cumulated probability density function
Parameters:
x Point at which is it evaluated

Implements XeDist.

void TabulatedDist::drawCumulatedGraph ( string  options = "C",
string  Xlab = "",
string  Ylab = "",
XeStyle style = NULL 
)

Draw the cumulated distribution as a graph.

Parameters:
Xlab label of x-axis
Ylb label of y-axis
style Style of the graph
options TGraph->Draw() option
void TabulatedDist::drawCumulatedGraphWithFrame ( string  options = "C",
string  Xlab = "",
string  Ylab = "",
XeStyle style = NULL 
)

Draw the cumulatedDistribution as a graph with its frame.

Parameters:
Xlab label of x-axis
Ylb label of y-axis
style Style of the graph
options TGraph->Draw() option
void TabulatedDist::drawCumulatedHist ( string  options = "C",
string  Xlab = "",
string  Ylab = "" 
)

Draw the cumulatedDistribution as an histogram.

Parameters:
options THist->Draw() option
virtual void TabulatedDist::fillValues ( double *  values,
int  nValues 
) [virtual]

Build the distribution from an list of realizations.

Parameters:
values array of values
nValues number of points

Reimplemented from XeSpectrum.

double* TabulatedDist::getCumulated (  ) 

Return cumulated values.

Returns:
pointer to the values
void TabulatedDist::importDistribution ( XeDist dist  ) 

Set the spectrum of the distribution from a distribution, normalize and cumulate.

Note: the original distribution need not be tabulated

Parameters:
dist mother distribution
void TabulatedDist::importSpectrum ( XeSpectrum spectrum  ) 

Copy content of distribution from a spectrum, normalize and cumulate.

Parameters:
spectrum vector of values to be copied
void TabulatedDist::importSpectrum ( vector< double > &  spectrum  )  [virtual]

Copy content of distribution from a vector, normalize and cumulate.

Parameters:
spectrum vector of values to be copied

Reimplemented from XeSpectrum.

void TabulatedDist::importSpectrum ( double *  array  )  [virtual]

Copy content of distribution from an array, normalize and cumulate.

Parameters:
array pointer to array of values to be copied

Reimplemented from XeSpectrum.

XeGraph* TabulatedDist::newCumulatedGraph ( string  Xlab = "",
string  Ylab = "",
XeStyle style = NULL,
string  legend = "" 
)
Returns:
A graph (actually an XeGraph) of the cumulated distribution
Parameters:
Xlab label of x-axis
Ylb label of y-axis
style Style of the graph
legend Legend in case of a multi-graph
TH1F* TabulatedDist::newCumulatedHistogram ( string  name = "",
int  plot = NONE 
)
Returns:
the cumulated histogram
Parameters:
name Name of the histogram
plot either NONE, AUTO, LINEAR, or LOG
double TabulatedDist::pdf ( double  x  )  [virtual]

returns probability density function

Returns:
Probability density function
Parameters:
x Point at which is it evaluated

Implements XeDist.

bool TabulatedDist::printCumulated ( int  level = 1  ) 

print the cumulated distribution

Parameters:
level of print
bool TabulatedDist::printIt ( int  level = 1  )  [virtual]

print the distribution

Parameters:
level print level (if >=3, also print cumulated distribution)

Reimplemented from XeSpectrum.

int TabulatedDist::quantileBin ( double  c  ) 

Convert cdf into a bin number (to find the top 10%, etc.

..)

Returns:
the x value corresponding to the Cdf value x
Parameters:
c cdf value (i.e .5=median, .9=top 10%, etc...)
double TabulatedDist::quantileX ( double  c  ) 

Convert cdf into x (to find the top 10%, etc.

..)

Returns:
the x value corresponding to the Cdf value x
Parameters:
c cdf value (i.e .5=median, .9=top 10%, etc...)

Member Data Documentation

map<double,int> TabulatedDist::cdfMap [protected]

Used for generating according to this dist.

vector<double> TabulatedDist::cdfVector [protected]

List of cumulated probabilities


The documentation for this class was generated from the following file:
 All Classes Functions Variables

Generated on 10 Apr 2015 for Xephyr by  doxygen 1.6.1