THStack Ownership

I am trying to understand how to delete objects added to the THStack class and noticed two statements which seem rather contradictory. In the ROOT user manual July 2006 V5.12, page 41 (as marked) there is the following text…

Histogram Stacks
A THStack is a collection of TH1 (or derived) objects. Use THStack::Add(TH1 *h) to add a histogram to the stack. The THStack owns the objects in the list

while the online html documentation (root.cern.ch/root/html/THStack#T … escription) states…
Class Description
A THStack is a collection of TH1 (or derived) objects
Use THStack::Add to add a new histogram to the list.
The THStack does not own the objects in the list.

John Estrada

Hi John,

Your observation is correct - the current text in the ROOT User’s Guide describes the old behavior of THStack class, which was changed a in cvs rev 1.38 of THStack.cxx. It will be fixed for the next edition.

Thank you, Ilka