Re: Consolidating different TTrees into one

From: suvayu ali <fatkasuvayu_at_gmail.com>
Date: Tue, 2 Nov 2010 14:34:44 -0700


Hi Philippe,

On 2 November 2010 10:56, Philippe Canal <pcanal_at_fnal.gov> wrote:
> Hi,
>
>> My TNtuples have different  names and are in the same file.
>
> Just do:
>
>     ch.Add("f1.root/name1");
>     ch.Add("f1.root/othername");
>     ch.Add("f1.root/somethingelse");
>

Thanks! I shouldn't have missed that, its all so clearly stated in the docs.

> Cheers,
> Philippe.
>
> On 11/2/10 12:25 PM, Suvayu Ali wrote:
>>
>> Hi Rene and Axel,
>>
>> On Tuesday 02 November 2010 03:48 AM, Rene Brun wrote:
>>>
>>> You can set a weight for each of your Trees via TTree::SetWeight().
>>> For example, suppose that you have 3 files f1.root, f2.root, f3.root,
>>> each containing a Tree "T".
>>> You can make persistent the weight for each Tree by doing something like
>>>    TFile f1("f1.root","update");
>>>    T.SetWeight(3.14);
>>>    T.AutoSave();
>>> and same for f2.root, f3.root.
>>> Now in an interactive session, you can do
>>>     TChain ch("T");
>>>     ch.Add("f1.root");
>>>     ch.Add("f2.root");
>>>     ch.Add("f3.root");
>>>     ch.Draw("myvar");
>>> you will get the histogram for "myvar" with the weight for each entry
>>> corresponding to each tree weight.
>>>
>>
>> Incidentally a friend pointed me to that exact same method just before I
>> got your email! This serves my purpose just right, I was looking for
>> something exactly like that.
>>
>> However I might have another complication. My TNtuples have different
>> names and are in the same file. So does that mean I need to rename them
>> with SetNameTitle() and save to separate files, before I can do the
>> above?
>>
>>> Rene Brun
>>
>>
>> Thanks for the suggestions.
>

-- 
Suvayu

Open source is the future. It sets us free.
Received on Tue Nov 02 2010 - 22:35:16 CET

This archive was generated by hypermail 2.2.0 : Thu Nov 04 2010 - 23:50:02 CET