How to create Branch in python and ROOT 6?

Why this works in ROOT 5:

import ROOT
tree = ROOT.TTreee()
tree.Branch("a", 0)

while in ROOT 6 I get

TypeError: can not resolve method template call for ''

I also tried

tree.Branch("float")("a", 0)

but still same answer

Hi,

sorry, I’m still sitting on this one (had to make some fixes for the doc string of TTree::Branch first).

Later,
Wim

Hi,

that was subtle. The problematic code is present in both 5 and 6, but a different path is taken through 5. Looks like the behavior is the same now …

Thanks for digging this up. :slight_smile:

Cheers,
Wim

Hi @wlav sorry for jumping in. Was this fixed in any recent root release? I think I am observing exactly the same problem with ROOT version 6-20-02.
Thanks
Nicola

OK, for the record I solved this following some other online posts in this way

input_file = R.TFile.Open(input_filename,'update')
input_tree = input_file.Get(tree_name)
rew_func  = array('d',[0])
branch_new_func = input_tree.Branch('branch_rew_func',rew_func, 'branch_rew_func/D')
tot_entries = float(input_tree.GetEntries())
index = 0
for event in input_tree :
    rew_func[0] = some_value
    branch_new_func.Fill()
    if  index > tot_entries:
        break
    index ++
input_file.Write()
input_file.Close()