Re: histogram subtraction and mean

From: Lorenzo Moneta <Lorenzo.Moneta_at_cern.ch>
Date: Tue, 1 Mar 2011 22:13:24 +0100


HI Arthur,

 There are two different things:

  1. When calculating the statistics (mean, standard deviation, etc...) it is used, when possible, the sums calculated from the original un-binned data. If you call before ResetStats() the computation is done using the bin center
  2. When subtracting the histogram, TH1::Add(h1,h2,c1,c2) , when c1*c2 < 0, the current computed statistics is wrong because the absolute values of c1 and c2 are used. This is independent of ResetStats. This will be fixed,

 Lorenzo    

On Mar 1, 2011, at 9:43 PM, Arthur E. Snyder wrote:

> Hi Lorenzo,
>
> I would say that ResetStats() should be the default. While it's clear in my example that the result is wrong, if working with a more symmetric distribution (for which error is not obvious) the naive user (like me) unaware of ResetStats might end up with a rather serious mistake in his/her analysis ..
>
> I don't know what the best algorythm is but the default should to something reasonably .. and/or give a big fat warning ..
>
>
> -Arthur
>
> A.E. Snyder, Group ? \!c*p?/
> SLAC Mail Stop #95 ((. .))
> Box 4349 |
> Stanford, Ca, USA, 94309 '\|/`
> e-mail:snyder_at_slac.stanford.edu o
> phone:650-926-2701 _
> http://www.slac.stanford.edu/~snyder BaBar
> FAX:707-313-0250 Collaboration
> &
> Fermi/GLAST
>
>
>
> On Tue, 1 Mar 2011, Lorenzo Moneta wrote:
>

>> Hi,
>> On Mar 1, 2011, at 6:25 PM, Holger Meyer wrote:
>> 
>>> If you only have the binned moments, you can't go the other way. The
>>> only possible change might be to add a function to the histogram classes
>>> that does the work for you. Something like
>>> TH1::SetMomentsFromBinCenters().
>> 
>> we have such a function already, TH1::ResetStats(). By calling it, all the statistics is computed from the bin centers,
>> 
>> Lorenzo
>> 
Received on Tue Mar 01 2011 - 22:14:01 CET

This archive was generated by hypermail 2.2.0 : Tue Mar 01 2011 - 23:50:01 CET