Logo ROOT   6.08/07
Reference Guide
TFumili.h
Go to the documentation of this file.
1 // @(#)root/fumili:$Id$
2 // Author: Rene Brun 31/08/99
3 
4 /////////////////////////////////////////////////////////////////////////
5 // //
6 // TFumili //
7 // //
8 // The FUMILI Minimization package //
9 // //
10 /////////////////////////////////////////////////////////////////////////
11 
12 #ifndef ROOT_TFumili
13 #define ROOT_TFumili
14 
15 #ifndef ROOT_TVirtualFitter
16 #include "TVirtualFitter.h"
17 #endif
18 
19 class TF1;
20 
21 class TFumili : public TVirtualFitter {
22 private:
25  Int_t fNfcn; // Number of FCN calls;
26  Int_t fNED1; // Number of experimental vectors X=(x1,x2,...xK)
27  Int_t fNED2; // K - Length of vector X plus 2 (for chi2)
28  Int_t fNED12; // fNED1+fNED2
29  Int_t fNpar; // fNpar - number of parameters
30  Int_t fNstepDec; // fNstepDec - maximum number of step decreasing counter
31  Int_t fNlimMul; // fNlimMul - after fNlimMul successful iterations permits four-fold increasing of fPL
32  Int_t fNmaxIter; // fNmaxIter - maximum number of iterations
33  Int_t fLastFixed; // Last fixed parameter number
34  Int_t fENDFLG; // End flag of fit
35  Int_t fINDFLG[5]; // internal flags;
36 
37 
38  Bool_t fGRAD; // user calculated gradients
39  Bool_t fWARN; // warnings
40  Bool_t fDEBUG; // debug info
41  Bool_t fLogLike; // LogLikelihood flag
43 
44  Double_t *fZ0; //[fMaxParam2] Matrix of approximate second derivatives of objective function
45  // This matrix is diagonal and always contain only variable parameter's
46  // derivatives
47  Double_t *fZ; //[fMaxParam2] Invers fZ0 matrix - covariance matrix
48  Double_t *fGr; //[fMaxParam] Gradients of objective function
49  Double_t *fParamError; //[fMaxParam] Parameter errors
50  Double_t *fSumLog; //[fNlog]
51  Double_t *fEXDA; //[fNED12] experimental data poInt_ter
52 
53  // don't calculate parameter errors - take them from fParamError array
54  Double_t *fA; //[fMaxParam] Fit parameter array
55  Double_t *fPL0; //[fMaxParam] Step initial bounds
56  Double_t *fPL; //[fMaxParam] Limits for parameters step. If <0, then parameter is fixed
57 
58  // Defines multidimensional parallelepiped with center in param. vector
59  Double_t *fDA; //[fMaxParam] Parameter step
60  Double_t *fAMX; //[fMaxParam] Maximum param value
61  Double_t *fAMN; //[fMaxParam] Minimum param value
62  Double_t *fR; //[fMaxParam] Correlation factors
63 
64  Double_t *fDF; //[fMaxParam] // First derivatives of theoretical function
65  Double_t *fCmPar; //[fMaxParam] parameters of commands
66 
67  Double_t fS; // fS - objective function value (return)
68  Double_t fEPS; // fEPS - required precision of parameters. If fEPS<0 then
69  Double_t fRP; // Precision of fit ( machine zero on CDC 6000) quite old yeh?
71  Double_t fGT; // Expected function change in next iteration
72  TString *fANames; //[fMaxParam] Parameter names
73  TString fCword; // Command string
74 
75 
76 // TF1 *fTFNF1; //Pointer to theoretical function
77 // void (*fFCN) (Int_t &, Double_t *, Double_t &f, Double_t *, Int_t); //
78 // //wrapper function to calculate functional value, gradients and Z-matrix
79 // Double_t (*fTFN)(Double_t *, Double_t *, Double_t*); // Wrapper function for TFN
80 
81 public:
82 
83  TFumili(Int_t maxpar=25);
84  virtual ~TFumili();
85 
86  void BuildArrays();
87  virtual Double_t Chisquare(Int_t npar, Double_t *params) const;
88  virtual void Clear(Option_t *opt="");
89  void DeleteArrays();
91  Int_t Eval(Int_t& npar, Double_t *grad, Double_t &fval, Double_t *par, Int_t flag); // Evaluate the minimisation function
93  virtual Int_t ExecuteCommand(const char *command, Double_t *args, Int_t nargs);
95  virtual void FitChisquare(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag);
96  virtual void FitChisquareI(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag);
97  virtual void FitLikelihood(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag);
98  virtual void FitLikelihoodI(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag);
99  virtual void FixParameter(Int_t ipar);
100  virtual Double_t *GetCovarianceMatrix() const;
101  virtual Double_t GetCovarianceMatrixElement(Int_t i, Int_t j) const;
102  virtual Int_t GetErrors(Int_t ipar,Double_t &eplus, Double_t &eminus, Double_t &eparab, Double_t &globcc) const;
103  virtual Int_t GetNumberTotalParameters() const;
104  virtual Int_t GetNumberFreeParameters() const;
105  Double_t* GetPL0() const { return fPL0;}
106  virtual Double_t GetParError(Int_t ipar) const;
107  virtual Double_t GetParameter(Int_t ipar) const ;
108  virtual Int_t GetParameter(Int_t ipar,char *name,Double_t &value,Double_t &verr,Double_t &vlow, Double_t &vhigh) const;
109  virtual const char *GetParName(Int_t ipar) const;
110  virtual Int_t GetStats(Double_t &amin, Double_t &edm, Double_t &errdef, Int_t &nvpar, Int_t &nparx) const;
111  virtual Double_t GetSumLog(Int_t );
112  Double_t* GetZ() const { return fZ;}
113  void InvertZ(Int_t);
114  virtual Bool_t IsFixed(Int_t ipar) const;
115  Int_t Minimize();
116  virtual void PrintResults(Int_t k,Double_t p) const;
117  virtual void ReleaseParameter(Int_t ipar);
118  Int_t SGZ();
119  void SetData(Double_t *,Int_t,Int_t);
120  virtual void SetFitMethod(const char *name);
121  virtual Int_t SetParameter(Int_t ipar,const char *parname,Double_t value,Double_t verr,Double_t vlow, Double_t vhigh);
122  void SetParNumber(Int_t ParNum) { fNpar = ParNum;};
123 
124  ClassDef(TFumili,0) //The FUMILI Minimization package
125 };
126 
128 #endif
129 
130 
131 
132 
double par[1]
Definition: unuranDistr.cxx:38
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: TFumili.cxx:912
Double_t * fDF
Definition: TFumili.h:64
virtual Double_t Chisquare(Int_t npar, Double_t *params) const
return a chisquare equivalent
Definition: TFumili.cxx:222
virtual Double_t * GetCovarianceMatrix() const
return a pointer to the covariance matrix
Definition: TFumili.cxx:791
virtual Double_t GetCovarianceMatrixElement(Int_t i, Int_t j) const
return element i,j from the covariance matrix
Definition: TFumili.cxx:800
Double_t * fR
Definition: TFumili.h:62
Int_t Eval(Int_t &npar, Double_t *grad, Double_t &fval, Double_t *par, Int_t flag)
Evaluate the minimisation function Input parameters: npar: number of currently variable parameters pa...
Definition: TFumili.cxx:352
const char Option_t
Definition: RtypesCore.h:62
Double_t fRP
Definition: TFumili.h:69
virtual void FixParameter(Int_t ipar)
Fixes parameter number ipar.
Definition: TFumili.cxx:781
Int_t fNlog
Definition: TFumili.h:24
TFumili(Int_t maxpar=25)
Definition: TFumili.cxx:129
virtual Double_t GetParameter(Int_t ipar) const
return current value of parameter ipar
Definition: TFumili.cxx:843
virtual Int_t GetNumberTotalParameters() const
return the total number of parameters (free + fixed)
Definition: TFumili.cxx:814
Basic string class.
Definition: TString.h:137
Double_t * fDA
Definition: TFumili.h:59
Double_t * fParamError
Definition: TFumili.h:49
virtual void PrintResults(Int_t k, Double_t p) const
Prints fit results.
Definition: TFumili.cxx:1509
int Int_t
Definition: RtypesCore.h:41
Double_t * GetPL0() const
Definition: TFumili.h:105
bool Bool_t
Definition: RtypesCore.h:59
Double_t * fPL
Definition: TFumili.h:56
Double_t * fEXDA
Definition: TFumili.h:51
Int_t Minimize()
Definition: TFumili.cxx:1089
Bool_t fNumericDerivatives
Definition: TFumili.h:42
Int_t fNED1
Definition: TFumili.h:26
virtual Int_t SetParameter(Int_t ipar, const char *parname, Double_t value, Double_t verr, Double_t vlow, Double_t vhigh)
Sets for prameter number ipar initial parameter value, name parname, initial error verr and limits vl...
Definition: TFumili.cxx:1672
void InvertZ(Int_t)
Inverts packed diagonal matrix Z by square-root method.
Definition: TFumili.cxx:958
#define ClassDef(name, id)
Definition: Rtypes.h:254
virtual const char * GetParName(Int_t ipar) const
return name of parameter ipar
Definition: TFumili.cxx:880
void BuildArrays()
Allocates memory for internal arrays.
Definition: TFumili.cxx:174
TString * fANames
Definition: TFumili.h:72
Int_t fNpar
Definition: TFumili.h:29
virtual Int_t GetErrors(Int_t ipar, Double_t &eplus, Double_t &eminus, Double_t &eparab, Double_t &globcc) const
Return errors after MINOs not implemented.
Definition: TFumili.cxx:890
Double_t EvalTFN(Double_t *, Double_t *)
Evaluate theoretical function df: array of partial derivatives X: vector of theoretical function argu...
Definition: TFumili.cxx:364
TString fCword
Definition: TFumili.h:73
Bool_t fDEBUG
Definition: TFumili.h:40
Bool_t fLogLike
Definition: TFumili.h:41
Double_t * fZ0
Definition: TFumili.h:44
virtual Double_t GetParError(Int_t ipar) const
return error of parameter ipar
Definition: TFumili.cxx:834
Double_t * fCmPar
Definition: TFumili.h:65
Int_t fNED2
Definition: TFumili.h:27
Int_t ExecuteSetCommand(Int_t)
Called from TFumili::ExecuteCommand in case of "SET xxx" and "SHOW xxx".
Definition: TFumili.cxx:565
void DeleteArrays()
Deallocates memory.
Definition: TFumili.cxx:261
Double_t fAKAPPA
Definition: TFumili.h:70
virtual Bool_t IsFixed(Int_t ipar) const
return kTRUE if parameter ipar is fixed, kFALSE othersise)
Definition: TFumili.cxx:1076
R__EXTERN TFumili * gFumili
Definition: TFumili.h:127
Double_t fS
Definition: TFumili.h:67
virtual Int_t GetNumberFreeParameters() const
return the number of free parameters
Definition: TFumili.cxx:822
Int_t fMaxParam
Definition: TFumili.h:23
virtual Int_t ExecuteCommand(const char *command, Double_t *args, Int_t nargs)
Execute MINUIT commands.
Definition: TFumili.cxx:394
Double_t * fGr
Definition: TFumili.h:48
virtual void SetFitMethod(const char *name)
ret fit method (chisquare or loglikelihood)
Definition: TFumili.cxx:1657
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: TFumili.cxx:1842
Int_t fNED12
Definition: TFumili.h:28
Bool_t fWARN
Definition: TFumili.h:39
Int_t fLastFixed
Definition: TFumili.h:33
Double_t * GetZ() const
Definition: TFumili.h:112
Double_t * fAMX
Definition: TFumili.h:60
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: TFumili.cxx:2005
double f(double x)
Int_t fENDFLG
Definition: TFumili.h:34
double Double_t
Definition: RtypesCore.h:55
Double_t * fSumLog
Definition: TFumili.h:50
Int_t fNstepDec
Definition: TFumili.h:30
virtual ~TFumili()
TFumili destructor.
Definition: TFumili.cxx:212
void Derivatives(Double_t *, Double_t *)
Calculates partial derivatives of theoretical function.
Definition: TFumili.cxx:293
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: TFumili.cxx:1770
Abstract Base Class for Fitting.
#define R__EXTERN
Definition: DllImport.h:27
Double_t * fAMN
Definition: TFumili.h:61
virtual void ReleaseParameter(Int_t ipar)
Releases parameter number ipar.
Definition: TFumili.cxx:1613
virtual Double_t GetSumLog(Int_t)
return Sum(log(i) i=0,n used by log likelihood fits
Definition: TFumili.cxx:931
1-Dim function class
Definition: TF1.h:149
void SetData(Double_t *, Int_t, Int_t)
Sets pointer to data array provided by user.
Definition: TFumili.cxx:1645
Double_t * fZ
Definition: TFumili.h:47
Double_t * fPL0
Definition: TFumili.h:55
virtual void Clear(Option_t *opt="")
Resets all parameter names, values and errors to zero.
Definition: TFumili.cxx:239
Int_t fNfcn
Definition: TFumili.h:25
Double_t fEPS
Definition: TFumili.h:68
void SetParNumber(Int_t ParNum)
Definition: TFumili.h:122
Double_t * fA
Definition: TFumili.h:54
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: TFumili.cxx:1917
Bool_t fGRAD
Definition: TFumili.h:38
Int_t fINDFLG[5]
Definition: TFumili.h:35
Double_t fGT
Definition: TFumili.h:71
Int_t SGZ()
Evaluates objective function ( chi-square ), gradients and Z-matrix using data provided by user via T...
Definition: TFumili.cxx:1702
char name[80]
Definition: TGX11.cxx:109
Int_t fNmaxIter
Definition: TFumili.h:32
Int_t fNlimMul
Definition: TFumili.h:31