Dear experts,
I’m trying to pass a Branch to an existing Tree (I have a branch in 1.root and want to pass to 2.root but in the same TTree)
1.root —> tree;1 —> branch1, branch2, …
tree;2—> branch11, branch21, …
2.root —> tree;1 —> branch1a, branch2a, …
tree;2—> branch11a, branch21a, …
I already tried with copytree but this creates a new Tree and I want the branch in the tree;1 in 2.root, and with TTree::MergeTrees they online save one branch and this branch does not have the same number of events (in the case of merge is in the same rootopla “2.root2” and I tried to merge or link tree;1 and tree;2).
This is my code of Merge
TFile *file1 = new TFile("2.root","UPDATE");
TTree *tree1 = (TTree*)file1->Get("Treerecortado;1");
TTree *tree2 = (TTree*)file1->Get("tree;2");
//tree2->Fill();
TList *list = new TList;
list->Add(tree2);
list->Add(tree1);
TTree *newtree = TTree::MergeTrees(list);
newtree->SetName("T");
newtree->Write(0, TObject::kOverwrite);
newtree->Print();
So I do not know how to fix or how to do what I want
Thanks & best,
Manuel
Please read tips for efficient and successful posting and posting code
ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided