# RooFit Convolution basic problem

I am having a simple problem of convolving a model with a pdf.

``````void powerlaw()
{
RooRealVar x("x","Energy",0.1,20) ; // use x, if E - > bad expression name
RooRealVar G("G","slope",-2,-4,-1) ;
RooRealVar N("N","normalisation",1e-12,1e-13,1e-11) ;
RooFormulaVar flux("flux","N*pow(x,G)",RooArgSet(N,x,G)) ;
RooRealVar a0("a0","a0",4.73968) ;
RooRealVar a1("a1","a1",0.329175) ;
RooRealVar a2("a2","a2",-0.129551) ;
RooRealVar a3("a3","a3",-0.463194) ;
RooRealVar a4("a4","a4",-0.0861036) ;
RooRealVar a5("a5","a5", 1.02192) ;
RooRealVar a6("a6","a6",-0.614789) ;
RooRealVar a7("a7","a7",-0.155646) ;
RooRealVar a8("a8","a8",0.208511) ;
RooRealVar a9("a9","a9",-0.0434517) ;
RooGenericPdf area("area","Effective Area","pow(10,a0)*pow(x,a1)*pow(x,a2*log10(x))*pow(x,a3*log10(x)*log10(x))*pow(x,a4*pow(log10(x),3))*pow(x,a5*pow(log10(x),4))*pow(x,a6*pow(log10(x),5))*pow(x,a7*pow(log10(x),6))",RooArgSet(a0,x,a1,a2,a3,a4,a5,a6,a7)) ;
x.setBins(1000,"cache") ;
RooFFTConvPdf lxa("lxa","flux (X) area",x,flux,area) ;
RooDataSet* data = lxa.generate(x,10000) ;
lxa.fitTo(*data) ;
RooPlot* frame = x.frame(Title("Flux")) ;
RooPlot* frame1 = x.frame(Title("Area")) ;
RooPlot* frame2 = x.frame(Title("Convolution")) ;
data->plotOn(frame,MarkerColor(kGreen)) ;
flux.plotOn(frame,LineStyle(7),LineWidth(2),LineColor(7)) ;
area.plotOn(frame1,LineStyle(1),LineWidth(2),LineColor(6)) ;
lxa.plotOn(frame2,LineWidth(2),LineColor(4)) ;
TCanvas* m = new TCanvas("convolution","convolution",1200,600) ;
m->Divide(2);
m->cd(1);
frame->Draw() ;
``Error: Can't call RooFFTConvPdf::RooFFTConvPdf("lxa","flux (X) area",x,flux,area) in current scope powerlaw.C:32:``