Re: Means of histograms in the case of negative weights

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Mon, 7 Jun 2010 08:27:21 +0200


Hi Tim,

see discussion at:
http://root.cern.ch/phpBB3//viewtopic.php?t=7654&view=previous&sid=7617ae5a0b2fde2737fabaec119044ee

We have no plans to change this algorithm

Rene Brun

Tim Head wrote:
> 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
>
>
Received on Mon Jun 07 2010 - 08:27:25 CEST

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