Re: 2dim fitting

Rene Brun (Rene.Brun@cern.ch)
Sat, 1 May 1999 11:11:58 +0200 (METDST)


Hi Faouzi,
This is not what Markus wants.
He simply wants to make a trivial fit with 3 parameters
on a set on N NON-EQUIDISTANT points. The solution
is to use the TGraph class or (TGraphErrors if he has associated
errors bars).
I could make a simple tutorial derived from the existing graph.C
or gerrors.C + myfit.C , adding a graph->Fit statement.

Rene Brun

On Sat, 1 May 1999, Faouzi Attallah wrote:

> On Fri, 30 Apr 1999, Markus Weiss wrote:
>
> > Hi,
> >
> > I like to fit a function of two values f(x,y) with 3 parameters
> > to datapoints of
> >
> > x1, y1, f1
> > x2, y2, f2
> > ....
> >
> > I tried the ntuple-class, and TF2 for the usersupplied function,
> > but seem not to get the desired result. Basically I'm lost...
> >
> > Has anyone solved this rather simple problem ?
> >
> > Thanks, Markus.
> >
> > --
> > ---------------------------------------------------------------------
> > Markus Weiss "Ah elbereth glithoniel
> > BESSY-2 Projektteam silvren penna miriel"
> > e-mail: weiss@abbe.exp.bessy.de phone: +49-30-6392-2941
> > ---------------------------------------------------------------------
> >
>
>
> Hi Markus,
>
> I hope Rene agrees with the following syntaxe. In the 2dim-hist case and
> a usersupplied function as, e.g. a 2dim Polynome of 1st degre one can
> write:
>
> TH2F *Hr ; // the 2-dim host
> ...
> pol = new TF2 ("pol","[0]*x + [1]*y + [2]", xmin, xmax, ymin, ymax) ;
> pol->SetParNames("Ax","Ay","B") ;
> hr->Fit("pol","R0") ;
>
> Cheers,
> Faouzi
>
> F. Attallah GSI mbH Planckstr 1 D-64291 Darmstadt
> Tel: +49 (0)6159 71 2743
> Fax: +49 (0)6159 71 2901
> Email: F.Attallah@gsi.de
>