Re: [ROOT] Truncating a TClonesArray

From: Rene Brun (Rene.Brun@cern.ch)
Date: Sun Aug 03 2003 - 08:32:38 MEST


Why do you want to avoid calling TClonesArray::Clear ?

Rene Brun

On Wed, 30 Jul 2003, 
Hamlet wrote:

> (18:39, mercoledì 30 luglio 2003)
> > What are you trying to accomplish?
> 
> I'm trying to skip the more steps it's possible in my program, as 
> redundant clearings.
> I'm filling a tree with an object, err... Event, which has a pointer to 
> a TClonesArray (CA) of, say, Particle-s.
> I use an instance of Event, call it pEvent, as branch address and like a 
> buffer.
> So if on first loop I put 5 Particle-s in pEvent, the CA will have 5 
> newly created entries. Streamer will write them.
> On second loop I am trying to clear nothing (this Particle object are 
> simple enough to allow this without risk). Say that second event has 
> only 3 particles; if it's possible to set fLast to -1, I'm going to do 
> that and then to add (via TClonesArray::operator[]) the 3 particles.
> If it's not possible, I'll leave fLast untouched, assign particles 
> (always with the same operator[]) and then I shall set fLast to 2; in 
> both cases Streamer() should write 3 particles, right?
> If an odd event had no particle, anyway, I couldn't save a CA with zero 
> elements (unless I Clear() it, which is what I'm trying to avoid).
> 
> As you see it's not an essential request, anyway.
> 
> 



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