# Plotting the contribution of 1-parameter to a complex pdf

Dear all,

I have a pdf containing several parameters to be defined. In the case of two parameters A and B, this could be written like (with two functions f1 and f2 depending on the observables theta and t):

pdf= Af1(theta,t)+Bf2(theta,t)

Now, I want to plot the distribution of theta coming from the data, the total pdf projected on it, and also the contribution coming from the A term and the one coming from the B term. For the data and the total pdf, I have no problem, I just do :

data.plotOn(…)
pdf.plotOn(…)

Now, I have tried to have access to the first term A*f1(theta) by doing by doing the following, but they don’t work (I get a segmentation fault):

pdf.plotOn(…,Components(“A”),…) or pdf.plotOn(…,Components(RooArgSet(A)),…)

What I then tried was to create two new pdfs, pdf1 and pdf2, where I set B=0 for pdf1 and A=0 for pdf2. But when I plot them, their normalizations are one and therefore, it is not the functions I wanted to plot.

I tried to use :

pdf1.plotOn(…,Normalization(A.getVal()),…)
pdf2.plotOn(…,Normalization(B.getVal()),…)

But the sum of the two projections of pdf1 and pdf2 on the observable theta are not equal to the projection of pdf (I cas easily see it, for example, at theta=0, the projection of pdf2 equals 0, but pdf and pdf1 do not have the same values ).

Does anyone know how I should do to have the proper plots ? Or how I should do the normalization of pdf1 and pdf2 such that their sum is equal to pdf ?

Thanks a lot,
Géraldine

Hi Géraldine,
The solution I guess is to use
pdf.plotOn(…,Components(f1),…) to plot component A, and
pdf.plotOn(…,Components(f2),…) to plot component B
In fact, A and B are not Pdfs, they are just numbers, while f1 and f2 are. On the resulting plot, you’ll see both functions, with different height (or amplitude), corresponding to A and B.

Hi,

Stephanes suggesttion is correct. The Components() argument should specify the p.d.f.s, not the coefficients. This feature works for any p.d.f that contains a RooAddPdf and RooRealSumPdf composite objects.

Wouter