Fitting a distrete function to a histogram


I have a function that produces a series of discrete points for some parameter, that i would like to fit to a series of data points.

So far i have tried interpolating the points with cubic splines to produce a continuous function, and fitting it with the the TH1F Fit method, after wrapping it in a TF1. The problem is that somtimes the cubic spline doesn’t appear to fit the points smoothly and i think this is upsetting TMinuit.

Does anyone have any suggestions on how to fit discrete points to histograms?


The problem was that the “I” option was set, and this was causing to use values that were not at the center of the bins. Though i am not sure what it is suppost to do