Lab setup of software: Geant4 José A. Ramos Méndez, PhD. University of California San Francisco 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 • Debian-based – apt-get install expat-dev • RedHat-based – yum install expat-devel • OSX – port install expat 3 geant4.web.cern.ch 4 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 5 Installation • Setup the environment variables: • For example if your Geant4 is at your $HOME/Geant4, then export export export export export export export export GEANT4=$HOME/Geant4 Geant4_DIR=$GEANT4/geant4-install G4LEDATA=$GEANT4/G4EMLOW6.41 G4NEUTRONHPDATA=$GEANT4/G4NDL4.5 G4SAIDXSDATA=$GEANT4/G4SAIDDATA1.1 G4NEUTRONXSDATA=$GEANT4/G4NEUTRONXS1.4 G4LEVELGAMMADATA=$GEANT4/PhotonEvaporation3.1 G4RADIOACTIVEDATA=$GEANT4/RadioactiveDecay4.2 • Add those lines to ~/.bashrc; ~/.bash_profile 6 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 7 THE COMMAND LINE AND PARALLELISM 8 Running • Let’s start with the example Geant4/basic/B1 • user@user:$ ./exampleB1 • Idle> /run/beamOn 10 • 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 9 Multithreading • In exampleB1.cc add G4cout << “##### “ << G4Threading::GetNumberOfCores() << “ ####” << G4endl; • rebuild and execute. Then you can set /run/numberOfThreads 4 Or runManger->SetNumberOfThreads( G4Threading::GetNumberOfCores() ); 10 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. 11
© Copyright 2026 Paperzz