  The OLYMPUS experiment used a 0.3 T toroidal magnetic spectrometer to measure
the momenta of outgoing charged particles. In order to accurately determine
particle trajectories, knowledge of the magnetic field was needed throughout
the spectrometer volume. For that purpose, the magnetic field was measured at
over 36,000 positions using a three-dimensional Hall probe actuated by a system
of translation tables. We used these field data to fit a numerical magnetic
field model, which could be employed to calculate the magnetic field at any
point in the spectrometer volume. Calculations with this model were
computationally intensive; for analysis applications where speed was crucial,
we pre-computed the magnetic field and its derivatives on an evenly spaced grid
so that the field could be interpolated between grid points. We developed a
spline-based interpolation scheme suitable for SIMD implementations, with a
memory layout chosen to minimize space and optimize the cache behavior to
quickly calculate field values. This scheme requires only one-eighth of the
memory needed to store necessary coefficients compared with a previous scheme
[1]. This method was accurate for the vast majority of the spectrometer volume,
though special fits and representations were needed to improve the accuracy
close to the magnet coils and along the toroid axis.
