This might just be a impl. detail - if so please close (or I move it to discussion)
When building a MomentumArray4D with ak.ArrayBuilder with the name keyword argument, I need to be careful to use x,y,z,t fieldnames and not px,py,pz,E (which I would have expected given that I pass MomentumArray4D as a name)
cc @jpivarski as a continuation of the discussion in #83
data = [
{"px": 1., "py": 1.1, "pz": 0.1, 'E': 3.3},
{"px": 2., "py": 2.2, "pz": 0.2, 'E': 3.3}
]
print(ak.type(vc.awk(data)))
print(vc.awk(data).mass)
print(vc.awk(data).px)
builder = ak.ArrayBuilder()
for d in data:
with builder.record(name = 'Momentum4D'):
# for f in d.keys(): fails
for f,k in {'x':'px','y':'py','z': 'pz', 't': 'E'}.items():
builder.field(f).real(d[k])
builder.snapshot().mass
This might just be a impl. detail - if so please close (or I move it to discussion)
When building a
MomentumArray4Dwithak.ArrayBuilderwith thenamekeyword argument, I need to be careful to usex,y,z,tfieldnames and notpx,py,pz,E(which I would have expected given that I passMomentumArray4Das a name)cc @jpivarski as a continuation of the discussion in #83