Dear all,
Sorry for the probably very basic questions.
See the simple macro below :
TH1::SetDefaultSumw2();
TH1D* h1 = new TH1D("h1","h1",50,35,45);
TH1D* h2 = new TH1D("h2","h2",50,35,45);
for(int i=0; i<10000; i++) {
h1->Fill(gRandom->Gaus(40.,2.));
h2->Fill(gRandom->Gaus(40.,2.));
}
Then
cout << h1->Chi2Test(h2,"CHI2WW") << endl;
40.8678
cout << h1->Chi2Test(h2,"CHI2UW") << endl;
41.7638
And
cout << h2->Chi2Test(h1,"CHI2WW") << endl;
40.8678
cout << h2->Chi2Test(h1,"CHI2UW") << endl;
40.463
My questions :
- for this test with unweighted events, why do “UW” and “WW” return different numbers? I would assume that assuming weighted events with w_i==1 would fall back to to the unweighted case, by consistency.
- why is the comparison between h1 and h2 different from that between h2 and h1, for “UW”?
In general, why shouldn’t we just always use “WW” (or remove these UU/UW/WW options)? Again, when w_i=1, the calculation should match the unweighted case by consistency.
A simple calculation, summing the square differences between the bin contents divided by the sum of the squares of the bin errors (using GetBinContent and GetBinError), always returns the same answer as “WW”, both with weighted and unweighted histograms
Sorry if I missed some obvious reasons, and thanks for your insights
Maarten