Effective range used by the fit when zooming a TH2 with SetRangeUser()

Dear ROOTers,

My understanding is that when I fit a TH2 histogram that has been “zoomed in” with a previous call to the SetRangeUser() method, only the “visible” part of the histogram is included in the range fit.

I compared this with an explicit range specification in the Fit method (where I can specify the range only for the x-axis):

//Case 1
h2.GetXaxis()->SetRangeUser(h2.GetMean()-3*h2.GetRMS() , h2.GetMean()+3*h2.GetRMS());
h2.Fit(&model,"VLE", "", h2.GetMean()-3*h2.GetRMS() , h2.GetMean()+3*h2.GetRMS());

The results are almost but not exactly exactly identical. In particular the number of degrees of freedom (it is reported even if it was a likelihood fit, hopefully it is reliable for my next statement) suggests that a different number of bins is included, maybe because of different rounding to the bin index (because you cannot include only half bin, right?) between SetRangeUser() and the Fit method range specification.

Is there any reason that explains the difference?

Since the TH2::Fit method does not allow to set a range also for the Y axis, I would like to know if I get the same effect by zooming in the histogram.


ROOT Version: 6.16
Platform: Debian 9
Compiler: gcc 6.3

Maybe @moneta can give you some hints

In addition to the original question, I would like to ask if the reported Chi2 value is meaningful also when you are doing a Max Likelihood fit, because at a first glance it seems so.

And maybe to deal with empty bins it is calculated estimating the “sigmas” in the bottom of the ratio from the function values (not sure, either the square root of the function value or maybe some other technique to deal with the Poisson distribution assumption in each bin)

It would be very useful to know this detail…

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.