Momentum 4D Object is not subscriptable #119
srosenzweig09
started this conversation in
General
Replies: 1 comment 2 replies
-
Maybe what you mean is this: import awkward as ak
import vector
vector.register_awkward()
pt = t["part_pt"].array()
eta = t["part_eta"].array()
phi = t["part_phi"].array()
m = t["part_m"].array()
particle_p4 = ak.Array({"pt": pt, "eta": eta, "phi": phi, "m": m}, with_name="Momentum4D")
particle_p4 # look at it
all_particles_in_interesting_event = particle_p4[evt_number]
particle_in_interesting_event = all_particles_in_interesting_event[particle_number] or if your data aren't jagged/nested, then only particle_in_interesting_event = particle_p4[evt_number] would be needed. Such an object would be an Awkward Array with all the usual properties that they have, but the combination of |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I was wondering how to access the p4 value for an entry in a vector.obj object. I have an array of p4 values and I want to access one of them, but if I try to do this, I get an error that the Momentum 4D object is not subscriptable. To get around this, I could loop through my events and build an array of vector.obj objects but that diminishes the power of columnar analysis. I would appreciate any suggestions. Thank you very much!
Example:
This throws an error. Am I trying to do something that is not possible yet? Thanks!
Beta Was this translation helpful? Give feedback.
All reactions