Re: 2dim fitting

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon May 03 1999 - 10:47:54 MEST


Hi Markus,
Sorry to have overlooked your question.
yes, the macro Ifit.C is a good starting point for solving
your problem.
I also agree that it would be nice to have the functionality
directly provided by a TTree::Fit. I will work on that.

Rene Brun

Markus Weiss wrote:
> 
> Thank you for your overwhelming support.
> 
> but I seem not to have supplied enough information to
> make my problem clear.
> 
> My main problem is to find the appropriate class to store
> nonequidistant triples of data, such as:
> 
>   x     y          z
>   5.0 178.75 177.847
> 20.0 178.75 177.496
> 2.25 400.7    390.669
> 10.0 400.7    396.195
> 
> The function I want to fit to these (and more) datapoints
> is
>         z=f(x,y)
> 
> by adjusting 3 additional parameters (dalpha, dbeta, dn)
> which modify f().
> 
> I was able to produce a TF2 with this "usersupplied" function.
> 
> So far so good, but I did not find a way to store these data and
> do a simple: whatever->Fit().
> I tried TGraph, but this one accepts only two column of data, in other
> words z=f(x).
> I tested TNtuple which seems to be the right joice, but the inherited
> method Fit() (from TTree) accepts only a TF1 function, according to
> the reference guide.
> 
> Sofar I succeeded by adapting the IFit.C example in the tutorial which
> uses migrad directly.
> 
> So, I am still search for the right data-model to take  ntuples of
> nonequidistant data and fit a multidimensional function to it, which
> is as easy as the one-dimensional case (Tgraph() and Fit()).
> 
> Thanks again,
> 
> Markus.
> 
> The suggestions to solve my problem follow:
> 
> On Sat, 01 May 1999, Faouzi Attallah wrote:
> >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") ;
> >
> 
> I am not sure if the 2dim-hist class is the rigth choice for my data.
> 
> On Sat, 01 May 1999, Rene Brun wrote:
> >  Please, read the tutorials graph.C and myfit.C
> > You create a TGraph(n,x,y) object with your array of points,
> > then invoke TGraph::Fit with your user defined function.
> 
> To my knowledge, TGraph cannot cope with data consisting of
> more than 2 columns (i.e. x,y,z).
> 
> --
> ---------------------------------------------------------------------
> Markus Weiss                                  "Ah elbereth glithoniel
> BESSY-2 Projektteam                            silvren penna miriel"
> e-mail: weiss@abbe.exp.bessy.de               phone: +49-30-6392-2941
> ---------------------------------------------------------------------



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:32 MET