Problem of draw fit result

Hi,

I ran into a problem that I haven’t encountered before. I have a histogram and fit function, which I fit histogram:

TCanvas* c1 = new TCanvas("Window 1", "Masses", 20, 20, 600, 600);
...
TH1D* mass_D = new TH1D("m_D","Mass D^{#pm};m_{D^{#pm}}, GeV", 70, 1.86966 - 0.016, 1.86966 + 0.016);
...
TF1* f1 = new TF1("f1","gausn(0) + pol1(3)", 1.86966 - 0.016, 1.86966 + 0.016);
  
f1->SetParameter(0, 8.5);       //f1->SetParLimits(0, 0, 1000);   //f1->FixParameter(0, 8);
f1->SetParameter(1, 1.186966);  //f1->FixParameter(1, 1.186966);
f1->SetParameter(2, 0.007);     //f1->FixParameter(2, 0.007);
f1->SetParameter(3, 70);        //f1->FixParameter(3, 0);
f1->SetParameter(4, 280);
  
mass_D->Fit(f1);
  
c1->cd();
mass_D->Draw();

I get a normal rusalts o fitting:
image

But root print onle pol1 part:

I can’t undersend why. I tried fix some parameters and this didn’t help.


Please read tips for efficient and successful posting and posting code

ROOT Version: 6.26/06
Platform: Ubuntu 22.04.1 LTS
Compiler: Not Provided


You need better initial values, e.g.: f1->SetParameters(10., 1.87, 0.004, 120., 0.);

Yes…
I accidentally added one after the dot in the second parameter…
Thank you!

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