BAT  0.9.4
The Bayesian analysis toolkit
 All Classes Namespaces Functions Variables Enumerations
BCH1D Class Reference

A class for handling 1D distributions. More...

#include <BCH1D.h>

Public Member Functions

Constructors and destructors
 BCH1D (TH1D *hist=0)
 
 ~BCH1D ()
 
Member functions (get)
TH1D * GetHistogram ()
 
double GetMean ()
 
double GetMode ()
 
double GetMedian ()
 
double GetQuantile (double probablity)
 
double GetLimit (double probability)
 
double GetRMS ()
 
double GetSTD ()
 
double GetVariance ()
 
double GetSkew ()
 
double GetKurtosis ()
 
double GetIntegral (double valuemin, double valuemax)
 
double GetPValue (double probability)
 
int GetColor (int index)
 
Member functions (set)
void SetColorScheme (int scheme)
 
void SetHistogram (TH1D *hist)
 
void SetDefaultCLLimit (double limit)
 
void SetGlobalMode (double mode)
 
Member functions (miscellaneous methods)
void Print (const char *filename, std::string options="BTsiB3CS1D0Lmeanmode", std::vector< double > intervals=std::vector< double >(0), int ww=0, int wh=0)
 
void Print (const char *filename, std::string options, double interval, int ww=0, int wh=0)
 
void Draw (std::string options="BTsiB3CS1D0Lmeanmode", std::vector< double > intervals=std::vector< double >(0))
 
void Draw (std::string options, double interval)
 
void DrawDelta (double value) const
 
double GetSmallestInterval (double &min, double &max, double content=.68)
 
TH1D * GetSmallestIntervalHistogram (double level)
 
std::vector< double > GetSmallestIntervals (double content=0.68)
 
double IntegralWidth (double min, double max)
 
TH1D * GetSubHisto (double min, double max, const char *name)
 

Detailed Description

A class for handling 1D distributions.

Author
Daniel Kollar
Kevin Kröninger
Version
1.0
Date
08.2008 This class contains a TH1D histogram and some additional functions. It is used for marginalized distributions.

Definition at line 31 of file BCH1D.h.

Constructor & Destructor Documentation

BCH1D::BCH1D ( TH1D *  hist = 0)

The default constructor.

Definition at line 37 of file BCH1D.cxx.

BCH1D::~BCH1D ( )

The default destructor.

Definition at line 45 of file BCH1D.cxx.

Member Function Documentation

void BCH1D::Draw ( std::string  options = "BTsiB3CS1D0Lmeanmode",
std::vector< double >  intervals = std::vector<double>(0) 
)

Draw distribution into the active canvas.

Parameters
optionsDrawing options:
BTci : band type is central interval [default]
BTsi : band type is/are smallest interval(s)
BTul : band type is upper limit
BTll : band type is lower limit
B1 : draw one band between values specified in intervals [default]
B2 : draw two bands between values specified in intervals
B3 : draw three bands between values specified in intervals
D0 : draw histogram [default]
D1 : draw smooth curve
CS0 : choose color scheme 0 (B&W)
CS1 : choose color scheme 1 (green/yellow/red) [default]
CS2 : choose color scheme 2 (blueish colors)
CS3 : choose color scheme 3 (redish colors)
smooth1 : use ROOT smoothing algorithm once
smooth3 : use ROOT smoothing algorithm three times
smooth5 : use ROOT smoothing algorithm five times
smooth10 : use ROOT smoothing algorithm ten times
median : draw median and central interval
mode : draw global mode and standard deviation
mean : draw mean value and standard deviation
quartiles : indicate quartiles
deciles : indicate deciles
percentiles : indicate percentiles
L : add a legend
same: add histogram on top of another histogram
intervalsthe intervals

Definition at line 231 of file BCH1D.cxx.

void BCH1D::Draw ( std::string  options,
double  interval 
)

Draw distribution into the active canvas.

Parameters
optionsDrawing options,
See Also
Print(const char * filename, std::string options, double interval, int ww=0, int wh=0)
Parameters
intervalan upper or lower limit

Definition at line 698 of file BCH1D.cxx.

void BCH1D::DrawDelta ( double  value) const

Draw the 1D marginal for a parameter fixed by a delta prior.

Parameters
valueThe fixed value of the parameter.

Definition at line 706 of file BCH1D.cxx.

int BCH1D::GetColor ( int  index)
inline

Returns a color of the current color scheme.

Parameters
indexthe color index
Returns
the color number.

Definition at line 128 of file BCH1D.h.

TH1D* BCH1D::GetHistogram ( )
inline
Returns
The one-dimensional histogram.

Definition at line 53 of file BCH1D.h.

double BCH1D::GetIntegral ( double  valuemin,
double  valuemax 
)

Returns the integral of distribution the between two values.

Parameters
valueminThe value from which the intergration is done.
valuemaxThe value up to which the intergration is done.
Returns
The integral.

Definition at line 73 of file BCH1D.cxx.

double BCH1D::GetKurtosis ( )
inline
Returns
The STD of the distribution.

Definition at line 107 of file BCH1D.h.

double BCH1D::GetLimit ( double  probability)
inline

Return the quantile of the distribution

Parameters
probabilityThe probability.
Returns
The quantile of the distribution for the probability.
See Also
GetQuantile(double probablity)

Definition at line 82 of file BCH1D.h.

double BCH1D::GetMean ( )
inline
Returns
The mean of the distribution.

Definition at line 58 of file BCH1D.h.

double BCH1D::GetMedian ( )
inline
Returns
The median of the distribution.

Definition at line 67 of file BCH1D.h.

double BCH1D::GetMode ( )
Returns
The mode of the distribution.

Definition at line 52 of file BCH1D.cxx.

double BCH1D::GetPValue ( double  probability)

Returns the p-value. Returns the integral from 0 to the probability.

Parameters
probabilityUpper limit of integration.
Returns
The p-value.

Definition at line 87 of file BCH1D.cxx.

double BCH1D::GetQuantile ( double  probablity)

Returns the quantile of the distribution.

Parameters
probabilityThe probability.
Returns
The quantile of the distribution for the probability.
See Also
GetLimit(double probability)

Definition at line 58 of file BCH1D.cxx.

double BCH1D::GetRMS ( )
inline
Returns
The RMS of the distribution.

Definition at line 87 of file BCH1D.h.

double BCH1D::GetSkew ( )
inline
Returns
The skew of the distribution.

Definition at line 102 of file BCH1D.h.

double BCH1D::GetSmallestInterval ( double &  min,
double &  max,
double  content = .68 
)

Calculate the minimal interval of the distribution containing a given content.

Parameters
mincalculated minimum of the interval
maxcalculated maximum of the interval
contentcontent of the interval [default is .68]
Returns
the content of the histogram between min and max

Definition at line 742 of file BCH1D.cxx.

TH1D * BCH1D::GetSmallestIntervalHistogram ( double  level)

Create a histogram with the smallest intervals of the original histogram containing a certain level. The histogram is yellow.

Parameters
levelthe level or content of the histogram
Returns
the histogram.

Definition at line 960 of file BCH1D.cxx.

std::vector< double > BCH1D::GetSmallestIntervals ( double  content = 0.68)

Return a vector containing information about the set of smallest intervals.
0 : x_min
1 : x_max
2 : relative height 3 : local mode
4 : relative area.

Parameters
contentThe content of the smallest interval
Returns
the vector.

Definition at line 1008 of file BCH1D.cxx.

double BCH1D::GetSTD ( )
inline
Returns
The standard deviation of the distribution.

Definition at line 92 of file BCH1D.h.

TH1D * BCH1D::GetSubHisto ( double  min,
double  max,
const char *  name 
)

Get histogram with bins outside min, max band being zero. The new histogram can have 2 more bins than the original one as the bins where min and max fall into will be split in two (except for the case when min and/or max are equal to some of the original bin boundaries.

Parameters
minlower boundary of the non-zero interval
maxupper boundary of the non-zero interval
Returns
new histogram which is nonzero only between min and max

Definition at line 882 of file BCH1D.cxx.

double BCH1D::GetVariance ( )
inline
Returns
The variance of the distribution.

Definition at line 97 of file BCH1D.h.

double BCH1D::IntegralWidth ( double  min,
double  max 
)

Calculate integral of the distribution between min and max.

Parameters
minlower boundary of the integrated interval
maxupper boundary of the integrated interval
Returns
integral calculated as sum of BinContent*BinWidth

Definition at line 844 of file BCH1D.cxx.

void BCH1D::Print ( const char *  filename,
std::string  options = "BTsiB3CS1D0Lmeanmode",
std::vector< double >  intervals = std::vector<double>(0),
int  ww = 0,
int  wh = 0 
)

Print distribution into a PostScript file.

Parameters
filenameOutput filename
optionthe draw options (see Draw()), plus
logx : draw x-axis in log-scale
logy : draw y-axis in log-scale
R : rescale canvas to have a squared histogram
intervalsthe intervals for the bands
wwcanvas size in pixels along X
wwcanvas size in pixels along Y If ww and wh are set to 0, default ROOT canvas size is used. For explanation of parameters options and ovalue look at BCH1D::Draw() method.

Definition at line 150 of file BCH1D.cxx.

void BCH1D::Print ( const char *  filename,
std::string  options,
double  interval,
int  ww = 0,
int  wh = 0 
)

Print distribution into a PostScript file.

Parameters
filenameOutput filename
optionthe draw options,
See Also
Print(const char * filename, std::string options="BTsiB3CS1D0Lmeanmode", std::vector<double> intervals=std::vector<double>(0), int ww=0, int wh=0)
Parameters
intervalan upper or lower limit
wwcanvas size in pixels along X
wwcanvas size in pixels along Y
See Also
Print(const char * filename, std::string options="BTsiB3CS1D0Lmeanmode", std::vector<double> intervals=std::vector<double>(0), int ww=0, int wh=0)

Definition at line 223 of file BCH1D.cxx.

void BCH1D::SetColorScheme ( int  scheme)

Sets the color scheme.

Parameters
schemethe scheme index
0 : black and white 1 : yellow-green-red 2 : blueish colors 2 : redish colors 2 : blueish colors

Definition at line 107 of file BCH1D.cxx.

void BCH1D::SetDefaultCLLimit ( double  limit)

Set default probability limits. Allowed values are between 68% and 100%. The default value is 95%.

Definition at line 94 of file BCH1D.cxx.

void BCH1D::SetGlobalMode ( double  mode)
inline

Set global mode

Definition at line 159 of file BCH1D.h.

void BCH1D::SetHistogram ( TH1D *  hist)
inline

Sets the histogram.

Definition at line 149 of file BCH1D.h.


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