FitSlicesY: per slice initial parameters


Slices in my 2D histogram can be fitted by a universal function, but require individual initial values and limits for each slice for the fit to converge. How can they be passed to FitSlicesY?

In my case, I need to know and use for that purpose some characteristics of the 1D histogram representing each slice, e.g. its mean and height in the middle.


you can set the initial parameters of the function for all the slices. If you need different parameters for each slice to fit, you can then call many times
TH2::FitSliceY changing firstxbin and lastxbin and if needed merge the histograms with the fitted parameters.

for (int ixbin = 1, ixbin < h2->GetNbinsX(); ++ixbin) { 
    // set initial parameter in the function
    // merge here histogram with fitted parameters

Best Regards