Re: questions on TClonesArray theory / Event class

From: Rene Brun (Rene.Brun@cern.ch)
Date: Sun Feb 13 2000 - 12:06:33 MET


Hi Jeff,
To answer your question precisely, I would need more info about
your event model. In a TClonesArray you can store instances of
objects of the same class. These objects may have obviously
members with different values but the number of attributes
must be the same. This means that a member cannot be a pointer
to a variable length structure.
If your particle class has a TLorentzVector as a member, this is OK.
You can set an attribute in your particle object to indicate
if the Lorentz vector has a meaning or not and use this attribute
later on in the analysis to filter selected particles.
A convenient (and very powerful way) to store attributes
of type boolean is to use the TObject::fBits or your particle object.
You can set a bit via TObject::SetBit (ResetBit) and use it via
TObject::TestBit. This is far much better than having boolean data
members as it permits fast "masks" combinations of bits when
you want to combine tests.

Rene Brun

On Fri, 11 Feb 2000, 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