Re: Fw: projecting a histogram

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Jul 30 1999 - 14:37:39 MEST


Hi Michael, Valeri, Selemon,

As I quickly realized that it might take more time to process the mails
than to implement the code, I have implemented this function
in my development version. Comments are welcome.

Rene Brun

TH1 *TH1::Project3D(Option_t *option)
{
   // Project a 3-d histogram into 1 or 2-d histograms depending on the
   // option parameter
   // option may contain a combination of the characters x,y,z,e
   // option = "x" return the x projection into a TH1D histogram
   // option = "y" return the y projection into a TH1D histogram
   // option = "z" return the z projection into a TH1D histogram
   // option = "xy" return the x versus y projection into a TH2D
histogram
   // option = "yx" return the y versus x projection into a TH2D
histogram
   // option = "xz" return the x versus z projection into a TH2D
histogram
   // option = "zx" return the z versus x projection into a TH2D
histogram
   // option = "yz" return the y versus z projection into a TH2D
histogram
   // option = "zy" return the z versus y projection into a TH2D
histogram
   //
   // if option contains the string "e", errors are computed
   //
   // The projection is made for the selected bins only

Michael A. Lisa wrote:
> 
> Hello Rene,
> 
>         Yes, but a TNtuple will get too big, if a lot of data points
> are collected.  With a histogram, the binning reduces memory usage.
> 
>         So TNtuple would be more powerful in principle, but is unpractical
> when dealing with large amounts of data.
>         So a question would be: are there plans to implement this
> projection feature of 3D histograms?
> 
> Thanks,
> Mike Lisa
> 
> +-------------------------------------------------------------------+
> | Mike Lisa              |  email: lisa@mps.ohio-state.edu          |
> | Department of Physics  |                                          |
> | 2156 Smith Laboratory  |  Van de Graaff <--- usually here         |
> | Ohio State University  |  ph: (614) 292-4775 / fax: 292-4833      |
> | 174 West 18th Avenue   |                                          |
> | Columbus, OH 43210     |  http://vdgus1.mps.ohio-state.edu/~lisa/ |
> +-------------------------------------------------------------------+
> 
> On Thu, 29 Jul 1999, Rene Brun wrote:
> 
> > Hi Valeri,
> > Your request could be implemented. To be complete, one has to consider
> > all possible combinations, including 1-d projections.
> >
> > I did not put much effort in this area, as I believe that is is more
> > general
> > and powerful to define a small TNtuple object with x,y,z from which you
> > can
> > already make all kinds of projections 1-d, 2-d and 3-d including
> > selections.
> >
> > Rene Brun
> >
> >
> > Valeri Fine (Faine) wrote:
> > >
> > > ----- Original Message -----
> > > From: Selemon Bekele <bekele@pacific.mps.ohio-state.edu>
> > > To: STAR software <starsofi-l@bnl.gov>
> > > Sent: 29 èþëÿ 1999 ã. 10:38
> > > Subject: projecting a histogram
> > >
> > > >
> > > >
> > > > I have a three dimensional histogram which I want to project to a certain
> > > > axis. Is there a way how to do it in root4star? I cheked the root class
> > > > library and found in a class which relates to one dimensional histograms a
> > > > method which projects only to the third axis which it calls Z. It would be
> > > > nice if two more methods could be added  so that one can project also onto
> > > > the other two axes separately. For the time being, a way around this problem
> > > > is to fill three histograms where each component is passed as a third
> > > > argument:
> > > >
> > > >                       Fill(x,y,z),Fill(z,x,y),Fill(y,z,x)
> > > >
> > > > and do the projection.
> > > > *******************************************
> > > >
> > > >  Selemon Bekele
> > > >  e-mail bekele@pacific.mps.ohio-state.edu
> > > >  Tel. (614)294-4863 (home)
> > > >
> > > > *******************************************
> > > >
> > > >
> > > >
> > > >
> >



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