338static const char charal[29] =
" .ABCDEFGHIJKLMNOPQRSTUVWXYZ";
453 gROOT->GetListOfSpecials()->Add(
this);
480 gROOT->GetListOfSpecials()->Add(
this);
490 Error(
"TMinuit",
"can not copy construct TMinuit");
503 if (
gROOT != 0 &&
gROOT->GetListOfSpecials() != 0)
gROOT->GetListOfSpecials()->Remove(
this);
585 for (
int i = 0; i <
fMaxpar; i++) {
662 mncont(pa1,pa2,npoints,xcoor,ycoor,npfound);
665 Warning(
"Contour",
"Cannot find more than 4 points, no TGraph returned");
666 fStatus= (npfound==0 ? 1 : npfound);
671 if (npfound!=npoints) {
673 Warning(
"Contour",
"Returning a TGraph with %d points only",npfound);
678 xcoor[npoints] = xcoor[0];
679 ycoor[npoints] = ycoor[0];
682 if ((
h =
gROOT->GetPluginManager()->FindHandler(
"TMinuitGraph"))) {
683 if (
h->LoadPlugin() != -1)
684 gr = (
TObject*)
h->ExecPlugin(3,npoints+1,xcoor,ycoor);
699 mnparm( parNo, sname, initVal, initErr, lowerLimit, upperLimit, err);
819 if (
fFCN) (*fFCN)(npar,grad,fval,par,flag);
832 mnexcm(
"FIX", tmp, 1, err );
846 mnpout( parNo,
name, currentValue, currentError, bnd1, bnd2, err );
885 mnexcm(
"MIGRAD", tmp, 0, err );
899 mnexcm(
"RELEASE", tmp, 1, err );
911 mnexcm(
"SET ERRDEF", &up, 1, err );
938 m->SetParamPtrs(args);
957 mnexcm(
"SET PRINT", tmp, 1, err );
959 if (printLevel <=-1)
mnexcm(
"SET NOWarnings",tmp,0,err);
979 Printf(
" FIRST CALL TO USER FUNCTION AT NEW START POINT, WITH IFLAG=4.");
1000 Int_t kwid, lwid, na=0, log_;
1004 if (al ==
ah)
ah = al + 1;
1007 if (naa == -1)
goto L150;
1016 if (awid <= 1) --log_;
1019 if (sigfig > 2)
goto L40;
1023 if (sigfig > 2.5)
goto L50;
1027 if (sigfig > 5)
goto L60;
1038 if (bwid <= 0)
goto L10;
1042 if (alb < 0) --lwid;
1044 alb =
ah / bwid + 1;
1046 if (alb < 0) --kwid;
1049 if (naa > 5)
goto L240;
1050 if (naa == -1)
return;
1052 if (naa > 1 || nb == 1)
return;
1057 if (nb << 1 != naa)
return;
1072 Int_t ndex, i, j,
m,
n, nparx;
1078 for (i = 1; i <=
fNpar; ++i) {
1080 for (j = 1; j <=
fNpar; ++j) {
1083 ndex =
m*(
m-1) / 2 +
n;
1088 for (i = 1; i <=
fNpar; ++i) {denom +=
fGrd[i-1]*(
fXt[i-1] - pvec[i-1]); }
1094 ycalf = (
f -
fApsi) / denom;
1112 for (i = 1; i <=
fMaxext; ++i) {
1133 static const char *
const clabel =
"0123456789ABCDEFGHIJ";
1137 Double_t fcna[115], fcnb[115], contur[20];
1138 Double_t ylabel, fmn, fmx, xlo, ylo, xup, yup;
1139 Double_t devs, xsav, ysav, bwidx, bwidy, unext, ff, xb4;
1140 Int_t i, ngrid, ixmid, nparx, ix, nx, ny, ki1, ki2, ixzero, iy, ics;
1145 if (ke1 <= 0 || ke2 <= 0)
goto L1350;
1146 if (ke1 >
fNu || ke2 >
fNu)
goto L1350;
1149 if (ki1 <= 0 || ki2 <= 0)
goto L1350;
1150 if (ki1 == ki2)
goto L1350;
1160 if (devs <= 0) devs = 2;
1161 xlo =
fU[ke1-1] - devs*
fWerr[ki1-1];
1162 xup =
fU[ke1-1] + devs*
fWerr[ki1-1];
1163 ylo =
fU[ke2-1] - devs*
fWerr[ki2-1];
1164 yup =
fU[ke2-1] + devs*
fWerr[ki2-1];
1176 if (nx < 11) nx = 11;
1177 if (ny < 11) ny = 11;
1178 if (nx >= 115) nx = 114;
1189 bwidx = (xup - xlo) /
Double_t(nx);
1190 bwidy = (yup - ylo) /
Double_t(ny);
1191 ixmid =
Int_t(((xsav - xlo)*
Double_t(nx) / (xup - xlo)) + 1);
1192 if (ixmid < 1) ixmid = 1;
1195 for (i = 1; i <= 20; ++i) { contur[i-1] =
fAmin +
fUp*(i-1)*(i-1); }
1196 contur[0] +=
fUp*.01;
1205 for (ix = 1; ix <= nx + 1; ++ix) {
1209 if (xb4 < 0 &&
fU[ke1-1] > 0) ixzero = ix - 1;
1214 Printf(
" Y-AXIS: PARAMETER %3d: %s",ke2,(
const char*)
fCpnam[ke2-1]);
1216 chzero[ixzero-1] =
'+';
1221 for (iy = 1; iy <= ny; ++iy) {
1222 unext =
fU[ke2-1] - bwidy;
1227 chln[ixmid-1] =
'*';
1228 if (ixzero != 0) chln[ixzero-1] =
':';
1229 if (
fU[ke2-1] > ysav && unext < ysav) chln = chmid;
1230 if (
fU[ke2-1] > 0 && unext < 0) chln = chzero;
1232 ylabel =
fU[ke2-1] + bwidy*.5;
1234 for (ix = 1; ix <= nx + 1; ++ix) {
1235 fcna[ix-1] = fcnb[ix-1];
1241 for (ix = 1; ix <= nx; ++ix) {
1248 for (ics = 1; ics <= 20; ++ics) {
1249 if (contur[ics-1] > fmn)
goto L240;
1253 if (contur[ics-1] < fmx) chln[ix-1] = clabel[ics-1];
1256 Printf(
" %12.4g %s",ylabel,(
const char*)chln);
1261 chln(ixmid-1,1) =
'I';
1263 Printf(
" %s",(
const char*)chln);
1268 Printf(
" %12.4g%s%12.4g",xlo,(
const char*)chln,xup);
1269 Printf(
" %s%12.4g",(
const char*)chln,xsav);
1271 Printf(
" %12.4g%s%12.4g%s%12.4g",xlo,(
const char*)chln,xsav,(
const char*)chln,xup);
1273 Printf(
" X-AXIS: PARAMETER %3d %s ONE COLUMN=%12.4g"
1274 ,ke1,(
const char*)
fCpnam[ke1-1],bwidx);
1282 Printf(
" INVALID PARAMETER NUMBER(S) REQUESTED. IGNORED.");
1312 Int_t ierr, ipos, i, llist, lenbuf, lnc;
1314 TString comand, crdbuf, ctemp;
1318 lenbuf = crdbuf.
Length();
1323 for (i = 1; i <=
TMath::Min(20,lenbuf); ++i) {
1324 if (crdbuf[i-1] ==
'\'')
break;
1325 if (crdbuf[i-1] ==
' ') {
1333 if (ipos > lenbuf) {
1334 Printf(
" BLANK COMMAND IGNORED.");
1340 if (crdbuf(ipos-1,3) ==
"PAR") {
1346 if (crdbuf(ipos-1,3) ==
"SET INP") {
1352 if (crdbuf(ipos-1,7) ==
"SET TIT") {
1358 if (crdbuf(ipos-1,7) ==
"SET COV") {
1364 ctemp = crdbuf(ipos-1,lenbuf-ipos+1);
1367 Printf(
" COMMAND CANNOT BE INTERPRETED");
1401 Double_t dist, xdir, ydir, aopt, u1min, u2min;
1403 Double_t a1, a2, val2mi, val2pl, dc, sclfac, bigdis, sigsav;
1404 Int_t nall, iold,
line, mpar, ierr, inew, move, next, i, j, nfcol, iercr;
1405 Int_t idist=0, npcol, kints, i2, i1, lr, nfcnco=0, ki1, ki2, ki3, ke3;
1406 Int_t nowpts, istrav, nfmxin, isw2, isw4;
1412 ldebug =
fIdbg[6] >= 1;
1413 if (ke1 <= 0 || ke2 <= 0)
goto L1350;
1414 if (ke1 >
fNu || ke2 >
fNu)
goto L1350;
1417 if (ki1 <= 0 || ki2 <= 0)
goto L1350;
1418 if (ki1 == ki2)
goto L1350;
1419 if (nptu < 4)
goto L1400;
1431 Printf(
" START MNCONTOUR CALCULATION OF %4d POINTS ON CONTOUR.",nptu);
1434 ki3 = 6 - ki1 - ki2;
1436 Printf(
" EACH POINT IS A MINIMUM WITH RESPECT TO PARAMETER %3d %s",ke3,(
const char*)
fCpnam[ke3-1]);
1438 Printf(
" EACH POINT IS A MINIMUM WITH RESPECT TO THE OTHER %3d VARIABLE PARAMETERS.",
fNpar - 2);
1445 mnmnot(ke1, ke2, val2pl, val2mi);
1447 xptu[0] =
fAlim[ke1-1];
1448 mnwarn(
"W",
"MNContour ",
"Contour squeezed by parameter limits.");
1450 if (
fErn[ki1-1] >= 0)
goto L1500;
1451 xptu[0] = u1min +
fErn[ki1-1];
1456 xptu[2] =
fBlim[ke1-1];
1457 mnwarn(
"W",
"MNContour ",
"Contour squeezed by parameter limits.");
1459 if (
fErp[ki1-1] <= 0)
goto L1500;
1460 xptu[2] = u1min +
fErp[ki1-1];
1463 scalx = 1 / (xptu[2] - xptu[0]);
1465 mnmnot(ke2, ke1, val2pl, val2mi);
1467 yptu[1] =
fAlim[ke2-1];
1468 mnwarn(
"W",
"MNContour ",
"Contour squeezed by parameter limits.");
1470 if (
fErn[ki2-1] >= 0)
goto L1500;
1471 yptu[1] = u2min +
fErn[ki2-1];
1475 yptu[3] =
fBlim[ke2-1];
1476 mnwarn(
"W",
"MNContour ",
"Contour squeezed by parameter limits.");
1478 if (
fErp[ki2-1] <= 0)
goto L1500;
1479 yptu[3] = u2min +
fErp[ki2-1];
1482 scaly = 1 / (yptu[3] - yptu[1]);
1486 Printf(
" Plot of four points found by MINOS");
1492 for (i = 2; i <= nall; ++i) {
1493 fXpt[i-1] = xptu[i-2];
1494 fYpt[i-1] = yptu[i-2];
1510 for (i = 1; i <= mpar; ++i) {
fXt[i-1] =
fX[i-1]; }
1511 i__1 = mpar*(mpar + 1) / 2;
1513 for (i = 1; i <= mpar; ++i) {
1523 for (inew = next; inew <= nptu; ++inew) {
1526 for (iold = 1; iold <= inew - 1; ++iold) {
1528 if (i2 == inew) i2 = 1;
1529 d__1 = scalx*(xptu[iold-1] - xptu[i2-1]);
1530 d__2 = scaly*(yptu[iold-1] - yptu[i2-1]);
1531 dist = d__1*d__1 + d__2*d__2;
1532 if (dist > bigdis) {
1539 if (i2 == inew) i2 = 1;
1544 fXmidcr = a1*xptu[i1-1] + a2*xptu[i2-1];
1545 fYmidcr = a1*yptu[i1-1] + a2*yptu[i2-1];
1546 xdir = yptu[i2-1] - yptu[i1-1];
1547 ydir = xptu[i1-1] - xptu[i2-1];
1560 Printf(
" MNCONT CANNOT FIND NEXT POINT ON CONTOUR. ONLY %3d POINTS FOUND.",nowpts);
1564 mnwarn(
"W",
"MNContour ",
"Cannot find midpoint, try closer.");
1570 for (move = nowpts; move >= i1 + 1; --move) {
1571 xptu[move] = xptu[move-1];
1572 yptu[move] = yptu[move-1];
1582 if (nowpts < nptu)
fCstatu =
"INCOMPLETE";
1590 for (i = 2; i <= nall; ++i) {
1591 fXpt[i-1] = xptu[i-2];
1592 fYpt[i-1] = yptu[i-2];
1596 Printf(
" Y-AXIS: PARAMETER %3d %s",ke2,(
const char*)
fCpnam[ke2-1]);
1600 Printf(
" X-AXIS: PARAMETER %3d %s",ke1,(
const char*)
fCpnam[ke1-1]);
1604 npcol = (nowpts + 1) / 2;
1606 Printf(
"%5d POINTS ON CONTOUR. FMIN=%13.5e ERRDEF=%11.3g",nowpts,abest,
fUp);
1608 (
const char*)
fCpnam[ke2-1],
1609 (
const char*)
fCpnam[ke1-1],
1610 (
const char*)
fCpnam[ke2-1]);
1613 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]);
1615 if (nfcol < npcol) {
1616 Printf(
" %5d%13.5e%13.5e",npcol,xptu[npcol-1],yptu[npcol-1]);
1623 i__1 = mpar*(mpar + 1) / 2;
1625 for (i = 1; i <= mpar; ++i) {
1644 Printf(
" INVALID PARAMETER NUMBERS.");
1647 Printf(
" LESS THAN FOUR POINTS REQUESTED.");
1653 Printf(
" MNCONT UNABLE TO FIND FOUR POINTS.");
1682 const char *cnumer =
"123456789-.0+";
1685 Int_t ifld, iend, lend, left, nreq, ipos, kcmnd, nextb, ic, ibegin, ltoadd;
1686 Int_t ielmnt, lelmnt[25], nelmnt;
1692 char *crdbuf = (
char*)cardbuf.
Data();
1699 for (ipos = nextb; ipos <= lend; ++ipos) {
1701 if (crdbuf[ipos-1] ==
' ')
continue;
1702 if (crdbuf[ipos-1] ==
',')
goto L250;
1708 for (ipos = ibegin + 1; ipos <= lend; ++ipos) {
1709 if (crdbuf[ipos-1] ==
' ')
goto L250;
1710 if (crdbuf[ipos-1] ==
',')
goto L250;
1716 if (iend >= ibegin) celmnt[ielmnt-1] = &crdbuf[ibegin-1];
1717 else celmnt[ielmnt-1] = cnull;
1718 lelmnt[ielmnt-1] = iend - ibegin + 1;
1719 if (lelmnt[ielmnt-1] > 19) {
1720 Printf(
" MINUIT WARNING: INPUT DATA WORD TOO LONG.");
1721 ctemp = cardbuf(ibegin-1,iend-ibegin+1);
1723 Printf(
" TRUNCATED TO:%s",celmnt[ielmnt-1]);
1724 lelmnt[ielmnt-1] = 19;
1726 if (ipos >= lend)
goto L300;
1727 if (ielmnt >= 25)
goto L300;
1729 for (ipos = iend + 1; ipos <= lend; ++ipos) {
1730 if (crdbuf[ipos-1] ==
' ')
continue;
1732 if (crdbuf[ipos-1] ==
',') nextb = ipos + 1;
1739 command[0] =
' '; command[1] = 0;
1743 if (ielmnt == 0)
goto L900;
1745 for (ielmnt = 1; ielmnt <= nelmnt; ++ielmnt) {
1746 if ( celmnt[ielmnt-1] == cnull)
goto L450;
1747 for (ic = 1; ic <= 13; ++ic) {
1748 if (*celmnt[ielmnt-1] == cnumer[ic-1])
goto L450;
1750 if (kcmnd >= maxcwd)
continue;
1751 left = maxcwd - kcmnd;
1752 ltoadd = lelmnt[ielmnt-1];
1753 if (ltoadd > left) ltoadd = left;
1754 strncpy(&command[kcmnd],celmnt[ielmnt-1],ltoadd);
1756 if (kcmnd == maxcwd)
continue;
1757 command[kcmnd] =
' ';
1767 for (ifld = ielmnt; ifld <= nelmnt; ++ifld) {
1770 nreq = nelmnt - ielmnt + 1;
1771 Printf(
" MINUIT WARNING IN MNCRCK: ");
1772 Printf(
" COMMAND HAS INPUT %5d NUMERIC FIELDS, BUT MINUIT CAN ACCEPT ONLY%3d",nreq,mxp);
1775 if (celmnt[ifld-1] == cnull) plist[llist-1] = 0;
1777 sscanf(celmnt[ifld-1],
"%lf",&plist[llist-1]);
1782 if (lnc <= 0) lnc = 1;
1800 Double_t alsb[3], flsb[3], bmin, bmax, zmid, sdev, zdir, zlim;
1801 Double_t coeff[3], aleft, aulim, fdist, adist, aminsv;
1803 Double_t determ, rt, smalla, aright, aim, tla, tlf, dfda,ecart;
1804 Int_t iout=0, i, ileft, ierev, maxlk, ibest, ik, it;
1805 Int_t noless, iworst=0, iright, itoohi, kex, ipt;
1810 ldebug =
fIdbg[6] >= 1;
1829 for (ik = 1; ik <= 2; ++ik) {
1835 if (
fKe2cr == 0)
continue;
1840 if (
fNvarl[kex-1] <= 1)
continue;
1841 if (zdir == 0)
continue;
1842 zlim =
fAlim[kex-1];
1843 if (zdir > 0) zlim =
fBlim[kex-1];
1844 aulim =
TMath::Min(aulim,(zlim - zmid) / zdir);
1852 mneval(anext, fnext, ierev);
1855 Printf(
" MNCROS: calls=%8d AIM=%10.5f F,A=%10.5f%10.5f",
fNfcn,aim,fnext,aopt);
1857 if (ierev > 0)
goto L900;
1858 if (
fLimset && fnext <= aim)
goto L930;
1860 fXpt[ipt-1] = anext;
1861 fYpt[ipt-1] = fnext;
1867 if (
TMath::Abs(fnext - aim) < tlf)
goto L800;
1869 if (aopt < -.5)aopt = -.5;
1870 if (aopt > 1) aopt = 1;
1876 mneval(aopt, fnext, ierev);
1879 Printf(
" MNCROS: calls=%8d AIM=%10.5f F,A=%10.5f%10.5f",
fNfcn,aim,fnext,aopt);
1881 if (ierev > 0)
goto L900;
1882 if (
fLimset && fnext <= aim)
goto L930;
1885 fXpt[ipt-1] = alsb[1];
1886 fYpt[ipt-1] = fnext;
1889 dfda = (flsb[1] - flsb[0]) / (alsb[1] - alsb[0]);
1891 if (dfda > 0)
goto L460;
1893 mnwarn(
"D",
"MNCROS ",
"Looking for slope of the right sign");
1895 for (it = 1; it <= maxlk; ++it) {
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;
1917 dfda = (flsb[1] - flsb[0]) / (alsb[1] - alsb[0]);
1918 if (dfda > 0)
goto L450;
1920 mnwarn(
"W",
"MNCROS ",
"Cannot find slope of the right sign");
1925 aopt = alsb[1] + (aim - flsb[1]) / dfda;
1930 if (adist < tla && fdist < tlf)
goto L800;
1931 if (ipt >= 15)
goto L950;
1933 if (aopt < bmin) aopt = bmin;
1935 if (aopt > bmax) aopt = bmax;
1942 mneval(aopt, fnext, ierev);
1945 Printf(
" MNCROS: calls=%8d AIM=%10.5f F,A=%10.5f%10.5f",
fNfcn,aim,fnext,aopt);
1947 if (ierev > 0)
goto L900;
1948 if (
fLimset && fnext <= aim)
goto L930;
1951 fXpt[ipt-1] = alsb[2];
1952 fYpt[ipt-1] = fnext;
1960 for (i = 1; i <= 3; ++i) {
1962 if (ecart > ecarmx) { ecarmx = ecart; iworst = i; }
1963 if (ecart < ecarmn) { ecarmn = ecart; ibest = i; }
1964 if (flsb[i-1] < aim) ++noless;
1967 if (noless == 1 || noless == 2)
goto L500;
1969 if (noless == 0 && ibest != 3)
goto L950;
1972 if (noless == 3 && ibest != 3) {
1978 alsb[iworst-1] = alsb[2];
1979 flsb[iworst-1] = flsb[2];
1980 dfda = (flsb[1] - flsb[0]) / (alsb[1] - alsb[0]);
1984 mnpfit(alsb, flsb, 3, coeff, sdev);
1985 if (coeff[2] <= 0) {
1986 mnwarn(
"D",
"MNCROS ",
"Curvature is negative near contour line.");
1988 determ = coeff[1]*coeff[1] - coeff[2]*4*(coeff[0] - aim);
1990 mnwarn(
"D",
"MNCROS ",
"Problem 2, impossible determinant");
1995 x1 = (-coeff[1] + rt) / (coeff[2]*2);
1996 x2 = (-coeff[1] - rt) / (coeff[2]*2);
1997 s1 = coeff[1] +
x1*2*coeff[2];
1998 s2 = coeff[1] +
x2*2*coeff[2];
2000 Printf(
" MNCONTour problem 1");
2014 if (ipt >= 15)
goto L950;
2023 for (i = 1; i <= 3; ++i) {
2025 if (ecart < ecarmn) { ecarmn = ecart; ibest = i; }
2026 if (ecart > ecarmx) { ecarmx = ecart; }
2027 if (flsb[i-1] > aim) {
2028 if (iright == 0) iright = i;
2029 else if (flsb[i-1] > flsb[iright-1]) iout = i;
2030 else { iout = iright; iright = i; }
2032 else if (ileft == 0) ileft = i;
2033 else if (flsb[i-1] < flsb[ileft-1]) iout = i;
2034 else { iout = ileft; ileft = i; }
2037 if (ecarmx >
TMath::Abs(flsb[iout-1] - aim)*10) {
2038 aopt = aopt*.5 + (alsb[iright-1] + alsb[ileft-1])*.25;
2042 if (slope*smalla > tlf) smalla = tlf / slope;
2043 aleft = alsb[ileft-1] + smalla;
2044 aright = alsb[iright-1] - smalla;
2046 if (aopt < aleft) aopt = aleft;
2047 if (aopt > aright) aopt = aright;
2048 if (aleft > aright) aopt = (aleft + aright)*.5;
2057 mneval(aopt, fnext, ierev);
2060 Printf(
" MNCROS: calls=%8d AIM=%10.5f F,A=%10.5f%10.5f",
fNfcn,aim,fnext,aopt);
2062 if (ierev > 0)
goto L900;
2063 if (
fLimset && fnext <= aim)
goto L930;
2066 fYpt[ipt-1] = fnext;
2069 alsb[iout-1] = aopt;
2070 flsb[iout-1] = fnext;
2082 if (ierev == 1)
goto L940;
2099 for (i = 1; i <= ipt; ++i) {
2108 if (
fXdircr < 0) chsign =
"NEGA";
2110 Printf(
" %sTIVE MINOS ERROR, PARAMETER %3d",chsign,
fKe1cr);
2113 Printf(
"POINTS LABELLED '+' WERE TOO HIGH TO PLOT.");
2116 Printf(
"RIGHTMOST POINT IS UP AGAINST LIMIT.");
2133 Int_t ndex, iext, i, j;
2136 Printf(
" FUNCTION MUST BE MINIMIZED BEFORE CALLING %s",(
const char*)
fCfrom);
2143 mnwarn(
"W",
fCfrom,
"NO ERROR MATRIX. WILL IMPROVISE.");
2144 for (i = 1; i <=
fNpar; ++i) {
2146 for (j = 1; j <= i-1; ++j) {
2151 if (
fG2[i-1] <= 0) {
2154 if (
fNvarl[iext-1] > 1) {
2159 fG2[i-1] =
fUp / (wint*wint);
2180 Double_t step, dfmin, stepb4, dd, df, fs1;
2181 Double_t tlrstp, tlrgrd, epspri, optstp, stpmax, stpmin, fs2, grbfor=0, d1d2, xtf;
2182 Int_t icyc, ncyc, iint, iext, i, nparx;
2186 ldebug =
fIdbg[2] >= 1;
2188 if (
fISW[2] == 1)
goto L100;
2200 Printf(
" FIRST DERIVATIVE DEBUG PRINTOUT. MNDERI");
2201 Printf(
" PAR DERIV STEP MINSTEP OPTSTEP D1-D2 2ND DRV");
2218 for (i = 1; i <=
fNpar; ++i) {
2225 for (icyc = 1; icyc <= ncyc; ++icyc) {
2231 if (
fGstep[i-1] < 0 && step > .5) step = .5;
2234 if (step > stpmax) step = stpmax;
2237 if (step < stpmin) step = stpmin;
2239 if (
TMath::Abs((step - stepb4) / step) < tlrstp)
goto L50;
2245 fX[i-1] = xtf + step;
2249 fX[i-1] = xtf - step;
2253 fGrd[i-1] = (fs1 - fs2) / (step*2);
2254 fG2[i-1] = (fs1 + fs2 -
fAmin*2) / (step*step);
2257 d1d2 = (fs1 + fs2 -
fAmin*2) / step;
2258 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]);
2265 if (ncyc == 1)
goto L50;
2274 for (iint = 1; iint <=
fNpar; ++iint) {
2276 if (
fNvarl[iext-1] <= 1) {
2312 Int_t i, j, k,
l,
m=0, i0, i1, j1, m1, n1;
2316 a_offset = ndima + 1;
2324 for (i1 = 2; i1 <=
n; ++i1) {
2326 f =
a[i + (i-1)*ndima];
2329 if (
l < 1)
goto L25;
2331 for (k = 1; k <=
l; ++k) {
2332 d__1 =
a[i + k*ndima];
2338 if (gl > 1
e-35)
goto L30;
2346 if (
f >= 0) gl = -gl;
2349 a[i + (i-1)*ndima] =
f - gl;
2351 for (j = 1; j <=
l; ++j) {
2352 a[j + i*ndima] =
a[i + j*ndima] /
h;
2354 for (k = 1; k <= j; ++k) { gl +=
a[j + k*ndima]*
a[i + k*ndima]; }
2355 if (j >=
l)
goto L47;
2357 for (k = j1; k <=
l; ++k) { gl +=
a[k + j*ndima]*
a[i + k*ndima]; }
2359 work[
n + j] = gl /
h;
2360 f += gl*
a[j + i*ndima];
2363 for (j = 1; j <=
l; ++j) {
2365 gl = work[
n + j] - hh*
f;
2367 for (k = 1; k <= j; ++k) {
2368 a[j + k*ndima] =
a[j + k*ndima] -
f*work[
n + k] - gl*
a[i + k*ndima];
2377 for (i = 1; i <=
n; ++i) {
2379 if (work[i] == 0 ||
l == 0)
goto L100;
2381 for (j = 1; j <=
l; ++j) {
2383 for (k = 1; k <=
l; ++k) { gl +=
a[i + k*ndima]*
a[k + j*ndima]; }
2384 for (k = 1; k <=
l; ++k) {
a[k + j*ndima] -= gl*
a[k + i*ndima]; }
2387 work[i] =
a[i + i*ndima];
2389 if (
l == 0)
continue;
2391 for (j = 1; j <=
l; ++j) {
2398 for (i = 2; i <=
n; ++i) {
2400 work[i0] = work[i0 + 1];
2405 for (
l = 1;
l <=
n; ++
l) {
2409 for (m1 =
l; m1 <=
n; ++m1) {
2415 if (
m ==
l)
goto L205;
2418 if (j == mits)
return;
2420 pt = (work[
l + 1] - work[
l]) / (work[
n +
l]*2);
2423 if (
pt < 0) pr =
pt -
r;
2425 h = work[
l] - work[
n +
l] / pr;
2426 for (i =
l; i <=
n; ++i) { work[i] -=
h; }
2433 for (i1 =
l; i1 <= m1; ++i1) {
2440 c =
pt / work[
n + i];
2442 work[
n + j] = s*work[
n + i]*
r;
2447 c = work[
n + i] /
pt;
2449 work[
n + j] = s*
pt*
r;
2453 pt =
c*work[i] - s*gl;
2454 work[j] =
h + s*(
c*gl + s*work[i]);
2455 for (k = 1; k <=
n; ++k) {
2457 a[k + j*ndima] = s*
a[k + i*ndima] +
c*
h;
2458 a[k + i*ndima] =
c*
a[k + i*ndima] - s*
h;
2469 for (i = 1; i <= n1; ++i) {
2473 for (j = i1; j <=
n; ++j) {
2474 if (work[j] >=
pt)
continue;
2479 if (k == i)
continue;
2483 for (j = 1; j <=
n; ++j) {
2484 pt =
a[j + i*ndima];
2485 a[j + i*ndima] =
a[j + k*ndima];
2486 a[j + k*ndima] =
pt;
2503 Int_t emat_dim1, emat_offset;
2507 Int_t i, j, k, npard, k2, kk, iz, nperln, kga, kgb;
2512 emat_offset = emat_dim1 + 1;
2513 emat -= emat_offset;
2516 if (
fISW[1] < 1)
return;
2518 Printf(
" EXTERNAL ERROR MATRIX. NDIM=%4d NPAR=%3d ERR DEF=%g",ndim,
fNpar,
fUp);
2525 Printf(
" USER-DIMENSIONED ARRAY EMAT NOT BIG ENOUGH. REDUCED MATRIX CALCULATED.");
2532 if (
fISW[4] >= 1 && npard > nperln) {
2533 Printf(
" ELEMENTS ABOVE DIAGONAL ARE NOT PRINTED.");
2536 for (i = 1; i <= npard; ++i) {
2539 for (j = 1; j <= i; ++j) {
2542 emat[i + j*emat_dim1] = dxdi*
fVhmat[kgb-1]*dxdj*
fUp;
2543 emat[j + i*emat_dim1] = emat[i + j*emat_dim1];
2548 for (i = 1; i <= npard; ++i) {
2550 if (npard >= nperln) iz = i;
2552 for (k = 1; nperln < 0 ? k >= iz : k <= iz; k += nperln) {
2553 k2 = k + nperln - 1;
2554 if (k2 > iz) k2 = iz;
2555 for (kk = k; kk <= k2; ++kk) {
2558 Printf(
"%s",(
const char*)ctemp);
2580 Int_t ndiag, iin, iex;
2584 if (iex >
fNu || iex <= 0)
goto L900;
2586 if (iin <= 0)
goto L900;
2589 eplus =
fErp[iin-1];
2590 if (eplus ==
fUndefi) eplus = 0;
2591 eminus =
fErn[iin-1];
2592 if (eminus ==
fUndefi) eminus = 0;
2594 ndiag = iin*(iin + 1) / 2;
2598 if (
fISW[1] < 2)
return;
2636 if (
fISW[0] >= 1) ierev = 1;
2637 if (
fISW[3] < 1) ierev = 2;
2668 static const char *
const cname[40] = {
2713 Double_t step, xptu[101], yptu[101],
f, rno;
2714 Int_t icol, kcol, ierr, iint, iext, lnow, nptu, i, iflag, ierrf;
2715 Int_t ilist, nparx, izero, nf, lk, it, iw, inonde, nsuper;
2716 Int_t it2, ke1, ke2, nowprt, kll, krl;
2717 TString chwhy, c26, cvblnk, cneway, comd;
2719 Bool_t lfreed, ltofix, lfixed;
2726 if (lk > 20) lk = 20;
2731 for (iw = 1; iw <=
fMaxpar; ++iw) {
2733 if (iw <= llist)
fWord7[iw-1] = plist[iw-1];
2740 if (lnow > 4) lnow = 4;
2743 for (i = 1; i <= lnow; ++i) {
2746 Printf(
"%s",(
const char*)ctemp);
2755 for (i = lnow + 1; i <= kll; ++i) {
2756 Printf(
"%12.4g",plist[i-1]);
2761 Printf(
" ERROR: ABOVE CALL TO MNEXCM TRIED TO PASS MORE THAN %d PARAMETERS.",
fMaxpar);
2779 for (i = 1; i <= nntot; ++i) {
2780 if (strncmp(ctemp.
Data(),
cname[i-1],3) == 0)
goto L90;
2782 Printf(
"UNKNOWN COMMAND IGNORED:%s", comand.
Data());
2787 if (
fCword(0,4) ==
"MINO") i = 5;
2788 if (i != 6 && i != 7 && i != 8 && i != 23) {
2803 case 10:
goto L1000;
2804 case 11:
goto L1100;
2805 case 12:
goto L1200;
2806 case 13:
goto L1300;
2807 case 14:
goto L1400;
2808 case 15:
goto L1500;
2809 case 16:
goto L1600;
2810 case 17:
goto L1700;
2811 case 18:
goto L1800;
2812 case 19:
goto L1900;
2813 case 20:
goto L1900;
2814 case 21:
goto L1900;
2815 case 22:
goto L2200;
2816 case 23:
goto L2300;
2817 case 24:
goto L2400;
2818 case 25:
goto L1900;
2819 case 26:
goto L2600;
2820 case 27:
goto L3300;
2821 case 28:
goto L3300;
2822 case 29:
goto L3300;
2823 case 30:
goto L3300;
2824 case 31:
goto L3300;
2825 case 32:
goto L3300;
2826 case 33:
goto L3300;
2827 case 34:
goto L3400;
2828 case 35:
goto L3500;
2829 case 36:
goto L3600;
2830 case 37:
goto L3700;
2831 case 38:
goto L3800;
2832 case 39:
goto L3900;
2833 case 40:
goto L4000;
2842 if (
fISW[3] < 1) ierflg = 4;
2850 if (
fISW[3] >= 1)
return;
2852 if (
fISW[0] == 1)
return;
2853 if (
fCword(0,3) ==
"MIG")
return;
2858 if (
fISW[0] == 1)
return;
2861 if (
fISW[3] >= 1) ierflg = 0;
2877 if (
fNfcn < nsuper)
goto L510;
2878 Printf(
" TOO MANY FUNCTION CALLS. MINOS GIVES UP");
2898 Printf(
"%s: NO PARAMETERS REQUESTED ",(
const char*)
fCword);
2901 for (ilist = 1; ilist <= llist; ++ilist) {
2902 iext =
Int_t(plist[ilist-1]);
2903 chwhy =
" IS UNDEFINED.";
2904 if (iext <= 0)
goto L930;
2905 if (iext >
fNu)
goto L930;
2906 if (
fNvarl[iext-1] < 0)
goto L930;
2907 chwhy =
" IS CONSTANT. ";
2908 if (
fNvarl[iext-1] == 0)
goto L930;
2911 chwhy =
" ALREADY FIXED.";
2912 if (iint == 0)
goto L930;
2914 if (ierr == 0) lfixed =
kTRUE;
2917 chwhy =
" ALREADY VARIABLE.";
2918 if (iint > 0)
goto L930;
2925 if (
fISW[4] >= 0)
Printf(
" PARAMETER %4d %s IGNORED.",iext,(
const char*)chwhy);
2927 if (lfreed || lfixed)
mnrset(0);
2940 if (it > 1 || it < 0)
goto L1005;
2951 Printf(
" IGNORED. UNKNOWN ARGUMENT:%4d",it);
2961 if (iext <= 0)
goto L1210;
2964 if (it2 <= 0)
goto L1250;
2970 Printf(
" PARAMETER %4d NOT VARIABLE.",iext);
2982 Printf(
"%s: NO PARAMETERS REQUESTED ",(
const char*)
fCword);
2988 mncntr(ke1-1, ke2-1, ierrf);
2989 if (ierrf > 0) ierflg = 3;
3024 if (
fISW[4] >= 0 && iflag <= 5 && nowprt == 1) {
3029 if (iflag > 5)
mnrset(1);
3040 if (
fISW[4] >= 0)
Printf(
" CALL TO USER FUNCTION WITH IFLAG = 3");
3045 if (
fCword(0,3) ==
"END") ierflg = 10;
3046 if (
fCword(0,3) ==
"RET") ierflg = 12;
3052 Printf(
" MINUIT MEMORY CLEARED. NO PARAMETERS NOW DEFINED.");
3058 for (icol = 5; icol <= lk; ++icol) {
3059 if (
fCword[icol-1] ==
' ')
continue;
3064 if (kcol == 0) comd =
"* ";
3065 else comd =
fCword(kcol-1,lk-kcol+1);
3073 if (ke1 == 0 &&
fNpar == 2) {
3078 if (nptu <= 0) nptu = 20;
3079 if (nptu > 101) nptu = 101;
3081 mncont(ke1-1, ke2-1, nptu, xptu, yptu, ierrf);
3082 if (ierrf < nptu) ierflg = 4;
3083 if (ierrf == -1) ierflg = 3;
3088 if (step <= 0) step = 2;
3091 for (i = 1; i <=
fNpar; ++i) {
3094 fX[i-1] += rno*step*
fWerr[i-1];
3102 Printf(
" BLANK COMMAND IGNORED.");
3108 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*");
3113 cneway =
"SET PRInt ";
3117 cneway =
"SET GRAd ";
3121 cneway =
"SHOW COVar";
3125 cneway =
"SET ERRdef";
3129 cneway =
"SET LIMits";
3136 Printf(
" OBSOLETE COMMAND:%s PLEASE USE:%s",(
const char*)
fCword
3137 ,(
const char*)cneway);
3139 if (
fCword ==
"SAVE ")
goto L1500;
3156 for (iint = 1; iint <=
fNpar; ++iint) {
3159 pint[iint-1] = pinti;
3172 Int_t kold, nold, ndex, knew, iext, i, j,
m,
n, lc, ik;
3176 Int_t iint = iint1+1;
3177 if (iint >
fNpar || iint <= 0) {
3179 Printf(
" MINUIT ERROR. ARGUMENT TO MNFIXP=%4d",iint);
3185 Printf(
" MINUIT CANNOT FIX PARAMETER %4d MAXIMUM NUMBER THAT CAN BE FIXED IS %d",iext,
fMaxpar);
3205 for (ik = iext + 1; ik <=
fNu; ++ik) {
3219 if (
fISW[1] <= 0)
return;
3221 if (
fNpar <= 0)
return;
3222 for (i = 1; i <= nold; ++i) {
3225 ndex =
m*(
m-1) / 2 +
n;
3231 for (i = 1; i <= nold; ++i) {
3232 for (j = 1; j <= i; ++j) {
3234 if (j == iint || i == iint)
continue;
3258 Double_t grdv, xv, dirinv, g2v, gstepv, xtv;
3259 Int_t i, ipsav, ka, lc, ik,
iq, ir, is;
3262 Printf(
" CALL TO MNFREE IGNORED. ARGUMENT GREATER THAN ONE");
3265 Printf(
" CALL TO MNFREE IGNORED. THERE ARE NO FIXED PARAMETERS");
3267 if (k == 1 || k == 0)
goto L40;
3271 if (
fNiofex[ka-1] == 0)
goto L15;
3272 Printf(
" IGNORED. PARAMETER SPECIFIED IS ALREADY VARIABLE.");
3275 if (
fNpfix < 1)
goto L21;
3276 for (ik = 1; ik <=
fNpfix; ++ik) {
if (
fIpfix[ik-1] == ka)
goto L24; }
3278 Printf(
" PARAMETER %4d NOT FIXED. CANNOT BE RELEASED.",ka);
3281 if (ik ==
fNpfix)
goto L40;
3291 for (i = ik + 1; i <=
fNpfix; ++i) {
3309 if (
fNpfix < 1)
goto L300;
3312 for (ik =
fNu; ik >= ir; --ik) {
3318 fX[lc-1] =
fX[lc-2];
3328 if (is == 0) is =
fNpar;
3343 Printf(
" PARAMETER %4d %s RESTORED TO VARIABLE.",ir,
3344 (
const char*)
fCpnam[ir-1]);
3346 if (k == 0)
goto L40;
3365 Int_t i, nparx, lc, istsav;
3370 if (
fWord7[0] > 0)
goto L2000;
3384 Printf(
" CHECK OF GRADIENT CALCULATION IN FCN");
3385 Printf(
" PARAMETER G(IN FCN) G(MINUIT) DG(MINUIT) AGREEMENT");
3388 for (lc = 1; lc <=
fNpar; ++lc) {
3390 const char *cwd =
"GOOD";
3402 Printf(
" %5d %10s%12.4e%12.4e%12.4e %s",i
3403 ,(
const char*)
fCpnam[i-1]
3407 Printf(
" AGREEMENT=NONE MEANS FCN DID NOT CALCULATE THE DERIVATIVE");
3410 Printf(
" MINUIT DOES NOT ACCEPT DERIVATIVE CALCULATIONS BY FCN");
3411 Printf(
" TO FORCE ACCEPTANCE, ENTER *SET GRAD 1*");
3445 if( comd.
Length() == 0 || comd[0] ==
'*' || comd[0] ==
'?' || comd[0] == 0 || comd==
"HELP" ) {
3446 Printf(
" ==>List of MINUIT Interactive commands:");
3447 Printf(
" CLEar Reset all parameter names and values undefined");
3448 Printf(
" CONtour Make contour map of the user function");
3449 Printf(
" EXIT Exit from Interactive Minuit");
3450 Printf(
" FIX Cause parameter(s) to remain constant");
3451 Printf(
" HESse Calculate the Hessian or error matrix.");
3452 Printf(
" IMPROVE Search for a new minimum around current minimum");
3453 Printf(
" MIGrad Minimize by the method of Migrad");
3454 Printf(
" MINImize MIGRAD + SIMPLEX method if Migrad fails");
3455 Printf(
" MINOs Exact (non-linear) parameter error analysis");
3456 Printf(
" MNContour Calculate one MINOS function contour");
3457 Printf(
" PARameter Define or redefine new parameters and values");
3458 Printf(
" RELease Make previously FIXed parameters variable again");
3459 Printf(
" REStore Release last parameter fixed");
3460 Printf(
" SAVe Save current parameter values on a file");
3461 Printf(
" SCAn Scan the user function by varying parameters");
3462 Printf(
" SEEk Minimize by the method of Monte Carlo");
3463 Printf(
" SET Set various MINUIT constants or conditions");
3464 Printf(
" SHOw Show values of current constants or conditions");
3465 Printf(
" SIMplex Minimize by the method of Simplex");
3473 if( !strncmp(comd.
Data(),
"CLE",3) ) {
3475 Printf(
" Resets all parameter names and values to undefined.");
3476 Printf(
" Must normally be followed by a PARameters command or ");
3477 Printf(
" equivalent, in order to define parameter values.");
3484 if( !strncmp(comd.
Data(),
"CON",3) ) {
3485 Printf(
" ***>CONTOUR <par1> <par2> [devs] [ngrid]");
3486 Printf(
" Instructs Minuit to trace contour lines of the user function");
3487 Printf(
" with respect to the two parameters whose external numbers");
3488 Printf(
" are <par1> and <par2>.");
3489 Printf(
" Other variable parameters of the function, if any, will have");
3490 Printf(
" their values fixed at the current values during the contour");
3491 Printf(
" tracing. The optional parameter [devs] (default value 2.)");
3492 Printf(
" gives the number of standard deviations in each parameter");
3493 Printf(
" which should lie entirely within the plotting area.");
3494 Printf(
" Optional parameter [ngrid] (default value 25 unless page");
3495 Printf(
" size is too small) determines the resolution of the plot,");
3496 Printf(
" i.e. the number of rows and columns of the grid at which the");
3497 Printf(
" function will be evaluated. [See also MNContour.]");
3504 if( !strncmp(comd.
Data(),
"END",3) ) {
3506 Printf(
" Signals the end of a data block (i.e., the end of a fit),");
3507 Printf(
" and implies that execution should continue, because another");
3508 Printf(
" Data Block follows. A Data Block is a set of Minuit data");
3509 Printf(
" consisting of");
3511 Printf(
" (2) One or more Parameter Definitions,");
3512 Printf(
" (3) A blank line, and");
3513 Printf(
" (4) A set of Minuit Commands.");
3514 Printf(
" The END command is used when more than one Data Block is to");
3515 Printf(
" be used with the same FCN function. It first causes Minuit");
3516 Printf(
" to issue a CALL FCN with IFLAG=3, in order to allow FCN to");
3517 Printf(
" perform any calculations associated with the final fitted");
3518 Printf(
" parameter values, unless a CALL FCN 3 command has already");
3519 Printf(
" been executed at the current FCN value.");
3526 if( !strncmp(comd.
Data(),
"EXI",3) ) {
3528 Printf(
" Signals the end of execution.");
3529 Printf(
" The EXIT command first causes Minuit to issue a CALL FCN");
3530 Printf(
" with IFLAG=3, to allow FCN to perform any calculations");
3531 Printf(
" associated with the final fitted parameter values, unless a");
3532 Printf(
" CALL FCN 3 command has already been executed.");
3539 if( !strncmp(comd.
Data(),
"FIX",3) ) {
3540 Printf(
" ***>FIX} <parno> [parno] ... [parno]");
3541 Printf(
" Causes parameter(s) <parno> to be removed from the list of");
3542 Printf(
" variable parameters, and their value(s) will remain constant");
3543 Printf(
" during subsequent minimizations, etc., until another command");
3544 Printf(
" changes their value(s) or status.");
3551 if( !strncmp(comd.
Data(),
"HES",3) ) {
3552 Printf(
" ***>HESse [maxcalls]");
3553 Printf(
" Calculate, by finite differences, the Hessian or error matrix.");
3554 Printf(
" That is, it calculates the full matrix of second derivatives");
3555 Printf(
" of the function with respect to the currently variable");
3556 Printf(
" parameters, and inverts it, printing out the resulting error");
3557 Printf(
" matrix. The optional argument [maxcalls] specifies the");
3558 Printf(
" (approximate) maximum number of function calls after which");
3559 Printf(
" the calculation will be stopped.");
3566 if( !strncmp(comd.
Data(),
"IMP",3) ) {
3567 Printf(
" ***>IMPROVE [maxcalls]");
3568 Printf(
" If a previous minimization has converged, and the current");
3569 Printf(
" values of the parameters therefore correspond to a local");
3570 Printf(
" minimum of the function, this command requests a search for");
3571 Printf(
" additional distinct local minima.");
3572 Printf(
" The optional argument [maxcalls] specifies the (approximate");
3573 Printf(
" maximum number of function calls after which the calculation");
3574 Printf(
" will be stopped.");
3581 if( !strncmp(comd.
Data(),
"MIG",3) ) {
3582 Printf(
" ***>MIGrad [maxcalls] [tolerance]");
3583 Printf(
" Causes minimization of the function by the method of Migrad,");
3584 Printf(
" the most efficient and complete single method, recommended");
3585 Printf(
" for general functions (see also MINImize).");
3586 Printf(
" The minimization produces as a by-product the error matrix");
3587 Printf(
" of the parameters, which is usually reliable unless warning");
3588 Printf(
" messages are produced.");
3589 Printf(
" The optional argument [maxcalls] specifies the (approximate)");
3590 Printf(
" maximum number of function calls after which the calculation");
3591 Printf(
" will be stopped even if it has not yet converged.");
3592 Printf(
" The optional argument [tolerance] specifies required tolerance");
3593 Printf(
" on the function value at the minimum.");
3594 Printf(
" The default tolerance is 0.1, and the minimization will stop");
3595 Printf(
" when the estimated vertical distance to the minimum (EDM) is");
3596 Printf(
" less than 0.001*[tolerance]*UP (see [SET ERRordef]).");
3603 if( !strncmp(comd.
Data(),
"MINI",4) ) {
3604 Printf(
" ***>MINImize [maxcalls] [tolerance]");
3605 Printf(
" Causes minimization of the function by the method of Migrad,");
3606 Printf(
" as does the MIGrad command, but switches to the SIMplex method");
3607 Printf(
" if Migrad fails to converge. Arguments are as for MIGrad.");
3608 Printf(
" Note that command requires four characters to be unambiguous.");
3615 if( !strncmp(comd.
Data(),
"MIN0",4) ) {
3616 Printf(
" ***>MINOs [maxcalls] [parno] [parno] ...");
3617 Printf(
" Causes a Minos error analysis to be performed on the parameters");
3618 Printf(
" whose numbers [parno] are specified. If none are specified,");
3619 Printf(
" Minos errors are calculated for all variable parameters.");
3620 Printf(
" Minos errors may be expensive to calculate, but are very");
3621 Printf(
" reliable since they take account of non-linearities in the");
3622 Printf(
" problem as well as parameter correlations, and are in general");
3624 Printf(
" The optional argument [maxcalls] specifies the (approximate)");
3625 Printf(
" maximum number of function calls per parameter requested,");
3626 Printf(
" after which the calculation will stop for that parameter.");
3633 if( !strncmp(comd.
Data(),
"MNC",3) ) {
3634 Printf(
" ***>MNContour <par1> <par2> [npts]");
3635 Printf(
" Calculates one function contour of FCN with respect to");
3636 Printf(
" parameters par1 and par2, with FCN minimized always with");
3637 Printf(
" respect to all other NPAR-2 variable parameters (if any).");
3638 Printf(
" Minuit will try to find npts points on the contour (default 20)");
3639 Printf(
" If only two parameters are variable at the time, it is not");
3640 Printf(
" necessary to specify their numbers. To calculate more than");
3641 Printf(
" one contour, it is necessary to SET ERRordef to the appropriate");
3642 Printf(
" value and issue the MNContour command for each contour.");
3649 if( !strncmp(comd.
Data(),
"PAR",3) ) {
3650 Printf(
" ***>PARameters");
3651 Printf(
" followed by one or more parameter definitions.");
3652 Printf(
" Parameter definitions are of the form:");
3653 Printf(
" <number> ''name'' <value> <step> [lolim] [uplim] ");
3655 Printf(
" 3 ''K width'' 1.2 0.1");
3656 Printf(
" the last definition is followed by a blank line or a zero.");
3663 if( !strncmp(comd.
Data(),
"REL",3) ) {
3664 Printf(
" ***>RELease <parno> [parno] ... [parno]");
3665 Printf(
" If <parno> is the number of a previously variable parameter");
3666 Printf(
" which has been fixed by a command: FIX <parno>, then that");
3667 Printf(
" parameter will return to variable status. Otherwise a warning");
3668 Printf(
" message is printed and the command is ignored.");
3669 Printf(
" Note that this command operates only on parameters which were");
3670 Printf(
" at one time variable and have been FIXed. It cannot make");
3671 Printf(
" constant parameters variable; that must be done by redefining");
3672 Printf(
" the parameter with a PARameters command.");
3679 if( !strncmp(comd.
Data(),
"RES",3) ) {
3680 Printf(
" ***>REStore [code]");
3681 Printf(
" If no [code] is specified, this command restores all previously");
3682 Printf(
" FIXed parameters to variable status. If [code]=1, then only");
3683 Printf(
" the last parameter FIXed is restored to variable status.");
3684 Printf(
" If code is neither zero nor one, the command is ignored.");
3691 if( !strncmp(comd.
Data(),
"RET",3) ) {
3693 Printf(
" Signals the end of a data block, and instructs Minuit to return");
3694 Printf(
" to the program which called it. The RETurn command first");
3695 Printf(
" causes Minuit to CALL FCN with IFLAG=3, in order to allow FCN");
3696 Printf(
" to perform any calculations associated with the final fitted");
3697 Printf(
" parameter values, unless a CALL FCN 3 command has already been");
3698 Printf(
" executed at the current FCN value.");
3705 if( !strncmp(comd.
Data(),
"SAV",3) ) {
3707 Printf(
" Causes the current parameter values to be saved on a file in");
3708 Printf(
" such a format that they can be read in again as Minuit");
3709 Printf(
" parameter definitions. If the covariance matrix exists, it is");
3710 Printf(
" also output in such a format. The unit number is by default 7,");
3711 Printf(
" or that specified by the user in their call to MINTIO or");
3712 Printf(
" MNINIT. The user is responsible for opening the file previous");
3713 Printf(
" to issuing the [SAVe] command (except where this can be done");
3714 Printf(
" interactively).");
3721 if( !strncmp(comd.
Data(),
"SCA",3) ) {
3722 Printf(
" ***>SCAn [parno] [numpts] [from] [to]");
3723 Printf(
" Scans the value of the user function by varying parameter");
3724 Printf(
" number [parno], leaving all other parameters fixed at the");
3725 Printf(
" current value. If [parno] is not specified, all variable");
3726 Printf(
" parameters are scanned in sequence.");
3727 Printf(
" The number of points [numpts] in the scan is 40 by default,");
3728 Printf(
" and cannot exceed 100. The range of the scan is by default");
3729 Printf(
" 2 standard deviations on each side of the current best value,");
3730 Printf(
" but can be specified as from [from] to [to].");
3731 Printf(
" After each scan, if a new minimum is found, the best parameter");
3732 Printf(
" values are retained as start values for future scans or");
3733 Printf(
" minimizations. The curve resulting from each scan is plotted");
3734 Printf(
" on the output unit in order to show the approximate behaviour");
3735 Printf(
" of the function.");
3736 Printf(
" This command is not intended for minimization, but is sometimes");
3737 Printf(
" useful for debugging the user function or finding a");
3738 Printf(
" reasonable starting point.");
3745 if( !strncmp(comd.
Data(),
"SEE",3) ) {
3746 Printf(
" ***>SEEk [maxcalls] [devs]");
3747 Printf(
" Causes a Monte Carlo minimization of the function, by choosing");
3748 Printf(
" random values of the variable parameters, chosen uniformly");
3749 Printf(
" over a hypercube centered at the current best value.");
3750 Printf(
" The region size is by default 3 standard deviations on each");
3751 Printf(
" side, but can be changed by specifying the value of [devs].");
3758 if( !strncmp(comd.
Data(),
"SET",3) ) {
3759 Printf(
" ***>SET <option_name>");
3761 Printf(
" Informs Minuit that it is running in batch mode.");
3764 Printf(
" SET EPSmachine <accuracy>");
3765 Printf(
" Informs Minuit that the relative floating point arithmetic");
3766 Printf(
" precision is <accuracy>. Minuit determines the nominal");
3767 Printf(
" precision itself, but the SET EPSmachine command can be");
3768 Printf(
" used to override Minuit own determination, when the user");
3769 Printf(
" knows that the FCN function value is not calculated to");
3770 Printf(
" the nominal machine accuracy. Typical values of <accuracy>");
3771 Printf(
" are between 10**-5 and 10**-14.");
3774 Printf(
" SET ERRordef <up>");
3775 Printf(
" Sets the value of UP (default value= 1.), defining parameter");
3776 Printf(
" errors. Minuit defines parameter errors as the change");
3777 Printf(
" in parameter value required to change the function value");
3778 Printf(
" by UP. Normally, for chisquared fits UP=1, and for negative");
3779 Printf(
" log likelihood, UP=0.5.");
3782 Printf(
" SET GRAdient [force]");
3783 Printf(
" Informs Minuit that the user function is prepared to");
3784 Printf(
" calculate its own first derivatives and return their values");
3785 Printf(
" in the array GRAD when IFLAG=2 (see specs of FCN).");
3786 Printf(
" If [force] is not specified, Minuit will calculate");
3787 Printf(
" the FCN derivatives by finite differences at the current");
3788 Printf(
" point and compare with the user calculation at that point,");
3789 Printf(
" accepting the user values only if they agree.");
3790 Printf(
" If [force]=1, Minuit does not do its own derivative");
3791 Printf(
" calculation, and uses the derivatives calculated in FCN.");
3794 Printf(
" SET INPut [unitno] [filename]");
3795 Printf(
" Causes Minuit, in data-driven mode only, to read subsequent");
3796 Printf(
" commands (or parameter definitions) from a different input");
3797 Printf(
" file. If no [unitno] is specified, reading reverts to the");
3798 Printf(
" previous input file, assuming that there was one.");
3799 Printf(
" If [unitno] is specified, and that unit has not been opened,");
3800 Printf(
" then Minuit attempts to open the file [filename]} if a");
3801 Printf(
" name is specified. If running in interactive mode and");
3802 Printf(
" [filename] is not specified and [unitno] is not opened,");
3803 Printf(
" Minuit prompts the user to enter a file name.");
3804 Printf(
" If the word REWIND is added to the command (note:no blanks");
3805 Printf(
" between INPUT and REWIND), the file is rewound before");
3806 Printf(
" reading. Note that this command is implemented in standard");
3807 Printf(
" Fortran 77 and the results may depend on the system;");
3808 Printf(
" for example, if a filename is given under VM/CMS, it must");
3809 Printf(
" be preceded by a slash.");
3812 Printf(
" SET INTeractive");
3813 Printf(
" Informs Minuit that it is running interactively.");
3816 Printf(
" SET LIMits [parno] [lolim] [uplim]");
3817 Printf(
" Allows the user to change the limits on one or all");
3818 Printf(
" parameters. If no arguments are specified, all limits are");
3819 Printf(
" removed from all parameters. If [parno] alone is specified,");
3820 Printf(
" limits are removed from parameter [parno].");
3821 Printf(
" If all arguments are specified, then parameter [parno] will");
3822 Printf(
" be bounded between [lolim] and [uplim].");
3823 Printf(
" Limits can be specified in either order, Minuit will take");
3824 Printf(
" the smaller as [lolim] and the larger as [uplim].");
3825 Printf(
" However, if [lolim] is equal to [uplim], an error condition");
3829 Printf(
" SET LINesperpage");
3830 Printf(
" Sets the number of lines for one page of output.");
3831 Printf(
" Default value is 24 for interactive mode");
3834 Printf(
" SET NOGradient");
3835 Printf(
" The inverse of SET GRAdient, instructs Minuit not to");
3836 Printf(
" use the first derivatives calculated by the user in FCN.");
3839 Printf(
" SET NOWarnings");
3840 Printf(
" Supresses Minuit warning messages.");
3843 Printf(
" SET OUTputfile <unitno>");
3844 Printf(
" Instructs Minuit to write further output to unit <unitno>.");
3847 Printf(
" SET PAGethrow <integer>");
3848 Printf(
" Sets the carriage control character for ``new page'' to");
3849 Printf(
" <integer>. Thus the value 1 produces a new page, and 0");
3850 Printf(
" produces a blank line, on some devices (see TOPofpage)");
3854 Printf(
" SET PARameter <parno> <value>");
3855 Printf(
" Sets the value of parameter <parno> to <value>.");
3856 Printf(
" The parameter in question may be variable, fixed, or");
3857 Printf(
" constant, but must be defined.");
3860 Printf(
" SET PRIntout <level>");
3861 Printf(
" Sets the print level, determining how much output will be");
3862 Printf(
" produced. Allowed values and their meanings are displayed");
3863 Printf(
" after a SHOw PRInt command, and are currently <level>=:");
3864 Printf(
" [-1] no output except from SHOW commands");
3865 Printf(
" [0] minimum output");
3866 Printf(
" [1] default value, normal output");
3867 Printf(
" [2] additional output giving intermediate results.");
3868 Printf(
" [3] maximum output, showing progress of minimizations.");
3869 Printf(
" Note: See also the SET WARnings command.");
3872 Printf(
" SET RANdomgenerator <seed>");
3873 Printf(
" Sets the seed of the random number generator used in SEEk.");
3874 Printf(
" This can be any integer between 10000 and 900000000, for");
3875 Printf(
" example one which was output from a SHOw RANdom command of");
3876 Printf(
" a previous run.");
3879 Printf(
" SET STRategy <level>");
3880 Printf(
" Sets the strategy to be used in calculating first and second");
3881 Printf(
" derivatives and in certain minimization methods.");
3882 Printf(
" In general, low values of <level> mean fewer function calls");
3883 Printf(
" and high values mean more reliable minimization.");
3884 Printf(
" Currently allowed values are 0, 1 (default), and 2.");
3888 Printf(
" Informs Minuit that the next input line is to be considered");
3889 Printf(
" the (new) title for this task or sub-task. This is for");
3890 Printf(
" the convenience of the user in reading their output.");
3894 Printf(
" Instructs Minuit to output warning messages when suspicious");
3895 Printf(
" conditions arise which may indicate unreliable results.");
3896 Printf(
" This is the default.");
3899 Printf(
" SET WIDthpage");
3900 Printf(
" Informs Minuit of the output page width.");
3901 Printf(
" Default values are 80 for interactive jobs");
3908 if( !strncmp(comd.
Data(),
"SHO",3) ) {
3909 Printf(
" ***>SHOw <option_name>");
3910 Printf(
" All SET XXXX commands have a corresponding SHOw XXXX command.");
3911 Printf(
" In addition, the SHOw commands listed starting here have no");
3912 Printf(
" corresponding SET command for obvious reasons.");
3915 Printf(
" SHOw CORrelations");
3916 Printf(
" Calculates and prints the parameter correlations from the");
3917 Printf(
" error matrix.");
3920 Printf(
" SHOw COVariance");
3921 Printf(
" Prints the (external) covariance (error) matrix.");
3924 Printf(
" SHOw EIGenvalues");
3925 Printf(
" Calculates and prints the eigenvalues of the covariance");
3929 Printf(
" SHOw FCNvalue");
3930 Printf(
" Prints the current value of FCN.");
3937 if( !strncmp(comd.
Data(),
"SIM",3) ) {
3938 Printf(
" ***>SIMplex [maxcalls] [tolerance]");
3939 Printf(
" Performs a function minimization using the simplex method of");
3940 Printf(
" Nelder and Mead. Minimization terminates either when the");
3941 Printf(
" function has been called (approximately) [maxcalls] times,");
3942 Printf(
" or when the estimated vertical distance to minimum (EDM) is");
3943 Printf(
" less than [tolerance].");
3944 Printf(
" The default value of [tolerance] is 0.1*UP(see SET ERRordef).");
3951 if( !strncmp(comd.
Data(),
"STA",3) ) {
3959 if( !strncmp(comd.
Data(),
"STO",3) ) {
3961 Printf(
" Same as EXIT.");
3968 if( !strncmp(comd.
Data(),
"TOP",3) ) {
3969 Printf(
" ***>TOPofpage");
3970 Printf(
" Causes Minuit to write the character specified in a");
3971 Printf(
" SET PAGethrow command (default = 1) to column 1 of the output");
3972 Printf(
" file, which may or may not position your output medium to");
3973 Printf(
" the top of a page depending on the device and system.");
3977 Printf(
" Unknown MINUIT command. Type HELP for list of commands.");
3995 Double_t dmin_, dxdi, elem, wint, tlrg2,
d, dlast, ztemp, g2bfor;
3996 Double_t df, aimsag, fs1, tlrstp, fs2, stpinm, g2i, sag=0, xtf, xti, xtj;
3997 Int_t icyc, ncyc, ndex, idrv, iext, npar2, i, j, ifail, npard, nparx,
id, multpy;
4000 ldebug =
fIdbg[3] >= 1;
4017 if (
fISW[4] >= 2 || ldebug) {
4018 Printf(
" START COVARIANCE MATRIX CALCULATION.");
4034 Printf(
" PAR D GSTEP D G2 GRD SAG ");
4044 for (i = 1; i <= npar2; ++i) {
fVhmat[i-1] = 0; }
4048 for (
id = 1;
id <= npard; ++
id) {
4049 i =
id +
fNpar - npard;
4051 if (
fG2[i-1] == 0) {
4052 mnwarn(
"W",
"HESSE",
Form(
"Second derivative enters zero, param %d",iext));
4054 if (
fNvarl[iext-1] > 1) {
4059 fG2[i-1] =
fUp / (wint*wint);
4067 for (icyc = 1; icyc <= ncyc; ++icyc) {
4069 for (multpy = 1; multpy <= 5; ++multpy) {
4079 sag = (fs1 + fs2 -
fAmin*2)*.5;
4080 if (sag != 0)
goto L30;
4082 if (
d >= .5)
goto L26;
4084 if (
d > .5)
d = .51;
4095 fG2[i-1] = sag*2 / (
d*
d);
4096 fGrd[i-1] = (fs1 - fs2) / (
d*2);
4109 if (
d < dmin_)
d = dmin_;
4123 ndex = i*(i + 1) / 2;
4134 if (
fNpar == 1)
goto L214;
4135 for (i = 1; i <=
fNpar; ++i) {
4136 for (j = 1; j <= i-1; ++j) {
4147 ndex = i*(i-1) / 2 + j;
4155 for (i = 1; i <=
fNpar; ++i) {
4156 for (j = 1; j <= i; ++j) {
4157 ndex = i*(i-1) / 2 + j;
4164 mnwarn(
"W",
"HESSE",
"Matrix inversion fails.");
4170 for (i = 1; i <=
fNpar; ++i) {
4173 for (j = 1; j <= i-1; ++j) {
4185 Printf(
" COVARIANCE MATRIX CALCULATED SUCCESSFULLY");
4194 Printf(
" MNHESS FAILS AND WILL RETURN DIAGONAL MATRIX. ");
4196 for (i = 1; i <=
fNpar; ++i) {
4198 for (j = 1; j <= i-1; ++j) {
4204 if (g2i <= 0) g2i = 1;
4205 fVhmat[ndex-1] = 2 / g2i;
4220 Double_t dmin_,
d, dfmin, dgmin=0, change, chgold, grdold=0, epspri;
4221 Double_t fs1, optstp, fs2, grdnew=0, sag, xtf;
4222 Int_t icyc, ncyc=0, idrv, i, nparx;
4225 ldebug =
fIdbg[5] >= 1;
4233 for (i = 1; i <=
fNpar; ++i) {
4239 if (
d > optstp)
d = optstp;
4240 if (
d < dmin_)
d = dmin_;
4243 for (icyc = 1; icyc <= ncyc; ++icyc) {
4252 sag = (fs1 + fs2 -
fAmin*2)*.5;
4254 grdnew = (fs1 - fs2) / (
d*2);
4257 Printf(
"%4d%2d%12.5g%12.5g%12.5g%12.5g%12.5g",i,idrv,
fGstep[i-1],
d,
fG2[i-1],grdnew,sag);
4259 if (grdnew == 0)
goto L60;
4260 change =
TMath::Abs((grdold - grdnew) / grdnew);
4261 if (change > chgold && icyc > 1)
goto L60;
4267 if (change < .05)
goto L60;
4268 if (
TMath::Abs(grdold - grdnew) < dgmin)
goto L60;
4270 mnwarn(
"D",
"MNHES1",
"Step size too small for 1st drv.");
4301 Double_t amax, ycalf, ystar, ystst;
4303 Int_t npfn, ndex, loop=0, i, j, ifail, iseed=0;
4304 Int_t jhold, nloop, nparx, nparp1, jh, jl, iswtr;
4306 if (
fNpar <= 0)
return;
4313 if (nloop <= 0) nloop =
fNpar + 4;
4320 for (i = 1; i <=
fNpar; ++i) {
4323 for (j = 1; j <= i; ++j) {
4324 ndex = i*(i-1) / 2 + j;
4330 if (ifail >= 1)
goto L280;
4332 for (i = 1; i <=
fNpar; ++i) {
4334 for (j = 1; j <= i; ++j) {
4342 for (i = 1; i <=
fNpar; ++i) {
4350 Printf(
"START ATTEMPT NO.%2d TO FIND NEW MINIMUM",loop);
4360 for (i = 1; i <=
fNpar; ++i) {
4363 fX[i-1] = xi -
fDirin[i-1]*(rnum - .5);
4369 }
else if (
fIMPRy[i-1] > amax) {
4382 if (
fAmin < 0)
goto L95;
4383 if (
fISW[1] <= 2)
goto L280;
4385 if (sig2 < ep &&
fEDM < ep)
goto L100;
4389 for (i = 1; i <=
fNpar; ++i) {
4397 if (ystar >=
fAmin)
goto L70;
4399 for (i = 1; i <=
fNpar; ++i) {
4404 if (ystst <
fIMPRy[jl-1])
goto L67;
4412 if (ystar >=
fIMPRy[jh-1])
goto L73;
4415 if (jhold != jh)
goto L50;
4418 for (i = 1; i <=
fNpar; ++i) {
4423 if (ystst >
fIMPRy[jh-1])
goto L30;
4425 if (ystst <
fAmin)
goto L67;
4431 Printf(
" AN IMPROVEMENT ON THE PREVIOUS MINIMUM HAS BEEN FOUND");
4438 for (i = 1; i <=
fNpar; ++i) {
4448 for (i = 1; i <=
fNpar; ++i) {
4466 Printf(
" IMPROVE HAS FOUND A TRULY NEW MINIMUM");
4467 Printf(
" *************************************");
4473 Printf(
" COVARIANCE MATRIX WAS NOT POSITIVE-DEFINITE");
4479 for (i = 1; i <=
fNpar; ++i) {
4488 Printf(
" IMPROVE HAS RETURNED TO REGION OF ORIGINAL MINIMUM");
4492 if (
fISW[1] < 2)
goto L380;
4493 if (loop < nloop &&
fISW[0] < 1)
goto L20;
4509 for (j = 0; j <
fNpar; ++j) {
4529 Double_t piby2, epstry, epsbak, distnn;
4547 fCovmes[0] =
"NO ERROR MATRIX ";
4548 fCovmes[1] =
"ERR MATRIX APPROXIMATE";
4549 fCovmes[2] =
"ERR MATRIX NOT POS-DEF";
4550 fCovmes[3] =
"ERROR MATRIX ACCURATE ";
4588 for (i = 1; i <= 100; ++i) {
4592 if (epsbak < epstry)
goto L35;
4596 Printf(
" MNINIT UNABLE TO DETERMINE ARITHMETIC PRECISION. WILL ASSUME:%g",
fEpsmac);
4619 Int_t kint, i2, newcod, ifx=0, inu;
4625 if (i2 >
fMaxext || i2 < 0)
goto L900;
4626 if (i2 > 0)
goto L30;
4630 for (inu = 1; inu <=
fNu; ++inu) {
4631 if (
fNvarl[inu-1] <= 0)
continue;
4632 if (
fNvarl[inu-1] == 1 && newcod == 1)
continue;
4637 Printf(
" LIMITS NOT CHANGED FOR FIXED PARAMETER:%4d",inu);
4644 Printf(
" LIMITS REMOVED FROM PARAMETER :%3d",inu);
4648 snew =
fGstep[kint-1]*dxdi;
4656 Printf(
" PARAMETER %3d LIMITS SET TO %15.5g%15.5g",inu,
fAlim[inu-1],
fBlim[inu-1]);
4667 Printf(
" PARAMETER %3d IS NOT VARIABLE.", i2);
4673 Printf(
" REQUEST TO CHANGE LIMITS ON FIXED PARAMETER:%3d",i2);
4674 for (ifx = 1; ifx <=
fNpfix; ++ifx) {
4675 if (i2 ==
fIpfix[ifx-1])
goto L92;
4677 Printf(
" MINUIT BUG IN MNLIMS. SEE F. JAMES");
4685 Printf(
" LIMITS REMOVED FROM PARAMETER %2d",i2);
4694 fGrd[kint-1] *= dxdi;
4698 Printf(
" NO LIMITS SPECIFIED. PARAMETER %3d IS ALREADY UNLIMITED. NO CHANGE.",i2);
4707 Printf(
" PARAMETER %3d LIMITS SET TO %15.5g%15.5g",i2,
fAlim[i2-1],
fBlim[i2-1]);
4710 if (kint <= 0)
fGsteps[ifx-1] = -.1;
4711 else fGstep[kint-1] = -.1;
4714 if (
fCstatu !=
"NO CHANGE ") {
4738 Double_t xpq[12], ypq[12], slam, sdev, coeff[3], denom, flast;
4739 Double_t fvals[3], xvals[3],
f1, fvmin, xvmin, ratio, f2, f3 = 0., fvmax;
4740 Double_t toler8, toler9, overal, undral, slamin, slamax, slopem;
4741 Int_t i, nparx=0, nvmax=0, nxypt, kk, ipt;
4748 l65 = 0; l70 = 0; l80 = 0;
4749 ldebug =
fIdbg[1] >= 1;
4758 Printf(
" MNLINE start point not consistent, F values, parameters=");
4759 for (kk = 1; kk <=
fNpar; ++kk) {
4773 for (i = 1; i <=
fNpar; ++i) {
4774 if (step[i-1] != 0) {
4776 if (slamin == 0) slamin = ratio;
4777 if (ratio < slamin) slamin = ratio;
4779 fX[i-1] = start[i-1] + step[i-1];
4781 if (slamin == 0) slamin =
fEpsmac;
4788 chpq[nxypt-1] =
charal[nxypt-1];
4803 denom = (flast - fstart - slope*slam)*2 / (slam*slam);
4805 if (denom != 0) slam = -slope / denom;
4806 if (slam < 0) slam = slamax;
4807 if (slam > slamax) slam = slamax;
4808 if (slam < toler8) slam = toler8;
4809 if (slam < slamin) {
4817 if (
TMath::Abs(slam - 1) < toler8) slam = toler8 + 1;
4822 for (i = 1; i <=
fNpar; ++i) {
fX[i-1] = start[i-1] + slam*step[i-1]; }
4827 chpq[nxypt-1] =
charal[nxypt-1];
4828 xpq[nxypt-1] = slam;
4834 if (fstart == fvmin) {
4836 toler8 = toler*slam;
4837 overal = slam - toler8;
4840 }
while (fstart == fvmin);
4842 if (!l65 && !l70 && !l80) {
4846 xvals[1] = xpq[nxypt-2];
4847 fvals[1] = ypq[nxypt-2];
4848 xvals[2] = xpq[nxypt-1];
4849 fvals[2] = ypq[nxypt-1];
4853 mnpfit(xvals, fvals, 3, coeff, sdev);
4854 if (coeff[2] <= 0) {
4855 slopem = coeff[2]*2*xvmin + coeff[1];
4856 if (slopem <= 0) slam = xvmin + slamax;
4857 else slam = xvmin - slamax;
4859 slam = -coeff[1] / (coeff[2]*2);
4860 if (slam > xvmin + slamax) slam = xvmin + slamax;
4861 if (slam < xvmin - slamax) slam = xvmin - slamax;
4866 else if (slam < undral)
4873 for (ipt = 1; ipt <= 3; ++ipt) {
4874 if (
TMath::Abs(slam - xvals[ipt-1]) < toler9) {
4885 for (i = 1; i <=
fNpar; ++i) {
fX[i-1] = start[i-1] + slam*step[i-1]; }
4889 chpq[nxypt-1] =
charal[nxypt-1];
4890 xpq[nxypt-1] = slam;
4895 if (fvals[1] > fvmax) {
4899 if (fvals[2] > fvmax) {
4909 if (slam > xvmin) overal =
TMath::Min(overal,slam - toler8);
4910 if (slam < xvmin) undral =
TMath::Max(undral,slam + toler8);
4911 slam = (slam + xvmin)*.5;
4913 }
while (f3 >= fvmax);
4916 if (l65 || l70)
break;
4918 xvals[nvmax-1] = slam;
4919 fvals[nvmax-1] = f3;
4924 if (slam > xvmin) overal =
TMath::Min(overal,slam - toler8);
4925 if (slam < xvmin) undral =
TMath::Max(undral,slam + toler8);
4927 }
while (nxypt < 12);
4933 cmess =
" LINE SEARCH HAS EXHAUSTED THE LIMIT OF FUNCTION CALLS ";
4935 Printf(
" MNLINE DEBUG: steps=");
4936 for (kk = 1; kk <=
fNpar; ++kk) {
4937 Printf(
" %12.4g",step[kk-1]);
4942 if (l70) cmess =
" LINE SEARCH HAS ATTAINED TOLERANCE ";
4943 if (l80) cmess =
" STEP SIZE AT ARITHMETICALLY ALLOWED MINIMUM";
4946 for (i = 1; i <=
fNpar; ++i) {
4947 fDirin[i-1] = step[i-1]*xvmin;
4948 fX[i-1] = start[i-1] +
fDirin[i-1];
4952 mnwarn(
"D",
"MNLINE",
" LINE MINIMUM IN BACKWARDS DIRECTION");
4954 if (fvmin == fstart) {
4955 mnwarn(
"D",
"MNLINE",
" LINE SEARCH FINDS NO IMPROVEMENT ");
4958 Printf(
" AFTER %3d POINTS,%s",nxypt,(
const char*)cmess);
4972 Int_t ndex, i, j,
m,
n, ncoef, nparm,
id, it, ix;
4973 Int_t nsofar, ndi, ndj, iso, isw2, isw5;
4982 Printf(
" MNMATU: NPAR=0");
4996 if (
fNpar <= 1)
return;
5002 Printf(
" PARAMETER CORRELATION COEFFICIENTS ");
5003 ctemp =
" NO. GLOBAL";
5004 for (
id = 1;
id <= nparm; ++
id) {
5007 Printf(
"%s",(
const char*)ctemp);
5008 for (i = 1; i <=
fNpar; ++i) {
5010 ndi = i*(i + 1) / 2;
5011 for (j = 1; j <=
fNpar; ++j) {
5014 ndex =
m*(
m-1) / 2 +
n;
5015 ndj = j*(j + 1) / 2;
5020 for (it = 1; it <= nparm; ++it) {
5023 Printf(
"%s",(
const char*)ctemp);
5024 if (i <= nparm)
continue;
5026 for (iso = 1; iso <= 10; ++iso) {
5029 for (it = nsofar + 1; it <= nparm; ++it) {
5032 Printf(
"%s",(
const char*)ctemp);
5033 if (i <= nparm)
break;
5052 Double_t gdel, gami, vlen, dsum, gssq, vsum,
d;
5055 Int_t npfn, ndex, iext, i, j,
m,
n, npsdf, nparx;
5056 Int_t iswtr, lined2, kk, nfcnmg, nrstrt,iter;
5060 if (
fNpar <= 0)
return;
5075 rhotol =
fApsi*.001;
5077 Printf(
" START MIGRAD MINIMIZATION. STRATEGY %2d. CONVERGENCE WHEN EDM .LT.%9.2e",
fIstrat,rhotol);
5092 if (
fISW[1] >= 1)
goto L10;
5100 if (
fISW[1] >= 1)
goto L10;
5102 for (i = 1; i <=
fNpar; ++i) {
5109 for (i = 1; i <=
fNpar; ++i) {
5110 if (
fG2[i-1] > 0)
continue;
5116 mnwarn(
"D",
"MNMIGR",
"Negative G2 line search");
5119 Printf(
" Negative G2 line search, param %3d %13.3g%13.3g",iext,
fs,
fAmin);
5125 for (i = 1; i <=
fNpar; ++i) {
5127 for (j = 1; j <= i-1; ++j) {
5132 if (
fG2[i-1] <= 0)
fG2[i-1] = 1;
5137 Printf(
" DEBUG MNMIGR, STARTING MATRIX DIAGONAL, VHMAT=");
5138 for (kk = 1; kk <=
Int_t(vlen); ++kk) {
5152 for (i = 1; i <=
fNpar; ++i) {
5156 for (j = 1; j <= i-1; ++j) {
5165 mnwarn(
"W",
"MIGRAD",
"STARTING MATRIX NOT POS-DEFINITE.");
5175 if (iswtr >= 2)
mnmatu(0);
5181 for (i = 1; i <=
fNpar; ++i) {
5184 for (j = 1; j <=
fNpar; ++j) {
5187 ndex =
m*(
m-1) / 2 +
n;
5194 mnwarn(
"D",
"MIGRAD",
" FIRST DERIVATIVES OF FCN ARE ALL ZERO");
5199 mnwarn(
"D",
"MIGRAD",
" NEWTON STEP NOT DESCENT.");
5200 if (npsdf == 1)
goto L1;
5224 for (i = 1; i <=
fNpar; ++i) {
5227 for (j = 1; j <=
fNpar; ++j) {
5230 ndex =
m*(
m-1) / 2 +
n;
5236 gdgssq += gami*gami;
5238 delgam +=
fDirin[i-1]*gami;
5243 if (
fEDM < 0 || gvg <= 0) {
5244 mnwarn(
"D",
"MIGRAD",
"NOT POS-DEF. EDM OR GVG NEGATIVE.");
5246 if (npsdf == 1)
goto L230;
5253 if (iswtr >= 3 || (iswtr == 2 && iter % 10 == 1)) {
5258 mnwarn(
"D",
"MIGRAD",
"NO CHANGE IN FIRST DERIVATIVES OVER LAST STEP");
5261 mnwarn(
"D",
"MIGRAD",
"FIRST DERIVATIVES INCREASING ALONG SEARCH LINE");
5267 for (kk = 1; kk <= 10; ++kk) {
5273 for (i = 1; i <=
fNpar; ++i) {
5274 for (j = 1; j <= i; ++j) {
5275 if(delgam == 0 || gvg == 0)
d = 0;
5278 ndex = i*(i-1) / 2 + j;
5285 if (iswtr >= 3 || ldebug) {
5286 Printf(
" RELATIVE CHANGE IN COV. MATRIX=%5.1f per cent",
fDcovar*100);
5290 for (kk = 1; kk <= 10; ++kk) {
5294 if (delgam <= gvg)
goto L135;
5295 for (i = 1; i <=
fNpar; ++i) {
5298 for (i = 1; i <=
fNpar; ++i) {
5299 for (j = 1; j <= i; ++j) {
5300 ndex = i*(i-1) / 2 + j;
5306 if (
fEDM < rhotol*.1)
goto L300;
5308 for (i = 1; i <=
fNpar; ++i) {
5322 Printf(
" CALL LIMIT EXCEEDED IN MIGRAD.");
5329 Printf(
" MIGRAD FAILS TO FIND IMPROVEMENT");
5332 if (
fEDM < rhotol)
goto L300;
5335 Printf(
" MACHINE ACCURACY LIMITS FURTHER IMPROVEMENT.");
5341 Printf(
" MIGRAD FAILS WITH STRATEGY=0. WILL TRY WITH STRATEGY=1.");
5349 Printf(
" MIGRAD TERMINATED WITHOUT CONVERGENCE.");
5357 Printf(
" MIGRAD MINIMIZATION HAS CONVERGED.");
5362 Printf(
" MIGRAD WILL VERIFY CONVERGENCE AND ERROR MATRIX.");
5367 if (
fEDM > rhotol)
goto L10;
5379 if (iswtr >= 1)
mnmatu(1);
5393 Int_t nbad, ilax, ilax2, ngood, nfcnmi, iin, knt;
5395 if (
fNpar <= 0)
goto L700;
5400 for (knt = 1; knt <=
fNpar; ++knt) {
5404 if (knt >= 7)
break;
5406 if (ilax == 0)
break;
5407 if (ilax > 0 && ilax <=
fNu) {
5408 if (
fNiofex[ilax-1] > 0)
goto L565;
5410 Printf(
" PARAMETER NUMBER %3d NOT A VARIABLE. IGNORED.",ilax);
5416 mnmnot(ilax, ilax2, val2pl, val2mi);
5420 if (
fErp[iin-1] > 0) ++ngood;
5422 if (
fErn[iin-1] < 0) ++ngood;
5430 if (ngood == 0 && nbad == 0)
goto L700;
5431 if (ngood > 0 && nbad == 0)
fCstatu =
"SUCCESSFUL";
5432 if (ngood == 0 && nbad > 0)
fCstatu =
"FAILURE ";
5433 if (ngood > 0 && nbad > 0)
fCstatu =
"PROBLEMS ";
5443 Printf(
" NEW MINIMUM FOUND. GO BACK TO MINIMIZATION STEP.");
5444 Printf(
" =================================================");
5454 Printf(
" THERE ARE NO MINOS ERRORS TO CALCULATE.");
5471 Double_t abest, xunit, dc, ut, sigsav, du1;
5473 Int_t marc, isig, mpar, ndex, imax, indx, ierr, i, j;
5474 Int_t iercr, it, istrav, nfmxin, nlimit, isw2, isw4;
5488 for (i = 1; i <= mpar; ++i) {
fXt[i-1] =
fX[i-1]; }
5489 i__1 = mpar*(mpar + 1) / 2;
5491 for (i = 1; i <= mpar; ++i) {
5500 if (
fNvarl[ilax-1] == 1) {
5504 ndex = it*(it + 1) / 2;
5507 for (i = 1; i <= mpar; ++i) {
5508 if (i == it)
continue;
5517 Printf(
" MINUIT ERROR. CANNOT FIX PARAMETER %4d INTERNAL %3d",ilax,it);
5523 for (isig = 1; isig <= 2; ++isig) {
5533 Printf(
" DETERMINATION OF %sTIVE MINOS ERROR FOR PARAMETER %d %s"
5534 ,(
const char*)csig,ilax
5535 ,(
const char*)
fCpnam[ilax-1]);
5538 mnwarn(
"D",
"MINOS",
"NO COVARIANCE MATRIX.");
5540 nlimit =
fNfcn + nfmxin;
5543 fU[ilax-1] = ut + sig*du1;
5546 delu =
fU[ilax-1] - ut;
5549 if ( (delu == 0 && ut == 0) ||
5551 fac = delu /
fMNOTw[it-1];
5552 for (i = 1; i <=
fNpar; ++i) {
5556 Printf(
" PARAMETER %4d SET TO%11.3e + %10.3e = %12.3e",ilax,ut,delu,
fU[ilax-1]);
5567 if (abest -
fAmin >
fUp*.01)
goto L650;
5568 if (iercr == 1)
goto L440;
5569 if (iercr == 2)
goto L450;
5570 if (iercr == 3)
goto L460;
5574 Printf(
" THE %4sTIVE MINOS ERROR OF PARAMETER %3d %10s, IS %12.4e"
5575 ,(
const char*)csig,ilax
5576 ,(
const char*)
fCpnam[ilax-1],eros);
5582 Printf(
" THE %4sTIVE MINOS ERROR OF PARAMETER %3d, %s EXCEEDS ITS LIMIT."
5583 ,(
const char*)csig,ilax
5584 ,(
const char*)
fCpnam[ilax-1]);
5590 Printf(
" THE %4sTIVE MINOS ERROR %4d REQUIRES MORE THAN %5d FUNCTION CALLS."
5591 ,(
const char*)csig,ilax,nfmxin);
5597 Printf(
" %4sTIVE MINOS ERROR NOT CALCULATED FOR PARAMETER %d"
5598 ,(
const char*)csig,ilax);
5604 Printf(
" **************************************************************************");
5608 if (ilax2 > 0 && ilax2 <=
fNu) val2mi =
fU[ilax2-1];
5611 if (ilax2 > 0 && ilax2 <=
fNu) val2pl =
fU[ilax2-1];
5618 i__1 = mpar*(mpar + 1) / 2;
5620 for (i = 1; i <= mpar; ++i) {
5669 Double_t vplu, a_small, gsmin, pinti, vminu, danger, sav, sav2;
5670 Int_t ierr, kint, in, ix, ktofix, lastin, kinfix, nvl;
5678 Printf(
" MINUIT USER ERROR. PARAMETER NUMBER IS %3d ALLOWED RANGE IS ONE TO %4d",k,
fMaxext);
5683 if (
fNvarl[k-1] < 0)
goto L50;
5686 for (ix = 1; ix <=
fNpfix; ++ix) {
5687 if (
fIpfix[ix-1] == k) ktofix = k;
5690 mnwarn(
"W",
"PARAM DEF",
"REDEFINING A FIXED PARAMETER.");
5692 Printf(
" CANNOT RELEASE. MAX NPAR EXCEEDED.");
5703 Printf(
" PARAMETER DEFINITIONS:");
5704 Printf(
" NO. NAME VALUE STEP SIZE LIMITS");
5707 if (wk > 0)
goto L122;
5710 Printf(
" %5d %-10s %13.5e constant",k,(
const char*)cnamk,uk);
5715 if (
a == 0 &&
b == 0) {
5719 Printf(
" %5d %-10s %13.5e%13.5e no limits",k,(
const char*)cnamk,uk,wk);
5726 Printf(
" %5d %-10s %13.5e%13.5e %13.5e%13.5e",k,(
const char*)cnamk,uk,wk,
a,
b);
5732 Printf(
" MINUIT USER ERROR. TOO MANY VARIABLE PARAMETERS.");
5735 if (nvl == 1)
goto L200;
5737 Printf(
" USER ERROR IN MINUIT PARAMETER");
5739 Printf(
" UPPER AND LOWER LIMITS EQUAL.");
5746 mnwarn(
"W",
"PARAM DEF",
"PARAMETER LIMITS WERE REVERSED.");
5753 danger = (
b - uk)*(uk -
a);
5755 mnwarn(
"W",
"PARAM DEF",
"STARTING VALUE OUTSIDE LIMITS.");
5758 mnwarn(
"W",
"PARAM DEF",
"STARTING VALUE IS AT LIMIT.");
5776 for (ix = 1; ix <= k-1; ++ix) {
if (
fNiofex[ix-1] > 0) ++lastin; }
5778 if (kint ==
fNpar)
goto L280;
5781 for (in =
fNpar; in >= lastin + 1; --in) {
5795 for (in = lastin + 1; in <= kint; ++in) {
5818 mnpint(sav, ix-1, pinti);
5820 fXt[in-1] =
fX[in-1];
5823 mnpint(sav2, ix-1, pinti);
5824 vplu = pinti -
fX[in-1];
5826 mnpint(sav2, ix-1, pinti);
5827 vminu = pinti -
fX[in-1];
5846 if (kinfix > 0)
mnfixp(kinfix-1, ierr);
5847 if (ierr > 0)
goto L800;
5872 Int_t ierr, kapo1, kapo2;
5873 Int_t k, llist, ibegin, lenbuf, istart, lnc, icy;
5874 TString cnamk, comand, celmnt, ctemp;
5877 lenbuf = strlen((
const char*)crdbuf);
5879 kapo1 = strspn((
const char*)crdbuf,
"'");
5880 if (kapo1 == 0)
goto L150;
5881 kapo2 = strspn((
const char*)crdbuf + kapo1,
"'");
5882 if (kapo2 == 0)
goto L150;
5886 for (istart = 1; istart <= kapo1-1; ++istart) {
5887 if (crdbuf(istart-1,1) !=
' ')
goto L120;
5892 celmnt = crdbuf(istart-1, kapo1-istart);
5893 if (scanf((
const char*)celmnt,&fk)) {;}
5895 if (k <= 0)
goto L210;
5896 cnamk =
"PARAM " + celmnt;
5897 if (kapo2 - kapo1 > 1) {
5898 cnamk = crdbuf(kapo1, kapo2-1-kapo1);
5901 for (icy = kapo2 + 1; icy <= lenbuf; ++icy) {
5902 if (crdbuf(icy-1,1) ==
',')
goto L139;
5903 if (crdbuf(icy-1,1) !=
' ')
goto L140;
5914 ctemp = crdbuf(ibegin-1,lenbuf-ibegin);
5916 if (ierr > 0)
goto L180;
5927 if (scanf((
const char*)crdbuf,&xk,stmp,&uk,&wk,&
a,&
b)) {;}
5930 if (k == 0)
goto L210;
5933 mnparm(k-1, cnamk, uk, wk,
a,
b, ierr);
5960 Double_t a,
f, s, t,
y, s2,
x2,
x3,
x4,
y2, cz[3], xm,
xy, x2y;
5970 for (i = 1; i <= 3; ++i) { cz[i-1] = 0; }
5972 if (npar2p < 3)
goto L10;
5976 for (i = 1; i <= npar2p; ++i) { xm += parx2p[i]; }
5985 for (i = 1; i <= npar2p; ++i) {
5998 if (
a == 0)
goto L10;
6000 cz[1] = (
xy -
x3*cz[2]) /
x2;
6001 cz[0] = (
y -
x2*cz[2]) /
f;
6002 if (npar2p == 3)
goto L6;
6003 sdev2p =
y2 - (cz[0]*
y + cz[1]*
xy + cz[2]*x2y);
6004 if (sdev2p < 0) sdev2p = 0;
6007 cz[0] += xm*(xm*cz[2] - cz[1]);
6008 cz[1] -= xm*2*cz[2];
6010 for (i = 1; i <= 3; ++i) { coef2p[i] = cz[i-1]; }
6032 yy = (pexti - alimi)*2 / (blimi - alimi) - 1;
6037 chbuf2 =
" IS AT ITS LOWER ALLOWED LIMIT.";
6040 chbuf2 =
" IS AT ITS UPPER ALLOWED LIMIT.";
6043 pexti = alimi + (blimi - alimi)*.5*(
TMath::Sin(
a) + 1);
6045 if (yy2 > 1) chbuf2 =
" BROUGHT BACK INSIDE LIMITS.";
6074 if ((
h =
gROOT->GetPluginManager()->FindHandler(
"TMinuitGraph"))) {
6076 if (
h->LoadPlugin() != -1)
6084 Double_t bwidx, bwidy, xbest, ybest, ax, ay, bx, by;
6085 Double_t xvalus[12], any, dxx, dyy;
6086 Int_t iten, i, j, k, maxnx, maxny, iquit, ni, linodd;
6087 Int_t nxbest, nybest, km1, ibk, isp1, nx, ny, ks, ix;
6096 if (maxnx < 10) maxnx = 10;
6098 if (maxny < 10) maxny = 10;
6099 if (nxypt <= 1)
return;
6105 for (i = 1; i <= km1; ++i) {
6108 for (j = 1; j <= ni; ++j) {
6109 if (ypt[j-1] > ypt[j])
continue;
6121 if (iquit == 0)
break;
6126 for (i = 1; i <= nxypt; ++i) {
6127 if (xpt[i-1] >
xmax)
xmax = xpt[i-1];
6128 if (xpt[i-1] <
xmin)
xmin = xpt[i-1];
6135 ymin = ypt[nxypt-1];
6143 if (chbest ==
' ')
goto L50;
6153 for (i = 1; i <= nxypt; ++i) {
6154 xpt[i-1] = ax*xpt[i-1] + bx;
6155 ypt[i-1] = any - ay*ypt[i-1] - by;
6157 nxbest =
Int_t((ax*xbest + bx));
6158 nybest =
Int_t((any - ay*ybest - by));
6165 for (i = 1; i <= ny; ++i) {
6166 for (ibk = 1; ibk <= nx; ++ibk) { cline[ibk-1] =
' '; }
6171 if (nx>0) cline[nx-1] =
'.';
6172 cline[nxbest-1] =
'.';
6173 if (i != 1 && i != nybest && i != ny)
goto L320;
6174 for (j = 1; j <= nx; ++j) { cline[j-1] =
'.'; }
6177 if (isp1 > nxypt)
goto L350;
6179 for (k = isp1; k <= nxypt; ++k) {
6180 ks =
Int_t(ypt[k-1]);
6181 if (ks > i)
goto L345;
6182 ix =
Int_t(xpt[k-1]);
6183 if (cline[ix-1] ==
'.')
goto L340;
6184 if (cline[ix-1] ==
' ')
goto L340;
6185 if (cline[ix-1] == chpt[k-1])
continue;
6192 cline[ix-1] = chpt[k-1];
6199 if (linodd == 1 || i == ny)
goto L380;
6202 Printf(
" %s",(
const char*)ctemp);
6206 Printf(
" %14.7g ..%s",yprt,(
const char*)ctemp);
6212 for (ibk = 1; ibk <= nx; ++ibk) {
6214 if (ibk % 10 == 1) cline[ibk-1] =
'/';
6218 for (ibk = 1; ibk <= 12; ++ibk) {
6221 iten = (nx + 9) / 10;
6223 for (ibk = 1; ibk <= iten; ++ibk)
6224 Printf(
"%# 8.3g ", xvalus[ibk-1]);
6227 if (overpr) chmess =
" Overprint character is &";
6228 Printf(
" ONE COLUMN=%13.7g%s",bwidx,(
const char*)chmess);
6251 Int_t iint, iext, nvl;
6253 Int_t iuext = iuext1 + 1;
6257 if (iuext == 0)
goto L100;
6261 if (iint >
fNpar)
goto L100;
6267 if (iext >
fNu)
goto L100;
6273 if (nvl < 0)
goto L100;
6276 if (iint > 0) err =
fWerr[iint-1];
6278 xlolim =
fAlim[iext-1];
6279 xuplim =
fBlim[iext-1];
6285 chnam =
"undefined";
6309 static const TString cblank =
" ";
6315 Int_t nadd, i, k,
l,
m, ikode, ic, nc, ntrail, lbl;
6317 TString colhdl[6], colhdu[6], cx2, cx3, cheval;
6320 Printf(
" THERE ARE CURRENTLY NO PARAMETERS DEFINED");
6326 ikode =
fISW[1] + 1;
6327 if (ikode > 3) ikode = 3;
6330 for (k = 1; k <= 6; ++k) {
6331 colhdu[k-1] =
"UNDEFINED";
6332 colhdl[k-1] =
"COLUMN HEAD";
6339 if (fval ==
fUndefi) cheval =
" unknown ";
6340 else cheval.
Form(
"%g",fval);
6346 Printf(
" FCN=%s FROM %8s STATUS=%10s %6d CALLS %9d TOTAL"
6347 ,(
const char*)cheval
6352 Printf(
" EDM=%s STRATEGY=%2d %s"
6358 Printf(
" EDM=%s STRATEGY=%2d ERROR MATRIX UNCERTAINTY %5.1f per cent"
6359 ,(
const char*)chedm,
fIstrat,dc);
6362 if (ikode == 0)
return;
6365 for (i = 1; i <=
fNu; ++i) {
6366 if (
fNvarl[i-1] < 0)
continue;
6367 for (ic = 10; ic >= 1; --ic) {
6368 if (
fCpnam[i-1](ic-1,1) !=
" ")
goto L16;
6373 if (lbl < ntrail) ntrail = lbl;
6375 nadd = ntrail / 2 + 1;
6378 colhdl[0] =
" ERROR ";
6379 colhdu[1] =
" PHYSICAL";
6380 colhdu[2] =
" LIMITS ";
6381 colhdl[1] =
" NEGATIVE ";
6382 colhdl[2] =
" POSITIVE ";
6386 colhdl[0] =
" ERROR ";
6387 colhdu[1] =
" INTERNAL ";
6388 colhdl[1] =
" STEP SIZE ";
6389 colhdu[2] =
" INTERNAL ";
6390 colhdl[2] =
" VALUE ";
6394 colhdl[0] =
" ERROR ";
6395 colhdu[1] =
" STEP ";
6396 colhdl[1] =
" SIZE ";
6397 colhdu[2] =
" FIRST ";
6398 colhdl[2] =
" DERIVATIVE ";
6401 colhdu[0] =
" PARABOLIC ";
6402 colhdl[0] =
" ERROR ";
6403 colhdu[1] =
" MINOS ";
6404 colhdu[2] =
"ERRORS ";
6405 colhdl[1] =
" NEGATIVE ";
6406 colhdl[2] =
" POSITIVE ";
6410 if (
fISW[1] < 3) colhdu[0] =
" APPROXIMATE ";
6411 if (
fISW[1] < 1) colhdu[0] =
" CURRENT GUESS";
6413 Printf(
" EXT PARAMETER %-14s%-14s%-14s",(
const char*)colhdu[0]
6414 ,(
const char*)colhdu[1]
6415 ,(
const char*)colhdu[2]);
6416 Printf(
" NO. NAME VALUE %-14s%-14s%-14s",(
const char*)colhdl[0]
6417 ,(
const char*)colhdl[1]
6418 ,(
const char*)colhdl[2]);
6420 for (i = 1; i <=
fNu; ++i) {
6421 if (
fNvarl[i-1] < 0)
continue;
6423 cnambf = cblank(0,nadd) +
fCpnam[i-1];
6424 if (
l == 0)
goto L55;
6427 cx2 =
"PLEASE GET X..";
6428 cx3 =
"PLEASE GET X..";
6431 Printf(
"%4d %-11s%14.5e%14.5e",i,(
const char*)cnambf,
fU[i-1],
x1);
6446 cx3 =
"** at limit **";
6451 if (
x2 == 0) cx2 =
" ";
6454 if (
x3 == 0) cx3 =
" ";
6457 if (cx2 ==
"PLEASE GET X..") cx2.
Form(
"%14.5e",
x2);
6458 if (cx3 ==
"PLEASE GET X..") cx3.
Form(
"%14.5e",
x3);
6459 Printf(
"%4d %-11s%14.5e%14.5e%-14s%-14s",i
6460 ,(
const char*)cnambf,
fU[i-1],
x1
6461 ,(
const char*)cx2,(
const char*)cx3);
6464 if (
fNvarl[i-1] <= 1 || ikode == 3)
continue;
6466 Printf(
" WARNING - - ABOVE PARAMETER IS AT LIMIT.");
6472 colhdu[0] =
" constant ";
6473 if (
fNvarl[i-1] > 0) colhdu[0] =
" fixed ";
6474 if (
fNvarl[i-1] == 4 && ikode == 1) {
6475 Printf(
"%4d %-11s%14.5e%-14s%14.5e%14.5e",i
6476 ,(
const char*)cnambf,
fU[i-1]
6477 ,(
const char*)colhdu[0],
fAlim[i-1],
fBlim[i-1]);
6479 Printf(
"%4d %-11s%14.5e%s",i
6480 ,(
const char*)cnambf,
fU[i-1],(
const char*)colhdu[0]);
6498 Double_t dgmin, padd, pmin, pmax, dg, epspdf, epsmin;
6499 Int_t ndex, i, j, ndexd, ip, ifault;
6506 for (i = 1; i <=
fNpar; ++i) {
6507 ndex = i*(i + 1) / 2;
6508 if (
fVhmat[ndex-1] <= 0) {
6514 dg = epspdf + 1 - dgmin;
6520 for (i = 1; i <=
fNpar; ++i) {
6524 if (
fVhmat[ndexd-1]==0) {
6529 for (j = 1; j <= i; ++j) {
6538 for (ip = 2; ip <=
fNpar; ++ip) {
6544 Printf(
" EIGENVALUES OF SECOND-DERIVATIVE MATRIX:");
6546 for (ip = 1; ip <=
fNpar; ++ip) {
6551 if (pmin > epspdf*pmax)
return;
6553 padd = pmax*.001 - pmin;
6554 for (ip = 1; ip <=
fNpar; ++ip) {
6555 ndex = ip*(ip + 1) / 2;
6556 fVhmat[ndex-1] *= padd + 1;
6559 mnwarn(
"W",
fCfrom,
Form(
"MATRIX FORCED POS-DEF BY ADDING %f TO DIAGONAL.",padd));
6579 for (i = 1; i <=
fNpar; ++i) {
fX[i-1] = pnew[i-1]; }
6587 for (j = 2; j <= nparp1; ++j) {
if (
y[j-1] >
y[jh-1]) jh = j; }
6588 fEDM =
y[jh-1] -
y[jl-1];
6589 if (
fEDM <= 0)
goto L45;
6590 for (i = 1; i <=
fNpar; ++i) {
6593 for (j = 2; j <= nparp1; ++j) {
6597 fDirin[i-1] = pbig - plit;
6602 Printf(
" FUNCTION VALUE DOES NOT SEEM TO DEPEND ON ANY OF THE %d VARIABLE PARAMETERS.",
fNpar);
6603 Printf(
" VERIFY THAT STEP SIZES ARE BIG ENOUGH AND CHECK FCN LOGIC.");
6604 Printf(
" *******************************************************************************");
6605 Printf(
" *******************************************************************************");
6622 static std::atomic<Int_t> g_iseed( 12345 );
6628 g_iseed.store(inseed, std::memory_order_release);
6632 int starting_seed = g_iseed.load( std::memory_order_acquire );
6636 next_seed = inseed = starting_seed;
6639 k = next_seed / 53668;
6640 next_seed = (next_seed - k*53668)*40014 - k*12211;
6641 if (next_seed < 0) next_seed += 2147483563;
6643 val =
Double_t(next_seed*4.656613e-10);
6648 }
while (! g_iseed.compare_exchange_strong(starting_seed, next_seed) );
6675 for (i = 1; i <=
fNpar; ++i) {
6696 Printf(
"mnsave is dummy in TMinuit");
6710 Double_t step, uhigh, xhreq, xlreq, ubest, fnext, unext, xh, xl;
6711 Int_t ipar, iint, icall, ncall, nbins, nparx;
6712 Int_t nxypt, nccall, iparwd;
6717 if (ncall <= 1) ncall = 41;
6718 if (ncall > 98) ncall = 98;
6724 if (iparwd > 0)
goto L200;
6729 if (ipar >
fNu)
goto L900;
6731 if (iint <= 0)
goto L100;
6743 if (
fNvarl[ipar-1] > 1)
goto L300;
6746 if (xlreq == xhreq)
goto L250;
6748 step = (xhreq - xlreq) /
Double_t(ncall-1);
6751 xl = ubest -
fWerr[iint-1];
6752 xh = ubest +
fWerr[iint-1];
6753 mnbins(xl, xh, ncall, unext, uhigh, nbins, step);
6758 if (xlreq == xhreq)
goto L350;
6763 if (xl >= xh)
goto L700;
6765 step = (xh - xl) /
Double_t(ncall-1);
6768 unext =
fAlim[ipar-1];
6772 for (icall = 1; icall <= nccall; ++icall) {
6777 fXpt[nxypt-1] = unext;
6778 fYpt[nxypt-1] = fnext;
6779 fChpt[nxypt-1] =
'*';
6780 if (fnext <
fAmin) {
6793 Printf(
"%dSCAN OF PARAMETER NO. %d, %s"
6798 Printf(
" REQUESTED RANGE OUTSIDE LIMITS FOR PARAMETER %d",ipar);
6800 if (iparwd <= 0)
goto L100;
6820 Double_t dxdi, rnum, ftry, rnum1, rnum2, alpha;
6822 Int_t ipar, iext, j, ifail, iseed=0, nparx, istep, ib, mxfail, mxstep;
6825 if (mxfail <= 0) mxfail =
fNpar*20 + 100;
6829 if (alpha <= 0) alpha = 3;
6831 Printf(
" MNSEEK: MONTE CARLO MINIMIZATION USING METROPOLIS ALGORITHM");
6832 Printf(
" TO STOP AFTER %6d SUCCESSIVE FAILURES, OR %7d STEPS",mxfail,mxstep);
6833 Printf(
" MAXIMUM STEP SIZE IS %9.3f ERROR BARS.",alpha);
6845 for (ipar = 1; ipar <=
fNpar; ++ipar) {
6848 if (
fNvarl[iext-1] > 1) {
6851 if (dxdi == 0) dxdi = 1;
6854 fDirin[ipar-1] = 6.2831859999999997;
6861 for (istep = 1; istep <= mxstep; ++istep) {
6862 if (ifail >= mxfail)
break;
6863 for (ipar = 1; ipar <=
fNpar; ++ipar) {
6893 Printf(
" MNSEEK: %5d SUCCESSIVE UNSUCCESSFUL TRIALS.",ifail);
6916 static const char *
const cname[30] = {
6948 static constexpr Int_t nname = 25;
6949 static constexpr Int_t nntot =
sizeof(
cname)/
sizeof(
char*);
6950 static const TString cprlev[5] = {
6951 "-1: NO OUTPUT EXCEPT FROM SHOW ",
6952 " 0: REDUCED OUTPUT ",
6953 " 1: NORMAL OUTPUT ",
6954 " 2: EXTRA OUTPUT FOR PROBLEM CASES",
6955 " 3: MAXIMUM OUTPUT "};
6957 static const TString cstrat[3] = {
6958 " 0: MINIMIZE THE NUMBER OF CALLS TO FUNCTION",
6959 " 1: TRY TO BALANCE SPEED AGAINST RELIABILITY",
6960 " 2: MAKE SURE MINIMUM TRUE, ERRORS CORRECT "};
6962 static const TString cdbopt[7] = {
6963 "REPORT ALL EXCEPTIONAL CONDITIONS ",
6964 "MNLINE: LINE SEARCH MINIMIZATION ",
6965 "MNDERI: FIRST DERIVATIVE CALCULATIONS ",
6966 "MNHESS: SECOND DERIVATIVE CALCULATIONS ",
6967 "MNMIGR: COVARIANCE MATRIX UPDATES ",
6968 "MNHES1: FIRST DERIVATIVE UNCERTAINTIES ",
6969 "MNCONT: MNCONTOUR PLOT (MNCROS SEARCH) "};
6976 Int_t iset, iprm, i, jseed, kname, iseed, iunit,
id, ii, kk;
6977 Int_t ikseed, idbopt, igrain=0, iswsav, isw2;
6978 TString cfname, cmode, ckind, cwarn, copt, ctemp, ctemp2;
6981 for (i = 1; i <= nntot; ++i) {
6985 if (strstr(ctemp2.
Data(),ckind.
Data()))
goto L5;
6993 if ( ctemp2.
Contains(
"HEL"))
goto L2000;
6994 if ( ctemp2.
Contains(
"SHO"))
goto L1000;
6995 if (!ctemp2.
Contains(
"SET"))
goto L1900;
6999 if (kname <= 0)
goto L1900;
7001 switch ((
int)kname) {
7019 case 18:
goto L3000;
7021 case 20:
goto L3000;
7026 case 25:
goto L3000;
7027 case 26:
goto L1900;
7037 if (iprm >
fNu)
goto L25;
7038 if (iprm <= 0)
goto L25;
7039 if (
fNvarl[iprm-1] < 0)
goto L25;
7051 Printf(
" UNDEFINED PARAMETER NUMBER. IGNORED.");
7082 for (i = 1; i <=
fNpar; ++i) {
7110 mnwarn(
"W",
"SHO",
"SHO");
7118 Printf(
" MINUIT RANDOM NUMBER SEED SET TO %d",jseed);
7130 if (
fISW[4] > 0)
goto L1172;
7148 if (
fISW[4] >= 0)
goto L1220;
7153 if (
fISW[4] >= 0)
goto L1100;
7158 if (
fISW[4] >= 0)
goto L1100;
7169 if (idbopt > 6)
goto L288;
7171 fIdbg[idbopt] = iset;
7172 if (iset == 1)
fIdbg[0] = 1;
7175 for (
id = 0;
id <= 6; ++
id) {
fIdbg[
id] = iset; }
7178 mnwarn(
"D",
"SHO",
"SHO");
7181 Printf(
" UNKNOWN DEBUG OPTION %d REQUESTED. IGNORED",idbopt);
7192 if (kname <= 0)
goto L1900;
7194 switch ((
int)kname) {
7204 case 10:
goto L1100;
7205 case 11:
goto L1110;
7206 case 12:
goto L1120;
7207 case 13:
goto L1130;
7208 case 14:
goto L1130;
7209 case 15:
goto L1150;
7210 case 16:
goto L1160;
7211 case 17:
goto L1170;
7212 case 18:
goto L1180;
7213 case 19:
goto L1190;
7214 case 20:
goto L1200;
7215 case 21:
goto L1210;
7216 case 22:
goto L1220;
7217 case 23:
goto L1100;
7218 case 24:
goto L1100;
7219 case 25:
goto L1250;
7220 case 26:
goto L1900;
7221 case 27:
goto L1270;
7222 case 28:
goto L1270;
7223 case 29:
goto L1290;
7224 case 30:
goto L1300;
7254 Printf(
" ALLOWED PRINT LEVELS ARE:");
7255 Printf(
" %s",cprlev[0].Data());
7256 Printf(
" %s",cprlev[1].Data());
7257 Printf(
" %s",cprlev[2].Data());
7258 Printf(
" %s",cprlev[3].Data());
7259 Printf(
" %s",cprlev[4].Data());
7260 Printf(
" CURRENT PRINTOUT LEVEL IS %s",cprlev[
fISW[4]+1].Data());
7265 Printf(
" NOGRAD IS SET. DERIVATIVES NOT COMPUTED IN FCN.");
7267 Printf(
" GRAD IS SET. USER COMPUTES DERIVATIVES IN FCN.");
7272 Printf(
" ERRORS CORRESPOND TO FUNCTION CHANGE OF %g",
fUp);
7296 cmode =
"BATCH MODE ";
7297 if (
fISW[5] == 1) cmode =
"INTERACTIVE MODE";
7298 if (! lname) cfname =
"unknown";
7299 Printf(
" INPUT NOW BEING READ IN %s FROM UNIT NO. %d FILENAME: %s"
7300 ,(
const char*)cmode,
fIsysrd,(
const char*)cfname);
7312 cwarn =
"SUPPRESSED";
7313 if (
fLwarn) cwarn =
"REPORTED ";
7314 Printf(
"%s",(
const char*)cwarn);
7322 Printf(
" MINUIT RNDM SEED IS CURRENTLY=%d",ikseed);
7329 Printf(
" TITLE OF CURRENT TASK IS:%s",(
const char*)
fCtitl);
7333 Printf(
" ALLOWED STRATEGIES ARE:");
7334 Printf(
" %s",cstrat[0].Data());
7335 Printf(
" %s",cstrat[1].Data());
7336 Printf(
" %s",cstrat[2].Data());
7338 Printf(
" NOW USING STRATEGY %s",(
const char*)cstrat[
fIstrat]);
7355 Printf(
" NO PAGE THROWS IN MINUIT OUTPUT");
7360 for (ii = 1; ii <=
fNpar; ++ii) {
7361 if (
fErp[ii-1] > 0 ||
fErn[ii-1] < 0)
goto L1204;
7363 Printf(
" THERE ARE NO MINOS ERRORS CURRENTLY VALID.");
7370 Printf(
" FLOATING-POINT NUMBERS ASSUMED ACCURATE TO %g",
fEpsmac);
7378 Printf(
" THIS IS MINUIT VERSION:%s",(
const char*)
fCvrsn);
7382 for (
id = 0;
id <= 6; ++
id) {
7384 if (
fIdbg[
id] >= 1) copt =
"ON ";
7385 Printf(
" DEBUG OPTION %3d IS %3s :%s"
7386 ,
id,(
const char*)copt,(
const char*)cdbopt[
id]);
7401 Printf(
" THE COMMAND:%10s IS UNKNOWN.",(
const char*)
fCword);
7408 if (strcmp(ctemp2.
Data(),
"SHO")) ckind =
"SHOW";
7410 Printf(
" THE FORMAT OF THE %4s COMMAND IS:",(
const char*)ckind);
7411 Printf(
" %s xxx [numerical arguments if any]",(
const char*)ckind);
7412 Printf(
" WHERE xxx MAY BE ONE OF THE FOLLOWING:");
7413 for (kk = 1; kk <= nname; ++kk) {
7420 Printf(
" ABOVE COMMAND IS ILLEGAL. IGNORED");
7434 static constexpr Double_t alpha = 1;
7435 static constexpr Double_t beta = .5;
7436 static constexpr Double_t gamma = 2;
7437 static constexpr Double_t rhomin = 4;
7438 static constexpr Double_t rhomax = 8;
7441 Double_t dmin_, dxdi, yrho,
f, ynpp1, aming, ypbar;
7443 Double_t absmin, rho, sig2, rho1, rho2;
7444 Int_t npfn, i, j, k, jhold, ncycl, nparx;
7445 Int_t nparp1, kg, jh, nf, jl, ns;
7447 if (
fNpar <= 0)
return;
7456 rho2 = rho1 + alpha*gamma;
7459 Printf(
" START SIMPLEX MINIMIZATION. CONVERGENCE WHEN EDM .LT. %g",
fEpsi);
7461 for (i = 1; i <=
fNpar; ++i) {
7474 for (i = 1; i <=
fNpar; ++i) {
7485 if (
f <= aming)
goto L6;
7487 if (kg == 1)
goto L8;
7491 if (nf < 3)
goto L4;
7501 if (ns < 6)
goto L4;
7505 if (aming < absmin) jl = i;
7506 if (aming < absmin) absmin = aming;
7526 for (i = 1; i <=
fNpar; ++i) {
7534 if (ystar >=
fAmin)
goto L70;
7536 for (i = 1; i <=
fNpar; ++i) {
7544 rho = (rho2*
y1 - rho1*
y2)*.5 / (
y1 -
y2);
7545 if (rho < rhomin)
goto L66;
7546 if (rho > rhomax) rho = rhomax;
7547 for (i = 1; i <=
fNpar; ++i) {
7552 if (yrho <
fSIMPy[jl-1] && yrho < ystst)
goto L65;
7553 if (ystst <
fSIMPy[jl-1])
goto L67;
7554 if (yrho >
fSIMPy[jl-1])
goto L66;
7560 if (ystst <
fSIMPy[jl-1])
goto L67;
7567 if (
fISW[4] < 2)
goto L50;
7568 if (
fISW[4] >= 3 || ncycl % 10 == 0) {
7574 if (ystar >=
fSIMPy[jh-1])
goto L73;
7577 if (jhold != jh)
goto L50;
7580 for (i = 1; i <=
fNpar; ++i) {
7585 if (ystst >
fSIMPy[jh-1])
goto L1;
7587 if (ystst <
fAmin)
goto L67;
7593 Printf(
" SIMPLEX MINIMIZATION HAS CONVERGED.");
7599 Printf(
" SIMPLEX TERMINATES WITHOUT CONVERGENCE.");
7605 for (i = 1; i <=
fNpar; ++i) {
7673 static const TString cpt =
" ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890./;:[]$%*_!@#&+()";
7676 l = strlen((
const char*)cfname);
7677 for (i = 1; i <=
l; ++i) {
7678 for (ic = 1; ic <= 80; ++ic) {
7679 if (cfname[i-1] == cpt[ic-1])
goto L100;
7702 Int_t i, j, k, kp1, km1;
7710 if (
n < 1)
goto L100;
7713 for (i = 1; i <=
n; ++i) {
7715 if (si <= 0)
goto L100;
7718 for (i = 1; i <=
n; ++i) {
7719 for (j = 1; j <=
n; ++j) {
7724 for (i = 1; i <=
n; ++i) {
7727 if (
a[k + k*
l] != 0)
fVERTq[k-1] = 1 /
a[k + k*
l];
7733 if (km1 < 0)
goto L100;
7734 else if (km1 == 0)
goto L50;
7737 for (j = 1; j <= km1; ++j) {
7743 if (k -
n < 0)
goto L51;
7744 else if (k -
n == 0)
goto L60;
7747 for (j = kp1; j <=
n; ++j) {
7754 for (j = 1; j <=
n; ++j) {
7759 for (j = 1; j <=
n; ++j) {
7760 for (k = 1; k <= j; ++k) {
7762 a[j + k*
l] =
a[k + j*
l];
7789 const Int_t kMAXMES = 10;
7790 Int_t ityp, i, ic, nm;
7793 if (corg(0,3) !=
"SHO" || cmes(0,3) !=
"SHO") {
7799 Printf(
" MINUIT WARNING IN %s",(
const char*)corg);
7800 Printf(
" ============== %s",(
const char*)cmes);
7806 Printf(
" MINUIT DEBUG FOR %s",(
const char*)corg);
7807 Printf(
" =============== %s ",(
const char*)cmes);
7832 englsh =
" WAS SUPPRESSED. ";
7833 if (
fNwrmes[ityp-1] > 1) englsh =
"S WERE SUPPRESSED.";
7835 ,(
const char*)ctyp,(
const char*)englsh);
7839 Printf(
" ONLY THE MOST RECENT 10 WILL BE LISTED BELOW.");
7843 Printf(
" CALLS ORIGIN MESSAGE");
7844 for (i = 1; i <= nm; ++i) {
7846 if (ic > kMAXMES) ic = 1;
7862 Double_t denom, ba, al, dx, du1, du2;
7863 Int_t ndex, ierr, i, j, k,
l, ndiag, k1, iin;
7868 ndex =
l*(
l + 1) / 2;
7873 ba =
fBlim[i-1] - al;
7876 if (dx > 1) du1 = ba;
7884 for (i = 1; i <=
fNpar; ++i) {
7887 for (j = 1; j <= i; ++j) {
7895 for (iin = 1; iin <=
fNpar; ++iin) {
7896 ndiag = iin*(iin + 1) / 2;
7898 if (denom <= 1 && denom >= 0)
fGlobcc[iin-1] = 0;
static const double x4[22]
static const double x3[11]
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char cname
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint xy
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize fs
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void reg
Option_t Option_t TPoint TPoint const char y1
static const char charal[29]
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.
R__EXTERN TMinuit * gMinuit
R__EXTERN TVirtualMutex * gROOTMutex
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
void Printf(const char *fmt,...)
Formats a string in a circular formatting buffer and prints the string.
#define R__LOCKGUARD(mutex)
Method or function calling interface.
Implementation in C++ of the Minuit package written by Fred James.
virtual void mnderi()
Calculates the first derivatives of FCN (GRD)
virtual void mnvert(Double_t *a, Int_t l, Int_t m, Int_t n, Int_t &ifail)
Inverts a symmetric matrix.
virtual Int_t GetParameter(Int_t parNo, Double_t ¤tValue, Double_t ¤tError) const
return parameter value and error
virtual Int_t FixParameter(Int_t parNo)
fix a parameter
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 Int_t GetNumPars() const
returns the total number of parameters that have been defined as fixed or free.
virtual void mnpsdf()
Calculates the eigenvalues of v to see if positive-def.
virtual Int_t GetNumFixedPars() const
returns the number of currently fixed parameters
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 Int_t Release(Int_t parNo)
release a parameter
virtual void mnpars(TString &crdbuf, Int_t &icondn)
Implements one parameter definition.
virtual void mnimpr()
Attempts to improve on a good local minimum.
virtual void BuildArrays(Int_t maxpar=15)
Create internal Minuit arrays for the maxpar parameters.
virtual void mnwerr()
Calculates the WERR, external parameter errors.
virtual void mnrset(Int_t iopt)
Resets function value and errors to UNDEFINED.
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.
virtual void mnsimp()
Minimization using the simplex method of Nelder and Mead.
TMethodCall * GetMethodCall() const
TMinuit()
Minuit normal constructor.
virtual void mnamin()
Initialize AMIN.
virtual Int_t SetErrorDef(Double_t up)
To get the n-sigma contour the error def parameter "up" has to set to n^2.
virtual void mncler()
Resets the parameter list to UNDEFINED.
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 Int_t Migrad()
invokes the MIGRAD minimizer
virtual void mncomd(const char *crdbin, Int_t &icondn)
Reads a command string and executes.
TString * fCpnam
Character to be plotted at the X,Y contour positions.
TMethodCall * fMethodCall
virtual void mngrad()
Interprets the SET GRAD command.
~TMinuit() override
Minuit default destructor.
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 void mnmnos()
Performs a MINOS error analysis.
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.
virtual void mncuve()
Makes sure that the current point is a local minimum.
virtual void mnscan()
Scans the values of FCN as a function of one parameter.
virtual void DeleteArrays()
Delete internal Minuit arrays.
TObject * Clone(const char *newname="") const override
Make a clone of an object using the Streamer facility.
TString fWarmes[kMAXWARN]
virtual void mnsave()
Writes current parameter values and step sizes onto file ISYSSA.
virtual void mnmatu(Int_t kode)
Prints the covariance matrix v when KODE=1.
virtual void mnlims()
Interprets the SET LIM command, to reset the parameter limits.
void(* fFCN)(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag)
virtual void SetMaxIterations(Int_t maxiter=500)
virtual void SetFCN(void(*fcn)(Int_t &, Double_t *, Double_t &f, Double_t *, Int_t))
To set the address of the minimization function.
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.
virtual void mninit(Int_t i1, Int_t i2, Int_t i3)
Main initialization member function for MINUIT.
virtual void mnseek()
Performs a rough (but global) minimization by monte carlo search.
virtual void mncalf(Double_t *pvec, Double_t &ycalf)
Transform FCN to find further minima.
virtual Int_t Command(const char *command)
Execute a Minuit command.
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 Int_t Eval(Int_t npar, Double_t *grad, Double_t &fval, Double_t *par, Int_t flag)
Evaluate the minimisation function Input parameters:
virtual void mnmigr()
Performs a local function minimization.
virtual void mnemat(Double_t *emat, Int_t ndim)
Calculates the external error matrix from the internal matrix.
virtual void mnrn15(Double_t &val, Int_t &inseed)
This is a super-portable random number generator.
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 mnexin(Double_t *pint)
Transforms the external parameter values U to internal values.
virtual void mnexcm(const char *comand, Double_t *plist, Int_t llist, Int_t &ierflg)
Interprets a command and takes appropriate action.
virtual void mnhelp(TString comd)
HELP routine for MINUIT interactive commands.
virtual Int_t SetPrintLevel(Int_t printLevel=0)
set Minuit print level.
Bool_t mnunpt(TString &cfname)
Returns .TRUE.
virtual void mnhess()
Calculates the full second-derivative matrix of FCN.
virtual void mneval(Double_t anext, Double_t &fnext, Int_t &ierev)
Evaluates the function being analysed by MNCROS.
virtual void mnset()
Interprets the commands that start with SET and SHOW.
virtual void mndxdi(Double_t pint, Int_t ipar, Double_t &dxdi)
Calculates the transformation factor between ext/internal values.
virtual void mntiny(Double_t epsp1, Double_t &epsbak)
To find the machine precision.
virtual void mninex(Double_t *pint)
Transforms from internal coordinates (PINT) to external (U)
virtual void mnpint(Double_t &pexti, Int_t i, Double_t &pinti)
Calculates the internal parameter value PINTI.
virtual void mnfixp(Int_t iint, Int_t &ierr)
Removes parameter IINT from the internal parameter list.
virtual void mnmnot(Int_t ilax, Int_t ilax2, Double_t &val2pl, Double_t &val2mi)
Performs a MINOS error analysis on one parameter.
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.
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 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.
virtual void mnwarn(const char *copt, const char *corg, const char *cmes)
Prints Warning messages.
virtual void mnprin(Int_t inkode, Double_t fval)
Prints the values of the parameters at the time of the call.
TString fOrigin[kMAXWARN]
virtual void mncros(Double_t &aopt, Int_t &iercr)
Find point where MNEVAL=AMIN+UP.
virtual Int_t GetNumFreePars() const
returns the number of currently free parameters
virtual void mnhes1()
Calculate first derivatives (GRD) and uncertainties (DGRD)
virtual void mnfree(Int_t k)
Restores one or more fixed parameter(s) to variable status.
virtual void mncntr(Int_t ke1, Int_t ke2, Int_t &ierrf)
Print function contours in two variables, on line printer.
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.
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.
The TNamed class is the base class for all named ROOT classes.
TObject * Clone(const char *newname="") const override
Make a clone of an object using the Streamer facility.
Mother of all ROOT objects.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual void Execute(const char *method, const char *params, Int_t *error=nullptr)
Execute method on this object with the given parameter string, e.g.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
const char * Data() const
void Resize(Ssiz_t n)
Resize the string. Truncate or add blanks as necessary.
void ToUpper()
Change string to upper case.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Double_t ASin(Double_t)
Returns the principal value of the arc sine of x, expressed in radians.
Double_t ATan(Double_t)
Returns the principal value of the arc tangent of x, expressed in radians.
Double_t Log(Double_t x)
Returns the natural logarithm of x.
Double_t Sqrt(Double_t x)
Returns the square root of x.
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Returns x raised to the power y.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
Double_t Log10(Double_t x)
Returns the common (base-10) logarithm of x.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.