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) ; mean.setConstant(kTRUE); 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)); pdf.fitTo(dh); pdf.plotOn(frame); 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
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?