Re: TH1F normalization and error-bars

From: Rene Brun (Rene.Brun@cern.ch)
Date: Sat Dec 04 1999 - 16:17:05 MET


Hi Steffen,
By default, errors bars are computed as sqrt(bin content).
If you want correct error bars to be computed and stored,
you have to call
 dndy1->Sumw2();
before filling the histogram in T.Draw(..

Rene Brun


On Fri, 3 Dec 1999, Steffen A. Bass wrote:

> 
> Hello folks!
> 
> I have a simple greenhorn problem with the normalization of a 1D
> histogram:
> 
> I have a Tree T containing a variable fY, the distribution of which I want
> to plot in a histogram, normalized per event.
> 
> So, first I create the histogram (30 bins from -2 to 2):
> 
> dndy1 = new TH1F("dndy","dN/dy of pi0",30,-2.0,2.0); 
> 
> Then I use T.Draw to fill the histo and plot it with error-bars:
> 
> T.Draw("fY>>dndy","1/(5000*4/30)*(fId==111)","e1");
> 
> I have normalized my histogram so that the integral of the distribution
> gives me the number of selected entries (particles) per event):
> "1/(5000*4/30)" = 1/number_of_events_in_tree * 1/bin_width
> 
> However, the error-bars are not getting renormalized (i.e. rescaled)
> properly (or at all) - the result is far too large error bars for the
> distribution.
> 
> What am I doing wrong and how to I get the proper error-bars for my
> normalized histogram? 
> 
> Would it not be more convenient to at least have the division by the
> bin-width automatically done in the histogramming, i.e. in the fill
> method?
> 
> Thanks a lot for the help!
> 
> Steffen
> 
> PS: I have tried to fill out the registration form, but somehow your 
> computer does not respond when I click on the "submit registration"
> button...
> 
> --------------------------------------------------------------------------
>   Steffen A. Bass                                 email: bass@nscl.msu.edu
>   Cyclotron Laboratory                       http://www.nscl.msu.edu/~bass
>   Michigan State University                         office: (517) 333-6434
>   East Lansing, MI  48823                              FAX: (517) 353-5967
> --------------------------------------------------------------------------
> 
> 



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:44 MET