How to fit 2 gaussian curves into a single plot

I want to fit 2 gaussian into this plot. I tried fit function. It looked like this.

Then I decreased the limit of fit made it from 0 to 0.5 and it looked like this

I want 2 humps like this in my plot. But I can only get one even if I tried using 2 gaussian fit. Here’s my code

void c1()
{

TCanvas *c1 = new TCanvas("c1", "Canvas", 2000, 1000);

TGraph *gr = new TGraph("36S_10.dat");

TF1 *f1 = new TF1("f1", "gaus", 0, 0.5);
gr->Fit("f1", "R");

TF1 *f2 = new TF1("f2", "gaus", 0.5, 1);
gr->Fit("f2", "R");

gr->Draw();	

}

Can anybody help me to add 2 gaussians to same plot. Huge thanks in advance

TF1 *f = new TF1("f", "gaus(0) + gaus(3)", 0.2, 0.8); f->Print();
f->SetParameters(5., 0.4, 0.03, 5., 0.6, 0.03); f->Draw();
TF1 *f = new TF1("f", "gaus(0) + gaus(3) + gaus(6)", 0.2, 0.8); f->Print();
f->SetParameters(5., 0.4, 0.03, 2., 0.5, 0.03, 5., 0.6, 0.03); f->Draw();

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