I think that the TH1::Chi2Test would be very good for my application, but I want to be sure I understand exactly what it is doing. Specifically, I have a histogram of data and one of a simulation. I treat both of them as unweighted and I scale the simulation to have the same total area as the data. The documentation and the source code give the formula for the chi2 value, and it is not quite the same as the usual Perason’s chi2. So what’s the difference? Also, is there a way to perform the test over only a specific range of the histogram?



You can see the referenced paper,

for the details.

If you scaling the simulation histogram then your comparison is between a weighted and an unweighted histogram comparison.

If you call TAxis::SetRange(firstBin, lastBin) before calling the TH1::Chi2Test function, the test will be done only for the bins in the given range.

Best Regards