Andy, THStach::GetHistogram returns a pointer to an intermediate fixed bin size histogram used to set the range and for picking. You cannot use this histogram to return the bin information. You must get a pointer to one of the histograms in the stack, the first one, for example. Rene Brun On Mon, 28 Jul 2003, Andy Hocker wrote: > > Hi, > > When I use THStack with histograms with variable bin sizes, > I've noticed that the bin edges get messed up somehow. The > problem can bre reproduced with the folliwng script: > > { > gROOT->Reset(); > > Int_t nbins = 4; > Float_t lowEdge[5] = {0,1,2,2.5,3}; > > TH1F *h1 = new TH1F("nh1","blah",nbins,lowEdge); > > THStack *hs = new THStack("nhs","stack"); > hs->Add(h1); > hs->Draw(); > > for (Int_t i = 1; i <= nbins; i++) { > cout << "Bin " << i > << ": Original histogram's low edge = " > << h1->GetBinLowEdge(i) > << "\t Stacked histo's low edge = " > << hs->GetHistogram()->GetBinLowEdge(i) > << endl; > } > } > > This produces the output: > > Bin 1: Original histogram's low edge = 0 Stacked histo's low edge = 0 > Bin 2: Original histogram's low edge = 1 Stacked histo's low edge = 0.75 > Bin 3: Original histogram's low edge = 2 Stacked histo's low edge = 1.5 > Bin 4: Original histogram's low edge = 2.5 Stacked histo's low edge = 2.25 > > One can see the disagreement. Is this a bug or am I just missing > something subtle? > > This is with ROOT version 3.05/04 on Red Hat 7.3.1. I realize > 3.05/04 is not the current pro release --- I had a look at the > new release notes and didn't see any recent attempts to address > this problem. > > Thanks a lot, > Andy > >
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:14 MET