What you do seems to be correct. The parameter values that you set before calling TH2::FitSlicesY are used to initialize the parameters of the function before fitting each slice.
When you say that the parameters are only slightly different, do you
mean that the answer is correct or far from the expected solution?
Could you post a modification of your script (including a file myth2.root)
that performs only one FitSlicesY on this particulat histo?
After you said, " The parameter values that you set before calling TH2::FitSlicesY are used to initialize the parameters of the function before fitting each slice." clears things up.
In my TH2F histogram, which is attached, there is a linear distribution. In order to fit this I have been using FitSlicesY(). Until recently I had always just used the built-in “gaus” function. I was trying to use slightly different distribution to fit the slices and then it seem to stop working.
However, when I only fit one bin using FitSlicesY(), after useing SetParameters(), it does seem to fit that slice correctly.
So my problem seems to be that before each slice the parameters are reset to the values I set using SetParameters(). This is a problem because as you move away from the first slice the SetParameters() are no longer valid.
I am attaching the histogram in root format.
Thanks for your help,
Taylor Childers
Univ. of Minnesota myth2.root (242 KB)
In your example, each slice has a peak but also a long background tail.
When fitting with the chisquare technique, the background bins have a
strong contribution. You should use the “L” option (Loglikelihood) instead
or the “W” option (giving all bins an equal weight).
This however will take more time to fit.
There is a better alternative to FitSlicesY in your example.
You should make a ProfileX of your histo and fit teh ProfileX with a straight line.
This ill be much faster and precise.
Both the suggestions you made seem to work: Adding Loglikelihood fit or Profiling the histogram.
I guess my intention was to deal with the tails by using a user defined Maxwell Distribution which also has a tail, however, these other options are easier.