ChiSquare

Hi all.
I made a simple routine to fit a histogram with a 2D Gaussian function and implemented the formula for calculating the ChiSquare. But when comparing this ChiSquare with the one given by ROOT, the value is totally different.
The same holds for the number of degrees of freedom.
Could anyone tell me what I am making wrong, please?

Thank you,
Francesca

P.S.
I am using ROOT 5.28.00g on Ubuntu 10.10
Beam_image.root (24.9 KB)
Minimal.C (3.41 KB)

愛情萬歲

Note: the way you treat your data means that both, the histogram and the fitted function, must always have non-negative values.
Minimal.C (3.47 KB)

Thanks!

Francesca