BCPrior Class Referenceabstract

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

#include <BCPrior.h>

Inheritance diagram for BCPrior:
[legend]

Public Member Functions

Constructors and destructors
 BCPrior ()
 Empty constructor.
 
 BCPrior (const BCPrior &other)
 Copy constructor.
 
virtual ~BCPrior ()
 Destructor.
 
methods that must be overloaded in derived classes
virtual double GetLogPrior (double x)=0
 Get log of prior. More...
 
virtual BCPriorClone () const =0
 Clone function. More...
 
virtual bool IsValid () const =0
 
Getters
virtual double GetLogNormalizedPrior (double x)
 Get log of normalized prior. More...
 
virtual double GetPrior (double x, bool normalize=false)
 Get 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 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 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 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 GetMean (double xmin=-std::numeric_limits< double >::infinity(), double xmax=std::numeric_limits< double >::infinity())
 Get mean of prior. 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 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 GetRandomValue (double xmin, double xmax, TRandom *const R=NULL)
 
Functions related to ROOT access.
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 BCH1D GetBCH1D (TH1 *bins, const std::string &name="prior")
 Get BCH1D object for prior. More...
 
virtual BCH2D GetBCH2D (BCPrior *ordinate, TH2 *bins, const std::string &name="prior")
 Get BCH2D object for prior. More...
 

Protected Attributes

double fLogIntegral
 Log of integral of unnormalized pdf over the range.
 
TF1 fPriorFunction
 

Friends

operators and swap
void swap (BCPrior &A, BCPrior &B)
 swap
 

Detailed Description

A class to represent the prior of a parameter.

Author
Daniel Greenwald
Version
1.0
Date
01.2015

Definition at line 49 of file BCPrior.h.

Member Function Documentation

virtual BCPrior* BCPrior::Clone ( ) const
pure virtual

Clone function.

[Copy constructor must also be provided.]

Implemented in BCPositiveDefinitePrior, BCTH1Prior, BCConstantPrior, BCTF1LogPrior, BCSplitGaussianPrior, BCTF1Prior, BCGaussianPrior, and BCCauchyPrior.

void BCPrior::FillHistogramByCenterValue ( TH1 *  h)
virtual

Fill histogram by prior evaluated at bin center.

Definition at line 140 of file BCPrior.cxx.

void BCPrior::FillHistogramByIntegral ( TH1 *  h)
virtual

Fill histogram by integrating prior over bin and dividing by bin width.

Definition at line 149 of file BCPrior.cxx.

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

Get BCH1D object for prior.

Parameters
binspointer to TH1 object defining binning to use (and axis names)
namename to assigned to the histogram created for BCH1D object
Returns
BCH1D object for prior.

Reimplemented in BCTH1Prior.

Definition at line 159 of file BCPrior.cxx.

BCH2D BCPrior::GetBCH2D ( BCPrior ordinate,
TH2 *  bins,
const std::string &  name = "prior" 
)
virtual

Get BCH2D object for prior.

Parameters
ordinatepointer to BCPrior object to be the ordinate axis
binspointer to TH2 object defining binning to use (and axis names)
namename to give histogram created for BCH2D object
Returns
BCH2D object for prior.

Definition at line 176 of file BCPrior.cxx.

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

Get central 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
central of prior distribution

Reimplemented in BCPositiveDefinitePrior.

Definition at line 88 of file BCPrior.cxx.

double BCPrior::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 in BCPositiveDefinitePrior, BCTH1Prior, BCSplitGaussianPrior, BCGaussianPrior, BCCauchyPrior, and BCConstantPrior.

Definition at line 81 of file BCPrior.cxx.

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

Get kurtosis 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
kurtosis of prior distribution

Reimplemented in BCPositiveDefinitePrior.

Definition at line 205 of file BCPrior.h.

virtual double BCPrior::GetLogNormalizedPrior ( double  x)
inlinevirtual

Get log of normalized prior.

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

Definition at line 106 of file BCPrior.h.

virtual double BCPrior::GetLogPrior ( double  x)
pure virtual

Get log of prior.

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

Implemented in BCTH1Prior, BCPositiveDefinitePrior, BCTF1Prior, BCSplitGaussianPrior, BCTF1LogPrior, BCGaussianPrior, BCCauchyPrior, and BCConstantPrior.

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

Get mean 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
mean of prior distribution

Reimplemented in BCPositiveDefinitePrior.

Definition at line 173 of file BCPrior.h.

double BCPrior::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 in BCPositiveDefinitePrior, BCTH1Prior, BCTF1LogPrior, BCSplitGaussianPrior, BCConstantPrior, BCGaussianPrior, and BCCauchyPrior.

Definition at line 65 of file BCPrior.cxx.

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

Get prior.

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

Reimplemented in BCPositiveDefinitePrior, BCTH1Prior, and BCTF1Prior.

Definition at line 51 of file BCPrior.cxx.

double BCPrior::GetRandomValue ( double  xmin,
double  xmax,
TRandom *const  R = NULL 
)
virtual
Returns
a random value distributed according to the prior.
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
random value.

Reimplemented in BCPositiveDefinitePrior, BCTH1Prior, and BCConstantPrior.

Definition at line 126 of file BCPrior.cxx.

double BCPrior::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 in BCPositiveDefinitePrior, BCTH1Prior, BCSplitGaussianPrior, BCGaussianPrior, BCCauchyPrior, and BCConstantPrior.

Definition at line 72 of file BCPrior.cxx.

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

Get skewness 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
skewness of prior distribution

Reimplemented in BCPositiveDefinitePrior.

Definition at line 197 of file BCPrior.h.

virtual double BCPrior::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 in BCPositiveDefinitePrior, and BCTH1Prior.

Definition at line 189 of file BCPrior.h.

double BCPrior::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 in BCPositiveDefinitePrior, and BCTH1Prior.

Definition at line 112 of file BCPrior.cxx.

virtual double BCPrior::GetStoredIntegral ( ) const
inlinevirtual

Get stored integral.

Definition at line 257 of file BCPrior.h.

virtual double BCPrior::GetStoredLogIntegral ( ) const
inlinevirtual

Get stored integral.

Definition at line 262 of file BCPrior.h.

virtual double BCPrior::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 in BCPositiveDefinitePrior, and BCTH1Prior.

Definition at line 181 of file BCPrior.h.

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

Implemented in BCPositiveDefinitePrior, BCTH1Prior, BCConstantPrior, BCTF1LogPrior, BCSplitGaussianPrior, BCTF1Prior, BCGaussianPrior, and BCCauchyPrior.

void BCPrior::SetFunctionRange ( double  xmin,
double  xmax 
)
virtual

Set range of ROOT TF1 function.

Reimplemented in BCPositiveDefinitePrior, and BCTF1LogPrior.

Definition at line 133 of file BCPrior.cxx.

Member Data Documentation

TF1 BCPrior::fPriorFunction
protected

TF1 for use in default raw moment calculation

Definition at line 291 of file BCPrior.h.


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