rk is hosted by Hepforge, IPPP Durham

Relativistic Kinematics (RK)

This package provides a C++ double precision implementation of several basic geometric entities and transformations: points in 3d, directions in 3d (unit vectors), 3-vectors, points in 4d, 4-vectors, rotations, linear transformations, and boosts. The main purpose of the package is representing 4-momenta of relativistic particles and related formulae. The package implementation differs from other kinematic libraries in several important respects:

  • Careful attention is paid to the numerical aspects of various calculations. For example, the "acos" function is not used to calculate angles between almost collinear vectors because "acos" results in an unacceptable rounding error amplification whenever the magnitude of its argument is close to 1.
  • Important invariants are not affected by rounding errors. 3-vector length does not change under rotations, 4-vector mass does not change under boosts, a combination of any number of Lorentz transformations is a Lorentz transformation.
  • Efficient implementations are provided for rotation interpolation and for generation of random rotations.
  • The code utilizes appropriate function inlining and supports return value optimization. Its performance typically exceeds that of similar CLHEP and ROOT classes.
  • RK is a simple, small, stand-alone package without excess baggage.

Unfortunately, the improvements in the numerical accuracy and code speed do not come without a price. In particular, due to a representation which memoizes particle masses, space-like 4-vectors are "second class" objects, and they are not treated equally with their time-like and light-like counterparts. Although space-like 4-vectors can participate in normal vector arithmetic operations, they can not be boosted and their masses can not be evaluated. This limitation will rarely be a problem for a typical HEP-related calculation, but you should be aware of it when you decide whether this package is a right tool for your job.

There is no separate manual, but the header files are well-commented, and the names of classes and functions are reasonably intuitive. After installing the package, include "rk/rk.hh" in your program if you perform 4-vector calculations, or "rk/geom3.hh" if 3d geometry is all you need. For general Lorentz transformations (in case you need to combine rotations and boosts or to combine several boosts into one operation) include "rk/LT.hh". If you need to read/write your objects to disk, the file "rk/rkIO.hh" interfaces RK classes to Geners serialization facilities. Geners is needed for I/O only. If you do not need I/O, you do not need to install Geners in order to compile and use RK.

Download RK

Contact: Igor Volobouev