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] Inverse 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 ~TFumili() override;
75
76 void BuildArrays();
77 Double_t Chisquare(Int_t npar, Double_t *params) const override;
78 void Clear(Option_t *opt="") override;
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 Int_t ExecuteCommand(const char *command, Double_t *args, Int_t nargs) override;
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 void FixParameter(Int_t ipar) override;
90 Double_t *GetCovarianceMatrix() const override;
92 Int_t GetErrors(Int_t ipar,Double_t &eplus, Double_t &eminus, Double_t &eparab, Double_t &globcc) const override;
93 Int_t GetNumberTotalParameters() const override;
94 Int_t GetNumberFreeParameters() const override;
95 Double_t* GetPL0() const { return fPL0;}
96 Double_t GetParError(Int_t ipar) const override;
97 Double_t GetParameter(Int_t ipar) const override ;
98 Int_t GetParameter(Int_t ipar,char *name,Double_t &value,Double_t &verr,Double_t &vlow, Double_t &vhigh) const override;
99 const char *GetParName(Int_t ipar) const override;
100 Int_t GetStats(Double_t &amin, Double_t &edm, Double_t &errdef, Int_t &nvpar, Int_t &nparx) const override;
101 Double_t GetSumLog(Int_t ) override;
102 Double_t* GetZ() const { return fZ;}
103 void InvertZ(Int_t);
104 Bool_t IsFixed(Int_t ipar) const override;
105 Int_t Minimize();
106 void PrintResults(Int_t k,Double_t p) const override;
107 void ReleaseParameter(Int_t ipar) override;
108 Int_t SGZ();
109 void SetData(Double_t *,Int_t,Int_t);
110 void SetFitMethod(const char *name) override;
111 Int_t SetParameter(Int_t ipar,const char *parname,Double_t value,Double_t verr,Double_t vlow, Double_t vhigh) override;
112 void SetParNumber(Int_t ParNum);
113
114 ClassDefOverride(TFumili,0) //The FUMILI Minimization package
115};
116
118#endif
119
120
121
122
#define R__EXTERN
Definition DllImport.h:26
#define f(i)
Definition RSha256.hxx:104
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
double Double_t
Definition RtypesCore.h:59
const char Option_t
Definition RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
R__EXTERN TFumili * gFumili
Definition TFumili.h:117
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
char name[80]
Definition TGX11.cxx:110
1-Dim function class
Definition TF1.h:233
Double_t GetParameter(Int_t ipar) const override
Return current value of parameter ipar.
Definition TFumili.cxx:835
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:261
Bool_t fNumericDerivatives
Definition TFumili.h:32
Double_t GetParError(Int_t ipar) const override
Return error of parameter ipar.
Definition TFumili.cxx:826
Bool_t IsFixed(Int_t ipar) const override
Return kTRUE if parameter ipar is fixed, kFALSE otherwise)
Definition TFumili.cxx:1060
Int_t fNED2
K - Length of vector X plus 2 (for chi2)
Definition TFumili.h:17
Double_t GetCovarianceMatrixElement(Int_t i, Int_t j) const override
Return element i,j from the covariance matrix.
Definition TFumili.cxx:793
Int_t ExecuteCommand(const char *command, Double_t *args, Int_t nargs) override
Execute MINUIT commands.
Definition TFumili.cxx:391
Int_t fNpar
fNpar - number of parameters
Definition TFumili.h:19
void PrintResults(Int_t k, Double_t p) const override
Prints fit results.
Definition TFumili.cxx:1483
Int_t GetNumberFreeParameters() const override
Return the number of free parameters.
Definition TFumili.cxx:814
Int_t GetNumberTotalParameters() const override
Return the total number of parameters (free + fixed)
Definition TFumili.cxx:806
Double_t * GetCovarianceMatrix() const override
Return a pointer to the covariance matrix.
Definition TFumili.cxx:784
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:1884
~TFumili() override
TFumili destructor.
Definition TFumili.cxx:217
Int_t GetStats(Double_t &amin, Double_t &edm, Double_t &errdef, Int_t &nvpar, Int_t &nparx) const override
Return global fit parameters.
Definition TFumili.cxx:904
Double_t * fEXDA
[fNED12] experimental data poInt_ter
Definition TFumili.h:41
Int_t SGZ()
Evaluates objective function ( chi-square ), gradients and Z-matrix using data provided by user via T...
Definition TFumili.cxx:1670
void ReleaseParameter(Int_t ipar) override
Releases parameter number ipar.
Definition TFumili.cxx:1586
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:1738
const char * GetParName(Int_t ipar) const override
Return name of parameter ipar.
Definition TFumili.cxx:872
void FixParameter(Int_t ipar) override
Fixes parameter number ipar.
Definition TFumili.cxx:774
void Derivatives(Double_t *, Double_t *)
Calculates partial derivatives of theoretical function.
Definition TFumili.cxx:291
Double_t * fAMN
[fMaxParam] Minimum param value
Definition TFumili.h:51
TString * fANames
[fMaxParam] Parameter names
Definition TFumili.h:62
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:350
Int_t fMaxParam
Definition TFumili.h:13
void SetParNumber(Int_t ParNum)
Definition TFumili.cxx:168
void SetData(Double_t *, Int_t, Int_t)
Sets pointer to data array provided by user.
Definition TFumili.cxx:1616
Int_t fINDFLG[5]
internal flags;
Definition TFumili.h:25
Double_t EvalTFN(Double_t *, Double_t *)
Evaluate theoretical function.
Definition TFumili.cxx:362
Double_t * GetZ() const
Definition TFumili.h:102
Double_t * fParamError
[fMaxParam] Parameter errors
Definition TFumili.h:39
Double_t Chisquare(Int_t npar, Double_t *params) const override
return a chisquare equivalent
Definition TFumili.cxx:227
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
void SetFitMethod(const char *name) override
ret fit method (chisquare or log-likelihood)
Definition TFumili.cxx:1628
Int_t fNstepDec
fNstepDec - maximum number of step decreasing counter
Definition TFumili.h:20
Int_t GetErrors(Int_t ipar, Double_t &eplus, Double_t &eminus, Double_t &eparab, Double_t &globcc) const override
Return errors after MINOs not implemented.
Definition TFumili.cxx:882
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
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:1085
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:558
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:1809
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:182
Double_t * fZ
[fMaxParam2] Inverse 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
void Clear(Option_t *opt="") override
Resets all parameter names, values and errors to zero.
Definition TFumili.cxx:242
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
Int_t SetParameter(Int_t ipar, const char *parname, Double_t value, Double_t verr, Double_t vlow, Double_t vhigh) override
Sets for parameter number ipar initial parameter value, name parname, initial error verr and limits v...
Definition TFumili.cxx:1641
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:1972
Double_t fRP
Precision of fit ( machine zero on CDC 6000) quite old yeh?
Definition TFumili.h:59
Double_t * fCmPar
[fMaxParam] parameters of commands
Definition TFumili.h:55
Double_t * fDF
[fMaxParam] First derivatives of theoretical function
Definition TFumili.h:54
Double_t GetSumLog(Int_t) override
Return Sum(log(i) i=0,n used by log-likelihood fits.
Definition TFumili.cxx:921
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:945
Basic string class.
Definition TString.h:139
Abstract Base Class for Fitting.