Dear Experts,
I’m trying to fit my distribution with a non-built-in ROOT function, but I have noticed that the parameter values I set are too large and the Chi-squared value I obtained is too small. I’m unsure if this makes sense or not. Could you please provide me with a solution for this? Here is my macro :
Fit_Resolution.cc (979 Bytes)
couet
August 29, 2024, 7:35am
2
Using errors bars on Y helps.
double Polynomial(double *x, double *p) {
double pt = x[0];
double r1 = p[0];
double r2 = p[1];
double r3 = p[2];
return ((r1 / pt) + r2 + r3 * pt);
}
void Fit_Resolution() {
double pt[] = {20, 40, 60, 80, 100, 120, 150};
double sigma_p[] = {0.0213361, 0.0225363, 0.0250548, 0.0280364, 0.0310096, 0.0295183, 0.0400554};
double ptErr[7] = {0};
double sigma_pErr[7] = {0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001};
auto graph = new TGraphErrors(7, pt, sigma_p, ptErr, sigma_pErr);
auto fitDSCB = new TF1("fitDSCB", Polynomial, 20, 160, 3);
graph->Fit(fitDSCB, "S");
graph->SetMarkerStyle(20);
graph->SetMarkerColor(kBlue);
graph->Draw("AP");
fitDSCB->Draw("same");
}
Processing Fit_Resolution.cc...
****************************************
Minimizer is Minuit2 / Migrad
Chi2 = 20.2449
NDf = 4
Edm = 1.2801e-19
NCalls = 62
p0 = 0.0958795 +/- 0.0501049
p1 = 0.0135572 +/- 0.00223064
p2 = 0.000158354 +/- 1.67148e-05
system
Closed
September 12, 2024, 12:58pm
4
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.