Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v.perp(direction) should compute 2D magnitude along an alternate 3D longitudinal axis direction (both are at least 3D) #141

Open
jpivarski opened this issue Sep 6, 2021 · 0 comments
Labels
feature New feature or request

Comments

@jpivarski
Copy link
Member

From ROOT's TLorentzVector:

>>> import ROOT

>>> v = ROOT.TLorentzVector(1.1, 2.2, 3.3, 4.4)
>>> direction = ROOT.TVector3(3, 2, 1)

>>> v.Perp(direction)
2.880476151115099

We want the same thing in a convenient method: v.perp(direction)

>>> import awkward as ak
>>> import numpy as np
>>> import vector
>>> vector.register_awkward()

>>> v = ak.Array([
...     [{"x": 1.1, "y": 2.2, "z": 3.3}], [], [{"x": 1.1, "y": 2.2, "z": 3.3}]
... ], with_name="Vector3D")

>>> direction = ak.Array([
...     [{"x": 3, "y": 2, "z": 1}], [], [{"x": 3, "y": 2, "z": 1}]
... ], with_name="Vector3D")

>>> v.mag * np.sin(v.deltaangle(direction))
<Array [[2.88], [], [2.88]] type='3 * var * float64'>

New "compute" modules are not needed; just compute this as a convenience method from the existing ones.

@jpivarski jpivarski added the feature New feature or request label Jan 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant