Getting the value of a convolution at a certain x

Hi,

i convoluted two functions ( a crystal ball and a breit wigner) and trying two evaluate the value of the convolution at a certain x.
However this doesnt seem to be possible directly, which is why i trying to create a TF1 object, where it is:

[code] TF1 * f_crystal = new TF1(“f_crystal”,minuithelper,&MinuitHelper::crystalball,0,250,4,“MinuitHelper”,“crystallball”);
f_crystal->SetParameters(par_cr);
TF1 * f_wigner = new TF1(“f_wigner”,minuithelper,&MinuitHelper::breitwigner,0,250,2,“MinuitHelper”,“breitwigner”);
f_wigner->SetParameters(par_bw);
//Convoulte them:
TF1Convolution *f_conv = new TF1Convolution(f_crystal,f_wigner,0,250);
//Get value at x:
TF1 *f = new TF1(“f”,*f_conv, 0., 250., f_conv->GetNpar());
f->SetParameters(cr_alpha, cr_n, cr_sigma, cr_mean, bw_gamma, bw_x0);

double cr_bw = f->Eval(xx);[/code]

(I had some problems when I started, which is why I redefined the pdfs in my MinuitHelper class instead of using the ones from ROOT::math, i just copied them from there, they are working fine. anyways the problem is the convolution)

somehow this is not really working (but compiling), the process just gets killed after a while. I am also not sure if i hand in the parameters the right way when i define this f Object.

The best would be just to have an analytical expression of the convolution anyways, since i need it inside a fit, does anybody has something like this?
I am not using roofit here, i made my own fit by minimizing a likelihood function via TMinuit (that is why I need a value of the function, i need to evaluate the likelihood in a certain bin.)
However, if there isnt a solution for this, i’ll have to switch to roofit…

Cheers

Elias

Hi,

What you are doing seems fine to me. If I have understood you well, you are saying that your code crashes after a while. Can you maybe send me in this case your running macro, so I can investigate the problem ?

Cheers

Lorenzo

Hi Lorenzo,

I tried to close this topic, since I already found the error.
The problem was just that i redefined the convolution function inside a loop, which led to massive resource consumption.

Cheers

Elias