ROOT  6.06/09
Reference Guide
Fitter.h
Go to the documentation of this file.
1 // @(#)root/mathcore:$Id$
2 // Author: L. Moneta Wed Aug 30 11:05:19 2006
3 
4 /**********************************************************************
5  * *
6  * Copyright (c) 2006 LCG ROOT Math Team, CERN/PH-SFT *
7  * *
8  * *
9  **********************************************************************/
10 
11 // Header file for class Fitter
12 
13 #ifndef ROOT_Fit_Fitter
14 #define ROOT_Fit_Fitter
15 
16 /**
17 @defgroup Fit Fitting and Parameter Estimation
18 
19 Classes used for fitting (regression analysis) and estimation of parameter values given a data sample.
20 
21 @ingroup MathCore
22 
23 */
24 
25 // #ifndef ROOT_Fit_DataVectorfwd
26 // #include "Fit/DataVectorfwd.h"
27 // #endif
28 #ifndef ROOT_Fit_BinData
29 #include "Fit/BinData.h"
30 #endif
31 #ifndef ROOT_Fit_UnBinData
32 #include "Fit/UnBinData.h"
33 #endif
34 
35 #ifndef ROOT_Fit_FitConfig
36 #include "Fit/FitConfig.h"
37 #endif
38 
39 #ifndef ROOT_Fit_FitResult
40 #include "Fit/FitResult.h"
41 #endif
42 
43 #ifndef ROOT_Math_IParamFunctionfwd
44 #include "Math/IParamFunctionfwd.h"
45 #endif
46 
47 #include <memory>
48 
49 
50 namespace ROOT {
51 
52 
53  namespace Math {
54  class Minimizer;
55 
56  // should maybe put this in a FitMethodFunctionfwd file
57  template<class FunctionType> class BasicFitMethodFunction;
58 
59  // define the normal and gradient function
62 
63  }
64 
65  /**
66  Namespace for the fitting classes
67  @ingroup Fit
68  */
69 
70  namespace Fit {
71 
72 /**
73  @defgroup FitMain User Fitting classes
74 
75  Main Classes used for fitting a given data set
76  @ingroup Fit
77 */
78 
79 
80 //___________________________________________________________________________________
81 /**
82  Fitter class, entry point for performing all type of fits.
83  Fits are performed using the generic ROOT::Fit::Fitter::Fit method.
84  The inputs are the data points and a model function (using a ROOT::Math::IParamFunction)
85  The result of the fit is returned and kept internally in the ROOT::Fit::FitResult class.
86  The configuration of the fit (parameters, options, etc...) are specified in the
87  ROOT::Math::FitConfig class.
88  After fitting the config of the fit will be modified to have the new values the resulting
89  parameter of the fit with step sizes equal to the errors. FitConfig can be preserved with
90  initial parameters by calling FitConfig.SetUpdateAfterFit(false);
91 
92  @ingroup FitMain
93 */
94 class Fitter {
95 
96 public:
97 
102 
105 
106 
107  /**
108  Default constructor
109  */
110  Fitter ();
111 
112  /**
113  Constructor from a result
114  */
115  Fitter (const std::shared_ptr<FitResult> & result);
116 
117 
118  /**
119  Destructor
120  */
121  ~Fitter ();
122 
123 private:
124 
125  /**
126  Copy constructor (disabled, class is not copyable)
127  */
128  Fitter(const Fitter &);
129 
130  /**
131  Assignment operator (disabled, class is not copyable)
132  */
133  Fitter & operator = (const Fitter & rhs);
134 
135 
136 public:
137 
138  /**
139  fit a data set using any generic model function
140  If data set is binned a least square fit is performed
141  If data set is unbinned a maximum likelihood fit (not extended) is done
142  Pre-requisite on the function:
143  it must implement the 1D or multidimensional parametric function interface
144  */
145  template < class Data , class Function>
146  bool Fit( const Data & data, const Function & func ) {
147  SetFunction(func);
148  return Fit(data);
149  }
150 
151  /**
152  Fit a binned data set using a least square fit (default method)
153  */
154  bool Fit(const BinData & data) {
155  SetData(data);
156  return DoLeastSquareFit();
157  }
158  bool Fit(const std::shared_ptr<BinData> & data) {
159  SetData(data);
160  return DoLeastSquareFit();
161  }
162 
163  /**
164  Fit a binned data set using a least square fit
165  */
166  bool LeastSquareFit(const BinData & data) {
167  return Fit(data);
168  }
169 
170  /**
171  fit an unbinned data set using loglikelihood method
172  */
173  bool Fit(const UnBinData & data, bool extended = false) {
174  SetData(data);
175  return DoUnbinnedLikelihoodFit(extended);
176  }
177 
178  /**
179  Binned Likelihood fit. Default is extended
180  */
181  bool LikelihoodFit(const BinData & data, bool extended = true) {
182  SetData(data);
183  return DoBinnedLikelihoodFit(extended);
184  }
185  bool LikelihoodFit(const std::shared_ptr<BinData> & data, bool extended = true) {
186  SetData(data);
187  return DoBinnedLikelihoodFit(extended);
188  }
189  /**
190  Unbinned Likelihood fit. Default is not extended
191  */
192  bool LikelihoodFit(const UnBinData & data, bool extended = false) {
193  SetData(data);
194  return DoUnbinnedLikelihoodFit(extended);
195  }
196  bool LikelihoodFit(const std::shared_ptr<UnBinData> & data, bool extended = false) {
197  SetData(data);
198  return DoUnbinnedLikelihoodFit(extended);
199  }
200 
201 
202  /**
203  fit a data set using any generic model function
204  Pre-requisite on the function:
205  */
206  template < class Data , class Function>
207  bool LikelihoodFit( const Data & data, const Function & func, bool extended) {
208  SetFunction(func);
209  return LikelihoodFit(data, extended);
210  }
211 
212  /**
213  do a linear fit on a set of bin-data
214  */
215  bool LinearFit(const BinData & data) {
216  SetData(data);
217  return DoLinearFit();
218  }
219  bool LinearFit(const std::shared_ptr<BinData> & data) {
220  SetData(data);
221  return DoLinearFit();
222  }
223 
224 
225  /**
226  Fit using the a generic FCN function as a C++ callable object implementing
227  double () (const double *)
228  Note that the function dimension (i.e. the number of parameter) is needed in this case
229  For the options see documentation for following methods FitFCN(IMultiGenFunction & fcn,..)
230  */
231  template <class Function>
232  bool FitFCN(unsigned int npar, Function & fcn, const double * params = 0, unsigned int dataSize = 0, bool chi2fit = false);
233 
234  /**
235  Set a generic FCN function as a C++ callable object implementing
236  double () (const double *)
237  Note that the function dimension (i.e. the number of parameter) is needed in this case
238  For the options see documentation for following methods FitFCN(IMultiGenFunction & fcn,..)
239  */
240  template <class Function>
241  bool SetFCN(unsigned int npar, Function & fcn, const double * params = 0, unsigned int dataSize = 0, bool chi2fit = false);
242 
243  /**
244  Fit using the given FCN function represented by a multi-dimensional function interface
245  (ROOT::Math::IMultiGenFunction).
246  Give optionally the initial arameter values, data size to have the fit Ndf correctly
247  set in the FitResult and flag specifying if it is a chi2 fit.
248  Note that if the parameters values are not given (params=0) the
249  current parameter settings are used. The parameter settings can be created before
250  by using the FitConfig::SetParamsSetting. If they have not been created they are created
251  automatically when the params pointer is not zero.
252  Note that passing a params != 0 will set the parameter settings to the new value AND also the
253  step sizes to some pre-defined value (stepsize = 0.3 * abs(parameter_value) )
254  */
255  bool FitFCN(const ROOT::Math::IMultiGenFunction & fcn, const double * params = 0, unsigned int dataSize = 0, bool
256  chi2fit = false);
257 
258  /**
259  Fit using a FitMethodFunction interface. Same as method above, but now extra information
260  can be taken from the function class
261  */
262  bool FitFCN(const ROOT::Math::FitMethodFunction & fcn, const double * params = 0);
263 
264  /**
265  Set the FCN function represented by a multi-dimensional function interface
266  (ROOT::Math::IMultiGenFunction) and optionally the initial parameters
267  See also note above for the initial parameters for FitFCN
268  */
269  bool SetFCN(const ROOT::Math::IMultiGenFunction & fcn, const double * params = 0, unsigned int dataSize = 0, bool chi2fit = false);
270 
271  /**
272  Set the objective function (FCN) using a FitMethodFunction interface.
273  Same as method above, but now extra information can be taken from the function class
274  */
275  bool SetFCN(const ROOT::Math::FitMethodFunction & fcn, const double * params = 0);
276 
277  /**
278  Fit using the given FCN function representing a multi-dimensional gradient function
279  interface (ROOT::Math::IMultiGradFunction). In this case the minimizer will use the
280  gradient information provided by the function.
281  For the options same consideration as in the previous method
282  */
283  bool FitFCN(const ROOT::Math::IMultiGradFunction & fcn, const double * params = 0, unsigned int dataSize = 0, bool chi2fit = false);
284 
285  /**
286  Fit using a FitMethodGradFunction interface. Same as method above, but now extra information
287  can be taken from the function class
288  */
289  bool FitFCN(const ROOT::Math::FitMethodGradFunction & fcn, const double * params = 0);
290 
291  /**
292  Set the FCN function represented by a multi-dimensional gradient function interface
293  (ROOT::Math::IMultiGenFunction) and optionally the initial parameters
294  See also note above for the initial parameters for FitFCN
295  */
296  bool SetFCN(const ROOT::Math::IMultiGradFunction & fcn, const double * params = 0, unsigned int dataSize = 0, bool chi2fit = false);
297 
298  /**
299  Set the objective function (FCN) using a FitMethodGradFunction interface.
300  Same as method above, but now extra information can be taken from the function class
301  */
302  bool SetFCN(const ROOT::Math::FitMethodGradFunction & fcn, const double * params = 0);
303 
304 
305  /**
306  fit using user provided FCN with Minuit-like interface
307  If npar = 0 it is assumed that the parameters are specified in the parameter settings created before
308  For the options same consideration as in the previous method
309  */
310  typedef void (* MinuitFCN_t )(int &npar, double *gin, double &f, double *u, int flag);
311  bool FitFCN( MinuitFCN_t fcn, int npar = 0, const double * params = 0, unsigned int dataSize = 0, bool chi2fit = false);
312 
313  /**
314  set objective function using user provided FCN with Minuit-like interface
315  If npar = 0 it is assumed that the parameters are specified in the parameter settings created before
316  For the options same consideration as in the previous method
317  */
318  bool SetFCN( MinuitFCN_t fcn, int npar = 0, const double * params = 0, unsigned int dataSize = 0, bool chi2fit = false);
319 
320  /**
321  Perform a fit with the previously set FCN function. Require SetFCN before
322  */
323  bool FitFCN();
324 
325  /**
326  Perform a simple FCN evaluation. FitResult will be modified and contain the value of the FCN
327  */
328  bool EvalFCN();
329 
330 
331 
332  /**
333  Set the fitted function (model function) from a parametric function interface
334  */
335  void SetFunction(const IModelFunction & func, bool useGradient = false);
336  /**
337  Set the fitted function from a parametric 1D function interface
338  */
339  void SetFunction(const IModel1DFunction & func, bool useGradient = false);
340 
341  /**
342  Set the fitted function (model function) from a parametric gradient function interface
343  */
344  void SetFunction(const IGradModelFunction & func, bool useGradient = true);
345  /**
346  Set the fitted function from 1D gradient parametric function interface
347  */
348  void SetFunction(const IGradModel1DFunction & func, bool useGradient = true);
349 
350 
351  /**
352  get fit result
353  */
354  const FitResult & Result() const {
355  assert( fResult.get() );
356  return *fResult;
357  }
358 
359 
360  /**
361  perform an error analysis on the result using the Hessian
362  Errors are obtaied from the inverse of the Hessian matrix
363  To be called only after fitting and when a minimizer supporting the Hessian calculations is used
364  otherwise an error (false) is returned.
365  A new FitResult with the Hessian result will be produced
366  */
367  bool CalculateHessErrors();
368 
369  /**
370  perform an error analysis on the result using MINOS
371  To be called only after fitting and when a minimizer supporting MINOS is used
372  otherwise an error (false) is returned.
373  The result will be appended in the fit result class
374  Optionally a vector of parameter indeces can be passed for selecting
375  the parameters to analyse using FitConfig::SetMinosErrors
376  */
377  bool CalculateMinosErrors();
378 
379  /**
380  access to the fit configuration (const method)
381  */
382  const FitConfig & Config() const { return fConfig; }
383 
384  /**
385  access to the configuration (non const method)
386  */
387  FitConfig & Config() { return fConfig; }
388 
389  /**
390  query if fit is binned. In cse of false teh fit can be unbinned
391  or is not defined (like in case of fitting through a ::FitFCN)
392  */
393  bool IsBinFit() const { return fBinFit; }
394 
395  /**
396  return pointer to last used minimizer
397  (is NULL in case fit is not yet done)
398  This pointer is guranteed to be valid as far as the fitter class is valid and a new fit is not redone.
399  To be used only after fitting.
400  The pointer should not be stored and will be invalided after performing a new fitting.
401  In this case a new instance of ROOT::Math::Minimizer will be re-created and can be
402  obtained calling again GetMinimizer()
403  */
404  ROOT::Math::Minimizer * GetMinimizer() const { return fMinimizer.get(); }
405 
406  /**
407  return pointer to last used objective function
408  (is NULL in case fit is not yet done)
409  This pointer will be valid as far as the fitter class
410  has not been deleted. To be used after the fitting.
411  The pointer should not be stored and will be invalided after performing a new fitting.
412  In this case a new instance of the function pointer will be re-created and can be
413  obtained calling again GetFCN()
414  */
416 
417 
418  /**
419  apply correction in the error matrix for the weights for likelihood fits
420  This method can be called only after a fit. The
421  passed function (loglw2) is a log-likelihood function impelemented using the
422  sum of weight squared
423  When using FitConfig.SetWeightCorrection() this correction is applied
424  automatically when doing a likelihood fit (binned or unbinned)
425  */
426  bool ApplyWeightCorrection(const ROOT::Math::IMultiGenFunction & loglw2, bool minimizeW2L=false);
427 
428 
429 protected:
430 
431 
432  /// least square fit
433  bool DoLeastSquareFit();
434  /// binned likelihood fit
435  bool DoBinnedLikelihoodFit( bool extended = true);
436  /// un-binned likelihood fit
437  bool DoUnbinnedLikelihoodFit( bool extended = false);
438  /// linear least square fit
439  bool DoLinearFit();
440 
441  // initialize the minimizer
442  bool DoInitMinimizer();
443  /// do minimization
444  bool DoMinimization(const BaseFunc & f, const ROOT::Math::IMultiGenFunction * chifunc = 0);
445  // do minimization after having set obj function
446  bool DoMinimization(const ROOT::Math::IMultiGenFunction * chifunc = 0);
447  // update config after fit
448  void DoUpdateFitConfig();
449  // get function calls from the FCN
450  int GetNCallsFromFCN();
451 
452 
453  //set data for the fit
454  void SetData(const FitData & data) {
455  fData = std::shared_ptr<FitData>(const_cast<FitData*>(&data),DummyDeleter<FitData>());
456  }
457  // set data and function without cloning them
458  void SetFunctionAndData(const IModelFunction & func, const FitData & data) {
459  SetData(data);
460  fFunc = std::shared_ptr<IModelFunction>(const_cast<IModelFunction*>(&func),DummyDeleter<IModelFunction>());
461  }
462 
463  //set data for the fit using a shared ptr
464  template <class Data>
465  void SetData(const std::shared_ptr<Data> & data) {
466  fData = std::static_pointer_cast<Data>(data);
467  }
468 
469  /// look at the user provided FCN and get data and model function is
470  /// they derive from ROOT::Fit FCN classes
471  void ExamineFCN();
472 
473 
474  /// internal functions to get data set and model function from FCN
475  /// useful for fits done with customized FCN classes
476  template <class ObjFuncType>
477  bool GetDataFromFCN();
478 
479 
480 private:
481 
482  bool fUseGradient; // flag to indicate if using gradient or not
483 
484  bool fBinFit; // flag to indicate if fit is binned
485  // in case of false the fit is unbinned or undefined)
486  // flag it is used to compute chi2 for binned likelihood fit
487 
488  int fFitType; // type of fit (0 undefined, 1 least square, 2 likelihood)
489 
490  int fDataSize; // size of data sets (need for Fumili or LM fitters)
491 
492  FitConfig fConfig; // fitter configuration (options and parameter settings)
493 
494  std::shared_ptr<IModelFunction> fFunc; //! copy of the fitted function containing on output the fit result
495 
496  std::shared_ptr<ROOT::Fit::FitResult> fResult; //! pointer to the object containing the result of the fit
497 
498  std::shared_ptr<ROOT::Math::Minimizer> fMinimizer; //! pointer to used minimizer
499 
500  std::shared_ptr<ROOT::Fit::FitData> fData; //! pointer to the fit data (binned or unbinned data)
501 
502  std::shared_ptr<ROOT::Math::IMultiGenFunction> fObjFunction; //! pointer to used objective function
503 
504 };
505 
506 
507 // internal functions to get data set and model function from FCN
508 // useful for fits done with customized FCN classes
509 template <class ObjFuncType>
511  ObjFuncType * objfunc = dynamic_cast<ObjFuncType*>(fObjFunction.get() );
512  if (objfunc) {
513  fFunc = objfunc->ModelFunctionPtr();
514  fData = objfunc->DataPtr();
515  return true;
516  }
517  else {
518  return false;
519  }
520 }
521 
522 
523  } // end namespace Fit
524 
525 } // end namespace ROOT
526 
527 // implementation of inline methods
528 
529 
530 #ifndef __CINT__
531 
532 
533 #ifndef ROOT_Math_WrappedFunction
534 #include "Math/WrappedFunction.h"
535 #endif
536 
537 template<class Function>
538 bool ROOT::Fit::Fitter::FitFCN(unsigned int npar, Function & f, const double * par, unsigned int datasize,bool chi2fit) {
540  return FitFCN(wf,par,datasize,chi2fit);
541 }
542 template<class Function>
543 bool ROOT::Fit::Fitter::SetFCN(unsigned int npar, Function & f, const double * par, unsigned int datasize,bool chi2fit) {
545  return SetFCN(wf,par,datasize,chi2fit);
546 }
547 
548 
549 
550 
551 #endif // endif __CINT__
552 
553 #endif /* ROOT_Fit_Fitter */
ROOT::Math::IParamFunction IModel1DFunction
Definition: Fitter.h:100
const FitConfig & Config() const
access to the fit configuration (const method)
Definition: Fitter.h:382
Interface (abstract class) for multi-dimensional functions providing a gradient calculation.
Definition: IFunction.h:322
double par[1]
Definition: unuranDistr.cxx:38
void ExamineFCN()
look at the user provided FCN and get data and model function is they derive from ROOT::Fit FCN class...
Definition: Fitter.cxx:884
Namespace for new ROOT classes and functions.
Definition: ROOT.py:1
void(* MinuitFCN_t)(int &npar, double *gin, double &f, double *u, int flag)
fit using user provided FCN with Minuit-like interface If npar = 0 it is assumed that the parameters ...
Definition: Fitter.h:310
FitConfig & Config()
access to the configuration (non const method)
Definition: Fitter.h:387
bool CalculateMinosErrors()
perform an error analysis on the result using MINOS To be called only after fitting and when a minimi...
Definition: Fitter.cxx:594
bool Fit(const std::shared_ptr< BinData > &data)
Definition: Fitter.h:158
bool LikelihoodFit(const UnBinData &data, bool extended=false)
Unbinned Likelihood fit.
Definition: Fitter.h:192
Fitter & operator=(const Fitter &rhs)
Assignment operator (disabled, class is not copyable)
Definition: Fitter.cxx:80
bool EvalFCN()
Perform a simple FCN evaluation.
Definition: Fitter.cxx:303
#define assert(cond)
Definition: unittest.h:542
bool DoBinnedLikelihoodFit(bool extended=true)
binned likelihood fit
Definition: Fitter.cxx:364
Base class for all the fit data types.
Definition: DataVector.h:67
void SetData(const FitData &data)
Definition: Fitter.h:454
ROOT::Math::IMultiGenFunction BaseFunc
Definition: Fitter.h:103
std::shared_ptr< IModelFunction > fFunc
Definition: Fitter.h:494
Class describing the unbinned data sets (just x coordinates values) of any dimensions.
Definition: UnBinData.h:47
bool Fit(const UnBinData &data, bool extended=false)
fit an unbinned data set using loglikelihood method
Definition: Fitter.h:173
ROOT::Math::IMultiGenFunction * GetFCN() const
return pointer to last used objective function (is NULL in case fit is not yet done) This pointer wil...
Definition: Fitter.h:415
bool DoLinearFit()
linear least square fit
Definition: Fitter.cxx:501
bool LikelihoodFit(const std::shared_ptr< UnBinData > &data, bool extended=false)
Definition: Fitter.h:196
std::shared_ptr< ROOT::Fit::FitResult > fResult
copy of the fitted function containing on output the fit result
Definition: Fitter.h:496
bool CalculateHessErrors()
perform an error analysis on the result using the Hessian Errors are obtaied from the inverse of the ...
Definition: Fitter.cxx:518
bool LeastSquareFit(const BinData &data)
Fit a binned data set using a least square fit.
Definition: Fitter.h:166
Fitter()
Default constructor.
Definition: Fitter.cxx:47
bool DoInitMinimizer()
Definition: Fitter.cxx:659
ROOT::Math::IParamMultiGradFunction IGradModelFunction
Definition: Fitter.h:99
Abstract Minimizer class, defining the interface for the various minimizer (like Minuit2, Minuit, GSL, etc..) Plug-in's exist in ROOT to be able to instantiate the derived classes like ROOT::Math::GSLMinimizer or ROOT::Math::Minuit2Minimizer via the plug-in manager.
Definition: Minimizer.h:86
const FitResult & Result() const
get fit result
Definition: Fitter.h:354
ROOT::Math::IParamGradFunction IGradModel1DFunction
Definition: Fitter.h:101
std::vector< std::vector< double > > Data
bool LinearFit(const BinData &data)
do a linear fit on a set of bin-data
Definition: Fitter.h:215
bool ApplyWeightCorrection(const ROOT::Math::IMultiGenFunction &loglw2, bool minimizeW2L=false)
apply correction in the error matrix for the weights for likelihood fits This method can be called on...
Definition: Fitter.cxx:777
~Fitter()
Destructor.
Definition: Fitter.cxx:66
std::shared_ptr< ROOT::Fit::FitData > fData
pointer to used minimizer
Definition: Fitter.h:500
bool Fit(const Data &data, const Function &func)
fit a data set using any generic model function If data set is binned a least square fit is performed...
Definition: Fitter.h:146
FitConfig fConfig
Definition: Fitter.h:492
IParamFunction interface (abstract class) describing multi-dimensional parameteric functions It is a ...
RooCmdArg Minimizer(const char *type, const char *alg=0)
Fitter class, entry point for performing all type of fits.
Definition: Fitter.h:94
bool Fit(const BinData &data)
Fit a binned data set using a least square fit (default method)
Definition: Fitter.h:154
bool FitFCN()
Perform a fit with the previously set FCN function.
Definition: Fitter.cxx:285
Class describing the binned data sets : vectors of x coordinates, y values and optionally error on y ...
Definition: BinData.h:61
bool IsBinFit() const
query if fit is binned.
Definition: Fitter.h:393
void SetFunction(const IModelFunction &func, bool useGradient=false)
Set the fitted function (model function) from a parametric function interface.
Definition: Fitter.cxx:99
std::shared_ptr< ROOT::Math::Minimizer > fMinimizer
pointer to the object containing the result of the fit
Definition: Fitter.h:498
bool LikelihoodFit(const BinData &data, bool extended=true)
Binned Likelihood fit.
Definition: Fitter.h:181
Interface (abstract class) for parametric one-dimensional gradient functions providing in addition to...
bool LikelihoodFit(const std::shared_ptr< BinData > &data, bool extended=true)
Definition: Fitter.h:185
class containg the result of the fit and all the related information (fitted parameter values...
Definition: FitResult.h:52
double f(double x)
Specialized IParamFunction interface (abstract class) for one-dimensional parametric functions It is ...
FitMethodFunction class Interface for objective functions (like chi2 and likelihood used in the fit) ...
Definition: Fitter.h:57
TFitResultPtr Fit(FitObject *h1, TF1 *f1, Foption_t &option, const ROOT::Math::MinimizerOptions &moption, const char *goption, ROOT::Fit::DataRange &range)
Definition: HFitImpl.cxx:132
Interface (abstract class) for parametric gradient multi-dimensional functions providing in addition ...
double func(double *x, double *p)
Definition: stressTF1.cxx:213
ROOT::Math::IMultiGradFunction BaseGradFunc
Definition: Fitter.h:104
std::shared_ptr< ROOT::Math::IMultiGenFunction > fObjFunction
pointer to the fit data (binned or unbinned data)
Definition: Fitter.h:502
bool GetDataFromFCN()
internal functions to get data set and model function from FCN useful for fits done with customized F...
Definition: Fitter.h:510
bool DoLeastSquareFit()
least square fit
Definition: Fitter.cxx:323
Template class to wrap any C++ callable object implementing operator() (const double * x) in a multi-...
bool useGradient
Namespace for new Math classes and functions.
bool fUseGradient
Definition: Fitter.h:482
BasicFitMethodFunction< ROOT::Math::IMultiGradFunction > FitMethodGradFunction
Definition: Fitter.h:61
typedef void((*Func_t)())
void SetFunctionAndData(const IModelFunction &func, const FitData &data)
Definition: Fitter.h:458
bool SetFCN(unsigned int npar, Function &fcn, const double *params=0, unsigned int dataSize=0, bool chi2fit=false)
Set a generic FCN function as a C++ callable object implementing double () (const double *) Note that...
Definition: Fitter.h:543
int GetNCallsFromFCN()
Definition: Fitter.cxx:761
void DoUpdateFitConfig()
Definition: Fitter.cxx:751
bool LikelihoodFit(const Data &data, const Function &func, bool extended)
fit a data set using any generic model function Pre-requisite on the function:
Definition: Fitter.h:207
double result[121]
bool LinearFit(const std::shared_ptr< BinData > &data)
Definition: Fitter.h:219
Documentation for the abstract class IBaseFunctionMultiDim.
Definition: IFunction.h:63
void SetData(const std::shared_ptr< Data > &data)
Definition: Fitter.h:465
bool DoMinimization(const BaseFunc &f, const ROOT::Math::IMultiGenFunction *chifunc=0)
do minimization
Definition: Fitter.cxx:740
ROOT::Math::IParamMultiFunction IModelFunction
Definition: Fitter.h:98
Class describing the configuration of the fit, options and parameter settings using the ROOT::Fit::Pa...
Definition: FitConfig.h:51
bool DoUnbinnedLikelihoodFit(bool extended=false)
un-binned likelihood fit
Definition: Fitter.cxx:434
BasicFitMethodFunction< ROOT::Math::IMultiGenFunction > FitMethodFunction
Definition: Fitter.h:57
ROOT::Math::Minimizer * GetMinimizer() const
return pointer to last used minimizer (is NULL in case fit is not yet done) This pointer is guranteed...
Definition: Fitter.h:404