... | ... | @@ -2,7 +2,7 @@ |
|
|
|
|
|
[[_TOC_]]
|
|
|
|
|
|
In this tutorial we will use Geant4 version 10.7.1, compiled with the support of multithreading, GDML and Qt5 based GUI.
|
|
|
In this tutorial we will use Geant4 version 11.0.1, compiled with the support of multithreading, GDML and Qt5 based GUI. The installation of Geant4 version 10.7.1 also tested.
|
|
|
|
|
|
On MacOS we recommend to install external libraries via [Homebrew](https://brew.sh)
|
|
|
|
... | ... | @@ -11,7 +11,7 @@ script. |
|
|
|
|
|
## macOS Requirements
|
|
|
|
|
|
* A 64-bit Intel CPU
|
|
|
* A 64-bit Intel or M1 CPU
|
|
|
* macOS High Sierra (10.13) (or higher)
|
|
|
* Command Line Tools (CLT) for Xcode
|
|
|
* A Bourne-compatible shell for installation (e.g. bash or zsh)
|
... | ... | @@ -47,11 +47,12 @@ brew install expat |
|
|
#qt6 default now, geant4 need qt5
|
|
|
brew install qt@5
|
|
|
brew install xerces-c
|
|
|
brew install freetype
|
|
|
```
|
|
|
|
|
|
This will install all dependencies: expat , qt5 , xerces-c and cmake which need for compilatuion
|
|
|
This will install all dependencies: expat , qt5 , xerces-c and optionally freetype. You will need install cmake for compilatuion.
|
|
|
|
|
|
## Compiling Geant4 10.7.1
|
|
|
## Compiling Geant4
|
|
|
|
|
|
Make sure you have no previous geant4 definition in environment variables and path. qt5 tools must be in your path and you need to define **PKG_CONFIG_PATH** variable to allow cmake to find qt5 correctly.
|
|
|
|
... | ... | @@ -61,8 +62,7 @@ export PATH="/usr/local/opt/qt@5/bin:$PATH |
|
|
```
|
|
|
|
|
|
Now you can download geant4 via git or tarball and follow the standard
|
|
|
cmake installation procedure. In this repository https://llrgit.in2p3.fr/semenjuk/installg4.git you can find script `build-geant4-1071-macos.sh` which I use for installation.
|
|
|
Tested on MacOS (11.2.3) Big Sur with Xcode 12.4 installed.
|
|
|
cmake installation procedure. In this repository https://llrgit.in2p3.fr/semenjuk/installg4.git you can find script `build-geant4-macos.sh` which I use for installation.
|
|
|
|
|
|
*Note. The default TLS model in Geant4 set to __initial-exec__ can cause some instability and slow-down of QtGui, I have better results with -DGEANT4_BUILD_TLS_MODEL=auto.*
|
|
|
|
... | ... | @@ -74,7 +74,7 @@ See e.g. https://chao-tic.github.io/blog/2018/12/25/tls for information about TL |
|
|
|
|
|
The ROOT installation is required for some exercises in this tutorial.
|
|
|
|
|
|
The command: `brew install root` will install _root_ 6.22/08.
|
|
|
The command: `brew install root` will install _root_ 6.26/02.
|
|
|
|
|
|
Homebrew installs ROOT in _relocatable_ mode.
|
|
|
To use ROOT, you must set its environment sourcing the *thisroot.sh* script from
|
... | ... | @@ -88,7 +88,7 @@ Visit http://root.cern.ch for more information about ROOT. |
|
|
|
|
|
In order to use Geant4 you need to define the environment variables pointing to the Geant4 datasets locations. This can be done by sourcing the *geant4.sh* script. For our installation this command is:
|
|
|
|
|
|
`source /usr/local/geant4/10.7.1/bin/geant4.sh`
|
|
|
`source /usr/local/geant4/11.0.1/bin/geant4.sh`
|
|
|
|
|
|
In the git repository you can find the bash script *setup_env.sh* with setup both for ROOT and Geant4.
|
|
|
|
... | ... | @@ -103,8 +103,8 @@ if [ -x /usr/local/bin/thisroot.sh ]; then |
|
|
fi
|
|
|
|
|
|
# Geant4
|
|
|
if [ -x /usr/local/geant4/10.7.1/bin/geant4.sh ]; then
|
|
|
. /usr/local/geant4/10.7.1/bin/geant4.sh
|
|
|
if [ -x /usr/local/geant4/11.0.1/bin/geant4.sh ]; then
|
|
|
. /usr/local/geant4/11.0.1/bin/geant4.sh
|
|
|
fi
|
|
|
|
|
|
>>>>>
|
... | ... | @@ -125,10 +125,10 @@ add these lines in your .bash_profile to get the environment set automatically w |
|
|
**N.B.** Before compiling the examples you need setup the environment for geant4:
|
|
|
|
|
|
```
|
|
|
if [ -x /usr/local/geant4/10.7.1/bin/geant4.sh ]; then
|
|
|
. /usr/local/geant4/10.7.1/bin/geant4.sh
|
|
|
if [ -x /usr/local/geant4/11.0.1/bin/geant4.sh ]; then
|
|
|
. /usr/local/geant4/11.0.1/bin/geant4.sh
|
|
|
# Need this if other Geant4 installed in /usr/local
|
|
|
export CMAKE_PREFIX_PATH=/usr/local/geant4/10.7.1/lib/Geant4-10.7.1
|
|
|
export CMAKE_PREFIX_PATH=/usr/local/geant4/11.0.1/lib/Geant4-11.0.1
|
|
|
fi
|
|
|
```
|
|
|
|
... | ... | @@ -142,7 +142,7 @@ E.g. basic B1 example: |
|
|
$ cd ~/tmp
|
|
|
$ mkdir B1-build
|
|
|
$ cd B1-build
|
|
|
$ cmake /usr/local/geant4/10.7.1/share/Geant4-10.7.1/examples/basic/B1/
|
|
|
$ cmake /usr/local/geant4/11.0.1/share/Geant4-11.0.1/examples/basic/B1/
|
|
|
```
|
|
|
|
|
|
You should see something like the output below. Watch for eventual configuration errors.
|
... | ... | @@ -285,6 +285,9 @@ $ |
|
|
- zsh
|
|
|
- If you use zsh you need to use .zprofile instead of .bash_profile
|
|
|
- Use *source* not *.* to source setup scripts
|
|
|
- you can't source geant4.sh with path in zsh,repace commmand
|
|
|
`source <install_path>/geant4.sh` with
|
|
|
`pushd -q <install_path>; source geant4.sh; popd -q`
|
|
|
|
|
|
- bash
|
|
|
- zsh default warning
|
... | ... | |