Re: [ROOT] error calc. in TProfile

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Jul 17 2002 - 09:48:49 MEST


The computation of errors in TProfile has evolved with time
in case of bins with low statistics (1, 2 or 3 entries).
In version 3.02/07, we introduced a new condition, in case
the errors computed are very small (error/content <1e-6)
We had complaints from several users making fits on such profiles
and finding that too much weight was given to the points
with low statistics.
Any idea to improve the existing algorithm is welcome.

Rene Brun

On Tue, 16 Jul 2002, Aihong Tang wrote:

> Hi,
> 
> Could anybody tell me why errors are identical in all
> bins in TProfile when that profile is filled with small values?
> 
> The problem happens in ROOT 3.02.07, If I repeat the same thing
> in ROOT 3.02.00, everything looks fine.
>  
> The code is :
> 
> ==================test.C=====================
> #include "TProfile.h"
> #include "float.h"
> #include "TRandom.h"
> #include "TString.h"
> #include "TCanvas.h"
> #include "iostream.h"
> 
> void test(){
>   TRandom rd;
> 
>   TProfile*  hprof= new TProfile("test", "test", 100,-4., 4., -1.*FLT_MAX, 
> FLT_MAX, "");
> 
>  Float_t px, py, pz;
>   for ( Int_t j=0; j<25; j++) {
>      rd.Rannor(px,py);
>      pz = px*px + py*py;
>      hprof->Fill(px,pz*1e-7); <======== errors are calc. correctly if 
> *1e-7 is removed from this line. It can be also calc. correctly if run in ROOT 3.02.00
>   }
>    
>   hprof->Print("all");
>   TCanvas *c1 = new TCanvas("c1","Profile histogram example",200,10,700,500);
>   hprof->Draw();
> }
> ========================================
> 
> Errors are shown the same for all bins in the following output:
> 
> ----------------------------------------
> 
>   *******************************************
>   *                                         *
>   *        W E L C O M E  to  R O O T       *
>   *                                         *
>   *   Version   3.02/07      1 March 2002   *
>   *                                         *
>   *  You are welcome to visit our Web site  *
>   *          http://root.cern.ch            *
>   *                                         *
>   *******************************************
> 
> Compiled for linux with thread support.
> 
> CINT/ROOT C/C++ Interpreter version 5.15.25, Jan 6 2002
> Type ? for help. Commands must be C++ statements.
> Enclose multiple statements between { }.
> 
> Welcome to the ROOT tutorials
> 
> 
> Type ".x demos.C" to get a toolbar from which to execute the demos
> 
> Type ".x demoshelp.C" to see the help window
> 
>  *** Start at Date : Tue Jul 16 15:36:50 2002
> QAInfo:You are using STAR_LEVEL : pro, ROOT_LEVEL : 3.02.07 and node : 
> rcas6015.rcf.bnl.gov 
> root4star [0] .x test.C++
> Info in <ACLiC>: creating shared library 
> /direct/star+data10/GC/aihong/anaSimV1_short/V2_5Pct_V1Vary_New/job4/dir8Test/./test_C.so
> In file included from 
> /direct/star+data10/GC/aihong/anaSimV1_short/V2_5Pct_V1Vary_New/job4/dir8Test/filexIyM7Z.h:29,
>                  from 
> /direct/star+data10/GC/aihong/anaSimV1_short/V2_5Pct_V1Vary_New/job4/dir8Test/./filexIyM7Z.C:5:
> /direct/star+data10/GC/aihong/anaSimV1_short/V2_5Pct_V1Vary_New/job4/dir8Test/./test.C: 
> In function 
> `void test ()':
> /direct/star+data10/GC/aihong/anaSimV1_short/V2_5Pct_V1Vary_New/job4/dir8Test/./test.C:25: 
> warning: unused
> variable `TCanvas *c1'
> TH1.Print Name= test, Entries= 25, Total sum= 2.96441e-06
>  fSumw[0]=0, x=-4.04, error=0
> //bla... bla...
>  fSumw[32]=2.96728e-07, x=-1.48, error=5.04825e-08
>  fSumw[33]=0, x=-1.4, error=0
>  fSumw[34]=0, x=-1.32, error=0
>  fSumw[35]=1.60949e-07, x=-1.24, error=5.04825e-08
>  fSumw[36]=0, x=-1.16, error=0
>  fSumw[37]=3.59341e-07, x=-1.08, error=5.04825e-08
>  fSumw[38]=0, x=-1, error=0
>  fSumw[39]=0, x=-0.92, error=0
>  fSumw[40]=0, x=-0.84, error=0
>  fSumw[41]=0, x=-0.76, error=0
>  fSumw[42]=5.56881e-08, x=-0.68, error=5.04825e-08
>  fSumw[43]=1.46839e-07, x=-0.6, error=5.04825e-08
>  fSumw[44]=2.11833e-07, x=-0.52, error=5.04825e-08
>  fSumw[45]=2.29327e-07, x=-0.44, error=5.04825e-08
>  fSumw[46]=2.87134e-07, x=-0.36, error=5.04825e-08
>  fSumw[47]=3.0389e-07, x=-0.28, error=5.04825e-08
>  fSumw[48]=0, x=-0.2, error=0
>  fSumw[49]=0, x=-0.12, error=0
>  fSumw[50]=0, x=-0.04, error=0
>  fSumw[51]=0, x=0.04, error=0
>  fSumw[52]=1.50715e-07, x=0.12, error=5.04825e-08
>  fSumw[53]=8.96748e-08, x=0.2, error=5.04825e-08
>  fSumw[54]=0, x=0.28, error=0
>  fSumw[55]=9.49502e-08, x=0.36, error=5.04825e-08
>  fSumw[56]=0, x=0.44, error=0
>  fSumw[57]=3.50281e-08, x=0.52, error=5.04825e-08
>  fSumw[58]=0, x=0.6, error=0
>  fSumw[59]=0, x=0.68, error=0
>  fSumw[60]=0, x=0.76, error=0
>  fSumw[61]=0, x=0.84, error=0
>  fSumw[62]=1.21321e-07, x=0.92, error=5.04825e-08
>  fSumw[63]=1.92461e-07, x=1, error=5.04825e-08
>  fSumw[64]=0, x=1.08, error=0
>  fSumw[65]=0, x=1.16, error=0
>  fSumw[66]=2.2853e-07, x=1.24, error=5.04825e-08
> 
> ----------------------------------------------------
> 
> 
> Thanks!
> 
> Aihong
> 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:00 MET