Unable to get fit parameters from FitSlicesY

Hello,

I define a TH2F like this:

TH2F* dPhiVsPHist = new TH2F(“DPhi Vs P”,“DPhi Vs P”,100,0,10,50,-0.05,0.05);

and then write it to a ROOT file and draw it - I see it is filled as expected.

When I try to use FitSlicesY nothing seems to happen:

TH2F* mark = (TH2F*)_file0.Get(“DPhi Vs P;1”)
TF1 *gaus = new TF1(“m1”,“gaus”,-0.05,0.05)
mark->FitSlicesY(gaus,0,100)

All the documentation seems to suggest histograms with names mark_0, mark_1 etc should appear that contain the fit parameters as a function of x. For me they do not exist, and no error messages appear suggesting any problem when calling FitSlicesY.

Does someone know where I am going wrong?

What I want to do is fit each slice in Y with a Gaussian and plot the mean of that fit vs the x-axis.

I am using ROOT 5.34/01 on a linux SL5 machine.

Thanks,

Mark

1 Like