Re: Deleting a branch from a tree

Rene Brun (Rene.Brun@cern.ch)
Tue, 02 Mar 1999 18:10:28 +0000


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