ROOT  6.06/09
Reference Guide
TFitter.h
Go to the documentation of this file.
1 // @(#)root/minuit:$Id$
2 // Author: Rene Brun 31/08/99
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 #ifndef ROOT_TFitter
12 #define ROOT_TFitter
13 
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // TFitter //
18 // //
19 // The ROOT standard fitter based on TMinuit //
20 // //
21 //////////////////////////////////////////////////////////////////////////
22 
23 
24 #ifndef ROOT_TVirtualFitter
25 #include "TVirtualFitter.h"
26 #endif
27 
28 class TMinuit;
29 
30 class TFitter : public TVirtualFitter {
31 
32 private:
33  Int_t fNlog; //Number of elements in fSunLog
34  Double_t *fCovar; //Covariance matrix
35  Double_t *fSumLog; //Sum of logs (array of fNlog elements)
36  TMinuit *fMinuit; //pointer to the TMinuit object
37 
38  TFitter(const TFitter&); // Not implemented
39  TFitter& operator=(const TFitter&); // Not implemented
40 
41 public:
42  TFitter(Int_t maxpar = 25);
43  virtual ~TFitter();
44  virtual Double_t Chisquare(Int_t npar, Double_t *params) const ;
45  virtual void Clear(Option_t *option="");
46  virtual Int_t ExecuteCommand(const char *command, Double_t *args, Int_t nargs);
47  virtual void FitChisquare(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag);
48  virtual void FitChisquareI(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag);
49  virtual void FitLikelihood(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag);
50  virtual void FitLikelihoodI(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag);
51  virtual void FixParameter(Int_t ipar);
52  virtual void GetConfidenceIntervals(Int_t n, Int_t ndim, const Double_t *x, Double_t *ci, Double_t cl=0.95);
53  virtual void GetConfidenceIntervals(TObject *obj, Double_t cl=0.95);
54  virtual Double_t *GetCovarianceMatrix() const;
55  virtual Double_t GetCovarianceMatrixElement(Int_t i, Int_t j) const;
56  virtual Int_t GetErrors(Int_t ipar,Double_t &eplus, Double_t &eminus, Double_t &eparab, Double_t &globcc) const;
57  TMinuit *GetMinuit() const {return fMinuit;}
58  virtual Int_t GetNumberTotalParameters() const;
59  virtual Int_t GetNumberFreeParameters() const;
60  virtual Double_t GetParError(Int_t ipar) const;
61  virtual Double_t GetParameter(Int_t ipar) const;
62  virtual Int_t GetParameter(Int_t ipar,char *name,Double_t &value,Double_t &verr,Double_t &vlow, Double_t &vhigh) const;
63  virtual const char *GetParName(Int_t ipar) const;
64  virtual Int_t GetStats(Double_t &amin, Double_t &edm, Double_t &errdef, Int_t &nvpar, Int_t &nparx) const;
65  virtual Double_t GetSumLog(Int_t i);
66  virtual Bool_t IsFixed(Int_t ipar) const;
67  virtual void PrintResults(Int_t level, Double_t amin) const;
68  virtual void ReleaseParameter(Int_t ipar);
69  virtual void SetFCN(void *fcn);
70  virtual void SetFCN(void (*fcn)(Int_t &, Double_t *, Double_t &f, Double_t *, Int_t));
71  virtual void SetFitMethod(const char *name);
72  virtual Int_t SetParameter(Int_t ipar,const char *parname,Double_t value,Double_t verr,Double_t vlow, Double_t vhigh);
73 
74  ClassDef(TFitter,0) //The ROOT standard fitter based on TMinuit
75 };
76 
77 #endif
TFitter(const TFitter &)
virtual void FitChisquareI(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag)
Minimization function for H1s using a Chisquare method The "I"ntegral method is used for each point t...
Definition: TFitter.cxx:656
TFitter & operator=(const TFitter &)
Implementation in C++ of the Minuit package written by F.
Definition: TMinuit.h:34
virtual void FitLikelihood(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag)
Minimization function for H1s using a Likelihood method*-*-*-*-*-* Basically, it forms the likelihood...
Definition: TFitter.cxx:713
TMinuit * GetMinuit() const
Definition: TFitter.h:57
const char Option_t
Definition: RtypesCore.h:62
virtual void FitChisquare(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag)
Minimization function for H1s using a Chisquare method Default method (function evaluated at center o...
Definition: TFitter.cxx:603
virtual void PrintResults(Int_t level, Double_t amin) const
Print fit results.
Definition: TFitter.cxx:528
virtual Double_t GetParError(Int_t ipar) const
return error of parameter ipar
Definition: TFitter.cxx:426
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual Int_t GetNumberTotalParameters() const
return the total number of parameters (free + fixed)
Definition: TFitter.cxx:409
virtual Int_t ExecuteCommand(const char *command, Double_t *args, Int_t nargs)
Execute a fitter command; command : command string args : list of nargs command arguments.
Definition: TFitter.cxx:86
virtual ~TFitter()
*-*-*-*-*-*-*-*-*-*-*default destructor*-*-*-*-*-*-*-*-*-*-*-*-*-* *-* ================== ...
Definition: TFitter.cxx:50
virtual Double_t GetParameter(Int_t ipar) const
return current value of parameter ipar
Definition: TFitter.cxx:440
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:254
virtual void ReleaseParameter(Int_t ipar)
Release parameter ipar.
Definition: TFitter.cxx:536
virtual Int_t GetErrors(Int_t ipar, Double_t &eplus, Double_t &eminus, Double_t &eparab, Double_t &globcc) const
return current errors for a parameter ipar : parameter number eplus : upper error eminus : lower erro...
Definition: TFitter.cxx:397
virtual Int_t GetStats(Double_t &amin, Double_t &edm, Double_t &errdef, Int_t &nvpar, Int_t &nparx) const
return global fit parameters amin : chisquare edm : estimated distance to minimum errdef nvpar : numb...
Definition: TFitter.cxx:486
virtual Double_t Chisquare(Int_t npar, Double_t *params) const
return a chisquare equivalent
Definition: TFitter.cxx:60
Double_t * fSumLog
Definition: TFitter.h:35
virtual Double_t GetCovarianceMatrixElement(Int_t i, Int_t j) const
return element i,j from the covariance matrix
Definition: TFitter.cxx:378
Double_t * fCovar
Definition: TFitter.h:34
virtual Bool_t IsFixed(Int_t ipar) const
return kTRUE if parameter ipar is fixed, kFALSE othersise)
Definition: TFitter.cxx:518
virtual void SetFCN(void *fcn)
Specify the address of the fitting algorithm (from the interpreter)
Definition: TFitter.cxx:545
virtual const char * GetParName(Int_t ipar) const
return name of parameter ipar
Definition: TFitter.cxx:472
virtual void SetFitMethod(const char *name)
ret fit method (chisquare or loglikelihood)
Definition: TFitter.cxx:566
double f(double x)
virtual Int_t GetNumberFreeParameters() const
return the number of free parameters
Definition: TFitter.cxx:417
virtual Double_t GetSumLog(Int_t i)
return Sum(log(i) i=0,n used by log likelihood fits
Definition: TFitter.cxx:497
double Double_t
Definition: RtypesCore.h:55
virtual Double_t * GetCovarianceMatrix() const
return a pointer to the covariance matrix
Definition: TFitter.cxx:366
virtual void GetConfidenceIntervals(Int_t n, Int_t ndim, const Double_t *x, Double_t *ci, Double_t cl=0.95)
Computes point-by-point confidence intervals for the fitted function Parameters: n - number of points...
Definition: TFitter.cxx:114
Int_t fNlog
Definition: TFitter.h:33
virtual void FixParameter(Int_t ipar)
Fix parameter ipar.
Definition: TFitter.cxx:97
TMinuit * fMinuit
Definition: TFitter.h:36
#define name(a, b)
Definition: linkTestLib0.cpp:5
Abstract Base Class for Fitting.
Mother of all ROOT objects.
Definition: TObject.h:58
virtual void Clear(Option_t *option="")
reset the fitter environment
Definition: TFitter.cxx:70
TObject * obj
float value
Definition: math.cpp:443
const Int_t n
Definition: legend1.C:16
virtual void FitLikelihoodI(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag)
Minimization function for H1s using a Likelihood method*-*-*-*-*-* Basically, it forms the likelihood...
Definition: TFitter.cxx:783
virtual Int_t SetParameter(Int_t ipar, const char *parname, Double_t value, Double_t verr, Double_t vlow, Double_t vhigh)
set initial values for a parameter ipar : parameter number parname : parameter name value : initial p...
Definition: TFitter.cxx:587