RooFFTConvPdf gives constant zero

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.

test.py (2.0 KB) 500w0.root (2.1 MB)

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)

1 Like

I created an issue to track work on this problem on GitHub: RooFFTConvPdf doesn't work with RooProdPdf · Issue #7157 · root-project/root · GitHub

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?

Hi, thanks for the check with RooNumConvPdf! I have mentioned this in the issue now too, it’s valuable information.

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