Re: Creating a copy of a tree

From: Tim Head <betatim_at_gmail.com>
Date: Tue, 26 May 2009 12:54:38 +0100


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
>>
>
>

-- 
http://tim.jottit.com/
Received on Tue May 26 2009 - 13:54:51 CEST

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