Framework-agnostic C++20 library exposing the SHiP magnetic field maps to simulation (aegir) and reconstruction.
The library wraps covfie for storage
and interpolation of regular-grid field maps. A small optional Geant4 adapter
(G4MagFieldAdapter) is built when BUILD_G4_ADAPTER is enabled; the core
library has no Geant4 dependency, so reconstruction can consume it without
pulling Geant4 in.
include/FieldService/IFieldSource.h— interface (point-query evaluator, list of named regions tagged by host-geometry volume name).include/FieldService/CovfieFieldSource.h+src/CovfieFieldSource.cpp— concrete source that loads one.cvffile per magnet via covfie.include/FieldService/G4MagFieldAdapter.h— Geant4 adapter, built whenBUILD_G4_ADAPTER=ON.tools/fairship_to_cvf— convert FairShip's legacy ROOT field-map format to covfie.cvf. Built when ROOT is available.tools/cvf_to_text— dump a.cvfto whitespace-separated text for inspection and closure tests.tools/generate_constant_cvf— synthetic uniform field-map generator for closure tests.
The supported way to set up a build environment is pixi.
pixi.toml pins the toolchain and all required packages
(mp-units, geant4, root, cmake, ninja, cxx-compiler).
git clone https://github.com/ShipSoft/field_service
cd field_service
pixi install
pixi run testAvailable tasks: configure, build, install, test, clean.
pixi run install deploys the library, headers and CMake package files under
the pixi environment prefix so downstream consumers can find_package
SHiPFieldService.
Map files are resolved relative to $SHIPFIELD_ROOT/share/field/ when a bare
filename is passed; the pixi activation script sets SHIPFIELD_ROOT to the
pixi environment prefix by default.
If you prefer to bring your own dependencies:
cmake -S . -B build
cmake --build build
ctest --test-dir buildInstall the pre-commit hooks (covers clang-format, cpplint, gersemi,
reuse, codespell, conventional-commit validation, and CITATION.cff
checks):
pixi run -e dev pre-commit install --hook-type pre-commit --hook-type commit-msgSee CONTRIBUTING.md for the full workflow.
Aegir consumes this via find_package(SHiPFieldService REQUIRED COMPONENTS Core G4Adapter). The aegir provider plugin field_covfie_provider constructs a
ship::CovfieFieldSource from jsonnet config and publishes it as a phlex Job
product; the aegir Geant4 module installs a per-magnet G4FieldManager on each
matching logical volume via the adapter.