[ROOT] Re: TClonesArrays in ROOT events and readback

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Jul 12 2002 - 08:41:04 MEST


Hi Amanda,

The configuration that you describe should work.
The automatic schema evolution system will take care of the
mapping between the old class and the current one in memory.
If, in a first run, the Tree does not contain entries in D0List,
no objects are written to the Tree and none will be read.
If you use a TChain of TTrees produced with different versions
of the class in D0List, this should also work. In this case,
it is your responsability to make sure that data members not
existing (or the contrary) in some versions are correctly
initialized, otherwise your query might be meaningless.

Rene Brun

On Thu, 11 Jul 2002, Amanda Weinstein wrote:

> 
> My question is as follows.  If I have an event
> structure containing TClonesArrays, etc. the class
> constructor looks like this:
> 
> EcsEvent::EcsEvent() {
> 
>   if (!_fsimpleTrackList)
>     _fsimpleTrackList   = new TClonesArray("SimpleTrack", 100);
>   _simpleTrackList = _fsimpleTrackList;
>   if (!_fD0List)
>     _fD0List           = new TClonesArray("TrackD0", 100);
>   _D0List = _fD0List;
> 
>   _referenceList = new TObjArray(500);
> 
>   Clear(NULL);
> 
>  _simpleTrackList->BypassStreamer(kFALSE);
>  _D0List->BypassStreamer(kFALSE);
> }
> 
> (The actual event structure has a lot more lists in it, but this
> is enough for the purposes of illustration).
> 
> Now, in the code I actually run, _D0List is never actually filled,
> and therefore, given my understanding, is never written out,
> except for the pointer itself.  Let's say that I produce a tree
> with one branch of "EcsEvent" objects, filled as above, so that
> the _simpleTrackList and _referenceList objects contain stuff,
> but the _D0List never does.
> 
> Now, imagine that the size of the "TrackD0" object were to be
> changed, and the code recompiled.  Will it still be possible
> to read back the tree generated above, which don't actually
> contain any "TrackD0" objects, even though EcsEvent creates
> a TClonesArray of "TrackD0" objects in its constructor?  Or
> will the change to the "TrackD0" object result in the readback
> becoming corrupted?
> 
> 			Thanks,
> 			   Amanda
> 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:59 MET