Skip to content

Possible to have a view of a MomentumObject4D with pt, eta, phi, m ? #324

Discussion options

You must be logged in to vote

vector automatically converts generic type coordinates to momentum type and vice versa when needed. So, for example -

In [1]: import vector

In [2]: v = vector.obj(px=1, py=2, pz=3, E=4)

In [3]: v
Out[3]: MomentumObject4D(px=1, py=2, pz=3, E=4)

In [4]: v.to_rhophietat()
Out[4]: MomentumObject4D(pt=2.23606797749979, phi=1.1071487177940904, eta=1.103586841560145, E=4)

In [5]: v.to_rhophietatau()
Out[5]: MomentumObject4D(pt=2.23606797749979, phi=1.1071487177940904, eta=1.103586841560145, mass=1.4142135623730951)

Similar to your example, vector understands that if a user calls to_rhophietatau or to_rhophietat on a MomentumVector, it must automatically use pt instead of phi and mass/E inste…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by matthewfeickert
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants