00001 #ifndef __BCMODELGRAPHFITTER__H 00002 #define __BCMODELGRAPHFITTER__H 00003 00016 /* 00017 * Copyright (C) 2008-2011, 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 "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 00124 int Fit(TGraphErrors * graph, TF1 * func); 00125 00128 void DrawFit(const char * options = "", bool flaglegend = false); 00129 00130 virtual double CDF(const std::vector<double>& parameters, int index, bool lower=false); 00131 00132 /* @} */ 00133 00134 private: 00135 00138 TGraphErrors * fGraph; 00139 00142 TF1 * fFitFunction; 00143 00146 TGraph * fErrorBand; 00147 00150 TGraph * fGraphFitFunction; 00151 00152 }; 00153 00154 // --------------------------------------------------------- 00155 00156 #endif