Logo ROOT   6.10/09
Reference Guide
Go to the documentation of this file.
1 // @(#)root/fumili:$Id$
2 // Author: Rene Brun 31/08/99
4 /////////////////////////////////////////////////////////////////////////
5 // //
6 // TFumili //
7 // //
8 // The FUMILI Minimization package //
9 // //
10 /////////////////////////////////////////////////////////////////////////
12 #ifndef ROOT_TFumili
13 #define ROOT_TFumili
15 #include "TVirtualFitter.h"
17 class TF1;
19 class TFumili : public TVirtualFitter {
20 private:
23  Int_t fNfcn; // Number of FCN calls;
24  Int_t fNED1; // Number of experimental vectors X=(x1,x2,...xK)
25  Int_t fNED2; // K - Length of vector X plus 2 (for chi2)
26  Int_t fNED12; // fNED1+fNED2
27  Int_t fNpar; // fNpar - number of parameters
28  Int_t fNstepDec; // fNstepDec - maximum number of step decreasing counter
29  Int_t fNlimMul; // fNlimMul - after fNlimMul successful iterations permits four-fold increasing of fPL
30  Int_t fNmaxIter; // fNmaxIter - maximum number of iterations
31  Int_t fLastFixed; // Last fixed parameter number
32  Int_t fENDFLG; // End flag of fit
33  Int_t fINDFLG[5]; // internal flags;
36  Bool_t fGRAD; // user calculated gradients
37  Bool_t fWARN; // warnings
38  Bool_t fDEBUG; // debug info
39  Bool_t fLogLike; // LogLikelihood flag
42  Double_t *fZ0; //[fMaxParam2] Matrix of approximate second derivatives of objective function
43  // This matrix is diagonal and always contain only variable parameter's
44  // derivatives
45  Double_t *fZ; //[fMaxParam2] Invers fZ0 matrix - covariance matrix
46  Double_t *fGr; //[fMaxParam] Gradients of objective function
47  Double_t *fParamError; //[fMaxParam] Parameter errors
48  Double_t *fSumLog; //[fNlog]
49  Double_t *fEXDA; //[fNED12] experimental data poInt_ter
51  // don't calculate parameter errors - take them from fParamError array
52  Double_t *fA; //[fMaxParam] Fit parameter array
53  Double_t *fPL0; //[fMaxParam] Step initial bounds
54  Double_t *fPL; //[fMaxParam] Limits for parameters step. If <0, then parameter is fixed
56  // Defines multidimensional parallelepiped with center in param. vector
57  Double_t *fDA; //[fMaxParam] Parameter step
58  Double_t *fAMX; //[fMaxParam] Maximum param value
59  Double_t *fAMN; //[fMaxParam] Minimum param value
60  Double_t *fR; //[fMaxParam] Correlation factors
62  Double_t *fDF; //[fMaxParam] // First derivatives of theoretical function
63  Double_t *fCmPar; //[fMaxParam] parameters of commands
65  Double_t fS; // fS - objective function value (return)
66  Double_t fEPS; // fEPS - required precision of parameters. If fEPS<0 then
67  Double_t fRP; // Precision of fit ( machine zero on CDC 6000) quite old yeh?
69  Double_t fGT; // Expected function change in next iteration
70  TString *fANames; //[fMaxParam] Parameter names
71  TString fCword; // Command string
74 // TF1 *fTFNF1; //Pointer to theoretical function
75 // void (*fFCN) (Int_t &, Double_t *, Double_t &f, Double_t *, Int_t); //
76 // //wrapper function to calculate functional value, gradients and Z-matrix
77 // Double_t (*fTFN)(Double_t *, Double_t *, Double_t*); // Wrapper function for TFN
79 public:
81  TFumili(Int_t maxpar=25);
82  virtual ~TFumili();
84  void BuildArrays();
85  virtual Double_t Chisquare(Int_t npar, Double_t *params) const;
86  virtual void Clear(Option_t *opt="");
87  void DeleteArrays();
89  Int_t Eval(Int_t& npar, Double_t *grad, Double_t &fval, Double_t *par, Int_t flag); // Evaluate the minimisation function
91  virtual Int_t ExecuteCommand(const char *command, Double_t *args, Int_t nargs);
93  virtual void FitChisquare(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag);
94  virtual void FitChisquareI(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag);
95  virtual void FitLikelihood(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag);
96  virtual void FitLikelihoodI(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag);
97  virtual void FixParameter(Int_t ipar);
98  virtual Double_t *GetCovarianceMatrix() const;
99  virtual Double_t GetCovarianceMatrixElement(Int_t i, Int_t j) const;
100  virtual Int_t GetErrors(Int_t ipar,Double_t &eplus, Double_t &eminus, Double_t &eparab, Double_t &globcc) const;
101  virtual Int_t GetNumberTotalParameters() const;
102  virtual Int_t GetNumberFreeParameters() const;
103  Double_t* GetPL0() const { return fPL0;}
104  virtual Double_t GetParError(Int_t ipar) const;
105  virtual Double_t GetParameter(Int_t ipar) const ;
106  virtual Int_t GetParameter(Int_t ipar,char *name,Double_t &value,Double_t &verr,Double_t &vlow, Double_t &vhigh) const;
107  virtual const char *GetParName(Int_t ipar) const;
108  virtual Int_t GetStats(Double_t &amin, Double_t &edm, Double_t &errdef, Int_t &nvpar, Int_t &nparx) const;
109  virtual Double_t GetSumLog(Int_t );
110  Double_t* GetZ() const { return fZ;}
111  void InvertZ(Int_t);
112  virtual Bool_t IsFixed(Int_t ipar) const;
113  Int_t Minimize();
114  virtual void PrintResults(Int_t k,Double_t p) const;
115  virtual void ReleaseParameter(Int_t ipar);
116  Int_t SGZ();
117  void SetData(Double_t *,Int_t,Int_t);
118  virtual void SetFitMethod(const char *name);
119  virtual Int_t SetParameter(Int_t ipar,const char *parname,Double_t value,Double_t verr,Double_t vlow, Double_t vhigh);
120  void SetParNumber(Int_t ParNum) { fNpar = ParNum;};
122  ClassDef(TFumili,0) //The FUMILI Minimization package
123 };
126 #endif
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:62
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:60
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:67
virtual void FixParameter(Int_t ipar)
Fixes parameter number ipar.
Definition: TFumili.cxx:781
Int_t fNlog
Definition: TFumili.h:22
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:129
Double_t * fDA
Definition: TFumili.h:57
Double_t * fParamError
Definition: TFumili.h:47
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:103
bool Bool_t
Definition: RtypesCore.h:59
Double_t * fPL
Definition: TFumili.h:54
Double_t * fEXDA
Definition: TFumili.h:49
Int_t Minimize()
Definition: TFumili.cxx:1089
Bool_t fNumericDerivatives
Definition: TFumili.h:40
Int_t fNED1
Definition: TFumili.h:24
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:297
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:70
Int_t fNpar
Definition: TFumili.h:27
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:71
Bool_t fDEBUG
Definition: TFumili.h:38
Bool_t fLogLike
Definition: TFumili.h:39
Double_t * fZ0
Definition: TFumili.h:42
virtual Double_t GetParError(Int_t ipar) const
return error of parameter ipar
Definition: TFumili.cxx:834
Double_t * fCmPar
Definition: TFumili.h:63
Int_t fNED2
Definition: TFumili.h:25
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:68
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:125
Double_t fS
Definition: TFumili.h:65
virtual Int_t GetNumberFreeParameters() const
return the number of free parameters
Definition: TFumili.cxx:822
Int_t fMaxParam
Definition: TFumili.h:21
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:46
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:26
Bool_t fWARN
Definition: TFumili.h:37
Int_t fLastFixed
Definition: TFumili.h:31
Double_t * GetZ() const
Definition: TFumili.h:110
Double_t * fAMX
Definition: TFumili.h:58
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)
Definition: TFumili.h:32
double Double_t
Definition: RtypesCore.h:55
Double_t * fSumLog
Definition: TFumili.h:48
Int_t fNstepDec
Definition: TFumili.h:28
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:59
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:150
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:45
Double_t * fPL0
Definition: TFumili.h:53
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:23
Double_t fEPS
Definition: TFumili.h:66
void SetParNumber(Int_t ParNum)
Definition: TFumili.h:120
Double_t * fA
Definition: TFumili.h:52
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:36
Int_t fINDFLG[5]
Definition: TFumili.h:33
Double_t fGT
Definition: TFumili.h:69
Int_t SGZ()
Evaluates objective function ( chi-square ), gradients and Z-matrix using data provided by user via T...
Definition: TFumili.cxx:1702
Int_t fNmaxIter
Definition: TFumili.h:30
Int_t fNlimMul
Definition: TFumili.h:29