Skip to content

Instantly share code, notes, and snippets.

@pn11
Created September 10, 2014 03:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pn11/0dae504b05ae9f7c2d1a to your computer and use it in GitHub Desktop.
Save pn11/0dae504b05ae9f7c2d1a to your computer and use it in GitHub Desktop.
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