TwoVector
- class coffea.nanoevents.methods.vector.TwoVector[source]
Bases:
object
A cartesian 2-dimensional vector
A heavy emphasis towards a momentum vector interpretation is assumed, hence properties like
px
andpy
are provided in addition tox
andy
.This mixin class requires the parent class to provide items
x
andy
.Attributes Summary
Polar angle relative to X axis
Alias for
r
Alias for
r2
Alias for
x
Alias for
y
Distance from origin in XY plane
Squared
r
Unit vector, a vector of length 1 pointing in the same direction
Methods Summary
absolute
()Returns magnitude of the 2D vector
add
(other)Add two vectors together elementwise using
x
andy
componentsdelta_phi
(other)Compute difference in angle between two vectors
divide
(other)Divide this vector by a scalar elementwise using its cartesian components
dot
(other)Compute the dot product of two vectors
multiply
(other)Multiply this vector by a scalar elementwise using
x
andy
componentsnegative
()Returns the negative of the vector
subtract
(other)Substract a vector from another elementwise using
x
andy
compontentssum
([axis])Sum an array of vectors elementwise using
x
andy
componentsAttributes Documentation
- phi
Polar angle relative to X axis
\(\text{arctan2}(y, x)\)
- r
Distance from origin in XY plane
\(\sqrt{x^2+y^2}\)
- unit
Unit vector, a vector of length 1 pointing in the same direction
Methods Documentation
- delta_phi(other)[source]
Compute difference in angle between two vectors
Returns a value within [-pi, pi)