Re: A question regarding TMinuit

Rene Brun (Rene.Brun@cern.ch)
Tue, 20 Oct 1998 10:26:34 +0200


Chris Jillings wrote:
>
> Hello,
> I am a neophyte to Minuit. I have never used it in fortran or in Root.
> My question concerns the example program from
> http://root.cern.ch/root/html/examples/Ifit.C.html
> I loaded it and it worked nicely.
>
> What confuses me is the global variables
> Float_t z[5],x[5],y[5],errorz[5];
>
> In, for example, numerical recipes, the minimizer is passed three
> arrays, x,y and sigma which contain the data to be fitted. It seems that
> TMinuit requires hard-coded globals for the data. Is this the case or have
> I missed the point?
>

Hi Chris,
In the small example Ifit.C, I use global arrays simply to make
the example short. The function fcn is YOUR function. You access
whatever you want. A simple mechanism is via global data.
In case, your data is part an an existing TObject (or derived),
you can do:
gMinuit->SetObjectFit(myObject);

and inside fcn access this object via
TObject *myObject = gMinuit->GetObjectFit();

Rene Brun