Re: [ROOT] Problem with TH3

From: Thomas Bretz (tbretz@astro.uni-wuerzburg.de)
Date: Thu Mar 18 2004 - 18:41:49 MET


Hi Rene,

why does h4 need the same number of bins? It is enough if h4 'takes' the 
binning from either h3 or h2, isn't it?

Thomas.

Rene Brun wrote:
> Your two projections h2 and h3 have the same number of bins,
> eg you can do h3->Divide(h2);
> However, you call the default constructor for h4. h4 does not have the
> same number of bins as h2 and h3.
> Instead of
>   TH2D *h4 = new TH2D;
>   h4->Divide(h3, h2);
> do
>   TH2D *h4 = (TH2D*)h2->Clone();
>   h4->Divide(h3, h2);
> 
> Rene Brun
> 
> Thomas Bretz wrote:
> 
>>Hi,
>>
>>I have a
>>Double_t x[5] = { 0, 1, 2, 3, 4 };
>>TH3D fHist("", "", 4, x, 4, x, 4, x);
>>and do:
>>fHist.GetZaxis()->SetRange(3, 4);
>>TH1 *h2 = fHist.Project3D("xy_off"); //, -1, 9999, "E");
>>
>>fHist.GetZaxis()->SetRange(1,2);
>>TH1 *h3 = fHist.Project3D("xy_on"); //, -1, 9999, "E");
>>
>>TH2D *h4 = new TH2D;
>>h4->Divide(h3, h2);
>>
>>And I get
>>Attempt to divide histograms with different number of bins...
>>
>>What am I doing wrong? I would expect to have two projections to have
>>the same binning...
>>
>>Thomas.
> 
> 



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:06 MET