wollra_j 99be3c737a Use G4Random::setTheEngine
CLHEP::HepRandom::setTheEngine is not thread safe and should not be
used.
2026-08-13 14:39:52 +02:00
2026-08-12 13:46:52 +02:00
2025-03-27 22:05:05 +01:00
2009-05-26 09:49:42 +00:00
2026-08-12 11:28:22 +02:00
2011-02-11 16:45:24 +00:00
2026-08-13 14:39:52 +02:00

musrSim simulation

Contents

This is the C++ source code for the musrSim simulation software which is intended to be a general tool for designing and simulating µSR spectrometers with high accuracy. To compile and run musrSim, the user must have a recent Geant4 (tested with v11.0.3 and v11.2.0) and ROOT installed (tested with v6-22-06 and v6-30-02, but the version should not be critical).

  • The code is specifically tuned to simulate muon spin spectrometers.
  • The code is maintained by the Laboratory for Muon Spin Spectroscopy at PSI.

Supported platforms

  • Linux and any other decent OS that can run ROOT and Geant4.

Installation

Compile and install Geant4, we recommend the use of the following cmake flags

cmake -DCMAKE_INSTALL_PREFIX=/path/to/G4installation /path/to/G4source -DGEANT4_USE_QT=ON -DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_OPENGL_X11=ON

We also recommend that you use view3dscene as a VRML viewer.

Following the installation of Geant4, initialise the Geant4 runtime environment before configuring or running musrSim. For a standard Geant4 installation this is normally done by sourcing the script installed with Geant4:

. /path/to/G4installation/bin/geant4.sh

The Geant4 data-set environment variables required by your installation must be valid after this step. If they are not, correct the Geant4 installation/environment rather than hard-coding musrSim-specific paths.

Clone the musrSim repository

git clone https://gitea.psi.ch/LMU/musrsim

then (see below for RedHat or other old systems)

cd musrsim
mkdir build
cd build
cmake ../
make -j8
make install

This will install the musrSim binary in /usr/local/bin, but it can be moved to any other directory in your PATH.

Running the tests

Tests are built by default. After configuring and building, run them with:

ctest --test-dir build --output-on-failure

Set -DBUILD_TESTING=OFF during CMake configuration to omit the test executables.

The regression suite currently covers steering-file parsing, process and volume ID mappings, the muonium charge-state yield model over its documented energy range, and the unpolarized muonium decay spectrum, isotropy, and energy conservation. Tests carrying the physics label can be run separately with:

ctest --test-dir build --output-on-failure -L physics

To compare a modified build with an older build using identical event seeds and the LEM run-4000 setup, build the musrRootOutputCompare target and run:

tests/compare_lem_versions.sh /path/to/baseline/musrSim /path/to/candidate/musrSim 500

The harness writes both simulations to temporary directories and compares the logical ROOT contents exactly. Set MUSRSIM_ROOT_COMPARATOR when the comparator is not available under tests/ beside the candidate executable.

Running the simulations

Prepare a file, filename.mac, with your beamline and spectrometer design following the instructions in the musrSim manual. Create a folder data and then run the simulation

musrSim filename.mac

Contact

Thomas Prokscha thomas.prokscha@psi.ch

Zaher Salman zaher.salman@psi.ch

S
Description
No description provided
Readme
474 MiB
Languages
C++ 74.3%
C 18.8%
Roff 3.6%
CMake 1.7%
Hack 1.5%
Other 0.1%