Re: I/O of TClonesArray members in TTree

Mark Boulay (mgb@owl.phy.queensu.ca)
Tue, 13 Oct 1998 12:34:01 -0400 (EDT)


By 'testing' the object, I mean performing a logical operation on
one of the object's data members. As an example, if I have a
TClonesArray *fTracks (as in the root example), I would like to do
something like

Track *fTrack;
Int_t i = 0;
Float_t fMinPx = 10;

while ( i < fTracks->GetEntries() )
{
fTrack = (Track *)fTracks->At(i);
if ( fTrack->GetPx() < fMinPx ) fTracks->Remove( fTrack );
}

I don't want to modify the file which contains the TTree, but only
have the fTracks array modified when read in, with the ability to
vary fMinPx before doing so.
I would like to have this implemented in the Streamer method of the
Event class, and I'm wondering how I can do this if I've written
the tree with splitlevel = 1.

Thanks again,
Mark.


=================================================================
= =
= Mark Boulay =
= Department of Physics phone/voice mail: (613) 545-6861 =
= Queen's University fax: (613) 545-6813 =
= Kingston, Ontario email: mgb@sno.phy.queensu.ca =
= Canada, K7L 3N6 =
= =
=================================================================

On Tue, 13 Oct 1998, Rene Brun wrote:

> Mark Boulay wrote:
> >
> > Dear Root team:
> > I want to accomplish the following, and am not sure what
> > the best (if any) method is for doing it. I have a TTree which
> > contains a TClonesArray branch. When reading the tree, I would
> > like to test each object in the TClonesArray, and only use it
> > if it passes some test based on a flag I have set. I am currently
> > writing the TTree with splitlevel = 1, which contains an event-level
> > branch, which in turn contains the TClonesArray.
> >
>
> Mark,
> Please, be more specific with your question. What do you mean by
> "testing each object"? What is the difference between testing
> and using.
> See examples of a TTree in $ROOTSYS/test/Event and associated
> macros eventa and eventb.
>
> Rene Brun
>