Re: Really strange fit

From: Eduard Avetisyan <eduard.avetisyan_at_desy.de>
Date: Wed, 9 Feb 2011 08:52:49 +0100

Hi Lorenzo,

On Wed, 9 Feb 2011, Lorenzo Moneta wrote:

> Hi Eduard,
>
> When you fit with pre-defined functions like "gaus", the initial fit parameter values are computed automatically.
> If you use option "B":: this initialization is not done and you need to specify those values.
>
> In your case probably your initial parameter values were too far off and the fit failed to converge.
> If you use better initial parameters like:
>
> aa->SetParameters(h3d_z->GetMaximum(),h3d_z->GetMean(),h3d_z->GetRMS());
> h3d_z->Fit(aa,"B");
>
> your fit will converge

Thanks for the hint. As I wrote, in case of individual histograms I can (and I actually do) initialize the fit function exactly in the way you pointed. What I cannot do is controlling the automated fit via FitSlices[XYZ]. There one edge of the 3D histogram may (and is) far off from the other and such initialization would make sense only for the first bin. What worries me is that I can't even limit the range of the fit function parameters to sensible values...

Cheers

        Eduard

>
> Best Regards
>
> Lorenzo
>
>
> On Feb 8, 2011, at 12:28 PM, Eduard Avetisyan wrote:
>
> >
> > Dear experts,
> >
> > I'm experiencing a really strange behaviour while trying to perform
> > something fairly simple.
> >
> > I have a histogram, which needs to be fitted with a gaussian.
> > I initialize the parameters of the gaussian and then fit, using a script.
> >
> > The fit fails if the "B" option is specified. It also fails at the first
> > invokation if no options were specified, and succeeds on the second
> > attempt.
> >
> > Now my problem is that I need to fit using the FitSlices* methods, and
> > here the fit fails miserably in bins which are very happily fitted if ran
> > manually. In this methods I don't have much control of the internals,
> > namely I can't force it to perform the fit twice in each bin. Moreover, I
> > really need to restrict some of the fit parameters, and that causes really
> > bogus results.
> >
> > Thanks for any help!
> > Eduard
> >
> > P.S. The root file with the histogram can be found at
> > http://www.desy.de/~dich/misc/strangehisto.root
> > and the script at
> > http://www.desy.de/~dich/misc/strangefit.C
> > ROOT v.5.26
> > Calling as root -l strangefit.C
> > The resulting pads:
> > 1(top): fit with "B" option
> > 2(middle): single fit with no options
> > 3(bottom): double fit with no options
> >
>
>
Received on Wed Feb 09 2011 - 08:52:56 CET

This archive was generated by hypermail 2.2.0 : Wed Feb 09 2011 - 11:50:01 CET