Chi2Test normalization

I’m using Chi2Test() to fit response functions and background to some gamma spectra and I’m getting some confusing results. For simplicity, the attached images just try to fit the smallest peak on the right. I’m using the option “UWCHI2NORM” since I’m comparing data to simulation and I want the normalization to be considered. The fit isn’t giving me reasonable results though. When I tried a few things manually I noticed that Chi2Test() doesn’t seem to be considering the normalization as I expected. Using it without the NORM option gives the exact same chi-squared values.

For example, the clearly worse fit below, “bad_fit” gives a slightly lower chi-squared value than the better fitting initial conditions I gave it in the first place, “good_fit”. Does this mean if it’s scaled it will fit better? Can I get it to really consider the normalization? Or am I misunderstanding the meaning of the NORM option.

Any help will be much appreciated.

Thanks!
Matt

I’m using ROOT 5.14




Hi,

you should use the “NORM” option only in combination with “UU”, the default, not with “UW”. It applies only if one or both histograms have been scaled, but they originally were unweighted, i.e. they represent counts (error = sqrt(contents) ). This is probably your case, since you are comparing data vs simulation.

I would recommend you also to switch to one of the latest version of ROOT (>= 5.20), since some bugs have been fixed previously in the Chi2Test function.

Regards

Lorenzo

Thanks for the clarification Lorenzo and the advice on 5.20. :frowning: Unfortunately I don’t maintain the software packages on the system I’m using, and the latest version they have is 5.14.