Order of RooAbsPdf in RooFFTConvPdf

Hi all,

I tried to do the convolution of a RooHistPdf and a gaussian shaped resolution model.
I first tried

 	RooRealVar x("x","x", hmin, hmax) ;
  	RooDataHist dh("dh","dh",x,Import(*histo)) ;
  	RooPlot* frame = x.frame(Title("mass")) ;
	dh.plotOn(frame,  MarkerColor(1), MarkerSize(0.05), MarkerStyle(2));

	RooRealVar mean("mean","mean", 0, -1000,  1000) ;
  	RooRealVar sigma("sigma","sigma", 1000, 500, 10000) ;

	RooGaussModel resol("resol", "resol", x, mean, sigma);
    	RooHistPdf histpdf("histpdf","histpdf",x, hMC,0) ;
	x.setBins(10000, "cache");
	RooFFTConvPdf pdf("pdf", "pdf", x,  resol, histpdf);
	pdf.plotOn(frame, LineColor(kGreen));
	frame -> Draw();

It gave me an error:

ERROR:Eval – RooAbsReal::logEvalError(histpdf_fft) evaluation error,
origin : RooHistPdf::histpdf_fft[ pdfObs=(x_shifted_FFTBuffer2) ]
message : p.d.f normalization integral is zero or negative

and warning:

WARNING:Plotting – At observable [x]=119700 RooHistPdf::resol_CONV_histpdf_CACHE_Obs[x][ >pdfObs=(x) ]
p.d.f normalization integral is zero or negative @ pdfObs=(x = 119700)

BUT when I changed

RooFFTConvPdf pdf(“pdf”, “pdf”, x, resol, histpdf);


RooFFTConvPdf pdf(“pdf”, “pdf”, x, histpdf, resol);

everything worked out.

The convolution is a commutative operation, as far as I know. Also, I couldn’t find anything about the order of RooAbsPdf in the documentation of classRooFFTConvPdf.

So my question is: what is the reason that the order of RooAbsPdf is important for RooFFTConvPdf? If someone has any answer why it can behave like this in this situation, please, share it with me.

p.s. I tried to perform the same trick using an example here. If you change pdfs position in the RooFFTConvPdf the macro still works. Can it be something connected with a fact that I use RooHistPdf, which is not an analytical function?

Hi @watmann,

It’s true that a convolution should be commutative. However, when the function used to implement the PDF gets normalised, things start to work a bit differently in RooFit. This is not the only time we see surprising results with convolutions. I pointed Wouter Verkerke to the problem, and he promised to investigate.

It’s good that you found this, because this might add one more piece to the puzzle.

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

Hi @watmann,

I likely fixed a bug concerning FFT convolutions. Now I want to test if that has any effect on what you were doing. Could I have the histograms that are referenced in your code snippet?

  • histo
  • hMC