Re: [ROOT] copying branches between trees

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon Apr 23 2001 - 23:01:50 MEST


Hi Eddy,

Copying a branch from one Tree to another Tree is not just a simple
memory copy or assignment. It may involve a substantial amount of I/O.

We give examples of copying subsets of a Tree to another Tree in the
two tutorials
  $ROOTSYS/tutorials/copytree.C
  $ROOTSYS/tutorials/copytree2.C

With Root version 3.01 (the current development version for which
the source is available from CVS) includes a fully operational
new facility the Tree FRIENDSHIP. We already discussed this point
some time ago. You can read more about Tree Friends at URLs:

  http://root.cern.ch/root/htmldoc/TTree.html
  http://root.cern.ch/root/htmldoc/TTree.html#TTree:AddFriend

 For example, these commands generate a 3-d scatter plot of variable "var"
 in the TTree tree versus variable v1 in TTree ft1 versus variable v2 in
 TTree ft2.

 tree.AddFriend("ft1","friendfile1.root");
 tree.AddFriend("ft2","friendfile2.root");
 tree.Draw("var:ft1.v1:ft2.v2");


Rene Brun


On Mon, 23 Apr 2001, Eddy Offermann wrote:

> 
> Dear Root-ers,
> 
> Suppose we have tree t1 and tree t2 and we want to copy
> a branch from t1 to t2. How does one do it in a general
> way, so no knowledge about the type of branch (case A, B ...)
> ??
> 
> I would have expected a command like t2->SetBranch(t1->GetBranch(".."))
> 
> Best regards,
> Eddy
> 
> 



This archive was generated by hypermail 2b29 : Fri Jun 08 2001 - 11:51:23 MEST