# RooFFTConvPDF constant to zero

Dear Expert,

I am trying to perform a fit using as model an exponential PDF convoluted with a double gaussian. Here is my code

`````` RooRealVar t_val("t","t",22.15,22.65);
RooRealVar sigma("#sigma","#sigma core",0.015,0.,0.03);
RooRealVar sigma1("#sigma1","#sigma tail",0.2,0.,0.4);
RooRealVar mean("#mu","#mu",22.36,22.35,23.38);
RooRealVar alpha("#alpha","#alpha",-25,-30.,0.);
RooRealVar frac1("fraction1","fraction",0.8,0,1);
RooExponential Expo("Expo","laser flash",t_val,alpha);
RooGaussian Gauss("Gauss","ph distribution",t_val,mean,sigma);
RooGaussian Gauss1("Gauss1","ph distribution",t_val,mean,sigma1);
RooFFTConvPdf conv("conv","convolution",t_val,Expo,Gauss);

RooDataHist jitter_data("data","dataset",t_val,Import(*hdata));
t_val.setBins(10000,"fft");
RooPlot* frame=t_val.frame();
//jitter_data.plotOn(frame);//Normalization(tot_data.numEntries(),RooAbsReal::NumEvent));

sigma.setVal(0.015);
sigma1.setVal(0.2);
mean.setVal(22.36);
alpha.setVal(-25);
frac1.setVal(0.8);
//mean.setConstant();
// sigmaG.setConstant();
//alpha.setConstant();
//RooFitResult *r=conv.fitTo(jitter_data);

conv.plotOn(frame);

frame->Draw();
``````

the problem is not the fit itself, but the fact that when I try to plot just the convolution function, even without fitting, I get a constant PDF with 0 value. I tried to do the convolution with one gaussian and between the two gaussian, but the result is the same. I think I am doing a systematic error I can’t figure out. On the other hand I tested the model with this code

``````RooRealVar dt("dt","dt",22.15,22.65) ;
RooRealVar tau("tau","tau",0.04) ;

//Gaussian model
RooRealVar mean("mean","mean",22.36) ;
RooRealVar sigma("sigma","sigma",0.015) ;
RooRealVar sigma1("sigma1","sigma",0.2) ;
RooRealVar gm1frac("gm1frac","fraction of gm1",0.8);
RooGaussModel gaussm("gaussm","gauss model",dt,mean,sigma) ;
RooGaussModel gaussm1("gaussm1","gauss model",dt,mean,sigma1) ;

RooAddModel gmsum("gmsum","sum of gm1 and gm2",RooArgList(gaussm,gaussm1),gm1frac);
//Create basis function
RooFormulaVar basis("basis","exp(-@0/@1)",RooArgList(dt,tau));
// Construct decay(t) (x) gauss1(t)

RooAbsReal* decayConvGauss=gmsum.convolution(&basis,&basis);

RooPlot* frame1 = dt.frame(Title("Bdecay (x) resolution"));
// Plot p.d.f.
decayConvGauss->plotOn(frame1);
TCanvas *c2=new TCanvas();
frame1->Draw();
``````

and I saw that the curve I want to see is corrected described.

Thanks for helping.

regards,

Eamanuele

Note: I enclosed the “code parts” of your post with triple back quote to make it more readable.

Hi @emarip - we will need our RooFit expert @StephanH to be back from travel to have a good answer! He should be back in a week. Please ping us should you not have received a reply by end of next week. Thanks!

Hi @emarip,

can you plot both the addition of the gaussians and the exponential before the convolution? Maybe the parameters are not chosen correctly.

Hi,
yes I can plot them separately. I fear that the problem is due to the fact that the exponential is practically 0 at the gaussian mean. In this case is it possible to shift the exponential pdf?

thanks

Emanuele

You can shift by not giving x as on observable to exp, but giving `x - a`, where `a` is a constant parameter that denotes the shift strength.

Hello,

thanks. You mean by using a rooformulavar?

regards,

Emanuele

Exactly.

A `RooAddition("name", "title", RooArgList(x, a))` should also work.

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