I am trying to simply define a Root TTree using python and give it a TBranch. Sounds reasonable, right? I tried:
from ROOT import *
myvar = int()
mytree = TTree('mytree', 'mytree')
tree.Branch('myvar', AddressOf(myvar), 'myvar/I')
exit(0)
and this crashes with the error:
ValueError: invalid argument for AddressOf().
I suspected that perhaps the argument of AddressOf() needs to be a Root type like Int_t, but I didn't think python data types needed to be made explicit--and furthermore I couldn't figure out how to force the data type of of int to be Int_t. Finally, if you do the same exact thing except replace the 'int' with 'TString' and the '/I' with '/S', things do not crash. Any suggestion is appreciated.