I was wondering how you can fill events in an existing tree, I was trying something like this:
#first make a new one
subtree = ROOT.TTree(“subtree”,“subtree”)
subtree.Branch(“var1” ,get_var1)
subtree.Branch(“var2” ,get_var2)
subtree.Write()
#later in an event loop
subtree = ROOT.gDirectory.Get(“subtree”)
get_var1 = var1_value_for_event_i
get_var2 = var2_value_for_event_i
subtree.Fill()
but this gives the following error:
Error in TBranchElement::Fill: attempt to fill branch var1 while addresss is not set
Error in TBranchElement::Fill: attempt to fill branch var2 while addresss is not set