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)?
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
RK