348 static const char charal[29] = 
" .ABCDEFGHIJKLMNOPQRSTUVWXYZ";
   437       fGraphicsMode = 
kTRUE;
   455       fGraphicsMode = 
kTRUE;
   463       gROOT->GetListOfSpecials()->Add(
this);
   490       gROOT->GetListOfSpecials()->Add(
this);
   500    Error(
"TMinuit", 
"can not copy construct TMinuit");
   513       if (
gROOT != 0 && 
gROOT->GetListOfSpecials() != 0) 
gROOT->GetListOfSpecials()->Remove(
this);
   515    if (gMinuit == 
this) gMinuit = 
nullptr;
   595    for (
int i = 0; i < 
fMaxpar; i++) {
   672    mncont(pa1,pa2,npoints,xcoor,ycoor,npfound);
   675       Warning(
"Contour",
"Cannot find more than 4 points, no TGraph returned");
   676       fStatus= (npfound==0 ? 1 : npfound);
   681    if (npfound!=npoints) {
   683       Warning(
"Contour",
"Returning a TGraph with %d points only",npfound);
   688    xcoor[npoints] = xcoor[0];  
   689    ycoor[npoints] = ycoor[0];
   692    if ((h = 
gROOT->GetPluginManager()->FindHandler(
"TMinuitGraph"))) {
   709    mnparm( parNo, sname, initVal, initErr, lowerLimit, upperLimit, err);
   829    if (
fFCN) (*fFCN)(npar,grad,fval,
par,flag);
   842    mnexcm( 
"FIX", tmp,  1,  err );
   856    mnpout( parNo, name, currentValue, currentError, bnd1, bnd2, err );
   895    mnexcm( 
"MIGRAD", tmp, 0, err );
   909    mnexcm( 
"RELEASE", tmp, 1, err );
   921    mnexcm( 
"SET ERRDEF", &up, 1, err );
   962    Error(
"SetFCN", 
"Not used anymore.");
   982    mnexcm( 
"SET PRINT", tmp, 1, err );
   984    if (printLevel <=-1) 
mnexcm(
"SET NOWarnings",tmp,0,err);
  1004       Printf(
" FIRST CALL TO USER FUNCTION AT NEW START POINT, WITH IFLAG=4.");
  1024    Double_t awid,ah, al, sigfig, sigrnd, alb;
  1025    Int_t kwid, lwid, na=0, log_;
  1029    if (al == ah) ah = al + 1;
  1032    if (naa == -1) 
goto L150;
  1041    if (awid <= 1) --log_;
  1044    if (sigfig > 2) 
goto L40;
  1048    if (sigfig > 2.5) 
goto L50;
  1052    if (sigfig > 5) 
goto L60;
  1063    if (bwid <= 0) 
goto L10;
  1067    if (alb < 0) --lwid;
  1069    alb  = ah / bwid + 1;
  1071    if (alb < 0) --kwid;
  1074    if (naa > 5) 
goto L240;
  1075    if (naa == -1) 
return;
  1077    if (naa > 1 || nb == 1) 
return;
  1082    if (nb << 1 != naa) 
return;
  1097    Int_t ndex, i, j, 
m, 
n, nparx;
  1103    for (i = 1; i <= 
fNpar; ++i) {
  1105       for (j = 1; j <= 
fNpar; ++j) {
  1108          ndex = m*(m-1) / 2 + n;
  1113    for (i = 1; i <= 
fNpar; ++i) {denom += 
fGrd[i-1]*(
fXt[i-1] - pvec[i-1]); }
  1119    ycalf = (f - 
fApsi) / denom;
  1137    for (i = 1; i <= 
fMaxext; ++i) {
  1158    static const char *
const clabel = 
"0123456789ABCDEFGHIJ";
  1162    Double_t fcna[115], fcnb[115], contur[20];
  1163    Double_t  ylabel, fmn, fmx, xlo, ylo, xup, yup;
  1164    Double_t devs, xsav, ysav,  bwidx,  bwidy, unext, ff, xb4;
  1165    Int_t i,  ngrid, ixmid, nparx, ix, 
nx, 
ny, ki1, ki2, ixzero, iy, ics;
  1170    if (ke1 <= 0 || ke2 <= 0) 
goto L1350;
  1171    if (ke1 > 
fNu || ke2 > 
fNu) 
goto L1350;
  1174    if (ki1 <= 0 || ki2 <= 0) 
goto L1350;
  1175    if (ki1 == ki2) 
goto L1350;
  1185    if (devs <= 0) devs = 2;
  1186    xlo = 
fU[ke1-1] - devs*
fWerr[ki1-1];
  1187    xup = 
fU[ke1-1] + devs*fWerr[ki1-1];
  1188    ylo = 
fU[ke2-1] - devs*fWerr[ki2-1];
  1189    yup = 
fU[ke2-1] + devs*fWerr[ki2-1];
  1201    if (nx < 11)   nx = 11;
  1202    if (ny < 11)   ny = 11;
  1203    if (nx >= 115) nx = 114;
  1214    bwidx = (xup - xlo) / 
Double_t(nx);
  1215    bwidy = (yup - ylo) / 
Double_t(ny);
  1216    ixmid = 
Int_t(((xsav - xlo)*
Double_t(nx) / (xup - xlo)) + 1);
  1217    if (ixmid < 1) ixmid = 1;
  1220    for (i = 1; i <= 20; ++i) {        contur[i-1] = 
fAmin + 
fUp*(i-1)*(i-1); }
  1221    contur[0] += 
fUp*.01;
  1230    for (ix = 1; ix <= nx + 1; ++ix) {
  1234       if (xb4 < 0 && 
fU[ke1-1] > 0) ixzero = ix - 1;
  1239    Printf(
" Y-AXIS: PARAMETER %3d: %s",ke2,(
const char*)
fCpnam[ke2-1]);
  1241       chzero[ixzero-1] = 
'+';
  1246    for (iy = 1; iy <= 
ny; ++iy) {
  1247       unext = 
fU[ke2-1] - bwidy;
  1252       chln[ixmid-1] = 
'*';
  1253       if (ixzero != 0) chln[ixzero-1] = 
':';
  1254       if (
fU[ke2-1] > ysav && unext < ysav) chln = chmid;
  1255       if (
fU[ke2-1] > 0 && unext < 0)       chln = chzero;
  1257       ylabel = 
fU[ke2-1] + bwidy*.5;
  1259       for (ix = 1; ix <= nx + 1; ++ix) {
  1260          fcna[ix-1] = fcnb[ix-1];
  1266       for (ix = 1; ix <= 
nx; ++ix) {
  1273          for (ics = 1; ics <= 20; ++ics) {
  1274             if (contur[ics-1] > fmn)  
goto L240;
  1278          if (contur[ics-1] < fmx) chln[ix-1] = clabel[ics-1];
  1281       Printf(
" %12.4g %s",ylabel,(
const char*)chln);
  1286    chln(ixmid-1,1) = 
'I';
  1288    Printf(
"              %s",(
const char*)chln);
  1293       Printf(
"        %12.4g%s%12.4g",xlo,(
const char*)chln,xup);
  1294       Printf(
"              %s%12.4g",(
const char*)chln,xsav);
  1296       Printf(
"        %12.4g%s%12.4g%s%12.4g",xlo,(
const char*)chln,xsav,(
const char*)chln,xup);
  1298    Printf(
"       X-AXIS: PARAMETER %3d %s  ONE COLUMN=%12.4g"  1299             ,ke1,(
const char*)
fCpnam[ke1-1],bwidx);
  1307    Printf(
" INVALID PARAMETER NUMBER(S) REQUESTED.  IGNORED.");
  1337    Int_t ierr, ipos, i, llist, lenbuf, lnc;
  1339    TString comand, crdbuf, ctemp;
  1343    lenbuf = crdbuf.
Length();
  1348    for (i = 1; i <= 
TMath::Min(20,lenbuf); ++i) {
  1349       if (crdbuf[i-1] == 
'\'') 
break;
  1350       if (crdbuf[i-1] == 
' ') {
  1358    if (ipos > lenbuf) {
  1359       Printf(
" BLANK COMMAND IGNORED.");
  1365    if (crdbuf(ipos-1,3) == 
"PAR") {
  1371    if (crdbuf(ipos-1,3) == 
"SET INP") {
  1377    if (crdbuf(ipos-1,7) == 
"SET TIT") {
  1383    if (crdbuf(ipos-1,7) == 
"SET COV") {
  1389    ctemp = crdbuf(ipos-1,lenbuf-ipos+1);
  1392       Printf(
" COMMAND CANNOT BE INTERPRETED");
  1428    Double_t a1, a2, val2mi, val2pl, dc, sclfac, bigdis, sigsav;
  1429    Int_t nall, iold, 
line, mpar, ierr, inew, move, next, i, j, nfcol, iercr;
  1430    Int_t idist=0, npcol, kints, i2, i1, lr, nfcnco=0, ki1, ki2, ki3, ke3;
  1431    Int_t nowpts, istrav, nfmxin, isw2, isw4;
  1437    ldebug = 
fIdbg[6] >= 1;
  1438    if (ke1 <= 0 || ke2 <= 0) 
goto L1350;
  1439    if (ke1 > 
fNu || ke2 > 
fNu) 
goto L1350;
  1442    if (ki1 <= 0 || ki2 <= 0) 
goto L1350;
  1443    if (ki1 == ki2) 
goto L1350;
  1444    if (nptu < 4)  
goto L1400;
  1456       Printf(
" START MNCONTOUR CALCULATION OF %4d POINTS ON CONTOUR.",nptu);
  1459             ki3 = 6 - ki1 - ki2;
  1461             Printf(
" EACH POINT IS A MINIMUM WITH RESPECT TO PARAMETER %3d  %s",ke3,(
const char*)
fCpnam[ke3-1]);
  1463             Printf(
" EACH POINT IS A MINIMUM WITH RESPECT TO THE OTHER %3d VARIABLE PARAMETERS.",
fNpar - 2);
  1470    mnmnot(ke1, ke2, val2pl, val2mi);
  1472       xptu[0] = 
fAlim[ke1-1];
  1473       mnwarn(
"W", 
"MNContour ", 
"Contour squeezed by parameter limits.");
  1475       if (
fErn[ki1-1] >= 0) 
goto L1500;
  1476       xptu[0] = u1min + 
fErn[ki1-1];
  1481       xptu[2] = 
fBlim[ke1-1];
  1482       mnwarn(
"W", 
"MNContour ", 
"Contour squeezed by parameter limits.");
  1484       if (
fErp[ki1-1] <= 0) 
goto L1500;
  1485       xptu[2] = u1min + 
fErp[ki1-1];
  1488    scalx = 1 / (xptu[2] - xptu[0]);
  1490    mnmnot(ke2, ke1, val2pl, val2mi);
  1492       yptu[1] = 
fAlim[ke2-1];
  1493       mnwarn(
"W", 
"MNContour ", 
"Contour squeezed by parameter limits.");
  1495       if (
fErn[ki2-1] >= 0) 
goto L1500;
  1496       yptu[1] = u2min + 
fErn[ki2-1];
  1500       yptu[3] = 
fBlim[ke2-1];
  1501       mnwarn(
"W", 
"MNContour ", 
"Contour squeezed by parameter limits.");
  1503       if (
fErp[ki2-1] <= 0) 
goto L1500;
  1504       yptu[3] = u2min + 
fErp[ki2-1];
  1507    scaly   = 1 / (yptu[3] - yptu[1]);
  1511       Printf(
" Plot of four points found by MINOS");
  1517       for (i = 2; i <= nall; ++i) {
  1518          fXpt[i-1] = xptu[i-2];
  1519          fYpt[i-1] = yptu[i-2];
  1521       sprintf(
fChpt,
"%s",
" ABCD");
  1535    for (i = 1; i <= mpar; ++i) { 
fXt[i-1] = 
fX[i-1]; }
  1536    i__1 = mpar*(mpar + 1) / 2;
  1538    for (i = 1; i <= mpar; ++i) {
  1548    for (inew = next; inew <= nptu; ++inew) {
  1551       for (iold = 1; iold <= inew - 1; ++iold) {
  1553          if (i2 == inew) i2 = 1;
  1554          d__1 = scalx*(xptu[iold-1] - xptu[i2-1]);
  1555          d__2 = scaly*(yptu[iold-1] - yptu[i2-1]);
  1556          dist = d__1*d__1 + d__2*d__2;
  1557          if (dist > bigdis) {
  1564       if (i2 == inew) i2 = 1;
  1569       fXmidcr = a1*xptu[i1-1] + a2*xptu[i2-1];
  1570       fYmidcr = a1*yptu[i1-1] + a2*yptu[i2-1];
  1571       xdir    = yptu[i2-1] - yptu[i1-1];
  1572       ydir    = xptu[i1-1] - xptu[i2-1];
  1585                Printf(
" MNCONT CANNOT FIND NEXT POINT ON CONTOUR.  ONLY %3d POINTS FOUND.",nowpts);
  1589          mnwarn(
"W", 
"MNContour ", 
"Cannot find midpoint, try closer.");
  1595       for (move = nowpts; move >= i1 + 1; --move) {
  1596          xptu[move] = xptu[move-1];
  1597          yptu[move] = yptu[move-1];
  1607    if (nowpts < nptu)         
fCstatu = 
"INCOMPLETE";
  1615       for (i = 2; i <= nall; ++i) {
  1616          fXpt[i-1]  = xptu[i-2];
  1617          fYpt[i-1]  = yptu[i-2];
  1621       Printf(
" Y-AXIS: PARAMETER %3d  %s",ke2,(
const char*)
fCpnam[ke2-1]);
  1625       Printf(
"                         X-AXIS: PARAMETER %3d  %s",ke1,(
const char*)
fCpnam[ke1-1]);
  1629       npcol = (nowpts + 1) / 2;
  1631       Printf(
"%5d POINTS ON CONTOUR.   FMIN=%13.5e   ERRDEF=%11.3g",nowpts,abest,
fUp);
  1633                                  (
const char*)
fCpnam[ke2-1],
  1634                                  (
const char*)
fCpnam[ke1-1],
  1635                                  (
const char*)
fCpnam[ke2-1]);
  1636       for (line = 1; line <= nfcol; ++
line) {
  1638          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]);
  1640       if (nfcol < npcol) {
  1641          Printf(
" %5d%13.5e%13.5e",npcol,xptu[npcol-1],yptu[npcol-1]);
  1648    i__1 = mpar*(mpar + 1) / 2;
  1650    for (i = 1; i <= mpar; ++i) {
  1669    Printf(
" INVALID PARAMETER NUMBERS.");
  1672    Printf(
" LESS THAN FOUR POINTS REQUESTED.");
  1678    Printf(
" MNCONT UNABLE TO FIND FOUR POINTS.");
  1707    const char *cnumer = 
"123456789-.0+";
  1710    Int_t ifld, iend, lend, left, nreq, ipos, kcmnd, nextb, ic, ibegin, ltoadd;
  1711    Int_t ielmnt, lelmnt[25], nelmnt;
  1717    char *crdbuf = (
char*)cardbuf.
Data();
  1724    for (ipos = nextb; ipos <= lend; ++ipos) {
  1726       if (crdbuf[ipos-1] == 
' ') 
continue;
  1727       if (crdbuf[ipos-1] == 
',') 
goto L250;
  1733    for (ipos = ibegin + 1; ipos <= lend; ++ipos) {
  1734       if (crdbuf[ipos-1] == 
' ') 
goto L250;
  1735       if (crdbuf[ipos-1] == 
',') 
goto L250;
  1741    if (iend >= ibegin) celmnt[ielmnt-1] = &crdbuf[ibegin-1];
  1742    else                celmnt[ielmnt-1] = cnull;
  1743    lelmnt[ielmnt-1] = iend - ibegin + 1;
  1744    if (lelmnt[ielmnt-1] > 19) {
  1745       Printf(
" MINUIT WARNING: INPUT DATA WORD TOO LONG.");
  1746       ctemp = cardbuf(ibegin-1,iend-ibegin+1);
  1748       Printf(
" TRUNCATED TO:%s",celmnt[ielmnt-1]);
  1749       lelmnt[ielmnt-1] = 19;
  1751    if (ipos >= lend) 
goto L300;
  1752    if (ielmnt >= 25) 
goto L300;
  1754    for (ipos = iend + 1; ipos <= lend; ++ipos) {
  1755       if (crdbuf[ipos-1] == 
' ') 
continue;
  1757       if (crdbuf[ipos-1] == 
',') nextb = ipos + 1;
  1764    command[0]  = 
' '; command[1] = 0;
  1768    if (ielmnt == 0) 
goto L900;
  1770    for (ielmnt = 1; ielmnt <= nelmnt; ++ielmnt) {
  1771       if ( celmnt[ielmnt-1] == cnull) 
goto L450;
  1772       for (ic = 1; ic <= 13; ++ic) {
  1773          if (*celmnt[ielmnt-1] == cnumer[ic-1]) 
goto L450;
  1775       if (kcmnd >= maxcwd) 
continue;
  1776       left = maxcwd - kcmnd;
  1777       ltoadd = lelmnt[ielmnt-1];
  1778       if (ltoadd > left) ltoadd = left;
  1779       strncpy(&command[kcmnd],celmnt[ielmnt-1],ltoadd);
  1781       if (kcmnd == maxcwd) 
continue;
  1782       command[kcmnd] = 
' ';
  1792    for (ifld = ielmnt; ifld <= nelmnt; ++ifld) {
  1795          nreq = nelmnt - ielmnt + 1;
  1796          Printf(
" MINUIT WARNING IN MNCRCK: ");
  1797          Printf(
" COMMAND HAS INPUT %5d NUMERIC FIELDS, BUT MINUIT CAN ACCEPT ONLY%3d",nreq,mxp);
  1800       if (celmnt[ifld-1] == cnull) plist[llist-1] = 0;
  1802          sscanf(celmnt[ifld-1],
"%lf",&plist[llist-1]);
  1807    if (lnc <= 0) lnc = 1;
  1825    Double_t alsb[3], flsb[3], bmin, bmax, zmid, sdev, zdir, zlim;
  1826    Double_t coeff[3], aleft, aulim, fdist, adist, aminsv;
  1827    Double_t anext, fnext, slope, s1, s2, 
x1, 
x2, ecarmn, ecarmx;
  1828    Double_t determ, rt, smalla, aright, aim, tla, tlf, dfda,ecart;
  1829    Int_t iout=0, i, ileft, ierev, maxlk, ibest, ik, it;
  1830    Int_t noless, iworst=0, iright, itoohi, kex, ipt;
  1835    ldebug = 
fIdbg[6] >= 1;
  1854    for (ik = 1; ik <= 2; ++ik) {
  1860          if (
fKe2cr == 0) 
continue;
  1865       if (
fNvarl[kex-1] <= 1) 
continue;
  1866       if (zdir == 0) 
continue;
  1867       zlim = 
fAlim[kex-1];
  1868       if (zdir > 0) zlim = 
fBlim[kex-1];
  1869       aulim = 
TMath::Min(aulim,(zlim - zmid) / zdir);
  1877    mneval(anext, fnext, ierev);
  1880       Printf(
" MNCROS: calls=%8d   AIM=%10.5f  F,A=%10.5f%10.5f",
fNfcn,aim,fnext,aopt);
  1882    if (ierev > 0) 
goto L900;
  1883    if (
fLimset && fnext <= aim) 
goto L930;
  1885    fXpt[ipt-1]  = anext;
  1886    fYpt[ipt-1]  = fnext;
  1892    if (
TMath::Abs(fnext - aim) < tlf) 
goto L800;
  1894    if (aopt < -.5)aopt = -.5;
  1895    if (aopt > 1)  aopt = 1;
  1901    mneval(aopt, fnext, ierev);
  1904       Printf(
" MNCROS: calls=%8d   AIM=%10.5f  F,A=%10.5f%10.5f",
fNfcn,aim,fnext,aopt);
  1906    if (ierev > 0) 
goto L900;
  1907    if (
fLimset && fnext <= aim) 
goto L930;
  1910    fXpt[ipt-1]  = alsb[1];
  1911    fYpt[ipt-1]  = fnext;
  1914    dfda         = (flsb[1] - flsb[0]) / (alsb[1] - alsb[0]);
  1916    if (dfda > 0) 
goto L460;
  1918    mnwarn(
"D", 
"MNCROS    ", 
"Looking for slope of the right sign");
  1920    for (it = 1; it <= maxlk; ++it) {
  1929       mneval(aopt, fnext, ierev);
  1932          Printf(
" MNCROS: calls=%8d   AIM=%10.5f  F,A=%10.5f%10.5f",
fNfcn,aim,fnext,aopt);
  1934       if (ierev > 0) 
goto L900;
  1935       if (
fLimset && fnext <= aim) 
goto L930;
  1938       fXpt[ipt-1]  = alsb[1];
  1939       fYpt[ipt-1]  = fnext;
  1942       dfda         = (flsb[1] - flsb[0]) / (alsb[1] - alsb[0]);
  1943       if (dfda > 0) 
goto L450;
  1945    mnwarn(
"W", 
"MNCROS    ", 
"Cannot find slope of the right sign");
  1950    aopt  = alsb[1] + (aim - flsb[1]) / dfda;
  1955    if (adist < tla && fdist < tlf) 
goto L800;
  1956    if (ipt >= 15) 
goto L950;
  1958    if (aopt < bmin) aopt = bmin;
  1960    if (aopt > bmax) aopt = bmax;
  1967    mneval(aopt, fnext, ierev);
  1970       Printf(
" MNCROS: calls=%8d   AIM=%10.5f  F,A=%10.5f%10.5f",
fNfcn,aim,fnext,aopt);
  1972    if (ierev > 0) 
goto L900;
  1973    if (
fLimset && fnext <= aim) 
goto L930;
  1976    fXpt[ipt-1]  = alsb[2];
  1977    fYpt[ipt-1]  = fnext;
  1985    for (i = 1; i <= 3; ++i) {
  1987       if (ecart > ecarmx) { ecarmx = ecart; iworst = i; }
  1988       if (ecart < ecarmn) { ecarmn = ecart; ibest = i; }
  1989       if (flsb[i-1] < aim) ++noless;
  1992    if (noless == 1 || noless == 2) 
goto L500;
  1994    if (noless == 0 && ibest != 3) 
goto L950;
  1997    if (noless == 3 && ibest != 3) {
  2003    alsb[iworst-1] = alsb[2];
  2004    flsb[iworst-1] = flsb[2];
  2005    dfda = (flsb[1] - flsb[0]) / (alsb[1] - alsb[0]);
  2009    mnpfit(alsb, flsb, 3, coeff, sdev);
  2010    if (coeff[2] <= 0) {
  2011       mnwarn(
"D", 
"MNCROS    ", 
"Curvature is negative near contour line.");
  2013    determ = coeff[1]*coeff[1] - coeff[2]*4*(coeff[0] - aim);
  2015       mnwarn(
"D", 
"MNCROS    ", 
"Problem 2, impossible determinant");
  2020    x1 = (-coeff[1] + rt) / (coeff[2]*2);
  2021    x2 = (-coeff[1] - rt) / (coeff[2]*2);
  2022    s1 = coeff[1] + x1*2*coeff[2];
  2023    s2 = coeff[1] + x2*2*coeff[2];
  2025       Printf(
" MNCONTour problem 1");
  2039    if (ipt >= 15) 
goto L950;
  2048    for (i = 1; i <= 3; ++i) {
  2050       if (ecart < ecarmn) { ecarmn = ecart; ibest = i; }
  2051       if (ecart > ecarmx) { ecarmx = ecart; }
  2052       if (flsb[i-1] > aim) {
  2053          if (iright == 0) iright = i;
  2054          else if (flsb[i-1] > flsb[iright-1]) iout = i;
  2055          else { iout = iright; iright = i; }
  2057       else if (ileft == 0) ileft = i;
  2058       else if (flsb[i-1] < flsb[ileft-1]) iout = i;
  2059       else { iout = ileft; ileft = i;        }
  2062    if (ecarmx > 
TMath::Abs(flsb[iout-1] - aim)*10) {
  2063       aopt = aopt*.5 + (alsb[iright-1] + alsb[ileft-1])*.25;
  2067    if (slope*smalla > tlf) smalla = tlf / slope;
  2068    aleft  = alsb[ileft-1] + smalla;
  2069    aright = alsb[iright-1] - smalla;
  2071    if (aopt < aleft)   aopt = aleft;
  2072    if (aopt > aright)  aopt = aright;
  2073    if (aleft > aright) aopt = (aleft + aright)*.5;
  2082    mneval(aopt, fnext, ierev);
  2085       Printf(
" MNCROS: calls=%8d   AIM=%10.5f  F,A=%10.5f%10.5f",
fNfcn,aim,fnext,aopt);
  2087    if (ierev > 0) 
goto L900;
  2088    if (
fLimset && fnext <= aim) 
goto L930;
  2091    fYpt[ipt-1]  = fnext;
  2094    alsb[iout-1] = aopt;
  2095    flsb[iout-1] = fnext;
  2107    if (ierev == 1) 
goto L940;
  2124       for (i = 1; i <= ipt; ++i) {
  2125          if (
fYpt[i-1] > aim + fUp) {
  2133       if (
fXdircr < 0) chsign = 
"NEGA";
  2135          Printf(
"  %sTIVE MINOS ERROR, PARAMETER %3d",chsign,
fKe1cr);
  2138          Printf(
"POINTS LABELLED '+' WERE TOO HIGH TO PLOT.");
  2141          Printf(
"RIGHTMOST POINT IS UP AGAINST LIMIT.");
  2158    Int_t ndex, iext, i, j;
  2161       Printf(
" FUNCTION MUST BE MINIMIZED BEFORE CALLING %s",(
const char*)
fCfrom);
  2168          mnwarn(
"W", 
fCfrom, 
"NO ERROR MATRIX.  WILL IMPROVISE.");
  2169          for (i = 1; i <= 
fNpar; ++i) {
  2171             for (j = 1; j <= i-1; ++j) {
  2176             if (
fG2[i-1] <= 0) {
  2179                if (
fNvarl[iext-1] > 1) {
  2184                fG2[i-1] = 
fUp / (wint*wint);
  2205    Double_t step, dfmin, stepb4, dd, df, fs1;
  2206    Double_t tlrstp, tlrgrd, epspri, optstp, stpmax, stpmin, fs2, grbfor=0, d1d2, xtf;
  2207    Int_t icyc, ncyc, iint, iext, i, nparx;
  2211    ldebug = 
fIdbg[2] >= 1;
  2213    if (
fISW[2] == 1) 
goto L100;
  2225       Printf(
"  FIRST DERIVATIVE DEBUG PRINTOUT.  MNDERI");
  2226       Printf(
" PAR    DERIV     STEP      MINSTEP   OPTSTEP  D1-D2    2ND DRV");
  2243    for (i = 1; i <= 
fNpar; ++i) {
  2250       for (icyc = 1; icyc <= ncyc; ++icyc) {
  2256          if (
fGstep[i-1] < 0 && step > .5) step = .5;
  2259          if (step > stpmax) step = stpmax;
  2262          if (step < stpmin) step = stpmin;
  2264          if (TMath::Abs((step - stepb4) / step) < tlrstp) 
goto L50;
  2270          fX[i-1] = xtf + step;
  2274          fX[i-1] = xtf - step;
  2278          fGrd[i-1] = (fs1 - fs2) / (step*2);
  2279          fG2[i-1]  = (fs1 + fs2 - 
fAmin*2) / (step*step);
  2282             d1d2 = (fs1 + fs2 - 
fAmin*2) / step;
  2283             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]);
  2286          if (TMath::Abs(grbfor - 
fGrd[i-1]) / (TMath::Abs(
fGrd[i-1]) + dfmin/step) < tlrgrd)
  2290       if (ncyc == 1) 
goto L50;
  2299    for (iint = 1; iint <= 
fNpar; ++iint) {
  2301       if (
fNvarl[iext-1] <= 1) {
  2337    Int_t i, j, k, 
l, 
m=0, i0, i1, j1, m1, n1;
  2341    a_offset = ndima + 1;
  2349    for (i1 = 2; i1 <= 
n; ++i1) {
  2351       f  = a[i + (i-1)*ndima];
  2354       if (l < 1) 
goto L25;
  2356       for (k = 1; k <= 
l; ++k) {
  2357          d__1 = a[i + k*ndima];
  2363       if (gl > 1
e-35) 
goto L30;
  2371       if (f >= 0) gl = -gl;
  2374       a[i + (i-1)*ndima] = f - gl;
  2376       for (j = 1; j <= 
l; ++j) {
  2377          a[j + i*ndima] = a[i + j*ndima] / 
h;
  2379          for (k = 1; k <= j; ++k) { gl += a[j + k*ndima]*a[i + k*ndima]; }
  2380          if (j >= l) 
goto L47;
  2382          for (k = j1; k <= 
l; ++k) {        gl += a[k + j*ndima]*a[i + k*ndima]; }
  2384          work[n + j] = gl / 
h;
  2385          f += gl*a[j + i*ndima];
  2388       for (j = 1; j <= 
l; ++j) {
  2390          gl = work[n + j] - hh*
f;
  2392          for (k = 1; k <= j; ++k) {
  2393             a[j + k*ndima] = a[j + k*ndima] - f*work[n + k] - gl*a[i + k*ndima];
  2402    for (i = 1; i <= 
n; ++i) {
  2404       if (work[i] == 0 || l == 0) 
goto L100;
  2406       for (j = 1; j <= 
l; ++j) {
  2408          for (k = 1; k <= 
l; ++k) { gl += a[i + k*ndima]*a[k + j*ndima]; }
  2409          for (k = 1; k <= 
l; ++k) { a[k + j*ndima] -= gl*a[k + i*ndima]; }
  2412       work[i] = a[i + i*ndima];
  2414       if (l == 0) 
continue;
  2416       for (j = 1; j <= 
l; ++j) {
  2423    for (i = 2; i <= 
n; ++i) {
  2425       work[i0] = work[i0 + 1];
  2430    for (l = 1; l <= 
n; ++
l) {
  2434       for (m1 = l; m1 <= 
n; ++m1) {
  2440       if (m == l) 
goto L205;
  2443       if (j == mits) 
return;
  2445       pt = (work[l + 1] - work[
l]) / (work[n + l]*2);
  2448       if (pt < 0) pr = pt - 
r;
  2450       h = work[
l] - work[n + 
l] / pr;
  2451       for (i = l; i <= 
n; ++i) { work[i] -= 
h; }
  2458       for (i1 = l; i1 <= m1; ++i1) {
  2465          c = pt / work[n + i];
  2467          work[n + j] = s*work[n + i]*
r;
  2472          c = work[n + i] / 
pt;
  2474          work[n + j] = s*pt*
r;
  2478          pt = c*work[i] - s*gl;
  2479          work[j] = h + s*(c*gl + s*work[i]);
  2480          for (k = 1; k <= 
n; ++k) {
  2482             a[k + j*ndima] = s*a[k + i*ndima] + c*
h;
  2483             a[k + i*ndima] = c*a[k + i*ndima] - s*
h;
  2494    for (i = 1; i <= n1; ++i) {
  2498       for (j = i1; j <= 
n; ++j) {
  2499          if (work[j] >= pt) 
continue;
  2504       if (k == i) 
continue;
  2508       for (j = 1; j <= 
n; ++j) {
  2509          pt = a[j + i*ndima];
  2510          a[j + i*ndima] = a[j + k*ndima];
  2511          a[j + k*ndima] = 
pt;
  2528    Int_t emat_dim1, emat_offset;
  2532    Int_t i, j, k, npard, k2, kk, iz, nperln, kga, kgb;
  2537    emat_offset = emat_dim1 + 1;
  2538    emat -= emat_offset;
  2541    if (
fISW[1] < 1) 
return;
  2543       Printf(
" EXTERNAL ERROR MATRIX.    NDIM=%4d    NPAR=%3d    ERR DEF=%g",ndim,
fNpar,
fUp);
  2550          Printf(
" USER-DIMENSIONED  ARRAY EMAT NOT BIG ENOUGH. REDUCED MATRIX CALCULATED.");
  2557    if (
fISW[4] >= 1 && npard > nperln) {
  2558       Printf(
" ELEMENTS ABOVE DIAGONAL ARE NOT PRINTED.");
  2561    for (i = 1; i <= npard; ++i) {
  2564       for (j = 1; j <= i; ++j) {
  2567          emat[i + j*emat_dim1] = dxdi*
fVhmat[kgb-1]*dxdj*
fUp;
  2568          emat[j + i*emat_dim1] = emat[i + j*emat_dim1];
  2573       for (i = 1; i <= npard; ++i) {
  2575          if (npard >= nperln) iz = i;
  2577          for (k = 1; nperln < 0 ? k >= iz : k <= iz; k += nperln) {
  2578             k2 = k + nperln - 1;
  2579             if (k2 > iz) k2 = iz;
  2580             for (kk = k; kk <= k2; ++kk) {
  2583             Printf(
"%s",(
const char*)ctemp);
  2605    Int_t ndiag, iin, iex;
  2609    if (iex > 
fNu || iex <= 0) 
goto L900;
  2611    if (iin <= 0) 
goto L900;
  2614    eplus  = 
fErp[iin-1];
  2615    if (eplus == 
fUndefi)  eplus = 0;
  2616    eminus = 
fErn[iin-1];
  2617    if (eminus == 
fUndefi) eminus = 0;
  2619    ndiag  = iin*(iin + 1) / 2;
  2623    if (
fISW[1] < 2) 
return;
  2661       if (
fISW[0] >= 1) ierev = 1;
  2662       if (
fISW[3] < 1)  ierev = 2;
  2693    static const char *
const cname[40] = {
  2738    Double_t step, xptu[101], yptu[101], 
f, rno;
  2739    Int_t icol, kcol, ierr, iint, iext, lnow, nptu, i, iflag, ierrf;
  2740    Int_t ilist, nparx, izero, nf, lk, it, iw, inonde, nsuper;
  2741    Int_t it2, ke1, ke2, nowprt, kll, krl;
  2742    TString chwhy, c26, cvblnk, cneway, comd;
  2744    Bool_t lfreed, ltofix, lfixed;
  2751    if (lk > 20) lk = 20;
  2756    for (iw = 1; iw <= 
fMaxpar; ++iw) {
  2758       if (iw <= llist) 
fWord7[iw-1] = plist[iw-1];
  2765          if (lnow > 4) lnow = 4;
  2768          for (i = 1; i <= lnow; ++i) {
  2771          Printf(
"%s",(
const char*)ctemp);
  2780             for (i = lnow + 1; i <= kll; ++i) {
  2781                Printf(
"%12.4g",plist[i-1]);
  2786             Printf(
"  ERROR: ABOVE CALL TO MNEXCM TRIED TO PASS MORE THAN %d PARAMETERS.", 
fMaxpar);
  2804    for (i = 1; i <= nntot; ++i) {
  2805       if (strncmp(ctemp.
Data(),cname[i-1],3) == 0) 
goto L90;
  2807    Printf(
"UNKNOWN COMMAND IGNORED:%s", comand.
Data());
  2812    if (
fCword(0,4) == 
"MINO") i = 5;
  2813    if (i != 6 && i != 7 && i != 8 && i != 23) {
  2828       case 10:  
goto L1000;
  2829       case 11:  
goto L1100;
  2830       case 12:  
goto L1200;
  2831       case 13:  
goto L1300;
  2832       case 14:  
goto L1400;
  2833       case 15:  
goto L1500;
  2834       case 16:  
goto L1600;
  2835       case 17:  
goto L1700;
  2836       case 18:  
goto L1800;
  2837       case 19:  
goto L1900;
  2838       case 20:  
goto L1900;
  2839       case 21:  
goto L1900;
  2840       case 22:  
goto L2200;
  2841       case 23:  
goto L2300;
  2842       case 24:  
goto L2400;
  2843       case 25:  
goto L1900;
  2844       case 26:  
goto L2600;
  2845       case 27:  
goto L3300;
  2846       case 28:  
goto L3300;
  2847       case 29:  
goto L3300;
  2848       case 30:  
goto L3300;
  2849       case 31:  
goto L3300;
  2850       case 32:  
goto L3300;
  2851       case 33:  
goto L3300;
  2852       case 34:  
goto L3400;
  2853       case 35:  
goto L3500;
  2854       case 36:  
goto L3600;
  2855       case 37:  
goto L3700;
  2856       case 38:  
goto L3800;
  2857       case 39:  
goto L3900;
  2858       case 40:  
goto L4000;
  2867    if (
fISW[3] < 1) ierflg = 4;
  2875    if (
fISW[3] >= 1) 
return;
  2877    if (
fISW[0] == 1) 
return;
  2878    if (
fCword(0,3) == 
"MIG") 
return;
  2883    if (
fISW[0] == 1) 
return;
  2886    if (
fISW[3] >= 1) ierflg = 0;
  2902    if (fNfcn < nsuper) 
goto L510;
  2903    Printf(
" TOO MANY FUNCTION CALLS. MINOS GIVES UP");
  2923       Printf(
"%s:  NO PARAMETERS REQUESTED ",(
const char*)
fCword);
  2926    for (ilist = 1; ilist <= llist; ++ilist) {
  2927       iext = 
Int_t(plist[ilist-1]);
  2928       chwhy = 
" IS UNDEFINED.";
  2929       if (iext <= 0) 
goto L930;
  2930       if (iext > 
fNu) 
goto L930;
  2931       if (
fNvarl[iext-1] < 0) 
goto L930;
  2932       chwhy = 
" IS CONSTANT.  ";
  2933       if (
fNvarl[iext-1] == 0) 
goto L930;
  2936          chwhy = 
" ALREADY FIXED.";
  2937          if (iint == 0) 
goto L930;
  2939          if (ierr == 0) lfixed = 
kTRUE;
  2942          chwhy = 
" ALREADY VARIABLE.";
  2943          if (iint > 0) 
goto L930;
  2950       if (
fISW[4] >= 0) 
Printf(
" PARAMETER %4d %s IGNORED.",iext,(
const char*)chwhy);
  2952    if (lfreed || lfixed) 
mnrset(0);
  2965    if (it > 1 || it < 0) 
goto L1005;
  2976    Printf(
" IGNORED.  UNKNOWN ARGUMENT:%4d",it);
  2986    if (iext <= 0) 
goto L1210;
  2989    if (it2 <= 0) 
goto L1250;
  2995    Printf(
" PARAMETER %4d NOT VARIABLE.",iext);
  3007          Printf(
"%s:  NO PARAMETERS REQUESTED ",(
const char*)
fCword);
  3013    mncntr(ke1-1, ke2-1, ierrf);
  3014    if (ierrf > 0) ierflg = 3;
  3045       } 
else if (f < 
fAmin) {
  3049       if (
fISW[4] >= 0 && iflag <= 5 && nowprt == 1) {
  3054    if (iflag > 5) 
mnrset(1);
  3065       if (
fISW[4] >= 0) 
Printf(
" CALL TO USER FUNCTION WITH IFLAG = 3");
  3070    if (
fCword(0,3) == 
"END") ierflg = 10;
  3071    if (
fCword(0,3) == 
"RET") ierflg = 12;
  3077       Printf(
" MINUIT MEMORY CLEARED. NO PARAMETERS NOW DEFINED.");
  3083    for (icol = 5; icol <= lk; ++icol) {
  3084       if (
fCword[icol-1] == 
' ') 
continue;
  3089    if (kcol == 0) comd = 
"*   ";
  3090    else           comd = 
fCword(kcol-1,lk-kcol+1);
  3098    if (ke1 == 0 && 
fNpar == 2) {
  3103    if (nptu <= 0)  nptu = 20;
  3104    if (nptu > 101) nptu = 101;
  3106    mncont(ke1-1, ke2-1, nptu, xptu, yptu, ierrf);
  3107    if (ierrf < nptu) ierflg = 4;
  3108    if (ierrf == -1)  ierflg = 3;
  3113    if (step <= 0) step = 2;
  3116    for (i = 1; i <= 
fNpar; ++i) {
  3119       fX[i-1] += rno*step*
fWerr[i-1];
  3127    Printf(
" BLANK COMMAND IGNORED.");
  3133    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*");
  3138    cneway = 
"SET PRInt ";
  3142    cneway = 
"SET GRAd  ";
  3146    cneway = 
"SHOW COVar";
  3150    cneway = 
"SET ERRdef";
  3154    cneway = 
"SET LIMits";
  3161    Printf(
" OBSOLETE COMMAND:%s   PLEASE USE:%s",(
const char*)
fCword  3162                                                  ,(
const char*)cneway);
  3164    if (fCword == 
"SAVE      ") 
goto L1500;
  3181    for (iint = 1; iint <= 
fNpar; ++iint) {
  3184       pint[iint-1] = pinti;
  3197    Int_t kold, nold, ndex, knew, iext, i, j, 
m, 
n, lc, ik;
  3201    Int_t iint = iint1+1;
  3202    if (iint > 
fNpar || iint <= 0) {
  3204       Printf(
" MINUIT ERROR.  ARGUMENT TO MNFIXP=%4d",iint);
  3210       Printf(
" MINUIT CANNOT FIX PARAMETER %4d MAXIMUM NUMBER THAT CAN BE FIXED IS %d",iext,
fMaxpar);
  3230    for (ik = iext + 1; ik <= 
fNu; ++ik) {
  3244    if (
fISW[1] <= 0) 
return;
  3246    if (
fNpar <= 0)   
return;
  3247    for (i = 1; i <= nold; ++i) {
  3250       ndex    = m*(m-1) / 2 + n;
  3256    for (i = 1; i <= nold; ++i) {
  3257       for (j = 1; j <= i; ++j) {
  3259          if (j == iint || i == iint) 
continue;
  3283    Double_t grdv, xv, dirinv, g2v, gstepv, xtv;
  3284    Int_t i, ipsav, ka, lc, ik, 
iq, ir, is;
  3287       Printf(
" CALL TO MNFREE IGNORED.  ARGUMENT GREATER THAN ONE");
  3290       Printf(
" CALL TO MNFREE IGNORED.  THERE ARE NO FIXED PARAMETERS");
  3292    if (k == 1 || k == 0) 
goto L40;
  3296    if (
fNiofex[ka-1] == 0) 
goto L15;
  3297    Printf(
" IGNORED.  PARAMETER SPECIFIED IS ALREADY VARIABLE.");
  3300    if (
fNpfix < 1) 
goto L21;
  3301    for (ik = 1; ik <= 
fNpfix; ++ik) { 
if (
fIpfix[ik-1] == ka) 
goto L24; }
  3303    Printf(
" PARAMETER %4d NOT FIXED.  CANNOT BE RELEASED.",ka);
  3306    if (ik == 
fNpfix) 
goto L40;
  3316    for (i = ik + 1; i <= 
fNpfix; ++i) {
  3334    if (
fNpfix < 1) 
goto L300;
  3337    for (ik = 
fNu; ik >= ir; --ik) {
  3343          fX[lc-1]      = 
fX[lc-2];
  3353    if (is == 0) is = 
fNpar;
  3357    fX[is-1]     = 
fXs[iq-1];
  3368       Printf(
"                   PARAMETER %4d  %s RESTORED TO VARIABLE.",ir,
  3369                       (
const char*)
fCpnam[ir-1]);
  3371    if (k == 0) 
goto L40;
  3390    Int_t i, nparx, lc, istsav;
  3395    if (
fWord7[0] > 0) 
goto L2000;
  3409    Printf(
" CHECK OF GRADIENT CALCULATION IN FCN");
  3410    Printf(
"            PARAMETER      G(IN FCN)   G(MINUIT)  DG(MINUIT)   AGREEMENT");
  3413    for (lc = 1; lc <= 
fNpar; ++lc) {
  3415       const char *cwd = 
"GOOD";
  3427       Printf(
"       %5d  %10s%12.4e%12.4e%12.4e    %s",i
  3428                     ,(
const char*)
fCpnam[i-1]
  3432       Printf(
"  AGREEMENT=NONE  MEANS FCN DID NOT CALCULATE THE DERIVATIVE");
  3435       Printf(
" MINUIT DOES NOT ACCEPT DERIVATIVE CALCULATIONS BY FCN");
  3436       Printf(
" TO FORCE ACCEPTANCE, ENTER *SET GRAD    1*");
  3470    if( comd.
Length() == 0 || comd[0] == 
'*' || comd[0] == 
'?' || comd[0] == 0 || comd==
"HELP" ) {
  3471       Printf(
"   ==>List of MINUIT Interactive commands:");
  3472       Printf(
" CLEar     Reset all parameter names and values undefined");
  3473       Printf(
" CONtour   Make contour map of the user function");
  3474       Printf(
" EXIT      Exit from Interactive Minuit");
  3475       Printf(
" FIX       Cause parameter(s) to remain constant");
  3476       Printf(
" HESse     Calculate the Hessian or error matrix.");
  3477       Printf(
" IMPROVE   Search for a new minimum around current minimum");
  3478       Printf(
" MIGrad    Minimize by the method of Migrad");
  3479       Printf(
" MINImize  MIGRAD + SIMPLEX method if Migrad fails");
  3480       Printf(
" MINOs     Exact (non-linear) parameter error analysis");
  3481       Printf(
" MNContour Calculate one MINOS function contour");
  3482       Printf(
" PARameter Define or redefine new parameters and values");
  3483       Printf(
" RELease   Make previously FIXed parameters variable again");
  3484       Printf(
" REStore   Release last parameter fixed");
  3485       Printf(
" SAVe      Save current parameter values on a file");
  3486       Printf(
" SCAn      Scan the user function by varying parameters");
  3487       Printf(
" SEEk      Minimize by the method of Monte Carlo");
  3488       Printf(
" SET       Set various MINUIT constants or conditions");
  3489       Printf(
" SHOw      Show values of current constants or conditions");
  3490       Printf(
" SIMplex   Minimize by the method of Simplex");
  3498    if( !strncmp(comd.
Data(),
"CLE",3) ) {
  3500       Printf(
" Resets all parameter names and values to undefined.");
  3501       Printf(
" Must normally be followed by a PARameters command or ");
  3502       Printf(
" equivalent, in order to define parameter values.");
  3509    if( !strncmp(comd.
Data(),
"CON",3) ) {
  3510       Printf(
" ***>CONTOUR <par1>  <par2>  [devs]  [ngrid]");
  3511       Printf(
" Instructs Minuit to trace contour lines of the user function");
  3512       Printf(
" with respect to the two parameters whose external numbers");
  3513       Printf(
" are <par1> and <par2>.");
  3514       Printf(
" Other variable parameters of the function, if any, will have");
  3515       Printf(
" their values fixed at the current values during the contour");
  3516       Printf(
" tracing. The optional parameter [devs] (default value 2.)");
  3517       Printf(
" gives the number of standard deviations in each parameter");
  3518       Printf(
" which should lie entirely within the plotting area.");
  3519       Printf(
" Optional parameter [ngrid] (default value 25 unless page");
  3520       Printf(
" size is too small) determines the resolution of the plot,");
  3521       Printf(
" i.e. the number of rows and columns of the grid at which the");
  3522       Printf(
" function will be evaluated. [See also MNContour.]");
  3529    if( !strncmp(comd.
Data(),
"END",3) ) {
  3531       Printf(
" Signals the end of a data block (i.e., the end of a fit),");
  3532       Printf(
" and implies that execution should continue, because another");
  3533       Printf(
" Data Block follows. A Data Block is a set of Minuit data");
  3534       Printf(
" consisting of");
  3536       Printf(
"     (2) One or more Parameter Definitions,");
  3537       Printf(
"     (3) A blank line, and");
  3538       Printf(
"     (4) A set of Minuit Commands.");
  3539       Printf(
" The END command is used when more than one Data Block is to");
  3540       Printf(
" be used with the same FCN function. It first causes Minuit");
  3541       Printf(
" to issue a CALL FCN with IFLAG=3, in order to allow FCN to");
  3542       Printf(
" perform any calculations associated with the final fitted");
  3543       Printf(
" parameter values, unless a CALL FCN 3 command has already");
  3544       Printf(
" been executed at the current FCN value.");
  3551    if( !strncmp(comd.
Data(),
"EXI",3) ) {
  3553       Printf(
" Signals the end of execution.");
  3554       Printf(
" The EXIT command first causes Minuit to issue a CALL FCN");
  3555       Printf(
" with IFLAG=3, to allow FCN to perform any calculations");
  3556       Printf(
" associated with the final fitted parameter values, unless a");
  3557       Printf(
" CALL FCN 3 command has already been executed.");
  3564    if( !strncmp(comd.
Data(),
"FIX",3) ) {
  3565       Printf(
" ***>FIX} <parno> [parno] ... [parno]");
  3566       Printf(
" Causes parameter(s) <parno> to be removed from the list of");
  3567       Printf(
" variable parameters, and their value(s) will remain constant");
  3568       Printf(
" during subsequent minimizations, etc., until another command");
  3569       Printf(
" changes their value(s) or status.");
  3576    if( !strncmp(comd.
Data(),
"HES",3) ) {
  3577       Printf(
" ***>HESse  [maxcalls]");
  3578       Printf(
" Calculate, by finite differences, the Hessian or error matrix.");
  3579       Printf(
"  That is, it calculates the full matrix of second derivatives");
  3580       Printf(
" of the function with respect to the currently variable");
  3581       Printf(
" parameters, and inverts it, printing out the resulting error");
  3582       Printf(
" matrix. The optional argument [maxcalls] specifies the");
  3583       Printf(
" (approximate) maximum number of function calls after which");
  3584       Printf(
" the calculation will be stopped.");
  3591    if( !strncmp(comd.
Data(),
"IMP",3) ) {
  3592       Printf(
" ***>IMPROVE  [maxcalls]");
  3593       Printf(
" If a previous minimization has converged, and the current");
  3594       Printf(
" values of the parameters therefore correspond to a local");
  3595       Printf(
" minimum of the function, this command requests a search for");
  3596       Printf(
" additional distinct local minima.");
  3597       Printf(
" The optional argument [maxcalls] specifies the (approximate");
  3598       Printf(
" maximum number of function calls after which the calculation");
  3599       Printf(
" will be stopped.");
  3606    if( !strncmp(comd.
Data(),
"MIG",3) ) {
  3607       Printf(
" ***>MIGrad  [maxcalls]  [tolerance]");
  3608       Printf(
" Causes minimization of the function by the method of Migrad,");
  3609       Printf(
" the most efficient and complete single method, recommended");
  3610       Printf(
" for general functions (see also MINImize).");
  3611       Printf(
" The minimization produces as a by-product the error matrix");
  3612       Printf(
" of the parameters, which is usually reliable unless warning");
  3613       Printf(
" messages are produced.");
  3614       Printf(
" The optional argument [maxcalls] specifies the (approximate)");
  3615       Printf(
" maximum number of function calls after which the calculation");
  3616       Printf(
" will be stopped even if it has not yet converged.");
  3617       Printf(
" The optional argument [tolerance] specifies required tolerance");
  3618       Printf(
" on the function value at the minimum.");
  3619       Printf(
" The default tolerance is 0.1, and the minimization will stop");
  3620       Printf(
" when the estimated vertical distance to the minimum (EDM) is");
  3621       Printf(
" less than 0.001*[tolerance]*UP (see [SET ERRordef]).");
  3628    if( !strncmp(comd.
Data(),
"MINI",4) ) {
  3629       Printf(
" ***>MINImize  [maxcalls] [tolerance]");
  3630       Printf(
" Causes minimization of the function by the method of Migrad,");
  3631       Printf(
" as does the MIGrad command, but switches to the SIMplex method");
  3632       Printf(
" if Migrad fails to converge. Arguments are as for MIGrad.");
  3633       Printf(
" Note that command requires four characters to be unambiguous.");
  3640    if( !strncmp(comd.
Data(),
"MIN0",4) ) {
  3641       Printf(
" ***>MINOs  [maxcalls]  [parno] [parno] ...");
  3642       Printf(
" Causes a Minos error analysis to be performed on the parameters");
  3643       Printf(
" whose numbers [parno] are specified. If none are specified,");
  3644       Printf(
" Minos errors are calculated for all variable parameters.");
  3645       Printf(
" Minos errors may be expensive to calculate, but are very");
  3646       Printf(
" reliable since they take account of non-linearities in the");
  3647       Printf(
" problem as well as parameter correlations, and are in general");
  3649       Printf(
" The optional argument [maxcalls] specifies the (approximate)");
  3650       Printf(
" maximum number of function calls per parameter requested,");
  3651       Printf(
" after which the calculation will stop for that parameter.");
  3658    if( !strncmp(comd.
Data(),
"MNC",3) ) {
  3659       Printf(
" ***>MNContour  <par1> <par2> [npts]");
  3660       Printf(
" Calculates one function contour of FCN with respect to");
  3661       Printf(
" parameters par1 and par2, with FCN minimized always with");
  3662       Printf(
" respect to all other NPAR-2 variable parameters (if any).");
  3663       Printf(
" Minuit will try to find npts points on the contour (default 20)");
  3664       Printf(
" If only two parameters are variable at the time, it is not");
  3665       Printf(
" necessary to specify their numbers. To calculate more than");
  3666       Printf(
" one contour, it is necessary to SET ERRordef to the appropriate");
  3667       Printf(
" value and issue the MNContour command for each contour.");
  3674    if( !strncmp(comd.
Data(),
"PAR",3) ) {
  3675       Printf(
" ***>PARameters");
  3676       Printf(
" followed by one or more parameter definitions.");
  3677       Printf(
" Parameter definitions are of the form:");
  3678       Printf(
"   <number>  ''name''  <value>  <step>  [lolim] [uplim] ");
  3680       Printf(
"  3  ''K width''  1.2   0.1");
  3681       Printf(
" the last definition is followed by a blank line or a zero.");
  3688    if( !strncmp(comd.
Data(),
"REL",3) ) {
  3689       Printf(
" ***>RELease  <parno> [parno] ... [parno]");
  3690       Printf(
" If <parno> is the number of a previously variable parameter");
  3691       Printf(
" which has been fixed by a command: FIX <parno>, then that");
  3692       Printf(
" parameter will return to variable status.  Otherwise a warning");
  3693       Printf(
" message is printed and the command is ignored.");
  3694       Printf(
" Note that this command operates only on parameters which were");
  3695       Printf(
" at one time variable and have been FIXed. It cannot make");
  3696       Printf(
" constant parameters variable; that must be done by redefining");
  3697       Printf(
" the parameter with a PARameters command.");
  3704    if( !strncmp(comd.
Data(),
"RES",3) ) {
  3705       Printf(
" ***>REStore  [code]");
  3706       Printf(
" If no [code] is specified, this command restores all previously");
  3707       Printf(
" FIXed parameters to variable status. If [code]=1, then only");
  3708       Printf(
" the last parameter FIXed is restored to variable status.");
  3709       Printf(
" If code is neither zero nor one, the command is ignored.");
  3716    if( !strncmp(comd.
Data(),
"RET",3) ) {
  3718       Printf(
" Signals the end of a data block, and instructs Minuit to return");
  3719       Printf(
" to the program which called it. The RETurn command first");
  3720       Printf(
" causes Minuit to CALL FCN with IFLAG=3, in order to allow FCN");
  3721       Printf(
" to perform any calculations associated with the final fitted");
  3722       Printf(
" parameter values, unless a CALL FCN 3 command has already been");
  3723       Printf(
" executed at the current FCN value.");
  3730    if( !strncmp(comd.
Data(),
"SAV",3) ) {
  3732       Printf(
" Causes the current parameter values to be saved on a file in");
  3733       Printf(
" such a format that they can be read in again as Minuit");
  3734       Printf(
" parameter definitions. If the covariance matrix exists, it is");
  3735       Printf(
" also output in such a format. The unit number is by default 7,");
  3736       Printf(
" or that specified by the user in their call to MINTIO or");
  3737       Printf(
" MNINIT. The user is responsible for opening the file previous");
  3738       Printf(
" to issuing the [SAVe] command (except where this can be done");
  3739       Printf(
" interactively).");
  3746    if( !strncmp(comd.
Data(),
"SCA",3) ) {
  3747       Printf(
" ***>SCAn  [parno]  [numpts] [from]  [to]");
  3748       Printf(
" Scans the value of the user function by varying parameter");
  3749       Printf(
" number [parno], leaving all other parameters fixed at the");
  3750       Printf(
" current value. If [parno] is not specified, all variable");
  3751       Printf(
" parameters are scanned in sequence.");
  3752       Printf(
" The number of points [numpts] in the scan is 40 by default,");
  3753       Printf(
" and cannot exceed 100. The range of the scan is by default");
  3754       Printf(
" 2 standard deviations on each side of the current best value,");
  3755       Printf(
" but can be specified as from [from] to [to].");
  3756       Printf(
" After each scan, if a new minimum is found, the best parameter");
  3757       Printf(
" values are retained as start values for future scans or");
  3758       Printf(
" minimizations. The curve resulting from each scan is plotted");
  3759       Printf(
" on the output unit in order to show the approximate behaviour");
  3760       Printf(
" of the function.");
  3761       Printf(
" This command is not intended for minimization, but is sometimes");
  3762       Printf(
" useful for debugging the user function or finding a");
  3763       Printf(
" reasonable starting point.");
  3770    if( !strncmp(comd.
Data(),
"SEE",3) ) {
  3771       Printf(
" ***>SEEk  [maxcalls]  [devs]");
  3772       Printf(
" Causes a Monte Carlo minimization of the function, by choosing");
  3773       Printf(
" random values of the variable parameters, chosen uniformly");
  3774       Printf(
" over a hypercube centered at the current best value.");
  3775       Printf(
" The region size is by default 3 standard deviations on each");
  3776       Printf(
" side, but can be changed by specifying the value of [devs].");
  3783    if( !strncmp(comd.
Data(),
"SET",3) ) {
  3784       Printf(
" ***>SET <option_name>");
  3786       Printf(
"    Informs Minuit that it is running in batch mode.");
  3789       Printf(
"  SET EPSmachine  <accuracy>");
  3790       Printf(
"    Informs Minuit that the relative floating point arithmetic");
  3791       Printf(
"    precision is <accuracy>. Minuit determines the nominal");
  3792       Printf(
"    precision itself, but the SET EPSmachine command can be");
  3793       Printf(
"    used to override Minuit own determination, when the user");
  3794       Printf(
"    knows that the FCN function value is not calculated to");
  3795       Printf(
"    the nominal machine accuracy. Typical values of <accuracy>");
  3796       Printf(
"    are between 10**-5 and 10**-14.");
  3799       Printf(
"  SET ERRordef  <up>");
  3800       Printf(
"    Sets the value of UP (default value= 1.), defining parameter");
  3801       Printf(
"    errors. Minuit defines parameter errors as the change");
  3802       Printf(
"    in parameter value required to change the function value");
  3803       Printf(
"    by UP. Normally, for chisquared fits UP=1, and for negative");
  3804       Printf(
"    log likelihood, UP=0.5.");
  3807       Printf(
"   SET GRAdient  [force]");
  3808       Printf(
"    Informs Minuit that the user function is prepared to");
  3809       Printf(
"    calculate its own first derivatives and return their values");
  3810       Printf(
"    in the array GRAD when IFLAG=2 (see specs of FCN).");
  3811       Printf(
"    If [force] is not specified, Minuit will calculate");
  3812       Printf(
"    the FCN derivatives by finite differences at the current");
  3813       Printf(
"    point and compare with the user calculation at that point,");
  3814       Printf(
"    accepting the user values only if they agree.");
  3815       Printf(
"    If [force]=1, Minuit does not do its own derivative");
  3816       Printf(
"    calculation, and uses the derivatives calculated in FCN.");
  3819       Printf(
"   SET INPut  [unitno]  [filename]");
  3820       Printf(
"    Causes Minuit, in data-driven mode only, to read subsequent");
  3821       Printf(
"    commands (or parameter definitions) from a different input");
  3822       Printf(
"    file. If no [unitno] is specified, reading reverts to the");
  3823       Printf(
"    previous input file, assuming that there was one.");
  3824       Printf(
"    If [unitno] is specified, and that unit has not been opened,");
  3825       Printf(
"    then Minuit attempts to open the file [filename]} if a");
  3826       Printf(
"    name is specified. If running in interactive mode and");
  3827       Printf(
"    [filename] is not specified and [unitno] is not opened,");
  3828       Printf(
"    Minuit prompts the user to enter a file name.");
  3829       Printf(
"    If the word REWIND is added to the command (note:no blanks");
  3830       Printf(
"    between INPUT and REWIND), the file is rewound before");
  3831       Printf(
"    reading. Note that this command is implemented in standard");
  3832       Printf(
"    Fortran 77 and the results may depend on the  system;");
  3833       Printf(
"    for example, if a filename is given under VM/CMS, it must");
  3834       Printf(
"    be preceded by a slash.");
  3837       Printf(
"   SET INTeractive");
  3838       Printf(
"    Informs Minuit that it is running interactively.");
  3841       Printf(
"   SET LIMits  [parno]  [lolim]  [uplim]");
  3842       Printf(
"    Allows the user to change the limits on one or all");
  3843       Printf(
"    parameters. If no arguments are specified, all limits are");
  3844       Printf(
"    removed from all parameters. If [parno] alone is specified,");
  3845       Printf(
"    limits are removed from parameter [parno].");
  3846       Printf(
"    If all arguments are specified, then parameter [parno] will");
  3847       Printf(
"    be bounded between [lolim] and [uplim].");
  3848       Printf(
"    Limits can be specified in either order, Minuit will take");
  3849       Printf(
"    the smaller as [lolim] and the larger as [uplim].");
  3850       Printf(
"    However, if [lolim] is equal to [uplim], an error condition");
  3854       Printf(
"   SET LINesperpage");
  3855       Printf(
"     Sets the number of lines for one page of output.");
  3856       Printf(
"     Default value is 24 for interactive mode");
  3859       Printf(
"   SET NOGradient");
  3860       Printf(
"    The inverse of SET GRAdient, instructs Minuit not to");
  3861       Printf(
"    use the first derivatives calculated by the user in FCN.");
  3864       Printf(
"   SET NOWarnings");
  3865       Printf(
"    Supresses Minuit warning messages.");
  3868       Printf(
"   SET OUTputfile  <unitno>");
  3869       Printf(
"    Instructs Minuit to write further output to unit <unitno>.");
  3872       Printf(
"   SET PAGethrow  <integer>");
  3873       Printf(
"    Sets the carriage control character for ``new page'' to");
  3874       Printf(
"    <integer>. Thus the value 1 produces a new page, and 0");
  3875       Printf(
"    produces a blank line, on some devices (see TOPofpage)");
  3879       Printf(
"   SET PARameter  <parno>  <value>");
  3880       Printf(
"    Sets the value of parameter <parno> to <value>.");
  3881       Printf(
"    The parameter in question may be variable, fixed, or");
  3882       Printf(
"    constant, but must be defined.");
  3885       Printf(
"   SET PRIntout  <level>");
  3886       Printf(
"    Sets the print level, determining how much output will be");
  3887       Printf(
"    produced. Allowed values and their meanings are displayed");
  3888       Printf(
"    after a SHOw PRInt command, and are currently <level>=:");
  3889       Printf(
"      [-1]  no output except from SHOW commands");
  3890       Printf(
"       [0]  minimum output");
  3891       Printf(
"       [1]  default value, normal output");
  3892       Printf(
"       [2]  additional output giving intermediate results.");
  3893       Printf(
"       [3]  maximum output, showing progress of minimizations.");
  3894       Printf(
"    Note: See also the SET WARnings command.");
  3897       Printf(
"   SET RANdomgenerator  <seed>");
  3898       Printf(
"    Sets the seed of the random number generator used in SEEk.");
  3899       Printf(
"    This can be any integer between 10000 and 900000000, for");
  3900       Printf(
"    example one which was output from a SHOw RANdom command of");
  3901       Printf(
"    a previous run.");
  3904       Printf(
"   SET STRategy  <level>");
  3905       Printf(
"    Sets the strategy to be used in calculating first and second");
  3906       Printf(
"    derivatives and in certain minimization methods.");
  3907       Printf(
"    In general, low values of <level> mean fewer function calls");
  3908       Printf(
"    and high values mean more reliable minimization.");
  3909       Printf(
"    Currently allowed values are 0, 1 (default), and 2.");
  3913       Printf(
"    Informs Minuit that the next input line is to be considered");
  3914       Printf(
"    the (new) title for this task or sub-task.  This is for");
  3915       Printf(
"    the convenience of the user in reading their output.");
  3919       Printf(
"    Instructs Minuit to output warning messages when suspicious");
  3920       Printf(
"    conditions arise which may indicate unreliable results.");
  3921       Printf(
"    This is the default.");
  3924       Printf(
"    SET WIDthpage");
  3925       Printf(
"    Informs Minuit of the output page width.");
  3926       Printf(
"    Default values are 80 for interactive jobs");
  3933    if( !strncmp(comd.
Data(),
"SHO",3) ) {
  3934       Printf(
" ***>SHOw  <option_name>");
  3935       Printf(
"  All SET XXXX commands have a corresponding SHOw XXXX command.");
  3936       Printf(
"  In addition, the SHOw commands listed starting here have no");
  3937       Printf(
"  corresponding SET command for obvious reasons.");
  3940       Printf(
"   SHOw CORrelations");
  3941       Printf(
"    Calculates and prints the parameter correlations from the");
  3942       Printf(
"    error matrix.");
  3945       Printf(
"   SHOw COVariance");
  3946       Printf(
"    Prints the (external) covariance (error) matrix.");
  3949       Printf(
"   SHOw EIGenvalues");
  3950       Printf(
"    Calculates and prints the eigenvalues of the covariance");
  3954       Printf(
"   SHOw FCNvalue");
  3955       Printf(
"    Prints the current value of FCN.");
  3962    if( !strncmp(comd.
Data(),
"SIM",3) ) {
  3963       Printf(
" ***>SIMplex  [maxcalls]  [tolerance]");
  3964       Printf(
" Performs a function minimization using the simplex method of");
  3965       Printf(
" Nelder and Mead. Minimization terminates either when the");
  3966       Printf(
" function has been called (approximately) [maxcalls] times,");
  3967       Printf(
" or when the estimated vertical distance to minimum (EDM) is");
  3968       Printf(
" less than [tolerance].");
  3969       Printf(
" The default value of [tolerance] is 0.1*UP(see SET ERRordef).");
  3976    if( !strncmp(comd.
Data(),
"STA",3) ) {
  3984    if( !strncmp(comd.
Data(),
"STO",3) ) {
  3986       Printf(
" Same as EXIT.");
  3993    if( !strncmp(comd.
Data(),
"TOP",3) ) {
  3994       Printf(
" ***>TOPofpage");
  3995       Printf(
" Causes Minuit to write the character specified in a");
  3996       Printf(
" SET PAGethrow command (default = 1) to column 1 of the output");
  3997       Printf(
" file, which may or may not position your output medium to");
  3998       Printf(
" the top of a page depending on the device and system.");
  4002    Printf(
" Unknown MINUIT command. Type HELP for list of commands.");
  4020    Double_t dmin_, dxdi, elem, wint, tlrg2, d, dlast, ztemp, g2bfor;
  4021    Double_t df, aimsag, fs1, tlrstp, fs2, stpinm, g2i, sag=0, xtf, xti, xtj;
  4022    Int_t icyc, ncyc, ndex, idrv, iext, npar2, i, j, ifail, npard, nparx, 
id, multpy;
  4025    ldebug = 
fIdbg[3] >= 1;
  4042    if (
fISW[4] >= 2 || ldebug) {
  4043       Printf(
"   START COVARIANCE MATRIX CALCULATION.");
  4059       Printf(
" PAR D   GSTEP           D          G2         GRD         SAG    ");
  4069    for (i = 1; i <= npar2; ++i) { 
fVhmat[i-1] = 0; }
  4073    for (
id = 1; 
id <= npard; ++
id) {
  4074       i = 
id + 
fNpar - npard;
  4076       if (
fG2[i-1] == 0) {
  4077          mnwarn(
"W", 
"HESSE", 
Form(
"Second derivative enters zero, param %d",iext));
  4079          if (
fNvarl[iext-1] > 1) {
  4084          fG2[i-1] = 
fUp / (wint*wint);
  4092       for (icyc = 1; icyc <= ncyc; ++icyc) {
  4094          for (multpy = 1; multpy <= 5; ++multpy) {
  4104             sag = (fs1 + fs2 - 
fAmin*2)*.5;
  4105             if (sag != 0) 
goto L30;
  4107                if (d >= .5) 
goto L26;
  4109                if (d > .5)         d = .51;
  4120          fG2[i-1]  = sag*2 / (d*d);
  4121          fGrd[i-1] = (fs1 - fs2) / (d*2);
  4123             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);
  4134          if (d < dmin_) d = dmin_;
  4136          if (TMath::Abs((d - dlast) / d) < tlrstp ||
  4137             TMath::Abs((
fG2[i-1] - g2bfor) / 
fG2[i-1]) < tlrg2) {
  4148       ndex = i*(i + 1) / 2;
  4159    if (
fNpar == 1) 
goto L214;
  4160    for (i = 1; i <= 
fNpar; ++i) {
  4161       for (j = 1; j <= i-1; ++j) {
  4165          fX[j-1] = xtj + fDirin[j-1];
  4171                     fDirin[i-1]*fDirin[j-1]);
  4172          ndex = i*(i-1) / 2 + j;
  4180    for (i = 1; i <= 
fNpar; ++i) {
  4181       for (j = 1; j <= i; ++j) {
  4182          ndex = i*(i-1) / 2 + j;
  4189       mnwarn(
"W", 
"HESSE", 
"Matrix inversion fails.");
  4195    for (i = 1; i <= 
fNpar; ++i) {
  4198       for (j = 1; j <= i-1; ++j) {
  4210       Printf(
" COVARIANCE MATRIX CALCULATED SUCCESSFULLY");
  4219       Printf(
"  MNHESS FAILS AND WILL RETURN DIAGONAL MATRIX. ");
  4221    for (i = 1; i <= 
fNpar; ++i) {
  4223       for (j = 1; j <= i-1; ++j) {
  4229       if (g2i <= 0) g2i = 1;
  4230       fVhmat[ndex-1] = 2 / g2i;
  4245    Double_t dmin_, d, dfmin, dgmin=0, change, chgold, grdold=0, epspri;
  4246    Double_t fs1, optstp, fs2, grdnew=0, sag, xtf;
  4247    Int_t icyc, ncyc=0, idrv, i, nparx;
  4250    ldebug = 
fIdbg[5] >= 1;
  4258    for (i = 1; i <= 
fNpar; ++i) {
  4264       if (d > optstp) d = optstp;
  4265       if (d < dmin_)  d = dmin_;
  4268       for (icyc = 1; icyc <= ncyc; ++icyc) {
  4277          sag    = (fs1 + fs2 - 
fAmin*2)*.5;
  4279          grdnew = (fs1 - fs2) / (d*2);
  4282             Printf(
"%4d%2d%12.5g%12.5g%12.5g%12.5g%12.5g",i,idrv,
fGstep[i-1],d,
fG2[i-1],grdnew,sag);
  4284          if (grdnew == 0) 
goto L60;
  4285          change = 
TMath::Abs((grdold - grdnew) / grdnew);
  4286          if (change > chgold && icyc > 1) 
goto L60;
  4292          if (change < .05) 
goto L60;
  4293          if (TMath::Abs(grdold - grdnew) < dgmin) 
goto L60;
  4295             mnwarn(
"D", 
"MNHES1", 
"Step size too small for 1st drv.");
  4326    Double_t amax, ycalf, ystar, ystst;
  4327    Double_t pb, ep, wg, xi, sigsav, reg, sig2;
  4328    Int_t npfn, ndex, loop=0, i, j, ifail, iseed=0;
  4329    Int_t jhold, nloop, nparx, nparp1, jh, jl, iswtr;
  4331    if (
fNpar <= 0) 
return;
  4338    if (nloop <= 0) nloop = 
fNpar + 4;
  4345    for (i = 1; i <= 
fNpar; ++i) {
  4348       for (j = 1; j <= i; ++j) {
  4349          ndex = i*(i-1) / 2 + j;
  4355    if (ifail >= 1) 
goto L280;
  4357    for (i = 1; i <= 
fNpar; ++i) {
  4359       for (j = 1; j <= i; ++j) {
  4367    for (i = 1; i <= 
fNpar; ++i) {
  4375       Printf(
"START ATTEMPT NO.%2d TO FIND NEW MINIMUM",loop);
  4385    for (i = 1; i <= 
fNpar; ++i) {
  4388       fX[i-1] = xi - 
fDirin[i-1]*(rnum - .5);
  4394       } 
else if (
fIMPRy[i-1] > amax) {
  4407    if (
fAmin < 0)   
goto L95;
  4408    if (
fISW[1] <= 2) 
goto L280;
  4410    if (sig2 < ep && 
fEDM < ep) 
goto L100;
  4414    for (i = 1; i <= 
fNpar; ++i) {
  4422    if (ystar >= 
fAmin) 
goto L70;
  4424    for (i = 1; i <= 
fNpar; ++i) {
  4429    if (ystst < 
fIMPRy[jl-1]) 
goto L67;
  4437    if (ystar >= 
fIMPRy[jh-1]) 
goto L73;
  4440    if (jhold != jh) 
goto L50;
  4443    for (i = 1; i <= 
fNpar; ++i) {
  4448    if (ystst > 
fIMPRy[jh-1]) 
goto L30;
  4450    if (ystst < 
fAmin) 
goto L67;
  4456       Printf(
" AN IMPROVEMENT ON THE PREVIOUS MINIMUM HAS BEEN FOUND");
  4463    for (i = 1; i <= 
fNpar; ++i) {
  4473    for (i = 1; i <= 
fNpar; ++i) {
  4491       Printf(
" IMPROVE HAS FOUND A TRULY NEW MINIMUM");
  4492       Printf(
" *************************************");
  4498       Printf(
" COVARIANCE MATRIX WAS NOT POSITIVE-DEFINITE");
  4504    for (i = 1; i <= 
fNpar; ++i) {
  4513       Printf(
" IMPROVE HAS RETURNED TO REGION OF ORIGINAL MINIMUM");
  4517    if (
fISW[1] < 2) 
goto L380;
  4518    if (loop < nloop && 
fISW[0] < 1) 
goto L20;
  4534    for (j = 0; j < 
fNpar; ++j) {
  4554    Double_t piby2, epstry, epsbak, distnn;
  4572    fCovmes[0] = 
"NO ERROR MATRIX       ";
  4573    fCovmes[1] = 
"ERR MATRIX APPROXIMATE";
  4574    fCovmes[2] = 
"ERR MATRIX NOT POS-DEF";
  4575    fCovmes[3] = 
"ERROR MATRIX ACCURATE ";
  4593    for (idb = 0; idb <= 10; ++
idb) { 
fIdbg[
idb] = 0; }
  4613    for (i = 1; i <= 100; ++i) {
  4617       if (epsbak < epstry) 
goto L35;
  4621    Printf(
" MNINIT UNABLE TO DETERMINE ARITHMETIC PRECISION. WILL ASSUME:%g",
fEpsmac);
  4644    Int_t kint, i2, newcod, ifx=0, inu;
  4650    if (i2 > 
fMaxext || i2 < 0) 
goto L900;
  4651    if (i2 > 0) 
goto L30;
  4655    for (inu = 1; inu <= 
fNu; ++inu) {
  4656       if (
fNvarl[inu-1] <= 0) 
continue;
  4657       if (
fNvarl[inu-1] == 1 && newcod == 1) 
continue;
  4662             Printf(
"           LIMITS NOT CHANGED FOR FIXED PARAMETER:%4d",inu);
  4669             Printf(
" LIMITS REMOVED FROM PARAMETER  :%3d",inu);
  4673          snew           = 
fGstep[kint-1]*dxdi;
  4681             Printf(
" PARAMETER %3d LIMITS SET TO  %15.5g%15.5g",inu,
fAlim[inu-1],
fBlim[inu-1]);
  4692       Printf(
" PARAMETER %3d IS NOT VARIABLE.", i2);
  4698       Printf(
" REQUEST TO CHANGE LIMITS ON FIXED PARAMETER:%3d",i2);
  4699       for (ifx = 1; ifx <= 
fNpfix; ++ifx) {
  4700          if (i2 == 
fIpfix[ifx-1]) 
goto L92;
  4702       Printf(
" MINUIT BUG IN MNLIMS. SEE F. JAMES");
  4710          Printf(
" LIMITS REMOVED FROM PARAMETER  %2d",i2);
  4719          fGrd[kint-1]  *= dxdi;
  4723       Printf(
" NO LIMITS SPECIFIED.  PARAMETER %3d IS ALREADY UNLIMITED.  NO CHANGE.",i2);
  4732       Printf(
" PARAMETER %3d LIMITS SET TO  %15.5g%15.5g",i2,
fAlim[i2-1],
fBlim[i2-1]);
  4735    if (kint <= 0) 
fGsteps[ifx-1] = -.1;
  4736    else           fGstep[kint-1] = -.1;
  4739    if (
fCstatu != 
"NO CHANGE ") {
  4763    Double_t xpq[12], ypq[12], slam, sdev, coeff[3], denom, flast;
  4764    Double_t fvals[3], xvals[3], 
f1, fvmin, xvmin, ratio, 
f2, f3 = 0., fvmax;
  4765    Double_t toler8, toler9, overal, undral, slamin, slamax, slopem;
  4766    Int_t i, nparx=0, nvmax=0, nxypt, kk, ipt;
  4773    l65 = 0; l70 = 0; l80 = 0;
  4774    ldebug = 
fIdbg[1] >= 1;
  4783          Printf(
" MNLINE start point not consistent, F values, parameters=");
  4784          for (kk = 1; kk <= 
fNpar; ++kk) {
  4798    for (i = 1; i <= 
fNpar; ++i) {
  4799       if (step[i-1] != 0) {
  4801          if (slamin == 0)    slamin = ratio;
  4802          if (ratio < slamin) slamin = ratio;
  4804       fX[i-1] = start[i-1] + step[i-1];
  4806    if (slamin == 0) slamin = 
fEpsmac;
  4813    chpq[nxypt-1] = 
charal[nxypt-1];
  4828       denom = (flast - fstart - slope*slam)*2 / (slam*slam);
  4830       if (denom != 0)    slam = -slope / denom;
  4831       if (slam < 0)      slam = slamax;
  4832       if (slam > slamax) slam = slamax;
  4833       if (slam < toler8) slam = toler8;
  4834       if (slam < slamin) {
  4838       if (
TMath::Abs(slam - 1) < toler8 && f1 < fstart) {
  4842       if (
TMath::Abs(slam - 1) < toler8) slam = toler8 + 1;
  4847       for (i = 1; i <= 
fNpar; ++i) { 
fX[i-1] = start[i-1] + slam*step[i-1]; }
  4852       chpq[nxypt-1] = 
charal[nxypt-1];
  4853       xpq[nxypt-1]  = slam;
  4859       if (fstart == fvmin) {
  4861          toler8 = toler*slam;
  4862          overal = slam - toler8;
  4865    } 
while (fstart == fvmin);
  4867    if (!l65 && !l70 && !l80) {
  4871       xvals[1] = xpq[nxypt-2];
  4872       fvals[1] = ypq[nxypt-2];
  4873       xvals[2] = xpq[nxypt-1];
  4874       fvals[2] = ypq[nxypt-1];
  4878          mnpfit(xvals, fvals, 3, coeff, sdev);
  4879          if (coeff[2] <= 0) {
  4880             slopem = coeff[2]*2*xvmin + coeff[1];
  4881             if (slopem <= 0)  slam = xvmin + slamax;
  4882             else              slam = xvmin - slamax;
  4884             slam = -coeff[1] / (coeff[2]*2);
  4885             if (slam > xvmin + slamax) slam = xvmin + slamax;
  4886             if (slam < xvmin - slamax) slam = xvmin - slamax;
  4891             else if (slam < undral)
  4898             for (ipt = 1; ipt <= 3; ++ipt) {
  4899                if (
TMath::Abs(slam - xvals[ipt-1]) < toler9) {
  4910             for (i = 1; i <= 
fNpar; ++i) { 
fX[i-1] = start[i-1] + slam*step[i-1]; }
  4914             chpq[nxypt-1] = 
charal[nxypt-1];
  4915             xpq[nxypt-1]  = slam;
  4920             if (fvals[1] > fvmax) {
  4924             if (fvals[2] > fvmax) {
  4934                if (slam > xvmin) overal = 
TMath::Min(overal,slam - toler8);
  4935                if (slam < xvmin) undral = 
TMath::Max(undral,slam + toler8);
  4936                slam = (slam + xvmin)*.5;
  4938          } 
while (f3 >= fvmax);
  4941          if (l65 || l70) 
break;
  4943          xvals[nvmax-1] = slam;
  4944          fvals[nvmax-1] = f3;
  4949             if (slam > xvmin) overal = 
TMath::Min(overal,slam - toler8);
  4950             if (slam < xvmin) undral = 
TMath::Max(undral,slam + toler8);
  4952       } 
while (nxypt < 12);
  4958       cmess = 
" LINE SEARCH HAS EXHAUSTED THE LIMIT OF FUNCTION CALLS ";
  4960          Printf(
" MNLINE DEBUG: steps=");
  4961          for (kk = 1; kk <= 
fNpar; ++kk) {
  4962             Printf(
"  %12.4g",step[kk-1]);
  4967    if (l70) cmess = 
" LINE SEARCH HAS ATTAINED TOLERANCE ";
  4968    if (l80) cmess = 
" STEP SIZE AT ARITHMETICALLY ALLOWED MINIMUM";
  4971    for (i = 1; i <= 
fNpar; ++i) {
  4972       fDirin[i-1] = step[i-1]*xvmin;
  4973       fX[i-1]     = start[i-1] + 
fDirin[i-1];
  4977       mnwarn(
"D", 
"MNLINE", 
" LINE MINIMUM IN BACKWARDS DIRECTION");
  4979    if (fvmin == fstart) {
  4980       mnwarn(
"D", 
"MNLINE", 
" LINE SEARCH FINDS NO IMPROVEMENT ");
  4983       Printf(
" AFTER %3d POINTS,%s",nxypt,(
const char*)cmess);
  4997    Int_t ndex, i, j, 
m, 
n, ncoef, nparm, 
id, it, ix;
  4998    Int_t nsofar, ndi, ndj, iso, isw2, isw5;
  5007       Printf(
" MNMATU: NPAR=0");
  5021    if (
fNpar <= 1) 
return;
  5027    Printf(
" PARAMETER  CORRELATION COEFFICIENTS  ");
  5028    ctemp = 
"       NO.  GLOBAL";
  5029    for (
id = 1; 
id <= nparm; ++
id) {
  5032    Printf(
"%s",(
const char*)ctemp);
  5033    for (i = 1; i <= 
fNpar; ++i) {
  5035       ndi = i*(i + 1) / 2;
  5036       for (j = 1; j <= 
fNpar; ++j) {
  5039          ndex = m*(m-1) / 2 + n;
  5040          ndj  = j*(j + 1) / 2;
  5044       ctemp.Form(
"      %3d  %7.5f ",ix,
fGlobcc[i-1]);
  5045       for (it = 1; it <= nparm; ++it) {
  5048       Printf(
"%s",(
const char*)ctemp);
  5049       if (i <= nparm) 
continue;
  5051       for (iso = 1; iso <= 10; ++iso) {
  5054          for (it = nsofar + 1; it <= nparm; ++it) {
  5057          Printf(
"%s",(
const char*)ctemp);
  5058          if (i <= nparm) 
break;
  5077    Double_t gdel, gami, vlen, dsum, gssq, vsum, d;
  5078    Double_t fzero, fs, ri, delgam, rhotol;
  5080    Int_t npfn, ndex, iext, i, j, 
m, 
n, npsdf, nparx;
  5081    Int_t iswtr, lined2, kk, nfcnmg, nrstrt,iter;
  5085    if (
fNpar <= 0) 
return;
  5100    rhotol  = 
fApsi*.001;
  5102       Printf(
" START MIGRAD MINIMIZATION.  STRATEGY %2d.  CONVERGENCE WHEN EDM .LT.%9.2e",
fIstrat,rhotol);
  5117    if (
fISW[1] >= 1) 
goto L10;
  5125    if (
fISW[1] >= 1) 
goto L10;
  5127    for (i = 1; i <= 
fNpar; ++i) {
  5134       for (i = 1; i <= 
fNpar; ++i) {
  5135          if (
fG2[i-1] > 0) 
continue;
  5141          mnwarn(
"D", 
"MNMIGR", 
"Negative G2 line search");
  5144             Printf(
" Negative G2 line search, param %3d %13.3g%13.3g",iext,fs,
fAmin);
  5150    for (i = 1; i <= 
fNpar; ++i) {
  5152       for (j = 1; j <= i-1; ++j) {
  5157       if (
fG2[i-1] <= 0) 
fG2[i-1] = 1;
  5162       Printf(
" DEBUG MNMIGR, STARTING MATRIX DIAGONAL,  VHMAT=");
  5163       for (kk = 1; kk <= 
Int_t(vlen); ++kk) {
  5177    for (i = 1; i <= 
fNpar; ++i) {
  5181       for (j = 1; j <= i-1; ++j) {
  5190       mnwarn(
"W", 
"MIGRAD", 
"STARTING MATRIX NOT POS-DEFINITE.");
  5200    if (iswtr >= 2) 
mnmatu(0);
  5206    for (i = 1; i <= 
fNpar; ++i) {
  5209       for (j = 1; j <= 
fNpar; ++j) {
  5212          ndex = m*(m-1) / 2 + n;
  5213          ri  += 
fVhmat[ndex-1]*fMIGRgs[j-1];
  5219       mnwarn(
"D", 
"MIGRAD", 
" FIRST DERIVATIVES OF FCN ARE ALL ZERO");
  5224       mnwarn(
"D", 
"MIGRAD", 
" NEWTON STEP NOT DESCENT.");
  5225       if (npsdf == 1) 
goto L1;
  5232    if (
fAmin == fs) 
goto L200;
  5249    for (i = 1; i <= 
fNpar; ++i) {
  5252       for (j = 1; j <= 
fNpar; ++j) {
  5255          ndex = m*(m-1) / 2 + n;
  5261       gdgssq += gami*gami;
  5263       delgam += 
fDirin[i-1]*gami;
  5268    if (
fEDM < 0 || gvg <= 0) {
  5269       mnwarn(
"D", 
"MIGRAD", 
"NOT POS-DEF. EDM OR GVG NEGATIVE.");
  5271       if (npsdf == 1) 
goto L230;
  5278    if (iswtr >= 3 || (iswtr == 2 && iter % 10 == 1)) {
  5283       mnwarn(
"D", 
"MIGRAD", 
"NO CHANGE IN FIRST DERIVATIVES OVER LAST STEP");
  5286       mnwarn(
"D", 
"MIGRAD", 
"FIRST DERIVATIVES INCREASING ALONG SEARCH LINE");
  5292       for (kk = 1; kk <= 10; ++kk) {
  5298    for (i = 1; i <= 
fNpar; ++i) {
  5299       for (j = 1; j <= i; ++j) {
  5300          if(delgam == 0 || gvg == 0) d = 0;
  5303          ndex  = i*(i-1) / 2 + j;
  5310    if (iswtr >= 3 || ldebug) {
  5311       Printf(
" RELATIVE CHANGE IN COV. MATRIX=%5.1f per cent",
fDcovar*100);
  5315       for (kk = 1; kk <= 10; ++kk) {
  5319    if (delgam <= gvg) 
goto L135;
  5320    for (i = 1; i <= 
fNpar; ++i) {
  5323    for (i = 1; i <= 
fNpar; ++i) {
  5324       for (j = 1; j <= i; ++j) {
  5325          ndex = i*(i-1) / 2 + j;
  5331    if (
fEDM < rhotol*.1) 
goto L300;
  5333    for (i = 1; i <= 
fNpar; ++i) {
  5347       Printf(
" CALL LIMIT EXCEEDED IN MIGRAD.");
  5354       Printf(
" MIGRAD FAILS TO FIND IMPROVEMENT");
  5357    if (
fEDM < rhotol) 
goto L300;
  5360          Printf(
" MACHINE ACCURACY LIMITS FURTHER IMPROVEMENT.");
  5366          Printf(
" MIGRAD FAILS WITH STRATEGY=0.   WILL TRY WITH STRATEGY=1.");
  5374       Printf(
" MIGRAD TERMINATED WITHOUT CONVERGENCE.");
  5382       Printf(
" MIGRAD MINIMIZATION HAS CONVERGED.");
  5387             Printf(
" MIGRAD WILL VERIFY CONVERGENCE AND ERROR MATRIX.");
  5392          if (
fEDM > rhotol) 
goto L10;
  5403    if (iswtr >= 0) 
mnprin(3, fAmin);
  5404    if (iswtr >= 1) 
mnmatu(1);
  5418    Int_t nbad, ilax, ilax2, ngood, nfcnmi, iin, knt;
  5420    if (
fNpar <= 0) 
goto L700;
  5425    for (knt = 1; knt <= 
fNpar; ++knt) {
  5429          if (knt >= 7) 
break;
  5431          if (ilax == 0) 
break;
  5432          if (ilax > 0 && ilax <= 
fNu) {
  5433             if (
fNiofex[ilax-1] > 0) 
goto L565;
  5435          Printf(
" PARAMETER NUMBER %3d NOT A VARIABLE. IGNORED.",ilax);
  5441       mnmnot(ilax, ilax2, val2pl, val2mi);
  5445       if (
fErp[iin-1] > 0) ++ngood;
  5447       if (
fErn[iin-1] < 0) ++ngood;
  5455    if (ngood == 0 && nbad == 0) 
goto L700;
  5456    if (ngood > 0 && nbad == 0)  
fCstatu = 
"SUCCESSFUL";
  5457    if (ngood == 0 && nbad > 0)  
fCstatu = 
"FAILURE   ";
  5458    if (ngood > 0 && nbad > 0)   
fCstatu = 
"PROBLEMS  ";
  5468    Printf(
" NEW MINIMUM FOUND.  GO BACK TO MINIMIZATION STEP.");
  5469    Printf(
" =================================================");
  5479    Printf(
" THERE ARE NO MINOS ERRORS TO CALCULATE.");
  5496    Double_t abest, xunit, dc, ut, sigsav, du1;
  5498    Int_t marc, isig, mpar, ndex, imax, indx, ierr, i, j;
  5499    Int_t iercr, it, istrav, nfmxin, nlimit, isw2, isw4;
  5513    for (i = 1; i <= mpar; ++i) { 
fXt[i-1] = 
fX[i-1]; }
  5514    i__1 = mpar*(mpar + 1) / 2;
  5516    for (i = 1; i <= mpar; ++i) {
  5525    if (
fNvarl[ilax-1] == 1) {
  5527       fBlim[ilax-1] = ut + fMNOTw[it-1]*100;
  5529    ndex  = it*(it + 1) / 2;
  5532    for (i = 1; i <= mpar; ++i) {
  5533       if (i == it) 
continue;
  5542       Printf(
" MINUIT ERROR. CANNOT FIX PARAMETER %4d   INTERNAL %3d",ilax,it);
  5548    for (isig = 1; isig <= 2; ++isig) {
  5558          Printf(
" DETERMINATION OF %sTIVE MINOS ERROR FOR PARAMETER %d %s"  5559                             ,(
const char*)csig,ilax
  5560                             ,(
const char*)
fCpnam[ilax-1]);
  5563             mnwarn(
"D", 
"MINOS", 
"NO COVARIANCE MATRIX.");
  5565       nlimit     = 
fNfcn + nfmxin;
  5568       fU[ilax-1] = ut + sig*du1;
  5571       delu = 
fU[ilax-1] - ut;
  5574       fac = delu / 
fMNOTw[it-1];
  5575       for (i = 1; i <= 
fNpar; ++i) {
  5579          Printf(
" PARAMETER %4d SET TO%11.3e + %10.3e = %12.3e",ilax,ut,delu,
fU[ilax-1]);
  5590       if (abest - 
fAmin > 
fUp*.01) 
goto L650;
  5591       if (iercr == 1) 
goto L440;
  5592       if (iercr == 2) 
goto L450;
  5593       if (iercr == 3) 
goto L460;
  5597          Printf(
"        THE %4sTIVE MINOS ERROR OF PARAMETER %3d  %10s, IS %12.4e"  5598                            ,(
const char*)csig,ilax
  5599                            ,(
const char*)
fCpnam[ilax-1],eros);
  5605          Printf(
"    THE %4sTIVE MINOS ERROR OF PARAMETER %3d, %s EXCEEDS ITS LIMIT."  5606                               ,(
const char*)csig,ilax
  5607                               ,(
const char*)
fCpnam[ilax-1]);
  5613          Printf(
"       THE %4sTIVE MINOS ERROR %4d REQUIRES MORE THAN %5d FUNCTION CALLS."  5614                          ,(
const char*)csig,ilax,nfmxin);
  5620          Printf(
"                         %4sTIVE MINOS ERROR NOT CALCULATED FOR PARAMETER %d"  5621                          ,(
const char*)csig,ilax);
  5627          Printf(
"     **************************************************************************");
  5631          if (ilax2 > 0 && ilax2 <= 
fNu) val2mi = 
fU[ilax2-1];
  5634          if (ilax2 > 0 && ilax2 <= 
fNu) val2pl = 
fU[ilax2-1];
  5641    i__1 = mpar*(mpar + 1) / 2;
  5643    for (i = 1; i <= mpar; ++i) {
  5692    Double_t vplu, a_small, gsmin, pinti, vminu, danger, sav, sav2;
  5693    Int_t ierr, kint, in, ix, ktofix, lastin, kinfix, nvl;
  5701       Printf(
" MINUIT USER ERROR.  PARAMETER NUMBER IS %3d  ALLOWED RANGE IS ONE TO %4d",k,fMaxext);
  5706    if (
fNvarl[k-1] < 0) 
goto L50;
  5709    for (ix = 1; ix <= 
fNpfix; ++ix) {
  5710       if (
fIpfix[ix-1] == k) ktofix = k;
  5713       mnwarn(
"W", 
"PARAM DEF", 
"REDEFINING A FIXED PARAMETER.");
  5715          Printf(
" CANNOT RELEASE. MAX NPAR EXCEEDED.");
  5726       Printf(
" PARAMETER DEFINITIONS:");
  5727       Printf(
"    NO.   NAME         VALUE      STEP SIZE      LIMITS");
  5730    if (wk > 0) 
goto L122;
  5733       Printf(
" %5d %-10s %13.5e  constant",k,(
const char*)cnamk,uk);
  5738    if (a == 0 && b == 0) {
  5742          Printf(
" %5d %-10s %13.5e%13.5e     no limits",k,(
const char*)cnamk,uk,wk);
  5749          Printf(
" %5d %-10s %13.5e%13.5e  %13.5e%13.5e",k,(
const char*)cnamk,uk,wk,a,b);
  5755       Printf(
" MINUIT USER ERROR.   TOO MANY VARIABLE PARAMETERS.");
  5758    if (nvl == 1) 
goto L200;
  5760       Printf(
" USER ERROR IN MINUIT PARAMETER");
  5762       Printf(
" UPPER AND LOWER LIMITS EQUAL.");
  5769       mnwarn(
"W", 
"PARAM DEF", 
"PARAMETER LIMITS WERE REVERSED.");
  5776    danger = (b - uk)*(uk - a);
  5778       mnwarn(
"W", 
"PARAM DEF", 
"STARTING VALUE OUTSIDE LIMITS.");
  5781       mnwarn(
"W", 
"PARAM DEF", 
"STARTING VALUE IS AT LIMIT.");
  5799    for (ix = 1; ix <= k-1; ++ix) { 
if (
fNiofex[ix-1] > 0) ++lastin; }
  5801    if (kint == 
fNpar) 
goto L280;
  5804       for (in = 
fNpar; in >= lastin + 1; --in) {
  5818       for (in = lastin + 1; in <= kint; ++in) {
  5841       mnpint(sav, ix-1, pinti);
  5843       fXt[in-1]   = 
fX[in-1];
  5846       mnpint(sav2, ix-1, pinti);
  5847       vplu = pinti - 
fX[in-1];
  5849       mnpint(sav2, ix-1, pinti);
  5850       vminu = pinti - fX[in-1];
  5869       if (kinfix > 0) 
mnfixp(kinfix-1, ierr);
  5870       if (ierr > 0)   
goto L800;
  5895    Int_t ierr, kapo1, kapo2;
  5896    Int_t k, llist, ibegin, lenbuf, istart, lnc, icy;
  5897    TString cnamk, comand, celmnt, ctemp;
  5900    lenbuf = strlen((
const char*)crdbuf);
  5902    kapo1 = strspn((
const char*)crdbuf, 
"'");
  5903    if (kapo1 == 0) 
goto L150;
  5904    kapo2 = strspn((
const char*)crdbuf + kapo1, 
"'");
  5905    if (kapo2 == 0) 
goto L150;
  5909    for (istart = 1; istart <= kapo1-1; ++istart) {
  5910       if (crdbuf(istart-1,1) != 
' ') 
goto L120;
  5915    celmnt = crdbuf(istart-1, kapo1-istart);
  5916    if (scanf((
const char*)celmnt,&fk)) {;}
  5918    if (k <= 0) 
goto L210;
  5919    cnamk = 
"PARAM " + celmnt;
  5920    if (kapo2 - kapo1 > 1) {
  5921       cnamk = crdbuf(kapo1, kapo2-1-kapo1);
  5924    for (icy = kapo2 + 1; icy <= lenbuf; ++icy) {
  5925       if (crdbuf(icy-1,1) == 
',') 
goto L139;
  5926       if (crdbuf(icy-1,1) != 
' ') 
goto L140;
  5937    ctemp = crdbuf(ibegin-1,lenbuf-ibegin);
  5939    if (ierr > 0) 
goto L180;
  5950    if (scanf((
const char*)crdbuf,&xk,stmp,&uk,&wk,&a,&
b)) {;}
  5953    if (k == 0)    
goto L210;
  5956    mnparm(k-1, cnamk, uk, wk, a, 
b, ierr);
  5983    Double_t a, 
f, s, t, 
y, s2, 
x2, 
x3, 
x4, y2, cz[3], xm, 
xy, x2y;
  5993    for (i = 1; i <= 3; ++i) { cz[i-1] = 0; }
  5995    if (npar2p < 3) 
goto L10;
  5999    for (i = 1; i <= npar2p; ++i) { xm += parx2p[i]; }
  6008    for (i = 1; i <= npar2p; ++i) {
  6020    a = (f*x4 - x2*
x2)*x2 - f*(x3*x3);
  6021    if (a == 0) 
goto L10;
  6022    cz[2] = (x2*(f*x2y - x2*
y) - f*x3*xy) / 
a;
  6023    cz[1] = (xy - x3*cz[2]) / x2;
  6024    cz[0] = (y - x2*cz[2]) / f;
  6025    if (npar2p == 3) 
goto L6;
  6026    sdev2p = y2 - (cz[0]*y + cz[1]*xy + cz[2]*x2y);
  6027    if (sdev2p < 0) sdev2p = 0;
  6030    cz[0] += xm*(xm*cz[2] - cz[1]);
  6031    cz[1] -= xm*2*cz[2];
  6033    for (i = 1; i <= 3; ++i) { coef2p[i] = cz[i-1]; }
  6055       yy = (pexti - alimi)*2 / (blimi - alimi) - 1;
  6060             chbuf2 = 
" IS AT ITS LOWER ALLOWED LIMIT.";
  6063             chbuf2 = 
" IS AT ITS UPPER ALLOWED LIMIT.";
  6066          pexti   = alimi + (blimi - alimi)*.5*(
TMath::Sin(a) + 1);
  6068          if (yy2 > 1) chbuf2 = 
" BROUGHT BACK INSIDE LIMITS.";
  6097       if ((h = 
gROOT->GetPluginManager()->FindHandler(
"TMinuitGraph"))) {
  6107    Double_t bwidx, bwidy, xbest, ybest, ax, ay, bx, by;
  6108    Double_t xvalus[12], any, dxx, dyy;
  6109    Int_t iten, i, j, k, maxnx, maxny, iquit, ni, linodd;
  6110    Int_t nxbest, nybest, km1, ibk, isp1, 
nx, 
ny, ks, ix;
  6119    if (maxnx < 10) maxnx = 10;
  6121    if (maxny < 10) maxny = 10;
  6122    if (nxypt <= 1) 
return;
  6128    for (i = 1; i <= km1; ++i) {
  6131       for (j = 1; j <= ni; ++j) {
  6132          if (ypt[j-1] > ypt[j]) 
continue;
  6144       if (iquit == 0) 
break;
  6149    for (i = 1; i <= nxypt; ++i) {
  6150       if (xpt[i-1] > xmax) xmax = xpt[i-1];
  6151       if (xpt[i-1] < xmin) xmin = xpt[i-1];
  6153    dxx   = (xmax - 
xmin)*.001;
  6156    mnbins(xmin, xmax, maxnx, xmin, xmax, nx, bwidx);
  6158    ymin = ypt[nxypt-1];
  6159    if (ymax == ymin) ymax = ymin + 1;
  6160    dyy   = (ymax - 
ymin)*.001;
  6163    mnbins(ymin, ymax, maxny, ymin, ymax, ny, bwidy);
  6166    if (chbest == 
' ') 
goto L50;
  6167    xbest = (xmax + 
xmin)*.5;
  6168    ybest = (ymax + 
ymin)*.5;
  6176    for (i = 1; i <= nxypt; ++i) {
  6177       xpt[i-1] = ax*xpt[i-1] + bx;
  6178       ypt[i-1] = any - ay*ypt[i-1] - by;
  6180    nxbest = 
Int_t((ax*xbest + bx));
  6181    nybest = 
Int_t((any - ay*ybest - by));
  6188    for (i = 1; i <= 
ny; ++i) {
  6189       for (ibk = 1; ibk <= 
nx; ++ibk) { cline[ibk-1] = 
' '; }
  6194       if (nx>0) cline[nx-1]     = 
'.';
  6195       cline[nxbest-1] = 
'.';
  6196       if (i != 1 && i != nybest && i != ny) 
goto L320;
  6197       for (j = 1; j <= 
nx; ++j) { cline[j-1] = 
'.'; }
  6200       if (isp1 > nxypt) 
goto L350;
  6202       for (k = isp1; k <= nxypt; ++k) {
  6203          ks = 
Int_t(ypt[k-1]);
  6204          if (ks > i) 
goto L345;
  6205          ix = 
Int_t(xpt[k-1]);
  6206          if (cline[ix-1] == 
'.')   
goto L340;
  6207          if (cline[ix-1] == 
' ') 
goto L340;
  6208          if (cline[ix-1] == chpt[k-1])   
continue;
  6215          cline[ix-1] = chpt[k-1];
  6222       if (linodd == 1 || i == ny) 
goto L380;
  6225       Printf(
"                  %s",(
const char*)ctemp);
  6229       Printf(
" %14.7g ..%s",yprt,(
const char*)ctemp);
  6235    for (ibk = 1; ibk <= 
nx; ++ibk) {
  6237       if (ibk % 10 == 1) cline[ibk-1] = 
'/';
  6241    for (ibk = 1; ibk <= 12; ++ibk) {
  6242       xvalus[ibk-1] = xmin + 
Double_t(ibk-1)*10*bwidx;
  6244    iten = (nx + 9) / 10;
  6245    for (ibk = 1; ibk <= iten && ibk <= 12; ++ibk) {
  6246       snprintf(cline + (ibk-1)*10, 11-(ibk == 12), 
"%#9.3g ", xvalus[ibk-1]);
  6250    if (overpr) chmess = 
"   Overprint character is &";
  6251    Printf(
"                         ONE COLUMN=%13.7g%s",bwidx,(
const char*)chmess);
  6274    Int_t iint, iext, nvl;
  6276    Int_t iuext = iuext1 + 1;
  6280    if (iuext == 0) 
goto L100;
  6284       if (iint > 
fNpar) 
goto L100;
  6290       if (iext > 
fNu) 
goto L100;
  6296    if (nvl < 0) 
goto L100;
  6299    if (iint > 0) err = 
fWerr[iint-1];
  6301       xlolim = 
fAlim[iext-1];
  6302       xuplim = 
fBlim[iext-1];
  6308    chnam = 
"undefined";
  6332    static const TString cblank = 
"           ";
  6338    Int_t nadd, i, k, 
l, 
m, ikode, ic, nc, ntrail, lbl;
  6340    TString colhdl[6], colhdu[6], cx2, cx3, cheval;
  6343       Printf(
" THERE ARE CURRENTLY NO PARAMETERS DEFINED");
  6349       ikode = 
fISW[1] + 1;
  6350       if (ikode > 3) ikode = 3;
  6353    for (k = 1; k <= 6; ++k) {
  6354       colhdu[k-1] = 
"UNDEFINED";
  6355       colhdl[k-1] = 
"COLUMN HEAD";
  6362    if (fval == 
fUndefi) cheval = 
" unknown       ";
  6363    else                 cheval.
Form(
"%g",fval);
  6369    Printf(
" FCN=%s FROM %8s  STATUS=%10s %6d CALLS   %9d TOTAL"  6370                ,(
const char*)cheval
  6374    if (m == 0 || m == 2 || 
fDcovar == 0) {
  6375       Printf(
"                     EDM=%s    STRATEGY=%2d      %s"  6381       Printf(
"                     EDM=%s    STRATEGY=%2d  ERROR MATRIX UNCERTAINTY %5.1f per cent"  6382                       ,(
const char*)chedm,
fIstrat,dc);
  6385    if (ikode == 0) 
return;
  6388    for (i = 1; i <= 
fNu; ++i) {
  6389       if (
fNvarl[i-1] < 0) 
continue;
  6390       for (ic = 10; ic >= 1; --ic) {
  6391          if (
fCpnam[i-1](ic-1,1) != 
" ") 
goto L16;
  6396       if (lbl < ntrail) ntrail = lbl;
  6398    nadd = ntrail / 2 + 1;
  6401       colhdl[0] = 
"      ERROR   ";
  6402       colhdu[1] = 
"      PHYSICAL";
  6403       colhdu[2] = 
" LIMITS       ";
  6404       colhdl[1] = 
"    NEGATIVE  ";
  6405       colhdl[2] = 
"    POSITIVE  ";
  6409       colhdl[0] = 
"      ERROR   ";
  6410       colhdu[1] = 
"    INTERNAL  ";
  6411       colhdl[1] = 
"    STEP SIZE ";
  6412       colhdu[2] = 
"    INTERNAL  ";
  6413       colhdl[2] = 
"      VALUE   ";
  6417       colhdl[0] = 
"      ERROR   ";
  6418       colhdu[1] = 
"       STEP   ";
  6419       colhdl[1] = 
"       SIZE   ";
  6420       colhdu[2] = 
"      FIRST   ";
  6421       colhdl[2] = 
"   DERIVATIVE ";
  6424       colhdu[0] = 
"    PARABOLIC ";
  6425       colhdl[0] = 
"      ERROR   ";
  6426       colhdu[1] = 
"        MINOS ";
  6427       colhdu[2] = 
"ERRORS        ";
  6428       colhdl[1] = 
"   NEGATIVE   ";
  6429       colhdl[2] = 
"   POSITIVE   ";
  6433       if (
fISW[1] < 3) colhdu[0] = 
"  APPROXIMATE ";
  6434       if (
fISW[1] < 1) colhdu[0] = 
" CURRENT GUESS";
  6436    Printf(
"  EXT PARAMETER              %-14s%-14s%-14s",(
const char*)colhdu[0]
  6437                                                     ,(
const char*)colhdu[1]
  6438                                                     ,(
const char*)colhdu[2]);
  6439    Printf(
"  NO.   NAME      VALUE      %-14s%-14s%-14s",(
const char*)colhdl[0]
  6440                                                     ,(
const char*)colhdl[1]
  6441                                                     ,(
const char*)colhdl[2]);
  6443    for (i = 1; i <= 
fNu; ++i) {
  6444       if (
fNvarl[i-1] < 0) 
continue;
  6446       cnambf = cblank(0,nadd) + 
fCpnam[i-1];
  6447       if (l == 0) 
goto L55;
  6450       cx2 = 
"PLEASE GET X..";
  6451       cx3 = 
"PLEASE GET X..";
  6454             Printf(
"%4d %-11s%14.5e%14.5e",i,(
const char*)cnambf,
fU[i-1],x1);
  6469             cx3 = 
"** at limit **";
  6474          if (x2 == 0)        cx2 = 
" ";
  6475          if (x2 == 
fUndefi)  cx2 = 
"   at limit   ";
  6477          if (x3 == 0)        cx3 = 
" ";
  6478          if (x3 == 
fUndefi)         cx3 = 
"   at limit   ";
  6480       if (cx2 == 
"PLEASE GET X..")  cx2.
Form(
"%14.5e",x2);
  6481       if (cx3 == 
"PLEASE GET X..")  cx3.
Form(
"%14.5e",x3);
  6482       Printf(
"%4d %-11s%14.5e%14.5e%-14s%-14s",i
  6483                    ,(
const char*)cnambf,
fU[i-1],x1
  6484                    ,(
const char*)cx2,(
const char*)cx3);
  6487       if (
fNvarl[i-1] <= 1 || ikode == 3) 
continue;
  6489          Printf(
"                                 WARNING -   - ABOVE PARAMETER IS AT LIMIT.");
  6495       colhdu[0] = 
"   constant   ";
  6496       if (
fNvarl[i-1] > 0)  colhdu[0] = 
"     fixed    ";
  6497       if (
fNvarl[i-1] == 4 && ikode == 1) {
  6498          Printf(
"%4d %-11s%14.5e%-14s%14.5e%14.5e",i
  6499               ,(
const char*)cnambf,
fU[i-1]
  6500               ,(
const char*)colhdu[0],
fAlim[i-1],
fBlim[i-1]);
  6502          Printf(
"%4d %-11s%14.5e%s",i
  6503                    ,(
const char*)cnambf,
fU[i-1],(
const char*)colhdu[0]);
  6521    Double_t dgmin, padd, pmin, pmax, dg, epspdf, epsmin;
  6522    Int_t ndex, i, j, ndexd, ip, ifault;
  6529    for (i = 1; i <= 
fNpar; ++i) {
  6530       ndex = i*(i + 1) / 2;
  6531       if (
fVhmat[ndex-1] <= 0) {
  6537       dg    = epspdf + 1 - dgmin;
  6543    for (i = 1; i <= 
fNpar; ++i) {
  6547       if (
fVhmat[ndexd-1]==0) {
  6552       for (j = 1; j <= i; ++j) {
  6561    for (ip = 2; ip <= 
fNpar; ++ip) {
  6567       Printf(
" EIGENVALUES OF SECOND-DERIVATIVE MATRIX:");
  6569       for (ip = 1; ip <= 
fNpar; ++ip) {
  6574    if (pmin > epspdf*pmax) 
return;
  6576    padd = pmax*.001 - pmin;
  6577    for (ip = 1; ip <= 
fNpar; ++ip) {
  6578       ndex = ip*(ip + 1) / 2;
  6579       fVhmat[ndex-1] *= padd + 1;
  6582    mnwarn(
"W", 
fCfrom, 
Form(
"MATRIX FORCED POS-DEF BY ADDING %f TO DIAGONAL.",padd));
  6602       for (i = 1; i <= 
fNpar; ++i) { 
fX[i-1] = pnew[i-1]; }
  6610    for (j = 2; j <= nparp1; ++j) { 
if (y[j-1] > y[jh-1]) jh = j; }
  6611    fEDM = y[jh-1] - y[jl-1];
  6612    if (
fEDM <= 0) 
goto L45;
  6613    for (i = 1; i <= 
fNpar; ++i) {
  6616       for (j = 2; j <= nparp1; ++j) {
  6620       fDirin[i-1] = pbig - plit;
  6625    Printf(
"  FUNCTION VALUE DOES NOT SEEM TO DEPEND ON ANY OF THE %d VARIABLE PARAMETERS.",
fNpar);
  6626    Printf(
"          VERIFY THAT STEP SIZES ARE BIG ENOUGH AND CHECK FCN LOGIC.");
  6627    Printf(
" *******************************************************************************");
  6628    Printf(
" *******************************************************************************");
  6645    static std::atomic<Int_t> g_iseed( 12345 );
  6651       g_iseed.store(inseed, std::memory_order_release);
  6655       int starting_seed = g_iseed.load( std::memory_order_acquire );
  6659          next_seed = inseed = starting_seed;
  6662          k      = next_seed / 53668;
  6663          next_seed  = (next_seed - k*53668)*40014 - k*12211;
  6664          if (next_seed < 0) next_seed += 2147483563;
  6671       } 
while (! g_iseed.compare_exchange_strong(starting_seed, next_seed) );
  6698    for (i = 1; i <= 
fNpar; ++i) {
  6719    Printf(
"mnsave is dummy in TMinuit");
  6733    Double_t step, uhigh, xhreq, xlreq, ubest, fnext, unext, xh, xl;
  6735    Int_t nxypt, nccall, iparwd;
  6740    if (ncall <= 1)  ncall = 41;
  6741    if (ncall > 98) ncall = 98;
  6747    if (iparwd > 0) 
goto L200;
  6752    if (ipar > 
fNu) 
goto L900;
  6754    if (iint <= 0) 
goto L100;
  6766    if (
fNvarl[ipar-1] > 1) 
goto L300;
  6769    if (xlreq == xhreq) 
goto L250;
  6771    step = (xhreq - xlreq) / 
Double_t(ncall-1);
  6774    xl = ubest - 
fWerr[iint-1];
  6775    xh = ubest + fWerr[iint-1];
  6776    mnbins(xl, xh, ncall, unext, uhigh, nbins, step);
  6781    if (xlreq == xhreq) 
goto L350;
  6786    if (xl >= xh) 
goto L700;
  6788    step  = (xh - xl) / 
Double_t(ncall-1);
  6791    unext = 
fAlim[ipar-1];
  6795    for (icall = 1; icall <= nccall; ++icall) {
  6800       fXpt[nxypt-1]  = unext;
  6801       fYpt[nxypt-1]  = fnext;
  6802       fChpt[nxypt-1] = 
'*';
  6803       if (fnext < 
fAmin) {
  6816    Printf(
"%dSCAN OF PARAMETER NO. %d,  %s"  6821    Printf(
" REQUESTED RANGE OUTSIDE LIMITS FOR PARAMETER  %d",ipar);
  6823    if (iparwd <= 0) 
goto L100;
  6843    Double_t dxdi, rnum, ftry, rnum1, rnum2, alpha;
  6845    Int_t ipar, iext, j, ifail, iseed=0, nparx, istep, ib, mxfail, mxstep;
  6848    if (mxfail <= 0) mxfail = 
fNpar*20 + 100;
  6852    if (alpha <= 0) alpha = 3;
  6854       Printf(
" MNSEEK: MONTE CARLO MINIMIZATION USING METROPOLIS ALGORITHM");
  6855       Printf(
" TO STOP AFTER %6d SUCCESSIVE FAILURES, OR %7d STEPS",mxfail,mxstep);
  6856       Printf(
" MAXIMUM STEP SIZE IS %9.3f ERROR BARS.",alpha);
  6868    for (ipar = 1; ipar <= 
fNpar; ++ipar) {
  6871       if (
fNvarl[iext-1] > 1) {
  6874          if (dxdi == 0) dxdi = 1;
  6875          fDirin[ipar-1] = alpha*2*fWerr[ipar-1] / dxdi;
  6877             fDirin[ipar-1] = 6.2831859999999997;
  6884    for (istep = 1; istep <= mxstep; ++istep) {
  6885       if (ifail >= mxfail) 
break;
  6886       for (ipar = 1; ipar <= 
fNpar; ++ipar) {
  6916       Printf(
" MNSEEK: %5d SUCCESSIVE UNSUCCESSFUL TRIALS.",ifail);
  6939    static const char *
const cname[30] = {
  6971    static constexpr 
Int_t nname = 25; 
  6972    static constexpr 
Int_t nntot = 
sizeof(cname)/
sizeof(
char*);
  6973    static const TString cprlev[5] = {
  6974       "-1: NO OUTPUT EXCEPT FROM SHOW    ",
  6975       " 0: REDUCED OUTPUT                ",
  6976       " 1: NORMAL OUTPUT                 ",
  6977       " 2: EXTRA OUTPUT FOR PROBLEM CASES",
  6978       " 3: MAXIMUM OUTPUT                "};
  6980    static const TString cstrat[3] = {
  6981       " 0: MINIMIZE THE NUMBER OF CALLS TO FUNCTION",
  6982       " 1: TRY TO BALANCE SPEED AGAINST RELIABILITY",
  6983       " 2: MAKE SURE MINIMUM TRUE, ERRORS CORRECT  "};
  6985    static const TString cdbopt[7] = {
  6986       "REPORT ALL EXCEPTIONAL CONDITIONS      ",
  6987       "MNLINE: LINE SEARCH MINIMIZATION       ",
  6988       "MNDERI: FIRST DERIVATIVE CALCULATIONS  ",
  6989       "MNHESS: SECOND DERIVATIVE CALCULATIONS ",
  6990       "MNMIGR: COVARIANCE MATRIX UPDATES      ",
  6991       "MNHES1: FIRST DERIVATIVE UNCERTAINTIES ",
  6992       "MNCONT: MNCONTOUR PLOT (MNCROS SEARCH) "};
  6999    Int_t iset, iprm, i, jseed, kname, iseed, iunit, 
id, ii, kk;
  7000    Int_t ikseed, idbopt, igrain=0, iswsav, isw2;
  7001    TString  cfname, cmode, ckind,  cwarn, copt, ctemp, ctemp2;
  7004    for (i = 1; i <= nntot; ++i) {
  7008       if (strstr(ctemp2.
Data(),ckind.
Data())) 
goto L5;
  7016    if ( ctemp2.
Contains(
"HEL"))  
goto L2000;
  7017    if ( ctemp2.
Contains(
"SHO"))  
goto L1000;
  7018    if (!ctemp2.
Contains(
"SET"))  
goto L1900;
  7022    if (kname <= 0) 
goto L1900;
  7024    switch ((
int)kname) {
  7042       case 18:  
goto L3000;
  7044       case 20:  
goto L3000;
  7049       case 25:  
goto L3000;
  7050       case 26:  
goto L1900;
  7060    if (iprm > 
fNu) 
goto L25;
  7061    if (iprm <= 0) 
goto L25;
  7062    if (
fNvarl[iprm-1] < 0) 
goto L25;
  7074    Printf(
" UNDEFINED PARAMETER NUMBER.  IGNORED.");
  7105    for (i = 1; i <= 
fNpar; ++i) {
  7133    mnwarn(
"W", 
"SHO", 
"SHO");
  7141       Printf(
" MINUIT RANDOM NUMBER SEED SET TO %d",jseed);
  7153    if (
fISW[4] > 0) 
goto L1172;
  7171    if (
fISW[4] >= 0) 
goto L1220;
  7176    if (
fISW[4] >= 0) 
goto L1100;
  7181    if (
fISW[4] >= 0) 
goto L1100;
  7192    if (idbopt > 6) 
goto L288;
  7194       fIdbg[idbopt] = iset;
  7195       if (iset == 1) 
fIdbg[0] = 1;
  7198       for (
id = 0; 
id <= 6; ++
id) { 
fIdbg[
id] = iset; }
  7201    mnwarn(
"D", 
"SHO", 
"SHO");
  7204    Printf(
" UNKNOWN DEBUG OPTION %d REQUESTED. IGNORED",idbopt);
  7215    if (kname <= 0) 
goto L1900;
  7217    switch ((
int)kname) {
  7227       case 10:  
goto L1100;
  7228       case 11:  
goto L1110;
  7229       case 12:  
goto L1120;
  7230       case 13:  
goto L1130;
  7231       case 14:  
goto L1130;
  7232       case 15:  
goto L1150;
  7233       case 16:  
goto L1160;
  7234       case 17:  
goto L1170;
  7235       case 18:  
goto L1180;
  7236       case 19:  
goto L1190;
  7237       case 20:  
goto L1200;
  7238       case 21:  
goto L1210;
  7239       case 22:  
goto L1220;
  7240       case 23:  
goto L1100;
  7241       case 24:  
goto L1100;
  7242       case 25:  
goto L1250;
  7243       case 26:  
goto L1900;
  7244       case 27:  
goto L1270;
  7245       case 28:  
goto L1270;
  7246       case 29:  
goto L1290;
  7247       case 30:  
goto L1300;
  7277    Printf(
" ALLOWED PRINT LEVELS ARE:");
  7283    Printf(
" CURRENT PRINTOUT LEVEL IS %s",cprlev[
fISW[4]+1].
Data());
  7288       Printf(
" NOGRAD IS SET.  DERIVATIVES NOT COMPUTED IN FCN.");
  7290       Printf(
"   GRAD IS SET.  USER COMPUTES DERIVATIVES IN FCN.");
  7295    Printf(
" ERRORS CORRESPOND TO FUNCTION CHANGE OF %g",
fUp);
  7319    cmode = 
"BATCH MODE      ";
  7320    if (
fISW[5] == 1) cmode  = 
"INTERACTIVE MODE";
  7321    if (! lname)      cfname = 
"unknown";
  7322    Printf(
" INPUT NOW BEING READ IN %s FROM UNIT NO. %d FILENAME: %s"  7323            ,(
const char*)cmode,
fIsysrd,(
const char*)cfname);
  7335    cwarn = 
"SUPPRESSED";
  7336    if (
fLwarn) cwarn = 
"REPORTED  ";
  7337    Printf(
"%s",(
const char*)cwarn);
  7345    Printf(
" MINUIT RNDM SEED IS CURRENTLY=%d",ikseed);
  7352    Printf(
" TITLE OF CURRENT TASK IS:%s",(
const char*)
fCtitl);
  7356    Printf(
" ALLOWED STRATEGIES ARE:");
  7361    Printf(
" NOW USING STRATEGY %s",(
const char*)cstrat[
fIstrat]);
  7378       Printf(
" NO PAGE THROWS IN MINUIT OUTPUT");
  7383    for (ii = 1; ii <= 
fNpar; ++ii) {
  7384       if (
fErp[ii-1] > 0 || 
fErn[ii-1] < 0) 
goto L1204;
  7386    Printf(
"       THERE ARE NO MINOS ERRORS CURRENTLY VALID.");
  7393    Printf(
" FLOATING-POINT NUMBERS ASSUMED ACCURATE TO %g",
fEpsmac);
  7401    Printf(
" THIS IS MINUIT VERSION:%s",(
const char*)
fCvrsn);
  7405    for (
id = 0; 
id <= 6; ++
id) {
  7407       if (
fIdbg[
id] >= 1) copt = 
"ON ";
  7408       Printf(
"          DEBUG OPTION %3d IS %3s :%s"  7409              ,
id,(
const char*)copt,(
const char*)cdbopt[
id]);
  7424    Printf(
" THE COMMAND:%10s IS UNKNOWN.",(
const char*)
fCword);
  7431    if (strcmp(ctemp2.
Data(), 
"SHO")) ckind = 
"SHOW";
  7433    Printf(
" THE FORMAT OF THE %4s COMMAND IS:",(
const char*)ckind);
  7434    Printf(
" %s xxx    [numerical arguments if any]",(
const char*)ckind);
  7435    Printf(
" WHERE xxx MAY BE ONE OF THE FOLLOWING:");
  7436    for (kk = 1; kk <= nname; ++kk) {
  7437       Printf(
" %s",cname[kk-1]);
  7443    Printf(
" ABOVE COMMAND IS ILLEGAL.   IGNORED");
  7457    static constexpr 
Double_t alpha = 1;
  7460    static constexpr 
Double_t rhomin = 4;
  7461    static constexpr 
Double_t rhomax = 8;
  7464    Double_t dmin_, dxdi, yrho, 
f, ynpp1, aming, ypbar;
  7465    Double_t bestx, ystar, y1, y2, ystst, pb, wg;
  7466    Double_t absmin, rho, sig2, rho1, rho2;
  7467    Int_t npfn, i, j, k, jhold, ncycl, nparx;
  7468    Int_t nparp1, kg, jh, nf, jl, ns;
  7470    if (
fNpar <= 0) 
return;
  7479    rho2    = rho1 + alpha*
gamma;
  7482       Printf(
" START SIMPLEX MINIMIZATION.    CONVERGENCE WHEN EDM .LT. %g",
fEpsi);
  7484    for (i = 1; i <= 
fNpar; ++i) {
  7497    for (i = 1; i <= 
fNpar; ++i) {
  7508       if (f <= aming) 
goto L6;
  7510       if (kg == 1) 
goto L8;
  7514       if (nf < 3) 
goto L4;
  7524       if (ns < 6) 
goto L4;
  7528       if (aming < absmin) jl = i;
  7529       if (aming < absmin) absmin = aming;
  7549    for (i = 1; i <= 
fNpar; ++i) {
  7557    if (ystar >= 
fAmin) 
goto L70;
  7559    for (i = 1; i <= 
fNpar; ++i) {
  7565    y1 = (ystar - 
fSIMPy[jh-1])*rho2;
  7566    y2 = (ystst - 
fSIMPy[jh-1])*rho1;
  7567    rho = (rho2*y1 - rho1*y2)*.5 / (y1 - y2);
  7568    if (rho < rhomin) 
goto L66;
  7569    if (rho > rhomax) rho = rhomax;
  7570    for (i = 1; i <= 
fNpar; ++i) {
  7575    if (yrho  < 
fSIMPy[jl-1] && yrho < ystst) 
goto L65;
  7576    if (ystst < 
fSIMPy[jl-1]) 
goto L67;
  7577    if (yrho  > 
fSIMPy[jl-1]) 
goto L66;
  7583    if (ystst < 
fSIMPy[jl-1]) 
goto L67;
  7590    if (
fISW[4] < 2) 
goto L50;
  7591    if (
fISW[4] >= 3 || ncycl % 10 == 0) {
  7597    if (ystar >= 
fSIMPy[jh-1]) 
goto L73;
  7600    if (jhold != jh) 
goto L50;
  7603    for (i = 1; i <= 
fNpar; ++i) {
  7608    if (ystst > 
fSIMPy[jh-1]) 
goto L1;
  7610    if (ystst < 
fAmin) 
goto L67;
  7616       Printf(
" SIMPLEX MINIMIZATION HAS CONVERGED.");
  7622       Printf(
" SIMPLEX TERMINATES WITHOUT CONVERGENCE.");
  7628    for (i = 1; i <= 
fNpar; ++i) {
  7696    static const TString cpt = 
" ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890./;:[]$%*_!@#&+()";
  7699    l       = strlen((
const char*)cfname);
  7700    for (i = 1; i <= 
l; ++i) {
  7701       for (ic = 1; ic <= 80; ++ic) {
  7702          if (cfname[i-1] == cpt[ic-1]) 
goto L100;
  7725    Int_t i, j, k, kp1, km1;
  7733    if (n < 1) 
goto L100;
  7736    for (i = 1; i <= 
n; ++i) {
  7738       if (si <= 0) 
goto L100;
  7741    for (i = 1; i <= 
n; ++i) {
  7742       for (j = 1; j <= 
n; ++j) {
  7747    for (i = 1; i <= 
n; ++i) {
  7750       if (a[k + k*l] != 0) 
fVERTq[k-1] = 1 / a[k + k*
l];
  7756       if (km1 < 0) 
goto L100;
  7757       else if (km1 == 0) 
goto L50;
  7760       for (j = 1; j <= km1; ++j) {
  7766       if (k - n < 0) 
goto L51;
  7767       else if (k - n == 0) 
goto L60;
  7770       for (j = kp1; j <= 
n; ++j) {
  7777       for (j = 1; j <= 
n; ++j) {
  7782    for (j = 1; j <= 
n; ++j) {
  7783       for (k = 1; k <= j; ++k) {
  7785          a[j + k*
l] = a[k + j*
l];
  7812    const Int_t kMAXMES = 10;
  7813    Int_t ityp, i, ic, nm;
  7816    if (corg(0,3) != 
"SHO" || cmes(0,3) != 
"SHO") {
  7822             Printf(
" MINUIT WARNING IN %s",(
const char*)corg);
  7823             Printf(
" ============== %s",(
const char*)cmes);
  7829             Printf(
" MINUIT DEBUG FOR %s",(
const char*)corg);
  7830             Printf(
" =============== %s ",(
const char*)cmes);
  7855       englsh = 
" WAS SUPPRESSED.  ";
  7856       if (
fNwrmes[ityp-1] > 1) englsh = 
"S WERE SUPPRESSED.";
  7858              ,(
const char*)ctyp,(
const char*)englsh);
  7862          Printf(
" ONLY THE MOST RECENT 10 WILL BE LISTED BELOW.");
  7866       Printf(
"  CALLS  ORIGIN         MESSAGE");
  7867       for (i = 1; i <= nm; ++i) {
  7869          if (ic > kMAXMES) ic = 1;
  7885    Double_t denom, ba, al, dx, du1, du2;
  7886    Int_t ndex, ierr, i, j, k, 
l, ndiag, k1, iin;
  7890       for (l = 1; l <= 
fNpar; ++
l) {
  7891          ndex = l*(l + 1) / 2;
  7896             ba = 
fBlim[i-1] - al;
  7899             if (dx > 1) du1 = ba;
  7907       for (i = 1; i <= 
fNpar; ++i) {
  7910          for (j = 1; j <= i; ++j) {
  7918          for (iin = 1; iin <= 
fNpar; ++iin) {
  7919             ndiag = iin*(iin + 1) / 2;
  7921             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 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 analysed 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 GetNumFixedPars() const
returns the number of currently fixed parameters 
 
virtual Int_t SetPrintLevel(Int_t printLevel=0)
set Minuit print level. 
 
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 Fred James. 
 
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. 
 
virtual void mntiny(volatile Double_t epsp1, Double_t &epsbak)
To find the machine precision. 
 
virtual Int_t GetParameter(Int_t parNo, Double_t ¤tValue, Double_t ¤tError) const
return parameter value and error 
 
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
 
double beta(double x, double y)
Calculates the beta function. 
 
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: 
 
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. 
 
virtual void mnmigr()
Performs a local function minimization. 
 
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 Int_t GetNumFreePars() const
returns the number of currently free parameters 
 
virtual ~TMinuit()
Minuit default destructor. 
 
static const double x4[22]
 
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 void BuildArrays(Int_t maxpar=15)
Create internal Minuit arrays for the maxpar parameters. 
 
Method or function calling interface. 
 
virtual void mnmnot(Int_t ilax, Int_t ilax2, Double_t &val2pl, Double_t &val2mi)
Performs a MINOS error analysis on one parameter. 
 
virtual void mnpout(Int_t iuext, TString &chnam, Double_t &val, Double_t &err, Double_t &xlolim, Double_t &xuplim, Int_t &iuint) const
Provides the user with information concerning the current status. 
 
virtual Int_t 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 void mnfixp(Int_t iint, Int_t &ierr)
Removes parameter IINT from the internal parameter list. 
 
Long_t ExecPlugin(int nargs, const T &... params)
 
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. 
 
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message. 
 
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 * fMethodCall
 
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. 
 
#define R__LOCKGUARD2(mutex)
 
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. 
 
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 
 
TMethodCall * GetMethodCall() const
 
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. 
 
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
 
virtual void SetFCN(void *fcn) R__DEPRECATED(6
To set the address of the minimization function. 
 
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
 
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 TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility. 
 
virtual Int_t Command(const char *command)
Execute a Minuit command. 
 
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) 
 
static const char charal[29]
 
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)
 
virtual void mnmatu(Int_t kode)
Prints the covariance matrix v when KODE=1. 
 
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
 
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 TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility. 
 
Double_t Sqrt(Double_t x)
 
virtual Int_t GetNumPars() const
returns the total number of parameters that have been defined as fixed or free. 
 
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message. 
 
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]
 
const char * Data() const
 
virtual void mnwerr()
Calculates the WERR, external parameter errors.