LorentzVector

class coffea.nanoevents.methods.vector.LorentzVector[source]

Bases: ThreeVector

A cartesian Lorentz vector

A heavy emphasis towards a momentum vector interpretation is assumed. (+, -, -, -) metric This mixin class requires the parent class to provide items x, y, z, and t.

Attributes Summary

boostvec

The x, y and z compontents divided by t as a ThreeVector

energy

Alias for t

eta

Pseudorapidity

mass

Invariant mass (+, -, -, -)

mass2

Squared mass

pvec

The x, y and z compontents as a ThreeVector

Methods Summary

absolute()

Magnitude of this Lorentz vector

add(other)

Add two vectors together elementwise using x, y, z, and t components

boost(other)

Apply a Lorentz boost given by the ThreeVector other and return it

delta_r(other)

Distance between two Lorentz vectors in (eta,phi) plane

delta_r2(other)

Squared delta_r

metric_table(other[, axis, metric, ...])

Return a list of a metric evaluated between this object and another.

multiply(other)

Multiply this vector by a scalar elementwise using x, y, z, and t components

nearest(other[, axis, metric, ...])

Return nearest object to this one

negative()

Returns the negative of the vector

subtract(other)

Subtract a vector from another elementwise using x, y, z, and t components

sum([axis])

Sum an array of vectors elementwise using x, y, z, and t components

Attributes Documentation

boostvec

The x, y and z compontents divided by t as a ThreeVector

This can be used for boosting. For cases where |t| <= rho, this returns the unit vector.

energy

Alias for t

eta

Pseudorapidity

\(-\ln[\tan(\theta/2)] = \text{arcsinh}(z/r)\)

mass

Invariant mass (+, -, -, -)

\(\sqrt{t^2-x^2-y^2-z^2}\)

mass2

Squared mass

pvec

The x, y and z compontents as a ThreeVector

Methods Documentation

absolute()[source]

Magnitude of this Lorentz vector

Alias for mass

add(other)[source]

Add two vectors together elementwise using x, y, z, and t components

boost(other)[source]

Apply a Lorentz boost given by the ThreeVector other and return it

Note that this follows the convention that, for example in order to boost a vector into its own rest frame, one needs to use the negative of its boostvec

delta_r(other)[source]

Distance between two Lorentz vectors in (eta,phi) plane

\(\sqrt{\Delta\eta^2 + \Delta\phi^2}\)

delta_r2(other)[source]

Squared delta_r

metric_table(other, axis=1, metric=<function LorentzVector.<lambda>>, return_combinations=False)[source]

Return a list of a metric evaluated between this object and another.

The two arrays should be broadcast-compatible on all axes other than the specified axis, which will be used to form a cartesian product. If axis=None, broadcast arrays directly. The return shape will be that of self with a new axis with shape of other appended at the specified axis depths.

Parameters:
  • other (awkward.Array) – Another array with same shape in all but axis

  • axis (int, optional) – The axis to form the cartesian product (default 1). If None, the metric is directly evaluated on the input arrays (i.e. they should broadcast)

  • metric (callable) – A function of two arguments, returning a scalar. The default metric is delta_r.

  • return_combinations (bool) – If True return the combinations of inputs as well as an unzipped tuple

multiply(other)[source]

Multiply this vector by a scalar elementwise using x, y, z, and t components

nearest(other, axis=1, metric=<function LorentzVector.<lambda>>, return_metric=False, threshold=None)[source]

Return nearest object to this one

Finds item in other satisfying min(metric(self, other)). The two arrays should be broadcast-compatible on all axes other than the specified axis, which will be used to form a cartesian product. If axis=None, broadcast arrays directly. The return shape will be that of self.

Parameters:
  • other (awkward.Array) – Another array with same shape in all but axis

  • axis (int, optional) – The axis to form the cartesian product (default 1). If None, the metric is directly evaluated on the input arrays (i.e. they should broadcast)

  • metric (callable) – A function of two arguments, returning a scalar. The default metric is delta_r.

  • return_metric (bool, optional) – If true, return both the closest object and its metric (default false)

  • threshold (Number, optional) – If set, any objects with metric > threshold will be masked from the result

negative()[source]

Returns the negative of the vector

subtract(other)[source]

Subtract a vector from another elementwise using x, y, z, and t components

sum(axis=-1)[source]

Sum an array of vectors elementwise using x, y, z, and t components