Software/Geant4/Tutorials/PBTCVMFS/B1 Basic Example: Difference between revisions

From PBTWiki
Jump to navigation Jump to search
(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...")
 
 
(7 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@plus1 ~]$ mkdir B1Folder  
[username@pc### ~]$ mkdir B1Folder  


[username@plus1 ~]$ cd B1Folder   
[username@pc### ~]$ cd B1Folder   
</pre>
</pre>


Line 23: Line 32:


<pre>
<pre>
[username@plus1 B1Folder]$ source /unix/pbt/software/scripts/pbt.sh
[username@pc### B1Folder]$ source /unix/pbt/software/scripts/pbt.sh
</pre>
</pre>


Line 29: Line 38:


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


Line 37: Line 46:


<pre>
<pre>
[username@plus1 B1Folder]$ mkdir B1_build   
[username@pc### B1Folder]$ mkdir B1_build   
</pre>
</pre>


Line 43: Line 52:


<pre>
<pre>
[username@plus1 B1Folder]$ cd B1_build  
[username@pc### 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@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-gcc10-optdeb-MT /home/username/B1Folder/B1_source  


[username@plus1 B1_build]$ make   
[username@pc### B1_build]$ make   
</pre>
</pre>


Line 53: Line 62:


<pre>
<pre>
[username@plus1 B1_build]$ ./exampleB1 run1.mac
[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 14:47, 25 November 2024

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.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 .
  
[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-gcc10-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