Re: [ROOT] TH2F::Fit

From: steven staelens (steven.staelens@rug.ac.be)
Date: Mon Mar 17 2003 - 17:23:18 MET


Hi eddy,

you are right, I've tested it first with 3 parameters and then omitted one and
forgot to include it again in the example.

After trying somewhat more I think I've found the problem :

when I do a lego plot of my fit, and afterwards a lego plot of my histogram,
the histogram is rescaled to the axes of the fit plot.....therefore I
misinterpreted the result.  For now I think the fit is probably OK but I want
to get rid of the rescaling to make sure.

Do you know a solution for that?

many thanks in advance,

S.

Eddy Offermann wrote:

> 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