Re: [ROOT] Compress in TClones Array

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Nov 23 2000 - 08:50:46 MET


Haitao,

A TObjString, like a TString is an object with a variable length.
The current TClonesArray implementation in Trees assume that all the objects
in the array have the same length, so you should not use TObjString.

About the update mode:
 - you can add a new branch to an existing Tree. When you do that, you must be
   careful to fill only the new branch(es) using TBranch::Fill and not
   TTree::Fill such that all the branches (old and new) have the same number
   of entries.
 - Replacing data in a branch/leaf is not supported for many reasons:
   This could be supported for basic types when the buffers are not compressed.
   With compression, the new buffer may be of different length. If it is
smaller,      no problem, except that the data base will be filled with holes
difficult
   to reuse without a garbage collection.
   If the buffer is longer, it has to be written at a different location anyway.
   So, it is in general much cheaper to allocate new branches with the new data
or     create a new Tree with only the modified branches.

Rene Brun

Haitao Liu wrote:
> 
> Hi,
> 
> I have find the problem with TClonesArray, the problem is that I can not use
> TObjString. in splict mode. While in user guide I know that TString can not
> be used, it does not say I can not use TObjString. Further more, if I use
> TClonesArray::Delete instead of  TClonesArray::Clear, I get segmantation
> fault.
> 
> Another question is that can we use TTree in update mode? That mean we read
> the TTree from a TFile, add a branch, modify some leaves and write it back.
> Of course we can read the old TTree and write a new TTree, but for large
> files it will be both space and time consuming.
> 
> Thanks with regards                                        Haitao



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