Re: questions on TClonesArray theory / Event class

From: Pasha Murat (630)840-8237 FNAL (630)859-3463 home (murat@murat.fnal.gov)
Date: Sat Feb 12 2000 - 05:37:14 MET


Hi Jeff,

TCLonesArray is a specialized container designed to optimize storage
of similar objects. "Clone" in "TClonesArray" warns that all the objects 
your store in this container HAVE to have the same size. You certainly
can loop over the objects stored in the container in the interactive 
session and invoke their methods. May be not T->Draw("ppsi.Mag()"), but
something like 

	for (int i=0; i<array->GetEntriesFast(); i++) {
           TLorentzVector* p = (TLorentzVector*) array->At(i);
           histogram->Fill(p->Pt());
        }

Also could you give an example of a 4-vector which may or may not be 
defined for an event? - One of the possibilities I could imagine is
that some list of particles would be empty - say, in 
case an event doesn't have muons reconstructed in it the corresponding 
"list of reconstructed muons" would be an empty TClonesArray (stored in
the tree). Is it what you've been asking for?
						best, Pasha

Jeff Templon wrote:
> 
> Hi Root,
> 
> I think I am beginning to understand Rene's comment that it would be
> better if I created a simple event class to handle my Tree filling
> tasks [see the thread I started about two weeks ago].  All the Event
> class examples I have seen so far are filling TClonesArrays of Tracks.
> 
> The question: something about the name Clone suggests to me that my
> objects will lose their identity if I make them part of a
> TClonesArray; that is I would not be able to associate a particular
> member name with that object later on.  I want to be able to say
> something like T->Draw("ppsi.Mag()") So it would appear that I should
> not use a TClonesArray since I want to know easily which particle is
> which in later analysis (and since there are not many particles
> produced).
> 
> Also, suppose I have some TLorentzVector objects which for some events
> are present, but others not.  How do I prevent old values from showing
> up in the tree?  Can I just set the object equal to zero (as some of
> the examples seem to do with unitialized objects)?
> 
> Thanks for any help.
> 
>                                         Jeff



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:18 MET