TFumili.h

Go to the documentation of this file.
00001 // @(#)root/fumili:$Id: TFumili.h 20882 2007-11-19 11:31:26Z rdm $
00002 // Author: Rene Brun   31/08/99
00003 
00004 /////////////////////////////////////////////////////////////////////////
00005 //                                                                     //
00006 //  TFumili                                                            //
00007 //                                                                     //
00008 //  The FUMILI Minimization package                                    //
00009 //                                                                     //
00010 ///////////////////////////////////////////////////////////////////////// 
00011 
00012 #ifndef ROOT_TFumili
00013 #define ROOT_TFumili
00014 
00015 #ifndef ROOT_TVirtualFitter
00016 #include "TVirtualFitter.h"
00017 #endif
00018 
00019 class TF1;
00020  
00021 class TFumili : public  TVirtualFitter {
00022 private:
00023    Int_t fMaxParam;     //
00024    Int_t fMaxParam2;    // fMaxParam*fMaxParam
00025    Int_t fNlog;         //
00026    Int_t fNfcn;         // Number of FCN calls;
00027    Int_t fNED1;         // Number of experimental vectors X=(x1,x2,...xK)
00028    Int_t fNED2;         // K - Length of vector X plus 2 (for chi2)
00029    Int_t fNED12;        // fNED1+fNED2
00030    Int_t fNpar;         //  fNpar - number of parameters
00031    Int_t fNstepDec;     //  fNstepDec - maximum number of step decreasing counter
00032    Int_t fNlimMul;      //  fNlimMul - after fNlimMul successful iterations permits four-fold increasing of fPL
00033    Int_t fNmaxIter;     //  fNmaxIter - maximum number of iterations
00034    Int_t fLastFixed;    // Last fixed parameter number
00035    Int_t fENDFLG;       // End flag of fit 
00036    Int_t fINDFLG[5];    // internal flags;
00037   
00038   
00039    Bool_t fGRAD;        // user calculated gradients  
00040    Bool_t fWARN;        // warnings
00041    Bool_t fDEBUG;       // debug info
00042    Bool_t fLogLike;     // LogLikelihood flag
00043    Bool_t fNumericDerivatives; //
00044 
00045    Double_t *fZ0;       //[fMaxParam2] Matrix of approximate second derivatives of objective function
00046                         // This matrix is diagonal and always contain only variable parameter's
00047                         // derivatives
00048    Double_t *fZ;        //[fMaxParam2] Invers fZ0 matrix - covariance matrix
00049    Double_t *fGr;       //[fMaxParam] Gradients of objective function
00050    Double_t *fParamError; //[fMaxParam] Parameter errors
00051    Double_t *fSumLog;   //[fNlog]
00052    Double_t *fEXDA;     //[fNED12] experimental data poInt_ter
00053   
00054    //  don't calculate parameter errors - take them from fParamError array
00055    Double_t *fA;        //[fMaxParam] Fit parameter array
00056    Double_t *fPL0;      //[fMaxParam] Step initial bounds
00057    Double_t *fPL;       //[fMaxParam] Limits for parameters step. If <0, then parameter is fixed
00058  
00059    // Defines multidimensional parallelepiped with center in param. vector
00060    Double_t *fDA;       //[fMaxParam] Parameter step
00061    Double_t *fAMX;      //[fMaxParam] Maximum param value
00062    Double_t *fAMN;      //[fMaxParam] Minimum param value
00063    Double_t *fR;        //[fMaxParam] Correlation factors
00064   
00065    Double_t *fDF;       //[fMaxParam] // First derivatives of theoretical function 
00066    Double_t *fCmPar;    //[fMaxParam] parameters of commands
00067 
00068    Double_t fS;         //  fS - objective function value (return)
00069    Double_t fEPS;       //  fEPS - required precision of parameters. If fEPS<0 then 
00070    Double_t fRP;        // Precision of fit ( machine zero on CDC 6000) quite old yeh?
00071    Double_t fAKAPPA;    //
00072    Double_t fGT;        // Expected function change in next iteration
00073    TString *fANames;    //[fMaxParam] Parameter names
00074    TString fCword;      //  Command string
00075 
00076 
00077 //  TF1 *fTFNF1;         //Pointer to theoretical function
00078 //  void (*fFCN) (Int_t &, Double_t *, Double_t &f, Double_t *, Int_t); //
00079 //  //wrapper function to calculate functional value, gradients and Z-matrix
00080 //  Double_t (*fTFN)(Double_t *, Double_t *, Double_t*); // Wrapper function for TFN
00081 
00082 public:
00083 
00084    TFumili(Int_t maxpar=25);
00085    virtual  ~TFumili();
00086 
00087    void             BuildArrays();
00088    virtual Double_t Chisquare(Int_t npar, Double_t *params) const;
00089    virtual void     Clear(Option_t *opt=""); 
00090    void             DeleteArrays();
00091    void             Derivatives(Double_t*,Double_t*);
00092    Int_t            Eval(Int_t& npar, Double_t *grad, Double_t &fval, Double_t *par, Int_t flag); // Evaluate the minimisation function
00093    Double_t         EvalTFN(Double_t *,Double_t*);
00094    virtual Int_t    ExecuteCommand(const char *command, Double_t *args, Int_t nargs);
00095    Int_t            ExecuteSetCommand(Int_t ); 
00096    virtual void     FitChisquare(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag);
00097    virtual void     FitChisquareI(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag);
00098    virtual void     FitLikelihood(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag);
00099    virtual void     FitLikelihoodI(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag);
00100    virtual void     FixParameter(Int_t ipar); 
00101    virtual Double_t *GetCovarianceMatrix() const;
00102    virtual Double_t GetCovarianceMatrixElement(Int_t i, Int_t j) const;
00103    virtual Int_t    GetErrors(Int_t ipar,Double_t &eplus, Double_t &eminus, Double_t &eparab, Double_t &globcc) const;
00104    virtual Int_t    GetNumberTotalParameters() const;
00105    virtual Int_t    GetNumberFreeParameters() const;
00106    Double_t*        GetPL0() const { return fPL0;} 
00107    virtual Double_t GetParError(Int_t ipar) const;
00108    virtual Double_t GetParameter(Int_t ipar) const ;
00109    virtual Int_t    GetParameter(Int_t ipar,char *name,Double_t &value,Double_t &verr,Double_t &vlow, Double_t &vhigh) const;
00110    virtual const char *GetParName(Int_t ipar) const;
00111    virtual Int_t    GetStats(Double_t &amin, Double_t &edm, Double_t &errdef, Int_t &nvpar, Int_t &nparx) const;
00112    virtual Double_t GetSumLog(Int_t );
00113    Double_t*        GetZ() const { return fZ;}
00114    void             InvertZ(Int_t); 
00115    virtual Bool_t   IsFixed(Int_t ipar) const;
00116    Int_t            Minimize(); 
00117    virtual void     PrintResults(Int_t k,Double_t p) const;
00118    virtual void     ReleaseParameter(Int_t ipar); 
00119    Int_t            SGZ();
00120    void             SetData(Double_t *,Int_t,Int_t);
00121    virtual void     SetFitMethod(const char *name);
00122    virtual Int_t    SetParameter(Int_t ipar,const char *parname,Double_t value,Double_t verr,Double_t vlow, Double_t vhigh);
00123    void             SetParNumber(Int_t ParNum) { fNpar = ParNum;};
00124 
00125    ClassDef(TFumili,0) //The FUMILI Minimization package
00126 };
00127 
00128 R__EXTERN TFumili * gFumili;
00129 #endif 
00130 
00131 
00132 
00133 

Generated on Tue Jul 5 14:26:56 2011 for ROOT_528-00b_version by  doxygen 1.5.1