A class to represent the prior of a parameter by a TH1. More...

#include <BCTH1Prior.h>

Inheritance diagram for BCTH1Prior:
[legend]
Collaboration diagram for BCTH1Prior:
[legend]

Public Member Functions

Constructor & Destructor
 BCTH1Prior (TH1 &h, bool interpolate=false)
 Constructor. More...
 
 BCTH1Prior (TH1 *h, bool interpolate=false)
 Constructor. More...
 
 BCTH1Prior (const BCTH1Prior &other)
 Copy constructor.
 
virtual ~BCTH1Prior ()
 Destructor.
 
Functions overloaded from BCPrior
virtual BCPriorClone () const
 Clone function.
 
virtual bool IsValid () const
 
virtual double GetPrior (double x, bool normalize=false)
 Get prior. More...
 
virtual double GetLogPrior (double x)
 Get log of prior. More...
 
virtual double GetMode (double xmin=-std::numeric_limits< double >::infinity(), double xmax=std::numeric_limits< double >::infinity())
 Return mode of prior (in range). More...
 
virtual double GetRawMoment (unsigned n, double xmin=-std::numeric_limits< double >::infinity(), double xmax=std::numeric_limits< double >::infinity())
 Get raw moment of prior distrubion. More...
 
virtual double GetIntegral (double xmin=-std::numeric_limits< double >::infinity(), double xmax=std::numeric_limits< double >::infinity())
 Get integral of prior. More...
 
virtual double GetStandardizedMoment (unsigned n, double xmin=-std::numeric_limits< double >::infinity(), double xmax=std::numeric_limits< double >::infinity())
 Get standardised moment of prior distrubion. More...
 
virtual double GetVariance (double xmin=-std::numeric_limits< double >::infinity(), double xmax=std::numeric_limits< double >::infinity())
 Get variance of prior. More...
 
virtual double GetStandardDeviation (double xmin=-std::numeric_limits< double >::infinity(), double xmax=std::numeric_limits< double >::infinity())
 Get standard deviation of prior. More...
 
virtual BCH1D GetBCH1D (TH1 *bins, const std::string &name="prior")
 Get BCH1D object for prior. More...
 
Setters
virtual void SetInterpolate (bool interpolate)
 
virtual double GetRandomValue (double xmin, double xmax, TRandom *const R=NULL)
 
Getters
virtual TH1 & GetHistogram ()
 
virtual const TH1 & GetHistogram () const
 
virtual bool GetInterpolate ()
 
Misc
void NormalizeHistogram ()
 Normalize the histogram holding the prior. More...
 
- Public Member Functions inherited from BCPrior
 BCPrior ()
 Empty constructor.
 
 BCPrior (const BCPrior &other)
 Copy constructor.
 
virtual ~BCPrior ()
 Destructor.
 
virtual double GetLogNormalizedPrior (double x)
 Get log of normalized prior. More...
 
virtual TF1 & GetFunction ()
 Return back ROOT TF1 evaluating BCPrior::GetPrior.
 
virtual const TF1 & GetFunction () const
 Return back ROOT TF1 evaluating BCPrior::GetPrior.
 
virtual void SetFunctionRange (double xmin, double xmax)
 Set range of ROOT TF1 function. More...
 
virtual double GetCentralMoment (unsigned n, double xmin=-std::numeric_limits< double >::infinity(), double xmax=std::numeric_limits< double >::infinity())
 Get central moment of prior distrubion. More...
 
virtual double GetMean (double xmin=-std::numeric_limits< double >::infinity(), double xmax=std::numeric_limits< double >::infinity())
 Get mean of prior. More...
 
virtual double GetSkewness (double xmin=-std::numeric_limits< double >::infinity(), double xmax=std::numeric_limits< double >::infinity())
 Get skewness of prior. More...
 
virtual double GetKurtosis (double xmin=-std::numeric_limits< double >::infinity(), double xmax=std::numeric_limits< double >::infinity())
 Get kurtosis of prior. More...
 
virtual double GetPriorForROOT (double *x, double *)
 For accessing prior as ROOT TF1.
 
virtual double GetNormalizedPriorForROOT (double *x, double *)
 For accessing normalized prior as ROOT TF1.
 
virtual double GetLogPriorForROOT (double *x, double *)
 For accessing log(prior) as ROOT TF1.
 
virtual double GetNormalizedLogPriorForROOT (double *x, double *)
 For accessing normalized log(prior) as ROOT TF1.
 
virtual double CalculateAndStoreIntegral (double xmin=-std::numeric_limits< double >::infinity(), double xmax=std::numeric_limits< double >::infinity())
 Calculate and store integral for use in normalized TF1s.
 
virtual void StoreIntegral (double I)
 Store integral;.
 
virtual void StoreLogIntegral (double logI)
 Store log(integral);.
 
virtual double GetStoredIntegral () const
 Get stored integral. More...
 
virtual double GetStoredLogIntegral () const
 Get stored integral. More...
 
virtual void FillHistogramByCenterValue (TH1 *h)
 Fill histogram by prior evaluated at bin center. More...
 
virtual void FillHistogramByIntegral (TH1 *h)
 Fill histogram by integrating prior over bin and dividing by bin width. More...
 
virtual BCH2D GetBCH2D (BCPrior *ordinate, TH2 *bins, const std::string &name="prior")
 Get BCH2D object for prior. More...
 

Protected Attributes

bool fInterpolate
 whether to interpolate values of hist for prior function
 
TH1 * fPriorHistogram
 
- Protected Attributes inherited from BCPrior
double fLogIntegral
 Log of integral of unnormalized pdf over the range.
 
TF1 fPriorFunction
 

operator and swap

BCTH1Prioroperator= (BCTH1Prior rhs)
 assignment operator
 
void swap (BCTH1Prior &A, BCTH1Prior &B)
 swap
 

Detailed Description

A class to represent the prior of a parameter by a TH1.

Author
Daniel Greenwald
Version
1.0
Date
01.2015

Definition at line 30 of file BCTH1Prior.h.

Constructor & Destructor Documentation

BCTH1Prior::BCTH1Prior ( TH1 &  h,
bool  interpolate = false 
)

Constructor.

Parameters
hCopied internally.
interpolateAll operations involving the density at a point x either interpolate linearly between two bins (true) or take the histogram's value of the bin into which x falls (false).

Definition at line 15 of file BCTH1Prior.cxx.

BCTH1Prior::BCTH1Prior ( TH1 *  h,
bool  interpolate = false 
)

Constructor.

Parameters
hCopied internally.
interpolateAll operations involving the density at a point x either interpolate linearly between two bins (true) or take the histogram's value of the bin into which x falls (false).

Definition at line 24 of file BCTH1Prior.cxx.

Member Function Documentation

BCH1D BCTH1Prior::GetBCH1D ( TH1 *  bins,
const std::string &  name = "prior" 
)
virtual

Get BCH1D object for prior.

Parameters
binsPointer to TH1 object defining binning to use.
nameName to give histogram created for BCH1D object
Returns
BCH1D object for prior.

Reimplemented from BCPrior.

Definition at line 154 of file BCTH1Prior.cxx.

double BCTH1Prior::GetIntegral ( double  xmin = -std::numeric_limits<double>::infinity(),
double  xmax = std::numeric_limits<double>::infinity() 
)
virtual

Get integral of prior.

Parameters
xminlower limit of range to evaluate over
xmaxupper limit of range to evaluate over
Returns
integral of prior

Reimplemented from BCPrior.

Definition at line 135 of file BCTH1Prior.cxx.

double BCTH1Prior::GetLogPrior ( double  x)
virtual

Get log of prior.

Parameters
xvalue to evaluate log of prior at
Returns
log of prior

Implements BCPrior.

Definition at line 92 of file BCTH1Prior.cxx.

double BCTH1Prior::GetMode ( double  xmin = -std::numeric_limits<double>::infinity(),
double  xmax = std::numeric_limits<double>::infinity() 
)
virtual

Return mode of prior (in range).

Parameters
xminlower limit of range to evaluate over
xmaxupper limit of range to evaluate over
Returns
mode of prior in range.

Reimplemented from BCPrior.

Definition at line 103 of file BCTH1Prior.cxx.

virtual double BCTH1Prior::GetPrior ( double  x,
bool  normalize = false 
)
inlinevirtual

Get prior.

Parameters
xvalue to evaluate prior at
normalizeWhether to normalize prior with stored integral
Returns
prior

Reimplemented from BCPrior.

Definition at line 83 of file BCTH1Prior.h.

virtual double BCTH1Prior::GetRandomValue ( double  xmin,
double  xmax,
TRandom *const  R = NULL 
)
inlinevirtual
Parameters
xminlower limit of range to generate value in
xmaxupper limit of range to generate value in
RPointer to the random generator to be used, if needed.
Returns
a random value distributed according to the prior.

Reimplemented from BCPrior.

Definition at line 158 of file BCTH1Prior.h.

double BCTH1Prior::GetRawMoment ( unsigned  n,
double  xmin = -std::numeric_limits<double>::infinity(),
double  xmax = std::numeric_limits<double>::infinity() 
)
virtual

Get raw moment of prior distrubion.

If limits are infinite, use exact value from prior type.

Parameters
nmoment number
xminlower limit of range to evaluate over
xmaxupper limit of range to evaluate over
Returns
raw moment of prior distribution

Reimplemented from BCPrior.

Definition at line 109 of file BCTH1Prior.cxx.

virtual double BCTH1Prior::GetStandardDeviation ( double  xmin = -std::numeric_limits<double>::infinity(),
double  xmax = std::numeric_limits<double>::infinity() 
)
inlinevirtual

Get standard deviation of prior.

If limits are infinite, use exact value from prior type

Parameters
xminlower limit of range to evaluate over
xmaxupper limit of range to evaluate over
Returns
standard deviation of prior distribution

Reimplemented from BCPrior.

Definition at line 135 of file BCTH1Prior.h.

double BCTH1Prior::GetStandardizedMoment ( unsigned  n,
double  xmin = -std::numeric_limits<double>::infinity(),
double  xmax = std::numeric_limits<double>::infinity() 
)
virtual

Get standardised moment of prior distrubion.

If limits are infinite, use exact value from prior type.

Parameters
nmoment number
xminlower limit of range to evaluate over
xmaxupper limit of range to evaluate over
Returns
standardised moment of prior distribution

Reimplemented from BCPrior.

Definition at line 121 of file BCTH1Prior.cxx.

virtual double BCTH1Prior::GetVariance ( double  xmin = -std::numeric_limits<double>::infinity(),
double  xmax = std::numeric_limits<double>::infinity() 
)
inlinevirtual

Get variance of prior.

If limits are infinite, use exact value from prior type

Parameters
xminlower limit of range to evaluate over
xmaxupper limit of range to evaluate over
Returns
variance of prior distribution

Reimplemented from BCPrior.

Definition at line 127 of file BCTH1Prior.h.

bool BCTH1Prior::IsValid ( ) const
virtual
Returns
Whether everything needed for prior is set and prior can be used.

Implements BCPrior.

Definition at line 63 of file BCTH1Prior.cxx.

void BCTH1Prior::NormalizeHistogram ( )

Normalize the histogram holding the prior.

Definition at line 79 of file BCTH1Prior.cxx.

Member Data Documentation

TH1* BCTH1Prior::fPriorHistogram
protected

TH1 holding prior

Definition at line 195 of file BCTH1Prior.h.


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