Re: Projections of 2D histograms

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue May 20 1997 - 09:41:41 MEST


Christopher Conner wrote:
> 
> Is there a way to make "Slix" or "banx" or "proj" on 2D
> histograms.  I see that the Profile Class can handle this but I
> see no constuctor that take a 2D histogram and a range in y and
> fill the profile from the 2D histogram.
> 
>         I found a way to extract bin values from a 1D histogram
> but I don't see how to do it for a 2D histogram. How is this done?
> 
>         It looks like 2D histograms inherit from 1D histograms but
> then what is the bin number corresponding to binx=5 and biny=10?
> 

We do not have a function making a projection of a 2-D histogram
into a Profile histogram or a 1-D histogram.
We are planning to add this functionality coupled with the dynamic
projection using a slider.
However, if you use a TNtuple/TTree, this functionality is already
there.

To extract bin values from a 2-D, use
   TH1::GetCellContent(Int_t binx, Int_t biny)
Uou can also use:
   Int_t bin = TH1::GetBin(Int_t binx, Int_t biny, Int_t binz)
The GetBin function returns a global bin number.
Then you can use teh normal GetBinContent(bin).

Rene Brun



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:26:18 MET