... | ... | @@ -4,10 +4,10 @@ |
|
|
|
|
|
In this tutorial we will use Geant4 version 10.6.2.
|
|
|
|
|
|
On MacOS we recommend install Geant4 via [Homebrew](https://brew.sh)
|
|
|
On MacOS we recommend to install Geant4 via [Homebrew](https://brew.sh)
|
|
|
|
|
|
All installation steps sumarased in `install-by-brew.sh`
|
|
|
scipt.
|
|
|
All installation steps are summarized in the `install-by-brew.sh`
|
|
|
script.
|
|
|
|
|
|
## macOS Requirements
|
|
|
|
... | ... | @@ -18,60 +18,60 @@ scipt. |
|
|
|
|
|
## Homebrew Installation
|
|
|
|
|
|
In a macOS Terminal type following command:
|
|
|
In a macOS Terminal type the following command:
|
|
|
|
|
|
`/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"`
|
|
|
|
|
|
Visit Homebrew pages for details:
|
|
|
Visit Homebrew web site for details:
|
|
|
|
|
|
https://brew.sh
|
|
|
https://docs.brew.sh/Installation
|
|
|
|
|
|
## Geant4 installation
|
|
|
|
|
|
First install _cmake_ :
|
|
|
First install _cmake_ (type the following command in Terminal window):
|
|
|
|
|
|
`brew install cmake`
|
|
|
|
|
|
In Terminal window type the command:
|
|
|
Then type:
|
|
|
|
|
|
`brew install geant4`
|
|
|
|
|
|
This will install _geant4_ 10.6.2 with all dependancies: expat , qt , xerces-c
|
|
|
This will install _geant4_ 10.6.2 with all dependencies: expat , qt , xerces-c
|
|
|
|
|
|
The giant4 install into /usr/local/Cellar/geant4/10.6.2 by default and
|
|
|
links into /usr/local/{bin, include, lib, share} was made
|
|
|
Geant4 is by default installed in /usr/local/Cellar/geant4/10.6.2 with
|
|
|
links in /usr/local/{bin, include, lib, share}.
|
|
|
|
|
|
Geant4 installed with MacOS native Qt interface , no X11 required.
|
|
|
Geant4 is installed with MacOS native Qt interface, X11 is not required.
|
|
|
|
|
|
## Installation of Root application ##
|
|
|
## ROOT Installation ##
|
|
|
|
|
|
The root installation was requaired for some exercise in this tutorial.
|
|
|
The ROOT installation is required for some exercises in this tutorial.
|
|
|
|
|
|
The command: `brew install root` will install _root_ 6.22.02.
|
|
|
|
|
|
Homebrew install root in _relocatable_ mode,
|
|
|
before use root you must setup root environment sourcing this root.sh from
|
|
|
root installation directory:
|
|
|
Homebrew installs ROOT in _relocatable_ mode.
|
|
|
To use ROOT, you must set its environment sourcing the *thisroot.sh* script from
|
|
|
the ROOT installation directory:
|
|
|
|
|
|
`source /usr/local/bin/thisroot.sh`
|
|
|
|
|
|
Visit http://root.cern.ch for more information about Root.
|
|
|
Visit http://root.cern.ch for more information about ROOT.
|
|
|
|
|
|
## Setup développement environment for tutorial
|
|
|
## Environment
|
|
|
|
|
|
In order to use Geant4 you need define variables pointed to Geant4 datasets locations.
|
|
|
This can be done by sourcing geant4.sh script. For homebrew installation the 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 the Homebrew installation this command is:
|
|
|
|
|
|
`source /usr/local/bin/geant4.sh`
|
|
|
|
|
|
In git repository you can found bash script *setup_env.sh* with allow setup root and geant4.
|
|
|
In the git repository you can find the bash script *setup_env.sh* with setup both for ROOT and Geant4.
|
|
|
|
|
|
The code snippet hire:
|
|
|
See below the code snippet:
|
|
|
|
|
|
```
|
|
|
>>>>>
|
|
|
|
|
|
# Root 6
|
|
|
# ROOT 6
|
|
|
if [ -x /usr/local/bin/thisroot.sh ]; then
|
|
|
. /usr/local/bin/thisroot.sh
|
|
|
fi
|
... | ... | @@ -84,56 +84,30 @@ fi |
|
|
>>>>>
|
|
|
```
|
|
|
|
|
|
You can source this script before start to work with geant4 project or
|
|
|
put the line to .bash_profile to setup environment automatically on each login.
|
|
|
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`
|
|
|
|
|
|
### 3. Start Root and type `.demo`
|
|
|
|
|
|
```
|
|
|
$ root
|
|
|
------------------------------------------------------------------
|
|
|
| Welcome to ROOT 6.22/02 https://root.cern |
|
|
|
| (c) 1995-2020, The ROOT Team; conception: R. Brun, F. Rademakers |
|
|
|
| Built for macosx64 on Aug 17 2020, 12:46:52 |
|
|
|
| From tags/v6-22-02@v6-22-02 |
|
|
|
| Try '.help', '.demo', '.license', '.credits', '.quit'/'.q' |
|
|
|
------------------------------------------------------------------
|
|
|
|
|
|
root [0] .demo
|
|
|
|
|
|
You will see root demo bar and can run some demos clicking on demo menu.
|
|
|
You need go from up to down in menu , some dome depend from previous demo results.
|
|
|
|
|
|
To quit root type .q on root prompt
|
|
|
|
|
|
root [1] .q
|
|
|
|
|
|
Taking a break from ROOT? Hope to see you back!
|
|
|
|
|
|
$
|
|
|
```
|
|
|
### 3. Test Geant4 installation
|
|
|
|
|
|
### 4. Test Geant4 installation
|
|
|
You can try to compile and run one of the Geant4 examples.
|
|
|
|
|
|
You can try to compile and run one of geant4 examples.
|
|
|
|
|
|
E.g. basic B5 example:
|
|
|
E.g. basic B1 example:
|
|
|
|
|
|
```
|
|
|
$ cd ~/tmp
|
|
|
$ mkdir B5-build
|
|
|
$ cd B5-build
|
|
|
$ cmake /usr/local/share/Geant4-10.6.2/examples/basic/B5/
|
|
|
$ mkdir B1-build
|
|
|
$ cd B1-build
|
|
|
$ cmake /usr/local/share/Geant4-10.6.2/examples/basic/B1/
|
|
|
```
|
|
|
|
|
|
You must see something like this and not see a configuration errors
|
|
|
You should see something like the output below. Watch for eventual configuration errors.
|
|
|
|
|
|
```
|
|
|
-- The C compiler identification is AppleClang 12.0.0.12000032
|
... | ... | @@ -153,60 +127,69 @@ You must see something like this and not see a configuration errors |
|
|
-- 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/B5-build
|
|
|
-- Build files have been written to: /Users/semenjuk/tmp/B1-build
|
|
|
```
|
|
|
Now you can build application wihh `make -j4` where -j4 the number of parallel make processes.
|
|
|
Now you can build the application with `make -j4` where -j4 is the number of parallel make processes.
|
|
|
|
|
|
```
|
|
|
$ make
|
|
|
Scanning dependencies of target exampleB5
|
|
|
[ 5%] Building CXX object CMakeFiles/exampleB5.dir/exampleB5.cc.o
|
|
|
[ 11%] Building CXX object CMakeFiles/exampleB5.dir/src/B5ActionInitialization.cc.o
|
|
|
[ 17%] Building CXX object CMakeFiles/exampleB5.dir/src/B5CellParameterisation.cc.o
|
|
|
[ 23%] Building CXX object CMakeFiles/exampleB5.dir/src/B5DetectorConstruction.cc.o
|
|
|
[ 29%] Building CXX object CMakeFiles/exampleB5.dir/src/B5DriftChamberHit.cc.o
|
|
|
[ 35%] Building CXX object CMakeFiles/exampleB5.dir/src/B5DriftChamberSD.cc.o
|
|
|
[ 41%] Building CXX object CMakeFiles/exampleB5.dir/src/B5EmCalorimeterHit.cc.o
|
|
|
[ 47%] Building CXX object CMakeFiles/exampleB5.dir/src/B5EmCalorimeterSD.cc.o
|
|
|
[ 52%] Building CXX object CMakeFiles/exampleB5.dir/src/B5EventAction.cc.o
|
|
|
[ 58%] Building CXX object CMakeFiles/exampleB5.dir/src/B5HadCalorimeterHit.cc.o
|
|
|
[ 64%] Building CXX object CMakeFiles/exampleB5.dir/src/B5HadCalorimeterSD.cc.o
|
|
|
[ 70%] Building CXX object CMakeFiles/exampleB5.dir/src/B5HodoscopeHit.cc.o
|
|
|
[ 76%] Building CXX object CMakeFiles/exampleB5.dir/src/B5HodoscopeSD.cc.o
|
|
|
[ 82%] Building CXX object CMakeFiles/exampleB5.dir/src/B5MagneticField.cc.o
|
|
|
[ 88%] Building CXX object CMakeFiles/exampleB5.dir/src/B5PrimaryGeneratorAction.cc.o
|
|
|
[ 94%] Building CXX object CMakeFiles/exampleB5.dir/src/B5RunAction.cc.o
|
|
|
[100%] Linking CXX executable exampleB5
|
|
|
[100%] Built target exampleB5
|
|
|
Scanning dependencies of target exampleB1
|
|
|
[ 12%] Building CXX object CMakeFiles/exampleB1.dir/exampleB1.cc.o
|
|
|
[ 25%] Building CXX object CMakeFiles/exampleB1.dir/src/B1ActionInitialization.cc.o
|
|
|
[ 37%] Building CXX object CMakeFiles/exampleB1.dir/src/B1DetectorConstruction.cc.o
|
|
|
[ 50%] Building CXX object CMakeFiles/exampleB1.dir/src/B1EventAction.cc.o
|
|
|
[ 62%] Building CXX object CMakeFiles/exampleB1.dir/src/B1PrimaryGeneratorAction.cc.o
|
|
|
[ 75%] Building CXX object CMakeFiles/exampleB1.dir/src/B1RunAction.cc.o
|
|
|
[ 87%] Building CXX object CMakeFiles/exampleB1.dir/src/B1SteppingAction.cc.o
|
|
|
[100%] Linking CXX executable exampleB1
|
|
|
[100%] Built target exampleB1
|
|
|
|
|
|
The compilation finished successfully
|
|
|
```
|
|
|
|
|
|
Run executable without parameters.
|
|
|
This will open interactive QTGUI window.
|
|
|
Now you can run the example executable:
|
|
|
```
|
|
|
./exampleB1
|
|
|
```
|
|
|
|
|
|
This will open an interactive QT GUI window.
|
|
|
To generate N events type in the Session window:
|
|
|
```
|
|
|
/run/beamOn N
|
|
|
```
|
|
|
|
|
|
You can generate N events typing filed
|
|
|
Session : `/run/beamOn N`
|
|
|
Or use command `exit` to quit application
|
|
|
To quit application type:
|
|
|
```
|
|
|
exit
|
|
|
```
|
|
|
|
|
|
See below the expected program output in the terminal.
|
|
|
*You should not see a crash dump!*
|
|
|
|
|
|
Below terminal output:
|
|
|
```
|
|
|
$ ./exampleB5
|
|
|
[MacBook-Pro-5] ~/tmp/B1-build > ./exampleB1
|
|
|
Available UI session types: [ Qt, GAG, tcsh, csh ]
|
|
|
G4WT0 > Using Root
|
|
|
G4WT1 > Using Root
|
|
|
G4WT0 > /control/saveHistory
|
|
|
G4WT1 > /control/saveHistory
|
|
|
G4WT1 > /run/verbose 2
|
|
|
G4WT0 > /control/saveHistory
|
|
|
G4WT0 > /run/verbose 2
|
|
|
G4WT1 > /run/initialize
|
|
|
G4WT1 > /run/verbose 2
|
|
|
G4WT0 > /run/initialize
|
|
|
G4WT1 > /run/physicsModified
|
|
|
G4WT1 > /run/initialize
|
|
|
G4WT0 > /run/physicsModified
|
|
|
...
|
|
|
<snip>
|
|
|
...
|
|
|
G4WT1 > /run/physicsModified
|
|
|
Graphics systems deleted.
|
|
|
Visualization Manager deleting...
|
|
|
G4WT1 > /tracking/storeTrajectory 2
|
|
|
G4WT0 > /tracking/storeTrajectory 2
|
|
|
G4WT0 > Destroying WorkerRunManager (0x7f9e17f67230)
|
|
|
G4WT0 > G4 kernel has come to Quit state.
|
|
|
G4WT0 > UserRunAction deleted.
|
|
|
G4WT0 > UserPrimaryGenerator deleted.
|
|
|
G4WT0 > RunManager is deleting RunManagerKernel.
|
|
|
G4WT0 > EventManager deleted.
|
|
|
G4WT0 > Units table cleared.
|
|
|
G4WT0 > TransportationManager deleted.
|
|
|
G4WT0 > Total navigation history collections cleaned: 3
|
|
|
G4WT0 > ================== Deleting memory pools ===================
|
|
|
G4WT0 > Pool ID '20G4NavigationLevelRep', size : 0.00288 MB
|
|
|
G4WT0 > Pool ID '24G4ReferenceCountedHandleIvE', size : 0.000961 MB
|
... | ... | @@ -218,6 +201,26 @@ G4WT0 > ============================================================ |
|
|
G4WT0 > G4Allocator objects are deleted.
|
|
|
G4WT0 > Thread-local UImanager is to be deleted.
|
|
|
G4WT0 > There should not be any thread-local G4cout/G4cerr hereafter.
|
|
|
G4WT1 > Destroying WorkerRunManager (0x7f9e1c072610)
|
|
|
G4WT1 > G4 kernel has come to Quit state.
|
|
|
G4WT1 > UserRunAction deleted.
|
|
|
G4WT1 > UserPrimaryGenerator deleted.
|
|
|
G4WT1 > RunManager is deleting RunManagerKernel.
|
|
|
G4WT1 > EventManager deleted.
|
|
|
G4WT1 > Units table cleared.
|
|
|
G4WT1 > TransportationManager deleted.
|
|
|
G4WT1 > Total navigation history collections cleaned: 3
|
|
|
G4WT1 > ================== Deleting memory pools ===================
|
|
|
G4WT1 > Pool ID '20G4NavigationLevelRep', size : 0.00288 MB
|
|
|
G4WT1 > Pool ID '24G4ReferenceCountedHandleIvE', size : 0.000961 MB
|
|
|
G4WT1 > Pool ID '7G4Event', size : 0.000961 MB
|
|
|
G4WT1 > Pool ID '15G4CountedObjectIvE', size : 0.000961 MB
|
|
|
G4WT1 > Number of memory pools allocated: 4; of which, static: 0
|
|
|
G4WT1 > Dynamic pools deleted: 4 / Total memory freed: 0.0058 MB
|
|
|
G4WT1 > ============================================================
|
|
|
G4WT1 > G4Allocator objects are deleted.
|
|
|
G4WT1 > Thread-local UImanager is to be deleted.
|
|
|
G4WT1 > There should not be any thread-local G4cout/G4cerr hereafter.
|
|
|
G4 kernel has come to Quit state.
|
|
|
UserDetectorConstruction deleted.
|
|
|
UserPhysicsList deleted.
|
... | ... | @@ -225,7 +228,6 @@ UserActionInitialization deleted. |
|
|
UserWorkerThreadInitialization deleted.
|
|
|
UserRunAction deleted.
|
|
|
RunManager is deleting RunManagerKernel.
|
|
|
G4SDManager deleted.
|
|
|
EventManager deleted.
|
|
|
Units table cleared.
|
|
|
TransportationManager deleted.
|
... | ... | @@ -242,29 +244,59 @@ UImanager deleted. |
|
|
StateManager deleted.
|
|
|
RunManagerKernel is deleted. Good bye :)
|
|
|
```
|
|
|
**You must not see and crash dump !**
|
|
|
|
|
|
### 4. Test ROOT Installation
|
|
|
|
|
|
Start the ROOT interactive session:
|
|
|
|
|
|
```
|
|
|
$ root
|
|
|
------------------------------------------------------------------
|
|
|
| Welcome to ROOT 6.22/02 https://root.cern |
|
|
|
| (c) 1995-2020, The ROOT Team; conception: R. Brun, F. Rademakers |
|
|
|
| Built for macosx64 on Aug 17 2020, 12:46:52 |
|
|
|
| From tags/v6-22-02@v6-22-02 |
|
|
|
| Try '.help', '.demo', '.license', '.credits', '.quit'/'.q' |
|
|
|
------------------------------------------------------------------
|
|
|
```
|
|
|
|
|
|
and type `.demo` after the ROOT prompt:
|
|
|
```
|
|
|
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.
|
|
|
|
|
|
To quit ROOT type .q on the ROOT prompt
|
|
|
```
|
|
|
root [1] .q
|
|
|
|
|
|
Taking a break from ROOT? Hope to see you back!
|
|
|
|
|
|
$
|
|
|
```
|
|
|
|
|
|
## 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 installations using command:
|
|
|
- Geant4
|
|
|
- You can check the Geant4 datasets installation using the command:
|
|
|
`geant4-config --check-datasets`
|
|
|
- `geant4-config --help` also show geant4 features ( configuration options )
|
|
|
|
|
|
Visit geant4 installation Gide for info:
|
|
|
Visit the Geant4 Installation Guide for info:
|
|
|
http://geant4-userdoc.web.cern.ch/geant4-userdoc/UsersGuides/InstallationGuide/html/
|
|
|
|
|
|
- zsh
|
|
|
- if you use zsh you need use .zprofile on place of .bash_profile
|
|
|
- use *source* not a *.* to source setup scripts
|
|
|
- If you use zsh you need use .zprofile instead of .bash_profile
|
|
|
- Use *source* not a *.* to source the setup scripts
|
|
|
|
|
|
- bash
|
|
|
- zsh default waring
|
|
|
To suppress waring massage put following line into .bash_profile
|
|
|
To suppress a warning massage put following line into .bash_profile:
|
|
|
`export BASH_SILENCE_DEPRECATION_WARNING=1`
|
|
|
|
|
|
|
... | ... | |