I called the KolmogorovTest on 2 histograms, the original histogram and the histogram of the fit, but I the binning differs. I wonder how I can set the bins of the histogram of the fitted.
if I use Rebin(), it will lower more the bin of the fit histo, and I do not want to change the binning of the initial histogram.
using the piece of code [*], I have the error message:
you can create an empty histogram with the same binning and set the bin content according to the value of the fit function calculated at the bin centres.
Try (assuming that your “hist” is a simple “fix bin size” one): TF1 *myfit = new TF1("myfit", myfit_fnc,
hist->GetXaxis()->GetXmin(), // use the same "xlow"
hist->GetXaxis()->GetXmax(), // use the same "xup"
maxPar);
myfit->SetNpx(hist->GetNbinsX()); // use the same "nbins"
I wonder how to get the fit function value calculated at the bin center?
I tried: fit->GetHistogram()->GetBinContent(i);
but the return values are not correct.