ROOFit: pdf convolution and RooClassFactory

Hi all,
I need to make the convolution of 2 pdfs in RooFit.
At the moment, I use something like this (and it works)

{
RooRealVar x(“x”,“x”,-10,10);
RooRealVar mean1(“mean1”,“mean of landau”,2);
RooRealVar sigma1(“sigma1”,“sigma of landau”,1);
RooLandau landau(“landau”,“landau”,x,mean1,sigma1);
RooRealVar mean2(“mean2”,“mean of gaussian”,0);
RooRealVar sigma2(“sigma2”,“sigma of gaussian”,2);
RooGaussian gauss(“gauss”,“gaussian PDF”,x,mean2,sigma2);
// Plot PDF
RooNumConvPdf model(“model”,“model”,x,landau,gauss);
RooPlot* xframe = x.frame();
model.plotOn(xframe);
xframe->Draw();
}

What if I want to implement this using RooClassFactory to define a new pdf? How should I write my evaluate()?
In principle, I’d like to be able to write something like

RooModel model(“model”, “model”, x, mean1, sigma1, mean2, sigma2)

Is it possible?

Cheers,
Giuseppe

Hi Giuseppe,

this is certainly possible. This procedure requires you implementing the convolution code.
If you are trying to achieve a faster evaluation, I would suggest to have a look to the much more efficient RooFFTConvPdf before diving in your own implementation of the convolution.

Cheers,
Danilo