Geant4 Cross Reference |
1 ---------------------------------------------- 2 3 ========================================= 4 Geant4 - an Object-Oriented Toolkit for S 5 ========================================= 6 7 How to build and run an examp 8 ----------------------------- 9 10 All basic and most of extended examples have 11 The main () function is included in exampleXY 12 and the example source code is structered in 13 When the example is built, the executable tak 14 main() function without .cc extension, exampl 15 16 Then several macros are provided to run the e 17 conditions. These macros have usually .mac ex 18 there is often a macro exampleXYZ.in (note it 19 which is used in Geant4 testing and which out 20 in the distribution. 21 22 You can find all details about building the e 23 "https://geant4-userdoc.web.cern.ch/UsersGuid 24 in the section How to Use the Geant4 Toolkit 25 https://geant4-userdoc.web.cern.ch/UsersGuide 26 Here we recall only the basics. 27 28 1) COMPILE AND LINK TO GENERATE AN EXECUTABLE 29 30 % cd path_to_exampleXYZ # go to dir 31 % mkdir exampleXYZ_build 32 % cd exampleXYZ_build 33 % cmake -DGeant4_DIR=path_to_Geant4_ins 34 % make -j N exampleXYZ # "N" is th 35 % make install # this step 36 37 2) EXECUTE EXAMPLEXYZ IN 'BATCH' MODE FROM MA 38 39 ... go to the directory where the examp 40 % ./exampleXYZ xyz.mac 41 42 3) EXECUTE EXAMPLEXYZ IN 'INTERACTIVE MODE' W 43 44 ... go to the directory where the examp 45 % ./exampleXYZ 46 .... 47 Idle> type your commands 48 .... 49 Idle> exit 50 51 52 Below we give the explicit instructions for t 53 extended/electromagnetic/TestEm1. 54 55 Let's suppose that the TestEm1 directory is a 56 installation in /usr/local and we work within 57 58 1) COMPILE AND LINK TESTEM1 TO GENERATE AN EX 59 60 % cd $HOME 61 % mkdir TestEm1_build 62 % cd TestEm1_build 63 % cmake -DGeant4_DIR=/usr/local/lib64/Gean 64 % make -j 2 TestEm1 65 66 2) EXECUTE TESTEM1 IN 'BATCH' MODE FROM MACRO 67 68 % cd $HOME/TestEm1_build # or cd $HOME/ 69 % ./TestEm1 annihil.mac 70 % ./TestEm1 brem.mac 71 % ./TestEm1 TestEm1.in >& myTestEm1.out 72 73 3) EXECUTE TESTEM1 IN 'INTERACTIVE MODE' WITH 74 75 % cd $HOME/TestEm1_build # or cd $HOME/ 76 % ./TestEm1 77 PreInit> /run/initialize 78 Idle> /run/beamOn 1 79 ... 80 Idle> exit