# How to use RooDecay in RooClassFactory::makePdf?

Hello,

I just want to try to follow some Tevatron papers and calculate the Mellin Convolution in a simplified way. I guess it would be faster than RooFFTConvPdf here:
http://root.cern.ch/phpBB2/viewtopic.php?t=7603

The convolution “mConv” in [color=brown][ Exp(t|k*tau) fConv Gau(st)] mConv H(k) [/color] is calculated in this way:

where h(k_i) is the i-th bin content, w_i is bin width. The problem is that RooClassFactory::makePdf can only deal with the RooRealVar variables. I also tried to read the source codes of RooDecay. It is not very complicated, and there is a RooResolutionModel. I should admit that I am not familiar with C++ and still haven’t understood the framework there.

I think the format of my Pdf could be something like:

kHist is just the histogram of k factor, decayModel is a RooDecay Pdf. In this case we could also change the Resolution models and so on.

But I don’t know how to write

so that I don’t need to take care of the normalization of [color=brown][Exp(t|k_i*tau) fConv Gau(st)][/color], or just reuse some codes in RooFit so that it can deal with different RooResolutionModel as well.
Could you please give me some hints how to do that (or point me some examples)?

Thanks a lot.

Cheers, Jibo

Hi Jibo,

Class RooDecay is a special class that inherits from RooAbsAnaConvPdf. Classes of this type represent p.d.f.s that can be decomposed in the form

`````` PDF(t) = SUM(i) coef_i * basisFunction_i (t)
``````

and that can be analytically convolved into

`````` PDF(t) (X) RES(t)  = SUM(i) coef_i * ( basisFunction_i(t) (X) RES(t) )
``````

The knowledge on how to calculate ( basisFunction_i(t) (X) RES(t) ) is contained in
the RooResolutionModel implementations. At present only a limited set of combinations
of basis functions and resolution model is supported, which are listed in the RooFit
users guide in the convolutions section.

If your convolution cannot be written in this form, or does not take basis functions and resolution models that are currently supported, you cannot use this framework out of the box.

The RooClassFactory can in any case not be used to create the special p.d.f.s of type RooAbsAnaConvPdf, only regular RooAbsPdf.

Wouter