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