... | ... | @@ -6,45 +6,45 @@ In this tutorial we will use Geant4 version 11.1.1, compiled with the support of |
|
|
|
|
|
The Qt6 interface not tested yet, we made tests on Mac M1 (ARM) with MacOS Ventura (13) and Sonoma (14).
|
|
|
|
|
|
__The installation tested on Intel Mac with
|
|
|
MacOS Big Sur (12), but this OS version not supported since September 2013.__
|
|
|
|
|
|
On MacOS we recommend to install external libraries via [Homebrew](https://brew.sh)
|
|
|
|
|
|
All pre-installation steps are summarized in the `install-by-brew.sh`
|
|
|
script.
|
|
|
All pre-installation steps are summarized in the `install-by-brew.sh` script.
|
|
|
|
|
|
## macOS Requirements
|
|
|
|
|
|
* A 64-bit Intel or M1 CPU
|
|
|
* macOS Monterey (12.6.6) (or higher)
|
|
|
* Command Line Tools (CLT) for Xcode
|
|
|
* A Bourne-compatible shell for installation (e.g. bash or zsh)
|
|
|
* A 64-bit Intel or M1 CPU
|
|
|
* macOS Monterey (12.6.6) (or higher)
|
|
|
* Command Line Tools (CLT) for Xcode
|
|
|
* A Bourne-compatible shell for installation (e.g. bash or zsh)
|
|
|
|
|
|
## Homebrew Installation
|
|
|
|
|
|
In a macOS Terminal type the following command:
|
|
|
|
|
|
```
|
|
|
```plaintext
|
|
|
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
|
|
|
```
|
|
|
|
|
|
Visit Homebrew web site for details:
|
|
|
|
|
|
https://brew.sh
|
|
|
https://docs.brew.sh/Installation
|
|
|
https://brew.sh https://docs.brew.sh/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.
|
|
|
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):
|
|
|
First install _cmake_ (type the following command in Terminal window):
|
|
|
|
|
|
```
|
|
|
```plaintext
|
|
|
brew install cmake
|
|
|
```
|
|
|
|
|
|
Then install dependancies:
|
|
|
|
|
|
```
|
|
|
```plaintext
|
|
|
brew install expat
|
|
|
#qt6 default now, geant4 need qt5
|
|
|
brew install qt@5
|
... | ... | @@ -53,54 +53,50 @@ brew install xerces-c |
|
|
brew install freetype
|
|
|
```
|
|
|
|
|
|
This will install all dependencies: expat , qt5 , xerces-c and optionally freetype. You will need install cmake for compilatuion.
|
|
|
This will install all dependencies: expat , qt5 , xerces-c and optionally freetype. You will need install cmake for compilatuion.
|
|
|
|
|
|
## 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.
|
|
|
|
|
|
```
|
|
|
```plaintext
|
|
|
export PKG_CONFIG_PATH=/usr/local/opt/qt@5/lib/pkgconfig
|
|
|
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-macos.sh` which I use for installation.
|
|
|
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-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.*
|
|
|
_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._
|
|
|
|
|
|
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.*
|
|
|
_Note. Geant4 is installed with MacOS native Qt interface, X11 is not required._
|
|
|
|
|
|
## ROOT Installation ##
|
|
|
## ROOT Installation
|
|
|
|
|
|
The ROOT installation is required for some exercises in this tutorial.
|
|
|
The root installation with brew requeired full XCode installetion.
|
|
|
The ROOT installation is required for some exercises in this tutorial. The root installation with brew requeired full XCode installetion.
|
|
|
|
|
|
The command: `brew install root` will install _root_ 6.26/06.
|
|
|
|
|
|
I has only xcode cli installed so i download root 6.28.02 directly from https://root.cern.ch/releases/release-62802/
|
|
|
|
|
|
The ROOT package installed in _relocatable_ mode.
|
|
|
To use ROOT, you must set its environment sourcing the *thisroot.sh* script from
|
|
|
the ROOT installation directory:
|
|
|
The ROOT package installed in _relocatable_ mode. To use ROOT, you must set its environment sourcing the _thisroot.sh_ script from the ROOT installation directory:
|
|
|
|
|
|
`source /usr/local/root/6.28.02/bin/thisroot.sh`
|
|
|
`source /usr/local/root/6.28.02/bin/thisroot.sh`
|
|
|
|
|
|
Visit http://root.cern.ch for more information about ROOT.
|
|
|
|
|
|
## Environment
|
|
|
|
|
|
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:
|
|
|
|
|
|
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/11.1.1/bin/geant4.sh`
|
|
|
|
|
|
In the git repository you can find the bash script *setup_env.sh* with setup both for ROOT and Geant4.
|
|
|
In the git repository you can find the bash script _setup_env.sh_ with setup both for ROOT and Geant4.
|
|
|
|
|
|
See below the code snippet:
|
|
|
|
|
|
```
|
|
|
```plaintext
|
|
|
>>>>>
|
|
|
|
|
|
# ROOT 6
|
... | ... | @@ -116,21 +112,21 @@ 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.
|
|
|
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.
|
|
|
|
|
|
## Testing of installation
|
|
|
|
|
|
### 1. Open new Terminal window
|
|
|
### 1\. Open new Terminal window
|
|
|
|
|
|
### 2. Source `setup_env.sh` if not done with `.bash_profile`
|
|
|
- `source ~/setup_env.sh`
|
|
|
### 2\. Source `setup_env.sh` if not done with `.bash_profile`
|
|
|
|
|
|
### 3. Test Geant4 installation
|
|
|
- `source ~/setup_env.sh`
|
|
|
|
|
|
### 3\. Test Geant4 installation
|
|
|
|
|
|
**N.B.** Before compiling the examples you need setup the environment for geant4:
|
|
|
|
|
|
```
|
|
|
```plaintext
|
|
|
if [ -x /usr/local/geant4/11.1.1/bin/geant4.sh ]; then
|
|
|
. /usr/local/geant4/11.1.1/bin/geant4.sh
|
|
|
# Need this if other Geant4 installed in /usr/local
|
... | ... | @@ -138,22 +134,22 @@ if [ -x /usr/local/geant4/11.1.1/bin/geant4.sh ]; then |
|
|
fi
|
|
|
```
|
|
|
|
|
|
or you can source `setup_env.sh` in new window.
|
|
|
or you can source `setup_env.sh` in new window.
|
|
|
|
|
|
You can try to compile and run one of the Geant4 examples.
|
|
|
|
|
|
E.g. basic B1 example:
|
|
|
|
|
|
```
|
|
|
```plaintext
|
|
|
$ cd ~/tmp
|
|
|
$ mkdir B1-build
|
|
|
$ cd B1-build
|
|
|
$ cmake /usr/local/geant4/11.1.1/share/Geant4/examples/basic/B1/
|
|
|
```
|
|
|
|
|
|
You should see something like the output below. Watch for eventual configuration errors.
|
|
|
You should see something like the output below. Watch for eventual configuration errors.
|
|
|
|
|
|
```
|
|
|
```plaintext
|
|
|
-- The C compiler identification is AppleClang 12.0.0.12000032
|
|
|
-- The CXX compiler identification is AppleClang 12.0.0.12000032
|
|
|
-- Detecting C compiler ABI info
|
... | ... | @@ -176,7 +172,7 @@ You should see something like the output below. Watch for eventual configuratio |
|
|
|
|
|
Now you can build the application with `make -j4` where -j4 is the number of parallel make processes.
|
|
|
|
|
|
```
|
|
|
```plaintext
|
|
|
$ make
|
|
|
Scanning dependencies of target exampleB1
|
|
|
[ 12%] Building CXX object CMakeFiles/exampleB1.dir/exampleB1.cc.o
|
... | ... | @@ -194,27 +190,27 @@ The compilation finished successfully |
|
|
|
|
|
Now you can run the example executable:
|
|
|
|
|
|
```
|
|
|
```plaintext
|
|
|
./exampleB1
|
|
|
```
|
|
|
|
|
|
This will open an interactive QT GUI window.
|
|
|
|
|
|
To generate N events type in the Session window:
|
|
|
```
|
|
|
|
|
|
```plaintext
|
|
|
/run/beamOn N
|
|
|
```
|
|
|
|
|
|
To quit application type:
|
|
|
|
|
|
```
|
|
|
```plaintext
|
|
|
exit
|
|
|
```
|
|
|
|
|
|
See below the expected program output in the terminal.
|
|
|
*You should not see a crash dump!*
|
|
|
See below the expected program output in the terminal. _You should not see a crash dump!_
|
|
|
|
|
|
```
|
|
|
```plaintext
|
|
|
[MacBook-Pro-5] ~/tmp/B1-build > ./exampleB1
|
|
|
Available UI session types: [ Qt, GAG, tcsh, csh ]
|
|
|
G4WT1 > /control/saveHistory
|
... | ... | @@ -243,11 +239,11 @@ G4WT1 > /run/physicsModified |
|
|
> RunManagerKernel is deleted. Good bye :)
|
|
|
```
|
|
|
|
|
|
### 4. Test ROOT Installation
|
|
|
### 4\. Test ROOT Installation
|
|
|
|
|
|
Start the ROOT interactive session:
|
|
|
|
|
|
```
|
|
|
```plaintext
|
|
|
$ root
|
|
|
------------------------------------------------------------------
|
|
|
| Welcome to ROOT 6.22/04 https://root.cern |
|
... | ... | @@ -259,15 +255,16 @@ $ root |
|
|
```
|
|
|
|
|
|
and type `.demo` after the ROOT prompt:
|
|
|
```
|
|
|
|
|
|
```plaintext
|
|
|
root [0] .demo
|
|
|
```
|
|
|
|
|
|
You will see the ROOT demo bar and can run some demos by clicking on the demo menu.
|
|
|
You need to go from up to down in the menu, some demos depend on the previous demos results.
|
|
|
You will see the ROOT demo bar and can run some demos by clicking on the demo menu. You need to go from up to down in the menu, some demos depend on the previous demos results.
|
|
|
|
|
|
To quit ROOT type .q on the ROOT prompt
|
|
|
```
|
|
|
|
|
|
```plaintext
|
|
|
root [1] .q
|
|
|
|
|
|
Taking a break from ROOT? Hope to see you back!
|
... | ... | @@ -275,31 +272,20 @@ Taking a break from ROOT? Hope to see you back! |
|
|
$
|
|
|
```
|
|
|
|
|
|
## Tips ##
|
|
|
## Tips
|
|
|
|
|
|
- Xcode
|
|
|
- You can install **Xcode** via **App Store** or download **Command Line Tools** from Apple Developer site https://developer.apple.com/downloads/
|
|
|
|
|
|
- Geant4
|
|
|
- You can check the Geant4 datasets installation using the command:
|
|
|
`geant4-config --check-datasets`
|
|
|
- You can check the Geant4 datasets installation using the command: `geant4-config --check-datasets`
|
|
|
- `geant4-config --help` also shows the Geant4 features (configuration options)
|
|
|
|
|
|
Visit Geant4 Installation Guide for more info:
|
|
|
http://geant4-userdoc.web.cern.ch/geant4-userdoc/UsersGuides/InstallationGuide/html/
|
|
|
|
|
|
Visit Geant4 Installation Guide for more info: http://geant4-userdoc.web.cern.ch/geant4-userdoc/UsersGuides/InstallationGuide/html/
|
|
|
- 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`
|
|
|
|
|
|
- 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
|
|
|
To suppress a warning massage put the following line into .bash_profile:
|
|
|
`export BASH_SILENCE_DEPRECATION_WARNING=1`
|
|
|
|
|
|
- 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 |
|
|
- default application encoding: defaults write -g AppleLocale en_US |
|
|
\ No newline at end of file |