333 const char charal[29] =
" .ABCDEFGHIJKLMNOPQRSTUVWXYZ";
422 fGraphicsMode =
kTRUE;
440 fGraphicsMode =
kTRUE;
449 gROOT->GetListOfSpecials()->Add(gMinuit);
477 gROOT->GetListOfSpecials()->Add(gMinuit);
486 Error(
"TMinuit",
"can not copy construct TMinuit");
500 if (
gROOT != 0 &&
gROOT->GetListOfSpecials() != 0)
gROOT->GetListOfSpecials()->Remove(
this);
502 if (gMinuit ==
this) gMinuit = 0;
583 for (
int i = 0; i <
fMaxpar; i++) {
664 mncont(pa1,pa2,npoints,xcoor,ycoor,npfound);
667 Warning(
"Contour",
"Cannot find more than 4 points, no TGraph returned");
668 fStatus= (npfound==0 ? 1 : npfound);
673 if (npfound!=npoints) {
675 Warning(
"Contour",
"Returning a TGraph with %d points only",npfound);
680 xcoor[npoints] = xcoor[0];
681 ycoor[npoints] = ycoor[0];
684 if ((h =
gROOT->GetPluginManager()->FindHandler(
"TMinuitGraph"))) {
701 mnparm( parNo, sname, initVal, initErr, lowerLimit, upperLimit, err);
822 if (
fFCN) (*fFCN)(npar,grad,fval,
par,flag);
835 mnexcm(
"FIX", tmp, 1, err );
849 mnpout( parNo, name, currentValue, currentError, bnd1, bnd2, err );
888 mnexcm(
"MIGRAD", tmp, 0, err );
902 mnexcm(
"RELEASE", tmp, 1, err );
914 mnexcm(
"SET ERRDEF", &up, 1, err );
983 mnexcm(
"SET PRINT", tmp, 1, err );
985 if (printLevel <=-1)
mnexcm(
"SET NOWarnings",tmp,0,err);
1006 Printf(
" FIRST CALL TO USER FUNCTION AT NEW START POINT, WITH IFLAG=4.");
1027 Double_t awid,ah, al, sigfig, sigrnd, alb;
1028 Int_t kwid, lwid, na=0, log_;
1032 if (al == ah) ah = al + 1;
1035 if (naa == -1)
goto L150;
1044 if (awid <= 1) --log_;
1047 if (sigfig > 2)
goto L40;
1051 if (sigfig > 2.5)
goto L50;
1055 if (sigfig > 5)
goto L60;
1066 if (bwid <= 0)
goto L10;
1070 if (alb < 0) --lwid;
1072 alb = ah / bwid + 1;
1074 if (alb < 0) --kwid;
1077 if (naa > 5)
goto L240;
1078 if (naa == -1)
return;
1080 if (naa > 1 || nb == 1)
return;
1085 if (nb << 1 != naa)
return;
1101 Int_t ndex, i, j,
m,
n, nparx;
1107 for (i = 1; i <=
fNpar; ++i) {
1109 for (j = 1; j <=
fNpar; ++j) {
1112 ndex = m*(m-1) / 2 + n;
1117 for (i = 1; i <=
fNpar; ++i) {denom +=
fGrd[i-1]*(
fXt[i-1] - pvec[i-1]); }
1123 ycalf = (f -
fApsi) / denom;
1142 for (i = 1; i <=
fMaxext; ++i) {
1165 static TString clabel =
"0123456789ABCDEFGHIJ";
1169 Double_t fcna[115], fcnb[115], contur[20];
1170 Double_t ylabel, fmn, fmx, xlo, ylo, xup, yup;
1171 Double_t devs, xsav, ysav, bwidx, bwidy, unext, ff, xb4;
1172 Int_t i, ngrid, ixmid, nparx, ix,
nx,
ny, ki1, ki2, ixzero, iy, ics;
1177 if (ke1 <= 0 || ke2 <= 0)
goto L1350;
1178 if (ke1 >
fNu || ke2 >
fNu)
goto L1350;
1181 if (ki1 <= 0 || ki2 <= 0)
goto L1350;
1182 if (ki1 == ki2)
goto L1350;
1192 if (devs <= 0) devs = 2;
1193 xlo =
fU[ke1-1] - devs*
fWerr[ki1-1];
1194 xup =
fU[ke1-1] + devs*fWerr[ki1-1];
1195 ylo =
fU[ke2-1] - devs*fWerr[ki2-1];
1196 yup =
fU[ke2-1] + devs*fWerr[ki2-1];
1208 if (nx < 11) nx = 11;
1209 if (ny < 11) ny = 11;
1210 if (nx >= 115) nx = 114;
1221 bwidx = (xup - xlo) /
Double_t(nx);
1222 bwidy = (yup - ylo) /
Double_t(ny);
1223 ixmid =
Int_t(((xsav - xlo)*
Double_t(nx) / (xup - xlo)) + 1);
1224 if (ixmid < 1) ixmid = 1;
1227 for (i = 1; i <= 20; ++i) { contur[i-1] =
fAmin +
fUp*(i-1)*(i-1); }
1228 contur[0] +=
fUp*.01;
1237 for (ix = 1; ix <= nx + 1; ++ix) {
1241 if (xb4 < 0 &&
fU[ke1-1] > 0) ixzero = ix - 1;
1246 Printf(
" Y-AXIS: PARAMETER %3d: %s",ke2,(
const char*)
fCpnam[ke2-1]);
1248 chzero[ixzero-1] =
'+';
1253 for (iy = 1; iy <=
ny; ++iy) {
1254 unext =
fU[ke2-1] - bwidy;
1259 chln[ixmid-1] =
'*';
1260 if (ixzero != 0) chln[ixzero-1] =
':';
1261 if (
fU[ke2-1] > ysav && unext < ysav) chln = chmid;
1262 if (
fU[ke2-1] > 0 && unext < 0) chln = chzero;
1264 ylabel =
fU[ke2-1] + bwidy*.5;
1266 for (ix = 1; ix <= nx + 1; ++ix) {
1267 fcna[ix-1] = fcnb[ix-1];
1273 for (ix = 1; ix <=
nx; ++ix) {
1280 for (ics = 1; ics <= 20; ++ics) {
1281 if (contur[ics-1] > fmn)
goto L240;
1285 if (contur[ics-1] < fmx) chln[ix-1] = clabel[ics-1];
1288 Printf(
" %12.4g %s",ylabel,(
const char*)chln);
1293 chln(ixmid-1,1) =
'I';
1295 Printf(
" %s",(
const char*)chln);
1300 Printf(
" %12.4g%s%12.4g",xlo,(
const char*)chln,xup);
1301 Printf(
" %s%12.4g",(
const char*)chln,xsav);
1303 Printf(
" %12.4g%s%12.4g%s%12.4g",xlo,(
const char*)chln,xsav,(
const char*)chln,xup);
1305 Printf(
" X-AXIS: PARAMETER %3d %s ONE COLUMN=%12.4g" 1306 ,ke1,(
const char*)
fCpnam[ke1-1],bwidx);
1314 Printf(
" INVALID PARAMETER NUMBER(S) REQUESTED. IGNORED.");
1344 Int_t ierr, ipos, i, llist, lenbuf, lnc;
1346 TString comand, crdbuf, ctemp;
1350 lenbuf = crdbuf.
Length();
1355 for (i = 1; i <=
TMath::Min(20,lenbuf); ++i) {
1356 if (crdbuf[i-1] ==
'\'')
break;
1357 if (crdbuf[i-1] ==
' ') {
1365 if (ipos > lenbuf) {
1366 Printf(
" BLANK COMMAND IGNORED.");
1372 if (crdbuf(ipos-1,3) ==
"PAR") {
1378 if (crdbuf(ipos-1,3) ==
"SET INP") {
1384 if (crdbuf(ipos-1,7) ==
"SET TIT") {
1390 if (crdbuf(ipos-1,7) ==
"SET COV") {
1396 ctemp = crdbuf(ipos-1,lenbuf-ipos+1);
1399 Printf(
" COMMAND CANNOT BE INTERPRETED");
1433 Double_t a1, a2, val2mi, val2pl, dc, sclfac, bigdis, sigsav;
1434 Int_t nall, iold,
line, mpar, ierr, inew, move, next, i, j, nfcol, iercr;
1435 Int_t idist=0, npcol, kints, i2, i1, lr, nfcnco=0, ki1, ki2, ki3, ke3;
1436 Int_t nowpts, istrav, nfmxin, isw2, isw4;
1442 ldebug =
fIdbg[6] >= 1;
1443 if (ke1 <= 0 || ke2 <= 0)
goto L1350;
1444 if (ke1 >
fNu || ke2 >
fNu)
goto L1350;
1447 if (ki1 <= 0 || ki2 <= 0)
goto L1350;
1448 if (ki1 == ki2)
goto L1350;
1449 if (nptu < 4)
goto L1400;
1461 Printf(
" START MNCONTOUR CALCULATION OF %4d POINTS ON CONTOUR.",nptu);
1464 ki3 = 6 - ki1 - ki2;
1466 Printf(
" EACH POINT IS A MINIMUM WITH RESPECT TO PARAMETER %3d %s",ke3,(
const char*)
fCpnam[ke3-1]);
1468 Printf(
" EACH POINT IS A MINIMUM WITH RESPECT TO THE OTHER %3d VARIABLE PARAMETERS.",
fNpar - 2);
1475 mnmnot(ke1, ke2, val2pl, val2mi);
1477 xptu[0] =
fAlim[ke1-1];
1478 mnwarn(
"W",
"MNContour ",
"Contour squeezed by parameter limits.");
1480 if (
fErn[ki1-1] >= 0)
goto L1500;
1481 xptu[0] = u1min +
fErn[ki1-1];
1486 xptu[2] =
fBlim[ke1-1];
1487 mnwarn(
"W",
"MNContour ",
"Contour squeezed by parameter limits.");
1489 if (
fErp[ki1-1] <= 0)
goto L1500;
1490 xptu[2] = u1min +
fErp[ki1-1];
1493 scalx = 1 / (xptu[2] - xptu[0]);
1495 mnmnot(ke2, ke1, val2pl, val2mi);
1497 yptu[1] =
fAlim[ke2-1];
1498 mnwarn(
"W",
"MNContour ",
"Contour squeezed by parameter limits.");
1500 if (
fErn[ki2-1] >= 0)
goto L1500;
1501 yptu[1] = u2min +
fErn[ki2-1];
1505 yptu[3] =
fBlim[ke2-1];
1506 mnwarn(
"W",
"MNContour ",
"Contour squeezed by parameter limits.");
1508 if (
fErp[ki2-1] <= 0)
goto L1500;
1509 yptu[3] = u2min +
fErp[ki2-1];
1512 scaly = 1 / (yptu[3] - yptu[1]);
1516 Printf(
" Plot of four points found by MINOS");
1522 for (i = 2; i <= nall; ++i) {
1523 fXpt[i-1] = xptu[i-2];
1524 fYpt[i-1] = yptu[i-2];
1526 sprintf(
fChpt,
"%s",
" ABCD");
1540 for (i = 1; i <= mpar; ++i) {
fXt[i-1] =
fX[i-1]; }
1541 i__1 = mpar*(mpar + 1) / 2;
1543 for (i = 1; i <= mpar; ++i) {
1553 for (inew = next; inew <= nptu; ++inew) {
1556 for (iold = 1; iold <= inew - 1; ++iold) {
1558 if (i2 == inew) i2 = 1;
1559 d__1 = scalx*(xptu[iold-1] - xptu[i2-1]);
1560 d__2 = scaly*(yptu[iold-1] - yptu[i2-1]);
1561 dist = d__1*d__1 + d__2*d__2;
1562 if (dist > bigdis) {
1569 if (i2 == inew) i2 = 1;
1574 fXmidcr = a1*xptu[i1-1] + a2*xptu[i2-1];
1575 fYmidcr = a1*yptu[i1-1] + a2*yptu[i2-1];
1576 xdir = yptu[i2-1] - yptu[i1-1];
1577 ydir = xptu[i1-1] - xptu[i2-1];
1590 Printf(
" MNCONT CANNOT FIND NEXT POINT ON CONTOUR. ONLY %3d POINTS FOUND.",nowpts);
1594 mnwarn(
"W",
"MNContour ",
"Cannot find midpoint, try closer.");
1600 for (move = nowpts; move >= i1 + 1; --move) {
1601 xptu[move] = xptu[move-1];
1602 yptu[move] = yptu[move-1];
1612 if (nowpts < nptu)
fCstatu =
"INCOMPLETE";
1620 for (i = 2; i <= nall; ++i) {
1621 fXpt[i-1] = xptu[i-2];
1622 fYpt[i-1] = yptu[i-2];
1626 Printf(
" Y-AXIS: PARAMETER %3d %s",ke2,(
const char*)
fCpnam[ke2-1]);
1630 Printf(
" X-AXIS: PARAMETER %3d %s",ke1,(
const char*)
fCpnam[ke1-1]);
1634 npcol = (nowpts + 1) / 2;
1636 Printf(
"%5d POINTS ON CONTOUR. FMIN=%13.5e ERRDEF=%11.3g",nowpts,abest,
fUp);
1638 (
const char*)
fCpnam[ke2-1],
1639 (
const char*)
fCpnam[ke1-1],
1640 (
const char*)
fCpnam[ke2-1]);
1641 for (line = 1; line <= nfcol; ++
line) {
1643 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]);
1645 if (nfcol < npcol) {
1646 Printf(
" %5d%13.5e%13.5e",npcol,xptu[npcol-1],yptu[npcol-1]);
1653 i__1 = mpar*(mpar + 1) / 2;
1655 for (i = 1; i <= mpar; ++i) {
1674 Printf(
" INVALID PARAMETER NUMBERS.");
1677 Printf(
" LESS THAN FOUR POINTS REQUESTED.");
1683 Printf(
" MNCONT UNABLE TO FIND FOUR POINTS.");
1712 const char *cnumer =
"123456789-.0+";
1715 Int_t ifld, iend, lend, left, nreq, ipos, kcmnd, nextb, ic, ibegin, ltoadd;
1716 Int_t ielmnt, lelmnt[25], nelmnt;
1722 char *crdbuf = (
char*)cardbuf.
Data();
1729 for (ipos = nextb; ipos <= lend; ++ipos) {
1731 if (crdbuf[ipos-1] ==
' ')
continue;
1732 if (crdbuf[ipos-1] ==
',')
goto L250;
1738 for (ipos = ibegin + 1; ipos <= lend; ++ipos) {
1739 if (crdbuf[ipos-1] ==
' ')
goto L250;
1740 if (crdbuf[ipos-1] ==
',')
goto L250;
1746 if (iend >= ibegin) celmnt[ielmnt-1] = &crdbuf[ibegin-1];
1747 else celmnt[ielmnt-1] = cnull;
1748 lelmnt[ielmnt-1] = iend - ibegin + 1;
1749 if (lelmnt[ielmnt-1] > 19) {
1750 Printf(
" MINUIT WARNING: INPUT DATA WORD TOO LONG.");
1751 ctemp = cardbuf(ibegin-1,iend-ibegin+1);
1753 Printf(
" TRUNCATED TO:%s",celmnt[ielmnt-1]);
1754 lelmnt[ielmnt-1] = 19;
1756 if (ipos >= lend)
goto L300;
1757 if (ielmnt >= 25)
goto L300;
1759 for (ipos = iend + 1; ipos <= lend; ++ipos) {
1760 if (crdbuf[ipos-1] ==
' ')
continue;
1762 if (crdbuf[ipos-1] ==
',') nextb = ipos + 1;
1769 command[0] =
' '; command[1] = 0;
1773 if (ielmnt == 0)
goto L900;
1775 for (ielmnt = 1; ielmnt <= nelmnt; ++ielmnt) {
1776 if ( celmnt[ielmnt-1] == cnull)
goto L450;
1777 for (ic = 1; ic <= 13; ++ic) {
1778 if (*celmnt[ielmnt-1] == cnumer[ic-1])
goto L450;
1780 if (kcmnd >= maxcwd)
continue;
1781 left = maxcwd - kcmnd;
1782 ltoadd = lelmnt[ielmnt-1];
1783 if (ltoadd > left) ltoadd = left;
1784 strncpy(&command[kcmnd],celmnt[ielmnt-1],ltoadd);
1786 if (kcmnd == maxcwd)
continue;
1787 command[kcmnd] =
' ';
1797 for (ifld = ielmnt; ifld <= nelmnt; ++ifld) {
1800 nreq = nelmnt - ielmnt + 1;
1801 Printf(
" MINUIT WARNING IN MNCRCK: ");
1802 Printf(
" COMMAND HAS INPUT %5d NUMERIC FIELDS, BUT MINUIT CAN ACCEPT ONLY%3d",nreq,mxp);
1805 if (celmnt[ifld-1] == cnull) plist[llist-1] = 0;
1807 sscanf(celmnt[ifld-1],
"%lf",&plist[llist-1]);
1812 if (lnc <= 0) lnc = 1;
1831 Double_t alsb[3], flsb[3], bmin, bmax, zmid, sdev, zdir, zlim;
1832 Double_t coeff[3], aleft, aulim, fdist, adist, aminsv;
1833 Double_t anext, fnext, slope, s1, s2,
x1,
x2, ecarmn, ecarmx;
1834 Double_t determ, rt, smalla, aright, aim, tla, tlf, dfda,ecart;
1835 Int_t iout=0, i, ileft, ierev, maxlk, ibest, ik, it;
1836 Int_t noless, iworst=0, iright, itoohi, kex, ipt;
1841 ldebug =
fIdbg[6] >= 1;
1860 for (ik = 1; ik <= 2; ++ik) {
1866 if (
fKe2cr == 0)
continue;
1871 if (
fNvarl[kex-1] <= 1)
continue;
1872 if (zdir == 0)
continue;
1873 zlim =
fAlim[kex-1];
1874 if (zdir > 0) zlim =
fBlim[kex-1];
1875 aulim =
TMath::Min(aulim,(zlim - zmid) / zdir);
1883 mneval(anext, fnext, ierev);
1886 Printf(
" MNCROS: calls=%8d AIM=%10.5f F,A=%10.5f%10.5f",
fNfcn,aim,fnext,aopt);
1888 if (ierev > 0)
goto L900;
1889 if (
fLimset && fnext <= aim)
goto L930;
1891 fXpt[ipt-1] = anext;
1892 fYpt[ipt-1] = fnext;
1893 fChpt[ipt-1] = charal[ipt-1];
1898 if (
TMath::Abs(fnext - aim) < tlf)
goto L800;
1900 if (aopt < -.5)aopt = -.5;
1901 if (aopt > 1) aopt = 1;
1907 mneval(aopt, fnext, ierev);
1910 Printf(
" MNCROS: calls=%8d AIM=%10.5f F,A=%10.5f%10.5f",
fNfcn,aim,fnext,aopt);
1912 if (ierev > 0)
goto L900;
1913 if (
fLimset && fnext <= aim)
goto L930;
1916 fXpt[ipt-1] = alsb[1];
1917 fYpt[ipt-1] = fnext;
1918 fChpt[ipt-1] = charal[ipt-1];
1920 dfda = (flsb[1] - flsb[0]) / (alsb[1] - alsb[0]);
1922 if (dfda > 0)
goto L460;
1924 mnwarn(
"D",
"MNCROS ",
"Looking for slope of the right sign");
1926 for (it = 1; it <= maxlk; ++it) {
1935 mneval(aopt, fnext, ierev);
1938 Printf(
" MNCROS: calls=%8d AIM=%10.5f F,A=%10.5f%10.5f",
fNfcn,aim,fnext,aopt);
1940 if (ierev > 0)
goto L900;
1941 if (
fLimset && fnext <= aim)
goto L930;
1944 fXpt[ipt-1] = alsb[1];
1945 fYpt[ipt-1] = fnext;
1946 fChpt[ipt-1] = charal[ipt-1];
1948 dfda = (flsb[1] - flsb[0]) / (alsb[1] - alsb[0]);
1949 if (dfda > 0)
goto L450;
1951 mnwarn(
"W",
"MNCROS ",
"Cannot find slope of the right sign");
1956 aopt = alsb[1] + (aim - flsb[1]) / dfda;
1961 if (adist < tla && fdist < tlf)
goto L800;
1962 if (ipt >= 15)
goto L950;
1964 if (aopt < bmin) aopt = bmin;
1966 if (aopt > bmax) aopt = bmax;
1973 mneval(aopt, fnext, ierev);
1976 Printf(
" MNCROS: calls=%8d AIM=%10.5f F,A=%10.5f%10.5f",
fNfcn,aim,fnext,aopt);
1978 if (ierev > 0)
goto L900;
1979 if (
fLimset && fnext <= aim)
goto L930;
1982 fXpt[ipt-1] = alsb[2];
1983 fYpt[ipt-1] = fnext;
1984 fChpt[ipt-1] = charal[ipt-1];
1991 for (i = 1; i <= 3; ++i) {
1993 if (ecart > ecarmx) { ecarmx = ecart; iworst = i; }
1994 if (ecart < ecarmn) { ecarmn = ecart; ibest = i; }
1995 if (flsb[i-1] < aim) ++noless;
1998 if (noless == 1 || noless == 2)
goto L500;
2000 if (noless == 0 && ibest != 3)
goto L950;
2003 if (noless == 3 && ibest != 3) {
2009 alsb[iworst-1] = alsb[2];
2010 flsb[iworst-1] = flsb[2];
2011 dfda = (flsb[1] - flsb[0]) / (alsb[1] - alsb[0]);
2015 mnpfit(alsb, flsb, 3, coeff, sdev);
2016 if (coeff[2] <= 0) {
2017 mnwarn(
"D",
"MNCROS ",
"Curvature is negative near contour line.");
2019 determ = coeff[1]*coeff[1] - coeff[2]*4*(coeff[0] - aim);
2021 mnwarn(
"D",
"MNCROS ",
"Problem 2, impossible determinant");
2026 x1 = (-coeff[1] + rt) / (coeff[2]*2);
2027 x2 = (-coeff[1] - rt) / (coeff[2]*2);
2028 s1 = coeff[1] + x1*2*coeff[2];
2029 s2 = coeff[1] + x2*2*coeff[2];
2031 Printf(
" MNCONTour problem 1");
2045 if (ipt >= 15)
goto L950;
2054 for (i = 1; i <= 3; ++i) {
2056 if (ecart < ecarmn) { ecarmn = ecart; ibest = i; }
2057 if (ecart > ecarmx) { ecarmx = ecart; }
2058 if (flsb[i-1] > aim) {
2059 if (iright == 0) iright = i;
2060 else if (flsb[i-1] > flsb[iright-1]) iout = i;
2061 else { iout = iright; iright = i; }
2063 else if (ileft == 0) ileft = i;
2064 else if (flsb[i-1] < flsb[ileft-1]) iout = i;
2065 else { iout = ileft; ileft = i; }
2068 if (ecarmx >
TMath::Abs(flsb[iout-1] - aim)*10) {
2069 aopt = aopt*.5 + (alsb[iright-1] + alsb[ileft-1])*.25;
2073 if (slope*smalla > tlf) smalla = tlf / slope;
2074 aleft = alsb[ileft-1] + smalla;
2075 aright = alsb[iright-1] - smalla;
2077 if (aopt < aleft) aopt = aleft;
2078 if (aopt > aright) aopt = aright;
2079 if (aleft > aright) aopt = (aleft + aright)*.5;
2088 mneval(aopt, fnext, ierev);
2091 Printf(
" MNCROS: calls=%8d AIM=%10.5f F,A=%10.5f%10.5f",
fNfcn,aim,fnext,aopt);
2093 if (ierev > 0)
goto L900;
2094 if (
fLimset && fnext <= aim)
goto L930;
2097 fYpt[ipt-1] = fnext;
2098 fChpt[ipt-1] = charal[ipt-1];
2100 alsb[iout-1] = aopt;
2101 flsb[iout-1] = fnext;
2113 if (ierev == 1)
goto L940;
2130 for (i = 1; i <= ipt; ++i) {
2131 if (
fYpt[i-1] > aim + fUp) {
2139 if (
fXdircr < 0) chsign =
"NEGA";
2141 Printf(
" %sTIVE MINOS ERROR, PARAMETER %3d",chsign,
fKe1cr);
2144 Printf(
"POINTS LABELLED '+' WERE TOO HIGH TO PLOT.");
2147 Printf(
"RIGHTMOST POINT IS UP AGAINST LIMIT.");
2165 Int_t ndex, iext, i, j;
2168 Printf(
" FUNCTION MUST BE MINIMIZED BEFORE CALLING %s",(
const char*)
fCfrom);
2175 mnwarn(
"W",
fCfrom,
"NO ERROR MATRIX. WILL IMPROVISE.");
2176 for (i = 1; i <=
fNpar; ++i) {
2178 for (j = 1; j <= i-1; ++j) {
2183 if (
fG2[i-1] <= 0) {
2186 if (
fNvarl[iext-1] > 1) {
2191 fG2[i-1] =
fUp / (wint*wint);
2213 Double_t step, dfmin, stepb4, dd, df, fs1;
2214 Double_t tlrstp, tlrgrd, epspri, optstp, stpmax, stpmin, fs2, grbfor=0, d1d2, xtf;
2215 Int_t icyc, ncyc, iint, iext, i, nparx;
2219 ldebug =
fIdbg[2] >= 1;
2221 if (
fISW[2] == 1)
goto L100;
2233 Printf(
" FIRST DERIVATIVE DEBUG PRINTOUT. MNDERI");
2234 Printf(
" PAR DERIV STEP MINSTEP OPTSTEP D1-D2 2ND DRV");
2251 for (i = 1; i <=
fNpar; ++i) {
2258 for (icyc = 1; icyc <= ncyc; ++icyc) {
2264 if (
fGstep[i-1] < 0 && step > .5) step = .5;
2267 if (step > stpmax) step = stpmax;
2270 if (step < stpmin) step = stpmin;
2272 if (TMath::Abs((step - stepb4) / step) < tlrstp)
goto L50;
2278 fX[i-1] = xtf + step;
2282 fX[i-1] = xtf - step;
2286 fGrd[i-1] = (fs1 - fs2) / (step*2);
2287 fG2[i-1] = (fs1 + fs2 -
fAmin*2) / (step*step);
2290 d1d2 = (fs1 + fs2 -
fAmin*2) / step;
2291 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]);
2294 if (TMath::Abs(grbfor -
fGrd[i-1]) / (TMath::Abs(
fGrd[i-1]) + dfmin/step) < tlrgrd)
2298 if (ncyc == 1)
goto L50;
2307 for (iint = 1; iint <=
fNpar; ++iint) {
2309 if (
fNvarl[iext-1] <= 1) {
2347 Int_t i, j, k,
l,
m=0, i0, i1, j1, m1, n1;
2351 a_offset = ndima + 1;
2359 for (i1 = 2; i1 <=
n; ++i1) {
2361 f = a[i + (i-1)*ndima];
2364 if (l < 1)
goto L25;
2366 for (k = 1; k <=
l; ++k) {
2367 d__1 = a[i + k*ndima];
2373 if (gl > 1e-35)
goto L30;
2381 if (f >= 0) gl = -gl;
2384 a[i + (i-1)*ndima] = f - gl;
2386 for (j = 1; j <=
l; ++j) {
2387 a[j + i*ndima] = a[i + j*ndima] /
h;
2389 for (k = 1; k <= j; ++k) { gl += a[j + k*ndima]*a[i + k*ndima]; }
2390 if (j >= l)
goto L47;
2392 for (k = j1; k <=
l; ++k) { gl += a[k + j*ndima]*a[i + k*ndima]; }
2394 work[n + j] = gl /
h;
2395 f += gl*a[j + i*ndima];
2398 for (j = 1; j <=
l; ++j) {
2400 gl = work[n + j] - hh*
f;
2402 for (k = 1; k <= j; ++k) {
2403 a[j + k*ndima] = a[j + k*ndima] - f*work[n + k] - gl*a[i + k*ndima];
2412 for (i = 1; i <=
n; ++i) {
2414 if (work[i] == 0 || l == 0)
goto L100;
2416 for (j = 1; j <=
l; ++j) {
2418 for (k = 1; k <=
l; ++k) { gl += a[i + k*ndima]*a[k + j*ndima]; }
2419 for (k = 1; k <=
l; ++k) { a[k + j*ndima] -= gl*a[k + i*ndima]; }
2422 work[i] = a[i + i*ndima];
2424 if (l == 0)
continue;
2426 for (j = 1; j <=
l; ++j) {
2433 for (i = 2; i <=
n; ++i) {
2435 work[i0] = work[i0 + 1];
2440 for (l = 1; l <=
n; ++
l) {
2444 for (m1 = l; m1 <=
n; ++m1) {
2450 if (m == l)
goto L205;
2453 if (j == mits)
return;
2455 pt = (work[l + 1] - work[
l]) / (work[n + l]*2);
2458 if (pt < 0) pr = pt -
r;
2460 h = work[
l] - work[n +
l] / pr;
2461 for (i = l; i <=
n; ++i) { work[i] -=
h; }
2468 for (i1 = l; i1 <= m1; ++i1) {
2475 c = pt / work[n + i];
2477 work[n + j] = s*work[n + i]*
r;
2482 c = work[n + i] /
pt;
2484 work[n + j] = s*pt*
r;
2488 pt = c*work[i] - s*gl;
2489 work[j] = h + s*(c*gl + s*work[i]);
2490 for (k = 1; k <=
n; ++k) {
2492 a[k + j*ndima] = s*a[k + i*ndima] + c*
h;
2493 a[k + i*ndima] = c*a[k + i*ndima] - s*
h;
2504 for (i = 1; i <= n1; ++i) {
2508 for (j = i1; j <=
n; ++j) {
2509 if (work[j] >= pt)
continue;
2514 if (k == i)
continue;
2518 for (j = 1; j <=
n; ++j) {
2519 pt = a[j + i*ndima];
2520 a[j + i*ndima] = a[j + k*ndima];
2521 a[j + k*ndima] =
pt;
2537 Int_t emat_dim1, emat_offset;
2541 Int_t i, j, k, npard, k2, kk, iz, nperln, kga, kgb;
2546 emat_offset = emat_dim1 + 1;
2547 emat -= emat_offset;
2550 if (
fISW[1] < 1)
return;
2552 Printf(
" EXTERNAL ERROR MATRIX. NDIM=%4d NPAR=%3d ERR DEF=%g",ndim,
fNpar,
fUp);
2559 Printf(
" USER-DIMENSIONED ARRAY EMAT NOT BIG ENOUGH. REDUCED MATRIX CALCULATED.");
2566 if (
fISW[4] >= 1 && npard > nperln) {
2567 Printf(
" ELEMENTS ABOVE DIAGONAL ARE NOT PRINTED.");
2570 for (i = 1; i <= npard; ++i) {
2573 for (j = 1; j <= i; ++j) {
2576 emat[i + j*emat_dim1] = dxdi*
fVhmat[kgb-1]*dxdj*
fUp;
2577 emat[j + i*emat_dim1] = emat[i + j*emat_dim1];
2582 for (i = 1; i <= npard; ++i) {
2584 if (npard >= nperln) iz = i;
2586 for (k = 1; nperln < 0 ? k >= iz : k <= iz; k += nperln) {
2587 k2 = k + nperln - 1;
2588 if (k2 > iz) k2 = iz;
2589 for (kk = k; kk <= k2; ++kk) {
2592 Printf(
"%s",(
const char*)ctemp);
2613 Int_t ndiag, iin, iex;
2617 if (iex >
fNu || iex <= 0)
goto L900;
2619 if (iin <= 0)
goto L900;
2622 eplus =
fErp[iin-1];
2623 if (eplus ==
fUndefi) eplus = 0;
2624 eminus =
fErn[iin-1];
2625 if (eminus ==
fUndefi) eminus = 0;
2627 ndiag = iin*(iin + 1) / 2;
2631 if (
fISW[1] < 2)
return;
2670 if (
fISW[0] >= 1) ierev = 1;
2671 if (
fISW[3] < 1) ierev = 2;
2704 static const char *cname[40] = {
2749 Double_t step, xptu[101], yptu[101],
f, rno;
2750 Int_t icol, kcol, ierr, iint, iext, lnow, nptu, i, iflag, ierrf;
2751 Int_t ilist, nparx, izero, nf, lk, it, iw, inonde, nsuper;
2752 Int_t it2, ke1, ke2, nowprt, kll, krl;
2753 TString chwhy, c26, cvblnk, cneway, comd;
2755 Bool_t lfreed, ltofix, lfixed;
2762 if (lk > 20) lk = 20;
2767 for (iw = 1; iw <=
fMaxpar; ++iw) {
2769 if (iw <= llist)
fWord7[iw-1] = plist[iw-1];
2776 if (lnow > 4) lnow = 4;
2779 for (i = 1; i <= lnow; ++i) {
2782 Printf(
"%s",(
const char*)ctemp);
2791 for (i = lnow + 1; i <= kll; ++i) {
2792 Printf(
"%12.4g",plist[i-1]);
2797 Printf(
" ERROR: ABOVE CALL TO MNEXCM TRIED TO PASS MORE THAN %d PARAMETERS.",
fMaxpar);
2815 for (i = 1; i <= nntot; ++i) {
2816 if (strncmp(ctemp.
Data(),cname[i-1],3) == 0)
goto L90;
2818 Printf(
"UNKNOWN COMMAND IGNORED:%s", comand.
Data());
2823 if (
fCword(0,4) ==
"MINO") i = 5;
2824 if (i != 6 && i != 7 && i != 8 && i != 23) {
2839 case 10:
goto L1000;
2840 case 11:
goto L1100;
2841 case 12:
goto L1200;
2842 case 13:
goto L1300;
2843 case 14:
goto L1400;
2844 case 15:
goto L1500;
2845 case 16:
goto L1600;
2846 case 17:
goto L1700;
2847 case 18:
goto L1800;
2848 case 19:
goto L1900;
2849 case 20:
goto L1900;
2850 case 21:
goto L1900;
2851 case 22:
goto L2200;
2852 case 23:
goto L2300;
2853 case 24:
goto L2400;
2854 case 25:
goto L1900;
2855 case 26:
goto L2600;
2856 case 27:
goto L3300;
2857 case 28:
goto L3300;
2858 case 29:
goto L3300;
2859 case 30:
goto L3300;
2860 case 31:
goto L3300;
2861 case 32:
goto L3300;
2862 case 33:
goto L3300;
2863 case 34:
goto L3400;
2864 case 35:
goto L3500;
2865 case 36:
goto L3600;
2866 case 37:
goto L3700;
2867 case 38:
goto L3800;
2868 case 39:
goto L3900;
2869 case 40:
goto L4000;
2878 if (
fISW[3] < 1) ierflg = 4;
2886 if (
fISW[3] >= 1)
return;
2888 if (
fISW[0] == 1)
return;
2889 if (
fCword(0,3) ==
"MIG")
return;
2894 if (
fISW[0] == 1)
return;
2897 if (
fISW[3] >= 1) ierflg = 0;
2913 if (fNfcn < nsuper)
goto L510;
2914 Printf(
" TOO MANY FUNCTION CALLS. MINOS GIVES UP");
2934 Printf(
"%s: NO PARAMETERS REQUESTED ",(
const char*)
fCword);
2937 for (ilist = 1; ilist <= llist; ++ilist) {
2938 iext =
Int_t(plist[ilist-1]);
2939 chwhy =
" IS UNDEFINED.";
2940 if (iext <= 0)
goto L930;
2941 if (iext >
fNu)
goto L930;
2942 if (
fNvarl[iext-1] < 0)
goto L930;
2943 chwhy =
" IS CONSTANT. ";
2944 if (
fNvarl[iext-1] == 0)
goto L930;
2947 chwhy =
" ALREADY FIXED.";
2948 if (iint == 0)
goto L930;
2950 if (ierr == 0) lfixed =
kTRUE;
2953 chwhy =
" ALREADY VARIABLE.";
2954 if (iint > 0)
goto L930;
2961 if (
fISW[4] >= 0)
Printf(
" PARAMETER %4d %s IGNORED.",iext,(
const char*)chwhy);
2963 if (lfreed || lfixed)
mnrset(0);
2976 if (it > 1 || it < 0)
goto L1005;
2987 Printf(
" IGNORED. UNKNOWN ARGUMENT:%4d",it);
2997 if (iext <= 0)
goto L1210;
3000 if (it2 <= 0)
goto L1250;
3006 Printf(
" PARAMETER %4d NOT VARIABLE.",iext);
3018 Printf(
"%s: NO PARAMETERS REQUESTED ",(
const char*)
fCword);
3024 mncntr(ke1-1, ke2-1, ierrf);
3025 if (ierrf > 0) ierflg = 3;
3056 }
else if (f <
fAmin) {
3060 if (
fISW[4] >= 0 && iflag <= 5 && nowprt == 1) {
3065 if (iflag > 5)
mnrset(1);
3076 if (
fISW[4] >= 0)
Printf(
" CALL TO USER FUNCTION WITH IFLAG = 3");
3081 if (
fCword(0,3) ==
"END") ierflg = 10;
3082 if (
fCword(0,3) ==
"RET") ierflg = 12;
3088 Printf(
" MINUIT MEMORY CLEARED. NO PARAMETERS NOW DEFINED.");
3094 for (icol = 5; icol <= lk; ++icol) {
3095 if (
fCword[icol-1] ==
' ')
continue;
3100 if (kcol == 0) comd =
"* ";
3101 else comd =
fCword(kcol-1,lk-kcol+1);
3109 if (ke1 == 0 &&
fNpar == 2) {
3114 if (nptu <= 0) nptu = 20;
3115 if (nptu > 101) nptu = 101;
3117 mncont(ke1-1, ke2-1, nptu, xptu, yptu, ierrf);
3118 if (ierrf < nptu) ierflg = 4;
3119 if (ierrf == -1) ierflg = 3;
3124 if (step <= 0) step = 2;
3127 for (i = 1; i <=
fNpar; ++i) {
3130 fX[i-1] += rno*step*
fWerr[i-1];
3138 Printf(
" BLANK COMMAND IGNORED.");
3144 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*");
3149 cneway =
"SET PRInt ";
3153 cneway =
"SET GRAd ";
3157 cneway =
"SHOW COVar";
3161 cneway =
"SET ERRdef";
3165 cneway =
"SET LIMits";
3172 Printf(
" OBSOLETE COMMAND:%s PLEASE USE:%s",(
const char*)
fCword 3173 ,(
const char*)cneway);
3175 if (
fCword ==
"SAVE ")
goto L1500;
3193 for (iint = 1; iint <=
fNpar; ++iint) {
3196 pint[iint-1] = pinti;
3210 Int_t kold, nold, ndex, knew, iext, i, j,
m,
n, lc, ik;
3214 Int_t iint = iint1+1;
3215 if (iint >
fNpar || iint <= 0) {
3217 Printf(
" MINUIT ERROR. ARGUMENT TO MNFIXP=%4d",iint);
3223 Printf(
" MINUIT CANNOT FIX PARAMETER %4d MAXIMUM NUMBER THAT CAN BE FIXED IS %d",iext,
fMaxpar);
3243 for (ik = iext + 1; ik <=
fNu; ++ik) {
3257 if (
fISW[1] <= 0)
return;
3259 if (
fNpar <= 0)
return;
3260 for (i = 1; i <= nold; ++i) {
3263 ndex = m*(m-1) / 2 + n;
3269 for (i = 1; i <= nold; ++i) {
3270 for (j = 1; j <= i; ++j) {
3272 if (j == iint || i == iint)
continue;
3297 Double_t grdv, xv, dirinv, g2v, gstepv, xtv;
3298 Int_t i, ipsav, ka, lc, ik,
iq, ir, is;
3301 Printf(
" CALL TO MNFREE IGNORED. ARGUMENT GREATER THAN ONE");
3304 Printf(
" CALL TO MNFREE IGNORED. THERE ARE NO FIXED PARAMETERS");
3306 if (k == 1 || k == 0)
goto L40;
3310 if (
fNiofex[ka-1] == 0)
goto L15;
3311 Printf(
" IGNORED. PARAMETER SPECIFIED IS ALREADY VARIABLE.");
3314 if (
fNpfix < 1)
goto L21;
3315 for (ik = 1; ik <=
fNpfix; ++ik) {
if (
fIpfix[ik-1] == ka)
goto L24; }
3317 Printf(
" PARAMETER %4d NOT FIXED. CANNOT BE RELEASED.",ka);
3320 if (ik ==
fNpfix)
goto L40;
3330 for (i = ik + 1; i <=
fNpfix; ++i) {
3348 if (
fNpfix < 1)
goto L300;
3351 for (ik =
fNu; ik >= ir; --ik) {
3357 fX[lc-1] =
fX[lc-2];
3367 if (is == 0) is =
fNpar;
3371 fX[is-1] =
fXs[iq-1];
3382 Printf(
" PARAMETER %4d %s RESTORED TO VARIABLE.",ir,
3383 (
const char*)
fCpnam[ir-1]);
3385 if (k == 0)
goto L40;
3405 Int_t i, nparx, lc, istsav;
3411 if (
fWord7[0] > 0)
goto L2000;
3425 Printf(
" CHECK OF GRADIENT CALCULATION IN FCN");
3426 Printf(
" PARAMETER G(IN FCN) G(MINUIT) DG(MINUIT) AGREEMENT");
3429 for (lc = 1; lc <=
fNpar; ++lc) {
3439 if (cwd !=
"GOOD")
fISW[2] = 0;
3440 Printf(
" %5d %10s%12.4e%12.4e%12.4e %s",i
3441 ,(
const char*)
fCpnam[i-1]
3445 Printf(
" AGREEMENT=NONE MEANS FCN DID NOT CALCULATE THE DERIVATIVE");
3448 Printf(
" MINUIT DOES NOT ACCEPT DERIVATIVE CALCULATIONS BY FCN");
3449 Printf(
" TO FORCE ACCEPTANCE, ENTER *SET GRAD 1*");
3487 if( comd.
Length() == 0 || comd[0] ==
'*' || comd[0] ==
'?' || comd[0] == 0 || comd==
"HELP" ) {
3488 Printf(
" ==>List of MINUIT Interactive commands:");
3489 Printf(
" CLEar Reset all parameter names and values undefined");
3490 Printf(
" CONtour Make contour map of the user function");
3491 Printf(
" EXIT Exit from Interactive Minuit");
3492 Printf(
" FIX Cause parameter(s) to remain constant");
3493 Printf(
" HESse Calculate the Hessian or error matrix.");
3494 Printf(
" IMPROVE Search for a new minimum around current minimum");
3495 Printf(
" MIGrad Minimize by the method of Migrad");
3496 Printf(
" MINImize MIGRAD + SIMPLEX method if Migrad fails");
3497 Printf(
" MINOs Exact (non-linear) parameter error analysis");
3498 Printf(
" MNContour Calculate one MINOS function contour");
3499 Printf(
" PARameter Define or redefine new parameters and values");
3500 Printf(
" RELease Make previously FIXed parameters variable again");
3501 Printf(
" REStore Release last parameter fixed");
3502 Printf(
" SAVe Save current parameter values on a file");
3503 Printf(
" SCAn Scan the user function by varying parameters");
3504 Printf(
" SEEk Minimize by the method of Monte Carlo");
3505 Printf(
" SET Set various MINUIT constants or conditions");
3506 Printf(
" SHOw Show values of current constants or conditions");
3507 Printf(
" SIMplex Minimize by the method of Simplex");
3516 if( !strncmp(comd.
Data(),
"CLE",3) ) {
3518 Printf(
" Resets all parameter names and values to undefined.");
3519 Printf(
" Must normally be followed by a PARameters command or ");
3520 Printf(
" equivalent, in order to define parameter values.");
3528 if( !strncmp(comd.
Data(),
"CON",3) ) {
3529 Printf(
" ***>CONTOUR <par1> <par2> [devs] [ngrid]");
3530 Printf(
" Instructs Minuit to trace contour lines of the user function");
3531 Printf(
" with respect to the two parameters whose external numbers");
3532 Printf(
" are <par1> and <par2>.");
3533 Printf(
" Other variable parameters of the function, if any, will have");
3534 Printf(
" their values fixed at the current values during the contour");
3535 Printf(
" tracing. The optional parameter [devs] (default value 2.)");
3536 Printf(
" gives the number of standard deviations in each parameter");
3537 Printf(
" which should lie entirely within the plotting area.");
3538 Printf(
" Optional parameter [ngrid] (default value 25 unless page");
3539 Printf(
" size is too small) determines the resolution of the plot,");
3540 Printf(
" i.e. the number of rows and columns of the grid at which the");
3541 Printf(
" function will be evaluated. [See also MNContour.]");
3549 if( !strncmp(comd.
Data(),
"END",3) ) {
3551 Printf(
" Signals the end of a data block (i.e., the end of a fit),");
3552 Printf(
" and implies that execution should continue, because another");
3553 Printf(
" Data Block follows. A Data Block is a set of Minuit data");
3554 Printf(
" consisting of");
3556 Printf(
" (2) One or more Parameter Definitions,");
3557 Printf(
" (3) A blank line, and");
3558 Printf(
" (4) A set of Minuit Commands.");
3559 Printf(
" The END command is used when more than one Data Block is to");
3560 Printf(
" be used with the same FCN function. It first causes Minuit");
3561 Printf(
" to issue a CALL FCN with IFLAG=3, in order to allow FCN to");
3562 Printf(
" perform any calculations associated with the final fitted");
3563 Printf(
" parameter values, unless a CALL FCN 3 command has already");
3564 Printf(
" been executed at the current FCN value.");
3572 if( !strncmp(comd.
Data(),
"EXI",3) ) {
3574 Printf(
" Signals the end of execution.");
3575 Printf(
" The EXIT command first causes Minuit to issue a CALL FCN");
3576 Printf(
" with IFLAG=3, to allow FCN to perform any calculations");
3577 Printf(
" associated with the final fitted parameter values, unless a");
3578 Printf(
" CALL FCN 3 command has already been executed.");
3586 if( !strncmp(comd.
Data(),
"FIX",3) ) {
3587 Printf(
" ***>FIX} <parno> [parno] ... [parno]");
3588 Printf(
" Causes parameter(s) <parno> to be removed from the list of");
3589 Printf(
" variable parameters, and their value(s) will remain constant");
3590 Printf(
" during subsequent minimizations, etc., until another command");
3591 Printf(
" changes their value(s) or status.");
3599 if( !strncmp(comd.
Data(),
"HES",3) ) {
3600 Printf(
" ***>HESse [maxcalls]");
3601 Printf(
" Calculate, by finite differences, the Hessian or error matrix.");
3602 Printf(
" That is, it calculates the full matrix of second derivatives");
3603 Printf(
" of the function with respect to the currently variable");
3604 Printf(
" parameters, and inverts it, printing out the resulting error");
3605 Printf(
" matrix. The optional argument [maxcalls] specifies the");
3606 Printf(
" (approximate) maximum number of function calls after which");
3607 Printf(
" the calculation will be stopped.");
3615 if( !strncmp(comd.
Data(),
"IMP",3) ) {
3616 Printf(
" ***>IMPROVE [maxcalls]");
3617 Printf(
" If a previous minimization has converged, and the current");
3618 Printf(
" values of the parameters therefore correspond to a local");
3619 Printf(
" minimum of the function, this command requests a search for");
3620 Printf(
" additional distinct local minima.");
3621 Printf(
" The optional argument [maxcalls] specifies the (approximate");
3622 Printf(
" maximum number of function calls after which the calculation");
3623 Printf(
" will be stopped.");
3631 if( !strncmp(comd.
Data(),
"MIG",3) ) {
3632 Printf(
" ***>MIGrad [maxcalls] [tolerance]");
3633 Printf(
" Causes minimization of the function by the method of Migrad,");
3634 Printf(
" the most efficient and complete single method, recommended");
3635 Printf(
" for general functions (see also MINImize).");
3636 Printf(
" The minimization produces as a by-product the error matrix");
3637 Printf(
" of the parameters, which is usually reliable unless warning");
3638 Printf(
" messages are produced.");
3639 Printf(
" The optional argument [maxcalls] specifies the (approximate)");
3640 Printf(
" maximum number of function calls after which the calculation");
3641 Printf(
" will be stopped even if it has not yet converged.");
3642 Printf(
" The optional argument [tolerance] specifies required tolerance");
3643 Printf(
" on the function value at the minimum.");
3644 Printf(
" The default tolerance is 0.1, and the minimization will stop");
3645 Printf(
" when the estimated vertical distance to the minimum (EDM) is");
3646 Printf(
" less than 0.001*[tolerance]*UP (see [SET ERRordef]).");
3654 if( !strncmp(comd.
Data(),
"MINI",4) ) {
3655 Printf(
" ***>MINImize [maxcalls] [tolerance]");
3656 Printf(
" Causes minimization of the function by the method of Migrad,");
3657 Printf(
" as does the MIGrad command, but switches to the SIMplex method");
3658 Printf(
" if Migrad fails to converge. Arguments are as for MIGrad.");
3659 Printf(
" Note that command requires four characters to be unambiguous.");
3667 if( !strncmp(comd.
Data(),
"MIN0",4) ) {
3668 Printf(
" ***>MINOs [maxcalls] [parno] [parno] ...");
3669 Printf(
" Causes a Minos error analysis to be performed on the parameters");
3670 Printf(
" whose numbers [parno] are specified. If none are specified,");
3671 Printf(
" Minos errors are calculated for all variable parameters.");
3672 Printf(
" Minos errors may be expensive to calculate, but are very");
3673 Printf(
" reliable since they take account of non-linearities in the");
3674 Printf(
" problem as well as parameter correlations, and are in general");
3676 Printf(
" The optional argument [maxcalls] specifies the (approximate)");
3677 Printf(
" maximum number of function calls per parameter requested,");
3678 Printf(
" after which the calculation will stop for that parameter.");
3686 if( !strncmp(comd.
Data(),
"MNC",3) ) {
3687 Printf(
" ***>MNContour <par1> <par2> [npts]");
3688 Printf(
" Calculates one function contour of FCN with respect to");
3689 Printf(
" parameters par1 and par2, with FCN minimized always with");
3690 Printf(
" respect to all other NPAR-2 variable parameters (if any).");
3691 Printf(
" Minuit will try to find npts points on the contour (default 20)");
3692 Printf(
" If only two parameters are variable at the time, it is not");
3693 Printf(
" necessary to specify their numbers. To calculate more than");
3694 Printf(
" one contour, it is necessary to SET ERRordef to the appropriate");
3695 Printf(
" value and issue the MNContour command for each contour.");
3703 if( !strncmp(comd.
Data(),
"PAR",3) ) {
3704 Printf(
" ***>PARameters");
3705 Printf(
" followed by one or more parameter definitions.");
3706 Printf(
" Parameter definitions are of the form:");
3707 Printf(
" <number> ''name'' <value> <step> [lolim] [uplim] ");
3709 Printf(
" 3 ''K width'' 1.2 0.1");
3710 Printf(
" the last definition is followed by a blank line or a zero.");
3718 if( !strncmp(comd.
Data(),
"REL",3) ) {
3719 Printf(
" ***>RELease <parno> [parno] ... [parno]");
3720 Printf(
" If <parno> is the number of a previously variable parameter");
3721 Printf(
" which has been fixed by a command: FIX <parno>, then that");
3722 Printf(
" parameter will return to variable status. Otherwise a warning");
3723 Printf(
" message is printed and the command is ignored.");
3724 Printf(
" Note that this command operates only on parameters which were");
3725 Printf(
" at one time variable and have been FIXed. It cannot make");
3726 Printf(
" constant parameters variable; that must be done by redefining");
3727 Printf(
" the parameter with a PARameters command.");
3735 if( !strncmp(comd.
Data(),
"RES",3) ) {
3736 Printf(
" ***>REStore [code]");
3737 Printf(
" If no [code] is specified, this command restores all previously");
3738 Printf(
" FIXed parameters to variable status. If [code]=1, then only");
3739 Printf(
" the last parameter FIXed is restored to variable status.");
3740 Printf(
" If code is neither zero nor one, the command is ignored.");
3748 if( !strncmp(comd.
Data(),
"RET",3) ) {
3750 Printf(
" Signals the end of a data block, and instructs Minuit to return");
3751 Printf(
" to the program which called it. The RETurn command first");
3752 Printf(
" causes Minuit to CALL FCN with IFLAG=3, in order to allow FCN");
3753 Printf(
" to perform any calculations associated with the final fitted");
3754 Printf(
" parameter values, unless a CALL FCN 3 command has already been");
3755 Printf(
" executed at the current FCN value.");
3763 if( !strncmp(comd.
Data(),
"SAV",3) ) {
3765 Printf(
" Causes the current parameter values to be saved on a file in");
3766 Printf(
" such a format that they can be read in again as Minuit");
3767 Printf(
" parameter definitions. If the covariance matrix exists, it is");
3768 Printf(
" also output in such a format. The unit number is by default 7,");
3769 Printf(
" or that specified by the user in their call to MINTIO or");
3770 Printf(
" MNINIT. The user is responsible for opening the file previous");
3771 Printf(
" to issuing the [SAVe] command (except where this can be done");
3772 Printf(
" interactively).");
3780 if( !strncmp(comd.
Data(),
"SCA",3) ) {
3781 Printf(
" ***>SCAn [parno] [numpts] [from] [to]");
3782 Printf(
" Scans the value of the user function by varying parameter");
3783 Printf(
" number [parno], leaving all other parameters fixed at the");
3784 Printf(
" current value. If [parno] is not specified, all variable");
3785 Printf(
" parameters are scanned in sequence.");
3786 Printf(
" The number of points [numpts] in the scan is 40 by default,");
3787 Printf(
" and cannot exceed 100. The range of the scan is by default");
3788 Printf(
" 2 standard deviations on each side of the current best value,");
3789 Printf(
" but can be specified as from [from] to [to].");
3790 Printf(
" After each scan, if a new minimum is found, the best parameter");
3791 Printf(
" values are retained as start values for future scans or");
3792 Printf(
" minimizations. The curve resulting from each scan is plotted");
3793 Printf(
" on the output unit in order to show the approximate behaviour");
3794 Printf(
" of the function.");
3795 Printf(
" This command is not intended for minimization, but is sometimes");
3796 Printf(
" useful for debugging the user function or finding a");
3797 Printf(
" reasonable starting point.");
3805 if( !strncmp(comd.
Data(),
"SEE",3) ) {
3806 Printf(
" ***>SEEk [maxcalls] [devs]");
3807 Printf(
" Causes a Monte Carlo minimization of the function, by choosing");
3808 Printf(
" random values of the variable parameters, chosen uniformly");
3809 Printf(
" over a hypercube centered at the current best value.");
3810 Printf(
" The region size is by default 3 standard deviations on each");
3811 Printf(
" side, but can be changed by specifying the value of [devs].");
3819 if( !strncmp(comd.
Data(),
"SET",3) ) {
3820 Printf(
" ***>SET <option_name>");
3822 Printf(
" Informs Minuit that it is running in batch mode.");
3825 Printf(
" SET EPSmachine <accuracy>");
3826 Printf(
" Informs Minuit that the relative floating point arithmetic");
3827 Printf(
" precision is <accuracy>. Minuit determines the nominal");
3828 Printf(
" precision itself, but the SET EPSmachine command can be");
3829 Printf(
" used to override Minuit own determination, when the user");
3830 Printf(
" knows that the FCN function value is not calculated to");
3831 Printf(
" the nominal machine accuracy. Typical values of <accuracy>");
3832 Printf(
" are between 10**-5 and 10**-14.");
3835 Printf(
" SET ERRordef <up>");
3836 Printf(
" Sets the value of UP (default value= 1.), defining parameter");
3837 Printf(
" errors. Minuit defines parameter errors as the change");
3838 Printf(
" in parameter value required to change the function value");
3839 Printf(
" by UP. Normally, for chisquared fits UP=1, and for negative");
3840 Printf(
" log likelihood, UP=0.5.");
3843 Printf(
" SET GRAdient [force]");
3844 Printf(
" Informs Minuit that the user function is prepared to");
3845 Printf(
" calculate its own first derivatives and return their values");
3846 Printf(
" in the array GRAD when IFLAG=2 (see specs of FCN).");
3847 Printf(
" If [force] is not specified, Minuit will calculate");
3848 Printf(
" the FCN derivatives by finite differences at the current");
3849 Printf(
" point and compare with the user calculation at that point,");
3850 Printf(
" accepting the user values only if they agree.");
3851 Printf(
" If [force]=1, Minuit does not do its own derivative");
3852 Printf(
" calculation, and uses the derivatives calculated in FCN.");
3855 Printf(
" SET INPut [unitno] [filename]");
3856 Printf(
" Causes Minuit, in data-driven mode only, to read subsequent");
3857 Printf(
" commands (or parameter definitions) from a different input");
3858 Printf(
" file. If no [unitno] is specified, reading reverts to the");
3859 Printf(
" previous input file, assuming that there was one.");
3860 Printf(
" If [unitno] is specified, and that unit has not been opened,");
3861 Printf(
" then Minuit attempts to open the file [filename]} if a");
3862 Printf(
" name is specified. If running in interactive mode and");
3863 Printf(
" [filename] is not specified and [unitno] is not opened,");
3864 Printf(
" Minuit prompts the user to enter a file name.");
3865 Printf(
" If the word REWIND is added to the command (note:no blanks");
3866 Printf(
" between INPUT and REWIND), the file is rewound before");
3867 Printf(
" reading. Note that this command is implemented in standard");
3868 Printf(
" Fortran 77 and the results may depend on the system;");
3869 Printf(
" for example, if a filename is given under VM/CMS, it must");
3870 Printf(
" be preceded by a slash.");
3873 Printf(
" SET INTeractive");
3874 Printf(
" Informs Minuit that it is running interactively.");
3877 Printf(
" SET LIMits [parno] [lolim] [uplim]");
3878 Printf(
" Allows the user to change the limits on one or all");
3879 Printf(
" parameters. If no arguments are specified, all limits are");
3880 Printf(
" removed from all parameters. If [parno] alone is specified,");
3881 Printf(
" limits are removed from parameter [parno].");
3882 Printf(
" If all arguments are specified, then parameter [parno] will");
3883 Printf(
" be bounded between [lolim] and [uplim].");
3884 Printf(
" Limits can be specified in either order, Minuit will take");
3885 Printf(
" the smaller as [lolim] and the larger as [uplim].");
3886 Printf(
" However, if [lolim] is equal to [uplim], an error condition");
3890 Printf(
" SET LINesperpage");
3891 Printf(
" Sets the number of lines for one page of output.");
3892 Printf(
" Default value is 24 for interactive mode");
3895 Printf(
" SET NOGradient");
3896 Printf(
" The inverse of SET GRAdient, instructs Minuit not to");
3897 Printf(
" use the first derivatives calculated by the user in FCN.");
3900 Printf(
" SET NOWarnings");
3901 Printf(
" Supresses Minuit warning messages.");
3904 Printf(
" SET OUTputfile <unitno>");
3905 Printf(
" Instructs Minuit to write further output to unit <unitno>.");
3908 Printf(
" SET PAGethrow <integer>");
3909 Printf(
" Sets the carriage control character for ``new page'' to");
3910 Printf(
" <integer>. Thus the value 1 produces a new page, and 0");
3911 Printf(
" produces a blank line, on some devices (see TOPofpage)");
3915 Printf(
" SET PARameter <parno> <value>");
3916 Printf(
" Sets the value of parameter <parno> to <value>.");
3917 Printf(
" The parameter in question may be variable, fixed, or");
3918 Printf(
" constant, but must be defined.");
3921 Printf(
" SET PRIntout <level>");
3922 Printf(
" Sets the print level, determining how much output will be");
3923 Printf(
" produced. Allowed values and their meanings are displayed");
3924 Printf(
" after a SHOw PRInt command, and are currently <level>=:");
3925 Printf(
" [-1] no output except from SHOW commands");
3926 Printf(
" [0] minimum output");
3927 Printf(
" [1] default value, normal output");
3928 Printf(
" [2] additional output giving intermediate results.");
3929 Printf(
" [3] maximum output, showing progress of minimizations.");
3930 Printf(
" Note: See also the SET WARnings command.");
3933 Printf(
" SET RANdomgenerator <seed>");
3934 Printf(
" Sets the seed of the random number generator used in SEEk.");
3935 Printf(
" This can be any integer between 10000 and 900000000, for");
3936 Printf(
" example one which was output from a SHOw RANdom command of");
3937 Printf(
" a previous run.");
3940 Printf(
" SET STRategy <level>");
3941 Printf(
" Sets the strategy to be used in calculating first and second");
3942 Printf(
" derivatives and in certain minimization methods.");
3943 Printf(
" In general, low values of <level> mean fewer function calls");
3944 Printf(
" and high values mean more reliable minimization.");
3945 Printf(
" Currently allowed values are 0, 1 (default), and 2.");
3949 Printf(
" Informs Minuit that the next input line is to be considered");
3950 Printf(
" the (new) title for this task or sub-task. This is for");
3951 Printf(
" the convenience of the user in reading their output.");
3955 Printf(
" Instructs Minuit to output warning messages when suspicious");
3956 Printf(
" conditions arise which may indicate unreliable results.");
3957 Printf(
" This is the default.");
3960 Printf(
" SET WIDthpage");
3961 Printf(
" Informs Minuit of the output page width.");
3962 Printf(
" Default values are 80 for interactive jobs");
3970 if( !strncmp(comd.
Data(),
"SHO",3) ) {
3971 Printf(
" ***>SHOw <option_name>");
3972 Printf(
" All SET XXXX commands have a corresponding SHOw XXXX command.");
3973 Printf(
" In addition, the SHOw commands listed starting here have no");
3974 Printf(
" corresponding SET command for obvious reasons.");
3977 Printf(
" SHOw CORrelations");
3978 Printf(
" Calculates and prints the parameter correlations from the");
3979 Printf(
" error matrix.");
3982 Printf(
" SHOw COVariance");
3983 Printf(
" Prints the (external) covariance (error) matrix.");
3986 Printf(
" SHOw EIGenvalues");
3987 Printf(
" Calculates and prints the eigenvalues of the covariance");
3991 Printf(
" SHOw FCNvalue");
3992 Printf(
" Prints the current value of FCN.");
4000 if( !strncmp(comd.
Data(),
"SIM",3) ) {
4001 Printf(
" ***>SIMplex [maxcalls] [tolerance]");
4002 Printf(
" Performs a function minimization using the simplex method of");
4003 Printf(
" Nelder and Mead. Minimization terminates either when the");
4004 Printf(
" function has been called (approximately) [maxcalls] times,");
4005 Printf(
" or when the estimated vertical distance to minimum (EDM) is");
4006 Printf(
" less than [tolerance].");
4007 Printf(
" The default value of [tolerance] is 0.1*UP(see SET ERRordef).");
4015 if( !strncmp(comd.
Data(),
"STA",3) ) {
4024 if( !strncmp(comd.
Data(),
"STO",3) ) {
4026 Printf(
" Same as EXIT.");
4034 if( !strncmp(comd.
Data(),
"TOP",3) ) {
4035 Printf(
" ***>TOPofpage");
4036 Printf(
" Causes Minuit to write the character specified in a");
4037 Printf(
" SET PAGethrow command (default = 1) to column 1 of the output");
4038 Printf(
" file, which may or may not position your output medium to");
4039 Printf(
" the top of a page depending on the device and system.");
4043 Printf(
" Unknown MINUIT command. Type HELP for list of commands.");
4062 Double_t dmin_, dxdi, elem, wint, tlrg2, d, dlast, ztemp, g2bfor;
4063 Double_t df, aimsag, fs1, tlrstp, fs2, stpinm, g2i, sag=0, xtf, xti, xtj;
4064 Int_t icyc, ncyc, ndex, idrv, iext, npar2, i, j, ifail, npard, nparx,
id, multpy;
4067 ldebug =
fIdbg[3] >= 1;
4084 if (
fISW[4] >= 2 || ldebug) {
4085 Printf(
" START COVARIANCE MATRIX CALCULATION.");
4101 Printf(
" PAR D GSTEP D G2 GRD SAG ");
4111 for (i = 1; i <= npar2; ++i) {
fVhmat[i-1] = 0; }
4115 for (
id = 1;
id <= npard; ++
id) {
4116 i =
id +
fNpar - npard;
4118 if (
fG2[i-1] == 0) {
4119 mnwarn(
"W",
"HESSE",
Form(
"Second derivative enters zero, param %d",iext));
4121 if (
fNvarl[iext-1] > 1) {
4126 fG2[i-1] =
fUp / (wint*wint);
4134 for (icyc = 1; icyc <= ncyc; ++icyc) {
4136 for (multpy = 1; multpy <= 5; ++multpy) {
4146 sag = (fs1 + fs2 -
fAmin*2)*.5;
4147 if (sag != 0)
goto L30;
4149 if (d >= .5)
goto L26;
4151 if (d > .5) d = .51;
4162 fG2[i-1] = sag*2 / (d*d);
4163 fGrd[i-1] = (fs1 - fs2) / (d*2);
4165 Printf(
"%4d%2d%12.5g%12.5g%12.5g%12.5g%12.5g",i,idrv,
fGstep[i-1],d,
fG2[i-1],
fGrd[i-1],sag);
4176 if (d < dmin_) d = dmin_;
4178 if (TMath::Abs((d - dlast) / d) < tlrstp ||
4179 TMath::Abs((
fG2[i-1] - g2bfor) /
fG2[i-1]) < tlrg2) {
4190 ndex = i*(i + 1) / 2;
4201 if (
fNpar == 1)
goto L214;
4202 for (i = 1; i <=
fNpar; ++i) {
4203 for (j = 1; j <= i-1; ++j) {
4207 fX[j-1] = xtj + fDirin[j-1];
4213 fDirin[i-1]*fDirin[j-1]);
4214 ndex = i*(i-1) / 2 + j;
4222 for (i = 1; i <=
fNpar; ++i) {
4223 for (j = 1; j <= i; ++j) {
4224 ndex = i*(i-1) / 2 + j;
4231 mnwarn(
"W",
"HESSE",
"Matrix inversion fails.");
4237 for (i = 1; i <=
fNpar; ++i) {
4240 for (j = 1; j <= i-1; ++j) {
4252 Printf(
" COVARIANCE MATRIX CALCULATED SUCCESSFULLY");
4261 Printf(
" MNHESS FAILS AND WILL RETURN DIAGONAL MATRIX. ");
4263 for (i = 1; i <=
fNpar; ++i) {
4265 for (j = 1; j <= i-1; ++j) {
4271 if (g2i <= 0) g2i = 1;
4272 fVhmat[ndex-1] = 2 / g2i;
4288 Double_t dmin_, d, dfmin, dgmin=0, change, chgold, grdold=0, epspri;
4289 Double_t fs1, optstp, fs2, grdnew=0, sag, xtf;
4290 Int_t icyc, ncyc=0, idrv, i, nparx;
4293 ldebug =
fIdbg[5] >= 1;
4301 for (i = 1; i <=
fNpar; ++i) {
4307 if (d > optstp) d = optstp;
4308 if (d < dmin_) d = dmin_;
4311 for (icyc = 1; icyc <= ncyc; ++icyc) {
4320 sag = (fs1 + fs2 -
fAmin*2)*.5;
4322 grdnew = (fs1 - fs2) / (d*2);
4325 Printf(
"%4d%2d%12.5g%12.5g%12.5g%12.5g%12.5g",i,idrv,
fGstep[i-1],d,
fG2[i-1],grdnew,sag);
4327 if (grdnew == 0)
goto L60;
4328 change =
TMath::Abs((grdold - grdnew) / grdnew);
4329 if (change > chgold && icyc > 1)
goto L60;
4335 if (change < .05)
goto L60;
4336 if (TMath::Abs(grdold - grdnew) < dgmin)
goto L60;
4338 mnwarn(
"D",
"MNHES1",
"Step size too small for 1st drv.");
4369 Double_t amax, ycalf, ystar, ystst;
4370 Double_t pb, ep, wg, xi, sigsav, reg, sig2;
4371 Int_t npfn, ndex, loop=0, i, j, ifail, iseed=0;
4372 Int_t jhold, nloop, nparx, nparp1, jh, jl, iswtr;
4374 if (
fNpar <= 0)
return;
4381 if (nloop <= 0) nloop =
fNpar + 4;
4388 for (i = 1; i <=
fNpar; ++i) {
4391 for (j = 1; j <= i; ++j) {
4392 ndex = i*(i-1) / 2 + j;
4398 if (ifail >= 1)
goto L280;
4400 for (i = 1; i <=
fNpar; ++i) {
4402 for (j = 1; j <= i; ++j) {
4410 for (i = 1; i <=
fNpar; ++i) {
4418 Printf(
"START ATTEMPT NO.%2d TO FIND NEW MINIMUM",loop);
4428 for (i = 1; i <=
fNpar; ++i) {
4431 fX[i-1] = xi -
fDirin[i-1]*(rnum - .5);
4437 }
else if (
fIMPRy[i-1] > amax) {
4450 if (
fAmin < 0)
goto L95;
4451 if (
fISW[1] <= 2)
goto L280;
4453 if (sig2 < ep &&
fEDM < ep)
goto L100;
4457 for (i = 1; i <=
fNpar; ++i) {
4465 if (ystar >=
fAmin)
goto L70;
4467 for (i = 1; i <=
fNpar; ++i) {
4472 if (ystst <
fIMPRy[jl-1])
goto L67;
4480 if (ystar >=
fIMPRy[jh-1])
goto L73;
4483 if (jhold != jh)
goto L50;
4486 for (i = 1; i <=
fNpar; ++i) {
4491 if (ystst >
fIMPRy[jh-1])
goto L30;
4493 if (ystst <
fAmin)
goto L67;
4499 Printf(
" AN IMPROVEMENT ON THE PREVIOUS MINIMUM HAS BEEN FOUND");
4506 for (i = 1; i <=
fNpar; ++i) {
4516 for (i = 1; i <=
fNpar; ++i) {
4534 Printf(
" IMPROVE HAS FOUND A TRULY NEW MINIMUM");
4535 Printf(
" *************************************");
4541 Printf(
" COVARIANCE MATRIX WAS NOT POSITIVE-DEFINITE");
4547 for (i = 1; i <=
fNpar; ++i) {
4556 Printf(
" IMPROVE HAS RETURNED TO REGION OF ORIGINAL MINIMUM");
4560 if (
fISW[1] < 2)
goto L380;
4561 if (loop < nloop &&
fISW[0] < 1)
goto L20;
4578 for (j = 0; j <
fNpar; ++j) {
4599 Double_t piby2, epstry, epsbak, distnn;
4617 fCovmes[0] =
"NO ERROR MATRIX ";
4618 fCovmes[1] =
"ERR MATRIX APPROXIMATE";
4619 fCovmes[2] =
"ERR MATRIX NOT POS-DEF";
4620 fCovmes[3] =
"ERROR MATRIX ACCURATE ";
4638 for (idb = 0; idb <= 10; ++
idb) {
fIdbg[
idb] = 0; }
4658 for (i = 1; i <= 100; ++i) {
4662 if (epsbak < epstry)
goto L35;
4666 Printf(
" MNINIT UNABLE TO DETERMINE ARITHMETIC PRECISION. WILL ASSUME:%g",
fEpsmac);
4696 if (i2 >
fMaxext || i2 < 0)
goto L900;
4697 if (i2 > 0)
goto L30;
4701 for (inu = 1; inu <=
fNu; ++inu) {
4702 if (
fNvarl[inu-1] <= 0)
continue;
4703 if (
fNvarl[inu-1] == 1 && newcod == 1)
continue;
4708 Printf(
" LIMITS NOT CHANGED FOR FIXED PARAMETER:%4d",inu);
4715 Printf(
" LIMITS REMOVED FROM PARAMETER :%3d",inu);
4719 snew =
fGstep[kint-1]*dxdi;
4727 Printf(
" PARAMETER %3d LIMITS SET TO %15.5g%15.5g",inu,
fAlim[inu-1],
fBlim[inu-1]);
4738 Printf(
" PARAMETER %3d IS NOT VARIABLE.", i2);
4744 Printf(
" REQUEST TO CHANGE LIMITS ON FIXED PARAMETER:%3d",i2);
4745 for (ifx = 1; ifx <=
fNpfix; ++ifx) {
4746 if (i2 ==
fIpfix[ifx-1])
goto L92;
4748 Printf(
" MINUIT BUG IN MNLIMS. SEE F. JAMES");
4756 Printf(
" LIMITS REMOVED FROM PARAMETER %2d",i2);
4765 fGrd[kint-1] *= dxdi;
4769 Printf(
" NO LIMITS SPECIFIED. PARAMETER %3d IS ALREADY UNLIMITED. NO CHANGE.",i2);
4778 Printf(
" PARAMETER %3d LIMITS SET TO %15.5g%15.5g",i2,
fAlim[i2-1],
fBlim[i2-1]);
4781 if (kint <= 0)
fGsteps[ifx-1] = -.1;
4782 else fGstep[kint-1] = -.1;
4785 if (
fCstatu !=
"NO CHANGE ") {
4810 Double_t xpq[12], ypq[12], slam, sdev, coeff[3], denom, flast;
4811 Double_t fvals[3], xvals[3],
f1, fvmin, xvmin, ratio,
f2, f3 = 0., fvmax;
4812 Double_t toler8, toler9, overal, undral, slamin, slamax, slopem;
4813 Int_t i, nparx=0, nvmax=0, nxypt, kk, ipt;
4820 l65 = 0; l70 = 0; l80 = 0;
4821 ldebug =
fIdbg[1] >= 1;
4830 Printf(
" MNLINE start point not consistent, F values, parameters=");
4831 for (kk = 1; kk <=
fNpar; ++kk) {
4840 chpq[0] = charal[0];
4845 for (i = 1; i <=
fNpar; ++i) {
4846 if (step[i-1] != 0) {
4848 if (slamin == 0) slamin = ratio;
4849 if (ratio < slamin) slamin = ratio;
4851 fX[i-1] = start[i-1] + step[i-1];
4853 if (slamin == 0) slamin =
fEpsmac;
4860 chpq[nxypt-1] = charal[nxypt-1];
4875 denom = (flast - fstart - slope*slam)*2 / (slam*slam);
4877 if (denom != 0) slam = -slope / denom;
4878 if (slam < 0) slam = slamax;
4879 if (slam > slamax) slam = slamax;
4880 if (slam < toler8) slam = toler8;
4881 if (slam < slamin) {
4885 if (
TMath::Abs(slam - 1) < toler8 && f1 < fstart) {
4889 if (
TMath::Abs(slam - 1) < toler8) slam = toler8 + 1;
4894 for (i = 1; i <=
fNpar; ++i) {
fX[i-1] = start[i-1] + slam*step[i-1]; }
4899 chpq[nxypt-1] = charal[nxypt-1];
4900 xpq[nxypt-1] = slam;
4906 if (fstart == fvmin) {
4908 toler8 = toler*slam;
4909 overal = slam - toler8;
4912 }
while (fstart == fvmin);
4914 if (!l65 && !l70 && !l80) {
4918 xvals[1] = xpq[nxypt-2];
4919 fvals[1] = ypq[nxypt-2];
4920 xvals[2] = xpq[nxypt-1];
4921 fvals[2] = ypq[nxypt-1];
4925 mnpfit(xvals, fvals, 3, coeff, sdev);
4926 if (coeff[2] <= 0) {
4927 slopem = coeff[2]*2*xvmin + coeff[1];
4928 if (slopem <= 0) slam = xvmin + slamax;
4929 else slam = xvmin - slamax;
4931 slam = -coeff[1] / (coeff[2]*2);
4932 if (slam > xvmin + slamax) slam = xvmin + slamax;
4933 if (slam < xvmin - slamax) slam = xvmin - slamax;
4938 else if (slam < undral)
4945 for (ipt = 1; ipt <= 3; ++ipt) {
4946 if (
TMath::Abs(slam - xvals[ipt-1]) < toler9) {
4957 for (i = 1; i <=
fNpar; ++i) {
fX[i-1] = start[i-1] + slam*step[i-1]; }
4961 chpq[nxypt-1] = charal[nxypt-1];
4962 xpq[nxypt-1] = slam;
4967 if (fvals[1] > fvmax) {
4971 if (fvals[2] > fvmax) {
4981 if (slam > xvmin) overal =
TMath::Min(overal,slam - toler8);
4982 if (slam < xvmin) undral =
TMath::Max(undral,slam + toler8);
4983 slam = (slam + xvmin)*.5;
4985 }
while (f3 >= fvmax);
4988 if (l65 || l70)
break;
4990 xvals[nvmax-1] = slam;
4991 fvals[nvmax-1] = f3;
4996 if (slam > xvmin) overal =
TMath::Min(overal,slam - toler8);
4997 if (slam < xvmin) undral =
TMath::Max(undral,slam + toler8);
4999 }
while (nxypt < 12);
5005 cmess =
" LINE SEARCH HAS EXHAUSTED THE LIMIT OF FUNCTION CALLS ";
5007 Printf(
" MNLINE DEBUG: steps=");
5008 for (kk = 1; kk <=
fNpar; ++kk) {
5009 Printf(
" %12.4g",step[kk-1]);
5014 if (l70) cmess =
" LINE SEARCH HAS ATTAINED TOLERANCE ";
5015 if (l80) cmess =
" STEP SIZE AT ARITHMETICALLY ALLOWED MINIMUM";
5018 for (i = 1; i <=
fNpar; ++i) {
5019 fDirin[i-1] = step[i-1]*xvmin;
5020 fX[i-1] = start[i-1] +
fDirin[i-1];
5024 mnwarn(
"D",
"MNLINE",
" LINE MINIMUM IN BACKWARDS DIRECTION");
5026 if (fvmin == fstart) {
5027 mnwarn(
"D",
"MNLINE",
" LINE SEARCH FINDS NO IMPROVEMENT ");
5030 Printf(
" AFTER %3d POINTS,%s",nxypt,(
const char*)cmess);
5045 Int_t ndex, i, j,
m,
n, ncoef, nparm,
id, it, ix;
5046 Int_t nsofar, ndi, ndj, iso, isw2, isw5;
5055 Printf(
" MNMATU: NPAR=0");
5069 if (
fNpar <= 1)
return;
5075 Printf(
" PARAMETER CORRELATION COEFFICIENTS ");
5076 ctemp =
" NO. GLOBAL";
5077 for (
id = 1;
id <= nparm; ++
id) {
5080 Printf(
"%s",(
const char*)ctemp);
5081 for (i = 1; i <=
fNpar; ++i) {
5083 ndi = i*(i + 1) / 2;
5084 for (j = 1; j <=
fNpar; ++j) {
5087 ndex = m*(m-1) / 2 + n;
5088 ndj = j*(j + 1) / 2;
5093 for (it = 1; it <= nparm; ++it) {
5096 Printf(
"%s",(
const char*)ctemp);
5097 if (i <= nparm)
continue;
5099 for (iso = 1; iso <= 10; ++iso) {
5102 for (it = nsofar + 1; it <= nparm; ++it) {
5105 Printf(
"%s",(
const char*)ctemp);
5106 if (i <= nparm)
break;
5125 Double_t gdel, gami, vlen, dsum, gssq, vsum, d;
5126 Double_t fzero, fs, ri, delgam, rhotol;
5128 Int_t npfn, ndex, iext, i, j,
m,
n, npsdf, nparx;
5129 Int_t iswtr, lined2, kk, nfcnmg, nrstrt,iter;
5133 if (
fNpar <= 0)
return;
5148 rhotol =
fApsi*.001;
5150 Printf(
" START MIGRAD MINIMIZATION. STRATEGY %2d. CONVERGENCE WHEN EDM .LT.%9.2e",
fIstrat,rhotol);
5165 if (
fISW[1] >= 1)
goto L10;
5173 if (
fISW[1] >= 1)
goto L10;
5175 for (i = 1; i <=
fNpar; ++i) {
5182 for (i = 1; i <=
fNpar; ++i) {
5183 if (
fG2[i-1] > 0)
continue;
5189 mnwarn(
"D",
"MNMIGR",
"Negative G2 line search");
5192 Printf(
" Negative G2 line search, param %3d %13.3g%13.3g",iext,fs,
fAmin);
5198 for (i = 1; i <=
fNpar; ++i) {
5200 for (j = 1; j <= i-1; ++j) {
5205 if (
fG2[i-1] <= 0)
fG2[i-1] = 1;
5210 Printf(
" DEBUG MNMIGR, STARTING MATRIX DIAGONAL, VHMAT=");
5211 for (kk = 1; kk <=
Int_t(vlen); ++kk) {
5225 for (i = 1; i <=
fNpar; ++i) {
5229 for (j = 1; j <= i-1; ++j) {
5238 mnwarn(
"W",
"MIGRAD",
"STARTING MATRIX NOT POS-DEFINITE.");
5248 if (iswtr >= 2)
mnmatu(0);
5254 for (i = 1; i <=
fNpar; ++i) {
5257 for (j = 1; j <=
fNpar; ++j) {
5260 ndex = m*(m-1) / 2 + n;
5261 ri +=
fVhmat[ndex-1]*fMIGRgs[j-1];
5267 mnwarn(
"D",
"MIGRAD",
" FIRST DERIVATIVES OF FCN ARE ALL ZERO");
5272 mnwarn(
"D",
"MIGRAD",
" NEWTON STEP NOT DESCENT.");
5273 if (npsdf == 1)
goto L1;
5280 if (
fAmin == fs)
goto L200;
5297 for (i = 1; i <=
fNpar; ++i) {
5300 for (j = 1; j <=
fNpar; ++j) {
5303 ndex = m*(m-1) / 2 + n;
5309 gdgssq += gami*gami;
5311 delgam +=
fDirin[i-1]*gami;
5316 if (
fEDM < 0 || gvg <= 0) {
5317 mnwarn(
"D",
"MIGRAD",
"NOT POS-DEF. EDM OR GVG NEGATIVE.");
5319 if (npsdf == 1)
goto L230;
5326 if (iswtr >= 3 || (iswtr == 2 && iter % 10 == 1)) {
5331 mnwarn(
"D",
"MIGRAD",
"NO CHANGE IN FIRST DERIVATIVES OVER LAST STEP");
5334 mnwarn(
"D",
"MIGRAD",
"FIRST DERIVATIVES INCREASING ALONG SEARCH LINE");
5340 for (kk = 1; kk <= 10; ++kk) {
5346 for (i = 1; i <=
fNpar; ++i) {
5347 for (j = 1; j <= i; ++j) {
5348 if(delgam == 0 || gvg == 0) d = 0;
5351 ndex = i*(i-1) / 2 + j;
5358 if (iswtr >= 3 || ldebug) {
5359 Printf(
" RELATIVE CHANGE IN COV. MATRIX=%5.1f per cent",
fDcovar*100);
5363 for (kk = 1; kk <= 10; ++kk) {
5367 if (delgam <= gvg)
goto L135;
5368 for (i = 1; i <=
fNpar; ++i) {
5371 for (i = 1; i <=
fNpar; ++i) {
5372 for (j = 1; j <= i; ++j) {
5373 ndex = i*(i-1) / 2 + j;
5379 if (
fEDM < rhotol*.1)
goto L300;
5381 for (i = 1; i <=
fNpar; ++i) {
5395 Printf(
" CALL LIMIT EXCEEDED IN MIGRAD.");
5402 Printf(
" MIGRAD FAILS TO FIND IMPROVEMENT");
5405 if (
fEDM < rhotol)
goto L300;
5408 Printf(
" MACHINE ACCURACY LIMITS FURTHER IMPROVEMENT.");
5414 Printf(
" MIGRAD FAILS WITH STRATEGY=0. WILL TRY WITH STRATEGY=1.");
5422 Printf(
" MIGRAD TERMINATED WITHOUT CONVERGENCE.");
5430 Printf(
" MIGRAD MINIMIZATION HAS CONVERGED.");
5435 Printf(
" MIGRAD WILL VERIFY CONVERGENCE AND ERROR MATRIX.");
5440 if (
fEDM > rhotol)
goto L10;
5451 if (iswtr >= 0)
mnprin(3, fAmin);
5452 if (iswtr >= 1)
mnmatu(1);
5467 Int_t nbad, ilax, ilax2, ngood, nfcnmi, iin, knt;
5469 if (
fNpar <= 0)
goto L700;
5474 for (knt = 1; knt <=
fNpar; ++knt) {
5478 if (knt >= 7)
break;
5480 if (ilax == 0)
break;
5481 if (ilax > 0 && ilax <=
fNu) {
5482 if (
fNiofex[ilax-1] > 0)
goto L565;
5484 Printf(
" PARAMETER NUMBER %3d NOT A VARIABLE. IGNORED.",ilax);
5490 mnmnot(ilax, ilax2, val2pl, val2mi);
5494 if (
fErp[iin-1] > 0) ++ngood;
5496 if (
fErn[iin-1] < 0) ++ngood;
5504 if (ngood == 0 && nbad == 0)
goto L700;
5505 if (ngood > 0 && nbad == 0)
fCstatu =
"SUCCESSFUL";
5506 if (ngood == 0 && nbad > 0)
fCstatu =
"FAILURE ";
5507 if (ngood > 0 && nbad > 0)
fCstatu =
"PROBLEMS ";
5517 Printf(
" NEW MINIMUM FOUND. GO BACK TO MINIMIZATION STEP.");
5518 Printf(
" =================================================");
5528 Printf(
" THERE ARE NO MINOS ERRORS TO CALCULATE.");
5546 Double_t abest, xunit, dc, ut, sigsav, du1;
5548 Int_t marc, isig, mpar, ndex, imax, indx, ierr, i, j;
5549 Int_t iercr, it, istrav, nfmxin, nlimit, isw2, isw4;
5563 for (i = 1; i <= mpar; ++i) {
fXt[i-1] =
fX[i-1]; }
5564 i__1 = mpar*(mpar + 1) / 2;
5566 for (i = 1; i <= mpar; ++i) {
5575 if (
fNvarl[ilax-1] == 1) {
5577 fBlim[ilax-1] = ut + fMNOTw[it-1]*100;
5579 ndex = it*(it + 1) / 2;
5582 for (i = 1; i <= mpar; ++i) {
5583 if (i == it)
continue;
5592 Printf(
" MINUIT ERROR. CANNOT FIX PARAMETER %4d INTERNAL %3d",ilax,it);
5598 for (isig = 1; isig <= 2; ++isig) {
5608 Printf(
" DETERMINATION OF %sTIVE MINOS ERROR FOR PARAMETER %d %s" 5609 ,(
const char*)csig,ilax
5610 ,(
const char*)
fCpnam[ilax-1]);
5613 mnwarn(
"D",
"MINOS",
"NO COVARIANCE MATRIX.");
5615 nlimit =
fNfcn + nfmxin;
5618 fU[ilax-1] = ut + sig*du1;
5621 delu =
fU[ilax-1] - ut;
5624 fac = delu /
fMNOTw[it-1];
5625 for (i = 1; i <=
fNpar; ++i) {
5629 Printf(
" PARAMETER %4d SET TO%11.3e + %10.3e = %12.3e",ilax,ut,delu,
fU[ilax-1]);
5640 if (abest -
fAmin >
fUp*.01)
goto L650;
5641 if (iercr == 1)
goto L440;
5642 if (iercr == 2)
goto L450;
5643 if (iercr == 3)
goto L460;
5647 Printf(
" THE %4sTIVE MINOS ERROR OF PARAMETER %3d %10s, IS %12.4e" 5648 ,(
const char*)csig,ilax
5649 ,(
const char*)
fCpnam[ilax-1],eros);
5655 Printf(
" THE %4sTIVE MINOS ERROR OF PARAMETER %3d, %s EXCEEDS ITS LIMIT." 5656 ,(
const char*)csig,ilax
5657 ,(
const char*)
fCpnam[ilax-1]);
5663 Printf(
" THE %4sTIVE MINOS ERROR %4d REQUIRES MORE THAN %5d FUNCTION CALLS." 5664 ,(
const char*)csig,ilax,nfmxin);
5670 Printf(
" %4sTIVE MINOS ERROR NOT CALCULATED FOR PARAMETER %d" 5671 ,(
const char*)csig,ilax);
5677 Printf(
" **************************************************************************");
5681 if (ilax2 > 0 && ilax2 <=
fNu) val2mi =
fU[ilax2-1];
5684 if (ilax2 > 0 && ilax2 <=
fNu) val2pl =
fU[ilax2-1];
5691 i__1 = mpar*(mpar + 1) / 2;
5693 for (i = 1; i <= mpar; ++i) {
5742 Double_t vplu, a_small, gsmin, pinti, vminu, danger, sav, sav2;
5743 Int_t ierr,
kint, in, ix, ktofix, lastin, kinfix, nvl;
5751 Printf(
" MINUIT USER ERROR. PARAMETER NUMBER IS %3d ALLOWED RANGE IS ONE TO %4d",k,fMaxext);
5756 if (
fNvarl[k-1] < 0)
goto L50;
5759 for (ix = 1; ix <=
fNpfix; ++ix) {
5760 if (
fIpfix[ix-1] == k) ktofix = k;
5763 mnwarn(
"W",
"PARAM DEF",
"REDEFINING A FIXED PARAMETER.");
5765 Printf(
" CANNOT RELEASE. MAX NPAR EXCEEDED.");
5776 Printf(
" PARAMETER DEFINITIONS:");
5777 Printf(
" NO. NAME VALUE STEP SIZE LIMITS");
5780 if (wk > 0)
goto L122;
5783 Printf(
" %5d %-10s %13.5e constant",k,(
const char*)cnamk,uk);
5788 if (a == 0 && b == 0) {
5792 Printf(
" %5d %-10s %13.5e%13.5e no limits",k,(
const char*)cnamk,uk,wk);
5799 Printf(
" %5d %-10s %13.5e%13.5e %13.5e%13.5e",k,(
const char*)cnamk,uk,wk,a,b);
5805 Printf(
" MINUIT USER ERROR. TOO MANY VARIABLE PARAMETERS.");
5808 if (nvl == 1)
goto L200;
5810 Printf(
" USER ERROR IN MINUIT PARAMETER");
5812 Printf(
" UPPER AND LOWER LIMITS EQUAL.");
5819 mnwarn(
"W",
"PARAM DEF",
"PARAMETER LIMITS WERE REVERSED.");
5826 danger = (b - uk)*(uk - a);
5828 mnwarn(
"W",
"PARAM DEF",
"STARTING VALUE OUTSIDE LIMITS.");
5831 mnwarn(
"W",
"PARAM DEF",
"STARTING VALUE IS AT LIMIT.");
5849 for (ix = 1; ix <= k-1; ++ix) {
if (
fNiofex[ix-1] > 0) ++lastin; }
5851 if (kint ==
fNpar)
goto L280;
5854 for (in =
fNpar; in >= lastin + 1; --in) {
5868 for (in = lastin + 1; in <=
kint; ++in) {
5891 mnpint(sav, ix-1, pinti);
5893 fXt[in-1] =
fX[in-1];
5896 mnpint(sav2, ix-1, pinti);
5897 vplu = pinti -
fX[in-1];
5899 mnpint(sav2, ix-1, pinti);
5900 vminu = pinti - fX[in-1];
5919 if (kinfix > 0)
mnfixp(kinfix-1, ierr);
5920 if (ierr > 0)
goto L800;
5945 Double_t a=0, b=0, fk=0, uk=0, wk=0, xk=0;
5946 Int_t ierr, kapo1, kapo2;
5947 Int_t k, llist, ibegin, lenbuf, istart, lnc, icy;
5948 TString cnamk, comand, celmnt, ctemp;
5951 lenbuf = strlen((
const char*)crdbuf);
5953 kapo1 = strspn((
const char*)crdbuf,
"'");
5954 if (kapo1 == 0)
goto L150;
5955 kapo2 = strspn((
const char*)crdbuf + kapo1,
"'");
5956 if (kapo2 == 0)
goto L150;
5960 for (istart = 1; istart <= kapo1-1; ++istart) {
5961 if (crdbuf(istart-1,1) !=
' ')
goto L120;
5966 celmnt = crdbuf(istart-1, kapo1-istart);
5967 if (scanf((
const char*)celmnt,&fk)) {;}
5969 if (k <= 0)
goto L210;
5970 cnamk =
"PARAM " + celmnt;
5971 if (kapo2 - kapo1 > 1) {
5972 cnamk = crdbuf(kapo1, kapo2-1-kapo1);
5975 for (icy = kapo2 + 1; icy <= lenbuf; ++icy) {
5976 if (crdbuf(icy-1,1) ==
',')
goto L139;
5977 if (crdbuf(icy-1,1) !=
' ')
goto L140;
5988 ctemp = crdbuf(ibegin-1,lenbuf-ibegin);
5990 if (ierr > 0)
goto L180;
6001 if (scanf((
const char*)crdbuf,&xk,stmp,&uk,&wk,&a,&b)) {;}
6004 if (k == 0)
goto L210;
6007 mnparm(k-1, cnamk, uk, wk, a, b, ierr);
6035 Double_t a,
f, s, t,
y, s2,
x2,
x3,
x4, y2, cz[3], xm,
xy, x2y;
6045 for (i = 1; i <= 3; ++i) { cz[i-1] = 0; }
6047 if (npar2p < 3)
goto L10;
6051 for (i = 1; i <= npar2p; ++i) { xm += parx2p[i]; }
6060 for (i = 1; i <= npar2p; ++i) {
6072 a = (f*x4 - x2*
x2)*x2 - f*(x3*x3);
6073 if (a == 0)
goto L10;
6074 cz[2] = (x2*(f*x2y - x2*
y) - f*x3*xy) /
a;
6075 cz[1] = (xy - x3*cz[2]) / x2;
6076 cz[0] = (y - x2*cz[2]) / f;
6077 if (npar2p == 3)
goto L6;
6078 sdev2p = y2 - (cz[0]*y + cz[1]*xy + cz[2]*x2y);
6079 if (sdev2p < 0) sdev2p = 0;
6082 cz[0] += xm*(xm*cz[2] - cz[1]);
6083 cz[1] -= xm*2*cz[2];
6085 for (i = 1; i <= 3; ++i) { coef2p[i] = cz[i-1]; }
6108 yy = (pexti - alimi)*2 / (blimi - alimi) - 1;
6113 chbuf2 =
" IS AT ITS LOWER ALLOWED LIMIT.";
6116 chbuf2 =
" IS AT ITS UPPER ALLOWED LIMIT.";
6119 pexti = alimi + (blimi - alimi)*.5*(
TMath::Sin(a) + 1);
6121 if (yy2 > 1) chbuf2 =
" BROUGHT BACK INSIDE LIMITS.";
6151 if ((h =
gROOT->GetPluginManager()->FindHandler(
"TMinuitGraph"))) {
6164 Double_t bwidx, bwidy, xbest, ybest, ax, ay, bx, by;
6165 Double_t xvalus[12], any, dxx, dyy;
6166 Int_t iten, i, j, k, maxnx, maxny, iquit, ni, linodd;
6167 Int_t nxbest, nybest, km1, ibk, isp1,
nx,
ny, ks, ix;
6176 if (maxnx < 10) maxnx = 10;
6178 if (maxny < 10) maxny = 10;
6179 if (nxypt <= 1)
return;
6185 for (i = 1; i <= km1; ++i) {
6188 for (j = 1; j <= ni; ++j) {
6189 if (ypt[j-1] > ypt[j])
continue;
6201 if (iquit == 0)
break;
6206 for (i = 1; i <= nxypt; ++i) {
6207 if (xpt[i-1] > xmax) xmax = xpt[i-1];
6208 if (xpt[i-1] < xmin) xmin = xpt[i-1];
6210 dxx = (xmax -
xmin)*.001;
6213 mnbins(xmin, xmax, maxnx, xmin, xmax, nx, bwidx);
6215 ymin = ypt[nxypt-1];
6216 if (ymax == ymin) ymax = ymin + 1;
6217 dyy = (ymax -
ymin)*.001;
6220 mnbins(ymin, ymax, maxny, ymin, ymax, ny, bwidy);
6223 if (chbest ==
' ')
goto L50;
6224 xbest = (xmax +
xmin)*.5;
6225 ybest = (ymax +
ymin)*.5;
6233 for (i = 1; i <= nxypt; ++i) {
6234 xpt[i-1] = ax*xpt[i-1] + bx;
6235 ypt[i-1] = any - ay*ypt[i-1] - by;
6237 nxbest =
Int_t((ax*xbest + bx));
6238 nybest =
Int_t((any - ay*ybest - by));
6245 for (i = 1; i <=
ny; ++i) {
6246 for (ibk = 1; ibk <=
nx; ++ibk) { cline[ibk-1] =
' '; }
6251 if (nx>0) cline[nx-1] =
'.';
6252 cline[nxbest-1] =
'.';
6253 if (i != 1 && i != nybest && i != ny)
goto L320;
6254 for (j = 1; j <=
nx; ++j) { cline[j-1] =
'.'; }
6257 if (isp1 > nxypt)
goto L350;
6259 for (k = isp1; k <= nxypt; ++k) {
6260 ks =
Int_t(ypt[k-1]);
6261 if (ks > i)
goto L345;
6262 ix =
Int_t(xpt[k-1]);
6263 if (cline[ix-1] ==
'.')
goto L340;
6264 if (cline[ix-1] ==
' ')
goto L340;
6265 if (cline[ix-1] == chpt[k-1])
continue;
6272 cline[ix-1] = chpt[k-1];
6279 if (linodd == 1 || i == ny)
goto L380;
6282 Printf(
" %s",(
const char*)ctemp);
6286 Printf(
" %14.7g ..%s",yprt,(
const char*)ctemp);
6292 for (ibk = 1; ibk <=
nx; ++ibk) {
6294 if (ibk % 10 == 1) cline[ibk-1] =
'/';
6298 for (ibk = 1; ibk <= 12; ++ibk) {
6299 xvalus[ibk-1] = xmin +
Double_t(ibk-1)*10*bwidx;
6301 iten = (nx + 9) / 10;
6302 for (ibk = 1; ibk <= iten && ibk <= 12; ++ibk) {
6303 snprintf(cline + (ibk-1)*10, 11-(ibk == 12),
"%#9.3g ", xvalus[ibk-1]);
6307 if (overpr) chmess =
" Overprint character is &";
6308 Printf(
" ONE COLUMN=%13.7g%s",bwidx,(
const char*)chmess);
6331 Int_t iint, iext, nvl;
6333 Int_t iuext = iuext1 + 1;
6337 if (iuext == 0)
goto L100;
6341 if (iint >
fNpar)
goto L100;
6347 if (iext >
fNu)
goto L100;
6353 if (nvl < 0)
goto L100;
6356 if (iint > 0) err =
fWerr[iint-1];
6358 xlolim =
fAlim[iext-1];
6359 xuplim =
fBlim[iext-1];
6365 chnam =
"undefined";
6394 Int_t nadd, i, k,
l,
m, ikode, ic, nc, ntrail, lbl;
6396 TString colhdl[6], colhdu[6], cx2, cx3, cheval;
6399 Printf(
" THERE ARE CURRENTLY NO PARAMETERS DEFINED");
6405 ikode =
fISW[1] + 1;
6406 if (ikode > 3) ikode = 3;
6409 for (k = 1; k <= 6; ++k) {
6410 colhdu[k-1] =
"UNDEFINED";
6411 colhdl[k-1] =
"COLUMN HEAD";
6418 if (fval ==
fUndefi) cheval =
" unknown ";
6419 else cheval.
Form(
"%g",fval);
6425 Printf(
" FCN=%s FROM %8s STATUS=%10s %6d CALLS %9d TOTAL" 6426 ,(
const char*)cheval
6430 if (m == 0 || m == 2 ||
fDcovar == 0) {
6431 Printf(
" EDM=%s STRATEGY=%2d %s" 6437 Printf(
" EDM=%s STRATEGY=%2d ERROR MATRIX UNCERTAINTY %5.1f per cent" 6438 ,(
const char*)chedm,
fIstrat,dc);
6441 if (ikode == 0)
return;
6444 for (i = 1; i <=
fNu; ++i) {
6445 if (
fNvarl[i-1] < 0)
continue;
6446 for (ic = 10; ic >= 1; --ic) {
6447 if (
fCpnam[i-1](ic-1,1) !=
" ")
goto L16;
6452 if (lbl < ntrail) ntrail = lbl;
6454 nadd = ntrail / 2 + 1;
6457 colhdl[0] =
" ERROR ";
6458 colhdu[1] =
" PHYSICAL";
6459 colhdu[2] =
" LIMITS ";
6460 colhdl[1] =
" NEGATIVE ";
6461 colhdl[2] =
" POSITIVE ";
6465 colhdl[0] =
" ERROR ";
6466 colhdu[1] =
" INTERNAL ";
6467 colhdl[1] =
" STEP SIZE ";
6468 colhdu[2] =
" INTERNAL ";
6469 colhdl[2] =
" VALUE ";
6473 colhdl[0] =
" ERROR ";
6474 colhdu[1] =
" STEP ";
6475 colhdl[1] =
" SIZE ";
6476 colhdu[2] =
" FIRST ";
6477 colhdl[2] =
" DERIVATIVE ";
6480 colhdu[0] =
" PARABOLIC ";
6481 colhdl[0] =
" ERROR ";
6482 colhdu[1] =
" MINOS ";
6483 colhdu[2] =
"ERRORS ";
6484 colhdl[1] =
" NEGATIVE ";
6485 colhdl[2] =
" POSITIVE ";
6489 if (
fISW[1] < 3) colhdu[0] =
" APPROXIMATE ";
6490 if (
fISW[1] < 1) colhdu[0] =
" CURRENT GUESS";
6492 Printf(
" EXT PARAMETER %-14s%-14s%-14s",(
const char*)colhdu[0]
6493 ,(
const char*)colhdu[1]
6494 ,(
const char*)colhdu[2]);
6495 Printf(
" NO. NAME VALUE %-14s%-14s%-14s",(
const char*)colhdl[0]
6496 ,(
const char*)colhdl[1]
6497 ,(
const char*)colhdl[2]);
6499 for (i = 1; i <=
fNu; ++i) {
6500 if (
fNvarl[i-1] < 0)
continue;
6502 cnambf = cblank(0,nadd) +
fCpnam[i-1];
6503 if (l == 0)
goto L55;
6506 cx2 =
"PLEASE GET X..";
6507 cx3 =
"PLEASE GET X..";
6510 Printf(
"%4d %-11s%14.5e%14.5e",i,(
const char*)cnambf,
fU[i-1],x1);
6525 cx3 =
"** at limit **";
6530 if (x2 == 0) cx2 =
" ";
6531 if (x2 ==
fUndefi) cx2 =
" at limit ";
6533 if (x3 == 0) cx3 =
" ";
6534 if (x3 ==
fUndefi) cx3 =
" at limit ";
6536 if (cx2 ==
"PLEASE GET X..") cx2.
Form(
"%14.5e",x2);
6537 if (cx3 ==
"PLEASE GET X..") cx3.
Form(
"%14.5e",x3);
6538 Printf(
"%4d %-11s%14.5e%14.5e%-14s%-14s",i
6539 ,(
const char*)cnambf,
fU[i-1],x1
6540 ,(
const char*)cx2,(
const char*)cx3);
6543 if (
fNvarl[i-1] <= 1 || ikode == 3)
continue;
6545 Printf(
" WARNING - - ABOVE PARAMETER IS AT LIMIT.");
6551 colhdu[0] =
" constant ";
6552 if (
fNvarl[i-1] > 0) colhdu[0] =
" fixed ";
6553 if (
fNvarl[i-1] == 4 && ikode == 1) {
6554 Printf(
"%4d %-11s%14.5e%-14s%14.5e%14.5e",i
6555 ,(
const char*)cnambf,
fU[i-1]
6556 ,(
const char*)colhdu[0],
fAlim[i-1],
fBlim[i-1]);
6558 Printf(
"%4d %-11s%14.5e%s",i
6559 ,(
const char*)cnambf,
fU[i-1],(
const char*)colhdu[0]);
6578 Double_t dgmin, padd, pmin, pmax, dg, epspdf, epsmin;
6579 Int_t ndex, i, j, ndexd,
ip, ifault;
6586 for (i = 1; i <=
fNpar; ++i) {
6587 ndex = i*(i + 1) / 2;
6588 if (
fVhmat[ndex-1] <= 0) {
6594 dg = epspdf + 1 - dgmin;
6600 for (i = 1; i <=
fNpar; ++i) {
6604 if (
fVhmat[ndexd-1]==0) {
6609 for (j = 1; j <= i; ++j) {
6618 for (ip = 2; ip <=
fNpar; ++
ip) {
6624 Printf(
" EIGENVALUES OF SECOND-DERIVATIVE MATRIX:");
6626 for (ip = 1; ip <=
fNpar; ++
ip) {
6631 if (pmin > epspdf*pmax)
return;
6633 padd = pmax*.001 - pmin;
6634 for (ip = 1; ip <=
fNpar; ++
ip) {
6635 ndex = ip*(ip + 1) / 2;
6636 fVhmat[ndex-1] *= padd + 1;
6639 mnwarn(
"W",
fCfrom,
Form(
"MATRIX FORCED POS-DEF BY ADDING %f TO DIAGONAL.",padd));
6660 for (i = 1; i <=
fNpar; ++i) {
fX[i-1] = pnew[i-1]; }
6668 for (j = 2; j <= nparp1; ++j) {
if (y[j-1] > y[jh-1]) jh = j; }
6669 fEDM = y[jh-1] - y[jl-1];
6670 if (
fEDM <= 0)
goto L45;
6671 for (i = 1; i <=
fNpar; ++i) {
6674 for (j = 2; j <= nparp1; ++j) {
6678 fDirin[i-1] = pbig - plit;
6683 Printf(
" FUNCTION VALUE DOES NOT SEEM TO DEPEND ON ANY OF THE %d VARIABLE PARAMETERS.",
fNpar);
6684 Printf(
" VERIFY THAT STEP SIZES ARE BIG ENOUGH AND CHECK FCN LOGIC.");
6685 Printf(
" *******************************************************************************");
6686 Printf(
" *******************************************************************************");
6703 static Int_t iseed = 12345;
6707 if (val == 3)
goto L100;
6710 iseed = (iseed - k*53668)*40014 - k*12211;
6711 if (iseed < 0) iseed += 2147483563;
6712 val =
Double_t(iseed*4.656613e-10);
6743 for (i = 1; i <=
fNpar; ++i) {
6765 Printf(
"mnsave is dummy in TMinuit");
6780 Double_t step, uhigh, xhreq, xlreq, ubest, fnext, unext, xh, xl;
6782 Int_t nxypt, nccall, iparwd;
6787 if (ncall <= 1) ncall = 41;
6788 if (ncall > 98) ncall = 98;
6794 if (iparwd > 0)
goto L200;
6799 if (ipar >
fNu)
goto L900;
6801 if (iint <= 0)
goto L100;
6813 if (
fNvarl[ipar-1] > 1)
goto L300;
6816 if (xlreq == xhreq)
goto L250;
6818 step = (xhreq - xlreq) /
Double_t(ncall-1);
6821 xl = ubest -
fWerr[iint-1];
6822 xh = ubest + fWerr[iint-1];
6823 mnbins(xl, xh, ncall, unext, uhigh, nbins, step);
6828 if (xlreq == xhreq)
goto L350;
6833 if (xl >= xh)
goto L700;
6835 step = (xh - xl) /
Double_t(ncall-1);
6838 unext =
fAlim[ipar-1];
6842 for (icall = 1; icall <= nccall; ++icall) {
6847 fXpt[nxypt-1] = unext;
6848 fYpt[nxypt-1] = fnext;
6849 fChpt[nxypt-1] =
'*';
6850 if (fnext <
fAmin) {
6863 Printf(
"%dSCAN OF PARAMETER NO. %d, %s" 6868 Printf(
" REQUESTED RANGE OUTSIDE LIMITS FOR PARAMETER %d",ipar);
6870 if (iparwd <= 0)
goto L100;
6891 Double_t dxdi, rnum, ftry, rnum1, rnum2, alpha;
6893 Int_t ipar, iext, j, ifail, iseed=0, nparx, istep, ib, mxfail, mxstep;
6896 if (mxfail <= 0) mxfail =
fNpar*20 + 100;
6900 if (alpha <= 0) alpha = 3;
6902 Printf(
" MNSEEK: MONTE CARLO MINIMIZATION USING METROPOLIS ALGORITHM");
6903 Printf(
" TO STOP AFTER %6d SUCCESSIVE FAILURES, OR %7d STEPS",mxfail,mxstep);
6904 Printf(
" MAXIMUM STEP SIZE IS %9.3f ERROR BARS.",alpha);
6916 for (ipar = 1; ipar <=
fNpar; ++ipar) {
6919 if (
fNvarl[iext-1] > 1) {
6922 if (dxdi == 0) dxdi = 1;
6923 fDirin[ipar-1] = alpha*2*fWerr[ipar-1] / dxdi;
6925 fDirin[ipar-1] = 6.2831859999999997;
6932 for (istep = 1; istep <= mxstep; ++istep) {
6933 if (ifail >= mxfail)
break;
6934 for (ipar = 1; ipar <=
fNpar; ++ipar) {
6964 Printf(
" MNSEEK: %5d SUCCESSIVE UNSUCCESSFUL TRIALS.",ifail);
6988 static const char *cname[30] = {
7020 static Int_t nname = 25;
7021 static Int_t nntot = 30;
7023 "-1: NO OUTPUT EXCEPT FROM SHOW ",
7024 " 0: REDUCED OUTPUT ",
7025 " 1: NORMAL OUTPUT ",
7026 " 2: EXTRA OUTPUT FOR PROBLEM CASES",
7027 " 3: MAXIMUM OUTPUT "};
7030 " 0: MINIMIZE THE NUMBER OF CALLS TO FUNCTION",
7031 " 1: TRY TO BALANCE SPEED AGAINST RELIABILITY",
7032 " 2: MAKE SURE MINIMUM TRUE, ERRORS CORRECT "};
7035 "REPORT ALL EXCEPTIONAL CONDITIONS ",
7036 "MNLINE: LINE SEARCH MINIMIZATION ",
7037 "MNDERI: FIRST DERIVATIVE CALCULATIONS ",
7038 "MNHESS: SECOND DERIVATIVE CALCULATIONS ",
7039 "MNMIGR: COVARIANCE MATRIX UPDATES ",
7040 "MNHES1: FIRST DERIVATIVE UNCERTAINTIES ",
7041 "MNCONT: MNCONTOUR PLOT (MNCROS SEARCH) "};
7048 Int_t iset, iprm, i, jseed, kname, iseed, iunit,
id, ii, kk;
7049 Int_t ikseed, idbopt, igrain=0, iswsav, isw2;
7050 TString cfname, cmode, ckind, cwarn, copt, ctemp, ctemp2;
7053 for (i = 1; i <= nntot; ++i) {
7057 if (strstr(ctemp2.
Data(),ckind.
Data()))
goto L5;
7065 if ( ctemp2.
Contains(
"HEL"))
goto L2000;
7066 if ( ctemp2.
Contains(
"SHO"))
goto L1000;
7067 if (!ctemp2.
Contains(
"SET"))
goto L1900;
7071 if (kname <= 0)
goto L1900;
7073 switch ((
int)kname) {
7091 case 18:
goto L3000;
7093 case 20:
goto L3000;
7098 case 25:
goto L3000;
7099 case 26:
goto L1900;
7109 if (iprm >
fNu)
goto L25;
7110 if (iprm <= 0)
goto L25;
7111 if (
fNvarl[iprm-1] < 0)
goto L25;
7123 Printf(
" UNDEFINED PARAMETER NUMBER. IGNORED.");
7154 for (i = 1; i <=
fNpar; ++i) {
7182 mnwarn(
"W",
"SHO",
"SHO");
7190 Printf(
" MINUIT RANDOM NUMBER SEED SET TO %d",jseed);
7202 if (
fISW[4] > 0)
goto L1172;
7220 if (
fISW[4] >= 0)
goto L1220;
7225 if (
fISW[4] >= 0)
goto L1100;
7230 if (
fISW[4] >= 0)
goto L1100;
7241 if (idbopt > 6)
goto L288;
7243 fIdbg[idbopt] = iset;
7244 if (iset == 1)
fIdbg[0] = 1;
7247 for (
id = 0;
id <= 6; ++
id) {
fIdbg[
id] = iset; }
7250 mnwarn(
"D",
"SHO",
"SHO");
7253 Printf(
" UNKNOWN DEBUG OPTION %d REQUESTED. IGNORED",idbopt);
7264 if (kname <= 0)
goto L1900;
7266 switch ((
int)kname) {
7276 case 10:
goto L1100;
7277 case 11:
goto L1110;
7278 case 12:
goto L1120;
7279 case 13:
goto L1130;
7280 case 14:
goto L1130;
7281 case 15:
goto L1150;
7282 case 16:
goto L1160;
7283 case 17:
goto L1170;
7284 case 18:
goto L1180;
7285 case 19:
goto L1190;
7286 case 20:
goto L1200;
7287 case 21:
goto L1210;
7288 case 22:
goto L1220;
7289 case 23:
goto L1100;
7290 case 24:
goto L1100;
7291 case 25:
goto L1250;
7292 case 26:
goto L1900;
7293 case 27:
goto L1270;
7294 case 28:
goto L1270;
7295 case 29:
goto L1290;
7296 case 30:
goto L1300;
7326 Printf(
" ALLOWED PRINT LEVELS ARE:");
7332 Printf(
" CURRENT PRINTOUT LEVEL IS %s",cprlev[
fISW[4]+1].
Data());
7337 Printf(
" NOGRAD IS SET. DERIVATIVES NOT COMPUTED IN FCN.");
7339 Printf(
" GRAD IS SET. USER COMPUTES DERIVATIVES IN FCN.");
7344 Printf(
" ERRORS CORRESPOND TO FUNCTION CHANGE OF %g",
fUp);
7368 cmode =
"BATCH MODE ";
7369 if (
fISW[5] == 1) cmode =
"INTERACTIVE MODE";
7370 if (! lname) cfname =
"unknown";
7371 Printf(
" INPUT NOW BEING READ IN %s FROM UNIT NO. %d FILENAME: %s" 7372 ,(
const char*)cmode,
fIsysrd,(
const char*)cfname);
7384 cwarn =
"SUPPRESSED";
7385 if (
fLwarn) cwarn =
"REPORTED ";
7386 Printf(
"%s",(
const char*)cwarn);
7394 Printf(
" MINUIT RNDM SEED IS CURRENTLY=%d",ikseed);
7401 Printf(
" TITLE OF CURRENT TASK IS:%s",(
const char*)
fCtitl);
7405 Printf(
" ALLOWED STRATEGIES ARE:");
7410 Printf(
" NOW USING STRATEGY %s",(
const char*)cstrat[
fIstrat]);
7427 Printf(
" NO PAGE THROWS IN MINUIT OUTPUT");
7432 for (ii = 1; ii <=
fNpar; ++ii) {
7433 if (
fErp[ii-1] > 0 ||
fErn[ii-1] < 0)
goto L1204;
7435 Printf(
" THERE ARE NO MINOS ERRORS CURRENTLY VALID.");
7442 Printf(
" FLOATING-POINT NUMBERS ASSUMED ACCURATE TO %g",
fEpsmac);
7450 Printf(
" THIS IS MINUIT VERSION:%s",(
const char*)
fCvrsn);
7454 for (
id = 0;
id <= 6; ++
id) {
7456 if (
fIdbg[
id] >= 1) copt =
"ON ";
7457 Printf(
" DEBUG OPTION %3d IS %3s :%s" 7458 ,
id,(
const char*)copt,(
const char*)cdbopt[
id]);
7473 Printf(
" THE COMMAND:%10s IS UNKNOWN.",(
const char*)
fCword);
7480 if (strcmp(ctemp2.
Data(),
"SHO")) ckind =
"SHOW";
7482 Printf(
" THE FORMAT OF THE %4s COMMAND IS:",(
const char*)ckind);
7483 Printf(
" %s xxx [numerical arguments if any]",(
const char*)ckind);
7484 Printf(
" WHERE xxx MAY BE ONE OF THE FOLLOWING:");
7485 for (kk = 1; kk <= nname; ++kk) {
7486 Printf(
" %s",cname[kk-1]);
7492 Printf(
" ABOVE COMMAND IS ILLEGAL. IGNORED");
7514 Double_t dmin_, dxdi, yrho,
f, ynpp1, aming, ypbar;
7515 Double_t bestx, ystar, y1, y2, ystst, pb, wg;
7516 Double_t absmin, rho, sig2, rho1, rho2;
7517 Int_t npfn, i, j, k, jhold, ncycl, nparx;
7518 Int_t nparp1, kg, jh, nf, jl, ns;
7520 if (
fNpar <= 0)
return;
7529 rho2 = rho1 + alpha*
gamma;
7532 Printf(
" START SIMPLEX MINIMIZATION. CONVERGENCE WHEN EDM .LT. %g",
fEpsi);
7534 for (i = 1; i <=
fNpar; ++i) {
7547 for (i = 1; i <=
fNpar; ++i) {
7558 if (f <= aming)
goto L6;
7560 if (kg == 1)
goto L8;
7564 if (nf < 3)
goto L4;
7574 if (ns < 6)
goto L4;
7578 if (aming < absmin) jl = i;
7579 if (aming < absmin) absmin = aming;
7599 for (i = 1; i <=
fNpar; ++i) {
7607 if (ystar >=
fAmin)
goto L70;
7609 for (i = 1; i <=
fNpar; ++i) {
7615 y1 = (ystar -
fSIMPy[jh-1])*rho2;
7616 y2 = (ystst -
fSIMPy[jh-1])*rho1;
7617 rho = (rho2*y1 - rho1*y2)*.5 / (y1 - y2);
7618 if (rho < rhomin)
goto L66;
7619 if (rho > rhomax) rho = rhomax;
7620 for (i = 1; i <=
fNpar; ++i) {
7625 if (yrho <
fSIMPy[jl-1] && yrho < ystst)
goto L65;
7626 if (ystst <
fSIMPy[jl-1])
goto L67;
7627 if (yrho >
fSIMPy[jl-1])
goto L66;
7633 if (ystst <
fSIMPy[jl-1])
goto L67;
7640 if (
fISW[4] < 2)
goto L50;
7641 if (
fISW[4] >= 3 || ncycl % 10 == 0) {
7647 if (ystar >=
fSIMPy[jh-1])
goto L73;
7650 if (jhold != jh)
goto L50;
7653 for (i = 1; i <=
fNpar; ++i) {
7658 if (ystst >
fSIMPy[jh-1])
goto L1;
7660 if (ystst <
fAmin)
goto L67;
7666 Printf(
" SIMPLEX MINIMIZATION HAS CONVERGED.");
7672 Printf(
" SIMPLEX TERMINATES WITHOUT CONVERGENCE.");
7678 for (i = 1; i <=
fNpar; ++i) {
7748 static TString cpt =
" ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890./;:[]$%*_!@#&+()";
7751 l = strlen((
const char*)cfname);
7752 for (i = 1; i <=
l; ++i) {
7753 for (ic = 1; ic <= 80; ++ic) {
7754 if (cfname[i-1] == cpt[ic-1])
goto L100;
7778 Int_t i, j, k, kp1, km1;
7786 if (n < 1)
goto L100;
7789 for (i = 1; i <=
n; ++i) {
7791 if (si <= 0)
goto L100;
7794 for (i = 1; i <=
n; ++i) {
7795 for (j = 1; j <=
n; ++j) {
7800 for (i = 1; i <=
n; ++i) {
7803 if (a[k + k*l] != 0)
fVERTq[k-1] = 1 / a[k + k*
l];
7809 if (km1 < 0)
goto L100;
7810 else if (km1 == 0)
goto L50;
7813 for (j = 1; j <= km1; ++j) {
7819 if (k - n < 0)
goto L51;
7820 else if (k - n == 0)
goto L60;
7823 for (j = kp1; j <=
n; ++j) {
7830 for (j = 1; j <=
n; ++j) {
7835 for (j = 1; j <=
n; ++j) {
7836 for (k = 1; k <= j; ++k) {
7838 a[j + k*
l] = a[k + j*
l];
7866 const Int_t kMAXMES = 10;
7867 Int_t ityp, i, ic, nm;
7870 if (corg(0,3) !=
"SHO" || cmes(0,3) !=
"SHO") {
7876 Printf(
" MINUIT WARNING IN %s",(
const char*)corg);
7877 Printf(
" ============== %s",(
const char*)cmes);
7883 Printf(
" MINUIT DEBUG FOR %s",(
const char*)corg);
7884 Printf(
" =============== %s ",(
const char*)cmes);
7909 englsh =
" WAS SUPPRESSED. ";
7910 if (
fNwrmes[ityp-1] > 1) englsh =
"S WERE SUPPRESSED.";
7912 ,(
const char*)ctyp,(
const char*)englsh);
7916 Printf(
" ONLY THE MOST RECENT 10 WILL BE LISTED BELOW.");
7920 Printf(
" CALLS ORIGIN MESSAGE");
7921 for (i = 1; i <= nm; ++i) {
7923 if (ic > kMAXMES) ic = 1;
7940 Double_t denom, ba, al, dx, du1, du2;
7941 Int_t ndex, ierr, i, j, k,
l, ndiag, k1, iin;
7945 for (l = 1; l <=
fNpar; ++
l) {
7946 ndex = l*(l + 1) / 2;
7951 ba =
fBlim[i-1] - al;
7954 if (dx > 1) du1 = ba;
7962 for (i = 1; i <=
fNpar; ++i) {
7965 for (j = 1; j <= i; ++j) {
7973 for (iin = 1; iin <=
fNpar; ++iin) {
7974 ndiag = iin*(iin + 1) / 2;
7976 if (denom <= 1 && denom >= 0)
fGlobcc[iin-1] = 0;
virtual void mnmnos()
*-*-*-*-*-*-*-*-*-*-*Performs a MINOS error analysis*-*-*-*-*-*-*-*-*-*-*-* *-* =====================...
virtual void mnsimp()
*-*-*-*-*Minimization using the simplex method of Nelder and Mead*-*-*-*-* *-* ======================...
TMinuit()
*-*-*-*-*-*-*-*-*-*-*Minuit normal constructor*-*-*-*-*-*-*-*-*-*-*-*-*-*-* *-* =====================...
virtual Int_t GetNumFreePars() const
returns the number of currently free parameters
virtual void mnstat(Double_t &fmin, Double_t &fedm, Double_t &errdef, Int_t &npari, Int_t &nparx, Int_t &istat)
*-*-*-*-*Returns concerning the current status of the minimization*-*-*-*-* *-* =====================...
double dist(Rotation3D const &r1, Rotation3D const &r2)
virtual void mneval(Double_t anext, Double_t &fnext, Int_t &ierev)
*-*-*-*-*-*-*Evaluates the function being analyzed by MNCROS*-*-*-*-*-*-*-* *-* =====================...
virtual void mnprin(Int_t inkode, Double_t fval)
*-*-*-*Prints the values of the parameters at the time of the call*-*-*-*-* *-* =====================...
virtual Int_t SetPrintLevel(Int_t printLevel=0)
set Minuit print level printlevel = -1 quiet (also suppresse all warnings) = 0 normal = 1 verbose ...
virtual void mnexin(Double_t *pint)
*-*-*-*-*Transforms the external parameter values U to internal values*-*-* *-* =====================...
virtual void mnhes1()
*-*-*-*Calculate first derivatives (GRD) and uncertainties (DGRD)*-*-*-*-*-* *-* ====================...
virtual void mnvert(Double_t *a, Int_t l, Int_t m, Int_t n, Int_t &ifail)
*-*-*-*-*-*-*-*-*-*-*-*Inverts a symmetric matrix*-*-*-*-*-*-*-*-*-*-*-*-* *-* ======================...
Implementation in C++ of the Minuit package written by F.
virtual void mnemat(Double_t *emat, Int_t ndim)
Calculates the external error matrix from the internal matrix.
void(* fFCN)(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag)
virtual void mnwarn(const char *copt, const char *corg, const char *cmes)
*-*-*-*-*-*-*-*-*-*-*-*Prints Warning messages*-*-*-*-*-*-*-*-*-*-*-*-*-* *-* =======================...
virtual void mnline(Double_t *start, Double_t fstart, Double_t *step, Double_t slope, Double_t toler)
*-*-*-*-*-*-*-*-*-*Perform a line search from position START*-*-*-*-*-*-*-* *-* =====================...
void ToUpper()
Change string to upper case.
virtual void mnseek()
*-*-*-*Performs a rough (but global) minimization by monte carlo search*-* *-* ======================...
Int_t LoadPlugin()
Load the plugin library for this handler.
Short_t Min(Short_t a, Short_t b)
R__EXTERN TVirtualMutex * gROOTMutex
virtual void mnderi()
*-*-*-*-*-*-*-*Calculates the first derivatives of FCN (GRD)*-*-*-*-*-*-*-* *-* =====================...
virtual void mncros(Double_t &aopt, Int_t &iercr)
*-*-*-*-*-*-*-*-*-*-*Find point where MNEVAL=AMIN+UP*-*-*-*-*-*-*-*-*-*-*-* *-* =====================...
virtual void mngrad()
*-*-*-*-*-*-*-*-*-*Interprets the SET GRAD command*-*-*-*-*-*-*-*-*-*-*-*-* *-* =====================...
virtual void mnbins(Double_t a1, Double_t a2, Int_t naa, Double_t &bl, Double_t &bh, Int_t &nb, Double_t &bwid)
*-*-*-*-*-*-*-*-*-*-*Compute reasonable histogram intervals*-*-*-*-*-*-*-*-* *-* ====================...
virtual void mnrset(Int_t iopt)
*-*-*-*-*-*-*-*Resets function value and errors to UNDEFINED*-*-*-*-*-*-*-* *-* =====================...
Long_t ExecPlugin(int nargs, const T &...params)
virtual void mntiny(volatile Double_t epsp1, Double_t &epsbak)
*-*-*-*-*-*-*-*To find the machine precision*-*-*-*-*-*-*-*-*-*-*-*-*-*-* *-* =======================...
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
double beta(double x, double y)
Calculates the beta function.
virtual Int_t GetNumPars() const
returns the total number of parameters that have been defined as fixed or free.
TString fOrigin[kMAXWARN]
virtual Int_t FixParameter(Int_t parNo)
fix a parameter
virtual Int_t Eval(Int_t npar, Double_t *grad, Double_t &fval, Double_t *par, Int_t flag)
Evaluate the minimisation function Input parameters: npar: number of currently variable parameters pa...
virtual void mneig(Double_t *a, Int_t ndima, Int_t n, Int_t mits, Double_t *work, Double_t precis, Int_t &ifault)
*-*-*-*-*-*-*-*-*-*-*-*Compute matrix eigen values*-*-*-*-*-*-*-*-*-*-*-*-* *-* =====================...
void SetParamPtrs(void *paramArr, Int_t nparam=-1)
ParamArr is an array containing the function argument values.
const char * Data() const
virtual void mnmigr()
*-*-*-*-*-*-*-*-*Performs a local function minimization*-*-*-*-*-*-*-*-*-* *-* ======================...
virtual void SetFCN(void *fcn)
*-*-*-*-*-*-*To set the address of the minimization function*-*-*-*-*-*-*-* *-* =====================...
virtual void mnfree(Int_t k)
*-*-*-*Restores one or more fixed parameter(s) to variable status*-*-*-*-*-* *-* ====================...
static const double x2[5]
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
The TNamed class is the base class for all named ROOT classes.
virtual void mncrck(TString crdbuf, Int_t maxcwd, TString &comand, Int_t &lnc, Int_t mxp, Double_t *plist, Int_t &llist, Int_t &ierr, Int_t isyswr)
*-*-*-*-*-*-*-*-*-*-*-*Cracks the free-format input*-*-*-*-*-*-*-*-*-*-*-*-* *-* ====================...
virtual void mnrn15(Double_t &val, Int_t &inseed)
*-*-*-*-*-*-*This is a super-portable random number generator*-*-*-*-*-*-* *-* ======================...
virtual TObject * Contour(Int_t npoints=10, Int_t pa1=0, Int_t pa2=1)
Creates a TGraph object describing the n-sigma contour of a TMinuit fit.
Double_t Log10(Double_t x)
virtual ~TMinuit()
*-*-*-*-*-*-*-*-*-*-*Minuit default destructor*-*-*-*-*-*-*-*-*-*-*-*-*-*-* *-* =====================...
static const double x4[22]
static Vc_ALWAYS_INLINE Vector< T > abs(const Vector< T > &x)
virtual void DeleteArrays()
*-*-*-*-*-*-*-*-*-*-*-*Delete internal Minuit arrays*-*-*-*-*-*-*-*-* *-* ===========================...
std::vector< std::vector< double > > Data
virtual void mncuve()
*-*-*-*-*-*-*-*Makes sure that the current point is a local minimum*-*-*-*-* *-* ====================...
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
virtual void BuildArrays(Int_t maxpar=15)
*-*-*-*-*-*-*Create internal Minuit arrays for the maxpar parameters*-*-*-* *-* =====================...
Method or function calling interface.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void mnmnot(Int_t ilax, Int_t ilax2, Double_t &val2pl, Double_t &val2mi)
*-*-*-*-*-*Performs a MINOS error analysis on one parameter*-*-*-*-*-*-*-*-* *-* ====================...
virtual Int_t DefineParameter(Int_t parNo, const char *name, Double_t initVal, Double_t initErr, Double_t lowerLimit, Double_t upperLimit)
Define a parameter.
virtual void mncont(Int_t ke1, Int_t ke2, Int_t nptu, Double_t *xptu, Double_t *yptu, Int_t &ierrf)
*-*-*-*-*-*-*Find points along a contour where FCN is minimum*-*-*-*-*-*-* *-* ======================...
TString * fCpnam
Character to be plotted at the X,Y contour positions.
virtual void mncler()
*-*-*-*-*-*-*-*-*-*-*Resets the parameter list to UNDEFINED*-*-*-*-*-*-*-* *-* ======================...
virtual void mnparm(Int_t k, TString cnamj, Double_t uk, Double_t wk, Double_t a, Double_t b, Int_t &ierflg)
*-*-*-*-*-*-*-*-*Implements one parameter definition*-*-*-*-*-*-*-*-*-*-*-* *-* =====================...
virtual Int_t GetParameter(Int_t parNo, Double_t ¤tValue, Double_t ¤tError) const
return parameter value and error
virtual void mnfixp(Int_t iint, Int_t &ierr)
*-*-*-*-*-*-*Removes parameter IINT from the internal parameter list*-*-* *-* =======================...
virtual void mncalf(Double_t *pvec, Double_t &ycalf)
*-*-*-*-*-*-*-*-*-*Transform FCN to find further minima*-*-*-*-*-*-*-*-*-* *-* ======================...
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
char * Form(const char *fmt,...)
virtual Int_t SetErrorDef(Double_t up)
To get the n-sigma contour the error def parameter "up" has to set to n^2.
TMethodCall * GetMethodCall() const
TMethodCall * fMethodCall
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
virtual void mnerrs(Int_t number, Double_t &eplus, Double_t &eminus, Double_t &eparab, Double_t &gcc)
*-*-*-*-*-*-*-*-*-*Utility routine to get MINOS errors*-*-*-*-*-*-*-*-*-*-* *-* =====================...
virtual void mnhess()
*-*-*-*-*-*Calculates the full second-derivative matrix of FCN*-*-*-*-*-*-*-* *-* ===================...
void InitWithPrototype(TClass *cl, const char *method, const char *proto, Bool_t objectIsConst=kFALSE, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch)
Initialize the method invocation environment.
#define R__LOCKGUARD2(mutex)
virtual Int_t GetNumFixedPars() const
returns the number of currently fixed parameters
virtual void mnpsdf()
*-*-*-*-*-*Calculates the eigenvalues of v to see if positive-def*-*-*-*-* *-* ======================...
virtual void mndxdi(Double_t pint, Int_t ipar, Double_t &dxdi)
*-*-*-*Calculates the transformation factor between ext/internal values*-* *-* ======================...
virtual void mnamin()
*-*-*-*-*-*-*-*-*-*-*-*-*Initialize AMIN*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* *-* =============== *-*C Ca...
static const double x1[5]
virtual void mnscan()
*-*-*-*-*Scans the values of FCN as a function of one parameter*-*-*-*-*-* *-* ======================...
TString fWarmes[kMAXWARN]
virtual void mnhelp(TString comd)
*-*-*-*-*-*-*-*HELP routine for MINUIT interactive commands*-*-*-*-*-*-*-*-* *-* ====================...
void InteractiveFCNm(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag)
*-*-*-*-*-*-*Static function called when SetFCN is called in interactive mode *-* ===================...
virtual Int_t Release(Int_t parNo)
release a parameter
virtual void mnpfit(Double_t *parx2p, Double_t *pary2p, Int_t npar2p, Double_t *coef2p, Double_t &sdev2p)
*-*-*-*-*-*-*-*-*-*To fit a parabola to npar2p points*-*-*-*-*-*-*-*-*-*-* *-* ======================...
virtual void mnlims()
*-*-*-*Interprets the SET LIM command, to reset the parameter limits*-*-*-* *-* =====================...
virtual void mnexcm(const char *comand, Double_t *plist, Int_t llist, Int_t &ierflg)
*-*-*-*-*-*Interprets a command and takes appropriate action*-*-*-*-*-*-*-* *-* =====================...
virtual void mncntr(Int_t ke1, Int_t ke2, Int_t &ierrf)
*-*-*-*-*Print function contours in two variables, on line printer*-*-*-*-* *-* =====================...
virtual void SetMaxIterations(Int_t maxiter=500)
virtual void mncomd(const char *crdbin, Int_t &icondn)
*-*-*-*-*-*-*-*-*-*-*Reads a command string and executes*-*-*-*-*-*-*-*-*-* *-* =====================...
virtual Int_t Command(const char *command)
execute a Minuit command Equivalent to MNEXCM except that the command is given as a character string...
virtual void mninit(Int_t i1, Int_t i2, Int_t i3)
*-*-*-*-*-*Main initialization member function for MINUIT*-*-*-*-*-*-*-*-* *-* ======================...
Mother of all ROOT objects.
virtual Int_t Migrad()
invokes the MIGRAD minimizer
virtual void mnpars(TString &crdbuf, Int_t &icondn)
*-*-*-*-*-*-*-*Implements one parameter definition*-*-*-*-*-*-*-*-*-*-*-*-* *-* =========== =========...
virtual void mnplot(Double_t *xpt, Double_t *ypt, char *chpt, Int_t nxypt, Int_t npagwd, Int_t npagln)
*-*-*-*Plots points in array xypt onto one page with labelled axes*-*-*-*-* *-* =====================...
virtual void mnpint(Double_t &pexti, Int_t i, Double_t &pinti)
*-*-*-*-*-*-*Calculates the internal parameter value PINTI*-*-*-*-*-*-*-* *-* =======================...
virtual void mnsave()
*-*-*-*Writes current parameter values and step sizes onto file ISYSSA*-*-* *-* =====================...
virtual void mninex(Double_t *pint)
*-*-*-*-*Transforms from internal coordinates (PINT) to external (U)*-*-*-* *-* =====================...
double f2(const double *x)
void Execute(const char *, const char *, int *=0)
Execute method on this object with the given parameter string, e.g.
Short_t Max(Short_t a, Short_t b)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
virtual void mnmatu(Int_t kode)
*-*-*-*-*-*-*-*Prints the covariance matrix v when KODE=1*-*-*-*-*-*-*-*-* *-* ======================...
virtual void mnset()
*-*-*-*-*Interprets the commands that start with SET and SHOW*-*-*-*-*-*-* *-* ======================...
Bool_t mnunpt(TString &cfname)
*-*-*-*-*-*Returns .TRUE.
virtual void mnrazz(Double_t ynew, Double_t *pnew, Double_t *y, Int_t &jh, Int_t &jl)
*-*-*-*-*Called only by MNSIMP (and MNIMPR) to add a new point*-*-*-*-*-*-* *-* =====================...
virtual const char * Getp2f2funcname(void *) const
Double_t Sqrt(Double_t x)
R__EXTERN TInterpreter * gCling
virtual void mnpout(Int_t iuext, TString &chnam, Double_t &val, Double_t &err, Double_t &xlolim, Double_t &xuplim, Int_t &iuint) const
*-*-*-*Provides the user with information concerning the current status*-*-* *-* ====================...
virtual void mnimpr()
*-*-*-*-*-*-*Attempts to improve on a good local minimum*-*-*-*-*-*-*-*-*-* *-* =====================...
void Resize(Ssiz_t n)
Resize the string. Truncate or add blanks as necessary.
static const double x3[11]
virtual void mnwerr()
*-*-*-*-*-*-*-*Calculates the WERR, external parameter errors*-*-*-*-*-*-* *-* ======================...
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.