00001 #ifndef __BCEFFICIENCYFITTER__H
00002 #define __BCEFFICIENCYFITTER__H
00003
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include <vector>
00028
00029 #include "BAT/BCModel.h"
00030
00031
00032 class TH1D;
00033 class TF1;
00034 class TGraphAsymmErrors;
00035
00036
00037
00038 class BCEfficiencyFitter : public BCModel
00039 {
00040 public:
00041
00043
00044
00047 BCEfficiencyFitter();
00048
00054 BCEfficiencyFitter(TH1D * hist1, TH1D * hist2, TF1 * func);
00055
00058 ~BCEfficiencyFitter();
00059
00060
00062
00063
00066 TH1D * GetHistogram1()
00067 { return fHistogram1; };
00068
00071 TH1D * GetHistogram2()
00072 { return fHistogram2; };
00073
00076 TGraphAsymmErrors * GetHistogramRatio()
00077 { return fHistogramRatio; };
00078
00081 TF1 * GetFitFunction()
00082 { return fFitFunction; };
00083
00086 TGraph * GetErrorBand()
00087 { return fErrorBand; };
00088
00091 TGraph * GetGraphFitFunction()
00092 { return fGraphFitFunction; };
00093
00102 int GetUncertainties(int n, int k, double p, double &xmin, double &xmax);
00103
00104
00106
00107
00112 int SetHistograms(TH1D * hist1, TH1D * hist2);
00113
00117 int SetFitFunction(TF1 * func);
00118
00123 void SetFlagIntegration(bool flag)
00124 { fFlagIntegration = flag; };
00125
00126
00128
00129
00133 virtual double LogAPrioriProbability(std::vector <double> parameters);
00134
00138 virtual double LogLikelihood(std::vector <double> parameters);
00139
00145 double FitFunction(std::vector <double> x, std::vector <double> parameters);
00146
00150 int Fit()
00151 { return this -> Fit(fHistogram1, fHistogram2, fFitFunction); };
00152
00159 int Fit(TH1D * hist1, TH1D * hist2, TF1 * func);
00160
00163 void DrawFit(const char * options = "", bool flaglegend = false);
00164
00170 int CalculatePValueFast(std::vector<double> par, double &pvalue);
00171
00172
00173
00174 private:
00175
00178 TH1D * fHistogram1;
00179
00182 TH1D * fHistogram2;
00183
00186 TGraphAsymmErrors * fHistogramRatio;
00187
00190 TF1 * fFitFunction;
00191
00195 bool fFlagIntegration;
00196
00199 TGraph * fErrorBand;
00200
00203 TGraph * fGraphFitFunction;
00204
00207 TH1D * fHistogramBinomial;
00208
00209 };
00210
00211
00212
00213 #endif