TTree in python root session

Hi,

I think I know what it is: the branch needs a pointer to a pointer and so it is given the address to the data member of the wrapper object of the vector. Problem is that the (python) property implementation is such that a new wrapper is created on each lookup (the property implementation makes the lookup go through functions rather than returning an object from the dictionary), and of course the result can be garbage collected any time after the lookup is done.

So the solution is to either use AddressOf() for these member just like it is done for the other members:tree.Branch("Type",ROOT.AddressOf(s,'type'),s.type.__class__.__name__) tree.Branch("Typesize",ROOT.AddressOf(s,'typesize'),s.typesize.__class__.__name__)or to keep a reference alive to these data members and use those.

This is actually an old problem in a different way: a struct that has a struct datamember can fail the lookup when going through two indirections, as the “middle” object may go dodo-bird along the way.

Cheers,
Wim

P.S. Edit: the second line should have read “typesize” instead of “type”, of course.