Re: Consolidating different TTrees into one

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Tue, 2 Nov 2010 12:56:46 -0500


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");

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.
Received on Tue Nov 02 2010 - 18:56:52 CET

This archive was generated by hypermail 2.2.0 : Tue Nov 02 2010 - 23:50:01 CET