|
ACTS
Experiment-independent tracking
|
Use ACTS from Python, with the PyPI wheel or a source build.
The Python bindings primarily expose the ACTS Examples framework: configure readers, algorithms, and writers in a Sequencer to run tracking workflows. Selected Core types are bound where the Examples workflows need them. The bindings do not aim to expose every Core tool directly to Python; use Core functionality through the Examples algorithms.
The easiest way to get the ACTS Python bindings is via PyPI:
The pyacts distribution includes bindings for the core library, Fatras, and the Examples framework.
The wheel includes .pyi type stubs and supports Linux and macOS with Python 3.11 or newer.
For a source build, enable the Python bindings and Examples framework, then load the generated <build>/this_acts_withdeps.sh script before importing acts:
Enable optional components with their CMake options. For ROOT readers, writers, and evaluation, use -DACTS_BUILD_EXAMPLES_ROOT=ON; this also enables the ROOT plugin. A source build needs Python development headers. The ActsPythonBindings target builds the enabled bindings, and the setup script adds the built modules and dependencies to your environment.
| Capability | PyPI (pyacts) | Full installation (source build) |
|---|---|---|
| Plugins | Arrow, JSON | All available plugins, including ROOT, DD4hep, or Geant4 |
| I/O | CSV, Parquet, particle and sim-hit ROOT uproot readers | Additionally native ROOT and EDM4hep |
| Geometry | GenericDetector, Tracking geometry from JSON | Directly build detector geometries with DD4hep or TGeo |
| Evaluation | In-memory performance writers and plotting in Python | Additionally native ROOT performance writers |
An acts.examples.Sequencer runs readers, algorithms, and writers over events. This first script generates muons and prints them; it works with the PyPI wheel:
For convenience, the package contains helpers in acts.examples.simulation and acts.examples.reconstruction that add entire workflow steps with addXYZ-functions (such as simulation, seeding, ...) and connect their data keys. For full flexibility, the underlying sequencer algorithms can be directly configured as well. For simple but complete chains, see the PyPI finding and fitting demo or the truth-tracking Kalman example (source build). Their helper signatures and default keys are in simulation.py and reconstruction.py.
Topics | |
| Custom Algorithms | |
| Writing your own IAlgorithm or IReader in Python, and moving data through the whiteboard. | |
| Data Reading and Writing | |
| Readers and writers available in the PyPI wheel and optional source builds. | |
| Performance Evaluation and Plotting | |
| Extracting efficiency/resolution numbers from a Sequencer run, and plotting them. | |
| Python-based testing | |
| Running the Python test suite and checking ROOT file hashes. | |