00001 #ifndef __BCMODELGRAPHFITTER__H 00002 #define __BCMODELGRAPHFITTER__H 00003 00016 /* 00017 * Copyright (C) 2008, Daniel Kollar and Kevin Kroeninger. 00018 * All rights reserved. 00019 * 00020 * For the licensing terms see doc/COPYING. 00021 */ 00022 00023 // --------------------------------------------------------- 00024 00025 #include <vector> 00026 00027 #include "BAT/BCModel.h" 00028 00029 class TGraphErrors; 00030 class TF1; 00031 00032 // --------------------------------------------------------- 00033 00034 class BCGraphFitter : public BCModel 00035 { 00036 public: 00037 00039 /* @{ */ 00040 00043 BCGraphFitter(); 00044 00049 BCGraphFitter(TGraphErrors * graph, TF1 * func); 00050 00053 ~BCGraphFitter(); 00054 00055 /* @} */ 00056 00058 /* @{ */ 00059 00062 TGraphErrors * GetGraph() 00063 { return fGraph; }; 00064 00067 TF1 * GetFitFunction() 00068 { return fFitFunction; }; 00069 00072 TGraph * GetErrorBand() 00073 { return fErrorBand; }; 00074 00077 TGraph * GetGraphFitFunction() 00078 { return fGraphFitFunction; }; 00079 00080 /* @} */ 00081 00083 /* @{ */ 00084 00087 int SetGraph(TGraphErrors * graph); 00088 00091 int SetFitFunction(TF1 * func); 00092 00093 /* @} */ 00095 /* @{ */ 00096 00100 double LogAPrioriProbability(std::vector <double> parameters); 00101 00105 double LogLikelihood(std::vector <double> parameters); 00106 00112 double FitFunction(std::vector <double> x, std::vector <double> parameters); 00113 00117 int Fit() 00118 { return this -> Fit(fGraph, fFitFunction); }; 00119 00125 int Fit(TGraphErrors * graph, TF1 * func); 00126 00129 void DrawFit(const char * options = "", bool flaglegend = false); 00130 00131 /* @} */ 00132 00133 private: 00134 00137 TGraphErrors * fGraph; 00138 00141 TF1 * fFitFunction; 00142 00145 TGraph * fErrorBand; 00146 00149 TGraph * fGraphFitFunction; 00150 00151 }; 00152 00153 // --------------------------------------------------------- 00154 00155 #endif