Re: [ROOT] Histogram Data

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Dec 03 2002 - 23:31:40 MET


Hi,

To get the y value corresponding to bin k, h->GetBinContent(k);
To get the bin number k corresponding to an x value, do
  int k = h->GetXaxis()->FindBin(x);

Rene Brun

On Tue, 3 Dec 2002, Manus wrote:

> Hello, I need to get data points, or "y values", from a histogram I have.
> For example, if I know the horizontal, or x, value of a histogram, what
> command do I use to get the y value out?  More specifically, say that my
> histogram corresponds exactly to the function y = x^2, then if I wanted to
> know the function value at, say x = 4, then the program would give me 16.
> I have tried
> 
> h1->GetBinContents(x);
> 
> but this hasn't seemed to work.  It seems like it should be easy enough to
> do - but I haven't found the right command yet.  Any help would be greatly
> appreciated.  Thank you.
> 
> 	mjd
> 
> 
> 



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