333 const char charal[29] =
" .ABCDEFGHIJKLMNOPQRSTUVWXYZ";
422 fGraphicsMode =
kTRUE;
440 fGraphicsMode =
kTRUE;
448 gROOT->GetListOfSpecials()->Add(
this);
476 gROOT->GetListOfSpecials()->Add(
this);
486 Error(
"TMinuit",
"can not copy construct TMinuit");
500 if (
gROOT != 0 &&
gROOT->GetListOfSpecials() != 0)
gROOT->GetListOfSpecials()->Remove(
this);
502 if (gMinuit ==
this) gMinuit =
nullptr;
583 for (
int i = 0; i <
fMaxpar; i++) {
664 mncont(pa1,pa2,npoints,xcoor,ycoor,npfound);
667 Warning(
"Contour",
"Cannot find more than 4 points, no TGraph returned");
668 fStatus= (npfound==0 ? 1 : npfound);
673 if (npfound!=npoints) {
675 Warning(
"Contour",
"Returning a TGraph with %d points only",npfound);
680 xcoor[npoints] = xcoor[0];
681 ycoor[npoints] = ycoor[0];
684 if ((h =
gROOT->GetPluginManager()->FindHandler(
"TMinuitGraph"))) {
701 mnparm( parNo, sname, initVal, initErr, lowerLimit, upperLimit, err);
822 if (
fFCN) (*fFCN)(npar,grad,fval,
par,flag);
835 mnexcm(
"FIX", tmp, 1, err );
849 mnpout( parNo, name, currentValue, currentError, bnd1, bnd2, err );
888 mnexcm(
"MIGRAD", tmp, 0, err );
902 mnexcm(
"RELEASE", tmp, 1, err );
914 mnexcm(
"SET ERRDEF", &up, 1, err );
980 mnexcm(
"SET PRINT", tmp, 1, err );
982 if (printLevel <=-1)
mnexcm(
"SET NOWarnings",tmp,0,err);
1003 Printf(
" FIRST CALL TO USER FUNCTION AT NEW START POINT, WITH IFLAG=4.");
1024 Double_t awid,ah, al, sigfig, sigrnd, alb;
1025 Int_t kwid, lwid, na=0, log_;
1029 if (al == ah) ah = al + 1;
1032 if (naa == -1)
goto L150;
1041 if (awid <= 1) --log_;
1044 if (sigfig > 2)
goto L40;
1048 if (sigfig > 2.5)
goto L50;
1052 if (sigfig > 5)
goto L60;
1063 if (bwid <= 0)
goto L10;
1067 if (alb < 0) --lwid;
1069 alb = ah / bwid + 1;
1071 if (alb < 0) --kwid;
1074 if (naa > 5)
goto L240;
1075 if (naa == -1)
return;
1077 if (naa > 1 || nb == 1)
return;
1082 if (nb << 1 != naa)
return;
1098 Int_t ndex, i, j,
m,
n, nparx;
1104 for (i = 1; i <=
fNpar; ++i) {
1106 for (j = 1; j <=
fNpar; ++j) {
1109 ndex = m*(m-1) / 2 + n;
1114 for (i = 1; i <=
fNpar; ++i) {denom +=
fGrd[i-1]*(
fXt[i-1] - pvec[i-1]); }
1120 ycalf = (f -
fApsi) / denom;
1139 for (i = 1; i <=
fMaxext; ++i) {
1162 static TString clabel =
"0123456789ABCDEFGHIJ";
1166 Double_t fcna[115], fcnb[115], contur[20];
1167 Double_t ylabel, fmn, fmx, xlo, ylo, xup, yup;
1168 Double_t devs, xsav, ysav, bwidx, bwidy, unext, ff, xb4;
1169 Int_t i, ngrid, ixmid, nparx, ix,
nx,
ny, ki1, ki2, ixzero, iy, ics;
1174 if (ke1 <= 0 || ke2 <= 0)
goto L1350;
1175 if (ke1 >
fNu || ke2 >
fNu)
goto L1350;
1178 if (ki1 <= 0 || ki2 <= 0)
goto L1350;
1179 if (ki1 == ki2)
goto L1350;
1189 if (devs <= 0) devs = 2;
1190 xlo =
fU[ke1-1] - devs*
fWerr[ki1-1];
1191 xup =
fU[ke1-1] + devs*fWerr[ki1-1];
1192 ylo =
fU[ke2-1] - devs*fWerr[ki2-1];
1193 yup =
fU[ke2-1] + devs*fWerr[ki2-1];
1205 if (nx < 11) nx = 11;
1206 if (ny < 11) ny = 11;
1207 if (nx >= 115) nx = 114;
1218 bwidx = (xup - xlo) /
Double_t(nx);
1219 bwidy = (yup - ylo) /
Double_t(ny);
1220 ixmid =
Int_t(((xsav - xlo)*
Double_t(nx) / (xup - xlo)) + 1);
1221 if (ixmid < 1) ixmid = 1;
1224 for (i = 1; i <= 20; ++i) { contur[i-1] =
fAmin +
fUp*(i-1)*(i-1); }
1225 contur[0] +=
fUp*.01;
1234 for (ix = 1; ix <= nx + 1; ++ix) {
1238 if (xb4 < 0 &&
fU[ke1-1] > 0) ixzero = ix - 1;
1243 Printf(
" Y-AXIS: PARAMETER %3d: %s",ke2,(
const char*)
fCpnam[ke2-1]);
1245 chzero[ixzero-1] =
'+';
1250 for (iy = 1; iy <=
ny; ++iy) {
1251 unext =
fU[ke2-1] - bwidy;
1256 chln[ixmid-1] =
'*';
1257 if (ixzero != 0) chln[ixzero-1] =
':';
1258 if (
fU[ke2-1] > ysav && unext < ysav) chln = chmid;
1259 if (
fU[ke2-1] > 0 && unext < 0) chln = chzero;
1261 ylabel =
fU[ke2-1] + bwidy*.5;
1263 for (ix = 1; ix <= nx + 1; ++ix) {
1264 fcna[ix-1] = fcnb[ix-1];
1270 for (ix = 1; ix <=
nx; ++ix) {
1277 for (ics = 1; ics <= 20; ++ics) {
1278 if (contur[ics-1] > fmn)
goto L240;
1282 if (contur[ics-1] < fmx) chln[ix-1] = clabel[ics-1];
1285 Printf(
" %12.4g %s",ylabel,(
const char*)chln);
1290 chln(ixmid-1,1) =
'I';
1292 Printf(
" %s",(
const char*)chln);
1297 Printf(
" %12.4g%s%12.4g",xlo,(
const char*)chln,xup);
1298 Printf(
" %s%12.4g",(
const char*)chln,xsav);
1300 Printf(
" %12.4g%s%12.4g%s%12.4g",xlo,(
const char*)chln,xsav,(
const char*)chln,xup);
1302 Printf(
" X-AXIS: PARAMETER %3d %s ONE COLUMN=%12.4g"
1303 ,ke1,(
const char*)
fCpnam[ke1-1],bwidx);
1311 Printf(
" INVALID PARAMETER NUMBER(S) REQUESTED. IGNORED.");
1341 Int_t ierr, ipos, i, llist, lenbuf, lnc;
1343 TString comand, crdbuf, ctemp;
1347 lenbuf = crdbuf.
Length();
1352 for (i = 1; i <=
TMath::Min(20,lenbuf); ++i) {
1353 if (crdbuf[i-1] ==
'\'')
break;
1354 if (crdbuf[i-1] ==
' ') {
1362 if (ipos > lenbuf) {
1363 Printf(
" BLANK COMMAND IGNORED.");
1369 if (crdbuf(ipos-1,3) ==
"PAR") {
1375 if (crdbuf(ipos-1,3) ==
"SET INP") {
1381 if (crdbuf(ipos-1,7) ==
"SET TIT") {
1387 if (crdbuf(ipos-1,7) ==
"SET COV") {
1393 ctemp = crdbuf(ipos-1,lenbuf-ipos+1);
1396 Printf(
" COMMAND CANNOT BE INTERPRETED");
1430 Double_t a1, a2, val2mi, val2pl, dc, sclfac, bigdis, sigsav;
1431 Int_t nall, iold,
line, mpar, ierr, inew, move,
next, i, j, nfcol, iercr;
1432 Int_t idist=0, npcol, kints, i2, i1, lr, nfcnco=0, ki1, ki2, ki3, ke3;
1433 Int_t nowpts, istrav, nfmxin, isw2, isw4;
1439 ldebug =
fIdbg[6] >= 1;
1440 if (ke1 <= 0 || ke2 <= 0)
goto L1350;
1441 if (ke1 >
fNu || ke2 >
fNu)
goto L1350;
1444 if (ki1 <= 0 || ki2 <= 0)
goto L1350;
1445 if (ki1 == ki2)
goto L1350;
1446 if (nptu < 4)
goto L1400;
1458 Printf(
" START MNCONTOUR CALCULATION OF %4d POINTS ON CONTOUR.",nptu);
1461 ki3 = 6 - ki1 - ki2;
1463 Printf(
" EACH POINT IS A MINIMUM WITH RESPECT TO PARAMETER %3d %s",ke3,(
const char*)
fCpnam[ke3-1]);
1465 Printf(
" EACH POINT IS A MINIMUM WITH RESPECT TO THE OTHER %3d VARIABLE PARAMETERS.",
fNpar - 2);
1472 mnmnot(ke1, ke2, val2pl, val2mi);
1474 xptu[0] =
fAlim[ke1-1];
1475 mnwarn(
"W",
"MNContour ",
"Contour squeezed by parameter limits.");
1477 if (
fErn[ki1-1] >= 0)
goto L1500;
1478 xptu[0] = u1min +
fErn[ki1-1];
1483 xptu[2] =
fBlim[ke1-1];
1484 mnwarn(
"W",
"MNContour ",
"Contour squeezed by parameter limits.");
1486 if (
fErp[ki1-1] <= 0)
goto L1500;
1487 xptu[2] = u1min +
fErp[ki1-1];
1490 scalx = 1 / (xptu[2] - xptu[0]);
1492 mnmnot(ke2, ke1, val2pl, val2mi);
1494 yptu[1] =
fAlim[ke2-1];
1495 mnwarn(
"W",
"MNContour ",
"Contour squeezed by parameter limits.");
1497 if (
fErn[ki2-1] >= 0)
goto L1500;
1498 yptu[1] = u2min +
fErn[ki2-1];
1502 yptu[3] =
fBlim[ke2-1];
1503 mnwarn(
"W",
"MNContour ",
"Contour squeezed by parameter limits.");
1505 if (
fErp[ki2-1] <= 0)
goto L1500;
1506 yptu[3] = u2min +
fErp[ki2-1];
1509 scaly = 1 / (yptu[3] - yptu[1]);
1513 Printf(
" Plot of four points found by MINOS");
1519 for (i = 2; i <= nall; ++i) {
1520 fXpt[i-1] = xptu[i-2];
1521 fYpt[i-1] = yptu[i-2];
1523 sprintf(
fChpt,
"%s",
" ABCD");
1537 for (i = 1; i <= mpar; ++i) {
fXt[i-1] =
fX[i-1]; }
1538 i__1 = mpar*(mpar + 1) / 2;
1540 for (i = 1; i <= mpar; ++i) {
1550 for (inew = next; inew <= nptu; ++inew) {
1553 for (iold = 1; iold <= inew - 1; ++iold) {
1555 if (i2 == inew) i2 = 1;
1556 d__1 = scalx*(xptu[iold-1] - xptu[i2-1]);
1557 d__2 = scaly*(yptu[iold-1] - yptu[i2-1]);
1558 dist = d__1*d__1 + d__2*d__2;
1559 if (dist > bigdis) {
1566 if (i2 == inew) i2 = 1;
1571 fXmidcr = a1*xptu[i1-1] + a2*xptu[i2-1];
1572 fYmidcr = a1*yptu[i1-1] + a2*yptu[i2-1];
1573 xdir = yptu[i2-1] - yptu[i1-1];
1574 ydir = xptu[i1-1] - xptu[i2-1];
1587 Printf(
" MNCONT CANNOT FIND NEXT POINT ON CONTOUR. ONLY %3d POINTS FOUND.",nowpts);
1591 mnwarn(
"W",
"MNContour ",
"Cannot find midpoint, try closer.");
1597 for (move = nowpts; move >= i1 + 1; --move) {
1598 xptu[move] = xptu[move-1];
1599 yptu[move] = yptu[move-1];
1609 if (nowpts < nptu)
fCstatu =
"INCOMPLETE";
1617 for (i = 2; i <= nall; ++i) {
1618 fXpt[i-1] = xptu[i-2];
1619 fYpt[i-1] = yptu[i-2];
1623 Printf(
" Y-AXIS: PARAMETER %3d %s",ke2,(
const char*)
fCpnam[ke2-1]);
1627 Printf(
" X-AXIS: PARAMETER %3d %s",ke1,(
const char*)
fCpnam[ke1-1]);
1631 npcol = (nowpts + 1) / 2;
1633 Printf(
"%5d POINTS ON CONTOUR. FMIN=%13.5e ERRDEF=%11.3g",nowpts,abest,
fUp);
1635 (
const char*)
fCpnam[ke2-1],
1636 (
const char*)
fCpnam[ke1-1],
1637 (
const char*)
fCpnam[ke2-1]);
1638 for (line = 1; line <= nfcol; ++
line) {
1640 Printf(
" %5d%13.5e%13.5e %5d%13.5e%13.5e",line,xptu[line-1],yptu[line-1],lr,xptu[lr-1],yptu[lr-1]);
1642 if (nfcol < npcol) {
1643 Printf(
" %5d%13.5e%13.5e",npcol,xptu[npcol-1],yptu[npcol-1]);
1650 i__1 = mpar*(mpar + 1) / 2;
1652 for (i = 1; i <= mpar; ++i) {
1671 Printf(
" INVALID PARAMETER NUMBERS.");
1674 Printf(
" LESS THAN FOUR POINTS REQUESTED.");
1680 Printf(
" MNCONT UNABLE TO FIND FOUR POINTS.");
1709 const char *cnumer =
"123456789-.0+";
1712 Int_t ifld, iend, lend, left, nreq, ipos, kcmnd, nextb, ic, ibegin, ltoadd;
1713 Int_t ielmnt, lelmnt[25], nelmnt;
1719 char *crdbuf = (
char*)cardbuf.
Data();
1726 for (ipos = nextb; ipos <= lend; ++ipos) {
1728 if (crdbuf[ipos-1] ==
' ')
continue;
1729 if (crdbuf[ipos-1] ==
',')
goto L250;
1735 for (ipos = ibegin + 1; ipos <= lend; ++ipos) {
1736 if (crdbuf[ipos-1] ==
' ')
goto L250;
1737 if (crdbuf[ipos-1] ==
',')
goto L250;
1743 if (iend >= ibegin) celmnt[ielmnt-1] = &crdbuf[ibegin-1];
1744 else celmnt[ielmnt-1] = cnull;
1745 lelmnt[ielmnt-1] = iend - ibegin + 1;
1746 if (lelmnt[ielmnt-1] > 19) {
1747 Printf(
" MINUIT WARNING: INPUT DATA WORD TOO LONG.");
1748 ctemp = cardbuf(ibegin-1,iend-ibegin+1);
1750 Printf(
" TRUNCATED TO:%s",celmnt[ielmnt-1]);
1751 lelmnt[ielmnt-1] = 19;
1753 if (ipos >= lend)
goto L300;
1754 if (ielmnt >= 25)
goto L300;
1756 for (ipos = iend + 1; ipos <= lend; ++ipos) {
1757 if (crdbuf[ipos-1] ==
' ')
continue;
1759 if (crdbuf[ipos-1] ==
',') nextb = ipos + 1;
1766 command[0] =
' '; command[1] = 0;
1770 if (ielmnt == 0)
goto L900;
1772 for (ielmnt = 1; ielmnt <= nelmnt; ++ielmnt) {
1773 if ( celmnt[ielmnt-1] == cnull)
goto L450;
1774 for (ic = 1; ic <= 13; ++ic) {
1775 if (*celmnt[ielmnt-1] == cnumer[ic-1])
goto L450;
1777 if (kcmnd >= maxcwd)
continue;
1778 left = maxcwd - kcmnd;
1779 ltoadd = lelmnt[ielmnt-1];
1780 if (ltoadd > left) ltoadd = left;
1781 strncpy(&command[kcmnd],celmnt[ielmnt-1],ltoadd);
1783 if (kcmnd == maxcwd)
continue;
1784 command[kcmnd] =
' ';
1794 for (ifld = ielmnt; ifld <= nelmnt; ++ifld) {
1797 nreq = nelmnt - ielmnt + 1;
1798 Printf(
" MINUIT WARNING IN MNCRCK: ");
1799 Printf(
" COMMAND HAS INPUT %5d NUMERIC FIELDS, BUT MINUIT CAN ACCEPT ONLY%3d",nreq,mxp);
1802 if (celmnt[ifld-1] == cnull) plist[llist-1] = 0;
1804 sscanf(celmnt[ifld-1],
"%lf",&plist[llist-1]);
1809 if (lnc <= 0) lnc = 1;
1828 Double_t alsb[3], flsb[3], bmin, bmax, zmid, sdev, zdir, zlim;
1829 Double_t coeff[3], aleft, aulim, fdist, adist, aminsv;
1830 Double_t anext, fnext, slope, s1, s2,
x1,
x2, ecarmn, ecarmx;
1831 Double_t determ, rt, smalla, aright, aim, tla, tlf, dfda,ecart;
1832 Int_t iout=0, i, ileft, ierev, maxlk, ibest, ik, it;
1833 Int_t noless, iworst=0, iright, itoohi, kex, ipt;
1838 ldebug =
fIdbg[6] >= 1;
1857 for (ik = 1; ik <= 2; ++ik) {
1863 if (
fKe2cr == 0)
continue;
1868 if (
fNvarl[kex-1] <= 1)
continue;
1869 if (zdir == 0)
continue;
1870 zlim =
fAlim[kex-1];
1871 if (zdir > 0) zlim =
fBlim[kex-1];
1872 aulim =
TMath::Min(aulim,(zlim - zmid) / zdir);
1880 mneval(anext, fnext, ierev);
1883 Printf(
" MNCROS: calls=%8d AIM=%10.5f F,A=%10.5f%10.5f",
fNfcn,aim,fnext,aopt);
1885 if (ierev > 0)
goto L900;
1886 if (
fLimset && fnext <= aim)
goto L930;
1888 fXpt[ipt-1] = anext;
1889 fYpt[ipt-1] = fnext;
1890 fChpt[ipt-1] = charal[ipt-1];
1895 if (
TMath::Abs(fnext - aim) < tlf)
goto L800;
1897 if (aopt < -.5)aopt = -.5;
1898 if (aopt > 1) aopt = 1;
1904 mneval(aopt, fnext, ierev);
1907 Printf(
" MNCROS: calls=%8d AIM=%10.5f F,A=%10.5f%10.5f",
fNfcn,aim,fnext,aopt);
1909 if (ierev > 0)
goto L900;
1910 if (
fLimset && fnext <= aim)
goto L930;
1913 fXpt[ipt-1] = alsb[1];
1914 fYpt[ipt-1] = fnext;
1915 fChpt[ipt-1] = charal[ipt-1];
1917 dfda = (flsb[1] - flsb[0]) / (alsb[1] - alsb[0]);
1919 if (dfda > 0)
goto L460;
1921 mnwarn(
"D",
"MNCROS ",
"Looking for slope of the right sign");
1923 for (it = 1; it <= maxlk; ++it) {
1932 mneval(aopt, fnext, ierev);
1935 Printf(
" MNCROS: calls=%8d AIM=%10.5f F,A=%10.5f%10.5f",
fNfcn,aim,fnext,aopt);
1937 if (ierev > 0)
goto L900;
1938 if (
fLimset && fnext <= aim)
goto L930;
1941 fXpt[ipt-1] = alsb[1];
1942 fYpt[ipt-1] = fnext;
1943 fChpt[ipt-1] = charal[ipt-1];
1945 dfda = (flsb[1] - flsb[0]) / (alsb[1] - alsb[0]);
1946 if (dfda > 0)
goto L450;
1948 mnwarn(
"W",
"MNCROS ",
"Cannot find slope of the right sign");
1953 aopt = alsb[1] + (aim - flsb[1]) / dfda;
1958 if (adist < tla && fdist < tlf)
goto L800;
1959 if (ipt >= 15)
goto L950;
1961 if (aopt < bmin) aopt = bmin;
1963 if (aopt > bmax) aopt = bmax;
1970 mneval(aopt, fnext, ierev);
1973 Printf(
" MNCROS: calls=%8d AIM=%10.5f F,A=%10.5f%10.5f",
fNfcn,aim,fnext,aopt);
1975 if (ierev > 0)
goto L900;
1976 if (
fLimset && fnext <= aim)
goto L930;
1979 fXpt[ipt-1] = alsb[2];
1980 fYpt[ipt-1] = fnext;
1981 fChpt[ipt-1] = charal[ipt-1];
1988 for (i = 1; i <= 3; ++i) {
1990 if (ecart > ecarmx) { ecarmx = ecart; iworst = i; }
1991 if (ecart < ecarmn) { ecarmn = ecart; ibest = i; }
1992 if (flsb[i-1] < aim) ++noless;
1995 if (noless == 1 || noless == 2)
goto L500;
1997 if (noless == 0 && ibest != 3)
goto L950;
2000 if (noless == 3 && ibest != 3) {
2006 alsb[iworst-1] = alsb[2];
2007 flsb[iworst-1] = flsb[2];
2008 dfda = (flsb[1] - flsb[0]) / (alsb[1] - alsb[0]);
2012 mnpfit(alsb, flsb, 3, coeff, sdev);
2013 if (coeff[2] <= 0) {
2014 mnwarn(
"D",
"MNCROS ",
"Curvature is negative near contour line.");
2016 determ = coeff[1]*coeff[1] - coeff[2]*4*(coeff[0] - aim);
2018 mnwarn(
"D",
"MNCROS ",
"Problem 2, impossible determinant");
2023 x1 = (-coeff[1] + rt) / (coeff[2]*2);
2024 x2 = (-coeff[1] - rt) / (coeff[2]*2);
2025 s1 = coeff[1] + x1*2*coeff[2];
2026 s2 = coeff[1] + x2*2*coeff[2];
2028 Printf(
" MNCONTour problem 1");
2042 if (ipt >= 15)
goto L950;
2051 for (i = 1; i <= 3; ++i) {
2053 if (ecart < ecarmn) { ecarmn = ecart; ibest = i; }
2054 if (ecart > ecarmx) { ecarmx = ecart; }
2055 if (flsb[i-1] > aim) {
2056 if (iright == 0) iright = i;
2057 else if (flsb[i-1] > flsb[iright-1]) iout = i;
2058 else { iout = iright; iright = i; }
2060 else if (ileft == 0) ileft = i;
2061 else if (flsb[i-1] < flsb[ileft-1]) iout = i;
2062 else { iout = ileft; ileft = i; }
2065 if (ecarmx >
TMath::Abs(flsb[iout-1] - aim)*10) {
2066 aopt = aopt*.5 + (alsb[iright-1] + alsb[ileft-1])*.25;
2070 if (slope*smalla > tlf) smalla = tlf / slope;
2071 aleft = alsb[ileft-1] + smalla;
2072 aright = alsb[iright-1] - smalla;
2074 if (aopt < aleft) aopt = aleft;
2075 if (aopt > aright) aopt = aright;
2076 if (aleft > aright) aopt = (aleft + aright)*.5;
2085 mneval(aopt, fnext, ierev);
2088 Printf(
" MNCROS: calls=%8d AIM=%10.5f F,A=%10.5f%10.5f",
fNfcn,aim,fnext,aopt);
2090 if (ierev > 0)
goto L900;
2091 if (
fLimset && fnext <= aim)
goto L930;
2094 fYpt[ipt-1] = fnext;
2095 fChpt[ipt-1] = charal[ipt-1];
2097 alsb[iout-1] = aopt;
2098 flsb[iout-1] = fnext;
2110 if (ierev == 1)
goto L940;
2127 for (i = 1; i <= ipt; ++i) {
2128 if (
fYpt[i-1] > aim + fUp) {
2136 if (
fXdircr < 0) chsign =
"NEGA";
2138 Printf(
" %sTIVE MINOS ERROR, PARAMETER %3d",chsign,
fKe1cr);
2141 Printf(
"POINTS LABELLED '+' WERE TOO HIGH TO PLOT.");
2144 Printf(
"RIGHTMOST POINT IS UP AGAINST LIMIT.");
2162 Int_t ndex, iext, i, j;
2165 Printf(
" FUNCTION MUST BE MINIMIZED BEFORE CALLING %s",(
const char*)
fCfrom);
2172 mnwarn(
"W",
fCfrom,
"NO ERROR MATRIX. WILL IMPROVISE.");
2173 for (i = 1; i <=
fNpar; ++i) {
2175 for (j = 1; j <= i-1; ++j) {
2180 if (
fG2[i-1] <= 0) {
2183 if (
fNvarl[iext-1] > 1) {
2188 fG2[i-1] =
fUp / (wint*wint);
2210 Double_t step, dfmin, stepb4, dd, df, fs1;
2211 Double_t tlrstp, tlrgrd, epspri, optstp, stpmax, stpmin, fs2, grbfor=0, d1d2, xtf;
2212 Int_t icyc, ncyc, iint, iext, i, nparx;
2216 ldebug =
fIdbg[2] >= 1;
2218 if (
fISW[2] == 1)
goto L100;
2230 Printf(
" FIRST DERIVATIVE DEBUG PRINTOUT. MNDERI");
2231 Printf(
" PAR DERIV STEP MINSTEP OPTSTEP D1-D2 2ND DRV");
2248 for (i = 1; i <=
fNpar; ++i) {
2255 for (icyc = 1; icyc <= ncyc; ++icyc) {
2261 if (
fGstep[i-1] < 0 && step > .5) step = .5;
2264 if (step > stpmax) step = stpmax;
2267 if (step < stpmin) step = stpmin;
2269 if (TMath::Abs((step - stepb4) / step) < tlrstp)
goto L50;
2275 fX[i-1] = xtf + step;
2279 fX[i-1] = xtf - step;
2283 fGrd[i-1] = (fs1 - fs2) / (step*2);
2284 fG2[i-1] = (fs1 + fs2 -
fAmin*2) / (step*step);
2287 d1d2 = (fs1 + fs2 -
fAmin*2) / step;
2288 Printf(
"%4d%11.3g%11.3g%10.2g%10.2g%10.2g%10.2g",i,
fGrd[i-1],step,stpmin,optstp,d1d2,
fG2[i-1]);
2291 if (TMath::Abs(grbfor -
fGrd[i-1]) / (TMath::Abs(
fGrd[i-1]) + dfmin/step) < tlrgrd)
2295 if (ncyc == 1)
goto L50;
2304 for (iint = 1; iint <=
fNpar; ++iint) {
2306 if (
fNvarl[iext-1] <= 1) {
2344 Int_t i, j, k,
l,
m=0, i0, i1, j1, m1, n1;
2348 a_offset = ndima + 1;
2356 for (i1 = 2; i1 <=
n; ++i1) {
2358 f = a[i + (i-1)*ndima];
2361 if (l < 1)
goto L25;
2363 for (k = 1; k <=
l; ++k) {
2364 d__1 = a[i + k*ndima];
2370 if (gl > 1e-35)
goto L30;
2378 if (f >= 0) gl = -gl;
2381 a[i + (i-1)*ndima] = f - gl;
2383 for (j = 1; j <=
l; ++j) {
2384 a[j + i*ndima] = a[i + j*ndima] /
h;
2386 for (k = 1; k <= j; ++k) { gl += a[j + k*ndima]*a[i + k*ndima]; }
2387 if (j >= l)
goto L47;
2389 for (k = j1; k <=
l; ++k) { gl += a[k + j*ndima]*a[i + k*ndima]; }
2391 work[n + j] = gl /
h;
2392 f += gl*a[j + i*ndima];
2395 for (j = 1; j <=
l; ++j) {
2397 gl = work[n + j] - hh*
f;
2399 for (k = 1; k <= j; ++k) {
2400 a[j + k*ndima] = a[j + k*ndima] - f*work[n + k] - gl*a[i + k*ndima];
2409 for (i = 1; i <=
n; ++i) {
2411 if (work[i] == 0 || l == 0)
goto L100;
2413 for (j = 1; j <=
l; ++j) {
2415 for (k = 1; k <=
l; ++k) { gl += a[i + k*ndima]*a[k + j*ndima]; }
2416 for (k = 1; k <=
l; ++k) { a[k + j*ndima] -= gl*a[k + i*ndima]; }
2419 work[i] = a[i + i*ndima];
2421 if (l == 0)
continue;
2423 for (j = 1; j <=
l; ++j) {
2430 for (i = 2; i <=
n; ++i) {
2432 work[i0] = work[i0 + 1];
2437 for (l = 1; l <=
n; ++
l) {
2441 for (m1 = l; m1 <=
n; ++m1) {
2447 if (m == l)
goto L205;
2450 if (j == mits)
return;
2452 pt = (work[l + 1] - work[
l]) / (work[n + l]*2);
2455 if (pt < 0) pr = pt -
r;
2457 h = work[
l] - work[n +
l] / pr;
2458 for (i = l; i <=
n; ++i) { work[i] -=
h; }
2465 for (i1 = l; i1 <= m1; ++i1) {
2472 c = pt / work[n + i];
2474 work[n + j] = s*work[n + i]*
r;
2479 c = work[n + i] /
pt;
2481 work[n + j] = s*pt*
r;
2485 pt = c*work[i] - s*gl;
2486 work[j] = h + s*(c*gl + s*work[i]);
2487 for (k = 1; k <=
n; ++k) {
2489 a[k + j*ndima] = s*a[k + i*ndima] + c*
h;
2490 a[k + i*ndima] = c*a[k + i*ndima] - s*
h;
2501 for (i = 1; i <= n1; ++i) {
2505 for (j = i1; j <=
n; ++j) {
2506 if (work[j] >= pt)
continue;
2511 if (k == i)
continue;
2515 for (j = 1; j <=
n; ++j) {
2516 pt = a[j + i*ndima];
2517 a[j + i*ndima] = a[j + k*ndima];
2518 a[j + k*ndima] =
pt;
2534 Int_t emat_dim1, emat_offset;
2538 Int_t i, j, k, npard, k2, kk, iz, nperln, kga, kgb;
2543 emat_offset = emat_dim1 + 1;
2544 emat -= emat_offset;
2547 if (
fISW[1] < 1)
return;
2549 Printf(
" EXTERNAL ERROR MATRIX. NDIM=%4d NPAR=%3d ERR DEF=%g",ndim,
fNpar,
fUp);
2556 Printf(
" USER-DIMENSIONED ARRAY EMAT NOT BIG ENOUGH. REDUCED MATRIX CALCULATED.");
2563 if (
fISW[4] >= 1 && npard > nperln) {
2564 Printf(
" ELEMENTS ABOVE DIAGONAL ARE NOT PRINTED.");
2567 for (i = 1; i <= npard; ++i) {
2570 for (j = 1; j <= i; ++j) {
2573 emat[i + j*emat_dim1] = dxdi*
fVhmat[kgb-1]*dxdj*
fUp;
2574 emat[j + i*emat_dim1] = emat[i + j*emat_dim1];
2579 for (i = 1; i <= npard; ++i) {
2581 if (npard >= nperln) iz = i;
2583 for (k = 1; nperln < 0 ? k >= iz : k <= iz; k += nperln) {
2584 k2 = k + nperln - 1;
2585 if (k2 > iz) k2 = iz;
2586 for (kk = k; kk <= k2; ++kk) {
2589 Printf(
"%s",(
const char*)ctemp);
2610 Int_t ndiag, iin, iex;
2614 if (iex >
fNu || iex <= 0)
goto L900;
2616 if (iin <= 0)
goto L900;
2619 eplus =
fErp[iin-1];
2620 if (eplus ==
fUndefi) eplus = 0;
2621 eminus =
fErn[iin-1];
2622 if (eminus ==
fUndefi) eminus = 0;
2624 ndiag = iin*(iin + 1) / 2;
2628 if (
fISW[1] < 2)
return;
2667 if (
fISW[0] >= 1) ierev = 1;
2668 if (
fISW[3] < 1) ierev = 2;
2701 static const char *cname[40] = {
2746 Double_t step, xptu[101], yptu[101],
f, rno;
2747 Int_t icol, kcol, ierr, iint, iext, lnow, nptu, i, iflag, ierrf;
2748 Int_t ilist, nparx, izero, nf, lk, it, iw, inonde, nsuper;
2749 Int_t it2, ke1, ke2, nowprt, kll, krl;
2750 TString chwhy, c26, cvblnk, cneway, comd;
2752 Bool_t lfreed, ltofix, lfixed;
2759 if (lk > 20) lk = 20;
2764 for (iw = 1; iw <=
fMaxpar; ++iw) {
2766 if (iw <= llist)
fWord7[iw-1] = plist[iw-1];
2773 if (lnow > 4) lnow = 4;
2776 for (i = 1; i <= lnow; ++i) {
2779 Printf(
"%s",(
const char*)ctemp);
2788 for (i = lnow + 1; i <= kll; ++i) {
2789 Printf(
"%12.4g",plist[i-1]);
2794 Printf(
" ERROR: ABOVE CALL TO MNEXCM TRIED TO PASS MORE THAN %d PARAMETERS.",
fMaxpar);
2812 for (i = 1; i <= nntot; ++i) {
2813 if (strncmp(ctemp.
Data(),cname[i-1],3) == 0)
goto L90;
2815 Printf(
"UNKNOWN COMMAND IGNORED:%s", comand.
Data());
2820 if (
fCword(0,4) ==
"MINO") i = 5;
2821 if (i != 6 && i != 7 && i != 8 && i != 23) {
2836 case 10:
goto L1000;
2837 case 11:
goto L1100;
2838 case 12:
goto L1200;
2839 case 13:
goto L1300;
2840 case 14:
goto L1400;
2841 case 15:
goto L1500;
2842 case 16:
goto L1600;
2843 case 17:
goto L1700;
2844 case 18:
goto L1800;
2845 case 19:
goto L1900;
2846 case 20:
goto L1900;
2847 case 21:
goto L1900;
2848 case 22:
goto L2200;
2849 case 23:
goto L2300;
2850 case 24:
goto L2400;
2851 case 25:
goto L1900;
2852 case 26:
goto L2600;
2853 case 27:
goto L3300;
2854 case 28:
goto L3300;
2855 case 29:
goto L3300;
2856 case 30:
goto L3300;
2857 case 31:
goto L3300;
2858 case 32:
goto L3300;
2859 case 33:
goto L3300;
2860 case 34:
goto L3400;
2861 case 35:
goto L3500;
2862 case 36:
goto L3600;
2863 case 37:
goto L3700;
2864 case 38:
goto L3800;
2865 case 39:
goto L3900;
2866 case 40:
goto L4000;
2875 if (
fISW[3] < 1) ierflg = 4;
2883 if (
fISW[3] >= 1)
return;
2885 if (
fISW[0] == 1)
return;
2886 if (
fCword(0,3) ==
"MIG")
return;
2891 if (
fISW[0] == 1)
return;
2894 if (
fISW[3] >= 1) ierflg = 0;
2910 if (fNfcn < nsuper)
goto L510;
2911 Printf(
" TOO MANY FUNCTION CALLS. MINOS GIVES UP");
2931 Printf(
"%s: NO PARAMETERS REQUESTED ",(
const char*)
fCword);
2934 for (ilist = 1; ilist <= llist; ++ilist) {
2935 iext =
Int_t(plist[ilist-1]);
2936 chwhy =
" IS UNDEFINED.";
2937 if (iext <= 0)
goto L930;
2938 if (iext >
fNu)
goto L930;
2939 if (
fNvarl[iext-1] < 0)
goto L930;
2940 chwhy =
" IS CONSTANT. ";
2941 if (
fNvarl[iext-1] == 0)
goto L930;
2944 chwhy =
" ALREADY FIXED.";
2945 if (iint == 0)
goto L930;
2947 if (ierr == 0) lfixed =
kTRUE;
2950 chwhy =
" ALREADY VARIABLE.";
2951 if (iint > 0)
goto L930;
2958 if (
fISW[4] >= 0)
Printf(
" PARAMETER %4d %s IGNORED.",iext,(
const char*)chwhy);
2960 if (lfreed || lfixed)
mnrset(0);
2973 if (it > 1 || it < 0)
goto L1005;
2984 Printf(
" IGNORED. UNKNOWN ARGUMENT:%4d",it);
2994 if (iext <= 0)
goto L1210;
2997 if (it2 <= 0)
goto L1250;
3003 Printf(
" PARAMETER %4d NOT VARIABLE.",iext);
3015 Printf(
"%s: NO PARAMETERS REQUESTED ",(
const char*)
fCword);
3021 mncntr(ke1-1, ke2-1, ierrf);
3022 if (ierrf > 0) ierflg = 3;
3053 }
else if (f <
fAmin) {
3057 if (
fISW[4] >= 0 && iflag <= 5 && nowprt == 1) {
3062 if (iflag > 5)
mnrset(1);
3073 if (
fISW[4] >= 0)
Printf(
" CALL TO USER FUNCTION WITH IFLAG = 3");
3078 if (
fCword(0,3) ==
"END") ierflg = 10;
3079 if (
fCword(0,3) ==
"RET") ierflg = 12;
3085 Printf(
" MINUIT MEMORY CLEARED. NO PARAMETERS NOW DEFINED.");
3091 for (icol = 5; icol <= lk; ++icol) {
3092 if (
fCword[icol-1] ==
' ')
continue;
3097 if (kcol == 0) comd =
"* ";
3098 else comd =
fCword(kcol-1,lk-kcol+1);
3106 if (ke1 == 0 &&
fNpar == 2) {
3111 if (nptu <= 0) nptu = 20;
3112 if (nptu > 101) nptu = 101;
3114 mncont(ke1-1, ke2-1, nptu, xptu, yptu, ierrf);
3115 if (ierrf < nptu) ierflg = 4;
3116 if (ierrf == -1) ierflg = 3;
3121 if (step <= 0) step = 2;
3124 for (i = 1; i <=
fNpar; ++i) {
3127 fX[i-1] += rno*step*
fWerr[i-1];
3135 Printf(
" BLANK COMMAND IGNORED.");
3141 Printf(
" THE *COVARIANCE* COMMAND IS OSBSOLETE. THE COVARIANCE MATRIX IS NOW SAVED IN A DIFFERENT FORMAT WITH THE *SAVE* COMMAND AND READ IN WITH:*SET COVARIANCE*");
3146 cneway =
"SET PRInt ";
3150 cneway =
"SET GRAd ";
3154 cneway =
"SHOW COVar";
3158 cneway =
"SET ERRdef";
3162 cneway =
"SET LIMits";
3169 Printf(
" OBSOLETE COMMAND:%s PLEASE USE:%s",(
const char*)
fCword
3170 ,(
const char*)cneway);
3172 if (
fCword ==
"SAVE ")
goto L1500;
3190 for (iint = 1; iint <=
fNpar; ++iint) {
3193 pint[iint-1] = pinti;
3207 Int_t kold, nold, ndex, knew, iext, i, j,
m,
n, lc, ik;
3211 Int_t iint = iint1+1;
3212 if (iint >
fNpar || iint <= 0) {
3214 Printf(
" MINUIT ERROR. ARGUMENT TO MNFIXP=%4d",iint);
3220 Printf(
" MINUIT CANNOT FIX PARAMETER %4d MAXIMUM NUMBER THAT CAN BE FIXED IS %d",iext,
fMaxpar);
3240 for (ik = iext + 1; ik <=
fNu; ++ik) {
3254 if (
fISW[1] <= 0)
return;
3256 if (
fNpar <= 0)
return;
3257 for (i = 1; i <= nold; ++i) {
3260 ndex = m*(m-1) / 2 + n;
3266 for (i = 1; i <= nold; ++i) {
3267 for (j = 1; j <= i; ++j) {
3269 if (j == iint || i == iint)
continue;
3294 Double_t grdv, xv, dirinv, g2v, gstepv, xtv;
3295 Int_t i, ipsav, ka, lc, ik,
iq, ir, is;
3298 Printf(
" CALL TO MNFREE IGNORED. ARGUMENT GREATER THAN ONE");
3301 Printf(
" CALL TO MNFREE IGNORED. THERE ARE NO FIXED PARAMETERS");
3303 if (k == 1 || k == 0)
goto L40;
3307 if (
fNiofex[ka-1] == 0)
goto L15;
3308 Printf(
" IGNORED. PARAMETER SPECIFIED IS ALREADY VARIABLE.");
3311 if (
fNpfix < 1)
goto L21;
3312 for (ik = 1; ik <=
fNpfix; ++ik) {
if (
fIpfix[ik-1] == ka)
goto L24; }
3314 Printf(
" PARAMETER %4d NOT FIXED. CANNOT BE RELEASED.",ka);
3317 if (ik ==
fNpfix)
goto L40;
3327 for (i = ik + 1; i <=
fNpfix; ++i) {
3345 if (
fNpfix < 1)
goto L300;
3348 for (ik =
fNu; ik >= ir; --ik) {
3354 fX[lc-1] =
fX[lc-2];
3364 if (is == 0) is =
fNpar;
3368 fX[is-1] =
fXs[iq-1];
3379 Printf(
" PARAMETER %4d %s RESTORED TO VARIABLE.",ir,
3380 (
const char*)
fCpnam[ir-1]);
3382 if (k == 0)
goto L40;
3402 Int_t i, nparx, lc, istsav;
3408 if (
fWord7[0] > 0)
goto L2000;
3422 Printf(
" CHECK OF GRADIENT CALCULATION IN FCN");
3423 Printf(
" PARAMETER G(IN FCN) G(MINUIT) DG(MINUIT) AGREEMENT");
3426 for (lc = 1; lc <=
fNpar; ++lc) {
3436 if (cwd !=
"GOOD")
fISW[2] = 0;
3437 Printf(
" %5d %10s%12.4e%12.4e%12.4e %s",i
3438 ,(
const char*)
fCpnam[i-1]
3442 Printf(
" AGREEMENT=NONE MEANS FCN DID NOT CALCULATE THE DERIVATIVE");
3445 Printf(
" MINUIT DOES NOT ACCEPT DERIVATIVE CALCULATIONS BY FCN");
3446 Printf(
" TO FORCE ACCEPTANCE, ENTER *SET GRAD 1*");
3484 if( comd.
Length() == 0 || comd[0] ==
'*' || comd[0] ==
'?' || comd[0] == 0 || comd==
"HELP" ) {
3485 Printf(
" ==>List of MINUIT Interactive commands:");
3486 Printf(
" CLEar Reset all parameter names and values undefined");
3487 Printf(
" CONtour Make contour map of the user function");
3488 Printf(
" EXIT Exit from Interactive Minuit");
3489 Printf(
" FIX Cause parameter(s) to remain constant");
3490 Printf(
" HESse Calculate the Hessian or error matrix.");
3491 Printf(
" IMPROVE Search for a new minimum around current minimum");
3492 Printf(
" MIGrad Minimize by the method of Migrad");
3493 Printf(
" MINImize MIGRAD + SIMPLEX method if Migrad fails");
3494 Printf(
" MINOs Exact (non-linear) parameter error analysis");
3495 Printf(
" MNContour Calculate one MINOS function contour");
3496 Printf(
" PARameter Define or redefine new parameters and values");
3497 Printf(
" RELease Make previously FIXed parameters variable again");
3498 Printf(
" REStore Release last parameter fixed");
3499 Printf(
" SAVe Save current parameter values on a file");
3500 Printf(
" SCAn Scan the user function by varying parameters");
3501 Printf(
" SEEk Minimize by the method of Monte Carlo");
3502 Printf(
" SET Set various MINUIT constants or conditions");
3503 Printf(
" SHOw Show values of current constants or conditions");
3504 Printf(
" SIMplex Minimize by the method of Simplex");
3513 if( !strncmp(comd.
Data(),
"CLE",3) ) {
3515 Printf(
" Resets all parameter names and values to undefined.");
3516 Printf(
" Must normally be followed by a PARameters command or ");
3517 Printf(
" equivalent, in order to define parameter values.");
3525 if( !strncmp(comd.
Data(),
"CON",3) ) {
3526 Printf(
" ***>CONTOUR <par1> <par2> [devs] [ngrid]");
3527 Printf(
" Instructs Minuit to trace contour lines of the user function");
3528 Printf(
" with respect to the two parameters whose external numbers");
3529 Printf(
" are <par1> and <par2>.");
3530 Printf(
" Other variable parameters of the function, if any, will have");
3531 Printf(
" their values fixed at the current values during the contour");
3532 Printf(
" tracing. The optional parameter [devs] (default value 2.)");
3533 Printf(
" gives the number of standard deviations in each parameter");
3534 Printf(
" which should lie entirely within the plotting area.");
3535 Printf(
" Optional parameter [ngrid] (default value 25 unless page");
3536 Printf(
" size is too small) determines the resolution of the plot,");
3537 Printf(
" i.e. the number of rows and columns of the grid at which the");
3538 Printf(
" function will be evaluated. [See also MNContour.]");
3546 if( !strncmp(comd.
Data(),
"END",3) ) {
3548 Printf(
" Signals the end of a data block (i.e., the end of a fit),");
3549 Printf(
" and implies that execution should continue, because another");
3550 Printf(
" Data Block follows. A Data Block is a set of Minuit data");
3551 Printf(
" consisting of");
3553 Printf(
" (2) One or more Parameter Definitions,");
3554 Printf(
" (3) A blank line, and");
3555 Printf(
" (4) A set of Minuit Commands.");
3556 Printf(
" The END command is used when more than one Data Block is to");
3557 Printf(
" be used with the same FCN function. It first causes Minuit");
3558 Printf(
" to issue a CALL FCN with IFLAG=3, in order to allow FCN to");
3559 Printf(
" perform any calculations associated with the final fitted");
3560 Printf(
" parameter values, unless a CALL FCN 3 command has already");
3561 Printf(
" been executed at the current FCN value.");
3569 if( !strncmp(comd.
Data(),
"EXI",3) ) {
3571 Printf(
" Signals the end of execution.");
3572 Printf(
" The EXIT command first causes Minuit to issue a CALL FCN");
3573 Printf(
" with IFLAG=3, to allow FCN to perform any calculations");
3574 Printf(
" associated with the final fitted parameter values, unless a");
3575 Printf(
" CALL FCN 3 command has already been executed.");
3583 if( !strncmp(comd.
Data(),
"FIX",3) ) {
3584 Printf(
" ***>FIX} <parno> [parno] ... [parno]");
3585 Printf(
" Causes parameter(s) <parno> to be removed from the list of");
3586 Printf(
" variable parameters, and their value(s) will remain constant");
3587 Printf(
" during subsequent minimizations, etc., until another command");
3588 Printf(
" changes their value(s) or status.");
3596 if( !strncmp(comd.
Data(),
"HES",3) ) {
3597 Printf(
" ***>HESse [maxcalls]");
3598 Printf(
" Calculate, by finite differences, the Hessian or error matrix.");
3599 Printf(
" That is, it calculates the full matrix of second derivatives");
3600 Printf(
" of the function with respect to the currently variable");
3601 Printf(
" parameters, and inverts it, printing out the resulting error");
3602 Printf(
" matrix. The optional argument [maxcalls] specifies the");
3603 Printf(
" (approximate) maximum number of function calls after which");
3604 Printf(
" the calculation will be stopped.");
3612 if( !strncmp(comd.
Data(),
"IMP",3) ) {
3613 Printf(
" ***>IMPROVE [maxcalls]");
3614 Printf(
" If a previous minimization has converged, and the current");
3615 Printf(
" values of the parameters therefore correspond to a local");
3616 Printf(
" minimum of the function, this command requests a search for");
3617 Printf(
" additional distinct local minima.");
3618 Printf(
" The optional argument [maxcalls] specifies the (approximate");
3619 Printf(
" maximum number of function calls after which the calculation");
3620 Printf(
" will be stopped.");
3628 if( !strncmp(comd.
Data(),
"MIG",3) ) {
3629 Printf(
" ***>MIGrad [maxcalls] [tolerance]");
3630 Printf(
" Causes minimization of the function by the method of Migrad,");
3631 Printf(
" the most efficient and complete single method, recommended");
3632 Printf(
" for general functions (see also MINImize).");
3633 Printf(
" The minimization produces as a by-product the error matrix");
3634 Printf(
" of the parameters, which is usually reliable unless warning");
3635 Printf(
" messages are produced.");
3636 Printf(
" The optional argument [maxcalls] specifies the (approximate)");
3637 Printf(
" maximum number of function calls after which the calculation");
3638 Printf(
" will be stopped even if it has not yet converged.");
3639 Printf(
" The optional argument [tolerance] specifies required tolerance");
3640 Printf(
" on the function value at the minimum.");
3641 Printf(
" The default tolerance is 0.1, and the minimization will stop");
3642 Printf(
" when the estimated vertical distance to the minimum (EDM) is");
3643 Printf(
" less than 0.001*[tolerance]*UP (see [SET ERRordef]).");
3651 if( !strncmp(comd.
Data(),
"MINI",4) ) {
3652 Printf(
" ***>MINImize [maxcalls] [tolerance]");
3653 Printf(
" Causes minimization of the function by the method of Migrad,");
3654 Printf(
" as does the MIGrad command, but switches to the SIMplex method");
3655 Printf(
" if Migrad fails to converge. Arguments are as for MIGrad.");
3656 Printf(
" Note that command requires four characters to be unambiguous.");
3664 if( !strncmp(comd.
Data(),
"MIN0",4) ) {
3665 Printf(
" ***>MINOs [maxcalls] [parno] [parno] ...");
3666 Printf(
" Causes a Minos error analysis to be performed on the parameters");
3667 Printf(
" whose numbers [parno] are specified. If none are specified,");
3668 Printf(
" Minos errors are calculated for all variable parameters.");
3669 Printf(
" Minos errors may be expensive to calculate, but are very");
3670 Printf(
" reliable since they take account of non-linearities in the");
3671 Printf(
" problem as well as parameter correlations, and are in general");
3673 Printf(
" The optional argument [maxcalls] specifies the (approximate)");
3674 Printf(
" maximum number of function calls per parameter requested,");
3675 Printf(
" after which the calculation will stop for that parameter.");
3683 if( !strncmp(comd.
Data(),
"MNC",3) ) {
3684 Printf(
" ***>MNContour <par1> <par2> [npts]");
3685 Printf(
" Calculates one function contour of FCN with respect to");
3686 Printf(
" parameters par1 and par2, with FCN minimized always with");
3687 Printf(
" respect to all other NPAR-2 variable parameters (if any).");
3688 Printf(
" Minuit will try to find npts points on the contour (default 20)");
3689 Printf(
" If only two parameters are variable at the time, it is not");
3690 Printf(
" necessary to specify their numbers. To calculate more than");
3691 Printf(
" one contour, it is necessary to SET ERRordef to the appropriate");
3692 Printf(
" value and issue the MNContour command for each contour.");
3700 if( !strncmp(comd.
Data(),
"PAR",3) ) {
3701 Printf(
" ***>PARameters");
3702 Printf(
" followed by one or more parameter definitions.");
3703 Printf(
" Parameter definitions are of the form:");
3704 Printf(
" <number> ''name'' <value> <step> [lolim] [uplim] ");
3706 Printf(
" 3 ''K width'' 1.2 0.1");
3707 Printf(
" the last definition is followed by a blank line or a zero.");
3715 if( !strncmp(comd.
Data(),
"REL",3) ) {
3716 Printf(
" ***>RELease <parno> [parno] ... [parno]");
3717 Printf(
" If <parno> is the number of a previously variable parameter");
3718 Printf(
" which has been fixed by a command: FIX <parno>, then that");
3719 Printf(
" parameter will return to variable status. Otherwise a warning");
3720 Printf(
" message is printed and the command is ignored.");
3721 Printf(
" Note that this command operates only on parameters which were");
3722 Printf(
" at one time variable and have been FIXed. It cannot make");
3723 Printf(
" constant parameters variable; that must be done by redefining");
3724 Printf(
" the parameter with a PARameters command.");
3732 if( !strncmp(comd.
Data(),
"RES",3) ) {
3733 Printf(
" ***>REStore [code]");
3734 Printf(
" If no [code] is specified, this command restores all previously");
3735 Printf(
" FIXed parameters to variable status. If [code]=1, then only");
3736 Printf(
" the last parameter FIXed is restored to variable status.");
3737 Printf(
" If code is neither zero nor one, the command is ignored.");
3745 if( !strncmp(comd.
Data(),
"RET",3) ) {
3747 Printf(
" Signals the end of a data block, and instructs Minuit to return");
3748 Printf(
" to the program which called it. The RETurn command first");
3749 Printf(
" causes Minuit to CALL FCN with IFLAG=3, in order to allow FCN");
3750 Printf(
" to perform any calculations associated with the final fitted");
3751 Printf(
" parameter values, unless a CALL FCN 3 command has already been");
3752 Printf(
" executed at the current FCN value.");
3760 if( !strncmp(comd.
Data(),
"SAV",3) ) {
3762 Printf(
" Causes the current parameter values to be saved on a file in");
3763 Printf(
" such a format that they can be read in again as Minuit");
3764 Printf(
" parameter definitions. If the covariance matrix exists, it is");
3765 Printf(
" also output in such a format. The unit number is by default 7,");
3766 Printf(
" or that specified by the user in their call to MINTIO or");
3767 Printf(
" MNINIT. The user is responsible for opening the file previous");
3768 Printf(
" to issuing the [SAVe] command (except where this can be done");
3769 Printf(
" interactively).");
3777 if( !strncmp(comd.
Data(),
"SCA",3) ) {
3778 Printf(
" ***>SCAn [parno] [numpts] [from] [to]");
3779 Printf(
" Scans the value of the user function by varying parameter");
3780 Printf(
" number [parno], leaving all other parameters fixed at the");
3781 Printf(
" current value. If [parno] is not specified, all variable");
3782 Printf(
" parameters are scanned in sequence.");
3783 Printf(
" The number of points [numpts] in the scan is 40 by default,");
3784 Printf(
" and cannot exceed 100. The range of the scan is by default");
3785 Printf(
" 2 standard deviations on each side of the current best value,");
3786 Printf(
" but can be specified as from [from] to [to].");
3787 Printf(
" After each scan, if a new minimum is found, the best parameter");
3788 Printf(
" values are retained as start values for future scans or");
3789 Printf(
" minimizations. The curve resulting from each scan is plotted");
3790 Printf(
" on the output unit in order to show the approximate behaviour");
3791 Printf(
" of the function.");
3792 Printf(
" This command is not intended for minimization, but is sometimes");
3793 Printf(
" useful for debugging the user function or finding a");
3794 Printf(
" reasonable starting point.");
3802 if( !strncmp(comd.
Data(),
"SEE",3) ) {
3803 Printf(
" ***>SEEk [maxcalls] [devs]");
3804 Printf(
" Causes a Monte Carlo minimization of the function, by choosing");
3805 Printf(
" random values of the variable parameters, chosen uniformly");
3806 Printf(
" over a hypercube centered at the current best value.");
3807 Printf(
" The region size is by default 3 standard deviations on each");
3808 Printf(
" side, but can be changed by specifying the value of [devs].");
3816 if( !strncmp(comd.
Data(),
"SET",3) ) {
3817 Printf(
" ***>SET <option_name>");
3819 Printf(
" Informs Minuit that it is running in batch mode.");
3822 Printf(
" SET EPSmachine <accuracy>");
3823 Printf(
" Informs Minuit that the relative floating point arithmetic");
3824 Printf(
" precision is <accuracy>. Minuit determines the nominal");
3825 Printf(
" precision itself, but the SET EPSmachine command can be");
3826 Printf(
" used to override Minuit own determination, when the user");
3827 Printf(
" knows that the FCN function value is not calculated to");
3828 Printf(
" the nominal machine accuracy. Typical values of <accuracy>");
3829 Printf(
" are between 10**-5 and 10**-14.");
3832 Printf(
" SET ERRordef <up>");
3833 Printf(
" Sets the value of UP (default value= 1.), defining parameter");
3834 Printf(
" errors. Minuit defines parameter errors as the change");
3835 Printf(
" in parameter value required to change the function value");
3836 Printf(
" by UP. Normally, for chisquared fits UP=1, and for negative");
3837 Printf(
" log likelihood, UP=0.5.");
3840 Printf(
" SET GRAdient [force]");
3841 Printf(
" Informs Minuit that the user function is prepared to");
3842 Printf(
" calculate its own first derivatives and return their values");
3843 Printf(
" in the array GRAD when IFLAG=2 (see specs of FCN).");
3844 Printf(
" If [force] is not specified, Minuit will calculate");
3845 Printf(
" the FCN derivatives by finite differences at the current");
3846 Printf(
" point and compare with the user calculation at that point,");
3847 Printf(
" accepting the user values only if they agree.");
3848 Printf(
" If [force]=1, Minuit does not do its own derivative");
3849 Printf(
" calculation, and uses the derivatives calculated in FCN.");
3852 Printf(
" SET INPut [unitno] [filename]");
3853 Printf(
" Causes Minuit, in data-driven mode only, to read subsequent");
3854 Printf(
" commands (or parameter definitions) from a different input");
3855 Printf(
" file. If no [unitno] is specified, reading reverts to the");
3856 Printf(
" previous input file, assuming that there was one.");
3857 Printf(
" If [unitno] is specified, and that unit has not been opened,");
3858 Printf(
" then Minuit attempts to open the file [filename]} if a");
3859 Printf(
" name is specified. If running in interactive mode and");
3860 Printf(
" [filename] is not specified and [unitno] is not opened,");
3861 Printf(
" Minuit prompts the user to enter a file name.");
3862 Printf(
" If the word REWIND is added to the command (note:no blanks");
3863 Printf(
" between INPUT and REWIND), the file is rewound before");
3864 Printf(
" reading. Note that this command is implemented in standard");
3865 Printf(
" Fortran 77 and the results may depend on the system;");
3866 Printf(
" for example, if a filename is given under VM/CMS, it must");
3867 Printf(
" be preceded by a slash.");
3870 Printf(
" SET INTeractive");
3871 Printf(
" Informs Minuit that it is running interactively.");
3874 Printf(
" SET LIMits [parno] [lolim] [uplim]");
3875 Printf(
" Allows the user to change the limits on one or all");
3876 Printf(
" parameters. If no arguments are specified, all limits are");
3877 Printf(
" removed from all parameters. If [parno] alone is specified,");
3878 Printf(
" limits are removed from parameter [parno].");
3879 Printf(
" If all arguments are specified, then parameter [parno] will");
3880 Printf(
" be bounded between [lolim] and [uplim].");
3881 Printf(
" Limits can be specified in either order, Minuit will take");
3882 Printf(
" the smaller as [lolim] and the larger as [uplim].");
3883 Printf(
" However, if [lolim] is equal to [uplim], an error condition");
3887 Printf(
" SET LINesperpage");
3888 Printf(
" Sets the number of lines for one page of output.");
3889 Printf(
" Default value is 24 for interactive mode");
3892 Printf(
" SET NOGradient");
3893 Printf(
" The inverse of SET GRAdient, instructs Minuit not to");
3894 Printf(
" use the first derivatives calculated by the user in FCN.");
3897 Printf(
" SET NOWarnings");
3898 Printf(
" Supresses Minuit warning messages.");
3901 Printf(
" SET OUTputfile <unitno>");
3902 Printf(
" Instructs Minuit to write further output to unit <unitno>.");
3905 Printf(
" SET PAGethrow <integer>");
3906 Printf(
" Sets the carriage control character for ``new page'' to");
3907 Printf(
" <integer>. Thus the value 1 produces a new page, and 0");
3908 Printf(
" produces a blank line, on some devices (see TOPofpage)");
3912 Printf(
" SET PARameter <parno> <value>");
3913 Printf(
" Sets the value of parameter <parno> to <value>.");
3914 Printf(
" The parameter in question may be variable, fixed, or");
3915 Printf(
" constant, but must be defined.");
3918 Printf(
" SET PRIntout <level>");
3919 Printf(
" Sets the print level, determining how much output will be");
3920 Printf(
" produced. Allowed values and their meanings are displayed");
3921 Printf(
" after a SHOw PRInt command, and are currently <level>=:");
3922 Printf(
" [-1] no output except from SHOW commands");
3923 Printf(
" [0] minimum output");
3924 Printf(
" [1] default value, normal output");
3925 Printf(
" [2] additional output giving intermediate results.");
3926 Printf(
" [3] maximum output, showing progress of minimizations.");
3927 Printf(
" Note: See also the SET WARnings command.");
3930 Printf(
" SET RANdomgenerator <seed>");
3931 Printf(
" Sets the seed of the random number generator used in SEEk.");
3932 Printf(
" This can be any integer between 10000 and 900000000, for");
3933 Printf(
" example one which was output from a SHOw RANdom command of");
3934 Printf(
" a previous run.");
3937 Printf(
" SET STRategy <level>");
3938 Printf(
" Sets the strategy to be used in calculating first and second");
3939 Printf(
" derivatives and in certain minimization methods.");
3940 Printf(
" In general, low values of <level> mean fewer function calls");
3941 Printf(
" and high values mean more reliable minimization.");
3942 Printf(
" Currently allowed values are 0, 1 (default), and 2.");
3946 Printf(
" Informs Minuit that the next input line is to be considered");
3947 Printf(
" the (new) title for this task or sub-task. This is for");
3948 Printf(
" the convenience of the user in reading their output.");
3952 Printf(
" Instructs Minuit to output warning messages when suspicious");
3953 Printf(
" conditions arise which may indicate unreliable results.");
3954 Printf(
" This is the default.");
3957 Printf(
" SET WIDthpage");
3958 Printf(
" Informs Minuit of the output page width.");
3959 Printf(
" Default values are 80 for interactive jobs");
3967 if( !strncmp(comd.
Data(),
"SHO",3) ) {
3968 Printf(
" ***>SHOw <option_name>");
3969 Printf(
" All SET XXXX commands have a corresponding SHOw XXXX command.");
3970 Printf(
" In addition, the SHOw commands listed starting here have no");
3971 Printf(
" corresponding SET command for obvious reasons.");
3974 Printf(
" SHOw CORrelations");
3975 Printf(
" Calculates and prints the parameter correlations from the");
3976 Printf(
" error matrix.");
3979 Printf(
" SHOw COVariance");
3980 Printf(
" Prints the (external) covariance (error) matrix.");
3983 Printf(
" SHOw EIGenvalues");
3984 Printf(
" Calculates and prints the eigenvalues of the covariance");
3988 Printf(
" SHOw FCNvalue");
3989 Printf(
" Prints the current value of FCN.");
3997 if( !strncmp(comd.
Data(),
"SIM",3) ) {
3998 Printf(
" ***>SIMplex [maxcalls] [tolerance]");
3999 Printf(
" Performs a function minimization using the simplex method of");
4000 Printf(
" Nelder and Mead. Minimization terminates either when the");
4001 Printf(
" function has been called (approximately) [maxcalls] times,");
4002 Printf(
" or when the estimated vertical distance to minimum (EDM) is");
4003 Printf(
" less than [tolerance].");
4004 Printf(
" The default value of [tolerance] is 0.1*UP(see SET ERRordef).");
4012 if( !strncmp(comd.
Data(),
"STA",3) ) {
4021 if( !strncmp(comd.
Data(),
"STO",3) ) {
4023 Printf(
" Same as EXIT.");
4031 if( !strncmp(comd.
Data(),
"TOP",3) ) {
4032 Printf(
" ***>TOPofpage");
4033 Printf(
" Causes Minuit to write the character specified in a");
4034 Printf(
" SET PAGethrow command (default = 1) to column 1 of the output");
4035 Printf(
" file, which may or may not position your output medium to");
4036 Printf(
" the top of a page depending on the device and system.");
4040 Printf(
" Unknown MINUIT command. Type HELP for list of commands.");
4059 Double_t dmin_, dxdi, elem, wint, tlrg2, d, dlast, ztemp, g2bfor;
4060 Double_t df, aimsag, fs1, tlrstp, fs2, stpinm, g2i, sag=0, xtf, xti, xtj;
4061 Int_t icyc, ncyc, ndex, idrv, iext, npar2, i, j, ifail, npard, nparx,
id, multpy;
4064 ldebug =
fIdbg[3] >= 1;
4081 if (
fISW[4] >= 2 || ldebug) {
4082 Printf(
" START COVARIANCE MATRIX CALCULATION.");
4098 Printf(
" PAR D GSTEP D G2 GRD SAG ");
4108 for (i = 1; i <= npar2; ++i) {
fVhmat[i-1] = 0; }
4112 for (
id = 1;
id <= npard; ++
id) {
4113 i =
id +
fNpar - npard;
4115 if (
fG2[i-1] == 0) {
4116 mnwarn(
"W",
"HESSE",
Form(
"Second derivative enters zero, param %d",iext));
4118 if (
fNvarl[iext-1] > 1) {
4123 fG2[i-1] =
fUp / (wint*wint);
4131 for (icyc = 1; icyc <= ncyc; ++icyc) {
4133 for (multpy = 1; multpy <= 5; ++multpy) {
4143 sag = (fs1 + fs2 -
fAmin*2)*.5;
4144 if (sag != 0)
goto L30;
4146 if (d >= .5)
goto L26;
4148 if (d > .5) d = .51;
4159 fG2[i-1] = sag*2 / (d*d);
4160 fGrd[i-1] = (fs1 - fs2) / (d*2);
4162 Printf(
"%4d%2d%12.5g%12.5g%12.5g%12.5g%12.5g",i,idrv,
fGstep[i-1],d,
fG2[i-1],
fGrd[i-1],sag);
4173 if (d < dmin_) d = dmin_;
4175 if (TMath::Abs((d - dlast) / d) < tlrstp ||
4176 TMath::Abs((
fG2[i-1] - g2bfor) /
fG2[i-1]) < tlrg2) {
4187 ndex = i*(i + 1) / 2;
4198 if (
fNpar == 1)
goto L214;
4199 for (i = 1; i <=
fNpar; ++i) {
4200 for (j = 1; j <= i-1; ++j) {
4204 fX[j-1] = xtj + fDirin[j-1];
4210 fDirin[i-1]*fDirin[j-1]);
4211 ndex = i*(i-1) / 2 + j;
4219 for (i = 1; i <=
fNpar; ++i) {
4220 for (j = 1; j <= i; ++j) {
4221 ndex = i*(i-1) / 2 + j;
4228 mnwarn(
"W",
"HESSE",
"Matrix inversion fails.");
4234 for (i = 1; i <=
fNpar; ++i) {
4237 for (j = 1; j <= i-1; ++j) {
4249 Printf(
" COVARIANCE MATRIX CALCULATED SUCCESSFULLY");
4258 Printf(
" MNHESS FAILS AND WILL RETURN DIAGONAL MATRIX. ");
4260 for (i = 1; i <=
fNpar; ++i) {
4262 for (j = 1; j <= i-1; ++j) {
4268 if (g2i <= 0) g2i = 1;
4269 fVhmat[ndex-1] = 2 / g2i;
4285 Double_t dmin_, d, dfmin, dgmin=0, change, chgold, grdold=0, epspri;
4286 Double_t fs1, optstp, fs2, grdnew=0, sag, xtf;
4287 Int_t icyc, ncyc=0, idrv, i, nparx;
4290 ldebug =
fIdbg[5] >= 1;
4298 for (i = 1; i <=
fNpar; ++i) {
4304 if (d > optstp) d = optstp;
4305 if (d < dmin_) d = dmin_;
4308 for (icyc = 1; icyc <= ncyc; ++icyc) {
4317 sag = (fs1 + fs2 -
fAmin*2)*.5;
4319 grdnew = (fs1 - fs2) / (d*2);
4322 Printf(
"%4d%2d%12.5g%12.5g%12.5g%12.5g%12.5g",i,idrv,
fGstep[i-1],d,
fG2[i-1],grdnew,sag);
4324 if (grdnew == 0)
goto L60;
4325 change =
TMath::Abs((grdold - grdnew) / grdnew);
4326 if (change > chgold && icyc > 1)
goto L60;
4332 if (change < .05)
goto L60;
4333 if (TMath::Abs(grdold - grdnew) < dgmin)
goto L60;
4335 mnwarn(
"D",
"MNHES1",
"Step size too small for 1st drv.");
4366 Double_t amax, ycalf, ystar, ystst;
4367 Double_t pb, ep, wg, xi, sigsav, reg, sig2;
4368 Int_t npfn, ndex, loop=0, i, j, ifail, iseed=0;
4369 Int_t jhold, nloop, nparx, nparp1, jh, jl, iswtr;
4371 if (
fNpar <= 0)
return;
4378 if (nloop <= 0) nloop =
fNpar + 4;
4385 for (i = 1; i <=
fNpar; ++i) {
4388 for (j = 1; j <= i; ++j) {
4389 ndex = i*(i-1) / 2 + j;
4395 if (ifail >= 1)
goto L280;
4397 for (i = 1; i <=
fNpar; ++i) {
4399 for (j = 1; j <= i; ++j) {
4407 for (i = 1; i <=
fNpar; ++i) {
4415 Printf(
"START ATTEMPT NO.%2d TO FIND NEW MINIMUM",loop);
4425 for (i = 1; i <=
fNpar; ++i) {
4428 fX[i-1] = xi -
fDirin[i-1]*(rnum - .5);
4434 }
else if (
fIMPRy[i-1] > amax) {
4447 if (
fAmin < 0)
goto L95;
4448 if (
fISW[1] <= 2)
goto L280;
4450 if (sig2 < ep &&
fEDM < ep)
goto L100;
4454 for (i = 1; i <=
fNpar; ++i) {
4462 if (ystar >=
fAmin)
goto L70;
4464 for (i = 1; i <=
fNpar; ++i) {
4469 if (ystst <
fIMPRy[jl-1])
goto L67;
4477 if (ystar >=
fIMPRy[jh-1])
goto L73;
4480 if (jhold != jh)
goto L50;
4483 for (i = 1; i <=
fNpar; ++i) {
4488 if (ystst >
fIMPRy[jh-1])
goto L30;
4490 if (ystst <
fAmin)
goto L67;
4496 Printf(
" AN IMPROVEMENT ON THE PREVIOUS MINIMUM HAS BEEN FOUND");
4503 for (i = 1; i <=
fNpar; ++i) {
4513 for (i = 1; i <=
fNpar; ++i) {
4531 Printf(
" IMPROVE HAS FOUND A TRULY NEW MINIMUM");
4532 Printf(
" *************************************");
4538 Printf(
" COVARIANCE MATRIX WAS NOT POSITIVE-DEFINITE");
4544 for (i = 1; i <=
fNpar; ++i) {
4553 Printf(
" IMPROVE HAS RETURNED TO REGION OF ORIGINAL MINIMUM");
4557 if (
fISW[1] < 2)
goto L380;
4558 if (loop < nloop &&
fISW[0] < 1)
goto L20;
4575 for (j = 0; j <
fNpar; ++j) {
4596 Double_t piby2, epstry, epsbak, distnn;
4614 fCovmes[0] =
"NO ERROR MATRIX ";
4615 fCovmes[1] =
"ERR MATRIX APPROXIMATE";
4616 fCovmes[2] =
"ERR MATRIX NOT POS-DEF";
4617 fCovmes[3] =
"ERROR MATRIX ACCURATE ";
4635 for (idb = 0; idb <= 10; ++
idb) {
fIdbg[
idb] = 0; }
4655 for (i = 1; i <= 100; ++i) {
4659 if (epsbak < epstry)
goto L35;
4663 Printf(
" MNINIT UNABLE TO DETERMINE ARITHMETIC PRECISION. WILL ASSUME:%g",
fEpsmac);
4693 if (i2 >
fMaxext || i2 < 0)
goto L900;
4694 if (i2 > 0)
goto L30;
4698 for (inu = 1; inu <=
fNu; ++inu) {
4699 if (
fNvarl[inu-1] <= 0)
continue;
4700 if (
fNvarl[inu-1] == 1 && newcod == 1)
continue;
4705 Printf(
" LIMITS NOT CHANGED FOR FIXED PARAMETER:%4d",inu);
4712 Printf(
" LIMITS REMOVED FROM PARAMETER :%3d",inu);
4716 snew =
fGstep[kint-1]*dxdi;
4724 Printf(
" PARAMETER %3d LIMITS SET TO %15.5g%15.5g",inu,
fAlim[inu-1],
fBlim[inu-1]);
4735 Printf(
" PARAMETER %3d IS NOT VARIABLE.", i2);
4741 Printf(
" REQUEST TO CHANGE LIMITS ON FIXED PARAMETER:%3d",i2);
4742 for (ifx = 1; ifx <=
fNpfix; ++ifx) {
4743 if (i2 ==
fIpfix[ifx-1])
goto L92;
4745 Printf(
" MINUIT BUG IN MNLIMS. SEE F. JAMES");
4753 Printf(
" LIMITS REMOVED FROM PARAMETER %2d",i2);
4762 fGrd[kint-1] *= dxdi;
4766 Printf(
" NO LIMITS SPECIFIED. PARAMETER %3d IS ALREADY UNLIMITED. NO CHANGE.",i2);
4775 Printf(
" PARAMETER %3d LIMITS SET TO %15.5g%15.5g",i2,
fAlim[i2-1],
fBlim[i2-1]);
4778 if (kint <= 0)
fGsteps[ifx-1] = -.1;
4779 else fGstep[kint-1] = -.1;
4782 if (
fCstatu !=
"NO CHANGE ") {
4807 Double_t xpq[12], ypq[12], slam, sdev, coeff[3], denom, flast;
4808 Double_t fvals[3], xvals[3],
f1, fvmin, xvmin, ratio,
f2, f3 = 0., fvmax;
4809 Double_t toler8, toler9, overal, undral, slamin, slamax, slopem;
4810 Int_t i, nparx=0, nvmax=0, nxypt, kk, ipt;
4817 l65 = 0; l70 = 0; l80 = 0;
4818 ldebug =
fIdbg[1] >= 1;
4827 Printf(
" MNLINE start point not consistent, F values, parameters=");
4828 for (kk = 1; kk <=
fNpar; ++kk) {
4837 chpq[0] = charal[0];
4842 for (i = 1; i <=
fNpar; ++i) {
4843 if (step[i-1] != 0) {
4845 if (slamin == 0) slamin = ratio;
4846 if (ratio < slamin) slamin = ratio;
4848 fX[i-1] = start[i-1] + step[i-1];
4850 if (slamin == 0) slamin =
fEpsmac;
4857 chpq[nxypt-1] = charal[nxypt-1];
4872 denom = (flast - fstart - slope*slam)*2 / (slam*slam);
4874 if (denom != 0) slam = -slope / denom;
4875 if (slam < 0) slam = slamax;
4876 if (slam > slamax) slam = slamax;
4877 if (slam < toler8) slam = toler8;
4878 if (slam < slamin) {
4882 if (
TMath::Abs(slam - 1) < toler8 && f1 < fstart) {
4886 if (
TMath::Abs(slam - 1) < toler8) slam = toler8 + 1;
4891 for (i = 1; i <=
fNpar; ++i) {
fX[i-1] = start[i-1] + slam*step[i-1]; }
4896 chpq[nxypt-1] = charal[nxypt-1];
4897 xpq[nxypt-1] = slam;
4903 if (fstart == fvmin) {
4905 toler8 = toler*slam;
4906 overal = slam - toler8;
4909 }
while (fstart == fvmin);
4911 if (!l65 && !l70 && !l80) {
4915 xvals[1] = xpq[nxypt-2];
4916 fvals[1] = ypq[nxypt-2];
4917 xvals[2] = xpq[nxypt-1];
4918 fvals[2] = ypq[nxypt-1];
4922 mnpfit(xvals, fvals, 3, coeff, sdev);
4923 if (coeff[2] <= 0) {
4924 slopem = coeff[2]*2*xvmin + coeff[1];
4925 if (slopem <= 0) slam = xvmin + slamax;
4926 else slam = xvmin - slamax;
4928 slam = -coeff[1] / (coeff[2]*2);
4929 if (slam > xvmin + slamax) slam = xvmin + slamax;
4930 if (slam < xvmin - slamax) slam = xvmin - slamax;
4935 else if (slam < undral)
4942 for (ipt = 1; ipt <= 3; ++ipt) {
4943 if (
TMath::Abs(slam - xvals[ipt-1]) < toler9) {
4954 for (i = 1; i <=
fNpar; ++i) {
fX[i-1] = start[i-1] + slam*step[i-1]; }
4958 chpq[nxypt-1] = charal[nxypt-1];
4959 xpq[nxypt-1] = slam;
4964 if (fvals[1] > fvmax) {
4968 if (fvals[2] > fvmax) {
4978 if (slam > xvmin) overal =
TMath::Min(overal,slam - toler8);
4979 if (slam < xvmin) undral =
TMath::Max(undral,slam + toler8);
4980 slam = (slam + xvmin)*.5;
4982 }
while (f3 >= fvmax);
4985 if (l65 || l70)
break;
4987 xvals[nvmax-1] = slam;
4988 fvals[nvmax-1] = f3;
4993 if (slam > xvmin) overal =
TMath::Min(overal,slam - toler8);
4994 if (slam < xvmin) undral =
TMath::Max(undral,slam + toler8);
4996 }
while (nxypt < 12);
5002 cmess =
" LINE SEARCH HAS EXHAUSTED THE LIMIT OF FUNCTION CALLS ";
5004 Printf(
" MNLINE DEBUG: steps=");
5005 for (kk = 1; kk <=
fNpar; ++kk) {
5006 Printf(
" %12.4g",step[kk-1]);
5011 if (l70) cmess =
" LINE SEARCH HAS ATTAINED TOLERANCE ";
5012 if (l80) cmess =
" STEP SIZE AT ARITHMETICALLY ALLOWED MINIMUM";
5015 for (i = 1; i <=
fNpar; ++i) {
5016 fDirin[i-1] = step[i-1]*xvmin;
5017 fX[i-1] = start[i-1] +
fDirin[i-1];
5021 mnwarn(
"D",
"MNLINE",
" LINE MINIMUM IN BACKWARDS DIRECTION");
5023 if (fvmin == fstart) {
5024 mnwarn(
"D",
"MNLINE",
" LINE SEARCH FINDS NO IMPROVEMENT ");
5027 Printf(
" AFTER %3d POINTS,%s",nxypt,(
const char*)cmess);
5042 Int_t ndex, i, j,
m,
n, ncoef, nparm,
id, it, ix;
5043 Int_t nsofar, ndi, ndj, iso, isw2, isw5;
5052 Printf(
" MNMATU: NPAR=0");
5066 if (
fNpar <= 1)
return;
5072 Printf(
" PARAMETER CORRELATION COEFFICIENTS ");
5073 ctemp =
" NO. GLOBAL";
5074 for (
id = 1;
id <= nparm; ++
id) {
5077 Printf(
"%s",(
const char*)ctemp);
5078 for (i = 1; i <=
fNpar; ++i) {
5080 ndi = i*(i + 1) / 2;
5081 for (j = 1; j <=
fNpar; ++j) {
5084 ndex = m*(m-1) / 2 + n;
5085 ndj = j*(j + 1) / 2;
5090 for (it = 1; it <= nparm; ++it) {
5093 Printf(
"%s",(
const char*)ctemp);
5094 if (i <= nparm)
continue;
5096 for (iso = 1; iso <= 10; ++iso) {
5099 for (it = nsofar + 1; it <= nparm; ++it) {
5102 Printf(
"%s",(
const char*)ctemp);
5103 if (i <= nparm)
break;
5122 Double_t gdel, gami, vlen, dsum, gssq, vsum, d;
5123 Double_t fzero, fs, ri, delgam, rhotol;
5125 Int_t npfn, ndex, iext, i, j,
m,
n, npsdf, nparx;
5126 Int_t iswtr, lined2, kk, nfcnmg, nrstrt,
iter;
5130 if (
fNpar <= 0)
return;
5145 rhotol =
fApsi*.001;
5147 Printf(
" START MIGRAD MINIMIZATION. STRATEGY %2d. CONVERGENCE WHEN EDM .LT.%9.2e",
fIstrat,rhotol);
5162 if (
fISW[1] >= 1)
goto L10;
5170 if (
fISW[1] >= 1)
goto L10;
5172 for (i = 1; i <=
fNpar; ++i) {
5179 for (i = 1; i <=
fNpar; ++i) {
5180 if (
fG2[i-1] > 0)
continue;
5186 mnwarn(
"D",
"MNMIGR",
"Negative G2 line search");
5189 Printf(
" Negative G2 line search, param %3d %13.3g%13.3g",iext,fs,
fAmin);
5195 for (i = 1; i <=
fNpar; ++i) {
5197 for (j = 1; j <= i-1; ++j) {
5202 if (
fG2[i-1] <= 0)
fG2[i-1] = 1;
5207 Printf(
" DEBUG MNMIGR, STARTING MATRIX DIAGONAL, VHMAT=");
5208 for (kk = 1; kk <=
Int_t(vlen); ++kk) {
5222 for (i = 1; i <=
fNpar; ++i) {
5226 for (j = 1; j <= i-1; ++j) {
5235 mnwarn(
"W",
"MIGRAD",
"STARTING MATRIX NOT POS-DEFINITE.");
5245 if (iswtr >= 2)
mnmatu(0);
5251 for (i = 1; i <=
fNpar; ++i) {
5254 for (j = 1; j <=
fNpar; ++j) {
5257 ndex = m*(m-1) / 2 + n;
5258 ri +=
fVhmat[ndex-1]*fMIGRgs[j-1];
5264 mnwarn(
"D",
"MIGRAD",
" FIRST DERIVATIVES OF FCN ARE ALL ZERO");
5269 mnwarn(
"D",
"MIGRAD",
" NEWTON STEP NOT DESCENT.");
5270 if (npsdf == 1)
goto L1;
5277 if (
fAmin == fs)
goto L200;
5294 for (i = 1; i <=
fNpar; ++i) {
5297 for (j = 1; j <=
fNpar; ++j) {
5300 ndex = m*(m-1) / 2 + n;
5306 gdgssq += gami*gami;
5308 delgam +=
fDirin[i-1]*gami;
5313 if (
fEDM < 0 || gvg <= 0) {
5314 mnwarn(
"D",
"MIGRAD",
"NOT POS-DEF. EDM OR GVG NEGATIVE.");
5316 if (npsdf == 1)
goto L230;
5323 if (iswtr >= 3 || (iswtr == 2 && iter % 10 == 1)) {
5328 mnwarn(
"D",
"MIGRAD",
"NO CHANGE IN FIRST DERIVATIVES OVER LAST STEP");
5331 mnwarn(
"D",
"MIGRAD",
"FIRST DERIVATIVES INCREASING ALONG SEARCH LINE");
5337 for (kk = 1; kk <= 10; ++kk) {
5343 for (i = 1; i <=
fNpar; ++i) {
5344 for (j = 1; j <= i; ++j) {
5345 if(delgam == 0 || gvg == 0) d = 0;
5348 ndex = i*(i-1) / 2 + j;
5355 if (iswtr >= 3 || ldebug) {
5356 Printf(
" RELATIVE CHANGE IN COV. MATRIX=%5.1f per cent",
fDcovar*100);
5360 for (kk = 1; kk <= 10; ++kk) {
5364 if (delgam <= gvg)
goto L135;
5365 for (i = 1; i <=
fNpar; ++i) {
5368 for (i = 1; i <=
fNpar; ++i) {
5369 for (j = 1; j <= i; ++j) {
5370 ndex = i*(i-1) / 2 + j;
5376 if (
fEDM < rhotol*.1)
goto L300;
5378 for (i = 1; i <=
fNpar; ++i) {
5392 Printf(
" CALL LIMIT EXCEEDED IN MIGRAD.");
5399 Printf(
" MIGRAD FAILS TO FIND IMPROVEMENT");
5402 if (
fEDM < rhotol)
goto L300;
5405 Printf(
" MACHINE ACCURACY LIMITS FURTHER IMPROVEMENT.");
5411 Printf(
" MIGRAD FAILS WITH STRATEGY=0. WILL TRY WITH STRATEGY=1.");
5419 Printf(
" MIGRAD TERMINATED WITHOUT CONVERGENCE.");
5427 Printf(
" MIGRAD MINIMIZATION HAS CONVERGED.");
5432 Printf(
" MIGRAD WILL VERIFY CONVERGENCE AND ERROR MATRIX.");
5437 if (
fEDM > rhotol)
goto L10;
5448 if (iswtr >= 0)
mnprin(3, fAmin);
5449 if (iswtr >= 1)
mnmatu(1);
5464 Int_t nbad, ilax, ilax2, ngood, nfcnmi, iin, knt;
5466 if (
fNpar <= 0)
goto L700;
5471 for (knt = 1; knt <=
fNpar; ++knt) {
5475 if (knt >= 7)
break;
5477 if (ilax == 0)
break;
5478 if (ilax > 0 && ilax <=
fNu) {
5479 if (
fNiofex[ilax-1] > 0)
goto L565;
5481 Printf(
" PARAMETER NUMBER %3d NOT A VARIABLE. IGNORED.",ilax);
5487 mnmnot(ilax, ilax2, val2pl, val2mi);
5491 if (
fErp[iin-1] > 0) ++ngood;
5493 if (
fErn[iin-1] < 0) ++ngood;
5501 if (ngood == 0 && nbad == 0)
goto L700;
5502 if (ngood > 0 && nbad == 0)
fCstatu =
"SUCCESSFUL";
5503 if (ngood == 0 && nbad > 0)
fCstatu =
"FAILURE ";
5504 if (ngood > 0 && nbad > 0)
fCstatu =
"PROBLEMS ";
5514 Printf(
" NEW MINIMUM FOUND. GO BACK TO MINIMIZATION STEP.");
5515 Printf(
" =================================================");
5525 Printf(
" THERE ARE NO MINOS ERRORS TO CALCULATE.");
5543 Double_t abest, xunit, dc, ut, sigsav, du1;
5545 Int_t marc, isig, mpar, ndex, imax, indx, ierr, i, j;
5546 Int_t iercr, it, istrav, nfmxin, nlimit, isw2, isw4;
5560 for (i = 1; i <= mpar; ++i) {
fXt[i-1] =
fX[i-1]; }
5561 i__1 = mpar*(mpar + 1) / 2;
5563 for (i = 1; i <= mpar; ++i) {
5572 if (
fNvarl[ilax-1] == 1) {
5574 fBlim[ilax-1] = ut + fMNOTw[it-1]*100;
5576 ndex = it*(it + 1) / 2;
5579 for (i = 1; i <= mpar; ++i) {
5580 if (i == it)
continue;
5589 Printf(
" MINUIT ERROR. CANNOT FIX PARAMETER %4d INTERNAL %3d",ilax,it);
5595 for (isig = 1; isig <= 2; ++isig) {
5605 Printf(
" DETERMINATION OF %sTIVE MINOS ERROR FOR PARAMETER %d %s"
5606 ,(
const char*)csig,ilax
5607 ,(
const char*)
fCpnam[ilax-1]);
5610 mnwarn(
"D",
"MINOS",
"NO COVARIANCE MATRIX.");
5612 nlimit =
fNfcn + nfmxin;
5615 fU[ilax-1] = ut + sig*du1;
5618 delu =
fU[ilax-1] - ut;
5621 fac = delu /
fMNOTw[it-1];
5622 for (i = 1; i <=
fNpar; ++i) {
5626 Printf(
" PARAMETER %4d SET TO%11.3e + %10.3e = %12.3e",ilax,ut,delu,
fU[ilax-1]);
5637 if (abest -
fAmin >
fUp*.01)
goto L650;
5638 if (iercr == 1)
goto L440;
5639 if (iercr == 2)
goto L450;
5640 if (iercr == 3)
goto L460;
5644 Printf(
" THE %4sTIVE MINOS ERROR OF PARAMETER %3d %10s, IS %12.4e"
5645 ,(
const char*)csig,ilax
5646 ,(
const char*)
fCpnam[ilax-1],eros);
5652 Printf(
" THE %4sTIVE MINOS ERROR OF PARAMETER %3d, %s EXCEEDS ITS LIMIT."
5653 ,(
const char*)csig,ilax
5654 ,(
const char*)
fCpnam[ilax-1]);
5660 Printf(
" THE %4sTIVE MINOS ERROR %4d REQUIRES MORE THAN %5d FUNCTION CALLS."
5661 ,(
const char*)csig,ilax,nfmxin);
5667 Printf(
" %4sTIVE MINOS ERROR NOT CALCULATED FOR PARAMETER %d"
5668 ,(
const char*)csig,ilax);
5674 Printf(
" **************************************************************************");
5678 if (ilax2 > 0 && ilax2 <=
fNu) val2mi =
fU[ilax2-1];
5681 if (ilax2 > 0 && ilax2 <=
fNu) val2pl =
fU[ilax2-1];
5688 i__1 = mpar*(mpar + 1) / 2;
5690 for (i = 1; i <= mpar; ++i) {
5739 Double_t vplu, a_small, gsmin, pinti, vminu, danger, sav, sav2;
5740 Int_t ierr,
kint, in, ix, ktofix, lastin, kinfix, nvl;
5748 Printf(
" MINUIT USER ERROR. PARAMETER NUMBER IS %3d ALLOWED RANGE IS ONE TO %4d",k,fMaxext);
5753 if (
fNvarl[k-1] < 0)
goto L50;
5756 for (ix = 1; ix <=
fNpfix; ++ix) {
5757 if (
fIpfix[ix-1] == k) ktofix = k;
5760 mnwarn(
"W",
"PARAM DEF",
"REDEFINING A FIXED PARAMETER.");
5762 Printf(
" CANNOT RELEASE. MAX NPAR EXCEEDED.");
5773 Printf(
" PARAMETER DEFINITIONS:");
5774 Printf(
" NO. NAME VALUE STEP SIZE LIMITS");
5777 if (wk > 0)
goto L122;
5780 Printf(
" %5d %-10s %13.5e constant",k,(
const char*)cnamk,uk);
5785 if (a == 0 && b == 0) {
5789 Printf(
" %5d %-10s %13.5e%13.5e no limits",k,(
const char*)cnamk,uk,wk);
5796 Printf(
" %5d %-10s %13.5e%13.5e %13.5e%13.5e",k,(
const char*)cnamk,uk,wk,a,b);
5802 Printf(
" MINUIT USER ERROR. TOO MANY VARIABLE PARAMETERS.");
5805 if (nvl == 1)
goto L200;
5807 Printf(
" USER ERROR IN MINUIT PARAMETER");
5809 Printf(
" UPPER AND LOWER LIMITS EQUAL.");
5816 mnwarn(
"W",
"PARAM DEF",
"PARAMETER LIMITS WERE REVERSED.");
5823 danger = (b - uk)*(uk - a);
5825 mnwarn(
"W",
"PARAM DEF",
"STARTING VALUE OUTSIDE LIMITS.");
5828 mnwarn(
"W",
"PARAM DEF",
"STARTING VALUE IS AT LIMIT.");
5846 for (ix = 1; ix <= k-1; ++ix) {
if (
fNiofex[ix-1] > 0) ++lastin; }
5848 if (kint ==
fNpar)
goto L280;
5851 for (in =
fNpar; in >= lastin + 1; --in) {
5865 for (in = lastin + 1; in <=
kint; ++in) {
5888 mnpint(sav, ix-1, pinti);
5890 fXt[in-1] =
fX[in-1];
5893 mnpint(sav2, ix-1, pinti);
5894 vplu = pinti -
fX[in-1];
5896 mnpint(sav2, ix-1, pinti);
5897 vminu = pinti - fX[in-1];
5916 if (kinfix > 0)
mnfixp(kinfix-1, ierr);
5917 if (ierr > 0)
goto L800;
5942 Double_t a=0, b=0, fk=0, uk=0, wk=0, xk=0;
5943 Int_t ierr, kapo1, kapo2;
5944 Int_t k, llist, ibegin, lenbuf, istart, lnc, icy;
5945 TString cnamk, comand, celmnt, ctemp;
5948 lenbuf = strlen((
const char*)crdbuf);
5950 kapo1 = strspn((
const char*)crdbuf,
"'");
5951 if (kapo1 == 0)
goto L150;
5952 kapo2 = strspn((
const char*)crdbuf + kapo1,
"'");
5953 if (kapo2 == 0)
goto L150;
5957 for (istart = 1; istart <= kapo1-1; ++istart) {
5958 if (crdbuf(istart-1,1) !=
' ')
goto L120;
5963 celmnt = crdbuf(istart-1, kapo1-istart);
5964 if (scanf((
const char*)celmnt,&fk)) {;}
5966 if (k <= 0)
goto L210;
5967 cnamk =
"PARAM " + celmnt;
5968 if (kapo2 - kapo1 > 1) {
5969 cnamk = crdbuf(kapo1, kapo2-1-kapo1);
5972 for (icy = kapo2 + 1; icy <= lenbuf; ++icy) {
5973 if (crdbuf(icy-1,1) ==
',')
goto L139;
5974 if (crdbuf(icy-1,1) !=
' ')
goto L140;
5985 ctemp = crdbuf(ibegin-1,lenbuf-ibegin);
5987 if (ierr > 0)
goto L180;
5998 if (scanf((
const char*)crdbuf,&xk,stmp,&uk,&wk,&a,&b)) {;}
6001 if (k == 0)
goto L210;
6004 mnparm(k-1, cnamk, uk, wk, a, b, ierr);
6032 Double_t a,
f, s, t,
y, s2,
x2,
x3,
x4, y2, cz[3], xm,
xy, x2y;
6042 for (i = 1; i <= 3; ++i) { cz[i-1] = 0; }
6044 if (npar2p < 3)
goto L10;
6048 for (i = 1; i <= npar2p; ++i) { xm += parx2p[i]; }
6057 for (i = 1; i <= npar2p; ++i) {
6069 a = (f*x4 - x2*
x2)*x2 - f*(x3*x3);
6070 if (a == 0)
goto L10;
6071 cz[2] = (x2*(f*x2y - x2*
y) - f*x3*xy) /
a;
6072 cz[1] = (xy - x3*cz[2]) / x2;
6073 cz[0] = (y - x2*cz[2]) / f;
6074 if (npar2p == 3)
goto L6;
6075 sdev2p = y2 - (cz[0]*y + cz[1]*xy + cz[2]*x2y);
6076 if (sdev2p < 0) sdev2p = 0;
6079 cz[0] += xm*(xm*cz[2] - cz[1]);
6080 cz[1] -= xm*2*cz[2];
6082 for (i = 1; i <= 3; ++i) { coef2p[i] = cz[i-1]; }
6105 yy = (pexti - alimi)*2 / (blimi - alimi) - 1;
6110 chbuf2 =
" IS AT ITS LOWER ALLOWED LIMIT.";
6113 chbuf2 =
" IS AT ITS UPPER ALLOWED LIMIT.";
6116 pexti = alimi + (blimi - alimi)*.5*(
TMath::Sin(a) + 1);
6118 if (yy2 > 1) chbuf2 =
" BROUGHT BACK INSIDE LIMITS.";
6148 if ((h =
gROOT->GetPluginManager()->FindHandler(
"TMinuitGraph"))) {
6161 Double_t bwidx, bwidy, xbest, ybest, ax, ay, bx, by;
6162 Double_t xvalus[12], any, dxx, dyy;
6163 Int_t iten, i, j, k, maxnx, maxny, iquit, ni, linodd;
6164 Int_t nxbest, nybest, km1, ibk, isp1,
nx,
ny, ks, ix;
6173 if (maxnx < 10) maxnx = 10;
6175 if (maxny < 10) maxny = 10;
6176 if (nxypt <= 1)
return;
6182 for (i = 1; i <= km1; ++i) {
6185 for (j = 1; j <= ni; ++j) {
6186 if (ypt[j-1] > ypt[j])
continue;
6198 if (iquit == 0)
break;
6203 for (i = 1; i <= nxypt; ++i) {
6204 if (xpt[i-1] > xmax) xmax = xpt[i-1];
6205 if (xpt[i-1] < xmin) xmin = xpt[i-1];
6207 dxx = (xmax -
xmin)*.001;
6210 mnbins(xmin, xmax, maxnx, xmin, xmax, nx, bwidx);
6212 ymin = ypt[nxypt-1];
6213 if (ymax == ymin) ymax = ymin + 1;
6214 dyy = (ymax -
ymin)*.001;
6217 mnbins(ymin, ymax, maxny, ymin, ymax, ny, bwidy);
6220 if (chbest ==
' ')
goto L50;
6221 xbest = (xmax +
xmin)*.5;
6222 ybest = (ymax +
ymin)*.5;
6230 for (i = 1; i <= nxypt; ++i) {
6231 xpt[i-1] = ax*xpt[i-1] + bx;
6232 ypt[i-1] = any - ay*ypt[i-1] - by;
6234 nxbest =
Int_t((ax*xbest + bx));
6235 nybest =
Int_t((any - ay*ybest - by));
6242 for (i = 1; i <=
ny; ++i) {
6243 for (ibk = 1; ibk <=
nx; ++ibk) { cline[ibk-1] =
' '; }
6248 if (nx>0) cline[nx-1] =
'.';
6249 cline[nxbest-1] =
'.';
6250 if (i != 1 && i != nybest && i != ny)
goto L320;
6251 for (j = 1; j <=
nx; ++j) { cline[j-1] =
'.'; }
6254 if (isp1 > nxypt)
goto L350;
6256 for (k = isp1; k <= nxypt; ++k) {
6257 ks =
Int_t(ypt[k-1]);
6258 if (ks > i)
goto L345;
6259 ix =
Int_t(xpt[k-1]);
6260 if (cline[ix-1] ==
'.')
goto L340;
6261 if (cline[ix-1] ==
' ')
goto L340;
6262 if (cline[ix-1] == chpt[k-1])
continue;
6269 cline[ix-1] = chpt[k-1];
6276 if (linodd == 1 || i == ny)
goto L380;
6279 Printf(
" %s",(
const char*)ctemp);
6283 Printf(
" %14.7g ..%s",yprt,(
const char*)ctemp);
6289 for (ibk = 1; ibk <=
nx; ++ibk) {
6291 if (ibk % 10 == 1) cline[ibk-1] =
'/';
6295 for (ibk = 1; ibk <= 12; ++ibk) {
6296 xvalus[ibk-1] = xmin +
Double_t(ibk-1)*10*bwidx;
6298 iten = (nx + 9) / 10;
6299 for (ibk = 1; ibk <= iten && ibk <= 12; ++ibk) {
6300 snprintf(cline + (ibk-1)*10, 11-(ibk == 12),
"%#9.3g ", xvalus[ibk-1]);
6304 if (overpr) chmess =
" Overprint character is &";
6305 Printf(
" ONE COLUMN=%13.7g%s",bwidx,(
const char*)chmess);
6328 Int_t iint, iext, nvl;
6330 Int_t iuext = iuext1 + 1;
6334 if (iuext == 0)
goto L100;
6338 if (iint >
fNpar)
goto L100;
6344 if (iext >
fNu)
goto L100;
6350 if (nvl < 0)
goto L100;
6353 if (iint > 0) err =
fWerr[iint-1];
6355 xlolim =
fAlim[iext-1];
6356 xuplim =
fBlim[iext-1];
6362 chnam =
"undefined";
6391 Int_t nadd, i, k,
l,
m, ikode, ic, nc, ntrail, lbl;
6393 TString colhdl[6], colhdu[6], cx2, cx3, cheval;
6396 Printf(
" THERE ARE CURRENTLY NO PARAMETERS DEFINED");
6402 ikode =
fISW[1] + 1;
6403 if (ikode > 3) ikode = 3;
6406 for (k = 1; k <= 6; ++k) {
6407 colhdu[k-1] =
"UNDEFINED";
6408 colhdl[k-1] =
"COLUMN HEAD";
6415 if (fval ==
fUndefi) cheval =
" unknown ";
6416 else cheval.
Form(
"%g",fval);
6422 Printf(
" FCN=%s FROM %8s STATUS=%10s %6d CALLS %9d TOTAL"
6423 ,(
const char*)cheval
6427 if (m == 0 || m == 2 ||
fDcovar == 0) {
6428 Printf(
" EDM=%s STRATEGY=%2d %s"
6434 Printf(
" EDM=%s STRATEGY=%2d ERROR MATRIX UNCERTAINTY %5.1f per cent"
6435 ,(
const char*)chedm,
fIstrat,dc);
6438 if (ikode == 0)
return;
6441 for (i = 1; i <=
fNu; ++i) {
6442 if (
fNvarl[i-1] < 0)
continue;
6443 for (ic = 10; ic >= 1; --ic) {
6444 if (
fCpnam[i-1](ic-1,1) !=
" ")
goto L16;
6449 if (lbl < ntrail) ntrail = lbl;
6451 nadd = ntrail / 2 + 1;
6454 colhdl[0] =
" ERROR ";
6455 colhdu[1] =
" PHYSICAL";
6456 colhdu[2] =
" LIMITS ";
6457 colhdl[1] =
" NEGATIVE ";
6458 colhdl[2] =
" POSITIVE ";
6462 colhdl[0] =
" ERROR ";
6463 colhdu[1] =
" INTERNAL ";
6464 colhdl[1] =
" STEP SIZE ";
6465 colhdu[2] =
" INTERNAL ";
6466 colhdl[2] =
" VALUE ";
6470 colhdl[0] =
" ERROR ";
6471 colhdu[1] =
" STEP ";
6472 colhdl[1] =
" SIZE ";
6473 colhdu[2] =
" FIRST ";
6474 colhdl[2] =
" DERIVATIVE ";
6477 colhdu[0] =
" PARABOLIC ";
6478 colhdl[0] =
" ERROR ";
6479 colhdu[1] =
" MINOS ";
6480 colhdu[2] =
"ERRORS ";
6481 colhdl[1] =
" NEGATIVE ";
6482 colhdl[2] =
" POSITIVE ";
6486 if (
fISW[1] < 3) colhdu[0] =
" APPROXIMATE ";
6487 if (
fISW[1] < 1) colhdu[0] =
" CURRENT GUESS";
6489 Printf(
" EXT PARAMETER %-14s%-14s%-14s",(
const char*)colhdu[0]
6490 ,(
const char*)colhdu[1]
6491 ,(
const char*)colhdu[2]);
6492 Printf(
" NO. NAME VALUE %-14s%-14s%-14s",(
const char*)colhdl[0]
6493 ,(
const char*)colhdl[1]
6494 ,(
const char*)colhdl[2]);
6496 for (i = 1; i <=
fNu; ++i) {
6497 if (
fNvarl[i-1] < 0)
continue;
6499 cnambf = cblank(0,nadd) +
fCpnam[i-1];
6500 if (l == 0)
goto L55;
6503 cx2 =
"PLEASE GET X..";
6504 cx3 =
"PLEASE GET X..";
6507 Printf(
"%4d %-11s%14.5e%14.5e",i,(
const char*)cnambf,
fU[i-1],x1);
6522 cx3 =
"** at limit **";
6527 if (x2 == 0) cx2 =
" ";
6528 if (x2 ==
fUndefi) cx2 =
" at limit ";
6530 if (x3 == 0) cx3 =
" ";
6531 if (x3 ==
fUndefi) cx3 =
" at limit ";
6533 if (cx2 ==
"PLEASE GET X..") cx2.
Form(
"%14.5e",x2);
6534 if (cx3 ==
"PLEASE GET X..") cx3.
Form(
"%14.5e",x3);
6535 Printf(
"%4d %-11s%14.5e%14.5e%-14s%-14s",i
6536 ,(
const char*)cnambf,
fU[i-1],x1
6537 ,(
const char*)cx2,(
const char*)cx3);
6540 if (
fNvarl[i-1] <= 1 || ikode == 3)
continue;
6542 Printf(
" WARNING - - ABOVE PARAMETER IS AT LIMIT.");
6548 colhdu[0] =
" constant ";
6549 if (
fNvarl[i-1] > 0) colhdu[0] =
" fixed ";
6550 if (
fNvarl[i-1] == 4 && ikode == 1) {
6551 Printf(
"%4d %-11s%14.5e%-14s%14.5e%14.5e",i
6552 ,(
const char*)cnambf,
fU[i-1]
6553 ,(
const char*)colhdu[0],
fAlim[i-1],
fBlim[i-1]);
6555 Printf(
"%4d %-11s%14.5e%s",i
6556 ,(
const char*)cnambf,
fU[i-1],(
const char*)colhdu[0]);
6575 Double_t dgmin, padd, pmin, pmax, dg, epspdf, epsmin;
6576 Int_t ndex, i, j, ndexd, ip, ifault;
6583 for (i = 1; i <=
fNpar; ++i) {
6584 ndex = i*(i + 1) / 2;
6585 if (
fVhmat[ndex-1] <= 0) {
6591 dg = epspdf + 1 - dgmin;
6597 for (i = 1; i <=
fNpar; ++i) {
6601 if (
fVhmat[ndexd-1]==0) {
6606 for (j = 1; j <= i; ++j) {
6615 for (ip = 2; ip <=
fNpar; ++ip) {
6621 Printf(
" EIGENVALUES OF SECOND-DERIVATIVE MATRIX:");
6623 for (ip = 1; ip <=
fNpar; ++ip) {
6628 if (pmin > epspdf*pmax)
return;
6630 padd = pmax*.001 - pmin;
6631 for (ip = 1; ip <=
fNpar; ++ip) {
6632 ndex = ip*(ip + 1) / 2;
6633 fVhmat[ndex-1] *= padd + 1;
6636 mnwarn(
"W",
fCfrom,
Form(
"MATRIX FORCED POS-DEF BY ADDING %f TO DIAGONAL.",padd));
6657 for (i = 1; i <=
fNpar; ++i) {
fX[i-1] = pnew[i-1]; }
6665 for (j = 2; j <= nparp1; ++j) {
if (y[j-1] > y[jh-1]) jh = j; }
6666 fEDM = y[jh-1] - y[jl-1];
6667 if (
fEDM <= 0)
goto L45;
6668 for (i = 1; i <=
fNpar; ++i) {
6671 for (j = 2; j <= nparp1; ++j) {
6675 fDirin[i-1] = pbig - plit;
6680 Printf(
" FUNCTION VALUE DOES NOT SEEM TO DEPEND ON ANY OF THE %d VARIABLE PARAMETERS.",
fNpar);
6681 Printf(
" VERIFY THAT STEP SIZES ARE BIG ENOUGH AND CHECK FCN LOGIC.");
6682 Printf(
" *******************************************************************************");
6683 Printf(
" *******************************************************************************");
6700 static Int_t iseed = 12345;
6704 if (val == 3)
goto L100;
6707 iseed = (iseed - k*53668)*40014 - k*12211;
6708 if (iseed < 0) iseed += 2147483563;
6709 val =
Double_t(iseed*4.656613e-10);
6740 for (i = 1; i <=
fNpar; ++i) {
6762 Printf(
"mnsave is dummy in TMinuit");
6777 Double_t step, uhigh, xhreq, xlreq, ubest, fnext, unext, xh, xl;
6779 Int_t nxypt, nccall, iparwd;
6784 if (ncall <= 1) ncall = 41;
6785 if (ncall > 98) ncall = 98;
6791 if (iparwd > 0)
goto L200;
6796 if (ipar >
fNu)
goto L900;
6798 if (iint <= 0)
goto L100;
6810 if (
fNvarl[ipar-1] > 1)
goto L300;
6813 if (xlreq == xhreq)
goto L250;
6815 step = (xhreq - xlreq) /
Double_t(ncall-1);
6818 xl = ubest -
fWerr[iint-1];
6819 xh = ubest + fWerr[iint-1];
6820 mnbins(xl, xh, ncall, unext, uhigh, nbins, step);
6825 if (xlreq == xhreq)
goto L350;
6830 if (xl >= xh)
goto L700;
6832 step = (xh - xl) /
Double_t(ncall-1);
6835 unext =
fAlim[ipar-1];
6839 for (icall = 1; icall <= nccall; ++icall) {
6844 fXpt[nxypt-1] = unext;
6845 fYpt[nxypt-1] = fnext;
6846 fChpt[nxypt-1] =
'*';
6847 if (fnext <
fAmin) {
6860 Printf(
"%dSCAN OF PARAMETER NO. %d, %s"
6865 Printf(
" REQUESTED RANGE OUTSIDE LIMITS FOR PARAMETER %d",ipar);
6867 if (iparwd <= 0)
goto L100;
6888 Double_t dxdi, rnum, ftry, rnum1, rnum2, alpha;
6890 Int_t ipar, iext, j, ifail, iseed=0, nparx, istep, ib, mxfail, mxstep;
6893 if (mxfail <= 0) mxfail =
fNpar*20 + 100;
6897 if (alpha <= 0) alpha = 3;
6899 Printf(
" MNSEEK: MONTE CARLO MINIMIZATION USING METROPOLIS ALGORITHM");
6900 Printf(
" TO STOP AFTER %6d SUCCESSIVE FAILURES, OR %7d STEPS",mxfail,mxstep);
6901 Printf(
" MAXIMUM STEP SIZE IS %9.3f ERROR BARS.",alpha);
6913 for (ipar = 1; ipar <=
fNpar; ++ipar) {
6916 if (
fNvarl[iext-1] > 1) {
6919 if (dxdi == 0) dxdi = 1;
6920 fDirin[ipar-1] = alpha*2*fWerr[ipar-1] / dxdi;
6922 fDirin[ipar-1] = 6.2831859999999997;
6929 for (istep = 1; istep <= mxstep; ++istep) {
6930 if (ifail >= mxfail)
break;
6931 for (ipar = 1; ipar <=
fNpar; ++ipar) {
6961 Printf(
" MNSEEK: %5d SUCCESSIVE UNSUCCESSFUL TRIALS.",ifail);
6985 static const char *cname[30] = {
7017 static Int_t nname = 25;
7018 static Int_t nntot = 30;
7020 "-1: NO OUTPUT EXCEPT FROM SHOW ",
7021 " 0: REDUCED OUTPUT ",
7022 " 1: NORMAL OUTPUT ",
7023 " 2: EXTRA OUTPUT FOR PROBLEM CASES",
7024 " 3: MAXIMUM OUTPUT "};
7027 " 0: MINIMIZE THE NUMBER OF CALLS TO FUNCTION",
7028 " 1: TRY TO BALANCE SPEED AGAINST RELIABILITY",
7029 " 2: MAKE SURE MINIMUM TRUE, ERRORS CORRECT "};
7032 "REPORT ALL EXCEPTIONAL CONDITIONS ",
7033 "MNLINE: LINE SEARCH MINIMIZATION ",
7034 "MNDERI: FIRST DERIVATIVE CALCULATIONS ",
7035 "MNHESS: SECOND DERIVATIVE CALCULATIONS ",
7036 "MNMIGR: COVARIANCE MATRIX UPDATES ",
7037 "MNHES1: FIRST DERIVATIVE UNCERTAINTIES ",
7038 "MNCONT: MNCONTOUR PLOT (MNCROS SEARCH) "};
7045 Int_t iset, iprm, i, jseed, kname, iseed, iunit,
id, ii, kk;
7046 Int_t ikseed, idbopt, igrain=0, iswsav, isw2;
7047 TString cfname, cmode, ckind, cwarn, copt, ctemp, ctemp2;
7050 for (i = 1; i <= nntot; ++i) {
7054 if (strstr(ctemp2.
Data(),ckind.
Data()))
goto L5;
7062 if ( ctemp2.
Contains(
"HEL"))
goto L2000;
7063 if ( ctemp2.
Contains(
"SHO"))
goto L1000;
7064 if (!ctemp2.
Contains(
"SET"))
goto L1900;
7068 if (kname <= 0)
goto L1900;
7070 switch ((
int)kname) {
7088 case 18:
goto L3000;
7090 case 20:
goto L3000;
7095 case 25:
goto L3000;
7096 case 26:
goto L1900;
7106 if (iprm >
fNu)
goto L25;
7107 if (iprm <= 0)
goto L25;
7108 if (
fNvarl[iprm-1] < 0)
goto L25;
7120 Printf(
" UNDEFINED PARAMETER NUMBER. IGNORED.");
7151 for (i = 1; i <=
fNpar; ++i) {
7179 mnwarn(
"W",
"SHO",
"SHO");
7187 Printf(
" MINUIT RANDOM NUMBER SEED SET TO %d",jseed);
7199 if (
fISW[4] > 0)
goto L1172;
7217 if (
fISW[4] >= 0)
goto L1220;
7222 if (
fISW[4] >= 0)
goto L1100;
7227 if (
fISW[4] >= 0)
goto L1100;
7238 if (idbopt > 6)
goto L288;
7240 fIdbg[idbopt] = iset;
7241 if (iset == 1)
fIdbg[0] = 1;
7244 for (
id = 0;
id <= 6; ++
id) {
fIdbg[
id] = iset; }
7247 mnwarn(
"D",
"SHO",
"SHO");
7250 Printf(
" UNKNOWN DEBUG OPTION %d REQUESTED. IGNORED",idbopt);
7261 if (kname <= 0)
goto L1900;
7263 switch ((
int)kname) {
7273 case 10:
goto L1100;
7274 case 11:
goto L1110;
7275 case 12:
goto L1120;
7276 case 13:
goto L1130;
7277 case 14:
goto L1130;
7278 case 15:
goto L1150;
7279 case 16:
goto L1160;
7280 case 17:
goto L1170;
7281 case 18:
goto L1180;
7282 case 19:
goto L1190;
7283 case 20:
goto L1200;
7284 case 21:
goto L1210;
7285 case 22:
goto L1220;
7286 case 23:
goto L1100;
7287 case 24:
goto L1100;
7288 case 25:
goto L1250;
7289 case 26:
goto L1900;
7290 case 27:
goto L1270;
7291 case 28:
goto L1270;
7292 case 29:
goto L1290;
7293 case 30:
goto L1300;
7323 Printf(
" ALLOWED PRINT LEVELS ARE:");
7329 Printf(
" CURRENT PRINTOUT LEVEL IS %s",cprlev[
fISW[4]+1].
Data());
7334 Printf(
" NOGRAD IS SET. DERIVATIVES NOT COMPUTED IN FCN.");
7336 Printf(
" GRAD IS SET. USER COMPUTES DERIVATIVES IN FCN.");
7341 Printf(
" ERRORS CORRESPOND TO FUNCTION CHANGE OF %g",
fUp);
7365 cmode =
"BATCH MODE ";
7366 if (
fISW[5] == 1) cmode =
"INTERACTIVE MODE";
7367 if (! lname) cfname =
"unknown";
7368 Printf(
" INPUT NOW BEING READ IN %s FROM UNIT NO. %d FILENAME: %s"
7369 ,(
const char*)cmode,
fIsysrd,(
const char*)cfname);
7381 cwarn =
"SUPPRESSED";
7382 if (
fLwarn) cwarn =
"REPORTED ";
7383 Printf(
"%s",(
const char*)cwarn);
7391 Printf(
" MINUIT RNDM SEED IS CURRENTLY=%d",ikseed);
7398 Printf(
" TITLE OF CURRENT TASK IS:%s",(
const char*)
fCtitl);
7402 Printf(
" ALLOWED STRATEGIES ARE:");
7407 Printf(
" NOW USING STRATEGY %s",(
const char*)cstrat[
fIstrat]);
7424 Printf(
" NO PAGE THROWS IN MINUIT OUTPUT");
7429 for (ii = 1; ii <=
fNpar; ++ii) {
7430 if (
fErp[ii-1] > 0 ||
fErn[ii-1] < 0)
goto L1204;
7432 Printf(
" THERE ARE NO MINOS ERRORS CURRENTLY VALID.");
7439 Printf(
" FLOATING-POINT NUMBERS ASSUMED ACCURATE TO %g",
fEpsmac);
7447 Printf(
" THIS IS MINUIT VERSION:%s",(
const char*)
fCvrsn);
7451 for (
id = 0;
id <= 6; ++
id) {
7453 if (
fIdbg[
id] >= 1) copt =
"ON ";
7454 Printf(
" DEBUG OPTION %3d IS %3s :%s"
7455 ,
id,(
const char*)copt,(
const char*)cdbopt[
id]);
7470 Printf(
" THE COMMAND:%10s IS UNKNOWN.",(
const char*)
fCword);
7477 if (strcmp(ctemp2.
Data(),
"SHO")) ckind =
"SHOW";
7479 Printf(
" THE FORMAT OF THE %4s COMMAND IS:",(
const char*)ckind);
7480 Printf(
" %s xxx [numerical arguments if any]",(
const char*)ckind);
7481 Printf(
" WHERE xxx MAY BE ONE OF THE FOLLOWING:");
7482 for (kk = 1; kk <= nname; ++kk) {
7483 Printf(
" %s",cname[kk-1]);
7489 Printf(
" ABOVE COMMAND IS ILLEGAL. IGNORED");
7511 Double_t dmin_, dxdi, yrho,
f, ynpp1, aming, ypbar;
7512 Double_t bestx, ystar, y1, y2, ystst, pb, wg;
7513 Double_t absmin, rho, sig2, rho1, rho2;
7514 Int_t npfn, i, j, k, jhold, ncycl, nparx;
7515 Int_t nparp1, kg, jh, nf, jl, ns;
7517 if (
fNpar <= 0)
return;
7526 rho2 = rho1 + alpha*
gamma;
7529 Printf(
" START SIMPLEX MINIMIZATION. CONVERGENCE WHEN EDM .LT. %g",
fEpsi);
7531 for (i = 1; i <=
fNpar; ++i) {
7544 for (i = 1; i <=
fNpar; ++i) {
7555 if (f <= aming)
goto L6;
7557 if (kg == 1)
goto L8;
7561 if (nf < 3)
goto L4;
7571 if (ns < 6)
goto L4;
7575 if (aming < absmin) jl = i;
7576 if (aming < absmin) absmin = aming;
7596 for (i = 1; i <=
fNpar; ++i) {
7604 if (ystar >=
fAmin)
goto L70;
7606 for (i = 1; i <=
fNpar; ++i) {
7612 y1 = (ystar -
fSIMPy[jh-1])*rho2;
7613 y2 = (ystst -
fSIMPy[jh-1])*rho1;
7614 rho = (rho2*y1 - rho1*y2)*.5 / (y1 - y2);
7615 if (rho < rhomin)
goto L66;
7616 if (rho > rhomax) rho = rhomax;
7617 for (i = 1; i <=
fNpar; ++i) {
7622 if (yrho <
fSIMPy[jl-1] && yrho < ystst)
goto L65;
7623 if (ystst <
fSIMPy[jl-1])
goto L67;
7624 if (yrho >
fSIMPy[jl-1])
goto L66;
7630 if (ystst <
fSIMPy[jl-1])
goto L67;
7637 if (
fISW[4] < 2)
goto L50;
7638 if (
fISW[4] >= 3 || ncycl % 10 == 0) {
7644 if (ystar >=
fSIMPy[jh-1])
goto L73;
7647 if (jhold != jh)
goto L50;
7650 for (i = 1; i <=
fNpar; ++i) {
7655 if (ystst >
fSIMPy[jh-1])
goto L1;
7657 if (ystst <
fAmin)
goto L67;
7663 Printf(
" SIMPLEX MINIMIZATION HAS CONVERGED.");
7669 Printf(
" SIMPLEX TERMINATES WITHOUT CONVERGENCE.");
7675 for (i = 1; i <=
fNpar; ++i) {
7745 static TString cpt =
" ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890./;:[]$%*_!@#&+()";
7748 l = strlen((
const char*)cfname);
7749 for (i = 1; i <=
l; ++i) {
7750 for (ic = 1; ic <= 80; ++ic) {
7751 if (cfname[i-1] == cpt[ic-1])
goto L100;
7775 Int_t i, j, k, kp1, km1;
7783 if (n < 1)
goto L100;
7786 for (i = 1; i <=
n; ++i) {
7788 if (si <= 0)
goto L100;
7791 for (i = 1; i <=
n; ++i) {
7792 for (j = 1; j <=
n; ++j) {
7797 for (i = 1; i <=
n; ++i) {
7800 if (a[k + k*l] != 0)
fVERTq[k-1] = 1 / a[k + k*
l];
7806 if (km1 < 0)
goto L100;
7807 else if (km1 == 0)
goto L50;
7810 for (j = 1; j <= km1; ++j) {
7816 if (k - n < 0)
goto L51;
7817 else if (k - n == 0)
goto L60;
7820 for (j = kp1; j <=
n; ++j) {
7827 for (j = 1; j <=
n; ++j) {
7832 for (j = 1; j <=
n; ++j) {
7833 for (k = 1; k <= j; ++k) {
7835 a[j + k*
l] = a[k + j*
l];
7863 const Int_t kMAXMES = 10;
7864 Int_t ityp, i, ic, nm;
7867 if (corg(0,3) !=
"SHO" || cmes(0,3) !=
"SHO") {
7873 Printf(
" MINUIT WARNING IN %s",(
const char*)corg);
7874 Printf(
" ============== %s",(
const char*)cmes);
7880 Printf(
" MINUIT DEBUG FOR %s",(
const char*)corg);
7881 Printf(
" =============== %s ",(
const char*)cmes);
7906 englsh =
" WAS SUPPRESSED. ";
7907 if (
fNwrmes[ityp-1] > 1) englsh =
"S WERE SUPPRESSED.";
7909 ,(
const char*)ctyp,(
const char*)englsh);
7913 Printf(
" ONLY THE MOST RECENT 10 WILL BE LISTED BELOW.");
7917 Printf(
" CALLS ORIGIN MESSAGE");
7918 for (i = 1; i <= nm; ++i) {
7920 if (ic > kMAXMES) ic = 1;
7937 Double_t denom, ba, al, dx, du1, du2;
7938 Int_t ndex, ierr, i, j, k,
l, ndiag, k1, iin;
7942 for (l = 1; l <=
fNpar; ++
l) {
7943 ndex = l*(l + 1) / 2;
7948 ba =
fBlim[i-1] - al;
7951 if (dx > 1) du1 = ba;
7959 for (i = 1; i <=
fNpar; ++i) {
7962 for (j = 1; j <= i; ++j) {
7970 for (iin = 1; iin <=
fNpar; ++iin) {
7971 ndiag = iin*(iin + 1) / 2;
7973 if (denom <= 1 && denom >= 0)
fGlobcc[iin-1] = 0;
virtual void mnmnos()
*-*-*-*-*-*-*-*-*-*-*Performs a MINOS error analysis*-*-*-*-*-*-*-*-*-*-*-* *-* =====================...
virtual void mnsimp()
*-*-*-*-*Minimization using the simplex method of Nelder and Mead*-*-*-*-* *-* ======================...
virtual Int_t GetNumFreePars() const
returns the number of currently free parameters
virtual void mnstat(Double_t &fmin, Double_t &fedm, Double_t &errdef, Int_t &npari, Int_t &nparx, Int_t &istat)
*-*-*-*-*Returns concerning the current status of the minimization*-*-*-*-* *-* =====================...
double dist(Rotation3D const &r1, Rotation3D const &r2)
virtual void mneval(Double_t anext, Double_t &fnext, Int_t &ierev)
*-*-*-*-*-*-*Evaluates the function being analyzed by MNCROS*-*-*-*-*-*-*-* *-* =====================...
virtual void mnprin(Int_t inkode, Double_t fval)
*-*-*-*Prints the values of the parameters at the time of the call*-*-*-*-* *-* =====================...
virtual Int_t SetPrintLevel(Int_t printLevel=0)
set Minuit print level printlevel = -1 quiet (also suppresse all warnings) = 0 normal = 1 verbose ...
virtual void mnexin(Double_t *pint)
*-*-*-*-*Transforms the external parameter values U to internal values*-*-* *-* =====================...
virtual void mnhes1()
*-*-*-*Calculate first derivatives (GRD) and uncertainties (DGRD)*-*-*-*-*-* *-* ====================...
virtual void mnvert(Double_t *a, Int_t l, Int_t m, Int_t n, Int_t &ifail)
*-*-*-*-*-*-*-*-*-*-*-*Inverts a symmetric matrix*-*-*-*-*-*-*-*-*-*-*-*-* *-* ======================...
Implementation in C++ of the Minuit package written by F.
ClassImp(TSeqCollection) Int_t TSeqCollection TIter next(this)
Return index of object in collection.
virtual void mnemat(Double_t *emat, Int_t ndim)
Calculates the external error matrix from the internal matrix.
void(* fFCN)(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag)
virtual void mnwarn(const char *copt, const char *corg, const char *cmes)
*-*-*-*-*-*-*-*-*-*-*-*Prints Warning messages*-*-*-*-*-*-*-*-*-*-*-*-*-* *-* =======================...
virtual void mnline(Double_t *start, Double_t fstart, Double_t *step, Double_t slope, Double_t toler)
*-*-*-*-*-*-*-*-*-*Perform a line search from position START*-*-*-*-*-*-*-* *-* =====================...
void ToUpper()
Change string to upper case.
virtual void mnseek()
*-*-*-*Performs a rough (but global) minimization by monte carlo search*-* *-* ======================...
Int_t LoadPlugin()
Load the plugin library for this handler.
Short_t Min(Short_t a, Short_t b)
R__EXTERN TVirtualMutex * gROOTMutex
virtual void mnderi()
*-*-*-*-*-*-*-*Calculates the first derivatives of FCN (GRD)*-*-*-*-*-*-*-* *-* =====================...
virtual void mncros(Double_t &aopt, Int_t &iercr)
*-*-*-*-*-*-*-*-*-*-*Find point where MNEVAL=AMIN+UP*-*-*-*-*-*-*-*-*-*-*-* *-* =====================...
virtual void mngrad()
*-*-*-*-*-*-*-*-*-*Interprets the SET GRAD command*-*-*-*-*-*-*-*-*-*-*-*-* *-* =====================...
virtual void mnbins(Double_t a1, Double_t a2, Int_t naa, Double_t &bl, Double_t &bh, Int_t &nb, Double_t &bwid)
*-*-*-*-*-*-*-*-*-*-*Compute reasonable histogram intervals*-*-*-*-*-*-*-*-* *-* ====================...
virtual void mnrset(Int_t iopt)
*-*-*-*-*-*-*-*Resets function value and errors to UNDEFINED*-*-*-*-*-*-*-* *-* =====================...
Long_t ExecPlugin(int nargs, const T &...params)
virtual void mntiny(volatile Double_t epsp1, Double_t &epsbak)
*-*-*-*-*-*-*-*To find the machine precision*-*-*-*-*-*-*-*-*-*-*-*-*-*-* *-* =======================...
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
double beta(double x, double y)
Calculates the beta function.
virtual Int_t GetNumPars() const
returns the total number of parameters that have been defined as fixed or free.
TString fOrigin[kMAXWARN]
virtual Int_t FixParameter(Int_t parNo)
fix a parameter
virtual Int_t Eval(Int_t npar, Double_t *grad, Double_t &fval, Double_t *par, Int_t flag)
Evaluate the minimisation function Input parameters: npar: number of currently variable parameters pa...
virtual void mneig(Double_t *a, Int_t ndima, Int_t n, Int_t mits, Double_t *work, Double_t precis, Int_t &ifault)
*-*-*-*-*-*-*-*-*-*-*-*Compute matrix eigen values*-*-*-*-*-*-*-*-*-*-*-*-* *-* =====================...
void SetParamPtrs(void *paramArr, Int_t nparam=-1)
ParamArr is an array containing the function argument values.
const char * Data() const
virtual void mnmigr()
*-*-*-*-*-*-*-*-*Performs a local function minimization*-*-*-*-*-*-*-*-*-* *-* ======================...
virtual void SetFCN(void *fcn)
*-*-*-*-*-*-*To set the address of the minimization function*-*-*-*-*-*-*-* *-* =====================...
virtual void mnfree(Int_t k)
*-*-*-*Restores one or more fixed parameter(s) to variable status*-*-*-*-*-* *-* ====================...
static const double x2[5]
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
The TNamed class is the base class for all named ROOT classes.
virtual void mncrck(TString crdbuf, Int_t maxcwd, TString &comand, Int_t &lnc, Int_t mxp, Double_t *plist, Int_t &llist, Int_t &ierr, Int_t isyswr)
*-*-*-*-*-*-*-*-*-*-*-*Cracks the free-format input*-*-*-*-*-*-*-*-*-*-*-*-* *-* ====================...
UChar_t mod R__LOCKGUARD2(gSrvAuthenticateMutex)
ClassImp(TMinuit) TMinuit
*-*-*-*-*-*-*-*-*-*-*Minuit normal constructor*-*-*-*-*-*-*-*-*-*-*-*-*-*-* *-* =====================...
virtual void mnrn15(Double_t &val, Int_t &inseed)
*-*-*-*-*-*-*This is a super-portable random number generator*-*-*-*-*-*-* *-* ======================...
std::map< std::string, std::string >::const_iterator iter
virtual TObject * Contour(Int_t npoints=10, Int_t pa1=0, Int_t pa2=1)
Creates a TGraph object describing the n-sigma contour of a TMinuit fit.
Double_t Log10(Double_t x)
virtual ~TMinuit()
*-*-*-*-*-*-*-*-*-*-*Minuit default destructor*-*-*-*-*-*-*-*-*-*-*-*-*-*-* *-* =====================...
static const double x4[22]
static Vc_ALWAYS_INLINE Vector< T > abs(const Vector< T > &x)
virtual void DeleteArrays()
*-*-*-*-*-*-*-*-*-*-*-*Delete internal Minuit arrays*-*-*-*-*-*-*-*-* *-* ===========================...
std::vector< std::vector< double > > Data
virtual void mncuve()
*-*-*-*-*-*-*-*Makes sure that the current point is a local minimum*-*-*-*-* *-* ====================...
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
virtual void BuildArrays(Int_t maxpar=15)
*-*-*-*-*-*-*Create internal Minuit arrays for the maxpar parameters*-*-*-* *-* =====================...
Method or function calling interface.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void mnmnot(Int_t ilax, Int_t ilax2, Double_t &val2pl, Double_t &val2mi)
*-*-*-*-*-*Performs a MINOS error analysis on one parameter*-*-*-*-*-*-*-*-* *-* ====================...
virtual Int_t DefineParameter(Int_t parNo, const char *name, Double_t initVal, Double_t initErr, Double_t lowerLimit, Double_t upperLimit)
Define a parameter.
virtual void mncont(Int_t ke1, Int_t ke2, Int_t nptu, Double_t *xptu, Double_t *yptu, Int_t &ierrf)
*-*-*-*-*-*-*Find points along a contour where FCN is minimum*-*-*-*-*-*-* *-* ======================...
TString * fCpnam
Character to be plotted at the X,Y contour positions.
virtual void mncler()
*-*-*-*-*-*-*-*-*-*-*Resets the parameter list to UNDEFINED*-*-*-*-*-*-*-* *-* ======================...
virtual void mnparm(Int_t k, TString cnamj, Double_t uk, Double_t wk, Double_t a, Double_t b, Int_t &ierflg)
*-*-*-*-*-*-*-*-*Implements one parameter definition*-*-*-*-*-*-*-*-*-*-*-* *-* =====================...
virtual Int_t GetParameter(Int_t parNo, Double_t ¤tValue, Double_t ¤tError) const
return parameter value and error
virtual void mnfixp(Int_t iint, Int_t &ierr)
*-*-*-*-*-*-*Removes parameter IINT from the internal parameter list*-*-* *-* =======================...
virtual void mncalf(Double_t *pvec, Double_t &ycalf)
*-*-*-*-*-*-*-*-*-*Transform FCN to find further minima*-*-*-*-*-*-*-*-*-* *-* ======================...
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
char * Form(const char *fmt,...)
virtual Int_t SetErrorDef(Double_t up)
To get the n-sigma contour the error def parameter "up" has to set to n^2.
TMethodCall * GetMethodCall() const
TMethodCall * fMethodCall
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
virtual void mnerrs(Int_t number, Double_t &eplus, Double_t &eminus, Double_t &eparab, Double_t &gcc)
*-*-*-*-*-*-*-*-*-*Utility routine to get MINOS errors*-*-*-*-*-*-*-*-*-*-* *-* =====================...
virtual void mnhess()
*-*-*-*-*-*Calculates the full second-derivative matrix of FCN*-*-*-*-*-*-*-* *-* ===================...
void InitWithPrototype(TClass *cl, const char *method, const char *proto, Bool_t objectIsConst=kFALSE, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch)
Initialize the method invocation environment.
virtual Int_t GetNumFixedPars() const
returns the number of currently fixed parameters
virtual void mnpsdf()
*-*-*-*-*-*Calculates the eigenvalues of v to see if positive-def*-*-*-*-* *-* ======================...
virtual void mndxdi(Double_t pint, Int_t ipar, Double_t &dxdi)
*-*-*-*Calculates the transformation factor between ext/internal values*-* *-* ======================...
virtual void mnamin()
*-*-*-*-*-*-*-*-*-*-*-*-*Initialize AMIN*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* *-* =============== *-*C Ca...
static const double x1[5]
virtual void mnscan()
*-*-*-*-*Scans the values of FCN as a function of one parameter*-*-*-*-*-* *-* ======================...
TString fWarmes[kMAXWARN]
virtual void mnhelp(TString comd)
*-*-*-*-*-*-*-*HELP routine for MINUIT interactive commands*-*-*-*-*-*-*-*-* *-* ====================...
void InteractiveFCNm(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag)
*-*-*-*-*-*-*Static function called when SetFCN is called in interactive mode *-* ===================...
virtual Int_t Release(Int_t parNo)
release a parameter
virtual void mnpfit(Double_t *parx2p, Double_t *pary2p, Int_t npar2p, Double_t *coef2p, Double_t &sdev2p)
*-*-*-*-*-*-*-*-*-*To fit a parabola to npar2p points*-*-*-*-*-*-*-*-*-*-* *-* ======================...
virtual void mnlims()
*-*-*-*Interprets the SET LIM command, to reset the parameter limits*-*-*-* *-* =====================...
virtual void mnexcm(const char *comand, Double_t *plist, Int_t llist, Int_t &ierflg)
*-*-*-*-*-*Interprets a command and takes appropriate action*-*-*-*-*-*-*-* *-* =====================...
virtual void mncntr(Int_t ke1, Int_t ke2, Int_t &ierrf)
*-*-*-*-*Print function contours in two variables, on line printer*-*-*-*-* *-* =====================...
virtual void SetMaxIterations(Int_t maxiter=500)
virtual void mncomd(const char *crdbin, Int_t &icondn)
*-*-*-*-*-*-*-*-*-*-*Reads a command string and executes*-*-*-*-*-*-*-*-*-* *-* =====================...
virtual Int_t Command(const char *command)
execute a Minuit command Equivalent to MNEXCM except that the command is given as a character string...
virtual void mninit(Int_t i1, Int_t i2, Int_t i3)
*-*-*-*-*-*Main initialization member function for MINUIT*-*-*-*-*-*-*-*-* *-* ======================...
Mother of all ROOT objects.
virtual Int_t Migrad()
invokes the MIGRAD minimizer
virtual void mnpars(TString &crdbuf, Int_t &icondn)
*-*-*-*-*-*-*-*Implements one parameter definition*-*-*-*-*-*-*-*-*-*-*-*-* *-* =========== =========...
virtual void mnplot(Double_t *xpt, Double_t *ypt, char *chpt, Int_t nxypt, Int_t npagwd, Int_t npagln)
*-*-*-*Plots points in array xypt onto one page with labelled axes*-*-*-*-* *-* =====================...
virtual void mnpint(Double_t &pexti, Int_t i, Double_t &pinti)
*-*-*-*-*-*-*Calculates the internal parameter value PINTI*-*-*-*-*-*-*-* *-* =======================...
virtual void mnsave()
*-*-*-*Writes current parameter values and step sizes onto file ISYSSA*-*-* *-* =====================...
virtual void mninex(Double_t *pint)
*-*-*-*-*Transforms from internal coordinates (PINT) to external (U)*-*-*-* *-* =====================...
double f2(const double *x)
void Execute(const char *, const char *, int *=0)
Execute method on this object with the given parameter string, e.g.
Short_t Max(Short_t a, Short_t b)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
virtual void mnmatu(Int_t kode)
*-*-*-*-*-*-*-*Prints the covariance matrix v when KODE=1*-*-*-*-*-*-*-*-* *-* ======================...
virtual void mnset()
*-*-*-*-*Interprets the commands that start with SET and SHOW*-*-*-*-*-*-* *-* ======================...
ClassImp(TSlaveInfo) Int_t TSlaveInfo const TSlaveInfo * si
Used to sort slaveinfos by ordinal.
Bool_t mnunpt(TString &cfname)
*-*-*-*-*-*Returns .TRUE.
virtual void mnrazz(Double_t ynew, Double_t *pnew, Double_t *y, Int_t &jh, Int_t &jl)
*-*-*-*-*Called only by MNSIMP (and MNIMPR) to add a new point*-*-*-*-*-*-* *-* =====================...
virtual const char * Getp2f2funcname(void *) const
Double_t Sqrt(Double_t x)
R__EXTERN TInterpreter * gCling
virtual void mnpout(Int_t iuext, TString &chnam, Double_t &val, Double_t &err, Double_t &xlolim, Double_t &xuplim, Int_t &iuint) const
*-*-*-*Provides the user with information concerning the current status*-*-* *-* ====================...
virtual void mnimpr()
*-*-*-*-*-*-*Attempts to improve on a good local minimum*-*-*-*-*-*-*-*-*-* *-* =====================...
void Resize(Ssiz_t n)
Resize the string. Truncate or add blanks as necessary.
static const double x3[11]
virtual void mnwerr()
*-*-*-*-*-*-*-*Calculates the WERR, external parameter errors*-*-*-*-*-*-* *-* ======================...
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.