Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

Midnight.h

Go to the documentation of this file.
00001 //  The below code is a modified version of the ROOT/TMinuit class
00002 // in order to have a stand alone C++ version of the Minuit package.
00003 //    G.Barrand
00004 
00005 #ifndef Midnight_h
00006 #define Midnight_h
00007 
00008 
00009 typedef unsigned char MBool;
00010 typedef int MInt;
00011 typedef double MDouble;
00012 typedef void(*MFunction)(MInt&,MDouble*,MDouble&,MDouble*,MInt);
00013 typedef void(*MPrintf)(const char*,...);
00014 
00015 class Midnight {
00016 public:
00017 
00018         // Implemented API is STL compatible. 
00019         // moved here by Toby Burnett to hide it, try to make it only available to Midnight
00020 
00021         class MString {
00022         public:
00023                 MString();
00024                 MString(const char*);
00025                 MString(const MString&);
00026                 ~MString();
00027                 const char* data() const;
00028                 int length() const;
00029                 void resize(int);
00030                 MString& replace(int,int,const MString&);
00031                 MString& operator +=(const char*);
00032                 MString& operator +=(const MString&);
00033                 MString& operator =(const char*);
00034                 MString& operator =(const MString&);
00035                 MString& operator =(char);
00036                 operator const char*() const;
00037                 char& operator[](int);
00038                 char  operator[](int) const;
00039                 char& operator()(int);
00040                 char  operator()(int) const;
00041                 MString operator()(int,int);
00042                 friend int operator ==(const MString&,const MString&);
00043                 friend int operator !=(const MString&,const MString&);
00044                 friend int operator ==(const MString&,const char*);
00045                 friend int operator !=(const MString&,const char*);
00046         private:
00047                 char* fString;
00048         };
00049 private:
00050         MInt        fEmpty;            //Initialization flag (1 = Midnight initialized)
00051         MInt        fMaxpar;           //Maximum number of parameters
00052         MString      *fCpnam;           //Array of parameters names
00053         MDouble     *fU;               //External (visible to user in FCN) value of parameters
00054         MDouble     *fAlim;            //Lower limits for parameters. If zero no limits
00055         MDouble     *fBlim;            //Upper limits for parameters
00056         MDouble     *fErp;             //Positive Minos errors if calculated
00057         MDouble     *fErn;             //Negative Minos errors if calculated
00058         MDouble     *fWerr;            //External parameters error (standard deviation, defined by UP)
00059         MDouble     *fGlobcc;          //Global Correlation Coefficients
00060            MInt     *fNvarl;           //parameters flag (-1=undefined, 0=constant..)
00061            MInt     *fNiofex;          //Internal parameters number, or zero if not currently variable
00062            MInt     *fNexofi;          //External parameters number for currently variable parameters
00063         MDouble     *fX;               //Internal parameters values
00064         MDouble     *fXt;              //Internal parameters values X saved as Xt
00065         MDouble     *fDirin;           //(Internal) step sizes for current step
00066         MDouble     *fXs;              //Internal parameters values saved for fixed params
00067         MDouble     *fXts;             //Internal parameters values X saved as Xt for fixed params
00068         MDouble     *fDirins;          //(Internal) step sizes for current step for fixed params
00069         MDouble     *fGrd;             //First derivatives
00070         MDouble     *fG2;              //
00071         MDouble     *fGstep;           //Step sizes
00072         MDouble     *fGin;             //
00073         MDouble     *fDgrd;            //Uncertainties
00074         MDouble     *fGrds;            //
00075         MDouble     *fG2s;             //
00076         MDouble     *fGsteps;          //
00077         MInt        *fIpfix;           //List of fixed parameters
00078         MInt        fNpfix;            //Number of fixed parameters
00079         MDouble     *fVhmat;           //(Internal) error matrix stored as Half MATrix, since it is symmetric
00080         MDouble     *fVthmat;          //VHMAT is sometimes saved in VTHMAT, especially in MNMNOT
00081         MDouble     *fP;               //
00082         MDouble     *fPstar;           //
00083         MDouble     *fPstst;           //
00084         MDouble     *fPbar;            //
00085         MDouble     *fPrho;            //Minimum point of parabola
00086         MInt        fMaxint;           //Maximum number of internal parameters
00087         MInt        fNpar;             //Number of parameters
00088         MInt        fMaxext;           //Maximum number of external parameters
00089         MInt        fNu;               //
00090         MInt        fIsysrd;           //standardInput unit
00091         MInt        fIsyswr;           //standard output unit
00092         MInt        fIsyssa;           //
00093         MInt        fNpagwd;           //Page width
00094         MInt        fNpagln;           //Number of lines per page
00095         MInt        fNewpag;           //
00096         MInt        fIstkrd[10];       //
00097         MInt        fNstkrd;           //
00098         MInt        fIstkwr[10];       //
00099         MInt        fNstkwr;           //
00100         MString      fCfrom;            //
00101         MString      fCstatu;           //
00102         MString      fCtitl;            //
00103         MString      fCword;            //
00104         MString      fCundef;           //
00105         MString      fCvrsn;            //
00106         MString      fCovmes[4];        //
00107         MInt        fISW[7];           //Array of switches
00108         MInt        fIdbg[11];         //Array of internal debug switches
00109         MInt        fNblock;           //Number of Minuit data blocks
00110         MInt        fIcomnd;           //Number of commands
00111         MDouble     fAmin;             //Minimum value found for FCN
00112         MDouble     fUp;               //FCN+-UP defines errors (for chisquare fits UP=1)
00113         MDouble     fEDM;              //Estimated vertical distance to the minimum
00114         MDouble     fFval3;            //
00115         MDouble     fEpsi;             //
00116         MDouble     fApsi;             //
00117         MDouble     fDcovar;           //Relative change in covariance matrix
00118         MInt        fNfcn;             //Number of calls to FCN
00119         MInt        fNfcnmx;           //Maximum number of calls to FCN
00120         MInt        fNfcnlc;           //
00121         MInt        fNfcnfr;           //
00122         MInt        fItaur;            //
00123         MInt        fIstrat;           //
00124         MInt        fNwrmes[2];        //
00125         MDouble     *fWord7;           //
00126         MBool       fLwarn;            //true if warning messges are to be put out (default=true)
00127         MBool       fLrepor;           //true if exceptional conditions are put out (default=false)
00128         MBool       fLimset;           //true if a parameter is up against limits (for MINOS)
00129         MBool       fLnolim;           //true if there are no limits on any parameters (not yet used)
00130         MBool       fLnewmn;           //true if the previous process has unexpectedly improved FCN
00131         MBool       fLphead;           //true if a heading should be put out for the next parameter definition
00132         MDouble     fEpsmac;           //machine precision for floating points:
00133         MDouble     fEpsma2;           //sqrt(fEpsmac)
00134         MDouble     fVlimlo;           //
00135         MDouble     fVlimhi;           //
00136         MDouble     fUndefi;           //Undefined number = -54321
00137         MDouble     fBigedm;           //Big EDM = 123456
00138         MDouble     fUpdflt;           //
00139         MDouble     *fXpt;             //X array of points for contours
00140         MDouble     *fYpt;             //Y array of points for contours
00141         MString      *fChpt;            //Character to be plotted at the X,Y contour positions
00142         MDouble     fXmidcr;           //
00143         MDouble     fYmidcr;           //
00144         MDouble     fXdircr;           //
00145         MDouble     fYdircr;           //
00146         MInt        fKe1cr;            //
00147         MInt        fKe2cr;            //
00148         MString      *fOrigin;          //
00149         MString      *fWarmes;          //
00150         MInt        fNfcwar[20];       //
00151         MInt        fIcirc[2];         //
00152         MFunction fFCN;
00153         MPrintf fPrintf;
00154 
00155 
00156 // methods performed on Midnight class
00157 private:
00158            Midnight(const Midnight &m);
00159  void      BuildArrays(MInt maxpar=15);
00160  void      DeleteArrays();
00161 public:
00162            Midnight();
00163            Midnight(MInt maxpar);
00164  virtual   ~Midnight();
00165  void      SetFCN(MFunction);
00166  void      SetPrintf(MPrintf);
00167  //
00168 
00169  // added R Terrier
00170  int GetParameter(int parNo, double &currentValue, double &currentError ); 
00171 
00172 
00173  void      mnamin();
00174  void      mnbins(MDouble a1, MDouble a2, MInt naa, MDouble &bl, MDouble &bh, MInt &nb, MDouble &bwid);
00175  void      mncalf(MDouble *pvec, MDouble &ycalf);
00176  void      mncler();
00177  void      mncntr(MInt ke1, MInt ke2, MInt &ierrf);
00178  void      mncomd(MString crdbin, MInt &icondn);
00179  void      mncont(MInt ke1, MInt ke2, MInt nptu, MDouble *xptu, MDouble *yptu, MInt &ierrf);
00180  void      mncrck(MString &crdbuf, MInt maxcwd, MString &comand, MInt &lnc
00181                 ,  MInt mxp, MDouble *plist, MInt &llist, MInt &ierr, MInt isyswr);
00182  void      mncros(MDouble &aopt, MInt &iercr);
00183  void      mncuve();
00184  void      mnderi();
00185  void      mndxdi(MDouble pint, MInt ipar, MDouble &dxdi);
00186  void      mneig(MDouble *a, MInt ndima, MInt n, MInt mits, MDouble *work, MDouble precis, MInt &ifault);
00187  void      mnemat(MDouble *emat, MInt ndim);
00188  void      mnerrs(MInt number, MDouble &eplus, MDouble &eminus, MDouble &eparab, MDouble &gcc);
00189  void      mneval(MDouble anext, MDouble &fnext, MInt &ierev);
00190  void      mnexcm(MString comand, MDouble *plist, MInt llist, MInt &ierflg) ;
00191  void      mnexin(MDouble *pint);
00192  void      mnfixp(MInt iint, MInt &ierr);
00193  void      mnfree(MInt k);
00194  void      mngrad();
00195  void      mnhelp(MString comd);
00196  void      mnhess();
00197  void      mnhes1();
00198  void      mnimpr();
00199  void      mninex(MDouble *pint);
00200  void      mninit(MInt i1, MInt i2, MInt i3);
00201  void      mnlims();
00202  void      mnline(MDouble *start, MDouble fstart, MDouble *step, MDouble slope, MDouble toler);
00203  void      mnmatu(MInt kode);
00204  void      mnmigr();
00205  void      mnmnos();
00206  void      mnmnot(MInt ilax, MInt ilax2, MDouble &val2pl, MDouble &val2mi);
00207  void      mnparm(MInt k, MString cnamj, MDouble uk, MDouble wk, MDouble a, MDouble b, MInt &ierflg);
00208  void      mnpars(MString &crdbuf, MInt &icondn);
00209  void      mnpfit(MDouble *parx2p, MDouble *pary2p, MInt npar2p, MDouble *coef2p, MDouble &sdev2p);
00210  void      mnpint(MDouble &pexti, MInt i, MDouble &pinti);
00211  void      mnplot(MDouble *xpt, MDouble *ypt, MString *chpt, MInt nxypt, MInt npagwd, MInt npagln);
00212  void      mnpout(MInt iuext, MString& chnam, MDouble &val, MDouble &err, MDouble &xlolim, MDouble &xuplim, MInt &iuint);
00213  void      mnprin(MInt inkode, MDouble fval);
00214  void      mnpsdf();
00215  void      mnrazz(MDouble ynew, MDouble *pnew, MDouble *y, MInt &jh, MInt &jl);
00216  void      mnrn15(MDouble &val, MInt &inseed);
00217  void      mnrset(MInt iopt);
00218  void      mnsave();
00219  void      mnscan();
00220  void      mnseek();
00221  void      mnset();
00222  void      mnsimp();
00223  void      mnstat(MDouble &fmin, MDouble &fedm, MDouble &errdef, MInt &npari, MInt &nparx, MInt &istat);
00224  void      mntiny(MDouble epsp1, MDouble &epsbak);
00225  MBool    mnunpt(MString &cfname);
00226  void      mnvert(MDouble *a, MInt l, MInt m, MInt n, MInt &ifail);
00227  void      mnwarn(const char *copt, const char *corg, const char *cmes);
00228  void      mnwerr();
00229 };
00230 
00231 #endif
00232 
00233 
00234 
00235 
00236 
00237 
00238 
00239 

Generated at Wed Nov 21 12:20:44 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000