#!/bin/bash
#This is a template script for use in the batch queueing system. Please only edit the user sections.
LOCAL_DIR=${TMPDIR}
################USER SETTINGS###########################
#You can edit the variables here, but something valid must be present.
# SOURCE_DIR defaults to a files subdirectory of the directory you submitted the job from
#Comment out to not import any files for the job. Edit for your specific needs.
SOURCE_DIR=/nfs/acc/user/dlr/development9_linux
#DESTINATION_DIR=/nfs/acc/user/dlr/development9_linux/g-2/mytest/harp/${USER}/${JOB_ID}
#DESTINATION_DIR=/nfs/acc/user/dlr/development9_linux/g-2/mytest/harp/
DESTINATION_DIR=/nfs/acc/user/dlr/development9_linux/g-2/mytest/harp/
########################################################
if [ ! -z "${SOURCE_DIR}" ]; then
   rsync -avz ${SOURCE_DIR}/g-2/mytest/harp/input.dat ${LOCAL_DIR}/test/
   rsync -avz ${SOURCE_DIR}/g-2/mytest/harp/bmad_grid_quads. ${LOCAL_DIR}/test/
fi

#Put your code in the user section below. You can delete the entire
#section between USER SECTION and END USER SECTION - it is a very simple
#example script that does a loop and echos some job data for testing.
#################USER SECTION###########################
cd ${LOCAL_DIR}/test/
ln -s /home/dlr/development9_linux/g-2/files/pulse_127cm.dat
ln -s /home/dlr/development9_linux/g-2/magneticfield/ring_inject_bfield3d_wuzheng_extended.dat 
ln -s /home/dlr/development9_linux/g-2/magneticfield/inf_field_alone.dat 
ln -s /home/dlr/development9_linux/g-2/files/muons/VDstop_DS_436_12000.dat 
ln -s /home/dlr/development9_linux/g-2/files/muons/particles_endm4m5_100.txt
ln -s /home/dlr/development9_linux/g-2/files/KICKER_E989_NoRolledEdges.dat 
ln -s /home/dlr/development9_linux/g-2/files/quads/
ln -s /home/dlr/development9_linux/g-2/files/calorimeter_lattice.
ln -s /home/dlr/development9_linux/g-2/files/fiber_monitor_lattice.
/nfs/acc/user/dlr/development9_linux/production/bin/g2_tracking > ${LOCAL_DIR}/test/${JOB_ID}
#################END USER SECTION#######################
#mkdir -p ${DESTINATION_DIR}
ls ${DESTINATION_DIR}
rsync -avz ${LOCAL_DIR}/test/ ${DESTINATION_DIR}
cp ${DESTINATION_DIR}/${JOB_ID} ${DESTINATION_DIR}/*/.
#rm -rf ${DESTINATION_DIR}/*..digested*


								  