Hi David, In general: - when you have a collection "owning" the objects use Delete(). This will delete the objects and clear the collection. - when a collection stores "references" (i.e. the objects are "owned" by a different collection or some pointer array), use Clear(). This clears the collection, but does not delete the object. Since TClonesArrays always own the objects use Delete(). However, TClonesArrays are special in that they not really delete the object space, TClonesArray::Delete() only makes sure the destructors of the objects are called properly. David Nitz wrote: > > I'm fairly new to trying to use root and C++. I'm trying to set up > an event structure similar to the examples using TClonesArray. > > I've gone over this a number of times, but remain confused about when > I should use "Clear" and when I should use "Delete" to prepare storage > for a new event. Can anyone explain the difference to me? Thanks. > > David F. Nitz (dfnitz@umich.edu) > Physics Department, University of Michigan -- Org: CERN, European Laboratory for Particle Physics. Mail: 1211 Geneve 23, Switzerland Phone: +41 22 7679248 E-Mail: Fons.Rademakers@cern.ch Fax: +41 22 7677910
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:26:21 MET