# Convolution with Gaussian (RooFFTConvPdf)

Hello,

I’m a little confused with convolution function.

I use RooFit v2.95

I consider example rf208_convolution.C from \$ROOTSYS/tutorials/roofit
but without data and fit

It plots convolution of Landau with mean=5, width=1 and Gaussian with mean=0, width=2, gives smoothed Landau distribution, as expected
range of variable -10 - +30

as I decrease width of Gaussian, convoluted distribution converges to initial Landau and for width of Gaussian = 0.2 they are indistinguishable by eye, also as expected

then I change range of variable to +60 - +120, mean of Landau to 95. And RooFFTConvPdf gives me convoluted distribution with peak shifted from initial Landau shift. As mean of Gaussian is still 0, I don’t understand where this shift comes from.

then I change width of Gaussian to 0.2 and expect the convoluted distribution to be indistinguishable from initial Landau, but instead receive

“[#0] WARNING:Plotting – At observable [x]=119.7 RooHistPdf::lx_CONV_gauss_CACHE_Obs[t][ depList=(t) ]
p.d.f normalization integral is zero @ depList=(t = 119.7)”

thank you for any suggestions how to fix it

Sincirely, Ekaterina Avdeeva

[code]/////////////////////////////////////////////////////////////////////////////////
// code of rf208_convolution.C (without generating data)
/////////////////////////////////////////////////////////////////////////////////

#ifndef CINT
#include “RooGlobalFunc.h”
#endif
#include “RooRealVar.h”
#include “RooDataSet.h”
#include “RooGaussian.h”
#include “RooLandau.h”
#include “RooFFTConvPdf.h”
#include “RooPlot.h”
#include “TCanvas.h”
#include "TH1.h"
using namespace RooFit ;

void rf208_convolution()
{
// S e t u p c o m p o n e n t p d f s
// ---------------------------------------

// Construct observable
RooRealVar t(“t”,“t”,-10,30) ;

// Construct landau(t,ml,sl) ;
RooRealVar ml(“ml”,“mean landau”,5.,-20,20) ;
RooRealVar sl(“sl”,“sigma landau”,1,0.1,10) ;
RooLandau landau(“lx”,“lx”,t,ml,sl) ;

// Construct gauss(t,mg,sg)
RooRealVar mg(“mg”,“mg”,0) ;
RooRealVar sg(“sg”,“sg”,2,0.1,10) ;
RooGaussian gauss(“gauss”,“gauss”,t,mg,sg) ;

// C o n s t r u c t c o n v o l u t i o n p d f
// ---------------------------------------

// Set #bins to be used for FFT sampling to 10000
t.setBins(10000,“cache”) ;

// Construct landau (x) gauss
RooFFTConvPdf lxg(“lxg”,“landau (X) gauss”,t,landau,gauss) ;

// Plot data, landau pdf, landau (X) gauss pdf
RooPlot* frame = t.frame(Title(“landau (x) gauss convolution”)) ;
lxg.plotOn(frame) ;
landau.plotOn(frame,LineStyle(kDashed)) ;

// Draw frame on canvas
new TCanvas(“rf208_convolution”,“rf208_convolution”,600,600) ;
frame->Draw() ;

}

////////////////////////////////////////////////////////////////////////////////////////////////////
// modified code of rf208_convolution.C with different mean of Landau
////////////////////////////////////////////////////////////////////////////////////////////////////

#ifndef CINT
#include “RooGlobalFunc.h”
#endif
#include “RooRealVar.h”
#include “RooDataSet.h”
#include “RooGaussian.h”
#include “RooLandau.h”
#include “RooFFTConvPdf.h”
#include “RooPlot.h”
#include “TCanvas.h”
#include "TH1.h"
using namespace RooFit ;

void rf208_convolution()
{
// S e t u p c o m p o n e n t p d f s
// ---------------------------------------

// Construct observable
RooRealVar t(“t”,“t”,60,120) ;

// Construct landau(t,ml,sl) ;
RooRealVar ml(“ml”,“mean landau”,95.,90,100) ;
RooRealVar sl(“sl”,“sigma landau”,1,0.1,10) ;
RooLandau landau(“lx”,“lx”,t,ml,sl) ;

// Construct gauss(t,mg,sg)
RooRealVar mg(“mg”,“mg”,0) ;
RooRealVar sg(“sg”,“sg”,0.2,0.1,10) ;
RooGaussian gauss(“gauss”,“gauss”,t,mg,sg) ;

// C o n s t r u c t c o n v o l u t i o n p d f
// ---------------------------------------

// Set #bins to be used for FFT sampling to 10000
t.setBins(10000,“cache”) ;

// Construct landau (x) gauss
RooFFTConvPdf lxg(“lxg”,“landau (X) gauss”,t,landau,gauss) ;

// Plot data, landau pdf, landau (X) gauss pdf
RooPlot* frame = t.frame(Title(“landau (x) gauss convolution”)) ;
lxg.plotOn(frame) ;
landau.plotOn(frame,LineStyle(kDashed)) ;

// Draw frame on canvas
new TCanvas(“rf208_convolution”,“rf208_convolution”,600,600) ;
frame->Draw() ;

}[/code]