TMinuit.h

Go to the documentation of this file.
00001 // @(#)root/minuit:$Id: TMinuit.h 20882 2007-11-19 11:31:26Z rdm $
00002 // Author: Rene Brun, Frederick James   12/08/95
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 // ---------------------------------- minuit.h
00012 
00013 
00014 
00015 //////////////////////////////////////////////////////////////////////////
00016 //                                                                      //
00017 // TMinuit                                                              //
00018 //                                                                      //
00019 // The MINUIT minimisation package (base class)                         //
00020 //                                                                      //
00021 //////////////////////////////////////////////////////////////////////////
00022 
00023 #ifndef ROOT_TMinuit
00024 #define ROOT_TMinuit
00025 
00026 #ifndef ROOT_TNamed
00027 #include "TNamed.h"
00028 #endif
00029 
00030 #ifndef ROOT_TMethodCall
00031 #include "TMethodCall.h"
00032 #endif
00033 
00034 class TMinuit : public TNamed {
00035 
00036 private:
00037    TMinuit(const TMinuit &m);
00038    TMinuit& operator=(const TMinuit &m); // Not implemented
00039 
00040 // should become private....
00041 public:
00042         enum{kMAXWARN=100};
00043           
00044         Int_t        fNpfix;            //Number of fixed parameters
00045         Int_t        fEmpty;            //Initialization flag (1 = Minuit initialized)
00046         Int_t        fMaxpar;           //Maximum number of parameters
00047         Int_t        fMaxint;           //Maximum number of internal parameters
00048         Int_t        fNpar;             //Number of free parameters (total number of pars = fNpar + fNfix)
00049         Int_t        fMaxext;           //Maximum number of external parameters
00050         Int_t        fMaxIterations;    //Maximum number of iterations
00051         Int_t        fMaxpar5;          // fMaxpar*(fMaxpar+1)/2
00052         Int_t        fMaxcpt;
00053         Int_t        fMaxpar2;          // fMaxpar*fMaxpar
00054         Int_t        fMaxpar1;          // fMaxpar*(fMaxpar+1)
00055         
00056         Double_t     fAmin;             //Minimum value found for FCN
00057         Double_t     fUp;               //FCN+-UP defines errors (for chisquare fits UP=1)
00058         Double_t     fEDM;              //Estimated vertical distance to the minimum
00059         Double_t     fFval3;            //
00060         Double_t     fEpsi;             //
00061         Double_t     fApsi;             //
00062         Double_t     fDcovar;           //Relative change in covariance matrix
00063         Double_t     fEpsmac;           //machine precision for floating points:
00064         Double_t     fEpsma2;           //sqrt(fEpsmac)
00065         Double_t     fVlimlo;           //
00066         Double_t     fVlimhi;           //
00067         Double_t     fUndefi;           //Undefined number = -54321
00068         Double_t     fBigedm;           //Big EDM = 123456
00069         Double_t     fUpdflt;           //
00070         Double_t     fXmidcr;           //
00071         Double_t     fYmidcr;           //
00072         Double_t     fXdircr;           //
00073         Double_t     fYdircr;           //
00074         
00075         Double_t     *fU;               //[fMaxpar2] External (visible to user in FCN) value of parameters
00076         Double_t     *fAlim;            //[fMaxpar2] Lower limits for parameters. If zero no limits
00077         Double_t     *fBlim;            //[fMaxpar2] Upper limits for parameters
00078         Double_t     *fErp;             //[fMaxpar] Positive Minos errors if calculated
00079         Double_t     *fErn;             //[fMaxpar] Negative Minos errors if calculated
00080         Double_t     *fWerr;            //[fMaxpar] External parameters error (standard deviation, defined by UP)
00081         Double_t     *fGlobcc;          //[fMaxpar] Global Correlation Coefficients
00082         Double_t     *fX;               //[fMaxpar] Internal parameters values
00083         Double_t     *fXt;              //[fMaxpar] Internal parameters values X saved as Xt
00084         Double_t     *fDirin;           //[fMaxpar] (Internal) step sizes for current step
00085         Double_t     *fXs;              //[fMaxpar] Internal parameters values saved for fixed params
00086         Double_t     *fXts;             //[fMaxpar] Internal parameters values X saved as Xt for fixed params
00087         Double_t     *fDirins;          //[fMaxpar] (Internal) step sizes for current step for fixed params
00088         Double_t     *fGrd;             //[fMaxpar] First derivatives
00089         Double_t     *fG2;              //[fMaxpar] 
00090         Double_t     *fGstep;           //[fMaxpar] Step sizes
00091         Double_t     *fGin;             //[fMaxpar2] 
00092         Double_t     *fDgrd;            //[fMaxpar] Uncertainties
00093         Double_t     *fGrds;            //[fMaxpar] 
00094         Double_t     *fG2s;             //[fMaxpar] 
00095         Double_t     *fGsteps;          //[fMaxpar] 
00096         Double_t     *fVhmat;           //[fMaxpar5] (Internal) error matrix stored as Half MATrix, since it is symmetric
00097         Double_t     *fVthmat;          //[fMaxpar5] VHMAT is sometimes saved in VTHMAT, especially in MNMNOT
00098         Double_t     *fP;               //[fMaxpar1] 
00099         Double_t     *fPstar;           //[fMaxpar2] 
00100         Double_t     *fPstst;           //[fMaxpar] 
00101         Double_t     *fPbar;            //[fMaxpar] 
00102         Double_t     *fPrho;            //[fMaxpar] Minimum point of parabola
00103         Double_t     *fWord7;           //[fMaxpar] 
00104         Double_t     *fXpt;             //[fMaxcpt] X array of points for contours
00105         Double_t     *fYpt;             //[fMaxcpt] Y array of points for contours
00106         
00107         Double_t     *fCONTgcc;         //[fMaxpar] array used in mncont
00108         Double_t     *fCONTw;           //[fMaxpar] array used in mncont
00109         Double_t     *fFIXPyy;          //[fMaxpar] array used in mnfixp
00110         Double_t     *fGRADgf;          //[fMaxpar] array used in mngrad
00111         Double_t     *fHESSyy;          //[fMaxpar] array used in mnhess
00112         Double_t     *fIMPRdsav;        //[fMaxpar] array used in mnimpr
00113         Double_t     *fIMPRy;           //[fMaxpar] array used in mnimpr
00114         Double_t     *fMATUvline;       //[fMaxpar] array used in mnmatu
00115         Double_t     *fMIGRflnu;        //[fMaxpar] array used in mnmigr
00116         Double_t     *fMIGRstep;        //[fMaxpar] array used in mnmigr
00117         Double_t     *fMIGRgs;          //[fMaxpar] array used in mnmigr
00118         Double_t     *fMIGRvg;          //[fMaxpar] array used in mnmigr
00119         Double_t     *fMIGRxxs;         //[fMaxpar] array used in mnmigr
00120         Double_t     *fMNOTxdev;        //[fMaxpar] array used in mnmnot
00121         Double_t     *fMNOTw;           //[fMaxpar] array used in mnmnot
00122         Double_t     *fMNOTgcc;         //[fMaxpar] array used in mnmnot
00123         Double_t     *fPSDFs;           //[fMaxpar] array used in mnpsdf
00124         Double_t     *fSEEKxmid;        //[fMaxpar] array used in mnseek
00125         Double_t     *fSEEKxbest;       //[fMaxpar] array used in mnseek
00126         Double_t     *fSIMPy;           //[fMaxpar] array used in mnsimp
00127         Double_t     *fVERTq;           //[fMaxpar] array used in mnvert
00128         Double_t     *fVERTs;           //[fMaxpar] array used in mnvert
00129         Double_t     *fVERTpp;          //[fMaxpar] array used in mnvert
00130         Double_t     *fCOMDplist;       //[fMaxpar] array used in mncomd
00131         Double_t     *fPARSplist;       //[fMaxpar] array used in mnpars
00132         
00133         Int_t        *fNvarl;           //[fMaxpar2] parameters flag (-1=undefined, 0=constant..)
00134         Int_t        *fNiofex;          //[fMaxpar2] Internal parameters number, or zero if not currently variable
00135         Int_t        *fNexofi;          //[fMaxpar] External parameters number for currently variable parameters
00136         Int_t        *fIpfix;           //[fMaxpar] List of fixed parameters
00137         Int_t        fNu;               //
00138         Int_t        fIsysrd;           //standardInput unit
00139         Int_t        fIsyswr;           //standard output unit
00140         Int_t        fIsyssa;           //
00141         Int_t        fNpagwd;           //Page width
00142         Int_t        fNpagln;           //Number of lines per page
00143         Int_t        fNewpag;           //
00144         Int_t        fIstkrd[10];       //
00145         Int_t        fNstkrd;           //
00146         Int_t        fIstkwr[10];       //
00147         Int_t        fNstkwr;           //
00148         Int_t        fISW[7];           //Array of switches
00149         Int_t        fIdbg[11];         //Array of internal debug switches
00150         Int_t        fNblock;           //Number of Minuit data blocks
00151         Int_t        fIcomnd;           //Number of commands
00152         Int_t        fNfcn;             //Number of calls to FCN
00153         Int_t        fNfcnmx;           //Maximum number of calls to FCN
00154         Int_t        fNfcnlc;           //
00155         Int_t        fNfcnfr;           //
00156         Int_t        fItaur;            //
00157         Int_t        fIstrat;           //
00158         Int_t        fNwrmes[2];        //
00159         Int_t        fNfcwar[20];       //
00160         Int_t        fIcirc[2];         //
00161         Int_t        fStatus;           //Status flag for the last called Minuit function
00162         Int_t        fKe1cr;            //
00163         Int_t        fKe2cr;            //
00164         Bool_t       fLwarn;            //true if warning messges are to be put out (default=true)
00165         Bool_t       fLrepor;           //true if exceptional conditions are put out (default=false)
00166         Bool_t       fLimset;           //true if a parameter is up against limits (for MINOS)
00167         Bool_t       fLnolim;           //true if there are no limits on any parameters (not yet used)
00168         Bool_t       fLnewmn;           //true if the previous process has unexpectedly improved FCN
00169         Bool_t       fLphead;           //true if a heading should be put out for the next parameter definition
00170         Bool_t       fGraphicsMode;     //true if graphics mode on (default)
00171         char         *fChpt;            //!Character to be plotted at the X,Y contour positions
00172         TString      *fCpnam;           //[fMaxpar2] Array of parameters names
00173         TString      fCfrom;            //
00174         TString      fCstatu;           //
00175         TString      fCtitl;            //
00176         TString      fCword;            //
00177         TString      fCundef;           //
00178         TString      fCvrsn;            //
00179         TString      fCovmes[4];        //
00180         TString      fOrigin[kMAXWARN]; //
00181         TString      fWarmes[kMAXWARN]; //
00182         TObject      *fObjectFit;       //Pointer to object being fitted
00183         TObject      *fPlot;            //Pointer to TGraph object created by mncont
00184         TMethodCall  *fMethodCall;      //Pointer to MethodCall in case of interpreted function
00185         void         (*fFCN)(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag); //!
00186 
00187 // methods performed on TMinuit class
00188 public:
00189    TMinuit();
00190    TMinuit(Int_t maxpar);
00191    virtual       ~TMinuit();
00192    virtual void   BuildArrays(Int_t maxpar=15);
00193    virtual TObject *Clone(const char *newname="") const;   //Clone-Method to copy the function-pointer fFCN
00194    virtual Int_t  Command(const char *command);
00195    virtual TObject *Contour(Int_t npoints=10, Int_t pa1=0, Int_t pa2=1);
00196    virtual Int_t  DefineParameter( Int_t parNo, const char *name, Double_t initVal, Double_t initErr, Double_t lowerLimit, Double_t upperLimit );
00197    virtual void   DeleteArrays();
00198    virtual Int_t  Eval(Int_t npar, Double_t *grad, Double_t &fval, Double_t *par, Int_t flag);
00199    virtual Int_t  FixParameter( Int_t parNo );
00200    TMethodCall   *GetMethodCall() const {return fMethodCall;}
00201    TObject       *GetObjectFit() const {return fObjectFit;}
00202    Int_t          GetMaxIterations() const {return fMaxIterations;}
00203    virtual Int_t  GetNumFixedPars() const;
00204    virtual Int_t  GetNumFreePars() const;
00205    virtual Int_t  GetNumPars() const;
00206    virtual Int_t  GetParameter( Int_t parNo, Double_t &currentValue, Double_t &currentError ) const;
00207    virtual TObject *GetPlot() const {return fPlot;}
00208    Int_t          GetStatus() const {return fStatus;}
00209    virtual Int_t  Migrad();
00210    virtual void   mnamin();
00211    virtual void   mnbins(Double_t a1, Double_t a2, Int_t naa, Double_t &bl, Double_t &bh, Int_t &nb, Double_t &bwid);
00212    virtual void   mncalf(Double_t *pvec, Double_t &ycalf);
00213    virtual void   mncler();
00214    virtual void   mncntr(Int_t ke1, Int_t ke2, Int_t &ierrf);
00215    virtual void   mncomd(const char *crdbin, Int_t &icondn);
00216    virtual void   mncont(Int_t ke1, Int_t ke2, Int_t nptu, Double_t *xptu, Double_t *yptu, Int_t &ierrf);
00217    virtual void   mncrck(TString crdbuf, Int_t maxcwd, TString &comand, Int_t &lnc
00218                     ,  Int_t mxp, Double_t *plist, Int_t &llist, Int_t &ierr, Int_t isyswr);
00219    virtual void   mncros(Double_t &aopt, Int_t &iercr);
00220    virtual void   mncuve();
00221    virtual void   mnderi();
00222    virtual void   mndxdi(Double_t pint, Int_t ipar, Double_t &dxdi);
00223    virtual void   mneig(Double_t *a, Int_t ndima, Int_t n, Int_t mits, Double_t *work, Double_t precis, Int_t &ifault);
00224    virtual void   mnemat(Double_t *emat, Int_t ndim);
00225    virtual void   mnerrs(Int_t number, Double_t &eplus, Double_t &eminus, Double_t &eparab, Double_t &gcc);
00226    virtual void   mneval(Double_t anext, Double_t &fnext, Int_t &ierev);
00227    virtual void   mnexcm(const char *comand, Double_t *plist, Int_t llist, Int_t &ierflg) ;
00228    virtual void   mnexin(Double_t *pint);
00229    virtual void   mnfixp(Int_t iint, Int_t &ierr);
00230    virtual void   mnfree(Int_t k);
00231    virtual void   mngrad();
00232    virtual void   mnhelp(TString comd);
00233    virtual void   mnhelp(const char *command="");
00234    virtual void   mnhess();
00235    virtual void   mnhes1();
00236    virtual void   mnimpr();
00237    virtual void   mninex(Double_t *pint);
00238    virtual void   mninit(Int_t i1, Int_t i2, Int_t i3);
00239    virtual void   mnlims();
00240    virtual void   mnline(Double_t *start, Double_t fstart, Double_t *step, Double_t slope, Double_t toler);
00241    virtual void   mnmatu(Int_t kode);
00242    virtual void   mnmigr();
00243    virtual void   mnmnos();
00244    virtual void   mnmnot(Int_t ilax, Int_t ilax2, Double_t &val2pl, Double_t &val2mi);
00245    virtual void   mnparm(Int_t k, TString cnamj, Double_t uk, Double_t wk, Double_t a, Double_t b, Int_t &ierflg);
00246    virtual void   mnpars(TString &crdbuf, Int_t &icondn);
00247    virtual void   mnpfit(Double_t *parx2p, Double_t *pary2p, Int_t npar2p, Double_t *coef2p, Double_t &sdev2p);
00248    virtual void   mnpint(Double_t &pexti, Int_t i, Double_t &pinti);
00249    virtual void   mnplot(Double_t *xpt, Double_t *ypt, char *chpt, Int_t nxypt, Int_t npagwd, Int_t npagln);
00250    virtual void   mnpout(Int_t iuext, TString &chnam, Double_t &val, Double_t &err, Double_t &xlolim, Double_t &xuplim, Int_t &iuint) const;
00251    virtual void   mnprin(Int_t inkode, Double_t fval);
00252    virtual void   mnpsdf();
00253    virtual void   mnrazz(Double_t ynew, Double_t *pnew, Double_t *y, Int_t &jh, Int_t &jl);
00254    virtual void   mnrn15(Double_t &val, Int_t &inseed);
00255    virtual void   mnrset(Int_t iopt);
00256    virtual void   mnsave();
00257    virtual void   mnscan();
00258    virtual void   mnseek();
00259    virtual void   mnset();
00260    virtual void   mnsimp();
00261    virtual void   mnstat(Double_t &fmin, Double_t &fedm, Double_t &errdef, Int_t &npari, Int_t &nparx, Int_t &istat);
00262    virtual void   mntiny(Double_t epsp1, Double_t &epsbak);
00263    Bool_t         mnunpt(TString &cfname);
00264    virtual void   mnvert(Double_t *a, Int_t l, Int_t m, Int_t n, Int_t &ifail);
00265    virtual void   mnwarn(const char *copt, const char *corg, const char *cmes);
00266    virtual void   mnwerr();
00267    virtual Int_t  Release( Int_t parNo );
00268    virtual Int_t  SetErrorDef( Double_t up );
00269    virtual void   SetFCN(void *fcn);
00270    virtual void   SetFCN(void (*fcn)(Int_t &, Double_t *, Double_t &f, Double_t *, Int_t));
00271    virtual void   SetGraphicsMode(Bool_t mode=kTRUE) {fGraphicsMode = mode;}
00272    virtual void   SetMaxIterations(Int_t maxiter=500) {fMaxIterations = maxiter;}
00273    virtual void   SetObjectFit(TObject *obj) {fObjectFit=obj;}
00274    virtual Int_t  SetPrintLevel( Int_t printLevel=0 );
00275 
00276    ClassDef(TMinuit,1)  //The MINUIT minimisation package
00277 };
00278 
00279 R__EXTERN TMinuit  *gMinuit;
00280 
00281 #endif
00282 

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