Roofit: Fitting a convoluted function to real data

My goal is to construct a function to fit the number of counts in a particular experimental peak.

This function is written in terms of a “signal” component and a “background” component, which has the form of a Breit Wigner tail. (I build the resulting “total” function using RooAddPdf).

I then want to convolute this function (using RooFFTConvPdf) with a Gaussian representing my detector resolution to obtain a “fit” function, which I use to fit the peak.

This fitting is successful if I use in-built functions (RooGaussian and RooBrietWigner) for my “total” function but if I try to use a custom function that I build using RooGenericPdf:

e.g.
RooRealVar mean1(“mean1”,“mean1”,5050) ;
RooRealVar width1(“width1”,“width1”,300.0) ;
RooRealVar wg1(“wg”,“wg”, 10) ;
RooGenericPdf BW1(“BW1”,“BW1”,“wg1*(width1/((x-5050)(x-5050)+((width1/2)(width1 /2)))”,RooArgSet(x,mean1,width1,wg1));

then I get the following error message:

ERROR:Eval – RooFormula::eval(BW1): Formula doesn’t compile: wg1*(width1/((x-5050)(x-5050)+((width1/2)(width1/2)))

Does anyone know what the problem might be? for instance, does RooFFTConvPdf not support the use of generic pdf?

The reason that I need to build my own BrietWigner function in this case is so that I can correctly simulate the contribution its tail makes to my fit - if I were to use the in-built BrietWigner shape I don’t think I can define the height of this function (effectively resonance strength), which is a fixed parameter for me.

I would greatly appreciate it if anyone could shed some light on this problem.

Many Thanks,
Andrew

I think it doesn’t compile because the variable wg1 needs to be named “wg1.” In the RooGenericPdf, you refer to its name by “wg1” when in its definition it is named “wg”.