Fitting two peaks alongs with the background

I am trying to fit two peaks and close to each others (channels 23 and 26),
with the help I could write the fitting function as gaussian and polynomials.
but still the fitting does not work perfectly.
I have wrote this fitting function. and the fitting result is attached. I tried to change the fitting edges but it is getting worse.
any assistance please.

 TF1 *doublegaus= new TF1("doublegaus", "gaus(0) + gaus(3) + pol1(6)", 21., 27.);
        doublegaus->SetParameter(0, 1000);           //constant1
        doublegaus->SetParameter(1, 23);              //main1
        doublegaus->SetParameter(2, 0.5);               //sigma1
        doublegaus->SetParameter(3, 700);             //constant2
        doublegaus->SetParameter(4, 26);              //main2
        doublegaus->SetParameter(5, 0.5);           //sigma2
        doublegaus->SetParameter(6, 0);             //BG
        doublegaus->SetParameter(7, 1000);           //BG

fitting_cd.pdf (14.2 KB)

Please read tips for efficient and successful posting and posting code

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


TF1 *doublegaus = new TF1("doublegaus", "gausn(0) + gausn(3) + pol1(6)", 20., 29.);
// doublegaus->Print();

doublegaus->SetParameter(0, 17000.); // area1
doublegaus->SetParameter(1, 22.5); // mean1
doublegaus->SetParameter(2, 0.5); // sigma1

doublegaus->SetParameter(3, 5000.); // area2
doublegaus->SetParameter(4, 26.); // mean2
doublegaus->SetParameter(5, 0.5); // sigma2

doublegaus->SetParameter(6, 1000.); // constant
doublegaus->SetParameter(7, 0.); // slope

h2_calibrated->Fit(doublegaus, "IR0");

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