BAT  0.9.4
The Bayesian analysis toolkit
 All Classes Namespaces Functions Variables Enumerations
BCFitter Class Referenceabstract

A base class for all fitting classes. More...

#include <BCFitter.h>

Inheritance diagram for BCFitter:
Collaboration diagram for BCFitter:

Public Member Functions

Constructors and destructors
 BCFitter ()
 
 BCFitter (const char *name)
 
 ~BCFitter ()
 
Member functions (get)
TGraph * GetErrorBand ()
 
TH2D * GetErrorBandXY () const
 
TH2D * GetErrorBandXY_yellow (double level=.68, int nsmooth=0) const
 
std::vector< double > GetErrorBand (double level) const
 
TGraph * GetErrorBandGraph (double level1, double level2) const
 
TGraph * GetFitFunctionGraph (const std::vector< double > &parameters)
 
TGraph * GetFitFunctionGraph ()
 
TGraph * GetFitFunctionGraph (const std::vector< double > &parameters, double xmin, double xmax, int n=1000)
 
void FixDataAxis (unsigned int index, bool fixed)
 
bool GetFixedDataAxis (unsigned int index) const
 
Member functions (set)
void SetFillErrorBand (bool flag=true)
 
void SetErrorBandHisto (TH2D *h)
 
void UnsetFillErrorBand ()
 
void SetFitFunctionIndexX (int index)
 
void SetFitFunctionIndexY (int index)
 
void SetFitFunctionIndices (int indexx, int indexy)
 
void SetErrorBandContinuous (bool flag)
 
virtual double FitFunction (const std::vector< double > &, const std::vector< double > &)
 
Member functions (miscellaneous methods)
int ReadErrorBandFromFile (const char *file)
 
virtual int Fit ()=0
 
virtual void DrawFit (const char *options, bool flaglegend=false)=0
 
void MCMCIterationInterface ()
 
void MarginalizePreprocess ()
 
void MarginalizePostprocess ()
 
void FillErrorBand ()
 
- Public Member Functions inherited from BCModel
 BCModel (const char *name="model")
 
 BCModel (const BCModel &bcmodel)
 
virtual ~BCModel ()
 
BCModeloperator= (const BCModel &bcmodel)
 
const std::string & GetName () const
 
double GetModelAPrioriProbability () const
 
double GetModelAPosterioriProbability () const
 
BCDataSetGetDataSet () const
 
BCDataPointGetDataPointLowerBoundaries () const
 
BCDataPointGetDataPointUpperBoundaries () const
 
double GetDataPointLowerBoundary (unsigned int index) const
 
double GetDataPointUpperBoundary (unsigned int index) const
 
bool GetFlagBoundaries () const
 
unsigned GetNDataPoints () const
 
BCDataPointGetDataPoint (unsigned int index) const
 
void SetName (const char *name)
 
void SetModelAPrioriProbability (double probability)
 
void SetModelAPosterioriProbability (double probability)
 
virtual int AddParameter (BCParameter *parameter)
 
void SetDataSet (BCDataSet *dataset)
 
void SetSingleDataPoint (BCDataPoint *datapoint)
 
void SetSingleDataPoint (BCDataSet *dataset, unsigned int index)
 
void SetDataBoundaries (unsigned int index, double lowerboundary, double upperboundary, bool fixed=false)
 
void SetDataPointLowerBoundaries (BCDataPoint *datasetlowerboundaries)
 
void SetDataPointUpperBoundaries (BCDataPoint *datasetupperboundaries)
 
void SetDataPointLowerBoundary (int index, double lowerboundary)
 
void SetDataPointUpperBoundary (int index, double upperboundary)
 
int SetPrior (int index, TF1 *f)
 
int SetPrior (const char *name, TF1 *f)
 
int SetPriorDelta (int index, double value)
 
int SetPriorDelta (const char *name, double value)
 
int SetPriorGauss (int index, double mean, double sigma)
 
int SetPriorGauss (const char *name, double mean, double sigma)
 
int SetPriorGauss (int index, double mean, double sigmadown, double sigmaup)
 
int SetPriorGauss (const char *name, double mean, double sigmadown, double sigmaup)
 
int SetPrior (int index, TH1 *h, bool flag=false)
 
int SetPrior (const char *name, TH1 *h, bool flag=false)
 
int SetPriorConstant (int index)
 
int SetPriorConstant (const char *name)
 
int SetPriorConstantAll ()
 
void Copy (const BCModel &bcmodel)
 
double APrioriProbability (const std::vector< double > &parameters)
 
virtual double LogAPrioriProbability (const std::vector< double > &parameters)
 
virtual double Likelihood (const std::vector< double > &params)
 
virtual double LogLikelihood (const std::vector< double > &params)=0
 
double ProbabilityNN (const std::vector< double > &params)
 
double LogProbabilityNN (const std::vector< double > &parameters)
 
double Probability (const std::vector< double > &parameter)
 
double LogProbability (const std::vector< double > &parameter)
 
virtual double SamplingFunction (const std::vector< double > &parameters)
 
double Eval (const std::vector< double > &parameters)
 
virtual double LogEval (const std::vector< double > &parameters)
 
virtual void CorrelateDataPointValues (std::vector< double > &x)
 
double GetPvalueFromChi2 (const std::vector< double > &par, int sigma_index)
 
double GetPvalueFromKolmogorov (const std::vector< double > &par, int index)
 
double GetPvalueFromChi2NDoF (std::vector< double > par, int sigma_index)
 
BCH1DCalculatePValue (std::vector< double > par, bool flag_histogram=false)
 
double GetPValue ()
 
double GetPValueNDoF ()
 
double GetChi2NDoF ()
 
std::vector< double > GetChi2Runs (int dataIndex, int sigmaIndex)
 
void SetGoFNIterationsMax (int n)
 
void SetGoFNIterationsRun (int n)
 
void SetGoFNChains (int n)
 
double HessianMatrixElement (const BCParameter *parameter1, const BCParameter *parameter2, std::vector< double > point)
 
void PrintSummary ()
 
void PrintResults (const char *file)
 
void PrintShortFitSummary (int chi2flag=0)
 
void PrintHessianMatrix (std::vector< double > parameters)
 
virtual double CDF (const std::vector< double > &, int, bool)
 

Protected Attributes

TH2D * fErrorBandXY
 
- Protected Attributes inherited from BCModel
std::string fName
 
double fModelAPriori
 
double fModelAPosteriori
 
BCDataSetfDataSet
 
BCDataPointfDataPointLowerBoundaries
 
BCDataPointfDataPointUpperBoundaries
 
std::vector< bool > fDataFixedValues
 
double fPValue
 
double fChi2NDoF
 
double fPValueNDoF
 
bool flag_discrete
 
int fGoFNIterationsMax
 
int fGoFNIterationsRun
 
int fGoFNChains
 
std::vector< TNamed * > fPriorContainer
 
bool fPriorConstantAll
 
std::vector< bool > fPriorContainerConstant
 
std::vector< bool > fPriorContainerInterpolate
 

Detailed Description

A base class for all fitting classes.

Author
Kevin Kröninger
Version
1.0
Date
08.2013 A base class for all fitting classes

Definition at line 27 of file BCFitter.h.

Constructor & Destructor Documentation

BCFitter::BCFitter ( )

The default constructor.

Definition at line 25 of file BCFitter.cxx.

BCFitter::BCFitter ( const char *  name)

Constructor

Parameters
namename of the model

Definition at line 39 of file BCFitter.cxx.

BCFitter::~BCFitter ( )

The default destructor.

Definition at line 53 of file BCFitter.cxx.

Member Function Documentation

virtual void BCFitter::DrawFit ( const char *  options,
bool  flaglegend = false 
)
pure virtual

Draw the fit in the current pad.

Implemented in BCEfficiencyFitter, BCHistogramFitter, and BCGraphFitter.

void BCFitter::FillErrorBand ( )

Fill error band histogram for curreent iteration. This method is called from MCMCIterationInterface()

Definition at line 102 of file BCFitter.cxx.

virtual int BCFitter::Fit ( )
pure virtual

Performs the fit.

Returns
An error code.

Implemented in BCEfficiencyFitter, BCHistogramFitter, and BCGraphFitter.

virtual double BCFitter::FitFunction ( const std::vector< double > &  ,
const std::vector< double > &   
)
inlinevirtual

Defines a fit function.

Parameters
parametersA set of parameter values
xA vector of x-values
Returns
The value of the fit function at the x-values given a set of parameters

Reimplemented in BCEfficiencyFitter, BCHistogramFitter, and BCGraphFitter.

Definition at line 135 of file BCFitter.h.

TGraph* BCFitter::GetErrorBand ( )
inline
Returns
pointer to the error band

Definition at line 54 of file BCFitter.h.

std::vector< double > BCFitter::GetErrorBand ( double  level) const

Returns a vector of y-values at a certain probability level.

Parameters
levelThe level of probability
Returns
vector of y-values

Definition at line 159 of file BCFitter.cxx.

TH2D* BCFitter::GetErrorBandXY ( ) const
inline

const BCParameter * GetParameter(const char * name);

Returns
The 2-d histogram of the error band.

Definition at line 60 of file BCFitter.h.

void BCFitter::MarginalizePostprocess ( )
inline

Overloaded from BCIntegrate.

Definition at line 165 of file BCFitter.h.

void BCFitter::MarginalizePreprocess ( )

Overloaded from BCIntegrate.

Definition at line 69 of file BCFitter.cxx.

void BCFitter::MCMCIterationInterface ( )

Overloaded from BCEngineMCMC

Definition at line 58 of file BCFitter.cxx.

int BCFitter::ReadErrorBandFromFile ( const char *  file)

Read

Definition at line 297 of file BCFitter.cxx.

void BCFitter::SetErrorBandContinuous ( bool  flag)

Sets the error band flag to continuous function

Definition at line 352 of file BCFitter.cxx.

void BCFitter::SetErrorBandHisto ( TH2D *  h)
inline

Sets errorband histogram

Definition at line 97 of file BCFitter.h.

void BCFitter::SetFillErrorBand ( bool  flag = true)
inline

Turn on or off the filling of the error band during the MCMC run.

Parameters
flagset to true for turning on the filling

Definition at line 92 of file BCFitter.h.

void BCFitter::SetFitFunctionIndexX ( int  index)
inline

Sets index of the x values in function fits.

Parameters
indexIndex of the x values

Definition at line 109 of file BCFitter.h.

void BCFitter::SetFitFunctionIndexY ( int  index)
inline

Sets index of the y values in function fits.

Parameters
indexIndex of the y values

Definition at line 115 of file BCFitter.h.

void BCFitter::SetFitFunctionIndices ( int  indexx,
int  indexy 
)
inline

Sets indices of the x and y values in function fits.

Parameters
indexxIndex of the x values
indexyIndex of the y values

Definition at line 122 of file BCFitter.h.

void BCFitter::UnsetFillErrorBand ( )
inline

Turn off filling of the error band during the MCMC run. This method is equivalent to SetFillErrorBand(false)

Definition at line 103 of file BCFitter.h.

Member Data Documentation

TH2D* BCFitter::fErrorBandXY
protected

The error band histogram

Definition at line 206 of file BCFitter.h.


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