Re: Creating a copy of a tree

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Tue, 26 May 2009 09:32:49 -0500


Hi Tim,

CopyTree: Allow the use of a 'TTreeFormula' selection for chosing which even to copy over.
CloneTree: Only allow the selection of the number of entries to be selected. When all entries are

    selected, allow for a near-disk speed copy of the data (use option "fast")
CopyEntries: Used to copy data into an existing TTree (CopyTree and CloneTree will create a new

    'output' tree.
TChain::Merge: Essentially the same as CloneTree.

So for you purpose, use Merge or CloneTree with the "fast' option.

Cheers,
Philippe.

Tim Head wrote:
> Hello Rene,
>
> 2009/5/25 Rene Brun <Rene.Brun_at_cern.ch>:
>
>> see TChain::Merge
>>
>>
>
> Thanks! I had a brief look at the code of Merge() and was expecting it
> to use one of the other three methods, but it doesnt look like that.
>
> So my question remains, what is the subtle difference between these
> (now) four seemingly different ways? When would I want to use one and
> when the other in the case of wanting to copy a tree or merge a chain?
>
> Thanks,
> Tim
>
>
>> 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 - 16:32:55 CEST

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