Convolution of gauss PDF and step function PDF using RooFit

Hello,

I am (a bit) experienced at root but not with RooFit. I should now convert our analysis code to RooFit. My task is to fit the convolution of a gaus PDF with a step function pdf to our data.
Right know we calculate the convolution by our self and aproximate a fit function from it.
The new plan is to use RooFit for that and use its numerical convolution properties so that we can use more complex PDF for our more complex experimental geometries.

To get a gauss PDF seems pretty simple:
RooGaussian gaus(“gaus”, “gaus function”, x, mean, sigma);
My problem is to get a step function pdf which is 1 for -r <= x <= r and else 0 and then do the convolution.

Can anyone help me, please?

Hi,

There is no a real pdf class in roofit for the step function, but you can easily create it from a simple user function as following for example:

RooRealVar  x("x","x",-10,10);
RooCFunction1PdfBinding<double,double> pdf("a","a",[](double x){ return (x > -2 && x < 2) ? 1.0 : 0.0; },x);

and then you can use it as a pdf for the convolution as showed in some roofit tutorials
(e.g. root.cern.ch/doc/master/rf208__ … on_8C.html )

Cheers

Lorenzo

Hi,
I suppose you can solve this problem with just a couple of calls to the Erf function?
Cheers
Giovanni