From 2e4a807ad33fd2118e5dabd5611a749b536f6b7e Mon Sep 17 00:00:00 2001 From: Mason Proffitt Date: Sat, 11 Jul 2020 15:24:50 +0200 Subject: [PATCH] add type interpretation for vector #507 --- uproot/interp/auto.py | 42 +++++++++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/uproot/interp/auto.py b/uproot/interp/auto.py index 34787823..ee712b1c 100644 --- a/uproot/interp/auto.py +++ b/uproot/interp/auto.py @@ -373,7 +373,11 @@ def transform(node, tofloat=True): return asjagged(asdtype("u4"), skipbytes=10) elif getattr(branch._streamer, "_fTypeName", None) == b"vector" or getattr(branch._streamer, "_fTypeName", None) == b"vector": return asjagged(asdtype("i8"), skipbytes=10) - elif getattr(branch._streamer, "_fTypeName", None) == b"vector" or getattr(branch._streamer, "_fTypeName", None) == b"vector": + elif getattr(branch._streamer, "_fTypeName", None) == b"vector" or getattr(branch._streamer, "_fTypeName", None) == b"vector": + return asjagged(asdtype("u8"), skipbytes=10) + elif getattr(branch._streamer, "_fTypeName", None) == b"vector" or getattr(branch._streamer, "_fTypeName", None) == b"vector": + return asjagged(asdtype("i8"), skipbytes=10) + elif getattr(branch._streamer, "_fTypeName", None) == b"vector" or getattr(branch._streamer, "_fTypeName", None) == b"vector": return asjagged(asdtype("u8"), skipbytes=10) elif getattr(branch._streamer, "_fTypeName", None) == b"vector" or getattr(branch._streamer, "_fTypeName", None) == b"vector": return asjagged(asdtype("f4"), skipbytes=10) @@ -403,7 +407,11 @@ def transform(node, tofloat=True): return asgenobj(STLMap(STLString(awkward), asdtype("u4")), branch._context, 6) elif getattr(branch._streamer, "_fTypeName", None) == b"map" or getattr(branch._streamer, "_fTypeName", None) == b"map": return asgenobj(STLMap(STLString(awkward), asdtype("i8")), branch._context, 6) - elif getattr(branch._streamer, "_fTypeName", None) == b"map" or getattr(branch._streamer, "_fTypeName", None) == b"map": + elif getattr(branch._streamer, "_fTypeName", None) == b"map" or getattr(branch._streamer, "_fTypeName", None) == b"map": + return asgenobj(STLMap(STLString(awkward), asdtype("u8")), branch._context, 6) + elif getattr(branch._streamer, "_fTypeName", None) == b"map" or getattr(branch._streamer, "_fTypeName", None) == b"map": + return asgenobj(STLMap(STLString(awkward), asdtype("i8")), branch._context, 6) + elif getattr(branch._streamer, "_fTypeName", None) == b"map" or getattr(branch._streamer, "_fTypeName", None) == b"map": return asgenobj(STLMap(STLString(awkward), asdtype("u8")), branch._context, 6) elif getattr(branch._streamer, "_fTypeName", None) == b"map" or getattr(branch._streamer, "_fTypeName", None) == b"map": return asgenobj(STLMap(STLString(awkward), asdtype("f4")), branch._context, 6) @@ -428,7 +436,11 @@ def transform(node, tofloat=True): return asgenobj(STLVector(STLVector(asdtype(">u4"))), branch._context, 6) elif getattr(branch._streamer, "_fTypeName", None) == b"vector >" or getattr(branch._streamer, "_fTypeName", None) == b"vector >": return asgenobj(STLVector(STLVector(asdtype(">i8"))), branch._context, 6) - elif getattr(branch._streamer, "_fTypeName", None) == b"vector >" or getattr(branch._streamer, "_fTypeName", None) == b"vector >": + elif getattr(branch._streamer, "_fTypeName", None) == b"vector >" or getattr(branch._streamer, "_fTypeName", None) == b"vector >": + return asgenobj(STLVector(STLVector(asdtype(">u8"))), branch._context, 6) + elif getattr(branch._streamer, "_fTypeName", None) == b"vector >" or getattr(branch._streamer, "_fTypeName", None) == b"vector >": + return asgenobj(STLVector(STLVector(asdtype(">i8"))), branch._context, 6) + elif getattr(branch._streamer, "_fTypeName", None) == b"vector >" or getattr(branch._streamer, "_fTypeName", None) == b"vector >": return asgenobj(STLVector(STLVector(asdtype(">u8"))), branch._context, 6) elif getattr(branch._streamer, "_fTypeName", None) == b"vector >" or getattr(branch._streamer, "_fTypeName", None) == b"vector >": return asgenobj(STLVector(STLVector(asdtype(">f4"))), branch._context, 6) @@ -460,7 +472,11 @@ def transform(node, tofloat=True): return asjagged(asdtype("u4"), skipbytes=10) elif branch._fClassName == b"vector" or branch._fClassName == b"vector": return asjagged(asdtype("i8"), skipbytes=10) - elif branch._fClassName == b"vector" or branch._fClassName == b"vector": + elif branch._fClassName == b"vector" or branch._fClassName == b"vector": + return asjagged(asdtype("u8"), skipbytes=10) + elif branch._fClassName == b"vector" or branch._fClassName == b"vector": + return asjagged(asdtype("i8"), skipbytes=10) + elif branch._fClassName == b"vector" or branch._fClassName == b"vector": return asjagged(asdtype("u8"), skipbytes=10) elif branch._fClassName == b"vector" or branch._fClassName == b"vector": return asjagged(asdtype("f4"), skipbytes=10) @@ -485,7 +501,11 @@ def transform(node, tofloat=True): return asgenobj(STLVector(STLVector(asdtype(">u4"))), branch._context, 6) elif branch._fClassName == b"vector >" or branch._fClassName == b"vector >": return asgenobj(STLVector(STLVector(asdtype(">i8"))), branch._context, 6) - elif branch._fClassName == b"vector >" or branch._fClassName == b"vector >": + elif branch._fClassName == b"vector >" or branch._fClassName == b"vector >": + return asgenobj(STLVector(STLVector(asdtype(">u8"))), branch._context, 6) + elif branch._fClassName == b"vector >" or branch._fClassName == b"vector >": + return asgenobj(STLVector(STLVector(asdtype(">i8"))), branch._context, 6) + elif branch._fClassName == b"vector >" or branch._fClassName == b"vector >": return asgenobj(STLVector(STLVector(asdtype(">u8"))), branch._context, 6) elif branch._fClassName == b"vector >" or branch._fClassName == b"vector >": return asgenobj(STLVector(STLVector(asdtype(">f4"))), branch._context, 6) @@ -510,7 +530,11 @@ def transform(node, tofloat=True): return asgenobj(STLMap(STLString(awkward), asdtype("u4")), branch._context, 6) elif branch._fClassName == b"map" or branch._fClassName == b"map": return asgenobj(STLMap(STLString(awkward), asdtype("i8")), branch._context, 6) - elif branch._fClassName == b"map" or branch._fClassName == b"map": + elif branch._fClassName == b"map" or branch._fClassName == b"map": + return asgenobj(STLMap(STLString(awkward), asdtype("u8")), branch._context, 6) + elif branch._fClassName == b"map" or branch._fClassName == b"map": + return asgenobj(STLMap(STLString(awkward), asdtype("i8")), branch._context, 6) + elif branch._fClassName == b"map" or branch._fClassName == b"map": return asgenobj(STLMap(STLString(awkward), asdtype("u8")), branch._context, 6) elif branch._fClassName == b"map" or branch._fClassName == b"map": return asgenobj(STLMap(STLString(awkward), asdtype("f4")), branch._context, 6) @@ -542,7 +566,11 @@ def transform(node, tofloat=True): return asgenobj(SimpleArray(STLVector(asdtype("u4"))), branch._context, 6) elif t == b"vector" or t == b"vector": return asgenobj(SimpleArray(STLVector(asdtype("i8"))), branch._context, 6) - elif t == b"vector" or t == b"vector": + elif t == b"vector" or t == b"vector": + return asgenobj(SimpleArray(STLVector(asdtype("u8"))), branch._context, 6) + elif t == b"vector" or t == b"vector": + return asgenobj(SimpleArray(STLVector(asdtype("i8"))), branch._context, 6) + elif t == b"vector" or t == b"vector": return asgenobj(SimpleArray(STLVector(asdtype("u8"))), branch._context, 6) elif t == b"vector" or t == b"vector": return asgenobj(SimpleArray(STLVector(asdtype("f4"))), branch._context, 6)