Re: [ROOT] Bug in TH1::Fill()

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Nov 14 2001 - 19:12:37 MET


Hi Ray,

You should not confuse the role of
 - TH1::Fill(x,1); //fill with a weight=1 (fEntries incremented by 1)
 - TH1::Fill(x,w); //fill with a weight=w (fEntries incremented by 1)
 - TH1::Fill(N,*x,*w);//fill with arrays x and weights w
                      //fEntries incremented by N

Rene Brun


redRay Fliller III wrote:
> 
>   Hello rooters,
> 
>   I am using ROOT 3.02/03 CVS as of Nov.12 on LINUX Mandrake.
> 
>   I have a class that inherits from a TH2F.  If I try to subtract
> two of these historgrams, I get an empty histogram.  To do the subtraction,
> I use TH1::Add(TH1 *h1, TH1 *h2, Double_t c1, Double_t c2), with
> c1=1,c2=-1.  Obvious enough.
> 
>    But I notice that fEntries is zero for this.  According to TH1.h,
>   fEntries is the number of entries in the histogram.  I assume that
>   this is different than the number of bins.  Looking at
> TH1::Fill(Axis_t x, Stat_t w) and TH2::Fill(Axis_t x, Axis_t y, Stat_t w)
> I see the fEntries is incremented only once.  I get a different fEntries
> if I call TH1::Fill(x,1) N times vs. TH1::Fill(X,N).
> 
>   Is this a bug or a feature??
> 
> --
> 
>  RAINMAN
>       "How much does a piece of gum cost Ray?"
>       "About $100."
>       "How much does a new car cost Ray?"
>       "`Bout $100."
>       "There goes working for NASA!"
> 
> ==================================================================
> Ray Fliller: rfliller@bnl.gov      Office Phone: (631)-344-6124
> C-A Accelerator Physics            Dept. Fax: (631)-344-5954
> Building 911B
> Brookhaven National Lab
> Upton, NY 11973                    Office: Room 211
> 
> http://www.agsrhichome.bnl.gov/People/rfliller/
> ==================================================================



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