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");
Cd->Draw("E");
Double_t par[10];
TF1 *g = new TF1("g","gaus",10e3,70e3);
//g->FixParameter(0,1590);
Cd->Fit(g,"R");
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?
An
Please read tips for efficient and successful posting and posting code
ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided