162    for (
int i = 0; i<5; ++i) 
fINDFLG[i] = 0;
   166    gROOT->GetListOfSpecials()->Add(gFumili);
   215       gROOT->GetListOfSpecials()->Remove(
this);
   216    if (gFumili == 
this) gFumili = 0;
   311                if (
fAMN[i]-ai+hi<0) { 
   354    if (
fFCN) (*fFCN)(npar,grad,fval,
par,flag);
   396    static TString clower = 
"abcdefghijklmnopqrstuvwxyz";
   397    static TString cupper = 
"ABCDEFGHIJKLMNOPQRSTUVWXYZ";
   398    const Int_t nntot = 40;
   399    const char *cname[nntot] = {
   444    if (nargs<=0) 
fCmPar[0] = 0;
   447       if(i<nargs) 
fCmPar[i] = args[i];
   459    for (ind = 0; ind < nntot; ++ind) {
   460       if (strncmp(ctemp.
Data(),cname[ind],3) == 0) 
break;
   462    if (ind==nntot) 
return -3; 
   463    if (
fCword(0,4) == 
"MINO") ind=3;
   465       case 0:  
case 3: 
case 2: 
case 28:
   487          if (nargs<1) 
return -1; 
   488          for (i=0;i<nargs;i++) {
   494          if (nargs<1) 
return 0;
   496             for (i=0;i<
fNpar;i++)
   505          if (nargs<1) 
return -1; 
   506          for (i=0;i<nargs;i++) {
   519          Printf(
"SAVe command is obsolete");
   524          {
if(nargs<1) 
return -1;
   545       case 26:   
case 27:  
case 29:  
case 30:  
case 31:  
case 32:
   547       case 33:   
case 34:   
case 35:  
case 36:   
case 37:  
case 38:
   549          Printf(
"Obsolete command. Use corresponding SET command instead");
   566    static Int_t nntot = 30;
   567    static const char *cname[30] = {
   599    TString  cfname, cmode, ckind,  cwarn, copt, ctemp, ctemp2;
   602    for (ind = 0; ind < nntot; ++ind) {
   606       if (strstr(ctemp2.
Data(),ckind.
Data())) 
break;
   609    if(ctemp2.
Contains(
"SET")) setCommand=
true;
   612    if (ind>=nntot) 
return -3;
   616          if(!setCommand) 
Printf(
"FCN=%f",
fS);
   620          if (nargs<2 && setCommand) 
return -1;
   626             if(parnum<0 || parnum>=
fNpar) 
return -2; 
   631                if(parnum<0 || parnum>=
fNpar) 
return -2; 
   634                for (i=0;i<
fNpar;i++)
   650                   Printf(
"Limits for param %s: Low=%E, High=%E",
   654             if(parnum<0 || parnum>=
fNpar)
return -1;
   659                   if(uplim==lolim) 
return -1;
   669                fAMN[parnum] = lolim;
   670                fAMX[parnum] = uplim;
   672                Printf(
"Limits for param %s Low=%E, High=%E",
   679          if(setCommand) 
return 0;
   680          Printf(
"\nCovariant matrix ");
   682          for (i=0;i<fNpar;i++) if(fPL0[i]>0.) 
nn++;
   684             for(;
fPL0[nnn]<=0.;nnn++) { }
   686             for (
Int_t j=0;j<=i;j++)
   687                printf(
"%11.2E",
fZ[l++]);
   688             std::cout<<std::endl;
   690          std::cout<<std::endl;
   694          if(setCommand) 
return 0;
   695          Printf(
"\nGlobal correlation factors (maximum correlation of the parameter\n  with arbitrary linear combination of other parameters)");
   696          for(i=0;i<
fNpar;i++) {
   700          std::cout<<std::endl;
   705          if(!setCommand) 
return 0;
   709          if(!setCommand) 
return 0;
   721          if(!setCommand) 
return 0;
   725          if(!setCommand) 
return 0;
   742             Printf(
"Relative floating point presicion RP=%E",
fRP);
   746                if (pres<1e-5 && pres>1
e-34) 
fRP=pres;
   756          if(setCommand) 
return 0;
   757          Printf(
"FUMILI-ROOT version 0.1");
   762          if(!setCommand) 
return 0;
   766          if(!setCommand) 
return 0;
   782    if(ipar>=0 && ipar<
fNpar && 
fPL0[ipar]>0.) {
   803    if (i < 0 || i >= 
fNpar || j < 0 || j >= 
fNpar) {
   804       Error(
"GetCovarianceMatrixElement",
"Illegal arguments i=%d, j=%d",i,j);
   836    if (ipar<0 || ipar>=
fNpar) 
return 0;
   845    if (ipar<0 || ipar>=
fNpar) 
return 0;
   846    else return fA[ipar];
   862    if (ipar<0 || ipar>=
fNpar) {
   882    if (ipar < 0 || ipar > 
fNpar) 
return "";
   894    if (ipar<0 || ipar>=
fNpar) {
   920       if(
fPL0[ii]>0.) nvpar++;
   966    Int_t i, k, 
l, ii, ki, li, kk, ni, ll, nk, nl, ir, lk;
   975    ap = 1.0e0 / (aps * aps);
   977    for (i = 1; i <= 
n; ++i) {
   980          if (pl_1[ir] <= 0.0e0) 
goto L1;
   983          ni = i * (i - 1) / 2;
   986          if (z_1[ii] <= rp * 
TMath::Abs(r_1[ir]) || z_1[ii] <= ap) {
   989          z_1[ii] = 1.0e0 / 
sqrt(z_1[ii]);
   992          if (nl - ni <= 0) 
goto L5;
  1002          if (i - n >= 0) 
goto L12;
  1006          nk = k * (k - 1) / 2;
  1009          d = z_1[kk] * z_1[ii];
  1015          z_1[ll] -= z_1[li] * 
c;
  1018          if (l - i <= 0) 
goto L9;
  1023          z_1[ll] -= z_1[li] * d;
  1026          if (l <= 0) 
goto L10;
  1030          if (k - i - 1 <= 0) 
goto L11;
  1036       for (i = 1; i <= 
n; ++i) {
  1037          for (k = i; k <= 
n; ++k) {
  1038             nl = k * (k - 1) / 2;
  1041             for (l = k; l <= 
n; ++
l) {
  1044                d += z_1[li] * z_1[lk];
  1047             ki = k * (k - 1) / 2 + i;
  1056       for (i = 1; i <= k; ++i) {
  1059             if (pl_1[ir] <= 0.0e0) {
  1078    if(ipar < 0 || ipar >= 
fNpar) {
  1079       Warning(
"IsFixed",
"Illegal parameter number :%d",ipar);
  1123    for( i = 0; i < 
fNpar; i++) {
  1128    Int_t nn2, 
n, fixFLG,  ifix1, fi, nn3, nn1, n0;
  1152    for( i=0; i < 
n; i++) {
  1169    for( i = 0; i < 
n; i++) {
  1182    for( i=0; i < nn0; i++) 
fZ[i]=0.;
  1194    if(!ijkl) 
return 10;
  1201    for( i=0; i < nn0; i++) 
fZ0[i] = 
fZ[i];
  1206             if (TMath::Abs(
fS-olds) <= sp && -
fGT <= sp) 
goto L19;
  1207             if(        0.59*t < -fGT) 
goto L19;
  1209             if (t < 0.25 ) t = 0.25;
  1215          for( i = 0; i < 
n; i++) {
  1232       printf(
"trying to execute an illegal junp at L85\n");
  1243    for( i = 0; i < 
n; i++) {
  1250             if ((
fA[i] >= 
fAMX[i] && 
fGr[i] < 0.) ||
  1257                for( j=0; j <= i; j++) {
  1262                         fZ[k2 -1] = 
fZ0[k1 -1];
  1278    for( i = 0; i < 
n; i++) {
  1294       fixFLG = fixFLG + 1;
  1301    for( i = 0; i < 
n; i++) {
  1305          for( l = 0; l < 
n; l++) {
  1309                if (i1 <= l1 ) k=l1*(l1-1)/2+i1;
  1310                else k=i1*(i1-1)/2+l1;
  1325    for( i = 0; i < 
n; i++)
  1349       fixFLG = fixFLG + 1;
  1363    for( i = 0; i < 
n; i++) {
  1366          abi = fA[i] + 
fPL[i]; 
  1369             bm = fA[i] - 
fAMN[i];
  1370             abi = fA[i] - fPL[i]; 
  1381          if ( TMath::Abs(
fDA[i]) > bi) {
  1399    if (alambd > .0) amb = 0.25/alambd;
  1400    for( i = 0; i < 
n; i++) {
  1403             if (TMath::Abs(
fDA[i]/
fPL[i]) > amb ) {
  1418    if (-
fGT <= sp && t1 < 1. && alambd < 1.)
fENDFLG = -1; 
  1472       for ( i = 0; i < 
n; i++) 
fA[i] = 
fA[i] + 
fDA[i];
  1473       if (imax >= 0) 
fA[imax] = aiMAX;
  1483          if( 
fPL0[ip] > .0) {
  1484             for( 
Int_t jp = 0; jp <= ip; jp++) {
  1513    TString colhdu[3],colhdl[3],cx2,cx3;
  1516       exitStatus=
"CONVERGED";
  1519       exitStatus=
"CONST FCN";
  1520       xsexpl=
"****\n* FUNCTION IS NOT DECREASING OR BAD DERIVATIVES\n****";
  1523       exitStatus=
"ERRORS INF";
  1524       xsexpl=
"****\n* ESTIMATED ERRORS ARE INfiNITE\n****";
  1527       exitStatus=
"MAX ITER.";
  1528       xsexpl=
"****\n* MAXIMUM NUMBER OF ITERATIONS IS EXCEEDED\n****";
  1531       exitStatus=
"ZERO PROBAB";
  1532       xsexpl=
"****\n* PROBABILITY OF LIKLIHOOD FUNCTION IS NEGATIVE OR ZERO\n****";
  1535       exitStatus=
"UNDEfiNED";
  1536       xsexpl=
"****\n* fiT IS IN PROGRESS\n****";
  1541       colhdl[0] = 
"      ERROR   ";
  1542       colhdu[1] = 
"      PHYSICAL";
  1543       colhdu[2] = 
" LIMITS       ";
  1544       colhdl[1] = 
"    NEGATIVE  ";
  1545       colhdl[2] = 
"    POSITIVE  ";
  1549       colhdl[0] = 
"      ERROR   ";
  1550       colhdu[1] = 
"    INTERNAL  ";
  1551       colhdl[1] = 
"    STEP SIZE ";
  1552       colhdu[2] = 
"    INTERNAL  ";
  1553       colhdl[2] = 
"      VALUE   ";
  1557       colhdl[0] = 
"      ERROR   ";
  1558       colhdu[1] = 
"       STEP   ";
  1559       colhdl[1] = 
"       SIZE   ";
  1560       colhdu[2] = 
"       fiRST  ";
  1561       colhdl[2] = 
"    DERIVATIVE";
  1564       colhdu[0] = 
"    PARABOLIC ";
  1565       colhdl[0] = 
"      ERROR   ";
  1566       colhdu[1] = 
"        MINOS ";
  1567       colhdu[2] = 
"ERRORS        ";
  1568       colhdl[1] = 
"   NEGATIVE   ";
  1569       colhdl[2] = 
"   POSITIVE   ";
  1572    Printf(
" FCN=%g FROM FUMILI  STATUS=%-10s %9d CALLS OF FCN",
  1575    Printf(
"  EXT PARAMETER              %-14s%-14s%-14s",
  1576          (
const char*)colhdu[0].
Data()
  1577          ,(
const char*)colhdu[1].
Data()
  1578          ,(
const char*)colhdu[2].
Data());
  1579    Printf(
"  NO.   NAME          VALUE  %-14s%-14s%-14s",
  1580          (
const char*)colhdl[0].
Data()
  1581          ,(
const char*)colhdl[1].
Data()
  1582          ,(
const char*)colhdl[2].
Data());
  1596          cx3 = 
Form(
"%14.5e",
fA[i]);
  1599          cx2 = 
" *undefined*  ";
  1600          cx3 = 
" *undefined*  ";
  1602       if(
fPL0[i]<=0.) { cx2=
"    *fixed*   ";cx3=
""; }
  1603       Printf(
"%4d %-11s%14.5e%14.5e%-14s%-14s",i+1
  1614    if(ipar>=0 && ipar<
fNpar && 
fPL0[ipar]<=0.) {
  1673    if (ipar<0 || ipar>=
fNpar) 
return -1;
  1705    Int_t i,j,
l,k2=1,k1,ki=0;
  1709    for (l=0;l<
fNED1;l++) { 
  1738          y = y - 
fEXDA[k1-1]; 
  1739          fS = 
fS + (y*y/(sig*sig))*.5; 
  1742       for (i=0;i<
fNpar;i++) {
  1745             fGr[i] += df[
n]*(y/sig);
  1752             fZ[l++] += df[i]*df[j];
  1789    if(flag == 9) 
return;
  1800       if (nd > 2) x[2]     = cache[4];
  1801       if (nd > 1) x[1]     = cache[3];
  1812          for (j=0;j<npar;j++) {
  1816                gin[j] += df[
n]*fsum;
  1822             for (
Int_t k=0;k<=j;k++)
  1823                zik[l++] += df[j]*df[k];
  1857    if(flag == 9) 
return;
  1871          fu = f1->
Integral(cache[2] - 0.5*cache[3],cache[2] + 0.5*cache[3])/cache[3];
  1872       } 
else if (nd < 3) {
  1873          fu = ((
TF2*)f1)->Integral(cache[2] - 0.5*cache[3],cache[2] + 0.5*cache[3],cache[4] - 0.5*cache[5],cache[4] + 0.5*cache[5])/(cache[3]*cache[5]);
  1875          fu = ((
TF3*)f1)->Integral(cache[2] - 0.5*cache[3],cache[2] + 0.5*cache[3],cache[4] - 0.5*cache[5],cache[4] + 0.5*cache[5],cache[6] - 0.5*cache[7],cache[6] + 0.5*cache[7])/(cache[3]*cache[5]*cache[7]);
  1883          for (j=0;j<npar;j++) {
  1887                gin[j] += df[
n]*fsum;
  1893             for (
Int_t k=0;k<=j;k++)
  1894                zik[l++] += df[j]*df[k];
  1938    if(flag == 9) 
return;
  1940    if (flag == 2) 
for (j=0;j<npar;j++) dersum[j] = gin[j] = 0;
  1947       if (nd > 2) x[2] = cache[4];
  1948       if (nd > 1) x[1] = cache[3];
  1955          for (j=0;j<npar;j++) {
  1960       if (fu < 1.
e-9) fu = 1.e-9;
  1969       for (j=0;j<npar;j++) {
  1971             df[
n]   = df[j]*(icu/fu-1);
  1980          for (
Int_t k=0;k<=j;k++)
  1981             zik[l++] += df[j]*df[k];
  2023    if(flag == 9) {
delete [] df; 
return;}
  2024    if (flag == 2) 
for (j=0;j<npar;j++) dersum[j] = gin[j] = 0;
  2031       if (nd > 2) x[2] = cache[4];
  2032       if (nd > 1) x[1] = cache[3];
  2037          fu = f1->
Integral(cache[2] - 0.5*cache[3],cache[2] + 0.5*cache[3])/cache[3];
  2038       } 
else if (nd < 3) {
  2039          fu = ((
TF2*)f1)->Integral(cache[2] - 0.5*cache[3],cache[2] + 0.5*cache[3],cache[4] - 0.5*cache[5],cache[4] + 0.5*cache[5])/(cache[3]*cache[5]);
  2041          fu = ((
TF3*)f1)->Integral(cache[2] - 0.5*cache[3],cache[2] + 0.5*cache[3],cache[4] - 0.5*cache[5],cache[4] + 0.5*cache[5],cache[6] - 0.5*cache[7],cache[6] + 0.5*cache[7])/(cache[3]*cache[5]*cache[7]);
  2045          for (j=0;j<npar;j++) {
  2050       if (fu < 1.
e-9) fu = 1.e-9;
  2059       for (j=0;j<npar;j++) {
  2061             df[
n]   = df[j]*(icu/fu-1);
  2070          for (
Int_t k=0;k<=j;k++)
  2071             zik[l++] += df[j]*df[k];
  2154    Int_t i, bin, npfits=0;
  2168    if(flag == 9) 
return;
  2176    for (bin=0;bin<
n;bin++) {
  2191          if (exl < 0) exl = 0;
  2192          if (exh < 0) exh = 0;
  2194          if (exh > 0 && exl > 0) {
  2196             eux = 0.5*(exl + exh)*f1->
Derivative(x[0], u);
  2200          if (eu <= 0) eu = 1;
  2205       fsum = (fu-cu)/eusq;
  2206       for (i=0;i<npar;i++) {
  2210             gin[i] += df[
n]*fsum;
  2216          for (
Int_t j=0;j<=i;j++)
  2217             zik[l++] += df[i]*df[j];
 
virtual Int_t GetStats(Double_t &amin, Double_t &edm, Double_t &errdef, Int_t &nvpar, Int_t &nparx) const
return global fit parameters amin : chisquare edm : estimated distance to minimum errdef nvpar : numb...
 
virtual Double_t Chisquare(Int_t npar, Double_t *params) const
return a chisquare equivalent 
 
virtual void SetParameters(const Double_t *params)
 
virtual Double_t * GetCovarianceMatrix() const
return a pointer to the covariance matrix 
 
virtual Double_t GetErrorY(Int_t bin) const
This function is called by GraphFitChisquare. 
 
virtual Double_t GetCovarianceMatrixElement(Int_t i, Int_t j) const
return element i,j from the covariance matrix 
 
Int_t Eval(Int_t &npar, Double_t *grad, Double_t &fval, Double_t *par, Int_t flag)
Evaluate the minimisation function Input parameters: npar: number of currently variable parameters pa...
 
virtual void FixParameter(Int_t ipar)
Fixes parameter number ipar. 
 
virtual void SetName(const char *name)
Set the name of the TNamed. 
 
virtual Double_t GetParameter(Int_t ipar) const
return current value of parameter ipar 
 
void ToUpper()
Change string to upper case. 
 
virtual Int_t GetNumberTotalParameters() const
return the total number of parameters (free + fixed) 
 
virtual void SetNumberFitPoints(Int_t npfits)
 
virtual void PrintResults(Int_t k, Double_t p) const
Prints fit results. 
 
Double_t * GetPL0() const
 
virtual Double_t Integral(Double_t a, Double_t b, Double_t epsrel=1.e-12)
IntegralOneDim or analytical integral. 
 
Bool_t fNumericDerivatives
 
virtual Double_t Derivative(Double_t x, Double_t *params=0, Double_t epsilon=0.001) const
Returns the first derivative of the function at point x, computed by Richardson's extrapolation metho...
 
virtual Int_t SetParameter(Int_t ipar, const char *parname, Double_t value, Double_t verr, Double_t vlow, Double_t vhigh)
Sets for prameter number ipar initial parameter value, name parname, initial error verr and limits vl...
 
virtual Int_t GetDimension() const
 
void InvertZ(Int_t)
Inverts packed diagonal matrix Z by square-root method. 
 
void H1FitChisquareFumili(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag)
Minimization function for H1s using a Chisquare method 
 
virtual const char * GetParName(Int_t ipar) const
return name of parameter ipar 
 
void BuildArrays()
Allocates memory for internal arrays. 
 
static const Double_t gMINDOUBLE
 
std::vector< std::vector< double > > Data
 
virtual Int_t GetErrors(Int_t ipar, Double_t &eplus, Double_t &eminus, Double_t &eparab, Double_t &globcc) const
Return errors after MINOs not implemented. 
 
virtual void SetFCN(void *fcn) R__DEPRECATED(6
To set the address of the minimization objective function. 
 
you should not use this method at all Int_t Int_t Double_t bm
 
Double_t EvalTFN(Double_t *, Double_t *)
Evaluate theoretical function df: array of partial derivatives X: vector of theoretical function argu...
 
virtual Double_t GetParError(Int_t ipar) const
return error of parameter ipar 
 
virtual Foption_t GetFitOption() const
 
virtual Double_t GetErrorXlow(Int_t bin) const
This function is called by GraphFitChisquare. 
 
Int_t ExecuteSetCommand(Int_t)
Called from TFumili::ExecuteCommand in case of "SET xxx" and "SHOW xxx". 
 
if object ctor succeeded but object should not be used 
 
A 3-Dim function with parameters. 
 
static const Double_t gMAXDOUBLE
 
void H1FitLikelihoodFumili(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag)
-*-*-*-*Minimization function for H1s using a Likelihood method*-*-*-*-*-* Basically, it forms the likelihood by determining the Poisson probability that given a number of entries in a particular bin, the fit would predict it's value. 
 
void DeleteArrays()
Deallocates memory. 
 
virtual Bool_t IsFixed(Int_t ipar) const
return kTRUE if parameter ipar is fixed, kFALSE othersise) 
 
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message. 
 
char * Form(const char *fmt,...)
 
static TVirtualFitter * GetFitter()
static: return the current Fitter 
 
static void RejectPoint(Bool_t reject=kTRUE)
Static function to set the global flag to reject points the fgRejectPoint global flag is tested by al...
 
virtual Int_t GetNumberFreeParameters() const
return the number of free parameters 
 
A 2-Dim function with parameters. 
 
virtual Int_t ExecuteCommand(const char *command, Double_t *args, Int_t nargs)
Execute MINUIT commands. 
 
virtual void SetFitMethod(const char *name)
ret fit method (chisquare or loglikelihood) 
 
virtual void FitChisquareI(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag)
Minimization function for H1s using a Chisquare method The "I"ntegral method is used for each point t...
 
virtual void FitLikelihoodI(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag)
Minimization function for H1s using a Likelihood method*-*-*-*-*-* Basically, it forms the likelihood...
 
virtual ~TFumili()
TFumili destructor. 
 
void Derivatives(Double_t *, Double_t *)
Calculates partial derivatives of theoretical function. 
 
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
 
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
 
virtual void FitChisquare(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag)
Minimization function for H1s using a Chisquare method Default method (function evaluated at center o...
 
virtual void InitArgs(const Double_t *x, const Double_t *params)
Initialize parameters addresses. 
 
virtual Bool_t IsInside(const Double_t *x) const
return kTRUE if the point is inside the function range 
 
virtual Int_t GetNpar() const
 
virtual void ReleaseParameter(Int_t ipar)
Releases parameter number ipar. 
 
static Bool_t RejectedPoint()
See TF1::RejectPoint above. 
 
virtual Double_t GetSumLog(Int_t)
return Sum(log(i) i=0,n used by log likelihood fits 
 
Short_t Max(Short_t a, Short_t b)
 
A Graph is a graphics object made of two arrays X and Y with npoints each. 
 
void SetData(Double_t *, Int_t, Int_t)
Sets pointer to data array provided by user. 
 
void(* fFCN)(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag)
 
virtual void Clear(Option_t *opt="")
Resets all parameter names, values and errors to zero. 
 
float type_of_call hi(const int &, const int &)
 
void SetParNumber(Int_t ParNum)
 
virtual void FitLikelihood(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag)
Minimization function for H1s using a Likelihood method*-*-*-*-*-* Basically, it forms the likelihood...
 
Double_t Sqrt(Double_t x)
 
virtual Double_t EvalPar(const Double_t *x, const Double_t *params=0)
Evaluate function with given coordinates and parameters. 
 
void GraphFitChisquareFumili(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag)
-*-*-*-*-*Minimization function for Graphs using a Chisquare method-*-*-*-* *-* =====================...
 
virtual TObject * GetUserFunc() const
 
virtual TObject * GetObjectFit() const
 
virtual Double_t GetErrorXhigh(Int_t bin) const
This function is called by GraphFitChisquare. 
 
Int_t SGZ()
Evaluates objective function ( chi-square ), gradients and Z-matrix using data provided by user via T...
 
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message. 
 
const char * Data() const