Example to use chi2 test for comparing two histograms One unweighted histogram is compared with a weighted histogram.
The normalized residuals are retrieved and plotted in a simple graph. The QQ plot of the normalized residual using the normal distribution is also plotted.
Processing /builddir/build/BUILD/root-6.12.06/tutorials/math/chi2test.C...
Chi2 = 21.085124, Prob = 0.332116, NDF = 19, igood = 1
(TCanvas *) 0x558cac6975d0
{
for (
Int_t i=0; i<
n; i++)
x[i]= 4.+i*12./20.+12./40.;
resgr->
SetTitle(
"Normalized Residuals");
TF1 *f =
new TF1(
"f",
"TMath::Gaus(x,0,1)",-10,10);
qqplot->
SetTitle(
"Q-Q plot of Normalized Residuals");
}
- Author
- Nikolai Gagunashvili, Daniel Haertl, Lorenzo Moneta
Definition in file chi2test.C.