# Propagation and extrapolation¶

The track propagation is an essential part of track reconstruction. The Acts propagation code is based on the ATLAS RungeKuttaPropagator, against which newer developments where validated. It has since been removed from the code base.

## Steppers and Propagator¶

The Acts propagator allows for different Stepper implementations provided as a class template. Following the general Acts design, each stepper has a nested cache struct, which is used for caching the field cell and the update the jacobian for covariance propagation.

### AtlasStepper¶

The AtlasStepper is a pure transcript from the ATLAS RungeKuttaPropagator and RungeKuttaUtils, and operators with an internal structure of double[]. This example shows a code snippet from the numerical integration.

while (h != 0.) {
double S3 = (1. / 3.) * h, S4 = .25 * h, PS2 = Pi * h;

// First point
//
double H0 = {f0 * PS2, f0 * PS2, f0 * PS2};
double A0    = A * H0 - A * H0;
double B0    = A * H0 - A * H0;
double C0    = A * H0 - A * H0;
double A2    = A0 + A;
double B2    = B0 + A;
double C2    = C0 + A;
double A1    = A2 + A;
double B1    = B2 + A;
double C1    = C2 + A;

// Second point
//
if (!Helix) {
const Vector3 pos(R + A1 * S4, R + B1 * S4, R + C1 * S4);
f = getField(cache, pos);
} else {
f = f0;
}

double H1 = {f * PS2, f * PS2, f * PS2};
double A3    = (A + B2 * H1) - C2 * H1;
double B3    = (A + C2 * H1) - A2 * H1;
double C3    = (A + A2 * H1) - B2 * H1;
double A4    = (A + B3 * H1) - C3 * H1;
double B4    = (A + C3 * H1) - A3 * H1;
double C4    = (A + A3 * H1) - B3 * H1;
double A5    = 2. * A4 - A;
double B5    = 2. * B4 - A;
double C5    = 2. * C4 - A;

// Last point
//
if (!Helix) {
const Vector3 pos(R + h * A4, R + h * B4, R + h * C4);
f = getField(cache, pos);
} else {
f = f0;
}

double H2 = {f * PS2, f * PS2, f * PS2};
double A6    = B5 * H2 - C5 * H2;
double B6    = C5 * H2 - A5 * H2;
double C6    = A5 * H2 - B5 * H2;
}


### EigenStepper¶

The EigenStepper implements the same functionality as the ATLAS stepper, however, the stepping code is rewritten with using Eigen primitives. The following code snippet shows the Runge-Kutta stepping code.

// The following functor starts to perform a Runge-Kutta step of a certain
// size, going up to the point where it can return an estimate of the local
// integration error. The results are stated in the local variables above,
// allowing integration to continue once the error is deemed satisfactory
const auto tryRungeKuttaStep = [&](const double h) -> bool {

// State the square and half of the step size
h2     = h * h;
half_h = h * 0.5;

// Second Runge-Kutta point
const Vector3 pos1 = state.stepping.pos + half_h * state.stepping.dir
+ h2 * 0.125 * sd.k1;
sd.B_middle = getField(state.stepping, pos1);
if (!state.stepping.extension.k2(
state, sd.k2, sd.B_middle, half_h, sd.k1)) {
return false;
}

// Third Runge-Kutta point
if (!state.stepping.extension.k3(
state, sd.k3, sd.B_middle, half_h, sd.k2)) {
return false;
}

// Last Runge-Kutta point
const Vector3 pos2
= state.stepping.pos + h * state.stepping.dir + h2 * 0.5 * sd.k3;
sd.B_last = getField(state.stepping, pos2);
if (!state.stepping.extension.k4(state, sd.k4, sd.B_last, h, sd.k3)) {
return false;
}

// Return an estimate of the local integration error
error_estimate = std::max(
h2 * (sd.k1 - sd.k2 - sd.k3 + sd.k4).template lpNorm<1>(), 1e-20);
return true;
};


The code includes the extension mechanism, which allows extending the numerical integration. This is implemented for the custom logic required to integrate through a volume with dense material.