# class TFumili: public TVirtualFitter

         FUMILI
Based on ideas, proposed by I.N. Silin
[See NIM A440, 2000 (p431)]
converted from FORTRAN to C  by
Sergey Yaschenko <s.yaschenko@fz-juelich.de>



## FUMILI minimization package

FUMILI is used to minimize Chi-square function or to search maximum of likelihood function.

Experimentally measured values $F_i$ are fitted with theoretical functions $f_i({\vec x}_i,\vec\theta\,\,)$, where ${\vec x}_i$ are coordinates, and $\vec\theta$ -- vector of parameters.

For better convergence Chi-square function has to be the following form

$${\chi^2\over2}={1\over2}\sum^n_{i=1}\left(f_i(\vec x_i,\vec\theta\,\,)-F_i\over\sigma_i\right)^2 \eqno(1)$$

where $\sigma_i$ are errors of measured function.

The minimum condition is

$${\partial\chi^2\over\partial\theta_i}=\sum^n_{j=1}{1\over\sigma^2_j}\cdot {\partial f_j\over\partial\theta_i}\left[f_j(\vec x_j,\vec\theta\,\,)-F_j\right]=0,\qquad i=1\ldots m\eqno(2)$$

where m is the quantity of parameters.

Expanding left part of (2) over parameter increments and retaining only linear terms one gets

$$\left(\partial\chi^2\over\theta_i\right)_{\vec\theta={\vec\theta}^0} +\sum_k\left(\partial^2\chi^2\over\partial\theta_i\partial\theta_k\right)_{ \vec\theta={\vec\theta}^0}\cdot(\theta_k-\theta_k^0) = 0\eqno(3)$$

Here ${\vec\theta}_0$ is some initial value of parameters. In general case:

$${\partial^2\chi^2\over\partial\theta_i\partial\theta_k}= \sum^n_{j=1}{1\over\sigma^2_j}{\partial f_j\over\theta_i} {\partial f_j\over\theta_k} + \sum^n_{j=1}{(f_j - F_j)\over\sigma^2_j}\cdot {\partial^2f_j\over\partial\theta_i\partial\theta_k}\eqno(4)$$

In FUMILI algorithm for second derivatives of Chi-square approximate expression is used when last term in (4) is discarded. It is often done, not always wittingly, and sometimes causes troubles, for example, if user wants to limit parameters with positive values by writing down $\theta_i^2$ instead of $\theta_i$. FUMILI will fail if one tries minimize $\chi^2 = g^2(\vec\theta)$ where g is arbitrary function.

Approximate value is:

$${\partial^2\chi^2\over\partial\theta_i\partial\theta_k}\approx Z_{ik}= \sum^n_{j=1}{1\over\sigma^2_j}{\partial f_j\over\theta_i} {\partial f_j\over\theta_k}\eqno(5)$$

Then the equations for parameter increments are

$$\left(\partial\chi^2\over\partial\theta_i\right)_{\vec\theta={\vec\theta}^0} +\sum_k Z_{ik}\cdot(\theta_k-\theta^0_k) = 0, \qquad i=1\ldots m\eqno(6)$$

Remarkable feature of algorithm is the technique for step restriction. For an initial value of parameter ${\vec\theta}^0$ a parallelepiped $P_0$ is built with the center at ${\vec\theta}^0$ and axes parallel to coordinate axes $\theta_i$. The lengths of parallelepiped sides along i-th axis is $2b_i$, where $b_i$ is such a value that the functions $f_j(\vec\theta)$ are quasi-linear all over the parallelepiped.

FUMILI takes into account simple linear inequalities in the form: $$\theta_i^{\rm min}\le\theta_i\le\theta^{\rm max}_i\eqno(7)$$

They form parallelepiped $P$ ($P_0$ may be deformed by $P$). Very similar step formulae are used in FUMILI for negative logarithm of the likelihood function with the same idea - linearization of function argument.




## Function Members (Methods)

public:
 virtual ~TFumili() void TObject::AbstractMethod(const char* method) const virtual void TObject::AppendPad(Option_t* option = "") virtual void TObject::Browse(TBrowser* b) void BuildArrays() virtual Double_t Chisquare(Int_t npar, Double_t* params) const static TClass* Class() virtual const char* TObject::ClassName() const virtual void Clear(Option_t* opt = "") virtual TObject* TNamed::Clone(const char* newname = "") const virtual Int_t TNamed::Compare(const TObject* obj) const virtual void TNamed::Copy(TObject& named) const virtual void TObject::Delete(Option_t* option = "")MENU void DeleteArrays() void Derivatives(Double_t*, Double_t*) virtual Int_t TObject::DistancetoPrimitive(Int_t px, Int_t py) virtual void TObject::Draw(Option_t* option = "") virtual void TObject::DrawClass() constMENU virtual TObject* TObject::DrawClone(Option_t* option = "") constMENU virtual void TObject::Dump() constMENU virtual void TObject::Error(const char* method, const char* msgfmt) const Int_t Eval(Int_t& npar, Double_t* grad, Double_t& fval, Double_t* par, Int_t flag) Double_t EvalTFN(Double_t*, Double_t*) virtual void TObject::Execute(const char* method, const char* params, Int_t* error = 0) virtual void TObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0) virtual Int_t ExecuteCommand(const char* command, Double_t* args, Int_t nargs) virtual void TObject::ExecuteEvent(Int_t event, Int_t px, Int_t py) Int_t ExecuteSetCommand(Int_t) virtual void TObject::Fatal(const char* method, const char* msgfmt) const virtual void TNamed::FillBuffer(char*& buffer) virtual TObject* TObject::FindObject(const char* name) const virtual TObject* TObject::FindObject(const TObject* obj) const virtual void FitChisquare(Int_t& npar, Double_t* gin, Double_t& f, Double_t* u, Int_t flag) virtual void FitChisquareI(Int_t& npar, Double_t* gin, Double_t& f, Double_t* u, Int_t flag) virtual void FitLikelihood(Int_t& npar, Double_t* gin, Double_t& f, Double_t* u, Int_t flag) virtual void FitLikelihoodI(Int_t& npar, Double_t* gin, Double_t& f, Double_t* u, Int_t flag) static TVirtualFitter* TVirtualFitter::Fitter(TObject* obj, Int_t maxpar = 25) virtual void FixParameter(Int_t ipar) virtual void TVirtualFitter::GetConfidenceIntervals(TObject* obj, Double_t cl = 0.94999999999999996) virtual void TVirtualFitter::GetConfidenceIntervals(Int_t n, Int_t ndim, const Double_t* x, Double_t* ci, Double_t cl = 0.94999999999999996) virtual Double_t* GetCovarianceMatrix() const virtual Double_t GetCovarianceMatrixElement(Int_t i, Int_t j) const static const char* TVirtualFitter::GetDefaultFitter() virtual Option_t* TObject::GetDrawOption() const static Long_t TObject::GetDtorOnly() static Double_t TVirtualFitter::GetErrorDef() virtual Int_t GetErrors(Int_t ipar, Double_t& eplus, Double_t& eminus, Double_t& eparab, Double_t& globcc) const virtual TVirtualFitter::FCNFunc_t TVirtualFitter::GetFCN() virtual Foption_t TVirtualFitter::GetFitOption() const static TVirtualFitter* TVirtualFitter::GetFitter() virtual const char* TObject::GetIconName() const static Int_t TVirtualFitter::GetMaxIterations() TMethodCall* TVirtualFitter::GetMethodCall() const virtual const char* TNamed::GetName() const virtual Int_t GetNumberFreeParameters() const virtual Int_t GetNumberTotalParameters() const virtual TObject* TVirtualFitter::GetObjectFit() const virtual char* TObject::GetObjectInfo(Int_t px, Int_t py) const static Bool_t TObject::GetObjectStat() virtual Option_t* TObject::GetOption() const virtual Double_t GetParameter(Int_t ipar) const virtual Int_t GetParameter(Int_t ipar, char* name, Double_t& value, Double_t& verr, Double_t& vlow, Double_t& vhigh) const virtual Double_t GetParError(Int_t ipar) const virtual const char* GetParName(Int_t ipar) const Double_t* GetPL0() const static Double_t TVirtualFitter::GetPrecision() virtual Int_t GetStats(Double_t& amin, Double_t& edm, Double_t& errdef, Int_t& nvpar, Int_t& nparx) const virtual Double_t GetSumLog(Int_t) virtual const char* TNamed::GetTitle() const virtual UInt_t TObject::GetUniqueID() const virtual TObject* TVirtualFitter::GetUserFunc() const virtual Int_t TVirtualFitter::GetXfirst() const virtual Int_t TVirtualFitter::GetXlast() const virtual Int_t TVirtualFitter::GetYfirst() const virtual Int_t TVirtualFitter::GetYlast() const Double_t* GetZ() const virtual Int_t TVirtualFitter::GetZfirst() const virtual Int_t TVirtualFitter::GetZlast() const virtual Bool_t TObject::HandleTimer(TTimer* timer) virtual ULong_t TNamed::Hash() const virtual void TObject::Info(const char* method, const char* msgfmt) const virtual Bool_t TObject::InheritsFrom(const char* classname) const virtual Bool_t TObject::InheritsFrom(const TClass* cl) const virtual void TObject::Inspect() constMENU void TObject::InvertBit(UInt_t f) void InvertZ(Int_t) virtual TClass* IsA() const virtual Bool_t TObject::IsEqual(const TObject* obj) const virtual Bool_t IsFixed(Int_t ipar) const virtual Bool_t TObject::IsFolder() const Bool_t TObject::IsOnHeap() const virtual Bool_t TNamed::IsSortable() const Bool_t TObject::IsZombie() const virtual void TNamed::ls(Option_t* option = "") const void TObject::MayNotUse(const char* method) const Int_t Minimize() virtual Bool_t TObject::Notify() void TObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const void TObject::operator delete(void* ptr) void TObject::operator delete(void* ptr, void* vp) void TObject::operator delete[](void* ptr) void TObject::operator delete[](void* ptr, void* vp) void* TObject::operator new(size_t sz) void* TObject::operator new(size_t sz, void* vp) void* TObject::operator new[](size_t sz) void* TObject::operator new[](size_t sz, void* vp) TFumili& operator=(const TFumili&) virtual void TObject::Paint(Option_t* option = "") virtual void TObject::Pop() virtual void TNamed::Print(Option_t* option = "") const virtual void PrintResults(Int_t k, Double_t p) const virtual Int_t TObject::Read(const char* name) virtual void TObject::RecursiveRemove(TObject* obj) virtual void ReleaseParameter(Int_t ipar) void TObject::ResetBit(UInt_t f) virtual void TObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU virtual void TObject::SavePrimitive(ostream& out, Option_t* option = "") void TObject::SetBit(UInt_t f) void TObject::SetBit(UInt_t f, Bool_t set) virtual Double_t* TVirtualFitter::SetCache(Int_t npoints, Int_t psize) void SetData(Double_t*, Int_t, Int_t) static void TVirtualFitter::SetDefaultFitter(const char* name = "") virtual void TObject::SetDrawOption(Option_t* option = "")MENU static void TObject::SetDtorOnly(void* obj) static void TVirtualFitter::SetErrorDef(Double_t errdef = 1) virtual void TVirtualFitter::SetFCN(void* fcn) virtual void TVirtualFitter::SetFCN(void(*)(Int_t&,Double_t*,Double_t&,Double_t*,Int_t) fcn) virtual void SetFitMethod(const char* name) virtual void TVirtualFitter::SetFitOption(Foption_t option) static void TVirtualFitter::SetFitter(TVirtualFitter* fitter, Int_t maxpar = 25) static void TVirtualFitter::SetMaxIterations(Int_t niter = 5000) virtual void TNamed::SetName(const char* name)MENU virtual void TNamed::SetNameTitle(const char* name, const char* title) virtual void TVirtualFitter::SetObjectFit(TObject* obj) static void TObject::SetObjectStat(Bool_t stat) virtual Int_t SetParameter(Int_t ipar, const char* parname, Double_t value, Double_t verr, Double_t vlow, Double_t vhigh) void SetParNumber(Int_t ParNum) static void TVirtualFitter::SetPrecision(Double_t prec = 9.9999999999999995E-7) virtual void TNamed::SetTitle(const char* title = "")MENU virtual void TObject::SetUniqueID(UInt_t uid) virtual void TVirtualFitter::SetUserFunc(TObject* userfunc) virtual void TVirtualFitter::SetXfirst(Int_t first) virtual void TVirtualFitter::SetXlast(Int_t last) virtual void TVirtualFitter::SetYfirst(Int_t first) virtual void TVirtualFitter::SetYlast(Int_t last) virtual void TVirtualFitter::SetZfirst(Int_t first) virtual void TVirtualFitter::SetZlast(Int_t last) Int_t SGZ() virtual void ShowMembers(TMemberInspector& insp) const virtual Int_t TNamed::Sizeof() const virtual void Streamer(TBuffer&) void StreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b) virtual void TObject::SysError(const char* method, const char* msgfmt) const Bool_t TObject::TestBit(UInt_t f) const Int_t TObject::TestBits(UInt_t f) const TFumili(Int_t maxpar = 25) TFumili(const TFumili&) virtual void TObject::UseCurrentStyle() virtual void TObject::Warning(const char* method, const char* msgfmt) const virtual Int_t TObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) virtual Int_t TObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
protected:
 virtual void TObject::DoError(int level, const char* location, const char* fmt, va_list va) const void TObject::MakeZombie()

## Data Members

public:
 static TObject::(anonymous) TObject::kBitMask static TObject::EStatusBits TObject::kCanDelete static TObject::EStatusBits TObject::kCannotPick static TObject::EStatusBits TObject::kHasUUID static TObject::EStatusBits TObject::kInvalidObject static TObject::(anonymous) TObject::kIsOnHeap static TObject::EStatusBits TObject::kIsReferenced static TObject::EStatusBits TObject::kMustCleanup static TObject::EStatusBits TObject::kNoContextMenu static TObject::(anonymous) TObject::kNotDeleted static TObject::EStatusBits TObject::kObjInCanvas static TObject::(anonymous) TObject::kOverwrite static TObject::(anonymous) TObject::kSingleKey static TObject::(anonymous) TObject::kWriteDelete static TObject::(anonymous) TObject::kZombie
protected:
 Double_t* TVirtualFitter::fCache [fCacheSize] array of points data (fNpoints*fPointSize < fCacheSize words) Int_t TVirtualFitter::fCacheSize Size of the fCache array void(*)(Int_t&,Double_t*,Double_t&,Double_t*,Int_t) TVirtualFitter::fFCN TMethodCall* TVirtualFitter::fMethodCall Pointer to MethodCall in case of interpreted function TString TNamed::fName object identifier Int_t TVirtualFitter::fNpoints Number of points to fit TObject* TVirtualFitter::fObjectFit pointer to object being fitted Foption_t TVirtualFitter::fOption struct with the fit options Int_t TVirtualFitter::fPointSize Number of words per point in the cache TString TNamed::fTitle object title TObject* TVirtualFitter::fUserFunc pointer to user theoretical function (a TF1*) Int_t TVirtualFitter::fXfirst first bin on X axis Int_t TVirtualFitter::fXlast last bin on X axis Int_t TVirtualFitter::fYfirst first bin on Y axis Int_t TVirtualFitter::fYlast last bin on Y axis Int_t TVirtualFitter::fZfirst first bin on Z axis Int_t TVirtualFitter::fZlast last bin on Z axis static TString TVirtualFitter::fgDefault name of the default fitter ("Minuit","Fumili",etc) static Double_t TVirtualFitter::fgErrorDef Error definition (default=1) static TVirtualFitter* TVirtualFitter::fgFitter Current fitter (default TFitter) static Int_t TVirtualFitter::fgMaxiter Maximum number of iterations static Int_t TVirtualFitter::fgMaxpar Maximum number of fit parameters for current fitter static Double_t TVirtualFitter::fgPrecision maximum precision
private:
 Double_t* fA [fMaxParam] Fit parameter array Double_t fAKAPPA Double_t* fAMN [fMaxParam] Minimum param value Double_t* fAMX [fMaxParam] Maximum param value TString* fANames [fMaxParam] Parameter names Double_t* fCmPar [fMaxParam] parameters of commands TString fCword Command string Double_t* fDA [fMaxParam] Parameter step Bool_t fDEBUG debug info Double_t* fDF [fMaxParam] // First derivatives of theoretical function Int_t fENDFLG End flag of fit Double_t fEPS fEPS - required precision of parameters. If fEPS<0 then Double_t* fEXDA [fNED12] experimental data poInt_ter Bool_t fGRAD user calculated gradients Double_t fGT Expected function change in next iteration Double_t* fGr [fMaxParam] Gradients of objective function Int_t fINDFLG[5] internal flags; Int_t fLastFixed Last fixed parameter number Bool_t fLogLike LogLikelihood flag Int_t fMaxParam Int_t fNED1 Number of experimental vectors X=(x1,x2,...xK) Int_t fNED12 fNED1+fNED2 Int_t fNED2 K - Length of vector X plus 2 (for chi2) Int_t fNfcn Number of FCN calls; Int_t fNlimMul fNlimMul - after fNlimMul successful iterations permits four-fold increasing of fPL Int_t fNlog Int_t fNmaxIter fNmaxIter - maximum number of iterations Int_t fNpar fNpar - number of parameters Int_t fNstepDec fNstepDec - maximum number of step decreasing counter Bool_t fNumericDerivatives Double_t* fPL [fMaxParam] Limits for parameters step. If <0, then parameter is fixed Double_t* fPL0 [fMaxParam] Step initial bounds Double_t* fParamError [fMaxParam] Parameter errors Double_t* fR [fMaxParam] Correlation factors Double_t fRP Precision of fit ( machine zero on CDC 6000) quite old yeh? Double_t fS fS - objective function value (return) Double_t* fSumLog [fNlog] Bool_t fWARN warnings Double_t* fZ [fMaxParam2] Invers fZ0 matrix - covariance matrix Double_t* fZ0 [fMaxParam2] Matrix of approximate second derivatives of objective function

## Function documentation

TFumili(Int_t maxpar = 25)
 maxpar is the maximum number of parameters used with TFumili object


void BuildArrays()
   Allocates memory for internal arrays. Called by TFumili::TFumili


~TFumili()
 TFumili destructor


Double_t Chisquare(Int_t npar, Double_t* params) const
 return a chisquare equivalent

void Clear(Option_t* opt = "")
 Resets all parameter names, values and errors to zero

Argument opt is ignored

NB: this procedure doesn't reset parameter limits


void DeleteArrays()
 Deallocates memory. Called from destructor TFumili::~TFumili


void Derivatives(Double_t* , Double_t* )
 Calculates partial derivatives of theoretical function

Input:
fX  - vector of data point
Output:
DF - array of derivatives

ARITHM.F
Converted from CERNLIB


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
par:     array of (constant and variable) parameters
flag:    Indicates what is to be calculated
grad:    array of gradients
Output parameters:
fval:    The calculated function value.
grad:    The vector of first derivatives.

The meaning of the parameters par is of course defined by the user,
who uses the values of those parameters to calculate their function value.
The starting values must be specified by the user.

Inside FCN user has to define Z-matrix by means TFumili::GetZ
and TFumili::Derivatives,
set theoretical function by means of TFumili::SetUserFunc,
but first - pass number of parameters by TFumili::SetParNumber

Later values are determined by Fumili as it searches for the minimum
or performs whatever analysis is requested by the user.

The default function calls the function specified in SetFCN



 Evaluate theoretical function
df: array of partial derivatives
X:  vector of theoretical function argument

Int_t ExecuteCommand(const char* command, Double_t* args, Int_t nargs)
  Execute MINUIT commands. MINImize, SIMplex, MIGrad and FUMili all
will call TFumili::Minimize method.

For full command list see
MINUIT. Reference Manual. CERN Program Library Long Writeup D506.

Improvement and errors calculation are not yet implemented as well
as Monte-Carlo seeking and minimization.
Contour commands are also unsupported.

command   : command string
args      : array of arguments
nargs     : number of arguments



 Called from TFumili::ExecuteCommand in case
of "SET xxx" and "SHOW xxx".


void FixParameter(Int_t ipar)
 Fixes parameter number ipar

Double_t * GetCovarianceMatrix() const
 return a pointer to the covariance matrix

Double_t GetCovarianceMatrixElement(Int_t i, Int_t j) const
 return element i,j from the covariance matrix

Int_t GetNumberTotalParameters() const
 return the total number of parameters (free + fixed)

Int_t GetNumberFreeParameters() const
 return the number of free parameters

Double_t GetParError(Int_t ipar) const
 return error of parameter ipar

Double_t GetParameter(Int_t ipar) const
 return current value of parameter ipar

Int_t GetParameter(Int_t ipar, char* name, Double_t& value, Double_t& verr, Double_t& vlow, Double_t& vhigh) const
 Get various ipar parameter attributs:

cname:    parameter name
value:    parameter value
verr:     parameter error
vlow:     lower limit
vhigh:    upper limit
WARNING! parname must be suitably dimensionned in the calling function.

const char * GetParName(Int_t ipar) const
 return name of parameter ipar

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

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    : number of variable parameters
nparx    : total number of parameters


 return Sum(log(i) i=0,n
used by log likelihood fits

void InvertZ(Int_t )
 Inverts packed diagonal matrix Z by square-root method.
Matrix elements corresponding to
fix parameters are removed.

n: number of variable parameters


Bool_t IsFixed(Int_t ipar) const
return kTRUE if parameter ipar is fixed, kFALSE othersise)


*
FUMILI
Based on ideas, proposed by I.N. Silin
[See NIM A440, 2000 (p431)]
converted from FORTRAN to C  by
Sergey Yaschenko <s.yaschenko@fz-juelich.de>

*

This function is called after setting theoretical function
by means of TFumili::SetUserFunc and initializing parameters.
Optionally one can set FCN function (see TFumili::SetFCN and TFumili::Eval)
If FCN is undefined then user has to provide data arrays by calling
TFumili::SetData procedure.

TFumili::Minimize return following values:
0  - fit is converged
-2  - function is not decreasing (or bad derivatives)
-3  - error estimations are infinite
-4  - maximum number of iterations is exceeded


void PrintResults(Int_t k, Double_t p) const
 Prints fit results.

ikode is the type of printing parameters
p is function value

ikode = 1   - print values, errors and limits
ikode = 2   - print values, errors and steps
ikode = 3   - print values, errors, steps and derivatives
ikode = 4   - print only values and errors


void ReleaseParameter(Int_t ipar)
 Releases parameter number ipar

void SetData(Double_t* , Int_t , Int_t )
 Sets pointer to data array provided by user.
Necessary if SetFCN is not called.

numpoints:    number of experimental points
vecsize:      size of data point vector + 2
(for N-dimensional fit vecsize=N+2)
exdata:       data array with following format

exdata[0] = ExpValue_0     - experimental data value number 0
exdata[1] = ExpSigma_0     - error of value number 0
exdata[2] = X_0[0]
exdata[3] = X_0[1]

exdata[vecsize-1] = X_0[vecsize-3]
exdata[vecsize]   = ExpValue_1
exdata[vecsize+1] = ExpSigma_1
exdata[vecsize+2] = X_1[0]

exdata[vecsize*(numpoints-1)] = ExpValue_(numpoints-1)

exdata[vecsize*numpoints-1] = X_(numpoints-1)[vecsize-3]


void SetFitMethod(const char* name)
 ret fit method (chisquare or loglikelihood)

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 vlow and vhigh
If vlow = vhigh but not equil to zero, parameter will be fixed.
If vlow = vhigh = 0, parameter is released and its limits are discarded


Int_t SGZ()
  Evaluates objective function ( chi-square ), gradients and
Z-matrix using data provided by user via TFumili::SetData


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 of bin)
for each point the cache contains the following info
-1D : bc,e,xc  (bin content, error, x of center of bin)
-2D : bc,e,xc,yc
-3D : bc,e,xc,yc,zc

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 the cache contains the following info
-1D : bc,e,xc,xw  (bin content, error, x of center of bin, x bin width of bin)
-2D : bc,e,xc,xw,yc,yw
-3D : bc,e,xc,xw,yc,yw,zc,zw

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 by determining the Poisson
probability that given a number of entries in a particular bin,
the fit would predict it's value.  This is then done for each bin,
and the sum of the logs is taken as the likelihood.
Default method (function evaluated at center of bin)
for each point the cache contains the following info
-1D : bc,e,xc  (bin content, error, x of center of bin)
-2D : bc,e,xc,yc
-3D : bc,e,xc,yc,zc

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 by determining the Poisson
probability that given a number of entries in a particular bin,
the fit would predict it's value.  This is then done for each bin,
and the sum of the logs is taken as the likelihood.
The "I"ntegral method is used
for each point the cache contains the following info
-1D : bc,e,xc,xw  (bin content, error, x of center of bin, x bin width of bin)
-2D : bc,e,xc,xw,yc,yw
-3D : bc,e,xc,xw,yc,yw,zc,zw

TFumili(Int_t maxpar = 25)
  TF1 *fTFNF1;         //Pointer to theoretical function
void (*fFCN) (Int_t &, Double_t *, Double_t &f, Double_t *, Int_t);
//wrapper function to calculate functional value, gradients and Z-matrix
Double_t (*fTFN)(Double_t *, Double_t *, Double_t*); // Wrapper function for TFN

Double_t* GetPL0() const
{ return fPL0;}
Double_t* GetZ() const
{ return fZ;}
void SetParNumber(Int_t ParNum)
{ fNpar = ParNum;}