Re: 2D hists: slices, bands and projections

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Mar 02 2000 - 09:54:58 MET


Hi Vincent,

We did not implement an interface for the 3-D similar to the 2-D case
because the number of possible combinations is too high.
You can restrict a projection along one or more axis on a TH3x *h3
with  statements like 
  h3->GetYaxis()->SetRange(first,last)
where first and last are respectively the first and last selected bin
number
for the axis (Y axis in this example).

Rene Brun

Vincent Colin de Verdiere wrote:
> 
> I like this restructuration idea and it looks backward compatible so it's
> really nice!
> 
> About the slices / projections, I didn't find yet a good way to get a 2D
> histo slice of a 3D histo. The project3D can almost do that but it doesn't
> have the range parameters that the other Projection methods have. Would it
> be a good thing to add these parameters ??
> Currently I think, I'm not sure and didn't check it correctly, it is
> possible to do it using the SetAxisRange() method. But the behaviour of
> this method is not very clear to me (I couldn't find source or documention
> on the web site ;-( ).
> 
> comments?
> 
> -- Vincent
> 
> On Tue, 29 Feb 2000, Rene Brun wrote:
> >Thanks for stating your level of ignorance and design capabilities ::)
> >Your point is perfectly valid. Last week, in a reply to Vincent, I
> >mentionned our intention to restructure the histogram class hierarchy.
> >We know how to do it in a backward compatible way. The sketch below is
> >just to give a rough indication of what we are planning.
> > - delete the existing classes TH2 and TH3
> > - Add new classes TH2 and TH3 to support the following inheritance tree
> >
> >                          TH1
> >                           ^
> >                           |
> >                           |
> >                           |
> >   -----------------------------------------------------
> >          |                |       |      |      |     |
> >          |                |      TH1C   TH1S   TH1F  TH1D
> >          |                |
> >          |                |
> >          |               TH2
> >          |                |
> >          |                |
> >          |                ------------------------------
> >          |                        |      |      |      |
> >          |                       TH2C   TH2S   TH2F   TH2D
> >          |
> >         TH3
> >          |
> >          |
> >          ------------------------------
> >                  |      |      |      |
> >                 TH3C   TH3S   TH3F   TH3D
> >
> > The functions Projection, etc will be moved to TH2 or TH3
> >
> >Rene Brun
> >
> >Pasha Murat (630)840-8237 FNAL (630)859-3463 home wrote:
> >>
> >> Dear Rene,
> >>
> >> sorry for being so ignorant - bring my deep apologies. Just as an excuse:
> >> I'd never guessed to search for a method filling the slices in Y inside
> >> 1D histogram class. May be I'm relying on my inuition too much, but
> >> intuitively Y-slice seems to be something which generic 1D hist doesn't have.
> >> This caused my confusion. Let me ask one question: may be it is a matter of
> >> me not being a very good designer, but do you think is it right for 1D
> >> histogram class to have methods like ProfileY(), even if they don't do
> >> anything?
> >>                                                 thanks, Pasha
> >> Rene Brun wrote:
> >> >
> >> > Dear Pasha,
> >> >
> >> > I am surprised by your question. Root supports ALL projections, bands,
> >> > slices facilities of Hbook and many more. Did you look at the TH1 specs
> >> > ?
> >> > You will find:
> >> >
> >> >     virtual void     FitSlicesX(TF1 *f1=0,Int_t binmin=1, Int_t
> >> > binmax=0,
> >> >                                 Int_t cut=0 ,Option_t *option="QNR");
> >> >     virtual void     FitSlicesY(TF1 *f1=0,Int_t binmin=1, Int_t
> >> > binmax=0,
> >> >                                 Int_t cut=0 ,Option_t *option="QNR");
> >> >     virtual void     FitSlicesZ(TF1 *f1=0,Int_t binminx=1, Int_t
> >> > binmaxx=0,
> >> >                                 Int_t binminy=1, Int_t binmaxy=0,
> >> >                                 Int_t cut=0 ,Option_t *option="QNR");
> >> >     virtual Stat_t   Integral();
> >> >     virtual Stat_t   Integral(Int_t binx1, Int_t binx2);
> >> >     virtual Stat_t   Integral(Int_t binx1, Int_t binx2, Int_t biny1,
> >> >                               Int_t biny2);
> >> >     virtual Stat_t   Integral(Int_t binx1, Int_t binx2, Int_t biny1,
> >> >                               Int_t biny2, Int_t binz1, Int_t binz2);
> >> >         TProfile    *ProfileX(const char *name="_pfx", Int_t
> >> > firstybin=0,
> >> >                               Int_t lastybin=9999, Option_t *option="");
> >> >         TProfile    *ProfileY(const char *name="_pfy", Int_t
> >> > firstxbin=0,
> >> >                               Int_t lastxbin=9999, Option_t *option="");
> >> >             TH1D    *ProjectionX(const char *name="_px", Int_t
> >> > firstybin=0,                                    Int_t lastybin=9999,
> >> > Option_t *option="");
> >> >             TH1D    *ProjectionY(const char *name="_py", Int_t
> >> > firstxbin=0,                                    Int_t lastxbin=9999,
> >> > Option_t *option="");
> >> >             TH1D    *ProjectionZ(const char *name="_pz", Int_t
> >> > firstxbin=0,                                    Int_t lastxbin=9999,
> >> > Int_t firstybin=0,
> >> >                                  Int_t lastybin=9999, Option_t
> >> > *option="");
> >> >             TH1     *Project3D(Option_t *option="x");
> >> >
> >> > In addition, the Root functions work from an existing 2-d or 3-d
> >> > histograms.
> >> > No need to prebook the projections, slices, etc as it was the case for
> >> > Hbook.
> >> >
> >> > Rene Brun
> >> > Pasha Murat (630)840-8237@169G wrote:
> >> > >
> >> > > Hi Rooters,
> >> > >
> >> > > in old good days of HBOOK 2D histograms had a set of nice facilities of
> >> > > slices, banks and projections which were extremely handy for analysis.
> >> > > I'm thinking if it is worth having the equivalent functionality in ROOT
> >> > > classes - it is certainly true that everybody can easily implement such
> >> > > macros for himself, but wouldn't it be nice to have a common set of such
> >> > > utilities ?
> >> > >                                                 thanks, Pasha
> >
> >
> 
> --
> Vincent Colin de Verdiere (vincent.colin.de.verdiere@cern.ch)
> at home: 44, rue de la Fruitiere, F-01710 Thoiry, tel: 04 50 20 87 90
> at work: CERN, division EP, Office 13-1-038, CH - 1211 Geneva 23
>          tel: (+41) 22 76 72839  fax: (+41) 22 767 9075



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:20 MET