Software/Geant4/Tutorials/PBTCVMFS/B1 Basic Example: Difference between revisions
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
Compile the Code with 
Run Macro 
Run Macro 
		
	
 (Created page with "== 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 ===  <pre> ssh -X...")  | 
				|||
| (13 intermediate revisions by the same user not shown) | |||
| Line 14: | Line 14: | ||
username@plus1.hep.ucl.ac.uk's password: type your password here  | username@plus1.hep.ucl.ac.uk's password: type your password here  | ||
ssh -X username@pc###.hep.ucl.ac.uk (where ### is the number of the PC you want to connect to)  | |||
or   | |||
ssh -X username@pcpool.hep.ucl.ac.uk (are unsure, or don't care, which PC you want to connect to)  | |||
username@pc###.hep.ucl.ac.uk's password: type your password here  | |||
[username@  | |||
[username@pc### ~]$ mkdir B1Folder    | |||
[username@  | [username@pc### ~]$ cd B1Folder     | ||
</pre>  | </pre>  | ||
| Line 23: | Line 32: | ||
<pre>  | <pre>  | ||
[username@  | [username@pc### B1Folder]$ source /unix/pbt/software/scripts/pbt_cvmfs.sh  | ||
</pre>  | </pre>  | ||
| Line 29: | Line 38: | ||
<pre>  | <pre>  | ||
[username@  | [username@pc### B1Folder]$ cp -rv /cvmfs/geant4.cern.ch/geant4/11.2/share/examples/basic/B1 . (include full stop as part of command)  | ||
[username@  | [username@pc### B1Folder]$ mv B1 B1_source  | ||
</pre>  | </pre>  | ||
| Line 37: | Line 46: | ||
<pre>  | <pre>  | ||
[username@  | [username@pc### B1Folder]$ mkdir B1_build     | ||
</pre>  | </pre>  | ||
| Line 43: | Line 52: | ||
<pre>  | <pre>  | ||
[username@  | [username@pc### B1Folder]$ cd B1_build    | ||
[username@  | [username@pc### 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-gcc9-optdeb-MT /home/username/B1Folder/B1_source    | ||
[username@  | [username@pc### B1_build]$ make     | ||
</pre>  | </pre>  | ||
| Line 53: | Line 62: | ||
<pre>  | <pre>  | ||
[username@  | [username@pc### B1_build]$ ./exampleB1 run1.mac  | ||
</pre>  | |||
If run is completed successful, output will show:  | |||
<pre>  | |||
G4Allocator objects are deleted.  | |||
UImanager deleted.  | |||
StateManager deleted.  | |||
RunManagerKernel is deleted. Good bye :)  | |||
RunManager is deleted.  | |||
</pre>  | |||
=== Run Macro <code>run2.mac</code> ===  | |||
<pre>  | |||
[username@pc### B1_build]$ ./exampleB1 run2.mac  | |||
</pre>  | </pre>  | ||
Latest revision as of 13:29, 30 July 2025
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 ssh -X username@pc###.hep.ucl.ac.uk (where ### is the number of the PC you want to connect to) or ssh -X username@pcpool.hep.ucl.ac.uk (are unsure, or don't care, which PC you want to connect to) username@pc###.hep.ucl.ac.uk's password: type your password here [username@pc### ~]$ mkdir B1Folder [username@pc### ~]$ cd B1Folder
Setup Your Environment
[username@pc### B1Folder]$ source /unix/pbt/software/scripts/pbt_cvmfs.sh
Copy the Code to Your Working Directory and Rename It
[username@pc### B1Folder]$ cp -rv /cvmfs/geant4.cern.ch/geant4/11.2/share/examples/basic/B1 . (include full stop as part of command) [username@pc### B1Folder]$ mv B1 B1_source
Create the Build Directory
[username@pc### B1Folder]$ mkdir B1_build
Compile the Code with Make and Cmake
[username@pc### B1Folder]$ cd B1_build [username@pc### 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-gcc9-optdeb-MT /home/username/B1Folder/B1_source [username@pc### B1_build]$ make
Run Macro run1.mac
[username@pc### 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@pc### B1_build]$ ./exampleB1 run2.mac