... | ... | @@ -2,11 +2,11 @@ |
|
|
|
|
|
[[_TOC_]]
|
|
|
|
|
|
In this tutorial we will use Geant4 version 10.6.2, compiled with the support of multithreading and Qt5 based GUI.
|
|
|
In this tutorial we will use Geant4 version 10.7.1, compiled with the support of multithreading, GDML and Qt5 based GUI.
|
|
|
|
|
|
On MacOS we recommend to install Geant4 via [Homebrew](https://brew.sh)
|
|
|
|
|
|
All installation steps are summarized in the `install-by-brew.sh`
|
|
|
All pre-installation steps are summarized in the `install-by-brew.sh`
|
|
|
script.
|
|
|
|
|
|
## macOS Requirements
|
... | ... | @@ -29,28 +29,52 @@ Visit Homebrew web site for details: |
|
|
https://brew.sh
|
|
|
https://docs.brew.sh/Installation
|
|
|
|
|
|
## Geant4 installation
|
|
|
## Installation of external libraries for Geant4
|
|
|
|
|
|
Since Feb 2021 homebrew not provide geant4 installation.
|
|
|
You can install libraries which need by geant4 via homebrew and compile geant4 later on.
|
|
|
|
|
|
First install _cmake_ (type the following command in Terminal window):
|
|
|
|
|
|
`brew install cmake`
|
|
|
```
|
|
|
brew install cmake
|
|
|
```
|
|
|
|
|
|
Then install dependancies:
|
|
|
|
|
|
```
|
|
|
brew install expat
|
|
|
#qt6 default now, geant4 need qt5
|
|
|
brew install qt@5
|
|
|
brew install xerces-c
|
|
|
```
|
|
|
|
|
|
This will install all dependencies: expat , qt5 , xerces-c and cmake which need for compilatuion
|
|
|
|
|
|
## Compiling Geant4 10.7.1
|
|
|
|
|
|
Then type:
|
|
|
Make sure you not have previous geant4 definition in environment variables and path. qt5 tools mast be in you path and you need define **PKG_CONFIG_PATH** variable to allow cmake find qt5 correctly.
|
|
|
|
|
|
`brew install geant4`
|
|
|
```
|
|
|
export PKG_CONFIG_PATH=/usr/local/opt/qt@5/lib/pkgconfig
|
|
|
export PATH="/usr/local/opt/qt@5/bin:$PATH
|
|
|
```
|
|
|
|
|
|
This will install _geant4_ 10.6.2 with all dependencies: expat , qt , xerces-c
|
|
|
Now you dir download geant4 via git or tarball and follow standard
|
|
|
cmake installation procedure. In this repository https://llrgit.in2p3.fr/semenjuk/installg4.git you can found script `build-geant4-1071-macos.sh` with i use for installation.
|
|
|
Tested on MacOS (11.2.3) Big Sur with Xcode 12.4 installed.
|
|
|
|
|
|
Geant4 is by default installed in /usr/local/Cellar/geant4/10.6.2 with
|
|
|
links in /usr/local/{bin, include, lib, share}.
|
|
|
*Note. The default TLS model in Geant4 set to __initial-exec__ make provide some instability and slow-less of QtGui, i has better results with -DGEANT4_BUILD_TLS_MODEL=auto.*
|
|
|
|
|
|
Geant4 is installed with MacOS native Qt interface, X11 is not required.
|
|
|
See e.g. https://chao-tic.github.io/blog/2018/12/25/tls for information about TLS modelles in C++
|
|
|
|
|
|
*Note. Geant4 is installed with MacOS native Qt interface, X11 is not required.*
|
|
|
|
|
|
## ROOT Installation ##
|
|
|
|
|
|
The ROOT installation is required for some exercises in this tutorial.
|
|
|
|
|
|
The command: `brew install root` will install _root_ 6.22/04.
|
|
|
The command: `brew install root` will install _root_ 6.22/08.
|
|
|
|
|
|
Homebrew installs ROOT in _relocatable_ mode.
|
|
|
To use ROOT, you must set its environment sourcing the *thisroot.sh* script from
|
... | ... | @@ -64,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 the Homebrew installation this command is:
|
|
|
|
|
|
`source /usr/local/bin/geant4.sh`
|
|
|
`source /usr/local/geant4/10.7.1/bin/geant4.sh`
|
|
|
|
|
|
In the git repository you can find the bash script *setup_env.sh* with setup both for ROOT and Geant4.
|
|
|
|
... | ... | @@ -79,8 +103,8 @@ if [ -x /usr/local/bin/thisroot.sh ]; then |
|
|
fi
|
|
|
|
|
|
# Geant4
|
|
|
if [ -x /usr/local/bin/geant4.sh ]; then
|
|
|
. /usr/local/bin/geant4.sh
|
|
|
if [ -x /usr/local/geant4/10.7.1/bin/geant4.sh ]; then
|
|
|
. /usr/local/geant4/10.7.1/bin/geant4.sh
|
|
|
fi
|
|
|
|
|
|
>>>>>
|
... | ... | @@ -89,44 +113,26 @@ fi |
|
|
You can source this script before starting to work with your Geant4 project or
|
|
|
add these lines in your .bash_profile to get the environment set automatically when you log in.
|
|
|
|
|
|
## Comiling Geant4 10.6.3
|
|
|
|
|
|
Make sure you not have previous geant4 definition in environment variables and path. qt tools mast be in you path and you need define **PKG_CONFIG_PATH**
|
|
|
variable to allow cmake find qt correctly.
|
|
|
## Testing of installation
|
|
|
|
|
|
```
|
|
|
export PKG_CONFIG_PATH=/usr/local/opt/qt/lib/pkgconfig
|
|
|
export PATH="/usr/local/opt/qt/bin:$PATH
|
|
|
```
|
|
|
### 1. Open new Terminal window
|
|
|
|
|
|
Now you dir download geant4 via git or tarball and follow standard
|
|
|
cmake installation procedure. In this repository you can found script
|
|
|
`build-geant4-1063-macos.sh`
|
|
|
with i use for installation. Tested on MacOS (10.15.7) Catalina with Xcode and Command Line Tools for Xcode 12.2 installed.
|
|
|
*Note. The default TLS model in Geant4 set to __initial-exec__ make provide some instability and slow-less of QtGui, i has better results with -DGEANT4_BUILD_TLS_MODEL=auto.*
|
|
|
### 2. Source `setup_env.sh` if not done with `.bash_profile`
|
|
|
- `source ~/setup_env.sh`
|
|
|
|
|
|
See e.g. https://chao-tic.github.io/blog/2018/12/25/tls for information about TLS modelles in C++
|
|
|
### 3. Test Geant4 installation
|
|
|
|
|
|
Before compiling the examples you need setup the environment for geant4.
|
|
|
**N.B.** Before compiling the examples you need setup the environment for geant4:
|
|
|
|
|
|
```
|
|
|
if [ -x /usr/local/geant4/10.6.3/bin/geant4.sh ]; then
|
|
|
. /usr/local/geant4/10.6.3/bin/geant4.sh
|
|
|
if [ -x /usr/local/geant4/10.7.1/bin/geant4.sh ]; then
|
|
|
. /usr/local/geant4/10.7.1/bin/geant4.sh
|
|
|
# Need this if other Geant4 installed in /usr/local
|
|
|
export CMAKE_PREFIX_PATH=/usr/local/bin/geant/10.6.3/lib/Geant4-10.6.3
|
|
|
export CMAKE_PREFIX_PATH=/usr/local/geant4/10.7.1/lib/Geant4-10.7.1
|
|
|
fi
|
|
|
```
|
|
|
|
|
|
## Testing of installation
|
|
|
|
|
|
**N.B.** use `setup_env_10_6_3.sh` if you compile geant4 locally.
|
|
|
|
|
|
### 1. Open new Terminal window
|
|
|
|
|
|
### 2. Source `setup_env.sh` if not done with `.bash_profile`
|
|
|
- `source ~/setup_env.sh`
|
|
|
|
|
|
### 3. Test Geant4 installation
|
|
|
or you can source `setup_env.sh` in new window.
|
|
|
|
|
|
You can try to compile and run one of the Geant4 examples.
|
|
|
|
... | ... | @@ -136,7 +142,7 @@ E.g. basic B1 example: |
|
|
$ cd ~/tmp
|
|
|
$ mkdir B1-build
|
|
|
$ cd B1-build
|
|
|
$ cmake /usr/local/share/Geant4-10.6.2/examples/basic/B1/
|
|
|
$ cmake /usr/local/geant4/10.7.1/share/Geant4-10.7.1/examples/basic/B1/
|
|
|
```
|
|
|
|
|
|
You should see something like the output below. Watch for eventual configuration errors.
|
... | ... | @@ -154,9 +160,9 @@ You should see something like the output below. Watch for eventual configuratio |
|
|
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
|
|
|
-- Detecting CXX compile features
|
|
|
-- Detecting CXX compile features - done
|
|
|
-- Found EXPAT: /usr/local/opt/expat/lib/libexpat.dylib (found suitable version "2.2.10", minimum required is "2.2.9")
|
|
|
-- Found XercesC: /usr/local/lib/libxerces-c.dylib (found suitable version "3.2.3", minimum required is "3.2.3")
|
|
|
-- Found OpenGL: /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/OpenGL.framework
|
|
|
-- Found EXPAT: /usr/local/opt/expat/lib/libexpat.dylib (found suitable version "2.2.10", minimum required is "2.2.9")
|
|
|
-- Found XercesC: /usr/local/lib/libxerces-c.dylib (found suitable version "3.2.3", minimum required is "3.2.3")
|
|
|
-- Found OpenGL: /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/OpenGL.framework
|
|
|
-- Configuring done
|
|
|
-- Generating done
|
|
|
-- Build files have been written to: /Users/semenjuk/tmp/B1-build
|
... | ... | @@ -205,14 +211,14 @@ See below the expected program output in the terminal. |
|
|
```
|
|
|
[MacBook-Pro-5] ~/tmp/B1-build > ./exampleB1
|
|
|
Available UI session types: [ Qt, GAG, tcsh, csh ]
|
|
|
G4WT1 > /control/saveHistory
|
|
|
G4WT0 > /control/saveHistory
|
|
|
G4WT1 > /control/saveHistory
|
|
|
G4WT0 > /control/saveHistory
|
|
|
G4WT0 > /run/verbose 2
|
|
|
G4WT1 > /run/verbose 2
|
|
|
G4WT0 > /run/initialize
|
|
|
G4WT1 > /run/initialize
|
|
|
G4WT0 > /run/physicsModified
|
|
|
G4WT1 > /run/physicsModified
|
|
|
G4WT0 > /run/initialize
|
|
|
G4WT1 > /run/initialize
|
|
|
G4WT0 > /run/physicsModified
|
|
|
G4WT1 > /run/physicsModified
|
|
|
|
|
|
...
|
|
|
<snip>
|
... | ... | @@ -284,6 +290,7 @@ $ |
|
|
- zsh default warning
|
|
|
To suppress a warning massage put the following line into .bash_profile:
|
|
|
`export BASH_SILENCE_DEPRECATION_WARNING=1`
|
|
|
|
|
|
- Termianl
|
|
|
- default application encoding:
|
|
|
defaults write -g AppleLocale en_US |