Geant4Examples

From Mu2eWiki
Jump to navigation Jump to search

The Geant4 package includes examples on now to create standalone Geant4 examples. Mu2e runs Geant4 from within an art module so these examples are not illustrative of how we use it. However understanding the first few Geant4 examples are good way to learn the basics of how to use Geant4; if you will work on Mu2e support for Geant4, we recommend understanding these examples before you see how Mu2e uses Geant4.

As of March 2024, the relevant Geant4 documentation is at these links:

The instructions on the CERN HowToRun page need some modifications to run in the Mu2e environment. The following describes how to install, build and run the basic example B1. These examples use G4 graphics and they work most easily if you do run the following commands from within a ComputingLogin#VNC session.

  1. Start in a clean shell
  2. mkdir G4Examples
  3. cd G4Examples
  4. mu2einit
  5. rsync -ar $GEANT4_DIR/source/geant4-v*/examples/basic/B1 .
  6. mkdir B1_build
  7. cd B1_build
  8. cmake -DGeant4_DIR=$GEANT4_FQ_DIR/lib/cmake/Geant4 ../B1
  9. make -j 4 B1
  10. ./exampleB1
  11. Following the run-time instructions in ../B1/README

Study how the examples works, using

If you wish to try other examples, follow the above pattern and make the directories peers of B1 and B1_build.

Notes:

  • Step 5: will choose the highest numbered envset in /cvmfs/mu2e.opensciencegrid.org/DataFiles/Muse/. It will also print a warning message that is safe to ignore.
  • Step 6 copies the example code from the G4 distribution to the local disk.
  • Steps 9 and 10 each take about 5 seconds on an unloaded mu2egpvm.
  1. Step 11 runs the example