[ROOT] Re: What happens to statistics in Add, Multiply

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Jan 31 2001 - 10:22:46 MET


You are now asking a different question.

When you use the Fill functions, the following quantities are incremented
    Stat_t        fEntries;         //Number of entries
    Stat_t        fTsumw;           //Total Sum of weights
    Stat_t        fTsumw2;          //Total Sum of squares of weights
    Stat_t        fTsumwx;          //Total Sum of weight*X
    Stat_t        fTsumwx2;         //Total Sum of weight*X*X

These quantities are not incremented when you use functions such as
SetBinContent.
When you call functions like GetMean, GetRMS, the parameters above are used
to compute the mean or rms when there is no selected range (default).
If you have a selected range (eg when zooming on one of the axis), the above
parameters cannot be used by definition. In this case the functions
compute an approximate mean and rms from the actual bin contents.

When you use the TH1::Add function, the above quantities are directly used.
The resulting mean or rms will use the full precision information
accumulated in these variables.
This does not make sense in case of a multiplication/division. In this case, the
functions recompute the above parameters from the result of the operation
in each bin.

Concerning the computation of the errors, assuming histograms h1 and h2,
if h1 or h2 have errors stored (TH1::Sumw2 has been called), the resulting
errors
will be correct. If not, the resulting error bars will be computed as the
sqrt of the bin contents. See comments in the functions.

Rene Brun


Alexander Cherlin wrote:
> 
>         Dear Rene!
> 
> > Hi Alexander,
> >
> > With Add, statistics are computed using the statistical quantities
> > in both histograms. In this case, the resulting stats preserve the
> > original full accuracy.
> 
>         What does it mean "using the statistical quantities
> in both histograms"? Is that a weighted mean value? What happens if I
> change the content of a bin/bins using SetContent? What is the bin error
> in that case if I don't set a new one?
> 
> Thank you,
> Alexander.
> 
> > In case of a multiplication/division, statistics are recomputed from
> > the bin contents.
> >
> > Rene Brun
> >
> >
> > Alexander Cherlin wrote:
> > >
> > >         Dear rooters!
> > > If I create a new histogram using Add (or Multiply), what show Mean and
> > > RMS values in statistics of the new histogram?
> > >
> > > Thanks in advance,
> > > Alexander.
> 
> ************************************************************************
> *   Alexander Cherlin                    |    Home:                    *
> *   Department of Particle Physics       |    Pinsker str., 50/15      *
> *   Weizmann Institute of Science        |    Rishon le-Zion 75910     *
> *   Rehovot 76100 ISRAEL                 |    ISRAEL                   *
> *   PHONE : 972 8 9343372                |    PHONE: 972 3 9560344     *
> *   FAX   : 972 8 9466253                |    CELLULAR                 *
> *                                        |    PHONE: 972 54 629228     *
> *                                        |    FAX: 972 15154 629228    *
> *----------------------------------------------------------------------*
> *   E-mail: cherlin@wicc.weizmann.ac.il                                *
> *           Alexander.Cherlin@cern.ch                                  *
> *   URL   : http://www.weizmann.ac.il/home/cherlin                     *
> ************************************************************************



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:35 MET