[ROOT] THStack at variable binning

From: Andy Hocker (hocker@fnal.gov)
Date: Tue Jul 29 2003 - 02:40:47 MEST


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

-- 
---------------------------------------------------------
Andy Hocker                     office: CDF trailer 168-O
University of Rochester         phone:     (630)-840-8622
Fermilab/CDF - M.S. 318         fax:       (630)-840-2968
PO Box 500                      e:        hocker@fnal.gov
Batavia, IL  60510              hey ho:          let's go
---------------------------------------------------------



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:14 MET