Four-Vectors

The Vec4 class gives an implementation of four-vectors. The member function names are based on the assumption that these represent momentum vectors. Thus one can get or set px(), py(), pz() and e(), but not x, y, z or t. (When production vertices are defined in the particle class, this is partly circumvented by new methods that hide a Vec4.) All four values can be set in the constructor, or later by the p method, with input in the order (px, py, pz, e).

The Particle object contains a Vec4 p that stores the particle four-momentum, and another Vec4 vProd for the production vertex. Therefore a user would not normally access the Vec4 class directly, but by using the similarly-named methods of the Particle class, see Particle Properties. (The latter also stores the particle mass separately, offering an element of redundancy, helpful in avoiding some roundoff errors.) However, you may find some knowledge of the four-vectors convenient, e.g. as part of some simple analysis code based directly on the PYTHIA output, say to define the four-vector sum of a set of particles.

A set of overloaded operators are defined for four-vectors, so that one may naturally add, subtract, multiply or divide four-vectors with each other or with double numbers, for all the cases that are meaningful. Of course the equal sign also works as expected. The << operator is overloaded to write out the values of the four components of a Vec4.

A number of methods provides output of derived quantities, such as:

There are also some friend methods that take two or three four-vectors as argument:

Some member functions can be used to modify vectors, including some for rotations and boosts:

For a longer sequence of rotations and boosts, and where several Vec4 are to be rotated and boosted in the same way, a more efficient approach is to define a RotBstMatrix, which forms a separate auxiliary class. You can build up this matrix by successive calls to the methods