3 # Author: bjpjones@fnal.gov from echurch@fnal.gov from dbox@fnal.gov
5 # A script to run the optical library building job
10 # jobsub -X509_USER_PROXY /scratch/[user]/grid/[user].uboone.proxy -N [NoOfJobs] -q OpticalLibraryBuild_Grid.sh `whoami` `pwd`
12 # You will get outputs in the area specified by the "outstage" variable
13 # which is specified below.
15 # The form of the output is one file for each few voxels. These then need
16 # stitching together, which is done after all jobs are done, with a
17 # dedicated stitching script.
23 # Copy arguments into meaningful names.
30 # Directory in which to put the output files.
31 outstage=/
uboone/data/users/bjpjones/OpticalProduction
34 # Library building parameters
36 # In each grid job, do this many voxels:
39 # In each voxel, run this many photons:
40 NPhotonsPerVoxel=30000
44 # This works out which voxels this job should focus on:
45 FirstVoxel=`echo
"($NVoxelsPerJob * $PROCESS ) % $NTopVoxel" | bc`
46 LastVoxel=`echo
"(($NVoxelsPerJob * $PROCESS ) + $NVoxelsPerJob - 1 ) % $NTopVoxel" | bc`
49 # And then tell the user about it:
50 echo
"This job will run from voxel $FirstVoxel to $LastVoxel, generating $NPhotonsPerVoxel in each"
53 # Most of what comes next is from echurch's grid submission script.
56 echo
"Input arguments:"
57 echo
"Cluster: " $cluster
58 echo
"Process: " $process
60 echo
"SubmitDir: " $submitdir
63 # Do not change this section.
65 TMP=`mktemp -d ${_CONDOR_SCRATCH_DIR:-/var/tmp}/working_dir.XXXXXXXXXX`
66 TMP=${TMP:-${_CONDOR_SCRATCH_DIR:-/var/tmp}/working_dir.$$}
68 { [[ -
n "$TMP" ]] &&
mkdir -
p "$TMP"; } || \
69 { echo
"ERROR: unable to create temporary directory!" 1>&2;
exit 1; }
70 trap
"[[ -n \"$TMP\" ]] && { cd ; rm -rf \"$TMP\"; }" 0
72 echo
"Temp directory : $TMP"