BAT  0.9.4
The Bayesian analysis toolkit
 All Classes Namespaces Functions Variables Enumerations
BCHistogramFitter.h
1 #ifndef __BCMODELHISTOGRAMFITTER__H
2 #define __BCMODELHISTOGRAMFITTER__H
3 
15 /*
16  * Copyright (C) 2007-2014, the BAT core developer team
17  * All rights reserved.
18  *
19  * For the licensing terms see doc/COPYING.
20  * For documentation see http://mpp.mpg.de/bat
21  */
22 
23 // ---------------------------------------------------------
24 
25 #include <vector>
26 
27 #include "BCFitter.h"
28 
29 // ROOT classes
30 class TH1D;
31 class TF1;
32 
33 // ---------------------------------------------------------
34 
36 {
37  public:
38 
40  /* @{ */
41 
45 
49  BCHistogramFitter(const char * name);
50 
55  BCHistogramFitter(TH1D * hist, TF1 * func);
56 
62  BCHistogramFitter(const char * name, TH1D * hist, TF1 * func);
63 
67 
68  /* @} */
69 
71  /* @{ */
72 
75  TH1D * GetHistogram()
76  { return fHistogram; };
77 
81  { return fHistogramExpected; };
82 
83 
87  { return fFitFunction; };
88 
91  TGraph * GetErrorBand()
92  { return fErrorBand; };
93 
97  { return fGraphFitFunction; };
98 
99  /* @} */
100 
102  /* @{ */
103 
108  int SetHistogram(TH1D * hist);
109 
114  int SetHistogramExpected(const std::vector<double>& parameters);
115 
120  int SetFitFunction(TF1 * func);
121 
126  void SetFlagIntegration(bool flag)
127  { fFlagIntegration = flag; };
128 
129  /* @} */
131  /* @{ */
132 
136 // virtual double LogAPrioriProbability(const std::vector<double> & parameters);
137 
141  virtual double LogLikelihood(const std::vector<double> & parameters);
142 
151 // void PrintHistogram(const char * options = "", const char * filename = "");
152 
158  double FitFunction(const std::vector<double> & x, const std::vector<double> & parameters);
159 
163  int Fit();
164 
170  int Fit(TH1D * hist, TF1 * func);
171 
174  void DrawFit(const char * options = "HIST", bool flaglegend = false);
175 
186  int CalculatePValueFast(const std::vector<double> & par, unsigned nIterations = 100000);
187 
195  int CalculatePValueLikelihood(const std::vector<double> &par);
196 
207  int CalculatePValueLeastSquares(const std::vector<double> &par, bool weightExpect=true);
208 
216  int CalculatePValueKolmogorov(const std::vector<double> &par);
217 
218  double CDF(const std::vector<double>& parameters, int index, bool lower=false);
219 
220  /* @} */
221 
222  private:
223 
227  TH1D * fHistogram;
228 
231  TF1 * fFitFunction;
232 
236  bool fFlagIntegration;
237 
240  TGraph * fErrorBand;
241 
244  TGraph * fGraphFitFunction;
245 
249  TH1D * fHistogramExpected;
250 };
251 
252 // ---------------------------------------------------------
253 
254 #endif
virtual double LogLikelihood(const std::vector< double > &parameters)
int SetFitFunction(TF1 *func)
TGraph * GetGraphFitFunction()
int CalculatePValueLeastSquares(const std::vector< double > &par, bool weightExpect=true)
int SetHistogramExpected(const std::vector< double > &parameters)
void SetFlagIntegration(bool flag)
A class for fitting histograms with functions.
double FitFunction(const std::vector< double > &x, const std::vector< double > &parameters)
int CalculatePValueKolmogorov(const std::vector< double > &par)
int SetHistogram(TH1D *hist)
TH1D * GetHistogramExpected()
double CDF(const std::vector< double > &parameters, int index, bool lower=false)
void DrawFit(const char *options="HIST", bool flaglegend=false)
int CalculatePValueFast(const std::vector< double > &par, unsigned nIterations=100000)
A base class for all fitting classes.
Definition: BCFitter.h:27
int CalculatePValueLikelihood(const std::vector< double > &par)