[ROOT] THStack with variable-binned TH2

From: Chris Roat (croat@SLAC.stanford.edu)
Date: Thu Apr 17 2003 - 01:41:16 MEST


I think that THStack somehow loses it's variable
binning for 2D histograms.  It seems to work
fine for 1D.  See the code below for the 2D case.

I don't think it's a problem in BuildStack(),
which clones 2D histos.  The Paint() method is a
little cryptic to me.  Any help would be
appreciated!

Chris


  // bins variable
  Float_t bins[4]= { -3, -0.5, 0.5, 3 };

  // create histos and fill randomly
  TH1 *h2 = new TH2F("h2","h2",3,bins,3,bins);
  TH1 *h2a = new TH2F("h2a","h2a",3,bins,3,bins);

  h2->SetFillColor(kBlue);
  h2->FillRandom("gaus",1000);
  h2a->SetFillColor(kRed);
  h2a->FillRandom("gaus",40);

  // make a stack and draw it
  THStack *hs2= new THStack();
  hs2->Add(h2,"LEGO");
  hs2->Add(h2a,"LEGO");
  hs2->Draw();



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