Home | News | Documentation | Download

Help with peak fit

I am trying to fit an alpha peak in my histogram, but the peak is asymmetrical and I don’t know what to do. I was thinking on doing a convolution of a gaussian and a lorentzian, but that is just a voigt function and I cannot get it to work either.
If it would be better to do just a sum, is it possible to sum an user defined Lorentzian with a TF1"gaus" fit?
Here’s part of the code in question:

  //Lorentzian Function
  TF1 *l1 = new TF1("l1","(1*[2]/(TMath::Pi()*2))*((TMath::Power([0],2))/(TMath::Power(x-[1],2)+TMath::Power([0],2)))",Pi,Pf);

  TF1Convolution *f_conv = new TF1Convolution("m1","l1",Pi,Pf,true);
  //TF1   *f = new TF1("f",*f_conv, Pi, Pf, f_conv->GetNpar());

  //Actual Voigt
  TF1 *f = new TF1("f","[0] * TMath::Voigt(x, [1], [2], 4)",Pi,Pf);

and here’s the full code:
alpha1.C (4.1 KB)

Whenever I fit the gaussian and the lorentzian separately I get an ok fit and a converged fit, but neither look “nice”.
2.pdf (17.5 KB)

Now, when I try the convolution it simply fails:
1.pdf (16.5 KB)

What can i do to improve the fit of the big peak? and finally, the whole thing (the smaller peaks and the tail to the right)?


Hello @JorgeM,

what you need is indeed the sum of a couple of distributions. Depending on whether the detector resolution dominates, a Voigt is a good start. A Gaussian might work for the smaller peak. I’m not sure about the background, though.

When fits get complicated, there is the option to use RooFit, as it allows you to build more complex models. Have a look at the RooFit tutorials, particularly at rf101 for the basics and rf201 for a sum of distributions.

Here’s a list of distributions that RooFit supports:
Voigt and Gauss are obviously part of this list. :slight_smile: