[ROOT] Re: questions on TH3

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Apr 11 2002 - 17:13:03 MEST


Hi Elena,

Elena Vataga wrote:
> 
> Hello, rooters!
> 
> I have few question on TH3:
> 
> 1. I have ntuple variables which have parabolic form in xy plane
> propagated along z, so building 3dim histo:
>         mytree->Draw("XYZloc.fZ:Phi*180/pi:R>>mmm")
> 
>         I expect to have        fZ - on X axis
>                                 Phi  on Y axis
>                                 R    on Z axis
>         But instead according to EventStatus from Canvas I am getting
>                                 fZ   on Z axis
>                                 Phi  on y axis
>                                 R    on X axis
> And indeed, making:
> TH3F *mmm = new TH3F("mmm","Phi vs R vs Z", r range, phi range, z range)
> is the right order for booking..
> 
> so in TTree->Draw()
> the order of variables is: "z:y:x" and in TH3
> constructor (x,y,z) - correct?
> 

This is correct.
If you do mytree->Draw("y:x");
you get the y variable along the y axis and the x variable along the x axis.
Similar logic for 3-D

> 2.      Making:
> 
>         mmm->Project3D("xy")
>         I am getting polynomial of 2 degree - which I need to fit,
>         and
>         mmm_xy->ProfileX(),
>         mmm_xy_px->Fit("pol2") works fine..
> 
>         but
>         mmm->Project3D("x")
>         shows distribution in R (which I belive is Y) instead of Phi- this
>         confuses me even more:
>         so in Project3D("xy") x-axis correspond to y axis in 3Dim....
> 

 No, this again is correct. You should get "R" if the way you
produced the 3-d plot was:
        mytree->Draw("XYZloc.fZ:Phi*180/pi:R>>mmm")

> 3. Next question - when trying to use
>         root [82] mmm->FitSlicesZ("pol2")

No. Look at the TH3::FitSlicesZ prototype. It is:
    void    FitSlicesZ(TF1 *f1=0,Int_t binminx=1, etc

You should give a pointer to TF1 object, not the name of the function.
I could also add the variant with the name.

Rene Brun


> Error: Can't call TH3F::FitSlicesZ("pol2") in current scope
> FILE:/tmp/filefo7Fbq_cint LINE:1
> Possible candidates are...
> filename       line:size busy function type and name  (in TH3F)
> filename       line:size busy function type and name  (in TH3)
> (compiled)        0:0    0 public: 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); //*MENU*
> filename       line:size busy function type and name  (in TH1)
> filename       line:size busy function type and name  (in TNamed)
> filename       line:size busy function type and name  (in TObject)
> filename       line:size busy function type and name  (in TAttLine)
> filename       line:size busy function type and name  (in TAttFill)
> filename       line:size busy function type and name  (in TAttMarker)
> filename       line:size busy function type and name  (in TAtt3D)
> filename       line:size busy function type and name  (in TArrayF)
> filename       line:size busy function type and name  (in TArray)
> Error: Failed to evaluate class member 'FitSlicesZ("pol2")'
> (mmm->FitSlicesZ("pol2"))Possible candidates are...
> filename       line:size busy function type and name
> *** Interpreter error recovered ***
> 
> I guess I am using FitSlicesZ in a wrong way...
> 
> I am attaching 3dim plot, hope you could suggest something,
> 
>         Thanks!
>                 Elena
> 
>   --------------------------------------------------------------------------------
> 
>                   Name: 3d.ps
>    3d.ps          Type: Postscript Document (APPLICATION/PostScript)
>               Encoding: BASE64
>            Description: z_vs_phi_vs_r.ps



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