How can i make a fitting better?

Hi experts.
After fitting the histogram, the chi2/ndf value came out too large, so I want to improve the fitting results more, but I don’t know what to do.

Below pic is the result of my fitting.

I think this fitting is not bad, but chi2/ndf is too big.

Chi2 =723.111
ndf = 3
Chi2/ndf = 241.037

And this is the code i used.

void cal()
  TCanvas *e = new TCanvas("e","e",1200,800);

  TFile *f = new TFile("qc5_Cd.root");
  TH1F *Cd_new = new TH1F("Cd_new","Cd_new",100,0,600e3);
  TH1F *Cd = (TH1F*)f->Get("Cd");

  Double_t par[10];

  TF1 *g = new TF1("g","gaus",10e3,70e3);

  auto fitresult = Cd->Fit(g,"S","",10e3,70e3);

  double chi2 = fitresult -> MinFcnValue();
  printf("Chi2 =%g\n",chi2);

  double ndf = fitresult -> Ndf();
  printf("ndf = %g\n",ndf);

  cout<<"Chi2/ndf = "<< chi2/ndf << endl;

  Double_t Cd_cal = 88/(g->GetParameter(1));

  cout<<"Cd cal: " << Cd_cal << endl;


How can i improve it?


Please read tips for efficient and successful posting and posting code

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

The bins of your histogram are pretty broad (as compared to the peak’s width), so you should add the “I” fit option.

Also, there is a quite significant “bump” on the left side of the peak, so you could maybe add a “model” for it to your fit function.

Thanks it really help!

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