FitSlicesX and fitted histograms

Dear ROOT experts,

I am using the method FitSlicesX of TH2F to perform gaussian fits on the slices of a 2D histogram. I can get the resulting plots by passing a TObjArray as the “arr” argument and plot them. I cannot, however, find a way to retrieve the histograms for each slice. I would like to examine these plots to make sure that the fit is working properly in all slices. Even though the method does produce a plot with the chi^2 of the fits, it is still good to look at the histogram with the fit result.

In principle one could use the ProjectionX/ProjectionY methods to produce these plots. However, this would demand manual synchronization of the slicing, making this option not very desirable.

Is there a way to access the fitted histograms from the FitSlicesX method?

Thank you in advance for any help,

best regards,


I don’t know of a way to obtain the slice histograms as you ask, but I can confirm that manually doing ProjectionX/Y and fitting each projected slice is indeed tricky to get right. I’m pretty sure I did it right with this PyROOT code:
The end of the relevant segment at around line 1038, but I do more than just get the histogram slices.