How to get result from RooFitResult

Dear Root User,

I use the following command to fit data.
RooFitResult* fitresult = model.fitTo(*data, Save()) ;

After I get fitresult and save it to a root file, how could I use the fitresult later to estimate what’s the y value for each x while y = model(x)? Do we have something like y = model.eval(x)?


@moneta can help you with this question

Thanks, looking forward to get reply!

Perhaps this can help:

const RooArgList & fitParams = fitresult->floatParsFinal();
for ( int i = 0; i < fitParams.getSize(); ++i)
  auto & fitPar = (RooRealVar &) fitParams[i];
  std::cout << fitPar.GetName() << " " << fitPar.getVal() << std::endl;

For -ln(likelihood) you have fitPar.minNll()

If you want your original model shape, you can plug the best fit x back to your model. I think the model is not saved in RooFitResult


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.