Notes from Sean on Building HDGeant4

  • The hdgeant4 makefile automagically patches the geant4 libraries it needs, so no worries there,
  • By default the single-threaded build seems to work fine.
  • To get multithreading to work, I needed to
    • un-comment the following line in GNUmakefile
      • CPPFLAGS += -DG4MULTITHREADED
    • rename src/g4py.cc so it didn’t have a .cc extension and didn’t get compiled. This is better handled in the makefile, but I didn’t have time to untangle it all when I was doing these tests
    • run “make hdds cobrems fixes exe lib bin”, which is everything but the g4py option.
Advertisements

David’s Geant4 Build Instructions


gluon48:marki:geant4> cat README.geant4.10.02.p02fixed

Sep 8, 2016

NOTE: The source file G4GDMLReadStructure.cc was modified to fix a
bug reported to GEANT4 bugzilla (# 1842) but not yet fixed in distributed
source. Link to bug report is here:

http://bugzilla-geant4.kek.jp/show_bug.cgi?id=1842
The modified source was re-tarred as geant4.10.02.p02fixed.tar.gz
Here is how I built Geant4 10.02.p02fixed on Linux RHEL6 x86_64
(ifarm1401)
0.) Make sure gcc4.9.2 and cmake 3.5.1 are in your PATH. gcc was
already set up via sim-recon, but I had to add cmake explicitly:

> setenv PATH /apps/cmake/cmake-3.5.1/bin:$PATH
1.) Unpack the source and create a build directory next to it as
suggested by the build instructions.

> tar xzf geant4.10.02.p02fixed.tar.gz
> mkdir geant4.10.02.p02fixed-build.$BMS_OSNAME
> cd geant4.10.02.p02fixed-build.$BMS_OSNAME
2.) Run cmake with appropriate flags to turn on GDML, OpenGL, and
raytracer. The GDML is so it can read geometry converted from
HDDS to GDML using the ROOT TGeoManager->Export() utility.
Note that GDML requires xerces and that it be given explicitly.

> cmake -DCMAKE_INSTALL_PREFIX=/group/halld/Software/ExternalPackages/GEANT4/geant4.10.02.p02fixed.$BMS_OSNAME \
-DGEANT4_USE_GDML=ON \
-DXERCESC_ROOT_DIR=$XERCESCROOT \
-DGEANT4_USE_OPENGL_X11=ON \
-DGEANT4_USE_RAYTRACER_X11=ON \
-DGEANT4_BUILD_MULTITHREADED=ON \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
../geant4.10.02.p02fixed

3.) Run make (multi-threaded) followed by make install

> nice make -j32
> make install

4.) Make sure the "data" directory containing all of the physics
process data files exists parallel to the installation directory.
The directory: geant4.10.02.p02fixed.$BMS_OSNAME/share/Geant4-10.2.2
will automatically be created. The data link, however, must be
created by hand:

> cd geant4.10.02.p02fixed.Linux_CentOS6-x86_64-gcc4.4.7/share/Geant4-10.2.2
> ln -s ../../../data
5.) Set up your environment to use this.

setenv G4 /group/halld/Software/ExternalPackages/GEANT4/geant4.10.02.p02fixed.$BMS_OSNAME
source $G4/bin/geant4.csh
source $G4/share/Geant4-10.2.2/geant4make/geant4make.csh
For older details, see:
https://halldweb1.jlab.org/wiki/index.php/HOWTO_build_and_install_GEANT4.10.00_on_OS_X