Re: [ROOT] Merging files

From: Matt Palmer (palmer@hep.phy.cam.ac.uk)
Date: Thu Dec 20 2001 - 11:27:11 MET


Hi Dennis - I had that problem too, here's the code I used to do it - 
basically you have to create a TFile first and use the other version of the 
Merge function

Matt

TFile* f1 = new TFile("merge.root", "recreate");
TChain ch1("T1");
ch1.Add("file1.root");
ch1.Add("file2.root");
ch1.Merge(f1, 0);

TChain ch2("T2");
ch2.Add("file1.root");
ch2.Add("file2.root");
ch2.Merge(f1, 0);

f1->Close();


On Thursday 20 December 2001  3:21 am, Dennis C. Arrogancia wrote:
>Dear Rooters,
>
>
>I have a little problem regarding merging files containig a tree. I tried
>using the code below and it works fine in my case.
>
>
>  TChain ch("T");
>  ch.Add("file1.root");
>  ch.Add("file2.root");
>  ch.Add("file3.root");
>  ch.Merge("big.root");
>
>
>Now, my problem is how can i merge these three files if each of them
>contains two or more trees? Say file1.root contains trees such as
>"T1","T2", and "T3". Similarly for file2.root and file3.root, they also
>contain the same number of trees.
>
>
>
>Dennis



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:12 MET