File indexing completed on 2025-01-17 09:02:54
0001
0002
0003
0004
0005
0006 echo "Running as ${USER}"
0007
0008 if [ ! -d "/home/${USER}/trq_output" ]; then
0009 echo "/home/${USER}/trq_output directory doesn't exist, making this directory for you..."
0010 mkdir "/home/${USER}/trq_output"
0011 echo "Directory created, check there for output and error logs from your job."
0012 fi
0013
0014 if [[ "$#" -ne 7 && "$#" -ne 8 ]]; then
0015 echo ""
0016 echo "!!! ERROR !!! - Expected 7 or 8 arguments - !!! ERROR !!!"
0017 echo "Expect - NumFiles NumEvents EBeamE HBeamE OutputType InteractionPoint Ejectile RecoilHadron(optional)"
0018 echo "See the Config_EIC.json file or the README for options and try again, exiting"
0019 echo "!!! ERROR !!! - Expected 7 or 8 arguments - !!! ERROR !!!"
0020 echo ""
0021 exit 0
0022 fi
0023
0024
0025 NumFiles=$1
0026 NumEvents=$2
0027 EBeamE=$3
0028 HBeamE=$4
0029 OutputType=$5
0030 InteractionPoint=$6
0031 Ejectile=$7
0032
0033
0034 if [[ $Ejectile == "K+" && -z "$8" ]]; then
0035 echo "!!! WARNING !!! - For K+ production expect a hadron specified, defaulting to Lambda - !!! WARNING !!!"
0036 RecoilHadron="Lambda"
0037 elif [[ $Ejectile == "K+" && ! -z "$8" ]]; then
0038 RecoilHadron=$8
0039 else
0040 RecoilHadron=""
0041 fi
0042
0043 i=1
0044 while [[ $i -le $NumFiles ]]; do
0045
0046 batch="${USER}_EICDempGen_${EBeamE}on${HBeamE}_${Ejectile}${RecoilHadron}_${InteractionPoint}_${NumEvents}_${i}_Job.txt"
0047 echo "Running ${batch} for file ${i}"
0048 cp /dev/null ${batch}
0049 RandomSeed=$(od -An -N3 -i /dev/urandom)
0050 echo "#!/bin/csh" >> ${batch}
0051 echo "#PBS -N DEMPGen_${EBeamE}on${HBeamE}_${Ejectile}${RecoilHadron}_${InteractionPoint}_${NumEvents}_${i}" >> ${batch}
0052 echo "#PBS -m abe" >> ${batch}
0053
0054 echo "#PBS -r n" >> ${batch}
0055 echo "#PBS -o /home/${USER}/trq_output/${EBeamE}on${HBeamE}_${Ejectile}${RecoilHadron}_${InteractionPoint}_${NumEvents}_${i}.out" >> ${batch}
0056 echo "#PBS -e /home/${USER}/trq_output/${EBeamE}on${HBeamE}_${Ejectile}${RecoilHadron}_${InteractionPoint}_${NumEvents}_${i}.err" >> ${batch}
0057 echo "date" >> ${batch}
0058 echo "cd /home/apps/DEMPgen/" >> ${batch}
0059 echo "./Process_EIC.csh ${i} ${NumEvents} ${EBeamE} ${HBeamE} ${RandomSeed} ${OutputType} ${InteractionPoint} ${Ejectile} ${RecoilHadron}" >> ${batch}
0060 echo "date">>${batch}
0061 echo "exit">>${batch}
0062 echo "Submitting batch"
0063 eval "qsub ${batch} 2>/dev/null"
0064 echo " "
0065 i=$(( $i + 1 ))
0066 sleep 2
0067 rm ${batch}
0068 done
0069