| 1 | // This may look like C code, but it is really -*- C++ -*-
 | 
|---|
| 2 | #ifndef MINUITADAPT_SEEN
 | 
|---|
| 3 | #define MINUITADAPT_SEEN
 | 
|---|
| 4 | 
 | 
|---|
| 5 | #include "machdefs.h"
 | 
|---|
| 6 | #include "tvector.h"
 | 
|---|
| 7 | #include "tmatrix.h"
 | 
|---|
| 8 | 
 | 
|---|
| 9 | namespace SOPHYA {
 | 
|---|
| 10 | 
 | 
|---|
| 11 | class MinuitAdapt {
 | 
|---|
| 12 | public:
 | 
|---|
| 13 |   MinuitAdapt(void (*myfcn)(int_4 *,double *,double *,double *,int_4 *,double (*f)(double *))
 | 
|---|
| 14 |              ,double (*myfutils)(double *)=NULL);
 | 
|---|
| 15 |   virtual ~MinuitAdapt(void);
 | 
|---|
| 16 | 
 | 
|---|
| 17 |   void SetTitle(char* title);
 | 
|---|
| 18 |   void Clear(void);
 | 
|---|
| 19 |   void Return(void);
 | 
|---|
| 20 | 
 | 
|---|
| 21 |   void PrintLevel(int_4 n=1);
 | 
|---|
| 22 |   void SetWidthPage(int_4 n=120);
 | 
|---|
| 23 |   void SetWarnings(bool w=true);
 | 
|---|
| 24 |   void SetErrorDef(double err=1.);
 | 
|---|
| 25 |   void SetEpsMachine(double eps=1.e-13);
 | 
|---|
| 26 |   void SetStrategy(int_4 n=1);
 | 
|---|
| 27 |   void SetGradient(int_4 n=-1);
 | 
|---|
| 28 |   void SetRandom(int_4 seed);
 | 
|---|
| 29 | 
 | 
|---|
| 30 |   void DefineParameter(int_4 n,char* name,double init,double step
 | 
|---|
| 31 |                       ,double vmin=0.,double vmax=0.);
 | 
|---|
| 32 |   void SetParameter(int_4 n,double val);
 | 
|---|
| 33 |   void SetLimits(int_4 n,double val1=0.,double val2=0.);
 | 
|---|
| 34 |   void SetFix(int_4 n);
 | 
|---|
| 35 |   void Release(int_4 n);
 | 
|---|
| 36 |   void Restore(bool only_last_fixed=false);
 | 
|---|
| 37 | 
 | 
|---|
| 38 |   void DoFit(char *method="MIGRAD",int_4 maxcall=9999999,double tol=0.1);
 | 
|---|
| 39 |   inline void Migrad(int_4 maxcall=9999999,double tol=0.1)
 | 
|---|
| 40 |        {DoFit("MIGRAD",maxcall,tol);}
 | 
|---|
| 41 |   inline void Minimize(int_4 maxcall=-1,double tol=0.1)
 | 
|---|
| 42 |        {DoFit("MINIMIZE",maxcall,tol);}
 | 
|---|
| 43 |   inline void Simplex(int_4 maxcall=9999999,double tol=0.1)
 | 
|---|
| 44 |        {DoFit("SIMPLEX",maxcall,tol);}
 | 
|---|
| 45 |   void Improve(int_4 maxcall=9999999);
 | 
|---|
| 46 |   void Hesse(int_4 maxcall=9999999);
 | 
|---|
| 47 |   void Minos(int_4 maxcall=9999999);
 | 
|---|
| 48 |   void Seek(int_4 maxcall=9999999,double stdev=3.);
 | 
|---|
| 49 | 
 | 
|---|
| 50 |   void Call(int_4 iflag);
 | 
|---|
| 51 |   void DrawContour(int_4 n1,int_4 n2,int_4 npts=25);
 | 
|---|
| 52 |   int_4 GetContour(int_4 n1,int_4 n2,int_4 npts
 | 
|---|
| 53 |                   ,TVector<r_8>& xpt,TVector<r_8>& ypt);
 | 
|---|
| 54 |   void Scan(int_4 n,double from,double to,int_4 npts=25);
 | 
|---|
| 55 | 
 | 
|---|
| 56 |   void ShowParameter(void);
 | 
|---|
| 57 |   void ShowRandom(void);
 | 
|---|
| 58 |   void ShowFcnValue(void);
 | 
|---|
| 59 |   void ShowCovariance(void);
 | 
|---|
| 60 |   void ShowCorrelations(void);
 | 
|---|
| 61 |   void ShowEigenValues(void);
 | 
|---|
| 62 | 
 | 
|---|
| 63 |   inline int_4 NPar(void) {return mNPar;}
 | 
|---|
| 64 |   inline int_4 ErrFlag(void) {return iErFlg;}
 | 
|---|
| 65 |   void GetParameter(int_4 n,string& name,double& val,double& err
 | 
|---|
| 66 |                    ,double& bound1,double& bound2,int_4& ivarbl);
 | 
|---|
| 67 |   void GetErrors(int_4 n,double& eplus,double& eminus
 | 
|---|
| 68 |                 ,double& eparab,double& globcc);
 | 
|---|
| 69 |   TMatrix<r_8> GetErrorsMatrix(void);
 | 
|---|
| 70 | 
 | 
|---|
| 71 | protected:
 | 
|---|
| 72 |   int_4 mNPar,iErFlg;
 | 
|---|
| 73 |   void (*fcn)(int_4 *,double *,double *,double *,int_4 *,double (*f)(double *));
 | 
|---|
| 74 |   double (*futils)(double *);
 | 
|---|
| 75 | };
 | 
|---|
| 76 | 
 | 
|---|
| 77 | } // Fin du namespace
 | 
|---|
| 78 | 
 | 
|---|
| 79 | #endif
 | 
|---|