BayesianAnalysisToolkit  0.9.3
BCEfficiencyFitter.h
Go to the documentation of this file.
1 #ifndef __BCEFFICIENCYFITTER__H
2 #define __BCEFFICIENCYFITTER__H
3 
18 /*
19  * Copyright (C) 2007-2013, the BAT core developer team
20  * All rights reserved.
21  *
22  * For the licensing terms see doc/COPYING.
23  * For documentation see http://mpp.mpg.de/bat
24  */
25 
26 // ---------------------------------------------------------
27 
28 #include <vector>
29 
30 #include "BCFitter.h"
31 
32 // ROOT classes
33 class TH1D;
34 class TF1;
35 class TGraphAsymmErrors;
36 
37 // ---------------------------------------------------------
38 
40 {
41  public:
42 
49  {
50  public:
57  virtual void operator()(const std::vector<double>& expectation, const std::vector<unsigned>& toyData) = 0;
58 
60  virtual ~ToyDataInterface(){}
61  };
62 
64  /* @{ */
65 
69 
73  BCEfficiencyFitter(const char * name);
74 
80  BCEfficiencyFitter(TH1D * hist1, TH1D * hist2, TF1 * func);
81 
88  BCEfficiencyFitter(const char * name, TH1D * hist1, TH1D * hist2, TF1 * func);
89 
93 
94  /* @} */
96  /* @{ */
97 
100  TH1D * GetHistogram1()
101  { return fHistogram1; };
102 
105  TH1D * GetHistogram2()
106  { return fHistogram2; };
107 
110  TGraphAsymmErrors * GetHistogramRatio()
111  { return fHistogramRatio; };
112 
116  { return fFitFunction; };
117 
120  TGraph * GetErrorBand()
121  { return fErrorBand; };
122 
126  { return fGraphFitFunction; };
127 
137  int GetUncertainties(int n, int k, double p, double &xexp, double &xmin, double &xmax);
138 
139  /* @} */
141  /* @{ */
142 
147  int SetHistograms(TH1D * hist1, TH1D * hist2);
148 
152  int SetFitFunction(TF1 * func);
153 
158  void SetFlagIntegration(bool flag)
159  { fFlagIntegration = flag; };
160 
165  void SetDataPointType(int type);
166 
167  /* @} */
169  /* @{ */
170 
174 // virtual double LogAPrioriProbability(const std::vector<double> & parameters);
175 
179  virtual double LogLikelihood(const std::vector<double> & parameters);
180 
186  double FitFunction(const std::vector<double> & x, const std::vector<double> & parameters);
187 
191  int Fit();
192 
199  int Fit(TH1D * hist1, TH1D * hist2, TF1 * func);
200 
203  void DrawFit(const char * options = "", bool flaglegend = false);
204 
218  int CalculatePValueFast(const std::vector<double> & par,
219  BCEfficiencyFitter::ToyDataInterface * callback, double & pvalue,
220  double & pvalueCorrected, unsigned nIterations = 100000);
221 
230  int CalculatePValueFast(const std::vector<double> & par, double & pvalue,
231  double & pvalueCorrected, unsigned nIterations = 100000);
232 
233  /* @} */
234 
235  private:
236 
239  TH1D * fHistogram1;
240 
243  TH1D * fHistogram2;
244 
247  TGraphAsymmErrors * fHistogramRatio;
248 
252 
257 
260  TGraph * fErrorBand;
261 
265 
269 
274  unsigned int fDataPointType;
275 
276 };
277 
278 // ---------------------------------------------------------
279 
280 #endif