_ROOT Version:6.26.04_1
_Platform: macOS Monterey
_Compiler: C++
I am working on a macro that applies a chi-square test to many different histograms and then creates a chi-square distribution using the outputted chi square scores. I am able to find the chi-square scores pretty easily using Chi2Test(); however I am unsure how to use these scores to fill another graph as chi2 is not the correct variable name although the class reference guide says " [out] chi2 " which led me to assume that if I wanted to input this in a graph I would just use g->Fill(chi2,other value).
{
g = new TGraph();
int i;
for(int i = 1; i < 26; i++)
{
//h1 is the predicted value
TH1F *h1 = new TH1F("h1", "Predict;x;y", 25, 0, 2500);
//h2 represents second histogram (data collected)
TH1F *h2 = new TH1F("h2", "Data;x;y", 25, 0, 2500);
int k;
for(int k = 0; k < i*500; k++)
{
h1->Fill( gRandom->Landau(1000, 300) );
h2->Fill( gRandom->Landau(1000, 300) );
}
Double_t res[25], x[25];
h1->Chi2Test(h2,"UU P", res);
g->SetPoint(i, chi2, i*500);
}
g->Draw();
}
This is the line of code I have written in which a for loop runs a chi-square test between two identical distributions at a varied number of total event counts.
TLDR; What is the variable name of the output for chi2 using TH1::Chi2Test()