The problem:
I clone my tree so that I don’t mess up the previous root file:
cloned_tree = tree.CloneTree(0)
When I type tree.GetEntries()
I see that it prints a large number. But when I do
output_file = ROOT.TFile("with_weights.root", "RECREATE")
cloned_tree.GetEntries()
that returns 0. So how does the cloned tree is empty?
My ultimate goal: I have a tree where I want to add a new branch (weights) to it . The values (weights) I want to add are already stored in a different .root file. I started by cloning the tree, then I loop over the weights and save them as a list. Then I try to create a new branch and fill the branch with this new list.