Back to home page

EIC code displayed by LXR

 
 

    


Warning, /geant4/examples/README.HowToRun is written in an unsupported language. File is not indexed.

0001 -------------------------------------------------------------------
0002 
0003      =========================================================
0004      Geant4 - an Object-Oriented Toolkit for Simulation in HEP
0005      =========================================================
0006 
0007                  How to build and run an example
0008                  -------------------------------
0009 
0010  All basic and most of extended examples have a similar structure.
0011  The main () function is included in exampleXYZ.cc in the example top directory
0012  and the example source code is structered in include and src subdirectories.
0013  When the example is built, the executable takes the same name as the file with
0014  main() function without .cc extension, exampleXYZ.
0015 
0016  Then several macros are provided to run the example with various start-up
0017  conditions. These macros have usually .mac extension. Besides these macros,
0018  there is often a macro exampleXYZ.in (note its different extension)
0019  which is used in Geant4 testing and which output, exampleXYZ.out, can also included
0020  in the distribution.
0021 
0022  You can find all details about building the examples in the Geant4 Installation Guide:
0023  "https://geant4-userdoc.web.cern.ch/UsersGuides/InstallationGuide/html/index.html"
0024  in the section How to Use the Geant4 Toolkit Libraries:
0025  https://geant4-userdoc.web.cern.ch/UsersGuides/InstallationGuide/html/buildtools.html"
0026  Here we recall only the basics. 
0027 
0028  1) COMPILE AND LINK TO GENERATE AN EXECUTABLE
0029 
0030        % cd path_to_exampleXYZ     # go to directory which contains your example
0031        % mkdir exampleXYZ_build
0032        % cd exampleXYZ_build
0033        % cmake -DGeant4_DIR=path_to_Geant4_installation/lib[64]/cmake/Geant4/ ../exampleXYZ
0034        % make -j N exampleXYZ      # "N" is the number of processes
0035        % make install              # this step is optional
0036 
0037  2) EXECUTE EXAMPLEXYZ IN 'BATCH' MODE FROM MACRO FILES
0038                 
0039        ... go to the directory where the example was built/installed
0040        % ./exampleXYZ  xyz.mac
0041                 
0042  3) EXECUTE EXAMPLEXYZ IN 'INTERACTIVE MODE' WITH VISUALIZATION
0043 
0044        ... go to the directory where the example was built/installed
0045        % ./exampleXYZ
0046        ....
0047        Idle> type your commands
0048        ....
0049        Idle> exit
0050 
0051 
0052  Below we give the explicit instructions for the example 
0053  extended/electromagnetic/TestEm1. 
0054 
0055  Let's suppose that the TestEm1 directory is available in $HOME and Geant4 
0056  installation in /usr/local and we work within bash shell on a 64-bit machine.
0057 
0058  1) COMPILE AND LINK TESTEM1 TO GENERATE AN EXECUTABLE
0059 
0060     % cd $HOME
0061     % mkdir TestEm1_build
0062     % cd TestEm1_build
0063     % cmake -DGeant4_DIR=/usr/local/lib64/Geant4-11.0.0/ ../TestEm1
0064     % make -j 2 TestEm1
0065 
0066  2) EXECUTE TESTEM1 IN 'BATCH' MODE FROM MACRO FILES
0067 
0068     % cd $HOME/TestEm1_build    # or cd $HOME/TestEm1 if example was built with GNUmake
0069     % ./TestEm1 annihil.mac
0070     % ./TestEm1 brem.mac
0071     % ./TestEm1 TestEm1.in >& myTestEm1.out   # redirecting output in a file
0072                 
0073  3) EXECUTE TESTEM1 IN 'INTERACTIVE MODE' WITH VISUALIZATION
0074 
0075     % cd $HOME/TestEm1_build    # or cd $HOME/TestEm1 if example was built with GNUmake
0076     % ./TestEm1
0077     PreInit> /run/initialize 
0078     Idle>    /run/beamOn 1
0079     ...
0080     Idle>    exit