Reading tree with vector branches

Dear All,

    Have been having some troubles when trying to read 
    some vector branches from a tree.

    Reading through older posts, two ways to do so came to mind.
    See Analysis.py and Analysis2.py. The latter seems to do just fine
    while the former crashes leaving the terminal stuck.

    We would rather having Analysis.py working as we hope that
    passing "MyCopy" rather than "chain" to other functions may
    improve the performance.

    Thanks, 
        Nicolas

Analysis2.py (1.28 KB)
Analysis.py (1.52 KB)

Hi,

not sure what the struct is for? In general these are not a good idea for anything other than builtin types. Classes that have non-trivial constructors loaded from a macro don’t work.

Instead of the struct, simply create a “myvec = ROOT.std.vector(‘float’)()” and use that instead of “AddressOf(mycopy,‘mc_pt’)”.

HTH,
Wim