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