Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ROOTのTH1:Chi2Test() (http://root.cern.ch/root/html/TH1.html#TH1:Chi2Test) がnormalizeしてるか確認した。
{
TH1D *h1 = new TH1D("h1", "h1", 3, 0, 3);
h1->Fill(1);
h1->Fill(1);
h1->Fill(2);
h1->Fill(2);
h1->Fill(2);
h1->Fill(2);
h1->Fill(3);
h1->Fill(3);
h1->Draw();
TH1D *h2 = new TH1D("h2", "h2", 3, 0, 3);
h2->Fill(1);
// h2->Fill(2);
h2->Fill(2);
h2->Fill(3);
h2->SetLineColor(kRed);
h2->Draw("same");
double res[];
cout << h1->Chi2Test(h2,"CHI2",res) << endl;
cout << res[0] << endl;
cout << res[1] << endl;
cout << res[2] << endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment