# Convolution of 2 functions

Hello,

I would like to fit a distribution with a gaus*landau convolution function. I had a look at the root tutorial \$ROOTSYS/tutorials/langaus.C, but to tell you the truth it didn’t help me much. So below are some questions which may make things somehow clearer…

1. why we have to shift the MV of the Landau by hand (in the tutorial script)?
2. We cannot simply convolute 2 ROOT functions as gauss and landau by just typing

``` TF1 *convolutionLandauGaus = new TF1("convolutionLandauGaus","gaus*landau",0,60);```
3. I tried 2, but it gave me different reults compared to those I got running the langaus.C (of course I applied the 2 different fits in the same histogram…)

cheers,
loukas

Hello,

As explained in root.cern.ch/root/htmldoc/TMath. … ath:Landau
when using TMath::Landau the maximum of the distribution is in reality shifted with respect to the location parameter passed in the TMath::Landau function. So, if in your fit you want the MPV as parameter you have to shift it by hand.

Concerning the convolution of functions, this is not implemented directly in ROOT for TF1 objects.
We could maybe implement this at some point, but we cannot use simply the
operator"*", since this represents the product of the two function values.

The alternative now to doing yourself as in langaus.C, is to use RooFit, which supports convolution between distributions (pdf). See as example the tutorials tutorials/roofit/rf208_convolution.C

Best Regards

Lorenzo

cannot simply use the “*” operator. This performs a

Hi Lorenzo,

Thanks, I was not aware of the Landau MPV “shift” …

It’s more than clear… I was misled by the mathematical definition of the convolution of 2 functions (f*g)(x) (or I wished it was like that easy…)

best regards,
loukas