# Getting Started with Geant4

21-23 January 2020
CERN
Europe/Zurich timezone

# Installing the Geant4 virtual machine

The Geant4 Virtual Machine provides a compiler, the extra software which Geant4 requires including a large set of visualisation libraries, and a fully working Geant4 system.

It avoids the effort to find and install the key pieces needed to create an installation on your own system, which varies depending on the OS, its version and many other factors.

This is the only method that we will support for this course.

The following information is a summary of the key steps. Further details can be found at the CENBG home of the Geant4 Virtual Machine.

### Step 1: Ensure that your machine can run the Geant4 Virtual Machine

Make sure that your computer meets the minimum requirements:

• Windows or Linux users : desktop or laptop PC running Windows or Linux with a virtualization software installed
• Mac users : Mac running Mac OS with a virtualization software installed
• at least 30 GB of free disk space available
• at least 4 GB of RAM available for use on the PC or Mac

### Step 2: Obtain a Virtual Machine 'player'

There is a choice of Virtual machine host software:

• The host software (player) from VMware, Inc is our recommendation:
• On Windows the VMWare Workstation Pro  is the choice,
• On Linux the Workstation Player can find be found for download and evaluation
• On Macintosh VMware Fusion has a download for evaluation, but is a commercial product (after the evaluation period of 30 days, a license must be purchased to keep using it).  Note that
• The recommended version is the latest version (11.5) of Fusion, which supports MacOS versions only from High Sierrra (MacOS 10.13) on.
• Fusion version 11.1.0 appears to be the last version which support Sierra (MacOS 10.12), and also added support for RHEL 8.0, which we believe is needed.  It appears to be still available for download.
• The alternative player is the free Virtual Box open source software available from Virtual Box software - but we have experienced issues with its interactivity. The instructions below relates only to a VMware Fusion configuration.

### Step 3: Obtain the Geant4 virtual machine

Obtain the Virtual machine file which corresponds to your player, and uncompress it:

• Download the corresponding file with the Geant4 Virtual Machine for your player.  Note that the VM file is large (7.2 GBytes), so it can take a long time to download, depending on your network bandwidth.
• Note: The current version includes both the FR or US keyboard version.

### Step 4: Uncompressing

• You need software which can un-compress '7z' files. There are many other choices, such as the popular (de-)compressor WinZip

### Step 5: Opening the Virtual Machine

• Use the files you downloaded to start a Virtual Machine with Geant4:

• You should find a new directory G4.10.06_CTOS8 at this location.
• Check that you can find the following uncompressed files in this directory
G4-10.06_CentOS8-src-foo1.vmdk
G4-10.06_CentOS8-src-foo2.vmdk
G4-10.06_CentOS8-src.vmdk
G4-10.06_CentOS8.nvram
G4-10.06_CentOS8.vmdk
G4-10.06_CentOS8.vmx         <----- the key file
G4-10.06_CentOS8.vmxf 
• Open that file using the corresponding program - i.e. use VMware Workstation (Windows), VMWare Player on Linux, or VMware Fusion on Mac.
• G4-10.06_CentOS8.vmx
• Note that you may encounter issues on opening this file:
• on Windows systems typically you will need to enable features needed for virtualisation in the BIOS.  This is needed if you encounter a message such as "Intel Vtx is disabled..."
• on earlier versions of MacOS like High Sierra, you may get a message like: "Could not open /dev/vmmon: No such file or directory. Please make sure that the kernel module 'vmmon' is loaded." This can be fixed by Opening the "Security and Privacy" dialog of "System Preferences", and from "General" tab looking for the message "System software from developer "VMware, Inc." was blocked from loading." If you click the Allow button, it should resolve the issue (for further details about this topic, please see the item on stackexchange).
• On MacOS Mojave you will need to grant access to some resources to Fusion -- this may need a reboot (also from the previous issue on stackexchange - see response of 16 October 2018 - user306389.)

### Step 6: Locate the Geant4 installation and check it

• The virtual machine will boot.  It will take a few minutes,
• You should now obtain a (Linux) desktop, which is mostly empty.
• Its menus can be found in the top left corner (icon and 'Activities').
• You can make it full screen using the icon with a rectangle inside a partial four corners.
• Open a Terminal window using the icon/"Activities":
• Look for the rectangle with a silver border around a prompt (in this menu) and you use it to obtain a Terminal.
• You should see a new window, ready to accept your commands
• It is running the command shell 'tcsh'
• Locate Geant4
• The Geant4 installation is located under the path defined for the $G4COMP environment variable. Type the following • echo$G4COMP
• /usr/local/geant4.10.06/share/Geant4-10.6.0
• cd $G4COMP • ls • echo$G4EXAMPLES
• /usr/local/geant4.10.06/share/Geant4-10.6.0/examples
• cd $G4EXAMPLES • ls • advanced/ basic/ CMakeLists.txt extended/ ..... • Build and run an example as an extra check • Please try to build the B1 example using the following commands: cd mkdir geant4/work/buildB1 cd geant4/work/buildB1 cmake$G4EXAMPLES/basic/B1
make -j4
./exampleB1 exampleB1.in
./exampleB1   
• DONE

We thank CENBG and CNRS for providing the Geant4 Virtual Machine, which is described in the article Int. J. Model. Simul. Sci. Comput. 1 (2010) 157–178, for updating it regularly and promptly and in time for this tutorial. and for their helpful collaboration.