ROOT logo
ROOT » MATH » FUMILI » TFumili

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:
TFumili(Int_t maxpar = 25)
TFumili(const TFumili&)
virtual~TFumili()
voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTObject::Browse(TBrowser* b)
voidBuildArrays()
virtual Double_tChisquare(Int_t npar, Double_t* params) const
virtual Double_tTVirtualFitter::Chisquare(Int_t npar, Double_t* params) const
static TClass*Class()
static TClass*TVirtualFitter::Class()
static TClass*TNamed::Class()
static TClass*TObject::Class()
virtual const char*TObject::ClassName() const
virtual voidClear(Option_t* opt = "")
virtual voidTVirtualFitter::Clear(Option_t* option = "")
virtual voidTNamed::Clear(Option_t* option = "")
virtual voidTObject::Clear(Option_t* = "")
virtual TObject*TNamed::Clone(const char* newname = "") const
virtual Int_tTNamed::Compare(const TObject* obj) const
virtual Int_tTObject::Compare(const TObject* obj) const
virtual voidTNamed::Copy(TObject& named) const
virtual voidTObject::Copy(TObject& object) const
virtual voidTObject::Delete(Option_t* option = "")MENU
voidDeleteArrays()
voidDerivatives(Double_t*, Double_t*)
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
Int_tEval(Int_t& npar, Double_t* grad, Double_t& fval, Double_t* par, Int_t flag)
Double_tEvalTFN(Double_t*, Double_t*)
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual Int_tExecuteCommand(const char* command, Double_t* args, Int_t nargs)
virtual Int_tTVirtualFitter::ExecuteCommand(const char* command, Double_t* args, Int_t nargs)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
Int_tExecuteSetCommand(Int_t)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual voidTNamed::FillBuffer(char*& buffer)
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
virtual voidFitChisquare(Int_t& npar, Double_t* gin, Double_t& f, Double_t* u, Int_t flag)
virtual voidFitChisquareI(Int_t& npar, Double_t* gin, Double_t& f, Double_t* u, Int_t flag)
virtual voidFitLikelihood(Int_t& npar, Double_t* gin, Double_t& f, Double_t* u, Int_t flag)
virtual voidFitLikelihoodI(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 voidFixParameter(Int_t ipar)
virtual voidTVirtualFitter::FixParameter(Int_t ipar)
virtual voidTVirtualFitter::GetConfidenceIntervals(TObject* obj, Double_t cl = 0.95)
virtual voidTVirtualFitter::GetConfidenceIntervals(Int_t n, Int_t ndim, const Double_t* x, Double_t* ci, Double_t cl = 0.95)
virtual Double_t*GetCovarianceMatrix() const
virtual Double_t*TVirtualFitter::GetCovarianceMatrix() const
virtual Double_tGetCovarianceMatrixElement(Int_t i, Int_t j) const
virtual Double_tTVirtualFitter::GetCovarianceMatrixElement(Int_t i, Int_t j) const
static const char*TVirtualFitter::GetDefaultFitter()
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
static Double_tTVirtualFitter::GetErrorDef()
virtual Int_tGetErrors(Int_t ipar, Double_t& eplus, Double_t& eminus, Double_t& eparab, Double_t& globcc) const
virtual Int_tTVirtualFitter::GetErrors(Int_t ipar, Double_t& eplus, Double_t& eminus, Double_t& eparab, Double_t& globcc) const
virtual TVirtualFitter::FCNFunc_tTVirtualFitter::GetFCN()
virtual Foption_tTVirtualFitter::GetFitOption() const
static TVirtualFitter*TVirtualFitter::GetFitter()
virtual const char*TObject::GetIconName() const
static Int_tTVirtualFitter::GetMaxIterations()
TMethodCall*TVirtualFitter::GetMethodCall() const
virtual const char*TNamed::GetName() const
virtual const char*TObject::GetName() const
virtual Int_tGetNumberFreeParameters() const
virtual Int_tTVirtualFitter::GetNumberFreeParameters() const
virtual Int_tGetNumberTotalParameters() const
virtual TObject*TVirtualFitter::GetObjectFit() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
virtual Double_tGetParameter(Int_t ipar) const
virtual Int_tGetParameter(Int_t ipar, char* name, Double_t& value, Double_t& verr, Double_t& vlow, Double_t& vhigh) const
virtual Double_tGetParError(Int_t ipar) const
virtual Double_tTVirtualFitter::GetParError(Int_t ipar) const
virtual const char*GetParName(Int_t ipar) const
virtual const char*TVirtualFitter::GetParName(Int_t ipar) const
Double_t*GetPL0() const
static Double_tTVirtualFitter::GetPrecision()
virtual Int_tGetStats(Double_t& amin, Double_t& edm, Double_t& errdef, Int_t& nvpar, Int_t& nparx) const
virtual Int_tTVirtualFitter::GetStats(Double_t& amin, Double_t& edm, Double_t& errdef, Int_t& nvpar, Int_t& nparx) const
virtual Double_tGetSumLog(Int_t)
virtual Double_tTVirtualFitter::GetSumLog(Int_t i)
virtual const char*TNamed::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
virtual TObject*TVirtualFitter::GetUserFunc() const
virtual Int_tTVirtualFitter::GetXfirst() const
virtual Int_tTVirtualFitter::GetXlast() const
virtual Int_tTVirtualFitter::GetYfirst() const
virtual Int_tTVirtualFitter::GetYlast() const
Double_t*GetZ() const
virtual Int_tTVirtualFitter::GetZfirst() const
virtual Int_tTVirtualFitter::GetZlast() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTNamed::Hash() const
virtual ULong_tTObject::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() constMENU
voidTObject::InvertBit(UInt_t f)
voidInvertZ(Int_t)
virtual TClass*IsA() const
virtual TClass*TVirtualFitter::IsA() const
virtual TClass*TNamed::IsA() const
virtual TClass*TObject::IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tIsFixed(Int_t ipar) const
virtual Bool_tTVirtualFitter::IsFixed(Int_t ipar) const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTNamed::IsSortable() const
virtual Bool_tTObject::IsSortable() const
Bool_tTObject::IsZombie() const
virtual voidTNamed::ls(Option_t* option = "") const
virtual voidTObject::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
Int_tMinimize()
virtual Bool_tTObject::Notify()
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::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)
TNamed&TNamed::operator=(const TNamed& rhs)
TObject&TObject::operator=(const TObject& rhs)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidTNamed::Print(Option_t* option = "") const
virtual voidTObject::Print(Option_t* option = "") const
virtual voidPrintResults(Int_t k, Double_t p) const
virtual voidTVirtualFitter::PrintResults(Int_t level, Double_t amin) const
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
virtual voidReleaseParameter(Int_t ipar)
virtual voidTVirtualFitter::ReleaseParameter(Int_t ipar)
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTObject::SavePrimitive(basic_ostream<char,char_traits<char> >& out, Option_t* option = "")
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
virtual Double_t*TVirtualFitter::SetCache(Int_t npoints, Int_t psize)
voidSetData(Double_t*, Int_t, Int_t)
static voidTVirtualFitter::SetDefaultFitter(const char* name = "")
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
static voidTVirtualFitter::SetErrorDef(Double_t errdef = 1)
virtual voidTVirtualFitter::SetFCN(void* fcn)
virtual voidTVirtualFitter::SetFCN(void (*)(Int_t&, Double_t*, Double_t&f, Double_t*, Int_t) fcn)
virtual voidSetFitMethod(const char* name)
virtual voidTVirtualFitter::SetFitMethod(const char* name)
virtual voidTVirtualFitter::SetFitOption(Foption_t option)
static voidTVirtualFitter::SetFitter(TVirtualFitter* fitter, Int_t maxpar = 25)
static voidTVirtualFitter::SetMaxIterations(Int_t niter = 5000)
virtual voidTNamed::SetName(const char* name)MENU
virtual voidTNamed::SetNameTitle(const char* name, const char* title)
virtual voidTVirtualFitter::SetObjectFit(TObject* obj)
static voidTObject::SetObjectStat(Bool_t stat)
virtual Int_tSetParameter(Int_t ipar, const char* parname, Double_t value, Double_t verr, Double_t vlow, Double_t vhigh)
virtual Int_tTVirtualFitter::SetParameter(Int_t ipar, const char* parname, Double_t value, Double_t verr, Double_t vlow, Double_t vhigh)
voidSetParNumber(Int_t ParNum)
static voidTVirtualFitter::SetPrecision(Double_t prec = 1e-6)
virtual voidTNamed::SetTitle(const char* title = "")MENU
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidTVirtualFitter::SetUserFunc(TObject* userfunc)
virtual voidTVirtualFitter::SetXfirst(Int_t first)
virtual voidTVirtualFitter::SetXlast(Int_t last)
virtual voidTVirtualFitter::SetYfirst(Int_t first)
virtual voidTVirtualFitter::SetYlast(Int_t last)
virtual voidTVirtualFitter::SetZfirst(Int_t first)
virtual voidTVirtualFitter::SetZlast(Int_t last)
Int_tSGZ()
virtual voidShowMembers(TMemberInspector& insp, char* parent)
virtual voidTVirtualFitter::ShowMembers(TMemberInspector& insp, char* parent)
virtual voidTNamed::ShowMembers(TMemberInspector& insp, char* parent)
virtual voidTObject::ShowMembers(TMemberInspector& insp, char* parent)
virtual Int_tTNamed::Sizeof() const
virtual voidStreamer(TBuffer& b)
virtual voidTVirtualFitter::Streamer(TBuffer& b)
virtual voidTNamed::Streamer(TBuffer& b)
virtual voidTObject::Streamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
voidTVirtualFitter::StreamerNVirtual(TBuffer& b)
voidTNamed::StreamerNVirtual(TBuffer& b)
voidTObject::StreamerNVirtual(TBuffer& b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
protected:
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidTObject::MakeZombie()
TVirtualFitter&TVirtualFitter::operator=(const TVirtualFitter& tvf)

Data Members

protected:
Double_t*TVirtualFitter::fCache[fCacheSize] array of points data (fNpoints*fPointSize < fCacheSize words)
Int_tTVirtualFitter::fCacheSizeSize of the fCache array
voidTVirtualFitter::fFCN
TMethodCall*TVirtualFitter::fMethodCallPointer to MethodCall in case of interpreted function
TStringTNamed::fNameobject identifier
Int_tTVirtualFitter::fNpointsNumber of points to fit
TObject*TVirtualFitter::fObjectFitpointer to object being fitted
Foption_tTVirtualFitter::fOptionstruct with the fit options
Int_tTVirtualFitter::fPointSizeNumber of words per point in the cache
TStringTNamed::fTitleobject title
TObject*TVirtualFitter::fUserFuncpointer to user theoretical function (a TF1*)
Int_tTVirtualFitter::fXfirstfirst bin on X axis
Int_tTVirtualFitter::fXlastlast bin on X axis
Int_tTVirtualFitter::fYfirstfirst bin on Y axis
Int_tTVirtualFitter::fYlastlast bin on Y axis
Int_tTVirtualFitter::fZfirstfirst bin on Z axis
Int_tTVirtualFitter::fZlastlast bin on Z axis
static TStringTVirtualFitter::fgDefaultname of the default fitter ("Minuit","Fumili",etc)
static Double_tTVirtualFitter::fgErrorDefError definition (default=1)
static TVirtualFitter*TVirtualFitter::fgFitterCurrent fitter (default TFitter)
static Int_tTVirtualFitter::fgMaxiterMaximum number of iterations
static Int_tTVirtualFitter::fgMaxparMaximum number of fit parameters for current fitter
static Double_tTVirtualFitter::fgPrecisionmaximum precision
private:
Double_t*fA[fMaxParam] Fit parameter array
Double_tfAKAPPA
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
TStringfCwordCommand string
Double_t*fDA[fMaxParam] Parameter step
Bool_tfDEBUGdebug info
Double_t*fDF[fMaxParam] // First derivatives of theoretical function
Int_tfENDFLGEnd flag of fit
Double_tfEPSfEPS - required precision of parameters. If fEPS<0 then
Double_t*fEXDA[fNED12] experimental data poInt_ter
Bool_tfGRADuser calculated gradients
Double_tfGTExpected function change in next iteration
Double_t*fGr[fMaxParam] Gradients of objective function
Int_tfINDFLG[5]internal flags;
Int_tfLastFixedLast fixed parameter number
Bool_tfLogLikeLogLikelihood flag
Int_tfMaxParam
Int_tfMaxParam2fMaxParam*fMaxParam
Int_tfNED1Number of experimental vectors X=(x1,x2,...xK)
Int_tfNED12fNED1+fNED2
Int_tfNED2K - Length of vector X plus 2 (for chi2)
Int_tfNfcnNumber of FCN calls;
Int_tfNlimMulfNlimMul - after fNlimMul successful iterations permits four-fold increasing of fPL
Int_tfNlog
Int_tfNmaxIterfNmaxIter - maximum number of iterations
Int_tfNparfNpar - number of parameters
Int_tfNstepDecfNstepDec - maximum number of step decreasing counter
Bool_tfNumericDerivatives
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_tfRPPrecision of fit ( machine zero on CDC 6000) quite old yeh?
Double_tfSfS - objective function value (return)
Double_t*fSumLog[fNlog]
Bool_tfWARNwarnings
Double_t*fZ[fMaxParam2] Invers fZ0 matrix - covariance matrix
Double_t*fZ0[fMaxParam2] Matrix of approximate second derivatives of objective function

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TFumili(Int_t maxpar)
 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 his 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

Double_t EvalTFN(Double_t* , Double_t* )
 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

Int_t ExecuteSetCommand(Int_t )
 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
Double_t GetSumLog(Int_t )
 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)
Int_t Minimize()
*
         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;}