Re: [ROOT] TH1D, getmean, getRMS, getMinimum...

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Jun 03 2004 - 10:55:34 MEST


Bernd,

Bernd Reinhold wrote:
> 
> Well, however you answered my question. Thank you for that.
> GetMinimum, GetMaximum doesnt work in my program, but probably it doesnt for other reasons. (For example GetMaximum returned 72 , where xmax is 15; therefore I thought GetMaximum() is not what I think it is; but now I will have a close look)
> and instead of h->GetXaxis()->GetXmin(), Xmax, Nbins, etc I looked for something like h->GetXmin() - and couldnt find it.


GetMaximum returns the maximum along Y, not along X (it depends on the bin
contents).
As you did not specified which version you are using, I assumed that you are
using a recent version, like 4.00/04. The feature in GetMaximum(maxval)
returning
the maximum value smaller than maxval was implemented in February this year.
If your version is older, GetMaximum returns the maximum bin content.
Note that in case of a 2-d histogram, GetMaximum also returns the maximum bin
content (along z), and similarly for a 3-d histogram it returns the maximum bin
content (along the 4th dimension).

Rene Brun

> 
> Thanks again.
> 
> Bernd.
> 
> -----Original Message-----
> From:   Rene Brun
> Sent:   Wed 6/2/2004 10:36 PM
> To:     Bernd Reinhold
> Cc:     roottalk@pcroot.cern.ch
> Subject:        Re: [ROOT] TH1D, getmean, getRMS, getMinimum...
> Hi Bernd,
> 
> I do not understand your question. All what you request is already
> provided by the TH1 class.
> Assuming TH1* h, you can do
>   h->GetMean()
>   h->GetRMS()
>   h->GetEntries()
>   h->GetMinimum(minval); //Return minimum value greater than minval of
>      bins in the range
>   h->GetMaximum(maxval); //Return maximum value smaller than maxval of
>      bins in the range
>   h->GetXaxis()->GetXmin(), Xmax, Nbins, etc
>   h->GetYaxis()....
> 
> Rene Brun
> 
> On Wed,
> 2 Jun 2004, Bernd Reinhold wrote:
> 
> > Hi!
> >
> > Is there a way to get the following information from the histogram? (TH1D as
> > input to the function (as reference), and as output the following infos:)
> >
> > mean, RMS, entries do work - that works with h1.GetMean(), h1.GetRMS,
> > h1.GetEntries()
> > minimum - I tried GetMinimum(), however this didn't work as expected. I want
> > to have the minimum entry in the histogram, that is bigger than xmin.
> > maximum - didn't work as expected, either...
> > xmin, xmax, numberofbins (the last three parameters in the TH1D-constructor)
> >
> > thank you for your help, Bernd.
> >
> >



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:08 MET