Software/Geant4/Tutorials/PBTCVMFS/B1 Basic Example

From PBTWiki
Jump to navigation Jump to search

B1 Basic Example

This example demonstrates a very simple application where an energy deposit is accounted in user actions and their associated objects and a dose in a selected volume is calculated (from https://github.com/alisw/geant4/tree/master/examples/basic/B1).

Running the Tutorial

All the source files for the tutorial can be found in https://github.com/alisw/geant4/tree/master/examples/basic/B1.


Create folder ProtonPBFolder

ssh -X username@plus1.hep.ucl.ac.uk 

username@plus1.hep.ucl.ac.uk's password: type your password here
 
[username@plus1 ~]$ mkdir B1Folder 

[username@plus1 ~]$ cd B1Folder  

Setup Your Environment

[username@plus1 B1Folder]$ source /unix/pbt/software/scripts/pbt.sh

Copy the Code to Your Working Directory and Rename It

[username@plus1 B1Folder]$ cp -rv /cvmfs/geant4.cern.ch/geant4/11.2/share/examples/basic/B1 .
  
[username@plus1 B1Folder]$ mv B1 B1_source

Create the Build Directory

[username@plus1 B1Folder]$ mkdir B1_build  

Compile the Code with Make and Cmake

[username@plus1 B1Folder]$ cd B1_build 

[username@plus1 B1_build]$ cmake -DCMAKE_CXX_STANDARD=17 -DCMAKE_BUILD_TYPE=Release -DGEANT4_USE_QT=ON -DGeant4_DIR=/cvmfs/geant4.cern.ch/geant4/11.2/x86_64-centos7-gcc10-optdeb-MT /home/username/B1Folder/B1_source 

[username@plus1 B1_build]$ make  

Run Macro run1.mac

[username@plus1 B1_build]$ ./exampleB1 run1.mac

If run is completed successful, output will show:

G4Allocator objects are deleted.
UImanager deleted.
StateManager deleted.
RunManagerKernel is deleted. Good bye :)
RunManager is deleted.

Run Macro run2.mac

[username@plus1 B1_build]$ ./exampleB1 run2.mac