I’ve ran into some issues while using TTree::SetBranchAddress method in PyROOT. I need it because I don’t the variable name in advance, so I won’t be able to use the Python way of accessing the branch with tree.branchName
I’ve been able to track the problem down to this: when I’ve got calls to this function (in a loop with the same tree and different variable names) in a larger program I’m getting a segmentation violation or glibc detected python: malloc(): smallbin double linked list corrupted in a random place of my program even though the function neither returns nor changes anything.
def MakeEqualProbBinning( targetTree, variableName ): varWeightList =  var = array( 'd', [0.] ) targetTree.SetBranchAddress( variableName, var ) entryNum = targetTree.GetEntries() for entryIdx in range( entryNum ): targetTree.GetEntry( entryIdx ) varWeightList.append( ( var, targetTree.weight ) )
The tree seems to be fine, I’m able to access all of the branches with tree.branchName and tree.Draw( ‘branchName’ ).
I’ve got this problem both locally on Ubnuntu 16.04 with ROOT 6.12/06 and on lxplus with ROOT 6.14/04
What could’ve caused it? Is there any other way to access a branch in a tree in PyROOT if I don’t know the name of the branch in advance?
Thanks in advance,