[ROOT] THStack addition and maybe a fix

From: Chris Roat (croat@SLAC.stanford.edu)
Date: Fri Jun 21 2002 - 01:44:30 MEST


Hi ROOTers,

Recently I wanted to plot a THStack object, where the "all summed"
histogram was normalized to unity (or some other value).  I thought it
might be interesting to add a method to handle this automatically, which
shouldn't be a problem given that a THStack owns its histos.  It could
just rescale all histograms correctly after the integral of fStack->Last()
is computed.

While attempting to write this in my own code, I wanted to call the
GetStack() method to get the total histo integral.  I hadn't
plotted the stack yet, so BuildStack() had not been called and GetStack
returned a NULL pointer.  Could GetStack() be changed to

TObjArray       *GetStack()  const {
  BuildStack();
  return fStack;
}

?

While looking at the code, I also noticed that the following causes
problems, presumably because no check is made that fHists is non-NULL:

root [0] THStack h
root [1] h.Draw()
<TCanvas::MakeDefCanvas>: created default TCanvas with name c1

 *** Break *** segmentation violation
Root >
 *** Break *** segmentation violation

Minor issue, as most people won't attempt something so boring.

Thanks,
Chris



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