Hi Philip,
In this case, as soon as you call GetMean(), GetRMS() or Draw the histogram,
the stats will automatically be recomputed from the bin contents.
Example:
{
TH1F h("h","h",100,0,100);
for (Int_t i=1;i<=100;i++) h.SetBinContent(i,i%10);
Double_t mean = h.GetMean();
Double_t rms = h.GetRMS();
printf("mean=%g, rms=%g\n",mean,rms);
h.Draw();
}
Rene Brun
Philip Adamson wrote:
>
> On Wed, 31 Jan 2001, Rene Brun wrote:
>
> > 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.
>
> There's probably a simple answer to this, but I've missed it. Suppose I
> have a set of numbers representing histo bin content in a file. I can
> read these in and use SetBinContent, but don't get the above statistics.
> How do I arrange for the above quantities to be correct in this case?
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:35 MET