BCGraphFitter.h
1 #ifndef __BCMODELGRAPHFITTER__H
2 #define __BCMODELGRAPHFITTER__H
3 
16 /*
17  * Copyright (C) 2007-2018, the BAT core developer team
18  * All rights reserved.
19  *
20  * For the licensing terms see doc/COPYING.
21  * For documentation see http://mpp.mpg.de/bat
22  */
23 
24 // ---------------------------------------------------------
25 
26 #include "BCFitter.h"
27 
28 #include <TGraphErrors.h>
29 
30 #include <string>
31 #include <vector>
32 
33 // ---------------------------------------------------------
34 
35 class BCGraphFitter : public BCFitter
36 {
37 public:
38 
40  /* @{ */
46  BCGraphFitter(const TGraphErrors& graph, const TF1& func, const std::string& name = "graph_fitter_model");
47 
50  virtual ~BCGraphFitter();
51 
52  /* @} */
53 
55  /* @{ */
56 
59  const TGraph& GetGraph()
60  { return fGraph; };
61 
62  /* @} */
63 
65  /* @{ */
66 
70  virtual double LogLikelihood(const std::vector<double>& parameters);
71 
75  void Fit();
76 
79  void DrawFit(const std::string& options = "", bool flaglegend = false);
80 
85  virtual double CalculateChi2(const std::vector<double>& pars);
86 
93  virtual double CalculatePValue(const std::vector<double>& pars, bool ndf = true);
94 
95  /* @} */
96 
97 private:
98 
101  TGraphErrors fGraph;
102 };
103 
104 // ---------------------------------------------------------
105 
106 #endif
virtual double CalculatePValue(const std::vector< double > &pars, bool ndf=true)
Calculate p value from chi^2 distribution, with assumption of Gaussian distribution for all data poin...
void Fit()
Performs the fit.
const TGraph & GetGraph()
Definition: BCGraphFitter.h:59
A class for fitting graphs with functions.
Definition: BCGraphFitter.h:35
virtual double LogLikelihood(const std::vector< double > &parameters)
The log of the conditional probability.
virtual ~BCGraphFitter()
The default destructor.
void DrawFit(const std::string &options="", bool flaglegend=false)
Draw the fit in the current pad.
BCGraphFitter(const TGraphErrors &graph, const TF1 &func, const std::string &name="graph_fitter_model")
Constructor.
A base class for all fitting classes.
Definition: BCFitter.h:31
virtual double CalculateChi2(const std::vector< double > &pars)
Calculate chi^2, the sum of [(y-f(x))/sigma_y]^2 for all data points.