[ROOT] resetting a histo

From: Hermine Woehri (Hermine.Woehri@cern.ch)
Date: Fri Mar 08 2002 - 13:09:48 MET


Hello,

Within a loop I fill a histogram and perform some further analysis
(fitting, ...). Whenever the loop is increased as a first step I
reset the histogram for new data and immediately afterwards crosscheck if
it really was put to zero.

    fitHist->Reset(); 

    for(int sample=0; sample<kNbSamples; sample++)
      printf("bin %d is %f\n", sample+1, fitHist->GetBinContent(sample+1)); 

    printf("histMax after resetting= %f\n", fitHist->GetMaximum() ); 


Although the bins are reset, i.e. all entries are 0., the maximum of the
entries is NOT zero. It always has a value calculated in one of the
previous iterations in the loop.  In fact I have observed the
following, which I would like to briefly introduce:

the nr. of entries in the histogram (kNbSamples) is 4. In most of the
cases only 2 "samples" are filled with non-zero values.
E.g.
T4: 0.000000, T3: 0.000000, T2: 9.355732, T1: 57.639565

Only in say 20% of my data analysed all 4 entries in the histogram are
non-zero, e.g.:

T4: 10.092725, T3: 20.273315, T2: -0.955282, T1: -0.154543

It is only then, that the method "GetMaximum" calculates the maximum of
the histogram correctly. And this number gets displayed after the
Reset-call and the GetMaximum-call, mentioned above in each iteration
until the histogram again was filled with four values > 0.

Best regards,
Hermine



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