RooFit: Evaluate fitted function at a point


I’m trying to fit three seperate peaks each with a Gaussian and a constant background using RooFit. This works (suprisingly well), but now I want to get the value of the Gaus+Background at the center of the peak. All attempts to get any meaningful value from the fitted p.d.f failed.

My variable is called x and I have the three p.d.f.s pdf1, pdf2 and pdf3. To get the values I tried to use

peak1_val = pdf1.getVal(RooArgSet(x))

This should return the normalized value of the p.d.f as far as I understand the manual. What I get is something like peak1_val == 51.
To get the fitted value (something like 0.9e-3 for the first peak) the normalized value would have to be multiplied by the integral over the data histogram in the fit range, correct?

Is there a way to construct a TF1 from the fitted p.d.f or any other way to get the fitted values?

I found a workarround:
After plotting the pdf via
pdf1.plotOn(frame, RooFit.Name(“pdf1”))

one can get a TF1 by asking the frame for an object called “pdf1”:

func = frame.findObject(“pdf1”)
peak_val1 = func.Eval(…)