Build from source

The MEMPHYS package contains the simulation, some analysis programs and some .C ROOT scripts to produce plots from the MEMPHYS.root file produced by the MEMPHYS_sim program.

This package is pretty close in structure than a Geant4 example and can be built with cmake (MEMPHYS_sim only) beside the bush way. The visualization had been displaced in the MEMPHYS_vis package.

The below build instructions work on the file :

     MEMPHYS-<version>.zip

found on the download area, or from a github clone.

 ///////////////////////////////////////////////////////////////////////////////////////////////////////
 /// build by using the default geant4 found under inexlib/ourex: //////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////////////////////////////
  To build :
    UNIX> cd MEMPHYS/mgr
    UNIX> ./build
  ( UNIX> ./build -v  # to see built files.)
  ( UNIX> ./build -x  # for a full trace.)

 (here UNIX is for Linux, macOS, Windows-10/cygwin, Windows-10/WSL)

  If the GNU parallel application is known from your prompt, you can use
 the "-parallel" option so that C and C++ file compilations are distributed
 on your cores. This feature had been tested with success on macOS with a MacPorts
 installation of the GNU parallel program and on centos7 with the GNU distribution.
 This can clearly boosts a lot the build of the ourex/geant4 package.

 You can build a binary zip distribution file with :
    UNIX> ./build_distrib
    
 At end, you should have a binary zip distribution file :
    bin_<config>/distrib/MEMPHYS-<version>-<platform>.zip

 If wanting to run from this build area :
    UNIX> <in setenv_g4data[.sh,.csh] edit the g4data_home variable to point to the geant4 data directories>
    UNIX> cd ../exa_run
    UNIX> ../mgr/<bin_dir>/MEMPHYS_sim  # it produces a MEMPHYS.root file.
    
 ///////////////////////////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////////////////////////////
 To build the MEMPHYS_sim program against an already installed geant4 and by using cmake :
    UNIX> cd <install_path>/MEMPHYS/MEMPHYS/cmake
    UNIX> <read README for instructions to build and run>
 (UNIX here is for Linux, macOS. Not tested or Windows-10/cygwin, Windows-10/WSL).

 ///////////////////////////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////////////////////////////
 To build the MEMPHYS_sim program against an already installed geant4 by using the bush scripts :
    UNIX> cd <install_path/MEMPHYS/MEMPHYS/mgr
      sh> . <geant4_install_dir>/bin/geant4.sh
   ( csh> source <geant4_install_dir>/bin/geant4.csh )
    UNIX> geant4-config  # to test that this program is here.

   Linux> <if needed source setup a gcc_[version].[sh,csh] file to have the correct g++>
   ( csh> source gcc_493.csh # on Lund iridium )
  
    UNIX> ./build -sys_geant4
  ( UNIX> ./build -sys_geant4 -v  # to see built files.)
  ( UNIX> ./build -sys_geant4 -x  # for a full trace.)

 You can build a binary zip distribution file with :
    UNIX> ./build_distrib
    
 At end, you should have a binary zip distribution file :
    bin_<config>/distrib/MEMPHYS-<version>-<platform>.zip

 If wanting to run from this build area :
    UNIX> <in setenv_g4data[.sh,.csh] edit the g4data_home variable to point to the geant4 data directories>
    UNIX> cd ../exa_run
    UNIX> ../mgr/<bin_dir>/MEMPHYS_sim  # it produces a MEMPHYS.root file.
    
 ///////////////////////////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////////////////////////////
 To build (not mendatory) some X11 (or Windows) plotting program using a MEMPHYS.root data file :
    UNIX> ./build_app_read_plot
    
 To build an offscreen plotting program using a MEMPHYS.root data file :
    UNIX> ./build_app_read_plot_offscreen

 If having CERN-ROOT :
    UNIX> <in cern_root_setup[.sh,.csh] edit root_home to point to your CERN-ROOT installation>
      sh> . ./cern_root_setup.sh
   ( csh> source ./cern_root_setup.csh )
    UNIX> ./build_app_read_plot_ROOT  # do some plotting on a MEMPHYS.root data file
                                      # by using CERN-ROOT plotting.
    UNIX> ./build_app_geomt_ROOT      # dump PMTs in a MEMPHYS.root data file, by using CERN-ROOT
                                      # to read the file.

 If these programs are built build_distrib script will include them in the distribution file.

 ///////////////////////////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////////////////////////////

  See the MEMPHYS section on http://gbarrand.github.io for more.