Download - Lab setup of software: Geant4 José A. Ramos Méndez, PhD. University of California San Francisco
![Page 1: Lab setup of software: Geant4 José A. Ramos Méndez, PhD. University of California San Francisco](https://reader036.vdocuments.mx/reader036/viewer/2022081504/5697c0061a28abf838cc5859/html5/thumbnails/1.jpg)
Lab setup of software: Geant4
José A. Ramos Méndez, PhD.
University of California San Francisco
![Page 2: Lab setup of software: Geant4 José A. Ramos Méndez, PhD. University of California San Francisco](https://reader036.vdocuments.mx/reader036/viewer/2022081504/5697c0061a28abf838cc5859/html5/thumbnails/2.jpg)
Requirements• The requirements vary from one OS system to others. But essentially one needs (either main package and developer libraries):– C++ and GLIBC– CMAKE– OpenGL– X11 libraries– EXPAT
2
• Debian-based– apt-get install expat-dev
• RedHat-based– yum install expat-devel
• OSX– port install expat
![Page 3: Lab setup of software: Geant4 José A. Ramos Méndez, PhD. University of California San Francisco](https://reader036.vdocuments.mx/reader036/viewer/2022081504/5697c0061a28abf838cc5859/html5/thumbnails/3.jpg)
3
geant4.web.cern.ch
![Page 4: Lab setup of software: Geant4 José A. Ramos Méndez, PhD. University of California San Francisco](https://reader036.vdocuments.mx/reader036/viewer/2022081504/5697c0061a28abf838cc5859/html5/thumbnails/4.jpg)
Installation• Create a directory named Geant4 in your home directory.• Uncompress Geant4 and the DATA files downloaded from the
webpage• Create the directories: Geant4/geant4-build and
Geant4/geant4-install• Inside Geant4/geant4-build do the follow: cmake ../geant4.xxx.xxx -DGEANT4_BUILD_MULTITHREADED=ON -DGEANT4_USE_OPENGL_X11=ON -DGEANT4_USE_RAYTRACER_X11=ON -DEXPAT_LIBRARY=/usr/lib/libexpat.so -DGEANT4_INSTALL_DATA=OFF-DCMAKE_INSTALL_PREFIX=../geant4-install• Then: make -jN where N is the number of CPUs in your PC• Finally make install
4
![Page 5: Lab setup of software: Geant4 José A. Ramos Méndez, PhD. University of California San Francisco](https://reader036.vdocuments.mx/reader036/viewer/2022081504/5697c0061a28abf838cc5859/html5/thumbnails/5.jpg)
Installation
• Setup the environment variables:• For example if your Geant4 is at your
$HOME/Geant4, then
export GEANT4=$HOME/Geant4export Geant4_DIR=$GEANT4/geant4-installexport G4LEDATA=$GEANT4/G4EMLOW6.41export G4NEUTRONHPDATA=$GEANT4/G4NDL4.5export G4SAIDXSDATA=$GEANT4/G4SAIDDATA1.1export G4NEUTRONXSDATA=$GEANT4/G4NEUTRONXS1.4export G4LEVELGAMMADATA=$GEANT4/PhotonEvaporation3.1export G4RADIOACTIVEDATA=$GEANT4/RadioactiveDecay4.2
• Add those lines to ~/.bashrc; ~/.bash_profile
5
![Page 6: Lab setup of software: Geant4 José A. Ramos Méndez, PhD. University of California San Francisco](https://reader036.vdocuments.mx/reader036/viewer/2022081504/5697c0061a28abf838cc5859/html5/thumbnails/6.jpg)
Running• user@user$ cd $GEANT4/geant4.xxx.xxx
• user@user$ cd examples/basic/B1• user@user$ mkdir build• user@user$ cd build• user@user$ cmake ../• user@user$ make -jN• user@user$ ./exampleB1 run1.mac• user@user$ ./exampleB1
6
![Page 7: Lab setup of software: Geant4 José A. Ramos Méndez, PhD. University of California San Francisco](https://reader036.vdocuments.mx/reader036/viewer/2022081504/5697c0061a28abf838cc5859/html5/thumbnails/7.jpg)
The command line and parallelism
7
![Page 8: Lab setup of software: Geant4 José A. Ramos Méndez, PhD. University of California San Francisco](https://reader036.vdocuments.mx/reader036/viewer/2022081504/5697c0061a28abf838cc5859/html5/thumbnails/8.jpg)
Running
• Let’s start with the example Geant4/basic/B1
• user@user:$ ./exampleB1• Idle> /run/beamOn 10
8
• Like-Unix commands. Do not use in a macro.• cd, pwd - jump to a command directory and shows the path, respectively• ls - all available commands• history - used commands• ?UICommand - shows the parameter of command UICommand• help UICommand - Provide detailed help, navigate it through keyboard• exit - Finalize simulation
![Page 9: Lab setup of software: Geant4 José A. Ramos Méndez, PhD. University of California San Francisco](https://reader036.vdocuments.mx/reader036/viewer/2022081504/5697c0061a28abf838cc5859/html5/thumbnails/9.jpg)
• In exampleB1.cc addG4cout << “##### “ << G4Threading::GetNumberOfCores()
<< “ ####” << G4endl;
• rebuild and execute. Then you can set
/run/numberOfThreads 4
Or runManger->SetNumberOfThreads( G4Threading::GetNumberOfCores() );
9
Multithreading
![Page 10: Lab setup of software: Geant4 José A. Ramos Méndez, PhD. University of California San Francisco](https://reader036.vdocuments.mx/reader036/viewer/2022081504/5697c0061a28abf838cc5859/html5/thumbnails/10.jpg)
Cluster
• Let’s play with the random generation seed.
• In exampleB1.cc G4int myseed = G4UIcommand::ConvertToInt(argv[2]); G4Random::setTheSeed(mySeed);
• Rebuild and execute for different seeds
./exampleB1 run1.mac 2324
• Everyone pick a ID number, we will use in each simulation.
10