Draw PDF without scale factor in pyROOT

Hi Guys,

I create a pdf by RooClassFactor which is named MyPdf(), such as y = a * f1(x) + b * f2(x) + c * f3(x)

I want to draw MyPdfs with different parameters in the same canvas using Raw Scale to compare the contribution of f1(x), f2(x) and f3(x)

Due to some special condition,I don’t want to use RooAddPdf().

I see the pdf could use Raw Scale when plot it. But I don‘t know how to achieve it.

mypdf = ROOT.MyPdf("mypdf", "mypdf", x, a, b, c)

frame = x.frame()

#plot total
mypdf.plotOn(frame, [???Raw Scale Option])

#plot f1(x) contribution
a.SetVal(1.)
b.SetVal(0.)
c.SetVal(0.)
mypdf.plotOn(frame,[???Raw Scale Option])

#plot f2(x) contribution
a.SetVal(0.)
b.SetVal(1.)
c.SetVal(0.)
mypdf.plotOn(frame,[???Raw Scale Option])

#plot f3(x) contribution
a.SetVal(0.)
b.SetVal(0.)
c.SetVal(1.)
mypdf.plotOn(frame,[???Raw Scale Option])

Hi @Type_Error - I have invited @moneta and @jonas to help, but due to the Christmas break this might take a bit longer than we’d hope.

Hi,

You can use the Raw scale factor in plotOn by doing:

mypdf.plotOn(frame,ROOT.RooFit.Normalization(scaleFactor,ROOT.RooAbsReal.Raw))

I think the scale factor will be applied to the raw pdf value, i.e not relative to data normalisation and without using any specific normalisation. I don’t think is very useful.
Also your pdf seems to me similar to the RooRealSumPdf, you can probably use that class.

Cheers

Lorenzo

Dear moneta,
Thanks for your suggestions!
But I think RooRealSumPdf seems are not to available for my condition. In my pdf, the a,b,c are just only switch, not represent coefficients.

f1(x),f2(x),f3(x) are functions (some of them are negative,but their sum is positive). The coefficients (or contributions) of them are integration of each function.

Such as, mypdf = a * f1(x) + b * f2(x) + c * f3(x) = N1 * pdf1(x) + N2 * pdf2(x) + N3 * pdf3(x)

I want to draw contribution of each item (include negative part), do you have any good suggestions?
(I try to extract the parameters of mypdf, and draw each terms by TF1. But mypdf need to consider convolution, such as mypdf = [a * f1(x) + b * f2(x) + c * f3(x)] * ConvoFun(x), which is easy to achieve in RooFit but complicated in TF1… )

Hi,
I am not sure I understand your problem. You can create separate functions representing the different terms of your pdf and draw them, as function, if they are not normalised, or according to some defined normalisation (e.g. a given number of events)

Lorenzo

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