[ROOT] Q: how to merge several trees into one and to write the result out?

From: Pasha Murat (630)840-8237@169G ((630)840-8237@169G)
Date: Tue Jan 02 2001 - 19:51:19 MET


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