Postinstall Setup¶
If you chose the default installation paths, then your install of
Geant4 is completely contained under the directory passed to
CMAKE_INSTALL_PREFIX
, with hierarchy
+- CMAKE_INSTALL_PREFIX +- bin/ | +- geant4-config (UNIX ONLY) | +- geant4.csh (UNIX ONLY) | +- geant4.sh (UNIX ONLY) | +- geant4-config.cmd (WINDOWS ONLY) | +- geant4.bat (WINDOWS ONLY) | +- G4global.dll (WINDOWS ONLY) | +- ... +- include/ | +- Geant4/ | +- G4global.hh | +- ... +- lib{64}/ | +- libG4global.{so,a,dylib,lib} | +- ... | +- cmake/ | | +- Geant4/ | | +- Geant4Config.cmake | | +- ... | +- Geant4-11.3.0/ | +- {Linux,Darwin}-{g++,clang} (UNIX ONLY) +- share +- Geant4-11.3.0 +- examples/ +- data/ (IF GEANT4_INSTALL_DATA WAS SET) +- geant4make/ +- geant4make.csh +- geant4make.sh +- config/
Required Environment Settings on UNIX¶
If you wish to make the Geant4 Toolkit programs and libraries available via your
PATH
and library path (LD_LIBRARY_PATH
on Linux) together with a default environment
variable for locating datasets, you should source the relevant script
in CMAKE_INSTALL_PREFIX/bin
. Please note that DYLD_LIBRARY_PATH
is
not set on macOS as this variable is not propagated to programs due
to SIP. This should not affect general
running of Geant4 applications as the default macOS settings link and install the libraries with
suitable install names and RPATHs.
On interactive Bourne shells (e.g. bash), do (assuming you are in
CMAKE_INSTALL_PREFIX/bin
):
$ source geant4.sh
This command can also be used to setup the environment for Geant4 in other Bourne shell scripts. You can also supply the full path to the script rather than changing to the directory containing it.
On interactive C shells, do (assuming you are in
CMAKE_INSTALL_PREFIX/bin
):
$ source geant4.csh
In an interactive session you can also supply the full path to the script rather than changing to the directory containing it. The C shell script cannot be sourced directly inside other shell scripts due to a limitation of the C shell which prevents the script being able to locate itself. If you need to source the C shell script inside another, then you can use the command:
$ cd CMAKE_INSTALL_PREFIX/bin ; source geant4.csh
where you should replace CMAKE_INSTALL_PREFIX/bin
with the directory
you installed geant4.csh
in. You can also use the command:
$ source CMAKE_INSTALL_PREFIX/bin/geant4.csh CMAKE_INSTALL_PREFIX/bin
where as above you should replace CMAKE_INSTALL_PREFIX/bin
with the
directory where geant4.csh
is located.
Required Environment Settings on Windows¶
On Windows, you should add the directory containing the Geant4 .dll
files
to your PATH/Path
environment variable(s), and set the variables
pointing to the datasets. This can be done through the experimental geant4.bat
batch file supplied in CMAKE_INSTALL_PREFIX/bin
for the current cmd session
only via (assuming you are in CMAKE_INSTALL_PREFIX/bin
):
> call geant4.bat
For PowerShell, you can either start PowerShell from cmd after calling the batch file, or use an extension such as Pscx and its Invoke-BatchFile command.
The required environment variables may also be set manually for the system as follows:
In Search, search for and select System (Control Panel)
Click the Advanced system settings link
Click the Environment Variables button
Select the
PATH
(orPath
) entry in the User variables list, and click the Edit button. IfPATH
orPath
are not present, click the New button and create one or the other.In the popup Edit User Variable window, add the directory in which the Geant4 DLLs are installed to the Variable value entry of the
PATH
orPath
variable (Note that on Windows, path entries are separated by semicolons). It’s very important to keep any existing entries otherwise other programs may stop working correctly!Optional, see Environment Variables for Datasets. Create a new environment variable named
GEANT4_DATA_DIR
and set its value to the path under which the physics model datasets are installed:If you installed Geant4 with
GEANT4_INSTALL_DATA
set toON
, then this path will beCMAKE_INSTALL_PREFIX/share/Geant4-
11.3.0
/data
.Otherwise, set the path to the location under which you manually unpacked the datasets to.
Click OK, and then OK through remaining windows to close.
Environment Variables for Datasets¶
If you need to manually manage the datasets for the Geant4 data-driven
physics models, zip/tarballs can be downloaded from the Geant4 distribution site.
Each dataset unpacks to a root directory whose name is the dataset name plus its
version. For example, the G4ABLA
dataset for Geant4 11.3.0 unpacks to a
“”name-version” directory G4ABLA
3.3
. The toolkit libraries locate these
datasets at application runtime using a lookup scheme based on a default set of paths which
may be overridden using environment variables.
With no environment variable(s) set, the toolkit will look for the required name-version dataset directories under the following ordered list of installation and platform dependent paths:
GEANT4_INSTALL_DATADIR
(as absolute installed path)Under each of the following prefixes
CMAKE_INSTALL_PREFIX
C:\\Program Files
(Windows only)C:\\Geant4
(Windows only)/usr/local
/usr
/cvmfs/geant4.cern.ch
with each of the following subdirectories:
share/Geant4/data
share/geant4/data
share/data
data
If the GEANT4_DATA_DIR
environment variable is set, then the above defaults are
ignored, and the value of this variable will be used as the root path under which
to look for the required name-version dataset directories. No fallback to the default search
paths is made if the dataset directory is not present under GEANT4_DATA_DIR
.
Finally, each dataset has an individual environment variable which may be set to
override both GEANT4_DATA_DIR
and default path lookup. These are listed below
together with the values, which must be the full path of the dataset’s unpacked root directory.
Please note that due to historical reasons the environment variables do not have a uniform
translation to the dataset name-version directories. This will be addressed in the next
major release of Geant4.
Environment Variable |
Value |
|
absolute path to the |
|
absolute path to the |
|
absolute path to the |
|
absolute path to the |
|
absolute path to the |
|
absolute path to the |
|
absolute path to the |
|
absolute path to the |
|
absolute path to the |
|
absolute path to the |
|
absolute path to the |
|
absolute path to the |