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
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:48:33 CET
This archive was generated by hypermail 2.2.0 : Wed Feb 09 2011 - 11:50:01 CET