Re: Creating a copy of a tree

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Tue, 26 May 2009 00:49:55 +0200


see TChain::Merge

Rene Brun

Tim Head wrote:
> Hello all,
>
> I am looking for an efficient (in terms of typing) way of merging a
> TChain into one TTree (I have several tens of jobs producing part of
> the final tree and its just easier to have one file and one tree for
> the rest instead of Njobs files).
>
> Doing something like:
>
> # ... setup branch addresses from one tree to the other
> for evt in tree:
> # ... copy things, call Fill()
>
> is a lot of work to type, and in python rather slow.
>
> Currently I am using TTree::CopyTree("1") which is fast enough for me.
> And it is reasonably short to type:
>
> out = R.TFile(newfname, "recreate")
> t = chain.CopyTree("1")
> t.Write()
> out.Close()
>
> However I was reading the docs just now and am now wondering what the
> exact difference between CopyEntries(), CloneTree() and CopyTree() is.
> Later two refer to the copytree tutorials, in which also CopyEntries()
> is used.
>
> It seems to me that CopyTree() accepts a TFormula compatible string to
> evaluate whether or not to copy an entry and the others don't, but
> this can't be the only difference?
>
>
> Thanks,
> Tim
>
Received on Tue May 26 2009 - 00:50:22 CEST

This archive was generated by hypermail 2.2.0 : Tue May 26 2009 - 17:50:04 CEST