|
SHiP Field Service
Framework-agnostic C++20 library exposing SHiP magnetic field maps.
|
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.
An automatic class reference is built using Doxygen from comments in the C++ code.
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 .cvf file per magnet via covfie.include/FieldService/G4MagFieldAdapter.h — Geant4 adapter, built when BUILD_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 .cvf to whitespace-separated text for inspection and closure tests.tools/generate_constant_cvf — synthetic uniform field-map generator for closure tests.tools/plot_field_map — plot a .cvf as ROOT histograms and PDFs (B_y vs z plus xz/yz/xy planes) over a user-given box. Built when ROOT is available.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).
Available 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:
Install the pre-commit hooks (covers clang-format, cpplint, gersemi, reuse, codespell, conventional-commit validation, and CITATION.cff checks):
See `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.