Means of histograms in the case of negative weights

From: Tim Head <betatim_at_gmail.com>
Date: Sat, 5 Jun 2010 07:39:25 -0500


Hello ROOTs,

I noticed the following when using root5.26 (so maybe this has already been fixed):

import ROOT as R
R.TH1.SetDefaultSumw2()

h = R.TH1F("", "", 10,0,10)

h.Fill(1, 1)
h.Fill(2, 1)
h.Fill(4, 1)
h.Fill(4, -1)

print h.GetMean()

which prints 2.75.

While the issue of negative weights is a tricky one with no good answers (or maybe it isn't ...) I was hoping that the mean comes out as 1.5 in this case.

I don't have the means to test with a more recent version of root, so if this has gone away ignore my comment, otherwise keep it in mind when dealing with negative weights.

Tim

-- 
http://tim.jottit.com/
Received on Sat Jun 05 2010 - 14:39:31 CEST

This archive was generated by hypermail 2.2.0 : Mon Jun 07 2010 - 11:50:01 CEST