Really strange Fit behaviour


I see a really strange fit behaviour, which is illustrated by the attached macro, which fits a polarization signature with a cosine.

Please play with the number of bins (NBins) of the histogram:
At NBins=100, the correct modulation is retrieved (0.20)
At NBins=1000, the modulation is somewhat smaller (0.16) but not even within errors close to the input
AT NBins=10000, the fitted cosine is almost flat, but visually the correct modulation is clearly visible (see attached image).

Any idea what might be wrong? The chi-square of the fit looks reasonable, but the result is definitely not…

Strangely, if one deactivates the normalization (UseNormalization=false) in the macro, the fit becomes acceptable again.

Any ideas what might be wrong?


OS: SuSE 9.2
CC: icc
ROOT: 4.04/02 (not cvs)
FitProb.C (2.41 KB)


Your normalization is wrong. I assume that instead of
Hist->SetBinContent(b, Hist->GetBinContent(b)/Mean-1);
you meant
Hist->SetBinContent(b, Hist->GetBinContent(b)/(Mean-1));



The normalization is only for illustration - and it is as intended - the values should be above and below zero.

The problem is - if there are values above and below zero - as in the example - then the fit misbehaves, i.e. it works perfectly ok if all values are positive or all values are negative.



You should define correct errors or force equal weights for all bins,
eg replace
Hist->Fit(Mod, “R”);
Hist->Fit(Mod, “Rw”);


Now it works!

Thanks! :smiley: