Re: Deleting a branch from a tree

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Mar 02 1999 - 19:10:28 MET


Scott Sampson wrote:
> 
> Hi,
> 
> I have a tree (a converted hbook ntuple) and I want to get rid of some of
> the variables. Is there a way to delete individual branches, then rewrite
> the file so that those branches are not there anymore? One reason I would
> like to do this is to reduce the size of some ntuples. Another use would
> be to change a value in the ntuple: i.e. delete branch "x", then create a
> new branch "x" with different values and write out that branch. Thanks,
> 
> Scott

Hi Scott,
I suggest you look at the example in $ROOTSYS/test/stress.cxx
Look at stress15.
You can use TTree::SetBranchStatus to enable/disable some branches
and then use TTree::CloneTree

I take this opportunity to recommend to our advanced users to look
in details at the stress program in the test directory.
This program has been developped to test most features of the Root
system.
It includes a suite of 16 programs.

Rene Brun



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:29 MET