Logo ROOT  
Reference Guide
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:
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
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?
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();
81  Int_t Eval(Int_t& npar, Double_t *grad, Double_t &fval, Double_t *par, Int_t flag); // Evaluate the minimisation function
83  virtual Int_t ExecuteCommand(const char *command, Double_t *args, Int_t nargs);
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 
118 #endif
119 
120 
121 
122 
TFumili::fZ
Double_t * fZ
[fMaxParam2] Invers fZ0 matrix - covariance matrix
Definition: TFumili.h:37
TFumili::FixParameter
virtual void FixParameter(Int_t ipar)
Fixes parameter number ipar.
Definition: TFumili.cxx:766
TFumili::fNED2
Int_t fNED2
K - Length of vector X plus 2 (for chi2)
Definition: TFumili.h:17
TFumili::SetParameter
virtual Int_t SetParameter(Int_t ipar, const char *parname, Double_t value, Double_t verr, Double_t vlow, Double_t vhigh)
Sets for parameter number ipar initial parameter value, name parname, initial error verr and limits v...
Definition: TFumili.cxx:1633
TFumili::fLastFixed
Int_t fLastFixed
Last fixed parameter number.
Definition: TFumili.h:23
TGeant4Unit::eplus
static constexpr double eplus
Definition: TGeant4SystemOfUnits.h:170
TFumili::fENDFLG
Int_t fENDFLG
End flag of fit.
Definition: TFumili.h:24
TFumili::BuildArrays
void BuildArrays()
Allocates memory for internal arrays.
Definition: TFumili.cxx:174
TFumili::~TFumili
virtual ~TFumili()
TFumili destructor.
Definition: TFumili.cxx:209
TFumili::fANames
TString * fANames
[fMaxParam] Parameter names
Definition: TFumili.h:62
TFumili::fAKAPPA
Double_t fAKAPPA
Definition: TFumili.h:60
f
#define f(i)
Definition: RSha256.hxx:104
TFumili::fGT
Double_t fGT
Expected function change in next iteration.
Definition: TFumili.h:61
TFumili::GetPL0
Double_t * GetPL0() const
Definition: TFumili.h:95
TFumili::SGZ
Int_t SGZ()
Evaluates objective function ( chi-square ), gradients and Z-matrix using data provided by user via T...
Definition: TFumili.cxx:1662
Option_t
const char Option_t
Definition: RtypesCore.h:66
TFumili::fS
Double_t fS
fS - objective function value (return)
Definition: TFumili.h:57
TFumili::fDEBUG
Bool_t fDEBUG
debug info
Definition: TFumili.h:30
TFumili::fLogLike
Bool_t fLogLike
LogLikelihood flag.
Definition: TFumili.h:31
TFumili::fCword
TString fCword
Command string.
Definition: TFumili.h:63
TFumili::fZ0
Double_t * fZ0
[fMaxParam2] Matrix of approximate second derivatives of objective function This matrix is diagonal a...
Definition: TFumili.h:34
TFumili::fEXDA
Double_t * fEXDA
[fNED12] experimental data poInt_ter
Definition: TFumili.h:41
TFumili::ExecuteCommand
virtual Int_t ExecuteCommand(const char *command, Double_t *args, Int_t nargs)
Execute MINUIT commands.
Definition: TFumili.cxx:383
TFumili::Chisquare
virtual Double_t Chisquare(Int_t npar, Double_t *params) const
return a chisquare equivalent
Definition: TFumili.cxx:219
TFumili::fCmPar
Double_t * fCmPar
[fMaxParam] parameters of commands
Definition: TFumili.h:55
TFumili::fPL0
Double_t * fPL0
[fMaxParam] Step initial bounds
Definition: TFumili.h:45
TFumili::fNfcn
Int_t fNfcn
Number of FCN calls;.
Definition: TFumili.h:15
TFumili::fEPS
Double_t fEPS
fEPS - required precision of parameters. If fEPS<0 then
Definition: TFumili.h:58
TFumili::GetZ
Double_t * GetZ() const
Definition: TFumili.h:102
TFumili::fAMX
Double_t * fAMX
[fMaxParam] Maximum param value
Definition: TFumili.h:50
TFumili::Eval
Int_t Eval(Int_t &npar, Double_t *grad, Double_t &fval, Double_t *par, Int_t flag)
Evaluate the minimisation function.
Definition: TFumili.cxx:342
TFumili::fNstepDec
Int_t fNstepDec
fNstepDec - maximum number of step decreasing counter
Definition: TFumili.h:20
Int_t
int Int_t
Definition: RtypesCore.h:45
TFumili::fGRAD
Bool_t fGRAD
user calculated gradients
Definition: TFumili.h:28
TFumili::fINDFLG
Int_t fINDFLG[5]
internal flags;
Definition: TFumili.h:25
TFumili::fAMN
Double_t * fAMN
[fMaxParam] Minimum param value
Definition: TFumili.h:51
TFumili::GetSumLog
virtual Double_t GetSumLog(Int_t)
Return Sum(log(i) i=0,n used by log-likelihood fits.
Definition: TFumili.cxx:913
TString
Basic string class.
Definition: TString.h:136
TVirtualFitter.h
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TVirtualFitter
Abstract Base Class for Fitting.
Definition: TVirtualFitter.h:29
TFumili
Definition: TFumili.h:11
TFumili::fNED12
Int_t fNED12
fNED1+fNED2
Definition: TFumili.h:18
bool
TFumili::Clear
virtual void Clear(Option_t *opt="")
Resets all parameter names, values and errors to zero.
Definition: TFumili.cxx:234
TFumili::FitLikelihoodI
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.
Definition: TFumili.cxx:1964
TFumili::GetCovarianceMatrix
virtual Double_t * GetCovarianceMatrix() const
Return a pointer to the covariance matrix.
Definition: TFumili.cxx:776
gFumili
R__EXTERN TFumili * gFumili
Definition: TFumili.h:117
TFumili::FitLikelihood
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.
Definition: TFumili.cxx:1876
TFumili::fA
Double_t * fA
[fMaxParam] Fit parameter array
Definition: TFumili.h:44
TFumili::Derivatives
void Derivatives(Double_t *, Double_t *)
Calculates partial derivatives of theoretical function.
Definition: TFumili.cxx:283
TFumili::FitChisquare
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.
Definition: TFumili.cxx:1730
TFumili::TFumili
TFumili(Int_t maxpar=25)
Definition: TFumili.cxx:129
TFumili::fNlimMul
Int_t fNlimMul
fNlimMul - after fNlimMul successful iterations permits four-fold increasing of fPL
Definition: TFumili.h:21
TFumili::ReleaseParameter
virtual void ReleaseParameter(Int_t ipar)
Releases parameter number ipar.
Definition: TFumili.cxx:1578
TFumili::fGr
Double_t * fGr
[fMaxParam] Gradients of objective function
Definition: TFumili.h:38
TFumili::fNpar
Int_t fNpar
fNpar - number of parameters
Definition: TFumili.h:19
TFumili::PrintResults
virtual void PrintResults(Int_t k, Double_t p) const
Prints fit results.
Definition: TFumili.cxx:1475
TFumili::fPL
Double_t * fPL
[fMaxParam] Limits for parameters step. If <0, then parameter is fixed
Definition: TFumili.h:46
TFumili::GetStats
virtual Int_t GetStats(Double_t &amin, Double_t &edm, Double_t &errdef, Int_t &nvpar, Int_t &nparx) const
Return global fit parameters.
Definition: TFumili.cxx:896
TFumili::fDA
Double_t * fDA
[fMaxParam] Parameter step
Definition: TFumili.h:49
TFumili::GetErrors
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:874
TFumili::fWARN
Bool_t fWARN
warnings
Definition: TFumili.h:29
TFumili::SetParNumber
void SetParNumber(Int_t ParNum)
Definition: TFumili.h:112
TFumili::GetParError
virtual Double_t GetParError(Int_t ipar) const
Return error of parameter ipar.
Definition: TFumili.cxx:818
TFumili::fRP
Double_t fRP
Precision of fit ( machine zero on CDC 6000) quite old yeh?
Definition: TFumili.h:59
TFumili::fNmaxIter
Int_t fNmaxIter
fNmaxIter - maximum number of iterations
Definition: TFumili.h:22
TFumili::GetParName
virtual const char * GetParName(Int_t ipar) const
Return name of parameter ipar.
Definition: TFumili.cxx:864
TFumili::fParamError
Double_t * fParamError
[fMaxParam] Parameter errors
Definition: TFumili.h:39
TFumili::fDF
Double_t * fDF
[fMaxParam] First derivatives of theoretical function
Definition: TFumili.h:54
TFumili::IsFixed
virtual Bool_t IsFixed(Int_t ipar) const
Return kTRUE if parameter ipar is fixed, kFALSE otherwise)
Definition: TFumili.cxx:1052
Double_t
double Double_t
Definition: RtypesCore.h:59
TFumili::GetNumberFreeParameters
virtual Int_t GetNumberFreeParameters() const
Return the number of free parameters.
Definition: TFumili.cxx:806
TFumili::EvalTFN
Double_t EvalTFN(Double_t *, Double_t *)
Evaluate theoretical function.
Definition: TFumili.cxx:354
TFumili::GetCovarianceMatrixElement
virtual Double_t GetCovarianceMatrixElement(Int_t i, Int_t j) const
Return element i,j from the covariance matrix.
Definition: TFumili.cxx:785
TFumili::fNumericDerivatives
Bool_t fNumericDerivatives
Definition: TFumili.h:32
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TFumili::fNED1
Int_t fNED1
Number of experimental vectors X=(x1,x2,...xK)
Definition: TFumili.h:16
name
char name[80]
Definition: TGX11.cxx:110
TFumili::fNlog
Int_t fNlog
Definition: TFumili.h:14
TFumili::InvertZ
void InvertZ(Int_t)
Inverts packed diagonal matrix Z by square-root method.
Definition: TFumili.cxx:937
TFumili::GetParameter
virtual Double_t GetParameter(Int_t ipar) const
Return current value of parameter ipar.
Definition: TFumili.cxx:827
TFumili::ExecuteSetCommand
Int_t ExecuteSetCommand(Int_t)
Called from TFumili::ExecuteCommand in case of "SET xxx" and "SHOW xxx".
Definition: TFumili.cxx:550
TFumili::fSumLog
Double_t * fSumLog
[fNlog]
Definition: TFumili.h:40
R__EXTERN
#define R__EXTERN
Definition: DllImport.h:27
TFumili::GetNumberTotalParameters
virtual Int_t GetNumberTotalParameters() const
Return the total number of parameters (free + fixed)
Definition: TFumili.cxx:798
TFumili::DeleteArrays
void DeleteArrays()
Deallocates memory. Called from destructor TFumili::~TFumili.
Definition: TFumili.cxx:253
TF1
1-Dim function class
Definition: TF1.h:213
TFumili::fMaxParam
Int_t fMaxParam
Definition: TFumili.h:13
TFumili::fR
Double_t * fR
[fMaxParam] Correlation factors
Definition: TFumili.h:52
TFumili::Minimize
Int_t Minimize()
Main minimization procedure.
Definition: TFumili.cxx:1077
TFumili::SetFitMethod
virtual void SetFitMethod(const char *name)
ret fit method (chisquare or log-likelihood)
Definition: TFumili.cxx:1620
int
TFumili::FitChisquareI
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.
Definition: TFumili.cxx:1801
TFumili::SetData
void SetData(Double_t *, Int_t, Int_t)
Sets pointer to data array provided by user.
Definition: TFumili.cxx:1608