Re: Histogram mean

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Thu, 15 Sep 2011 07:04:09 +0200


Yes, I agree.
I discussed the recent thread with Lorenzo and he will add this information to TH1::GetMean/RMS.

Rene

On 14/09/2011 22:57, Philip Rodrigues wrote:
> Hi Rene,
> It would be useful if that comprehensive explanation was added to the
> documentation for TH1::GetMean(), which currently doesn't say anything about
> the difference between "binned" and "unbinned" calculations, and when each one
> is used.
>
> Cheers,
> Phil
>
> On Wednesday, September 14, 2011 12:50:41 AM Rene Brun wrote:
>> Let me come with some clarification as I have the impression that
>> senders are confusing each-other.
>>
>> When filling a histogram with Fill(x,w), ROOT keeps track of the sums of
>> w, w*x and w*x*x such that later the mean, rms can be computed precisely
>> over the FULL bin range.
>> When you set the bin range to a subset of the original range, ROOT does
>> what it can only do, ie recompute the statistics quantities starting
>> with the center of each bin in the range BECAUSE THE ORIGINAL ENTRIES IN
>> THIS RANGE ARE NOT AVAILABLE ANYMORE.
>> In the case of Philip, there is no way to know that you have restricted
>> the range without excluding any entries.
>> Once you restrict the range, there is no way of offering an "UNBINNED"
>> option for binned data because the original data is lost.
>> ntuples have been invented many decades ago to solve your problem. You
>> always start from unbinned data.
>> ROOT has an option (not well known) via TH1::SetBuffer to keep all
>> entries to TH1::Fill in memory such that the statistics are always
>> accurate, but, of course, this scheme can only be used for histograms
>> with small number of entries.
>> So, use TNtupleD or TTrees and project the data in the desired range if
>> you want/need very precise statistics.
Received on Thu Sep 15 2011 - 07:04:16 CEST

This archive was generated by hypermail 2.2.0 : Thu Sep 15 2011 - 11:50:01 CEST