Possible to convert a RooFitResult to a TFitResult?

@couet @moneta Thanks for the reply. I would like to try to follow up on this as it seems like this would also fix @poniatowska’s problem as RooAbsReal::asTF() returns a pdf, not the fit you want.

In the more general case where one has a RooFitResult then (in PyROOT) you’re suggesting to do this?

# model is our RooAbsPdf (let's say a RooGaussian)
# datahist is the RooDataHist that we fit model to
# x is our observable RooRealVar
# x_range is the fit range we care about

# roo_fit_result = model.fitTo(datahist, ...) # Assume something like this has been done
fit_result_func = model.asTF(ROOT.RooArgList(x))
hist = datahist.createHistogram('hist name', x)
# This gets us the TFitResult
fit_result = hist.Fit(fit_result_func.GetName(), 'ILS', '', x_range[0], x_range[1])

# Now fit_result_func should have the parameters of the fit
integral = fit_result_func.Integral(x_range[0], x_range[1])

If this is what you are suggesting, then I think this seems to work and can easily have a user wrapper function that handles all of this (however a quick test results in an error with illegal number of parameters from hist.Fit()). However, I am a bit concerned about the fact that RooFit and ROOT’s fits do NOT seem to give consistent results (c.f. my chi-square question). Do you have advice here?