Fermilab Logo
-----
Computing Division - Fermilab-Search the Computing Web-CD Documents-CD Projects-Help Desk-CD Memos of Understanding-Fermilab At Work
System Status-Metrics-Fermilab Phonebook-Security-ES&H-CD Organization-CD Internal
---
ILC and Future Programs - Accel and Detector Sim - Geant4 at FNAL - Geant4 at CERN
Instructions for Geant4 Users at Fermilab

  • How to find the latest official version:
  • Please check the News, in the upper right corner of the Geant4 Homepage

  • Which versions are available on your machine:
  • Geant4 at Fermilab is available in ups/upd. To find out which versions are available on your machine please follow the instructions :
    > ups list -aK+ geant4
    If ups is not installed on your machine, a user will NOT be able to setup Geant4.
  • Which versions are available at Fermilab:
  • There may be more versions of Geant4 available in kits (upd) than are installed on your machine. To obtain the information please follow the instructions :
    > setup upd
    > upd list -aK+ geant4
    You will not be able to setup versions which are only available in upd. They must be installed on your machine first.

  • On which machines one can run Geant4 at Fermilab :
  • Geant4 is supported at Fermilab on the Linux platform only.
    On the central cluster FNALU we recommend flxi02 and flxi03 machines.
    CDF users can run on any of the machines served by ncdf209 or the interactive cluster fcdflnx2,fcdflnx3,...
    For Geant4 installation on a PC, please see specific instructions.

    How to choose the correct versions of Geant4: We suggest the use of the latest version available on your machine.
    You will need to select the flavor that corresponds to your machine.
    Depending on the needs of your project, may choose either the regular version or the version built with OpenGL.
    Please note that starting from release v4_8_1_p01 and onward, in addition to the Linux+2.4-2.3.2 flavor (SL3),
    Geant4 product is also available in the Linux+2.6 flavor (SL4).

  • How do you know the flavor of your machine:
  • To determine the flavor use the following command:
    > cat /etc/redhat-release

  • How to setup a particular version:
  • Use a qualifer (-q) to specify the desired compiler, for example:
    > setup   geant4   v4_9_2_p01   -q   GCC_3_4_3-OpenGL
    In general it is not necessary to specify the flavor, but you wish, you may do so with the of use of the (-f) qualifer, for example:
    > setup   geant4   v4_9_2_p01   -q   GCC_3_4_3-OpenGL   -f   Linux+2.4-2.3.2

    For SL4, we used the default compiler g77 or gcc-4.3.2; the build still has a qualifiers, to identify the featured OpenGL-based visualization option;
    to set it up, you may use either:
    > setup   geant4   v4_9_2_p01   -q   g77-OpenGL  
    > setup   geant4   v4_9_2_p01   -q   GCC_4_3_2-OpenGL  

  • How to find the Release Notes for a particular version :
  • Release Notes are linked in the Download section of the Geant4 page
    Once you setup Geant4, you can also find Release Notes in the subdirectory:
    $G4INSTALL/ReleaseNotes
    Currently the Release Notes are available in the html format.
    They typically contain information on:
    1. Supported and Tested Platforms
    2. AIDA and CLHEP
    3. Compiler Specific Problems
    4. Known Run-Time Problems
    5. Compilation Warnings
    6. Known Run-Time Warnings
    7. Major items for migration of user code
    8. Detailed list of changes and fixes

  • Which version of CLHEP is being used:
  • Geant4 depends on the CLHEP product; it will be automatically set up along with the Geant4;
    no specfic action from the user is needed.
    If you want to check the version of CLHEP, use one of the following commands:
    > echo   $CLHEP_BASE_DIR
    > echo   $CLHEP_DIR

  • Geant4 Examples
  • Geant4 comes with a set of examples of various complexity.
    We suggset that new Geant4 users start with the examples from the novice category.
    They can be found in the hierarchy of subdirectories, from /N01 to /N07, in the following area:
    $G4INSTALL/examples/novice
    For each example a README file with instructions is provided along with the source code.

  • How to build and run novice exampleN01:
  • This is the fisrt - and the simplest - example that introduces users to the Geant4 basics.
    The instructions below show how to build and run it.
    First of all, you will need to set up Geant4 (see setup section).
    After that, you will create your local work directory MyG4Test (or any name of your choice):
    > mkdir   MyG4Test
    and will copy into it all sources of the exampleN01:
    > cp   -r   $G4INSTALL/examples/novice/N01   MyG4Test/.
    Next, you will need to prepare your environment:
    > cd   MyG4Test/N01
    > setenv   G4WORKDIR $PWD
    Please note that you should set environment variable G4WORKDIR to point explicitely to your work area;
    otherwise the build (gmake) procedure will fail because it will try to create ``service'' /tmp and /bin subdirectories
    in the ``default'' $G4INSTALL area, where a typical user does not have the ``write'' access.
    Next step is to build the executable, which will be done via issuing statement:
    > gmake
    This will produce binary file exampleN01 in the $G4WORKDIR/bin/$G4SYSTEM subdirectory (G4SYSTEM
    is one of the environment variables defined upon Geant4 setup; for details see Information on Environment Variables ).
    It may also be useful to define an environment variable to point to the area where your executable is located, for example:
    > setenv   G4EXE   $G4WORKDIR/bin/$G4SYSTEM
    This example does not need any input; you can run it as follows:
    > $G4EXE/exampleN01
    which will produce an output on your screen, or you can redirect output into a file FileName.out (any name of your choice):
    > $G4EXE/exampleN01   >&   FileName.out
    You may compare your output with the ``standard'' output file exampleN01.out provided along with the example (you will
    find it in your $G4WORDIR area)

  • How to build and run novice exampleN02 with the openGL visualization:
  • The instructions are simular to those for exampleN01.
    However, there are several differences.
    First of all, you will need to set up Geant4 product built with the OpenGL (see setup section).
    In addition, you will need to set several environment variables specific to the OpenGL use:
    > setenv   G4VIS_BUILD_OPENGLX_DRIVER   1
    > setenv   G4VIS_USE_OPENGLX   1
    > setenv   OGLHOME /usr/X11R6
    > setenv   OGLFLAGS  "-I$OGLHOME/include"
    > setenv   OGLLIBS   "-L/usr/X11R6/lib -lGL -lGLU"
    Now you can copy exampleN02 and build it following the instructions provided above for exampleN01.
    Visualization is initialized and controlled via a set of /vis/ user interface commands provided in the example input file vis.mac.
    The vis.mac will be automatically read by the main() if you run exampleN02 without any input argument:
    > $G4EXE/exampleN02
    This mode is called ``interactive'', and at the end of the job you will need to type exit at the program command prompt:
    Idle> exit
    Alternatively, you can run exampleN02 with either vis.mac , or run1.mac, or run2.mac explicitely on input, for example:
    > $G4EXE/exampleN02   vis.mac
    This mode is called ``batch''. Please note that if you run in the ``batch'' mode with the vis.mac file on input, the OpenGL window
    will be closed automatically upon the program termination.
    Running with run1.mac or run2.mac will NOT employ openGL visualization.

  • Tips on other examples:
  • 1. Building other examples is similar to exampleN01.
    2. In case you choose to put several examples in the same area MyG4Test, you may want to set your environment variable
    G4WORKDIR to point directly to MyG4Test, rather than to the area of a specific example. In this case all the executables
    will be in the same area, because the build procedure (gmake) always creates /tmp and /bin in G4WORKDIR.
    However, you will still need to move to the area of one or another example and to issue the gmake statement there, in order
    to build the example.
    3. Some examples will need specific data and will require setting up additional environment variable. For instance, to be able
    to run exampleN04 you will have to:
    > setup   g4photon   v2_0
    > setenv G4LEVELGAMMADATA g4photon
    > setenv LD_LIBRARY_PATH LD_LIBRARY_PATH:$G4LIB/plists/$G4SYSTEM/:$G4LIB/$G4SYSTEM/
    For more details please check Information on additional products

  • Whether you need to do all this each time you logon:
  • A convenient way is to write a short shell script.
    An example shell script start_geant4.tcsh is offered; typically it refers to the latest version available at Fermilab.
    Each time you logon you source the file:
    > source   start_geant4.tcsh
    (You will need to make sure it is executable. If it is not, you can change the protection assigned to the file:
    chmod 744 start_geant4.tcsh)
    Those who are interested in using OpenGL visualization option, please see an example shell script
    start_geant4_OGL.tcsh that includes setting up several specific environment variables.
    You will need to make sure that the file protections allows its execution, after that you can source it.


    CD ]  [ IFP ]  [ ADS ]  [ Geant4 at FNAL ]  [ Geant4 at CERN ]
    This file last modified Thursday, 19-Mar-2009 17:05:17 CDT How to maintain these pages