Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:11:47

0001 // @(#)root/fumili:$Id$
0002 // Author: Rene Brun   31/08/99
0003 
0004 #ifndef ROOT_TFumili
0005 #define ROOT_TFumili
0006 
0007 #include "TVirtualFitter.h"
0008 
0009 class TF1;
0010 
0011 class TFumili : public  TVirtualFitter {
0012 private:
0013    Int_t fMaxParam;       ///<
0014    Int_t fNlog;           ///<
0015    Int_t fNfcn;           ///< Number of FCN calls;
0016    Int_t fNED1;           ///< Number of experimental vectors X=(x1,x2,...xK)
0017    Int_t fNED2;           ///< K - Length of vector X plus 2 (for chi2)
0018    Int_t fNED12;          ///< fNED1+fNED2
0019    Int_t fNpar;           ///<  fNpar - number of parameters
0020    Int_t fNstepDec;       ///<  fNstepDec - maximum number of step decreasing counter
0021    Int_t fNlimMul;        ///<  fNlimMul - after fNlimMul successful iterations permits four-fold increasing of fPL
0022    Int_t fNmaxIter;       ///<  fNmaxIter - maximum number of iterations
0023    Int_t fLastFixed;      ///< Last fixed parameter number
0024    Int_t fENDFLG;         ///< End flag of fit
0025    Int_t fINDFLG[5];      ///< internal flags;
0026 
0027 
0028    Bool_t fGRAD;          ///< user calculated gradients
0029    Bool_t fWARN;          ///< warnings
0030    Bool_t fDEBUG;         ///< debug info
0031    Bool_t fLogLike;       ///< LogLikelihood flag
0032    Bool_t fNumericDerivatives; ///<
0033 
0034    Double_t *fZ0;         ///< [fMaxParam2] Matrix of approximate second derivatives of objective function
0035                           ///< This matrix is diagonal and always contain only variable parameter's
0036                           ///< derivatives
0037    Double_t *fZ;          ///< [fMaxParam2] Inverse fZ0 matrix - covariance matrix
0038    Double_t *fGr;         ///< [fMaxParam] Gradients of objective function
0039    Double_t *fParamError; ///< [fMaxParam] Parameter errors
0040    Double_t *fSumLog;     ///< [fNlog]
0041    Double_t *fEXDA;       ///< [fNED12] experimental data poInt_ter
0042 
0043    //  don't calculate parameter errors - take them from fParamError array
0044    Double_t *fA;          ///< [fMaxParam] Fit parameter array
0045    Double_t *fPL0;        ///< [fMaxParam] Step initial bounds
0046    Double_t *fPL;         ///< [fMaxParam] Limits for parameters step. If <0, then parameter is fixed
0047 
0048    // Defines multidimensional parallelepiped with center in param. vector
0049    Double_t *fDA;         ///< [fMaxParam] Parameter step
0050    Double_t *fAMX;        ///< [fMaxParam] Maximum param value
0051    Double_t *fAMN;        ///< [fMaxParam] Minimum param value
0052    Double_t *fR;          ///< [fMaxParam] Correlation factors
0053 
0054    Double_t *fDF;         ///< [fMaxParam] First derivatives of theoretical function
0055    Double_t *fCmPar;      ///< [fMaxParam] parameters of commands
0056 
0057    Double_t fS;           ///<  fS - objective function value (return)
0058    Double_t fEPS;         ///<  fEPS - required precision of parameters. If fEPS<0 then
0059    Double_t fRP;          ///< Precision of fit ( machine zero on CDC 6000) quite old yeh?
0060    Double_t fAKAPPA;      ///<
0061    Double_t fGT;          ///< Expected function change in next iteration
0062    TString *fANames;      ///< [fMaxParam] Parameter names
0063    TString fCword;        ///<  Command string
0064 
0065 
0066 //  TF1 *fTFNF1;         //Pointer to theoretical function
0067 //  void (*fFCN) (Int_t &, Double_t *, Double_t &f, Double_t *, Int_t); //
0068 //  //wrapper function to calculate functional value, gradients and Z-matrix
0069 //  Double_t (*fTFN)(Double_t *, Double_t *, Double_t*); // Wrapper function for TFN
0070 
0071 public:
0072 
0073    TFumili(Int_t maxpar=25);
0074     ~TFumili() override;
0075 
0076    void             BuildArrays();
0077    Double_t Chisquare(Int_t npar, Double_t *params) const override;
0078    void     Clear(Option_t *opt="") override;
0079    void             DeleteArrays();
0080    void             Derivatives(Double_t*,Double_t*);
0081    Int_t            Eval(Int_t& npar, Double_t *grad, Double_t &fval, Double_t *par, Int_t flag); // Evaluate the minimisation function
0082    Double_t         EvalTFN(Double_t *,Double_t*);
0083    Int_t    ExecuteCommand(const char *command, Double_t *args, Int_t nargs) override;
0084    Int_t            ExecuteSetCommand(Int_t );
0085    virtual void     FitChisquare(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag);
0086    virtual void     FitChisquareI(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag);
0087    virtual void     FitLikelihood(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag);
0088    virtual void     FitLikelihoodI(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag);
0089    void     FixParameter(Int_t ipar) override;
0090    Double_t *GetCovarianceMatrix() const override;
0091    Double_t GetCovarianceMatrixElement(Int_t i, Int_t j) const override;
0092    Int_t    GetErrors(Int_t ipar,Double_t &eplus, Double_t &eminus, Double_t &eparab, Double_t &globcc) const override;
0093    Int_t    GetNumberTotalParameters() const override;
0094    Int_t    GetNumberFreeParameters() const override;
0095    Double_t*        GetPL0() const { return fPL0;}
0096    Double_t GetParError(Int_t ipar) const override;
0097    Double_t GetParameter(Int_t ipar) const override ;
0098    Int_t    GetParameter(Int_t ipar,char *name,Double_t &value,Double_t &verr,Double_t &vlow, Double_t &vhigh) const override;
0099    const char *GetParName(Int_t ipar) const override;
0100    Int_t    GetStats(Double_t &amin, Double_t &edm, Double_t &errdef, Int_t &nvpar, Int_t &nparx) const override;
0101    Double_t GetSumLog(Int_t ) override;
0102    Double_t*        GetZ() const { return fZ;}
0103    void             InvertZ(Int_t);
0104    Bool_t   IsFixed(Int_t ipar) const override;
0105    Int_t            Minimize();
0106    void     PrintResults(Int_t k,Double_t p) const override;
0107    void     ReleaseParameter(Int_t ipar) override;
0108    Int_t            SGZ();
0109    void             SetData(Double_t *,Int_t,Int_t);
0110    void     SetFitMethod(const char *name) override;
0111    Int_t    SetParameter(Int_t ipar,const char *parname,Double_t value,Double_t verr,Double_t vlow, Double_t vhigh) override;
0112    void     SetParNumber(Int_t ParNum);
0113 
0114    ClassDefOverride(TFumili,0) //The FUMILI Minimization package
0115 };
0116 
0117 R__EXTERN TFumili * gFumili;
0118 #endif
0119 
0120 
0121 
0122