TF GEANT4.11: Difference between revisions

From New IAC Wiki
Jump to navigation Jump to search
Foretony (talk | contribs)
Foretony (talk | contribs)
 
(24 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Simulations_of_Particle_Interactions_with_Matter]]


==resources==
== System requirements==
 
===Installing on Ubuntu 24===
 
 
sudo apt-get install build-essential
 
install OpenGL
 
sudo apt install libglu1-mesa-dev
 
sudo apt install libglut-dev
 
sudo apt install libxpm-dev
 
sudo apt install libxmu-dev


https://geant4-userdoc.web.cern.ch/UsersGuides/InstallationGuide/html/installguide.html#buildandinstall
sudo apt search libexpat1-dev


==Step -by- Step commands==
maybe 


mkdir geant4.10.2
sudo apt install libcurl4-openssl-dev


cd geant4.10.2


using wget to get version 4.10.2
sudo apt-get install libmotif-dev


wget http://geant4.cern.ch/support/source/geant4.10.02.p02.tar.gz
==resources==


tar -zxvf geant4.10.02.p02.tar.gz
https://geant4-userdoc.web.cern.ch/UsersGuides/InstallationGuide/html/installguide.html#buildandinstall
 
==Step -by- Step commands==


mkdir geant4.11


mkdir geant4.10.02-build
cd geant4.11


cd geant4.10.02-build
using git to get version 4.11.2


You need data file for the physics interaction processes
git clone https://github.com/Geant4/geant4.git


If the server is up you can tell CMake to download them for you
cd geant4


cmake -DCMAKE_INSTALL_PREFIX=~/src/GEANT4/geant4.10.2/geant4.10.2-install -DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_OPENGL_X11=ON ~/src/GEANT4/geant4.10.2/geant4.10.02.p02
git checkout v11.2.2


cd ..


mkdir build


cd build


(the data files will be installed at geant4.9.6.p02-install/share/Geant4.9.6.p02/data)
cmake -DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_OPENGL_X11:BOOL=ON -DCMAKE_INSTALL_PREFIX=~/src/GEANT4/geant4.11/install ~/src/GEANT4/geant4.11/geant4


If the server is down then you need to download, install and set environmental variables by hand
make -j8


cmake -DCMAKE_INSTALL_PREFIX=~/src/GEANT4/geant4.10.2/geant4.10.2-install -DGEANT4_INSTALL_DATA=OFF -DGEANT4_USE_OPENGL_X11=ON ~/src/GEANT4/geant4.10.2/geant4.10.02.p02
make install


cd ../geant4-install/


make -j2 VERBOSE=1


make install
source bin/geant4.sh


the above creates the subdirectory
~/src/GEANT4/geant10.2/geant4.10.2-install




Line 49: Line 68:
You can test your installation by compiling and running the example programs
You can test your installation by compiling and running the example programs


first try to compile example/novice/N01 located in the directory where you untarred everything (geant4.9.6.p02)
first try to compile example/basic/B2 located in the directory where you build everything


source geant4.10.2-install/bin/geant4.csh  
source geant4-install/bin/geant4.csh  


cd geant4.10.02.p02/examples/novice/N01
cd geant4/examples/basic/B2/B2a


cmake .
cmake .
Line 59: Line 78:
make -f Makefile
make -f Makefile


./exampleN01
./exampleB2a
 


exampleN02 will allow you to test that you have installed the visual drivers needed to draw paraticle trajectories


===creating a copy of an example===
===creating a copy of an example===
Line 67: Line 86:
cd
cd


mkdir geant4
mkdir HW
 
cd geant4


cp -r geant4.10.02.p02/examples/novice/N02 ./
cd HW


cd N02
cp -r geant4.10.02.p02/examples/basic/B2/B2a/* ./


rm CMakeCache.txt
rm CMakeCache.txt
Line 81: Line 98:
make -f Makefile
make -f Makefile


=== problems===
./exampleB2a
 
1.) bus error on Mac if using -DGEANT4_USE_OPENGL_X11=ON
 
try using XM instead
 
cmake -DCMAKE_INSTALL_PREFIX=~/src/GEANT4/geant4.10.2/geant4.10.02-install -DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_XM=ON ~/src/GEANT4/geant4.10.2/geant4.10.02.p02
 
opens up the GUI but also has a Bus error.


==Commands used for version 4.9.5==
==Commands used for version 4.9.5==
Line 122: Line 131:
make
make


[[Simulations_of_Particle_Interactions_with_Matter#Building_GEANT4.11]]
 
==TSG==
 
TOOLSSG_OFFSCREEN (TSG_OFFSCREEN, TSG_FILE, TSG)
Default graphics system is: TSG_OFFSCREEN (based on build flags).
Default window size hint is: 600x600-0+0 (based on G4VisManager initialisation).
Note: Parameters specified on the command line will override these defaults.
      Use "vis/open" without parameters to get these defaults.
 
==ROOT install==
 
cmake command to build standalone ROOT without python xrootd and ssl
 
cmake -DCMAKE_INSTALL_PREFIX=../root_install -Dbuiltin_openssl=OFF -Dpython=OFF -Dbuiltin_xrootd=OFF -Dxrootd=OFF ../root_src^C
 
 
 
[[Simulations_of_Particle_Interactions_with_Matter]]

Latest revision as of 05:12, 2 April 2025

Simulations_of_Particle_Interactions_with_Matter

System requirements

Installing on Ubuntu 24

sudo apt-get install build-essential

install OpenGL

sudo apt install libglu1-mesa-dev
sudo apt install libglut-dev
sudo apt install libxpm-dev
sudo apt install libxmu-dev

sudo apt search libexpat1-dev

maybe

sudo apt install libcurl4-openssl-dev


sudo apt-get install libmotif-dev

resources

https://geant4-userdoc.web.cern.ch/UsersGuides/InstallationGuide/html/installguide.html#buildandinstall

Step -by- Step commands

mkdir geant4.11
cd geant4.11

using git to get version 4.11.2

git clone https://github.com/Geant4/geant4.git
cd geant4
git checkout v11.2.2
cd ..
mkdir build
cd build
cmake -DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_OPENGL_X11:BOOL=ON -DCMAKE_INSTALL_PREFIX=~/src/GEANT4/geant4.11/install ~/src/GEANT4/geant4.11/geant4
make -j8
make install
cd ../geant4-install/


source bin/geant4.sh


examples

You can test your installation by compiling and running the example programs

first try to compile example/basic/B2 located in the directory where you build everything

source geant4-install/bin/geant4.csh

cd geant4/examples/basic/B2/B2a

cmake .

make -f Makefile

./exampleB2a


creating a copy of an example

cd

mkdir HW

cd HW

cp -r geant4.10.02.p02/examples/basic/B2/B2a/* ./

rm CMakeCache.txt

cmake .

make -f Makefile

./exampleB2a

Commands used for version 4.9.5

Download the source code to a subdirectory.

I stored it in /Users/tforest/src/GEANT4/geant4.9.5/geant4.9.5.p01

Then I created a build subdirectory

mkdir /Users/tforest/src/GEANT4/geant4.9.5/geant4.9.5-build

From inside the build directory I execute the cmake command using a switch to download the data files and install visulatization

cmake -DCMAKE_INSTALL_PREFIX=/Users/tforest/src/GEANT4/geant4.9.5/geant4.9.5-install -DGEANT4_USE_OPENGL_X11=ON GEANT4_INSTALL_DATA=ON /Users/tforest/src/GEANT4/geant4.9.5/geant4.9.5.p01

cmake -DCMAKE_INSTALL_PREFIX=/Users/tforest/src/GEANT4/geant4.9.5/geant4.9.5-install -DGEANT4_USE_XM=ON GEANT4_INSTALL_DATA=ON /Users/tforest/src/GEASNT4/geant4.9.5/geant4.9.5.p01


Then I install if teh make was succcessfull

make install


Build example N02

To build an example you need to create a build subdirectory under the subdirectory of teh example source code.


 cmake -DGeant4_DIR=/Users/tforest/src/GEANT4/geant4.9.5/geant4.9.5-install ../

make


TSG

TOOLSSG_OFFSCREEN (TSG_OFFSCREEN, TSG_FILE, TSG)
Default graphics system is: TSG_OFFSCREEN (based on build flags).
Default window size hint is: 600x600-0+0 (based on G4VisManager initialisation).
Note: Parameters specified on the command line will override these defaults.
     Use "vis/open" without parameters to get these defaults.

ROOT install

cmake command to build standalone ROOT without python xrootd and ssl

cmake -DCMAKE_INSTALL_PREFIX=../root_install -Dbuiltin_openssl=OFF -Dpython=OFF -Dbuiltin_xrootd=OFF -Dxrootd=OFF ../root_src^C


Simulations_of_Particle_Interactions_with_Matter