I am trying to calculate the convolution between a RooHistPdf and the product of a RooBreitWigner and a RooLognormal pdf. The distribution of both pdf is fine, but the convolution is zero everywhere.

It seems that RooFFTConvPdf is unable to handle the product of two different pdf. The convolution works with the product of the same pdf.

Hi, thanks a lot for reporting this interesting problem!

This problem seems to be specific to putting a RooProdPdf into a RooFFTConvPdf. We are investigating this problem right now and hope to find a real fix. If you need a quick and dirty solution in the meantime, you can just add zero to the product such that it’s class is RooRealSumPdf, which works in the convolution. Here is what you need to do for that:

# calculate product of RooBreitWigner and RooLognormal
# give it a temporary name because we will turn it into a RooRealSumPdf in the next step
modifedbw_tmp = ROOT.RooProdPdf("modifedbw_tmp" + name + str(width), "modifedbw_tmp", ROOT.RooArgList(bw, ln))
# Using a RooProdPdf directly in RooFFTConvPdf gives wrong results.
# But passing a RooRealSumPdf to RooFFTConvPdf works, so we turn the RooProdPdf into a RooRealSumPdf
# by adding a dummy pdf with coefficient zero (the second zero coefficient will be inferred from
# the coefficient of the first pdf, which is one)
dummy_for_sum_pdf = ROOT.RooUniform("dummy_for_sum_pdf", "dummy_for_sum_pdf", x)
unity_for_sum_pdf = ROOT.RooRealVar("unity_for_sum_pdf", "unity_for_sum_pdf", 1)
modifedbw = ROOT.RooRealSumPdf("modifedbw" + name + str(width), "modifedbw", ROOT.RooArgList(modifedbw_tmp, dummy_for_sum_pdf),
ROOT.RooArgList(unity_for_sum_pdf))

The complete script with the change is here: test_add_zero.py (3.3 KB)

Thanks for you help. I found that the numerical convolution also have the same problem. Maybe you can add RooNumConvPdf to the GitHub issue page as well?