Dear ROOT experts,
I’m trying to add the contents of two TTrees (that contain different TBranches i.e. different names, types etc.) from the same file into another TTree, so that I can then use MakeClass on the new tree that contains all the branches of the other two.
I’m not sure what’s the best way to do this but I tried to do
[code]
TFile *f = new TFile(“out.root”);
TTree * t1 = (*TTree)f->Get(“GEN”);
TTree * t2 = (*TTree)f->Get(“Analysis”);
TList list;
list.Add(t1);
list.Add(t2);
TFile *f = new TFile(“new.root”);
TTree::MergeTrees(&list)
f->Write();
f->Close();
[\code][/code]
but only the branches from the first tree were present, and a message saying that the first set of branches couldn’t be found appeared when it tried to reaed the second tree.
Is this correct? Or is there a better way to do it?
Cheers,
Chris Boddy