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

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

#include <BCH2D.h>

Public Member Functions

Constructors and destructors
 BCH2D (TH2D *h=0)
 
 ~BCH2D ()
 
Member functions (get)
TH2D * GetHistogram ()
 
int GetColor (int index)
 
Member functions (set)
void SetColorScheme (int scheme)
 
void SetHistogram (TH2D *hist)
 
void SetGlobalMode (double mode[2])
 
Member functions (miscellaneous methods)
void Print (const char *filename, std::string options="BTfB3CS1meangmode", 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="BTfB3CS1meangmodelmode", std::vector< double > intervals=std::vector< double >(0))
 
void Draw (std::string options, double interval)
 
void CalculateIntegratedHistogram ()
 
void PrintIntegratedHistogram (const char *filename)
 
double GetLevel (double p)
 
double GetArea (double p)
 
std::vector< int > GetNIntervalsY (TH2D *h, int &nfoundmax)
 
TGraph * CalculateProfileGraph (int axis, std::string options="mode")
 
TGraph * DrawProfile (int axis, std::string options, std::string drawoptions="blacksolid")
 
TGraph * DrawProfileX (std::string options, std::string drawoptions)
 
TGraph * DrawProfileY (std::string options, std::string drawoptions)
 

Detailed Description

A class for handling 2D distributions.

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

Definition at line 37 of file BCH2D.h.

Constructor & Destructor Documentation

BCH2D::BCH2D ( TH2D *  h = 0)

The complete constructor.

Definition at line 36 of file BCH2D.cxx.

BCH2D::~BCH2D ( )

The default destructor.

Definition at line 46 of file BCH2D.cxx.

Member Function Documentation

void BCH2D::CalculateIntegratedHistogram ( )

Calculates the integral of the distribution as a function of the height.

Definition at line 564 of file BCH2D.cxx.

TGraph * BCH2D::CalculateProfileGraph ( int  axis,
std::string  options = "mode" 
)

Return a graph of the profile along x or y. The profile is calculated by scanning through the one axis, e.g., y, and finding the mode, mean, median, etc. with respect to the other axis, e.g. x.

Parameters
axisx-axis (0) or y-axis (1)
optionsOptions:
mode : calculate the profile using the mode [default]
mean : calculate the profile using the mean
median : calculate the profile using the median

Definition at line 691 of file BCH2D.cxx.

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

Draw distribution into the active canvas.

Parameters
optionsDrawing options:
BTf : band type a filled area [default]
BTc : band type is a contour
B1 : draw one band corresponding to an integrated probability specified in intervals
B2 : draw two bands corresponding to an integrated probability specified in intervals
B3 : draw three bands corresponding to an integrated probability specified in intervals [default]
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
mean : draw mean value and standard deviation [default]
gmode : draw global mode [default]
lmode : draw global mode [default]
profilex : draw the profile line vs. x using the mode
profiley : draw the profile line vs. y using the mode
nL : remove legend
intervalsthe intervals for the bands

Definition at line 171 of file BCH2D.cxx.

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

Draw distribution into the active canvas.

Parameters
optionsDrawing options,
See Also
Draw(std::string options="BTfB3CS1meangmodelmode", std::vector<double> intervals=std::vector<double>(0))
Parameters
intervalan upper or lower limit
See Also
Draw(std::string options="BTfB3CS1meangmodelmode", std::vector<double> intervals=std::vector<double>(0))

Definition at line 543 of file BCH2D.cxx.

TGraph * BCH2D::DrawProfile ( int  axis,
std::string  options,
std::string  drawoptions = "blacksolid" 
)

Draw the profile along x or y

Parameters
optionsThe options of the calculation of the profile
drawoptionsThe drawing options:
black : line color is black [default]
red : line color is red
solid : line is solid [default]
dashed : line is dashed
dotted : line is dotted
Returns
The profile graph

Definition at line 802 of file BCH2D.cxx.

TGraph* BCH2D::DrawProfileX ( std::string  options,
std::string  drawoptions 
)
inline

Draw the profile along x

Parameters
optionsThe options defined in DrawProfile
drawoptionsThe drawoptions defined DrawProfile
Returns
The profile graph

Definition at line 218 of file BCH2D.h.

TGraph* BCH2D::DrawProfileY ( std::string  options,
std::string  drawoptions 
)
inline

Draw the profile along y

Parameters
optionsThe options defined in DrawProfile
drawoptionsThe drawoptions defined DrawProfile
Returns
The profile graph

Definition at line 226 of file BCH2D.h.

double BCH2D::GetArea ( double  p)

Calculate the smallest area over which the integral of the function is p

Parameters
pThe integrated probability in the region below the height to be estimated.

Definition at line 611 of file BCH2D.cxx.

int BCH2D::GetColor ( int  index)
inline

Returns a color of the current color scheme.

Parameters
indexthe color index
Returns
the color number.

Definition at line 67 of file BCH2D.h.

TH2D* BCH2D::GetHistogram ( )
inline

Return the TH2D histogram

Returns
The TH2D histogram.

Definition at line 60 of file BCH2D.h.

double BCH2D::GetLevel ( double  p)

Calculates the height below which the integrated probability has a certain value.

Parameters
pThe integrated probability in the region below the height to be estimated.

Definition at line 599 of file BCH2D.cxx.

std::vector< int > BCH2D::GetNIntervalsY ( TH2D *  h,
int &  nfoundmax 
)

Returns the number of intervals as a function of x

Parameters
hThe histogram.
nfoundmaxThe maximum number of intervals.
Returns
A vector containing the number of intervals for all bins in x.

Definition at line 656 of file BCH2D.cxx.

void BCH2D::Print ( const char *  filename,
std::string  options = "BTfB3CS1meangmode",
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 myDraw()) plus
intervalsthe intervals for the bands logz : draw z-axis in log-scale
R : rescale canvas to have a squared histogram
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.

Definition at line 107 of file BCH2D.cxx.

void BCH2D::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="BTfB3CS1meangmode", 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="BTfB3CS1meangmode", std::vector<double> intervals=std::vector<double>(0), int ww=0, int wh=0)

Definition at line 163 of file BCH2D.cxx.

void BCH2D::PrintIntegratedHistogram ( const char *  filename)

Print the integrated histogram.

Parameters
filenamethe name of the file.

Definition at line 551 of file BCH2D.cxx.

void BCH2D::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 56 of file BCH2D.cxx.

void BCH2D::SetGlobalMode ( double  mode[2])
inline

Set global mode.

Parameters
Theglobal mode.

Definition at line 92 of file BCH2D.h.

void BCH2D::SetHistogram ( TH2D *  hist)

Set the 2D histogram.

Definition at line 99 of file BCH2D.cxx.


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