Problem Fitting a histogram

Hello,
I’m trying to fit a histogram with my own function (which in fact is just a convolution of a gaussian and an exponential.)
I was able able to fit the same histogram with other functions of my own but here I just get some very bad result.
Here is my code :

[code]TF1 myfit = new TF1(“myfit”,"[0]exp([1](0.5[1][2][2]-1.*x-[3]))",100,3500);

myfit->SetParName(0,"K");
myfit->SetParName(1,"lambda");
myfit->SetParName(2,"sigma");
myfit->SetParName(3,"mu") ;


myfit->SetParameter(0,1.) ;
myfit->SetParameter(1, 0) ;
myfit->SetParameter(2,2) ;
myfit->SetParameter(3,0.00001) ;


 Histo>Draw("");
Histo->Fit("myfit","","",400,3000);

[/code]
Does anyone have an idea about what I’m doing wrong ?
Thank you in advance !

Hi,

I would check your function definition. It does not look right at a first sight. I would try also to plot it with your initial parameter value

Lorenzo