It is not necessary in order to know the width.
Scaling the area of the function g so that is equal to 1 gives you the correct amplitude for the function f before the effect of the resolution.
In line 16 could have been done using “TMath::Gaus(x, 0 ,3.5,kTRUE)” instead of “gaus”. You can do it and change a bit the code to remove the FixParameter related to g function.
The reason is that you have drawn h1 in both in c1->cd(1) and c1->cd(2). So when you fit h1 the function is drawn on both the pads.
So I modified the code a bit. Since we are now able to decompose the distribution without the effect of resolution using the function f_no_res (which we convert into a histogram and obtain the original widths without resolution).
Now I try to fit the f_no_res histogram using the 3 Gaussian function as
I was interested in calculating the area of the Gaussian functions used for fitting. What I see is that the fit parameters in cd(2) and cd(3) (see figure )are different even though we use the same function f_no_res. Is this normal ? Also the value of the integral is also different.
It is an easy fix.
The Gaussian in f_conv and f_no_res do not have the 0.5 in the definition while f12, f11, f122 and f13 have the 0.5 in the definition.
Add the 0.5 in f_conv and f_no_res and everything will works.
Replace the (46.,130.) range with (40.,140.) everywhere and I suggest you also to fit the functions with option “MEL” since the Likelihood Method is better in fitting histograms. Especially in taking care of bins with 0 counts .
Below my results and here the macro modified Re_Smear_3gauss.c (5.2 KB)