BAT
0.9.4
The Bayesian analysis toolkit
|
A class for fitting histograms with functions. More...
#include <BCEfficiencyFitter.h>
Classes | |
class | ToyDataInterface |
Public Member Functions | |
Constructors and destructors | |
BCEfficiencyFitter () | |
BCEfficiencyFitter (const char *name) | |
BCEfficiencyFitter (TH1D *hist1, TH1D *hist2, TF1 *func) | |
BCEfficiencyFitter (const char *name, TH1D *hist1, TH1D *hist2, TF1 *func) | |
~BCEfficiencyFitter () | |
Member functions (get) | |
TH1D * | GetHistogram1 () |
TH1D * | GetHistogram2 () |
TGraphAsymmErrors * | GetHistogramRatio () |
TF1 * | GetFitFunction () |
TGraph * | GetErrorBand () |
TGraph * | GetGraphFitFunction () |
int | GetUncertainties (int n, int k, double p, double &xexp, double &xmin, double &xmax) |
Member functions (set) | |
int | SetHistograms (TH1D *hist1, TH1D *hist2) |
int | SetFitFunction (TF1 *func) |
void | SetFlagIntegration (bool flag) |
void | SetDataPointType (int type) |
Member functions (miscellaneous methods) | |
virtual double | LogLikelihood (const std::vector< double > ¶meters) |
double | FitFunction (const std::vector< double > &x, const std::vector< double > ¶meters) |
int | Fit () |
int | Fit (TH1D *hist1, TH1D *hist2, TF1 *func) |
void | DrawFit (const char *options="", bool flaglegend=false) |
int | CalculatePValueFast (const std::vector< double > &par, BCEfficiencyFitter::ToyDataInterface *callback, double &pvalue, double &pvalueCorrected, unsigned nIterations=100000) |
int | CalculatePValueFast (const std::vector< double > &par, double &pvalue, double &pvalueCorrected, unsigned nIterations=100000) |
![]() | |
BCFitter () | |
BCFitter (const char *name) | |
~BCFitter () | |
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 > ¶meters) |
TGraph * | GetFitFunctionGraph () |
TGraph * | GetFitFunctionGraph (const std::vector< double > ¶meters, double xmin, double xmax, int n=1000) |
void | FixDataAxis (unsigned int index, bool fixed) |
bool | GetFixedDataAxis (unsigned int index) const |
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) |
int | ReadErrorBandFromFile (const char *file) |
void | MCMCIterationInterface () |
void | MarginalizePreprocess () |
void | MarginalizePostprocess () |
void | FillErrorBand () |
![]() | |
BCModel (const char *name="model") | |
BCModel (const BCModel &bcmodel) | |
virtual | ~BCModel () |
BCModel & | operator= (const BCModel &bcmodel) |
const std::string & | GetName () const |
double | GetModelAPrioriProbability () const |
double | GetModelAPosterioriProbability () const |
BCDataSet * | GetDataSet () const |
BCDataPoint * | GetDataPointLowerBoundaries () const |
BCDataPoint * | GetDataPointUpperBoundaries () const |
double | GetDataPointLowerBoundary (unsigned int index) const |
double | GetDataPointUpperBoundary (unsigned int index) const |
bool | GetFlagBoundaries () const |
unsigned | GetNDataPoints () const |
BCDataPoint * | GetDataPoint (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 > ¶meters) |
virtual double | LogAPrioriProbability (const std::vector< double > ¶meters) |
virtual double | Likelihood (const std::vector< double > ¶ms) |
double | ProbabilityNN (const std::vector< double > ¶ms) |
double | LogProbabilityNN (const std::vector< double > ¶meters) |
double | Probability (const std::vector< double > ¶meter) |
double | LogProbability (const std::vector< double > ¶meter) |
virtual double | SamplingFunction (const std::vector< double > ¶meters) |
double | Eval (const std::vector< double > ¶meters) |
virtual double | LogEval (const std::vector< double > ¶meters) |
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) |
BCH1D * | CalculatePValue (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) |
Additional Inherited Members | |
![]() | |
TH2D * | fErrorBandXY |
![]() | |
std::string | fName |
double | fModelAPriori |
double | fModelAPosteriori |
BCDataSet * | fDataSet |
BCDataPoint * | fDataPointLowerBoundaries |
BCDataPoint * | fDataPointUpperBoundaries |
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 |
A class for fitting histograms with functions.
Definition at line 39 of file BCEfficiencyFitter.h.
BCEfficiencyFitter::BCEfficiencyFitter | ( | ) |
The default constructor.
Definition at line 32 of file BCEfficiencyFitter.cxx.
BCEfficiencyFitter::BCEfficiencyFitter | ( | const char * | name | ) |
BCEfficiencyFitter::BCEfficiencyFitter | ( | TH1D * | hist1, |
TH1D * | hist2, | ||
TF1 * | func | ||
) |
A constructor.
hist1 | The histogram with the larger numbers |
hist2 | The histogram with the smaller numbers |
func | The fit function. |
Definition at line 66 of file BCEfficiencyFitter.cxx.
BCEfficiencyFitter::BCEfficiencyFitter | ( | const char * | name, |
TH1D * | hist1, | ||
TH1D * | hist2, | ||
TF1 * | func | ||
) |
Constructor.
name | name fo the model |
hist1 | The histogram with the larger numbers |
hist2 | The histogram with the smaller numbers |
func | The fit function. |
Definition at line 85 of file BCEfficiencyFitter.cxx.
BCEfficiencyFitter::~BCEfficiencyFitter | ( | ) |
The default destructor.
Definition at line 211 of file BCEfficiencyFitter.cxx.
int BCEfficiencyFitter::CalculatePValueFast | ( | const std::vector< double > & | par, |
BCEfficiencyFitter::ToyDataInterface * | callback, | ||
double & | pvalue, | ||
double & | pvalueCorrected, | ||
unsigned | nIterations = 100000 |
||
) |
Calculate the p-value using fast-MCMC. In every iteration, a new toy data set is created. By providing a suitable implementation of ToyDataInterface, the user can calculate the distribution of an arbitrary statistic. Each toy data set as well as the expected values for the parameter values are passed on to the interface.
par | A set of parameter values |
pvalue | The p-value for the default likelihood statistic |
pvalueCorrected | The p-value for the default likelihood statistic with corrections for DoF to reduce fitting bias, in all nonpathological cases the correction lowers the p-value. |
callback | requires class with operator(...) defined. |
nIterations | number of toy data sets generated by the Markov chain |
Definition at line 451 of file BCEfficiencyFitter.cxx.
int BCEfficiencyFitter::CalculatePValueFast | ( | const std::vector< double > & | par, |
double & | pvalue, | ||
double & | pvalueCorrected, | ||
unsigned | nIterations = 100000 |
||
) |
Calculate the p-value using fast-MCMC.
par | A set of parameter values |
pvalue | The pvalue |
pvalueCorrected | The p-value for the default likelihood statistic with corrections for DoF to reduce fitting bias |
nIterations | number of pseudo experiments generated by the Markov chain |
Definition at line 443 of file BCEfficiencyFitter.cxx.
|
virtual |
Draw the fit in the current pad.
Implements BCFitter.
Definition at line 349 of file BCEfficiencyFitter.cxx.
|
virtual |
Performs the fit.
Implements BCFitter.
Definition at line 309 of file BCEfficiencyFitter.cxx.
int BCEfficiencyFitter::Fit | ( | TH1D * | hist1, |
TH1D * | hist2, | ||
TF1 * | func | ||
) |
Performs the fit.
hist1 | The histogram with the larger number. |
hist2 | The histogram with the smaller number. |
func | The fit function. |
Definition at line 286 of file BCEfficiencyFitter.cxx.
|
virtual |
Returns the y-value of the 1-dimensional fit function at an x and for a set of parameters.
x | A vector with the x-value. |
parameters | A set of parameters. |
Reimplemented from BCFitter.
Definition at line 276 of file BCEfficiencyFitter.cxx.
|
inline |
Definition at line 120 of file BCEfficiencyFitter.h.
|
inline |
Definition at line 115 of file BCEfficiencyFitter.h.
|
inline |
Definition at line 125 of file BCEfficiencyFitter.h.
|
inline |
Definition at line 100 of file BCEfficiencyFitter.h.
|
inline |
Definition at line 105 of file BCEfficiencyFitter.h.
|
inline |
Definition at line 110 of file BCEfficiencyFitter.h.
int BCEfficiencyFitter::GetUncertainties | ( | int | n, |
int | k, | ||
double | p, | ||
double & | xexp, | ||
double & | xmin, | ||
double & | xmax | ||
) |
Calculates the central value and the lower and upper limits for a given probability.
n | n for the binomial. |
k | k for the binomial. |
p | The central probability defining the limits. |
xmin | The central value. |
xmin | The lower limit. |
xmax | The upper limit. |
Definition at line 576 of file BCEfficiencyFitter.cxx.
|
virtual |
The log of the prior probability. Overloaded from BCModel.
parameters | A vector of doubles containing the parameter values. The log of the conditional probability. Overloaded from BCModel. |
parameters | A vector of doubles containing the parameter values. |
Implements BCModel.
Definition at line 230 of file BCEfficiencyFitter.cxx.
void BCEfficiencyFitter::SetDataPointType | ( | int | type | ) |
Set type of point to be used to plot the efficiency data 0 - mean + rms 1 - mode + smallest 68% 2 - median + central 68%
Definition at line 220 of file BCEfficiencyFitter.cxx.
int BCEfficiencyFitter::SetFitFunction | ( | TF1 * | func | ) |
func | The fit function |
Definition at line 171 of file BCEfficiencyFitter.cxx.
|
inline |
Sets the flag for integration.
true: use ROOT's TH1D::Integrate()
false: use linear interpolation
Definition at line 158 of file BCEfficiencyFitter.h.
int BCEfficiencyFitter::SetHistograms | ( | TH1D * | hist1, |
TH1D * | hist2 | ||
) |
hist | The histogram 1 |
hist | The histogram 2 |
Definition at line 105 of file BCEfficiencyFitter.cxx.