I have a file f1.root with a Tree “mytree” with one Branch "Branch1"
How can I add a new branch to this Tree in this file?
I use
[code]TFile *f1 = new TFile(“data.root”, “update”);
TTree tree = (TTree)f1->Get(“mytree”);
TBranch *br;
br = tree->Branch(“Branch2”,&A,"…");
…
f1->cd();
tree -> Write(“mytree”);
[/code]
But when I run it once more it creates an additional Branch2;2 in a Tree.
I need to overwrite it.
How can I do it?