Re: [ROOT] THStack addition and maybe a fix

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Jun 21 2002 - 08:59:21 MEST


Hi Chris,

I have modified GetStack to call BuildStack if the stack is not yet built.
I had to change the signature removing the const qualifier.
I also added protections in case the default constructor is called.

Now in CVS

Rene Brun

On Thu, 20 Jun 2002, Chris Roat wrote:

> 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