Rene Brun | 4 Dec 2006 13:59
Picon
Picon

Re: [ROOT] TMinuit function arguments

Hi Till,

Instead of making the arrays t and sigma global, define only one global 
pointer to an object
that includes these 2 arrays.
We are currently considering extensions to the fitter where a pointer to 
an object could be specified
instead of the FCN.

Rene Brun

Till Sawala wrote:
> Hi Rooters,
>
> I would like to minimze a likelyhood-function of 1 parameter with Tminuit. At the moment, I use the
following pair of functions (adapted from http://root.cern.ch/root/html/examples/Ifit.C.html):
>
> void NLL(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
> {
>   Double_t LL = 0.0;              
>   const Int_t nbins = 100000;
>
>   for (int i=1; i<nbins; i++)
>     {
>       LL += TMath::Log(Prob(t[i], sigma[i],par));
>     }
>
>   f = -1. * LL;
> }
>
(Continue reading)

Christian Holm Christensen | 4 Dec 2006 15:53
Picon
Favicon

Re: [ROOT] TMinuit function arguments

Hi Till,

On Mon, 2006-12-04 at 13:59 +0100, Rene Brun wrote:
> Hi Till,
> 
> Instead of making the arrays t and sigma global, define only one global 
> pointer to an object
> that includes these 2 arrays.
> We are currently considering extensions to the fitter where a pointer to 
> an object could be specified
> instead of the FCN.

In the mean time, do something like in the attached script (a re-write
of Ifit.C) where an object is used, and a special forwarding `minimised'
function is implemented.  Note also, that I use the `TVirtualFitter'
interface - one should _never_ use the TMinuit/TFumili/... classes
directly . 

Run the script like 

	Root> .x Ifit.C+ 

Yours,

--

-- 
 ___  |  Christian Holm Christensen 
  |_| |  -------------------------------------------------------------
    | |  Address: Sankt Hansgade 23, 1. th.  Phone:  (+45) 35 35 96 91
     _|           DK-2200 Copenhagen N       Cell:   (+45) 24 61 85 91
    _|            Denmark                    Office: (+45) 353  25 404
(Continue reading)


Gmane