# Two gaussian for single peak

__

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided

Dear Rooters,
I am trying to fit a Gaussian peak so I can calculate the area under the peak.
when I choose the single Gaussian fitting function, it did not fit perfectly (Black, dot-like line), so I choose to fit the single peak with double Gaussian function (red line).

TF1 *gaus= new TF1(“gaus”,"[0]exp(-0.5((x-[1])/[2])**2)",10000,16500);

gaus->SetParameter(0,40000);
gaus->SetParameter(1,13000);
gaus->SetParameter(2,800);
h_e_ch2 ->Fit(“gaus”,“XR”);
gaus->SetLineColor(1);
gaus->SetLineStyle(2);
gaus->Draw(“same”);

TF1 *doublegaus= new TF1(“doublegaus”,"[0]exp(-0.5((x-[1])/[2])**2)+ [3]exp(-0.5((x-[4])/[5])**2)",10000,16500);

doublegaus->SetParameter(0,30000);
doublegaus->SetParameter(1,13000);
doublegaus->SetParameter(2,100);
doublegaus->SetParameter(3,30000);
doublegaus->SetParameter(4,13000);
doublegaus->SetParameter(5,100);
h_e_ch2 ->Fit(“doublegaus”,“XR”);

• It fit perfectly.
• values of standard deviation less than zero, how could this be??
-How can I estimate the area under the peak (single peak +6 parameters) from such function?
DOUBLEGAUSE.pdf (23.3 KB)

thank you

Hi,

are you sure that the fit converged?

Cheers,
D

yes it is, Herein the fit data

FCN=1866.67 FROM MIGRAD STATUS=CONVERGED 718 CALLS 719 TOTAL
EDM=6.25267e-07 STRATEGY= 1 ERROR MATRIX UNCERTAINTY 2.4 per cent
EXT PARAMETER STEP FIRST
NO. NAME VALUE ERROR SIZE DERIVATIVE
1 p0 5.01542e+02 6.47096e+00 -2.44286e-02 5.51618e-04
2 p1 1.35319e+04 3.58552e+00 3.69064e-02 -8.43591e-05
3 p2 -1.15736e+03 4.97603e+00 -3.81730e-03 -2.13578e-04
4 p3 1.42796e+03 7.39325e+00 -4.07391e-04 2.16800e-04
5 p4 1.33932e+04 1.83863e+00 8.25332e-03 4.33176e-04
6 p5 -4.66763e+02 2.34736e+00 -1.29875e-02 -9.45711e-04

as you see P2&P5 are less than zero,

Hi,

but the error is compensating for that, right?

Cheers,
D

I don’t get it, How could the error compensate the value??

and I am confuse about how this function can describe the peak
what these parameters refer to??
if Sigma still the width at Half maximum, it can not be less than zero??
and how I can calculate the area under the peak using these parameters??

Hi,
MINUIT (MIGRAD) does function minimization,
it does not know about gaussians, sigma etc.
In your function P2 and P5 (which y o u call sigma) only appear
squared, so the function does n o t depend on their sign.
If you include sigma in the normalization thats different:

``````G(x) = (c / s * sqrt(2*pi)) * exp ( -0.5 * [(x-m)/s]^2 )
``````

To get the area under your fitted function you can use:

``````doublegaus->Integral(0,20000);
``````

To compare with your entries carefully think about normalization!

Cheers
Otto

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.