###################################################################
#                                                                 #
#  g4setup.env - Geant4 environment setup file                    #
#                                                                 #
#  Author: Dennis Wright (SLAC)                                   #
#  Date:   21 May 2010                                            #
#                                                                 #
###################################################################
#
export G4BASE_DIR=/afs/slac/package/geant4
#
# Define the architecture and set the platform:
# rhel4-32, rhel4-64, rhel5-32 or rhel5-64
#
export G4SYSTEM
if [ "$OSTYPE" == "linux-gnu" ]
then

  export G4SYSTEM="Linux-g++"
  proc=`uname -p`
  rhel=`uname -r | cut -c 5-6`

  if [ "$proc" == "athlon" ]
  then
    if [ "$rhel" == "18" ]
    then
      platform="rhel5-32"
    else
      platform="rhel4-32"
    fi
  elif [ "$proc" == "x86_64" ] 
  then
    if [ "$rhel" == "18" ]
    then
      platform="rhel5-64"
    else
      platform="rhel4-64"
    fi
  else
    platform=none
  fi
#
# Link to Geant4 and CLHEP
#
  echo Setting links to $platform libraries of Geant4 and CLHEP

  if [ "$platform" == "rhel4-32" ] 
  then
    source $G4BASE_DIR/9.3.p01/env-rhel4-32.sh
  elif [ "$platform" == "rhel4-64" ] 
  then
    source $G4BASE_DIR/9.3.p01/env-rhel4-64.sh
  elif [ "$platform" == "rhel5-32" ] 
  then
    source $G4BASE_DIR/9.3.p01/env-rhel5-32.sh
  elif [ "$platform" == "rhel5-64" ] 
  then
    source $G4BASE_DIR/9.3.p01/env-rhel5-64.sh
  else
    echo Unknown platform
  fi
else
  echo No architecture for this system
fi

#
# Set compiler to optimize
#
export G4OPTIMIZE=1
