Namespace Acts::UnitConstants

Unit definitions and conversions.

Detailed Description

All physical quantities have both a numerical value and a unit. For the computations we always choose a particular unit so we only need to consider the numerical values as such. The chosen base unit for a particular physical quantity, e.g. length, time, or energy, within this code base is called the native unit. Here, the following native units are used:

  • Length is expressed in mm.

  • Time is expressed in [speed-of-light * time] == mm. A consequence of this choice is that the speed-of-light expressed in native units is 1.

  • Angles are expressed in radian.

  • Energy, mass, and momentum are all expressed in GeV (consistent with a speed-of-light == 1).

  • Electric charge is expressed in e, i.e. units of the elementary charge.

  • The magnetic field is expressed in GeV/(e*mm). The magnetic field connects momentum to length, e.g. in SI units the radius of a charged particle trajectory in a constant magnetic field is given by radius = - (momentum / charge) / magnetic-field

With the chosen magnetic field unit the expression above stays the

same and no additional conversion factors are necessary.

  • Amount of substance is expressed in mol.

To ensure consistent computations and results the following guidelines must be followed when handling physical quantities with units:

  • All unqualified numerical values, i.e. without a unit, are assumed to be expressed in the relevant native unit, e.g. mm for lengths or GeV for energy/momentum.

  • If a variable stores a physical quantity in a specific unit that is not the native unit, clearly mark this in the variable, i.e. double momentum = 100.0; // momentum is stored as native unit GeV

double momentumInMeV = 10.0; // would be 0.01 in native units

  • All input values must be given as numerical_value * unit_constant or equivalently using the unit literals as value_unit. The resulting unqualified numerical value will be automatically converted to the native unit.

  • To output an unqualified numerical value in the native units as a numerical value in a specific unit divide by the unit constants as numerical_value / unit_constant or using the unit literals as value / 1_unit.

Examples: #include “Acts/include/Definitions/Units.hpp” using namespace Acts::UnitLiterals;

// define input values w/ units (via unit constants) double width = 12 * Acts::UnitConstants::mm; double mmuon = 105.7 * Acts::UnitConstants::MeV; // define input values w/ units (via unit user literals) double length = 23_cm; double time = 1214.2_ns; double angle = 123_degree; double momentum = 2.5_TeV; double mass = 511_keV; double velocity = 345_m / 1_s; double bfield = 3.9_T; double density = 1_mol / 1_cm3;

// convert output values (via unit constants) doube t_in_ns = trackPars.time() / Acts::UnitConstants::ns; // convert output values (via unit user literals) double x_in_mm = trackPars.position()[ePos0] / 1_mm; double p_in_TeV = trackPars.absoluteMomentum() / 1_TeV; A helper script is available in Core/scripts/print_units_physical_constants.py to validate some of the numerical values.

Variables