Modern precision experiments trapping low-energy particles require detailed simulations of particle trajectories and spin precession to determine systematic measurement limitations and apparatus deficiencies. We developed PENTrack, a tool that allows to simulate trajectories of ultracold neutrons and their decay products-protons and electrons-and the precession of their spins in complex geometries and electromagnetic fields. The interaction of ultracold neutrons with matter is implemented with the Fermi-potential formalism and diffuse scattering using Lambert and microroughness models. The results of several benchmark simulations agree with STARucn v1.2, uncovered several flaws in Geant4 v10.2.2, and agree with experimental data. Experiment geometry and electromagnetic fields can be imported from commercial computer-aided-design and finite-element software. All simulation parameters are defined in simple text files allowing quick changes. The simulation code is written in C++ and is freely available at github.com/wschreyer/ PENTrack.git.
scite is a Brooklyn-based organization that helps researchers better discover and understand research articles through Smart Citations–citations that display the context of the citation and describe whether the article provides supporting or contrasting evidence. scite is used by students and researchers from around the world and is funded in part by the National Science Foundation and the National Institute on Drug Abuse of the National Institutes of Health.