API reference

Pylorentz is a python package to facilitate working with 4-vectors and lorentz boosts in high energy physics.

class pylorentz.Momentum4(*x)[source]

Representation of 4-momenta.

e

Returns the energy of the vector.

static e_eta_phi_p(e, eta, phi, p)[source]

Creates a new energy-momentum vector based on energy, pseudo-rapidity, polar angle and momentum.

static e_eta_phi_pt(e, eta, phi, p_t)[source]

Creates a new energy-momentum vector based on energy, pseudo-rapidity, polar angle and transverse momentum.

static e_m_eta_phi(e, m, eta, phi)[source]

Creates a new energy-momentum vector based on energy, mass, pseudo-rapidity and polar angle.

m

Returns the mass.

m2

Returns the mass squared.

static m_eta_phi_p(m, eta, phi, p)[source]

Creates a new energy-momentum vector based on mass, pseudo-rapidity, polar angle and momentum.

static m_eta_phi_pt(m, eta, phi, p_t)[source]

Creates a new energy-momentum vector based on mass, pseudo-rapidity, polar angle and transverse momentum.

p

Returns the magnitude of the 3-momentum.

p2

Returns the square of the magnitude of the 3-momentum.

p_t

Returns the transverse momentum.

p_x

Returns the x-component of the momentum.

p_y

Returns the y-component of the momentum.

p_z

Returns the y-component of the momentum.

class pylorentz.Position4(*x)[source]

Representation of points in space-time.

t

Returns the t component of the vector.

x

Returns the x component of the vector.

y

Returns the y component of the vector.

z

Returns the z component of the vector.

class pylorentz.Vector4(*x)[source]

Representation of a Lorentz 4-vector.

boost(x, y, z, beta=None, gamma=None)[source]

Boosts the 4-vector in the direction given by (x, y, z). The magnitude of (x, y, z) is ignored. Exactly one of beta and gamma must be given.

The method returns the transformed 4-vector as measured in the frame moving in (x, y, z) direction with velocity defined by beta or gamma. This is the opposite of TLorentzVector::Boost().

boost_particle(momentum)[source]

Performs a Lorentz transformation of the 4-vector. The boost is specified by the 4-momentum of a particle (measured in the laboratory frame). The transformation is from the particle rest frame into the laboratory frame.

The method returns the transformed 4-vector.

components

Returns the interal array of all components.

eta

Returns the pseudo-rapidity, a measure for the angle between the vector and the x[3] axis.

mag

Magnitude of vector.

mag2

Square of magnitude of vector, i.e. the dot product with itself.

phi

Polar angle in the x[1:4] space.

theta

Azimuth angle in the x[1:4] space.

trans

Magnitude of the transverse component.