# musrSim simulation # ### Contents ### This is the C++ source code for the musrSim simulation software which is intended to be a general tool to design and simulate µSR spectrometer with very high accuracy. To compile and run musrSim, the user must have a recent Geant4 (tested with v11.0.3) and Root (tested with v6-22-06) installed (Root version is not 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/installation /path/to/source -DGEANT4_USE_QT=ON -DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_OPENGL_X11=ON We also recommend that you use `view3dscene` as a VRML viewer. This can be downloaded from here: `https://castle-engine.io/view3dscene.php`. Following the installation of Gean4, set the correct environment variable. We recommend that you add the following to your `.bashrc` file. export G4INSTALL="/path/to/installation" export G4NEUTRONHPDATA="$G4INSTALL/share/Geant4-11.0.3/data/G4NDL4.6" export G4LEDATA="$G4INSTALL/share/Geant4-11.0.3/data/G4EMLOW8.0" export G4LEVELGAMMADATA="$G4INSTALL/share/Geant4-11.0.3/data/PhotonEvaporation5.7" export G4RADIOACTIVEDATA="$G4INSTALL/share/Geant4-11.0.3/data/RadioactiveDecay5.6" export G4PARTICLEXSDATA="$G4INSTALL/share/Geant4-11.0.3/data/G4PARTICLEXS4.0" export G4PIIDATA="$G4INSTALL/share/Geant4-11.0.3/data/G4PII1.3" export G4REALSURFACEDATA="$G4INSTALL/share/Geant4-11.0.3/data/RealSurface2.2" export G4SAIDXSDATA="$G4INSTALL/share/Geant4-11.0.3/data/G4SAIDDATA2.0" export G4ABLADATA="$G4INSTALL/share/Geant4-11.0.3/data/G4ABLA3.1" export G4INCLDATA="$G4INSTALL/share/Geant4-11.0.3/data/G4INCL1.0" export G4ENSDFSTATEDATA="$G4INSTALL/share/Geant4-11.0.3/data/G4ENSDFSTATE2.3" export G4VRMLFILE_VIEWER="/path/to/your/view3dscene"; Clone the musrSim repository git clone https://zaher-salman@bitbucket.org/zaher-salman/musrsim.git 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 simulations ### Prepare a file, `finlename.mac`, with your beamline and spectrometer design following the instruction in the [musrSim manual](https://bitbucket.org/zaher-salman/musrsim/src/master/doc/musrSim.pdf). musrSim filename.mac ### RedHat and old systems ### For compilation on RedHat systems: # Make sure that the `gcc-toolset-13` package is installed # Use the follwoing compilation command: `scl enable gcc-toolset-13 'make -j8'` # Use `CMakeLists_rhel8.txt`: `cp CMakeLists_rhel8.txt CMakeLists.txt` # If you have Root 6.30 use `FindROOT_6.30.cmake`: `cp FindROOT_6.30.cmake FindROOT.cmake` ### Contact ### Zaher Salman