HOWTO build and run PHASM on Geant4 examples
Jump to navigation
Jump to search
This page is incomplete. It needs instructions for building and running PHASM.
Building and running a Geant4 example
Here are some instructions for using singularity to build a Geant4 example and run it.
source /etc/profile.d/modules.sh module load singularity singularity shell -B/cvmfs:/cvmfs /cvmfs/oasis.opensciencegrid.org/jlab/epsci/singularity/images/epsci-ubuntu-22.04.img Singularity> source /cvmfs/oasis.opensciencegrid.org/jlab/epsci/ubuntu/22.04/share/spack/setup-env.sh Singularity> spack env activate phasm
The source for the Geant4 examples is available in /cvmfs though it has not been compiled. Compile it in your own directory like this:
# Define G4EX as the source directory of the example we want to build. # This just makes the cmake and other commands a little more readable. # The G4EX envar is not actually used by any of the software. # B4 is a simple sampling calorimeter example. export G4EX=$SPACK_ROOT/opt/spack/linux-*/*/geant4-*/share/Geant4/examples/basic/B4 # export G4EX=$SPACK_ROOT/opt/spack/linux-ubuntu22.04-x86_64/gcc-11.3.0/geant4-11.1.0-px46pszk3frzg74fdbsqktipkohbyq3u/share/Geant4/examples/basic/B4 # for cuda container cmake -S $G4EX -B build -DCMAKE_INSTALL_PREFIX=install -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=1 cmake --build build --target install -- -j8
There are actually 4 variants of this example that are built. All will be installed in install/bin. The examples expect you to use macros that came with the source. Copy the macros to your working directory and run an example like this:
cp -rp $G4EX/macros . cd macros ../install/bin/exampleB4d # A lot of output will be printed and a graphics window will open. # Eventually, you will be given a prompt where you may enter commands. # Enter the command run/beamOn 1 to simulated a single event. Idle> run/beamOn 1 # Quit the simulation Idle> exit
Note: You can control the number of threads and turn off visualization by editing the file init_vis.mac before starting the example.