BayesianAnalysisToolkit  0.9.3
BCFitter.h
Go to the documentation of this file.
1 #ifndef __BCFITTER__H
2 #define __BCFITTER__H
3 
13 /*
14  * Copyright (C) 2007-2013, the BAT core developer team
15  * All rights reserved.
16  *
17  * For the licensing terms see doc/COPYING.
18  * For documentation see http://mpp.mpg.de/bat
19  */
20 
21 // ---------------------------------------------------------
22 
23 #include "../../BAT/BCModel.h"
24 
25 // ---------------------------------------------------------
26 
27 class BCFitter : public BCModel
28 {
29  public:
30 
32  /* @{ */
33 
36  BCFitter();
37 
41  BCFitter(const char * name);
42 
45  ~BCFitter();
46 
47  /* @} */
48 
50  /* @{ */
51 
54  TGraph * GetErrorBand()
55  { return fErrorBand; };
56 
60  TH2D * GetErrorBandXY() const
61  { return fErrorBandXY; }
62 
63  TH2D * GetErrorBandXY_yellow(double level=.68, int nsmooth=0) const;
64 
69  std::vector<double> GetErrorBand(double level) const;
70 
71  TGraph * GetErrorBandGraph(double level1, double level2) const;
72 
73  TGraph * GetFitFunctionGraph(const std::vector<double> &parameters);
74 
77 
78  TGraph * GetFitFunctionGraph(const std::vector<double> &parameters, double xmin, double xmax, int n=1000);
79 
80  void FixDataAxis(unsigned int index, bool fixed);
81 
82  bool GetFixedDataAxis(unsigned int index) const;
83 
84  /* @} */
85 
87  /* @{ */
88 
92  void SetFillErrorBand(bool flag = true)
93  { fFlagFillErrorBand=flag; }
94 
97  void SetErrorBandHisto(TH2D * h)
98  { fErrorBandXY = h; }
99 
104  { fFlagFillErrorBand=false; }
105 
109  void SetFitFunctionIndexX(int index)
110  { fFitFunctionIndexX = index; }
111 
115  void SetFitFunctionIndexY(int index)
116  { fFitFunctionIndexY = index; }
117 
122  void SetFitFunctionIndices(int indexx, int indexy)
123  { SetFitFunctionIndexX(indexx);
124  SetFitFunctionIndexY(indexy); }
125 
128  void SetErrorBandContinuous(bool flag);
129 
135  virtual double FitFunction(const std::vector<double> &/*x*/, const std::vector<double> &/*parameters*/)
136  { return 0; }
137 
138  /* @} */
140  /* @{ */
141 
144  int ReadErrorBandFromFile(const char * file);
145 
149  virtual int Fit() = 0;
150 
153  virtual void DrawFit(const char * options, bool flaglegend = false) = 0;
154 
157  void MCMCIterationInterface();
158 
161  void MarginalizePreprocess();
162 
166  {;};
167 
170  void FillErrorBand();
171 
172  /* @} */
173 
174  private:
175 
178  TGraph * fErrorBand;
179 
183 
188 
192  std::vector<double> fErrorBandX;
193 
197 
201 
202  protected:
203 
206  TH2D * fErrorBandXY;
207 
208 };
209 
210 // ---------------------------------------------------------
211 
212 #endif