Dear All,
I am fitting a distribution which seems to be a sum of two Gaussians with both their means close to zero and simgas different. Unlike $ROOTSYS/tutorials/multifit.C, the ranges of these two distributions are not different. I tried the following:
//h1 is the total histogram; h1 is the signal and h2 is the background
double par[6];
TF1 *G1 = new TF1 ("G1","gaus",-3.0,3.0);
TF1 *G2 = new TF1 ("G2","gaus",-3.0,3.0);
//G1->FixParameter(1,0.0);
h2->Fit(G1,"R");
h3->Fit(G2,"R");
G1->GetParameters(&par[0]);
G2->GetParameters(&par[3]);
TF1 *f = new TF1 ("f","gaus(0)+gaus(3)",-3.0,3.0);
f->SetParameters(par);
h1->Fit(f,"R");
f->SetLineColor(2);
// 6 parameters of the fit: (p0 to p5)
double Ncons = f->GetParameter(0);
double Gmean= f->GetParameter(1);
double Gwdth = f->GetParameter(2);
Usually I see that the fit âfâ has very good chi square/ndf and the sigma (p2) is slightly less than each of the distributions. However, occassionally I am getting the sigma to be grossly overestimated ~ sum of individual sigmas of G1 and G2. I found by searching that it might help to fix a certain fit parameter of G1/G2. I tried that as well, but it did not help.
I do not really understand if I am reading off the right parameters. Can anyone please tell me if I am making some mistake? Thanks in advance,
-Regards,
Kolahal