{
"cells": [
{
"cell_type": "markdown",
"id": "ca8fc493",
"metadata": {},
"source": [
"# goftest\n",
"Example showing usage of goodness of fit tests.\n",
"\n",
"Using Anderson-Darling and Kolmogorov-Smirnov goodness of fit tests,\n",
"1st sample test is performed comparing data with a log-normal distribution\n",
"and a 2nd sample test is done comparing two gaussian data sets.\n",
"\n",
"\n",
"\n",
"\n",
"**Author:** Bartolomeu Rabacal \n",
"This notebook tutorial was automatically generated with ROOTBOOK-izer from the macro found in the ROOT repository on Tuesday, May 19, 2026 at 08:25 PM."
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "24379811",
"metadata": {
"collapsed": false,
"execution": {
"iopub.execute_input": "2026-05-19T20:25:30.854305Z",
"iopub.status.busy": "2026-05-19T20:25:30.854126Z",
"iopub.status.idle": "2026-05-19T20:25:30.861547Z",
"shell.execute_reply": "2026-05-19T20:25:30.860904Z"
}
},
"outputs": [],
"source": [
"%%cpp -d\n",
"#include \n",
"#include \"TCanvas.h\"\n",
"#include \"TPaveText.h\"\n",
"#include \"TH1.h\"\n",
"#include \"TF1.h\"\n",
"#include \"Math/GoFTest.h\"\n",
"#include \"Math/Functor.h\"\n",
"#include \"TRandom3.h\"\n",
"#include \"Math/DistFunc.h\""
]
},
{
"cell_type": "markdown",
"id": "22ae87b3",
"metadata": {},
"source": [
" need to use Functor1D\n",
" "
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "366d4041",
"metadata": {
"collapsed": false,
"execution": {
"iopub.execute_input": "2026-05-19T20:25:30.863190Z",
"iopub.status.busy": "2026-05-19T20:25:30.863009Z",
"iopub.status.idle": "2026-05-19T20:25:30.866746Z",
"shell.execute_reply": "2026-05-19T20:25:30.866034Z"
}
},
"outputs": [],
"source": [
"%%cpp -d\n",
"double landau(double x) {\n",
" return ROOT::Math::landau_pdf(x);\n",
"}"
]
},
{
"cell_type": "markdown",
"id": "14f0cddc",
"metadata": {},
"source": [
"------------------------------------------------------------------------\n",
"Case 1: Create logNormal random sample"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "7279ec3e",
"metadata": {
"collapsed": false,
"execution": {
"iopub.execute_input": "2026-05-19T20:25:30.868192Z",
"iopub.status.busy": "2026-05-19T20:25:30.868027Z",
"iopub.status.idle": "2026-05-19T20:25:31.200127Z",
"shell.execute_reply": "2026-05-19T20:25:31.199524Z"
}
},
"outputs": [],
"source": [
"UInt_t nEvents1 = 1000;"
]
},
{
"cell_type": "markdown",
"id": "04c36fa9",
"metadata": {},
"source": [
"ROOT::Math::Random r;"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "056bc544",
"metadata": {
"collapsed": false,
"execution": {
"iopub.execute_input": "2026-05-19T20:25:31.202280Z",
"iopub.status.busy": "2026-05-19T20:25:31.202159Z",
"iopub.status.idle": "2026-05-19T20:25:31.416272Z",
"shell.execute_reply": "2026-05-19T20:25:31.415555Z"
}
},
"outputs": [],
"source": [
"TF1 * f1 = new TF1(\"logNormal\",\"ROOT::Math::lognormal_pdf(x,[0],[1])\",0,500);"
]
},
{
"cell_type": "markdown",
"id": "bf111c83",
"metadata": {},
"source": [
"set the lognormal parameters (m and s)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "cce382ed",
"metadata": {
"collapsed": false,
"execution": {
"iopub.execute_input": "2026-05-19T20:25:31.418162Z",
"iopub.status.busy": "2026-05-19T20:25:31.418041Z",
"iopub.status.idle": "2026-05-19T20:25:31.620404Z",
"shell.execute_reply": "2026-05-19T20:25:31.619755Z"
}
},
"outputs": [],
"source": [
"f1->SetParameters(4.0,1.0);\n",
"f1->SetNpx(1000);\n",
"\n",
"\n",
"Double_t* sample1 = new Double_t[nEvents1];\n",
"\n",
"TH1D* h1smp = new TH1D(\"h1smp\", \"LogNormal distribution histogram\", 100, 0, 500);\n",
"h1smp->SetStats(kFALSE);\n",
"\n",
"for (UInt_t i = 0; i < nEvents1; ++i) {\n",
" //Double_t data = f1->GetRandom();\n",
" Double_t data = gRandom->Gaus(4,1);\n",
" data = TMath::Exp(data);\n",
" sample1[i] = data;\n",
" h1smp->Fill(data);\n",
"}"
]
},
{
"cell_type": "markdown",
"id": "9a6f435b",
"metadata": {},
"source": [
"normalize correctly the histogram using the entries inside"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "fd198e80",
"metadata": {
"collapsed": false,
"execution": {
"iopub.execute_input": "2026-05-19T20:25:31.622314Z",
"iopub.status.busy": "2026-05-19T20:25:31.622194Z",
"iopub.status.idle": "2026-05-19T20:25:31.826984Z",
"shell.execute_reply": "2026-05-19T20:25:31.826280Z"
}
},
"outputs": [],
"source": [
"h1smp->Scale( ROOT::Math::lognormal_cdf(500.,4.,1) / nEvents1, \"width\");\n",
"\n",
"TCanvas* c = new TCanvas(\"c\",\"1-Sample and 2-Samples GoF Tests\");\n",
"c->Divide(1, 2);\n",
"TPad * pad = (TPad *)c->cd(1);\n",
"h1smp->Draw();\n",
"h1smp->SetLineColor(kBlue);\n",
"pad->SetLogy();\n",
"f1->SetNpx(100); // use same points as histo for drawing\n",
"f1->SetLineColor(kRed);\n",
"f1->Draw(\"SAME\");"
]
},
{
"cell_type": "markdown",
"id": "57a6ad0e",
"metadata": {},
"source": [
"-----------------------------------------\n",
"Create GoFTest object"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "33f91010",
"metadata": {
"collapsed": false,
"execution": {
"iopub.execute_input": "2026-05-19T20:25:31.829079Z",
"iopub.status.busy": "2026-05-19T20:25:31.828966Z",
"iopub.status.idle": "2026-05-19T20:25:32.035521Z",
"shell.execute_reply": "2026-05-19T20:25:32.034999Z"
}
},
"outputs": [],
"source": [
"ROOT::Math::GoFTest* goftest_1 = new ROOT::Math::GoFTest(nEvents1, sample1, ROOT::Math::GoFTest::kLogNormal);"
]
},
{
"cell_type": "markdown",
"id": "f21146ae",
"metadata": {},
"source": [
"----------------------------------------------------\n",
"Possible calls for the Anderson - DarlingTest test\n",
"a) Returning the Anderson-Darling standardized test statistic"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "f19c203c",
"metadata": {
"collapsed": false,
"execution": {
"iopub.execute_input": "2026-05-19T20:25:32.037687Z",
"iopub.status.busy": "2026-05-19T20:25:32.037549Z",
"iopub.status.idle": "2026-05-19T20:25:32.244100Z",
"shell.execute_reply": "2026-05-19T20:25:32.243536Z"
}
},
"outputs": [],
"source": [
"Double_t A2_1 = goftest_1-> AndersonDarlingTest(\"t\");\n",
"Double_t A2_2 = (*goftest_1)(ROOT::Math::GoFTest::kAD, \"t\");\n",
"assert(A2_1 == A2_2);"
]
},
{
"cell_type": "markdown",
"id": "450f55fa",
"metadata": {},
"source": [
"b) Returning the p-value for the Anderson-Darling test statistic"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "fda85723",
"metadata": {
"collapsed": false,
"execution": {
"iopub.execute_input": "2026-05-19T20:25:32.246262Z",
"iopub.status.busy": "2026-05-19T20:25:32.246150Z",
"iopub.status.idle": "2026-05-19T20:25:32.452644Z",
"shell.execute_reply": "2026-05-19T20:25:32.452079Z"
}
},
"outputs": [],
"source": [
"Double_t pvalueAD_1 = goftest_1-> AndersonDarlingTest(); // p-value is the default choice\n",
"Double_t pvalueAD_2 = (*goftest_1)(); // p-value and Anderson - Darling Test are the default choices\n",
"assert(pvalueAD_1 == pvalueAD_2);"
]
},
{
"cell_type": "markdown",
"id": "916a8b64",
"metadata": {},
"source": [
"Rebuild the test using the default 1-sample constructor"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "873fe5fc",
"metadata": {
"collapsed": false,
"execution": {
"iopub.execute_input": "2026-05-19T20:25:32.454857Z",
"iopub.status.busy": "2026-05-19T20:25:32.454730Z",
"iopub.status.idle": "2026-05-19T20:25:32.661357Z",
"shell.execute_reply": "2026-05-19T20:25:32.660715Z"
}
},
"outputs": [],
"source": [
"delete goftest_1;\n",
"goftest_1 = new ROOT::Math::GoFTest(nEvents1, sample1 ); // User must then input a distribution type option\n",
"goftest_1->SetDistribution(ROOT::Math::GoFTest::kLogNormal);"
]
},
{
"cell_type": "markdown",
"id": "c46a73ba",
"metadata": {},
"source": [
"--------------------------------------------------\n",
"Possible calls for the Kolmogorov - Smirnov test\n",
"a) Returning the Kolmogorov-Smirnov standardized test statistic"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "2a64d5a2",
"metadata": {
"collapsed": false,
"execution": {
"iopub.execute_input": "2026-05-19T20:25:32.663081Z",
"iopub.status.busy": "2026-05-19T20:25:32.662975Z",
"iopub.status.idle": "2026-05-19T20:25:32.869540Z",
"shell.execute_reply": "2026-05-19T20:25:32.869036Z"
}
},
"outputs": [],
"source": [
"Double_t Dn_1 = goftest_1-> KolmogorovSmirnovTest(\"t\");\n",
"Double_t Dn_2 = (*goftest_1)(ROOT::Math::GoFTest::kKS, \"t\");\n",
"assert(Dn_1 == Dn_2);"
]
},
{
"cell_type": "markdown",
"id": "3bbd0bdb",
"metadata": {},
"source": [
"b) Returning the p-value for the Kolmogorov-Smirnov test statistic"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "92557273",
"metadata": {
"collapsed": false,
"execution": {
"iopub.execute_input": "2026-05-19T20:25:32.871567Z",
"iopub.status.busy": "2026-05-19T20:25:32.871450Z",
"iopub.status.idle": "2026-05-19T20:25:33.077857Z",
"shell.execute_reply": "2026-05-19T20:25:33.077377Z"
}
},
"outputs": [],
"source": [
"Double_t pvalueKS_1 = goftest_1-> KolmogorovSmirnovTest();\n",
"Double_t pvalueKS_2 = (*goftest_1)(ROOT::Math::GoFTest::kKS);\n",
"assert(pvalueKS_1 == pvalueKS_2);"
]
},
{
"cell_type": "markdown",
"id": "fc65b972",
"metadata": {},
"source": [
"Valid but incorrect calls for the 2-samples methods of the 1-samples constructed goftest_1"
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "a20d940f",
"metadata": {
"collapsed": false,
"execution": {
"iopub.execute_input": "2026-05-19T20:25:33.079920Z",
"iopub.status.busy": "2026-05-19T20:25:33.079811Z",
"iopub.status.idle": "2026-05-19T20:25:33.298839Z",
"shell.execute_reply": "2026-05-19T20:25:33.296648Z"
}
},
"outputs": [],
"source": [
"#ifdef TEST_ERROR_MESSAGE\n",
" Double_t A2 = (*goftest_1)(ROOT::Math::GoFTest::kAD2s, \"t\"); // Issues error message\n",
" Double_t pvalueKS = (*goftest_1)(ROOT::Math::GoFTest::kKS2s); // Issues error message\n",
" assert(A2 == pvalueKS);\n",
"#endif\n",
"\n",
"TPaveText* pt1 = new TPaveText(0.58, 0.6, 0.88, 0.80, \"brNDC\");\n",
"Char_t str1[50];\n",
"sprintf(str1, \"p-value for A-D 1-smp test: %f\", pvalueAD_1);\n",
"pt1->AddText(str1);\n",
"pt1->SetFillColor(18);\n",
"pt1->SetTextFont(20);\n",
"pt1->SetTextColor(4);\n",
"Char_t str2[50];\n",
"sprintf(str2, \"p-value for K-S 1-smp test: %f\", pvalueKS_1);\n",
"pt1->AddText(str2);\n",
"pt1->Draw();"
]
},
{
"cell_type": "markdown",
"id": "97b61dfb",
"metadata": {},
"source": [
"------------------------------------------------------------------------\n",
"Case 2: Create Gaussian random samples"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "885a8616",
"metadata": {
"collapsed": false,
"execution": {
"iopub.execute_input": "2026-05-19T20:25:33.309987Z",
"iopub.status.busy": "2026-05-19T20:25:33.309852Z",
"iopub.status.idle": "2026-05-19T20:25:33.516352Z",
"shell.execute_reply": "2026-05-19T20:25:33.515802Z"
}
},
"outputs": [],
"source": [
" \n",
"UInt_t nEvents2 = 2000;\n",
"\n",
"Double_t* sample2 = new Double_t[nEvents2];\n",
"\n",
"TH1D* h2smps_1 = new TH1D(\"h2smps_1\", \"Gaussian distribution histograms\", 100, 0, 500);\n",
"h2smps_1->SetStats(kFALSE);\n",
"\n",
"TH1D* h2smps_2 = new TH1D(\"h2smps_2\", \"Gaussian distribution histograms\", 100, 0, 500);\n",
"h2smps_2->SetStats(kFALSE);\n",
"\n",
"TRandom3 r;\n",
"for (UInt_t i = 0; i < nEvents1; ++i) {\n",
" Double_t data = r.Gaus(300, 50);\n",
" sample1[i] = data;\n",
" h2smps_1->Fill(data);\n",
"}\n",
"h2smps_1->Scale(1. / nEvents1, \"width\");\n",
"c->cd(2);\n",
"h2smps_1->Draw();\n",
"h2smps_1->SetLineColor(kBlue);\n",
"\n",
"for (UInt_t i = 0; i < nEvents2; ++i) {\n",
" Double_t data = r.Gaus(300, 50);\n",
" sample2[i] = data;\n",
" h2smps_2->Fill(data);\n",
"}\n",
"h2smps_2->Scale(1. / nEvents2, \"width\");\n",
"h2smps_2->Draw(\"SAME\");\n",
"h2smps_2->SetLineColor(kRed);"
]
},
{
"cell_type": "markdown",
"id": "27a40591",
"metadata": {},
"source": [
"-----------------------------------------\n",
"Create GoFTest object"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "ad59b688",
"metadata": {
"collapsed": false,
"execution": {
"iopub.execute_input": "2026-05-19T20:25:33.518156Z",
"iopub.status.busy": "2026-05-19T20:25:33.518048Z",
"iopub.status.idle": "2026-05-19T20:25:33.724527Z",
"shell.execute_reply": "2026-05-19T20:25:33.724042Z"
}
},
"outputs": [],
"source": [
"ROOT::Math::GoFTest* goftest_2 = new ROOT::Math::GoFTest(nEvents1, sample1, nEvents2, sample2);"
]
},
{
"cell_type": "markdown",
"id": "f981ece1",
"metadata": {},
"source": [
"----------------------------------------------------\n",
"Possible calls for the Anderson - DarlingTest test\n",
"a) Returning the Anderson-Darling standardized test statistic"
]
},
{
"cell_type": "code",
"execution_count": 16,
"id": "0669cdb8",
"metadata": {
"collapsed": false,
"execution": {
"iopub.execute_input": "2026-05-19T20:25:33.726393Z",
"iopub.status.busy": "2026-05-19T20:25:33.726287Z",
"iopub.status.idle": "2026-05-19T20:25:33.932759Z",
"shell.execute_reply": "2026-05-19T20:25:33.932242Z"
}
},
"outputs": [],
"source": [
"A2_1 = goftest_2->AndersonDarling2SamplesTest(\"t\");\n",
"A2_2 = (*goftest_2)(ROOT::Math::GoFTest::kAD2s, \"t\");\n",
"assert(A2_1 == A2_2);"
]
},
{
"cell_type": "markdown",
"id": "83a942ec",
"metadata": {},
"source": [
"b) Returning the p-value for the Anderson-Darling test statistic"
]
},
{
"cell_type": "code",
"execution_count": 17,
"id": "3be8f2f0",
"metadata": {
"collapsed": false,
"execution": {
"iopub.execute_input": "2026-05-19T20:25:33.934722Z",
"iopub.status.busy": "2026-05-19T20:25:33.934595Z",
"iopub.status.idle": "2026-05-19T20:25:34.141019Z",
"shell.execute_reply": "2026-05-19T20:25:34.140521Z"
}
},
"outputs": [],
"source": [
"pvalueAD_1 = goftest_2-> AndersonDarling2SamplesTest(); // p-value is the default choice\n",
"pvalueAD_2 = (*goftest_2)(ROOT::Math::GoFTest::kAD2s); // p-value is the default choices\n",
"assert(pvalueAD_1 == pvalueAD_2);"
]
},
{
"cell_type": "markdown",
"id": "5e29d386",
"metadata": {},
"source": [
"--------------------------------------------------\n",
"Possible calls for the Kolmogorov - Smirnov test\n",
"a) Returning the Kolmogorov-Smirnov standardized test statistic"
]
},
{
"cell_type": "code",
"execution_count": 18,
"id": "98410a69",
"metadata": {
"collapsed": false,
"execution": {
"iopub.execute_input": "2026-05-19T20:25:34.142851Z",
"iopub.status.busy": "2026-05-19T20:25:34.142743Z",
"iopub.status.idle": "2026-05-19T20:25:34.349239Z",
"shell.execute_reply": "2026-05-19T20:25:34.348740Z"
}
},
"outputs": [],
"source": [
"Dn_1 = goftest_2-> KolmogorovSmirnov2SamplesTest(\"t\");\n",
"Dn_2 = (*goftest_2)(ROOT::Math::GoFTest::kKS2s, \"t\");\n",
"assert(Dn_1 == Dn_2);"
]
},
{
"cell_type": "markdown",
"id": "655213bb",
"metadata": {},
"source": [
"b) Returning the p-value for the Kolmogorov-Smirnov test statistic"
]
},
{
"cell_type": "code",
"execution_count": 19,
"id": "839ae956",
"metadata": {
"collapsed": false,
"execution": {
"iopub.execute_input": "2026-05-19T20:25:34.351082Z",
"iopub.status.busy": "2026-05-19T20:25:34.350974Z",
"iopub.status.idle": "2026-05-19T20:25:34.557405Z",
"shell.execute_reply": "2026-05-19T20:25:34.556895Z"
}
},
"outputs": [],
"source": [
"pvalueKS_1 = goftest_2-> KolmogorovSmirnov2SamplesTest();\n",
"pvalueKS_2 = (*goftest_2)(ROOT::Math::GoFTest::kKS2s);\n",
"assert(pvalueKS_1 == pvalueKS_2);\n",
"\n",
"#ifdef TEST_ERROR_MESSAGE\n",
"/* Valid but incorrect calls for the 1-sample methods of the 2-samples constructed goftest_2 */\n",
"A2 = (*goftest_2)(ROOT::Math::GoFTest::kAD, \"t\"); // Issues error message\n",
"pvalueKS = (*goftest_2)(ROOT::Math::GoFTest::kKS); // Issues error message\n",
"assert(A2 == pvalueKS);\n",
"#endif\n",
"\n",
"TPaveText* pt2 = new TPaveText(0.13, 0.6, 0.43, 0.8, \"brNDC\");\n",
"sprintf(str1, \"p-value for A-D 2-smps test: %f\", pvalueAD_1);\n",
"pt2->AddText(str1);\n",
"pt2->SetFillColor(18);\n",
"pt2->SetTextFont(20);\n",
"pt2->SetTextColor(4);\n",
"sprintf(str2, \"p-value for K-S 2-smps test: %f\", pvalueKS_1);\n",
"pt2-> AddText(str2);\n",
"pt2-> Draw();"
]
},
{
"cell_type": "markdown",
"id": "fba77720",
"metadata": {},
"source": [
"------------------------------------------------------------------------\n",
"Case 3: Create Landau random sample"
]
},
{
"cell_type": "code",
"execution_count": 20,
"id": "331b606d",
"metadata": {
"collapsed": false,
"execution": {
"iopub.execute_input": "2026-05-19T20:25:34.559198Z",
"iopub.status.busy": "2026-05-19T20:25:34.559090Z",
"iopub.status.idle": "2026-05-19T20:25:34.761072Z",
"shell.execute_reply": "2026-05-19T20:25:34.760574Z"
}
},
"outputs": [],
"source": [
"UInt_t nEvents3 = 1000;\n",
"\n",
"Double_t* sample3 = new Double_t[nEvents3];\n",
"for (UInt_t i = 0; i < nEvents3; ++i) {\n",
" Double_t data = r.Landau();\n",
" sample3[i] = data;\n",
"}"
]
},
{
"cell_type": "markdown",
"id": "bc1a03cf",
"metadata": {},
"source": [
"------------------------------------------\n",
"Create GoFTest objects\n",
"\n",
"Possible constructors for the user input distribution"
]
},
{
"cell_type": "markdown",
"id": "9f44cf0d",
"metadata": {},
"source": [
"a) User input PDF"
]
},
{
"cell_type": "code",
"execution_count": 21,
"id": "9d4ea5a2",
"metadata": {
"collapsed": false,
"execution": {
"iopub.execute_input": "2026-05-19T20:25:34.763021Z",
"iopub.status.busy": "2026-05-19T20:25:34.762915Z",
"iopub.status.idle": "2026-05-19T20:25:34.967373Z",
"shell.execute_reply": "2026-05-19T20:25:34.966895Z"
}
},
"outputs": [],
"source": [
"ROOT::Math::Functor1D f(&landau);\n",
"double minimum = 3*TMath::MinElement(nEvents3, sample3);\n",
"double maximum = 3*TMath::MaxElement(nEvents3, sample3);\n",
"ROOT::Math::GoFTest* goftest_3a = new ROOT::Math::GoFTest(nEvents3, sample3, f, ROOT::Math::GoFTest::kPDF, minimum,maximum); // need to specify am interval"
]
},
{
"cell_type": "markdown",
"id": "d7cf6e0b",
"metadata": {},
"source": [
"b) User input CDF"
]
},
{
"cell_type": "code",
"execution_count": 22,
"id": "a30132d3",
"metadata": {
"collapsed": false,
"execution": {
"iopub.execute_input": "2026-05-19T20:25:34.969260Z",
"iopub.status.busy": "2026-05-19T20:25:34.969147Z",
"iopub.status.idle": "2026-05-19T20:25:35.175591Z",
"shell.execute_reply": "2026-05-19T20:25:35.175124Z"
}
},
"outputs": [],
"source": [
"ROOT::Math::Functor1D fI(&TMath::LandauI);\n",
"ROOT::Math::GoFTest* goftest_3b = new ROOT::Math::GoFTest(nEvents3, sample3, fI, ROOT::Math::GoFTest::kCDF,minimum,maximum);"
]
},
{
"cell_type": "markdown",
"id": "e81476b7",
"metadata": {},
"source": [
"Returning the p-value for the Anderson-Darling test statistic"
]
},
{
"cell_type": "code",
"execution_count": 23,
"id": "f8df2dce",
"metadata": {
"collapsed": false,
"execution": {
"iopub.execute_input": "2026-05-19T20:25:35.177546Z",
"iopub.status.busy": "2026-05-19T20:25:35.177433Z",
"iopub.status.idle": "2026-05-19T20:25:35.381933Z",
"shell.execute_reply": "2026-05-19T20:25:35.381448Z"
}
},
"outputs": [],
"source": [
"pvalueAD_1 = goftest_3a-> AndersonDarlingTest(); // p-value is the default choice\n",
"\n",
"pvalueAD_2 = (*goftest_3b)(); // p-value and Anderson - Darling Test are the default choices"
]
},
{
"cell_type": "markdown",
"id": "d0eacaf6",
"metadata": {},
"source": [
"Checking consistency between both tests"
]
},
{
"cell_type": "code",
"execution_count": 24,
"id": "39a70518",
"metadata": {
"collapsed": false,
"execution": {
"iopub.execute_input": "2026-05-19T20:25:35.383800Z",
"iopub.status.busy": "2026-05-19T20:25:35.383691Z",
"iopub.status.idle": "2026-05-19T20:25:35.590198Z",
"shell.execute_reply": "2026-05-19T20:25:35.589824Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" \n",
"\n",
"TEST with LANDAU distribution:\tOK ( pvalues = 0.777278 )\n"
]
}
],
"source": [
"std::cout << \" \\n\\nTEST with LANDAU distribution:\\t\";\n",
"if (TMath::Abs(pvalueAD_1 - pvalueAD_2) > 1.E-1 * pvalueAD_2) {\n",
" std::cout << \"FAILED \" << std::endl;\n",
" Error(\"goftest\",\"Error in comparing testing using Landau and Landau CDF\");\n",
" std::cerr << \" pvalues are \" << pvalueAD_1 << \" \" << pvalueAD_2 << std::endl;\n",
"}\n",
"else\n",
" std::cout << \"OK ( pvalues = \" << pvalueAD_2 << \" )\" << std::endl;"
]
},
{
"cell_type": "markdown",
"id": "8f26e7dd",
"metadata": {},
"source": [
"Draw all canvases "
]
},
{
"cell_type": "code",
"execution_count": 25,
"id": "739abcff",
"metadata": {
"collapsed": false,
"execution": {
"iopub.execute_input": "2026-05-19T20:25:35.591886Z",
"iopub.status.busy": "2026-05-19T20:25:35.591781Z",
"iopub.status.idle": "2026-05-19T20:25:35.809037Z",
"shell.execute_reply": "2026-05-19T20:25:35.808684Z"
}
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"\n",
"
\n",
"\n",
"\n",
"\n"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"gROOT->GetListOfCanvases()->Draw()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "ROOT C++",
"language": "c++",
"name": "root"
},
"language_info": {
"codemirror_mode": "text/x-c++src",
"file_extension": ".C",
"mimetype": " text/x-c++src",
"name": "c++"
}
},
"nbformat": 4,
"nbformat_minor": 5
}