Re: [ROOT] TH2F::Fit

From: Eddy Offermann (eddy@rentec.com)
Date: Mon Mar 17 2003 - 17:07:52 MET


Hi Steven,

It seems that for your fitting function only the ratio (!) [0]/[1]
is relevant. So now you are trying to fit two 100% correlated
variables. What aws the "convergence" state of the fit ?

Eddy

> >
> > I'm using ROOT for the analysis of my nuclear medicine Monte Carlo
> > simulations results.  Therefore I want to fit a twodimensional function
> > to a 2D histogram.  I therefore use the following code:
> >
> > #include "TF2.h"
> > #include "TH2.h"
> >
> > void fit2d(){
> >   TFile b("t4.root");
> >
> >   Singles->Draw("PosZ:PosX>>hnew(18,0,180,20,-200,200)");
> >
> >   TF2 *f2e = new TF2("f2e",
> > "([0]*(y+201))/([1]*(x^2+(y+201)^2))",-0.5,180.5,-201,201) ;
> >
> >   f2e->SetParameters(1,1) ;
> >
> >   hnew->Fit("f2e")   ;
> >
> >   hnew->Draw("LEGO") ;
> >
> >   f2e->Draw("LEGO same");
> > }
> >
> > The result I get is not satisfactory however as I see that the maxima of
> > the histogram and the fit are put equal.  This is of course not the most
> > appropriate fit as can be seen from the attached gif.  The wireframe
> > plot is the data while the filled lego plot is the fit.
> >
> > In fact I was wondering how I could change the criteria in TH2F::Fit to
> > optimalize my 2D fit, as I have the impression now that it is mainly
> > penalizing the maximum deviation.
> >
> > Thanks in advance,
> >
> > best regards,
> >
> > Steven
> >
> > S. Staelens
> > Ghent University
> > ELIS / Medisip
> > Proeftuinstraat 86
> > B-9000 Gent
> > tel. 0032 9 264 66 28
> > fax. 0032 9 264 66 18
> > email: Steven.Staelens@rug.ac.be



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:10 MET