#! /bin/csh -f
#==============================================================
#
#  Abs:  Starts LCLS Image Acquisition Matlab script
#
#  Name: ImageAcq
#
#  Facility:  SLAC
#
#  Auth: 21-Mar-2007, Sergei Chevtsov (chevtsov@slac.stanford.edu):
#
#==============================================================
#
# Check for afs access
#
if (-e ${LCROOT}/tools/script/ENVS.csh) then 
#
# Reset any existing EPICS environment setup
#
  source ${LCROOT}/tools/script/ENVS.csh
#
# Changes to EPICS environment to read Images
#
  setenv EPICS_CA_MAX_ARRAY_BYTES 40000000
#
# Log file on nfs
set user=`whoami`-
set date=`date`
set year=`echo $date | cut -d" " -f6`-
set month=`echo $date | cut -d" " -f2`-
set day=`echo $date | cut -d" " -f3`-
set time=`echo $date | cut -d" " -f4 | cut -c1-5`
set log_file=$MATLABDATAFILES/ImageAcq/log/$user$year$month$day$time.log
#
# set to data directory
pushd $MATLABDATAFILES/ImageAcq/data
#
# Start the Image Acquisition Matlab script
#
  matlab -nosplash -nodesktop -r startLCLS,imgAcq_main -logfile $log_file
else
#
# No afs access
#
  echo Sorry, can't find LCLS environment setup
endif
