Skip to content

how to add two LorentzVector? #205

Discussion options

You must be logged in to vote

@Saransh-cpp, this is a problem with the vector.awk constructor: it allows users to construct arrays of vectors with incorrect types without any warning. For instance, if I have four jagged arrays with the same list lengths,

>>> import awkward as ak
>>> pt = ak.Array([[1, 2], [], [3]])
>>> eta = ak.Array([[1, 2], [], [3]])
>>> phi = ak.Array([[1, 2], [], [3]])
>>> mass = ak.Array([[1, 2], [], [3]])

then what I want to create is three lists of vectors, two in the first list and one in the last. But vector.awk is too literal:

>>> wrong_types = vector.awk({"pt": pt, "eta": eta, "phi": phi, "mass": mass})
>>> print(wrong_types.type)
3 * Momentum4D["rho": var * int64, "phi": var * int64, "eta": 

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@agoose77
Comment options

@jpivarski
Comment options

@Saransh-cpp
Comment options

@jpivarski
Comment options

Answer selected by Saransh-cpp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants