Question regarding multifit of gaussians

I fitted a curve using 3 Gaussian. At x = 100, the individual values of the three fitted Gaussians are 951.3, 1714, and 4.6, respectively. Surprisingly, when I add these values at x = 100 (951.3 + 1714 + 4.6), it doesn’t match the total fitted Gaussian value at that same point, which is 1816.34 as shown in the figure.

Is my fit correct, or have I overlooked something in the process? I apologise if this is a basic question and I’m not sure if this is the appropriate platform for such questions. Any help will be really appreciated. For further clarification, I’ve attached the macro file below.

data_2.C (2.6 KB)

Hi @Shiva_Prasad_Nayak,
thanks for reaching out!
Maybe @jonas can help with this.

Cheers,
Monica

Hi @Shiva_Prasad_Nayak,

nothing to worry about, your fit is completely fine!

It’s just that your individually fitted Gaussians are completely incomparable with the total fit. Yes, you are fitting them in different ranges as I see in the script, but still the tails of the Gaussian in one range interfere with the other ranges, resulting in different parameters for the 3 Gaussians if you fit all at the same time.

If you set the parameters of the individual Gaussians to the same parameters as obtained by the total fit, you will see what I mean:

    // after total->Fit():

    // Set the parameters of the individual functions to the values from the
    // total fit
    for (int i = 0; i < 3; ++i) {
       fit1->SetParameter(i, total->GetParameter(i));
       fit2->SetParameter(i, total->GetParameter(i + 3));
       fit3->SetParameter(i, total->GetParameter(i + 6));
    }

See, the Gaussians left and right have different parameters in the total fit because they have to “make room” for the central Gaussian.

Cheers,
Jonas

1 Like

Couldn’t thank you enough, @jonas! It was incredibly helpful, and I genuinely appreciate your expertise in this field.