How to get chiSquare from multi-subranges simultaneously fit

Dear RooFit experts,

I have tried doing multi-subranges simultaneously fit because there are some parts I don’t wanna include into the fit and I found the fit curve fit quite well with my unbinned dataset but the RooPlot::chiSquare() seems to include all the data points in the calculation even those data points (non-zero) that I didn’t include in my subranges fit. Is that correct? My question is when we do multi-subranges fit, how can we get the correct chiSquare value from this kind of fit. Thanks in advance.



Would it be possible to have a running example ?
Otherwise, I would extract directly the data (the residual histogram) and remove the unwanted points.
Also, if you have empty bins, they are included in the chi-square computed with RooFit, and these points should also be removed

Best Regards