Hi Pasha, You can use the TChain::Merge method to a file from the collected trees. Suzanne ----- Original Message ----- From: "Pasha Murat (630)840-8237@169G" <murat@ncdf41.fnal.gov> To: "roottalk" <roottalk@pcroot.cern.ch> Sent: Tuesday, January 02, 2001 12:51 PM Subject: [ROOT] Q: how to merge several trees into one and to write the result out? > Dear Rooters, > > I'm pretty sure this little problem has already been solved. I'm trying to merge > several ROOT trees (all having the same structure) residing in different files > into a single one and to write the resulting tree out. The simpliest procedure > I tried - to create a chain and to write it out using methods of TChain class > doesn't do the job - I can create a chain > > TChain c1("/STNTUPLE/h1"); > > c1.Add("/data/run1/einclusive/root/iceflt_ccj951.root"); > c1.Add("/data/run1/einclusive/root/iceflt_ccj952.root"); > c1.Add("/data/run1/einclusive/root/iceflt_ccj953.root"); > > but I didn't find a way to either write the chain with all the events out - > TChain::Write doesn't seem to write out the events, or to copy contents > of a chain into a new tree - smth. along these lines > > TFile output_file("output.root"); > TTree* output_tree = c1.CloneTree(); > output_file.Write(); > > I'd appreciate any help here and I also think that that having a method > TChain::CloneTree overloading TTree::CloneTree might be quite useful. > > Happy New Year and thanks, Pasha > >
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:33 MET