File indexing completed on 2025-01-17 09:02:54
0001
0002
0003
0004
0005
0006
0007
0008 echo "Running as ${USER}"
0009
0010
0011 if [[ "$#" -ne 7 && "$#" -ne 8 ]]; then
0012 echo ""
0013 echo "!!! ERROR !!! - Expected 7 or 8 arguments - !!! ERROR !!!"
0014 echo "Expect - NumFiles NumEvents EBeamE HBeamE OutputType InteractionPoint Ejectile RecoilHadron(optional)"
0015 echo "See the Config_EIC.json file or the README for options and try again, exiting"
0016 echo "!!! ERROR !!! - Expected 7 or 8 arguments - !!! ERROR !!!"
0017 echo ""
0018 exit 0
0019 fi
0020
0021
0022 NumFiles=$1
0023 NumEvents=$2
0024 EBeamE=$3
0025 HBeamE=$4
0026 OutputType=$5
0027 InteractionPoint=$6
0028 Ejectile=$7
0029
0030
0031 if [[ $Ejectile == "K+" && -z "$8" ]]; then
0032 echo "!!! WARNING !!! - For K+ production expect a hadron specified, defaulting to Lambda - !!! WARNING !!!"
0033 RecoilHadron="Lambda"
0034 elif [[ $Ejectile == "K+" && ! -z "$8" ]]; then
0035 RecoilHadron=$8
0036 else
0037 RecoilHadron=""
0038 fi
0039
0040 Workflow="EIC_DEMPGen_${USER}"
0041
0042 while true; do
0043 read -p "Do you wish to begin a new batch submission? (Please answer yes or no) " yn
0044 case $yn in
0045 [Yy]* )
0046 i=1
0047 (
0048 while [[ $i -le $NumFiles ]]; do
0049
0050 batch="${USER}_EICDempGen_${EBeamE}on${HBeamE}_${Ejectile}${RecoilHadron}_${InteractionPoint}_${NumEvents}_${i}_Job.txt"
0051 echo "Running ${batch} for file ${i}"
0052 cp /dev/null ${batch}
0053 RandomSeed=$(od -An -N3 -i /dev/urandom)
0054 echo "PROJECT: c-kaonlt" >> ${batch}
0055 echo "TRACK: analysis" >> ${batch}
0056 echo "JOBNAME: DEMPGen_${EBeamE}on${HBeamE}_${Ejectile}${RecoilHadron}_${InteractionPoint}_${NumEvents}_${i}" >> ${batch}
0057 echo "MEMORY: 2000 MB" >> ${batch}
0058 echo "CPU: 1" >> ${batch}
0059 echo "COMMAND:/group/eic/users/${USER}/DEMPGen/Process_EIC_iFarm.csh ${i} ${NumEvents} ${EBeamE} ${HBeamE} ${RandomSeed} ${OutputType} ${InteractionPoint} ${Ejectile} ${RecoilHadron}" >> ${batch}
0060 echo "MAIL: ${USER}@jlab.org" >> ${batch}
0061 echo "Submitting batch"
0062 eval "swif2 add-jsub ${Workflow} -script ${batch} 2>/dev/null"
0063 echo " "
0064 i=$(( $i + 1 ))
0065 sleep 2
0066 rm ${batch}
0067 if [ $i -gt $NumFiles ]; then
0068 echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
0069 echo " "
0070 echo "###############################################################################################################"
0071 echo "############################################ END OF JOB SUBMISSIONS ###########################################"
0072 echo "###############################################################################################################"
0073 echo " "
0074 fi
0075 done
0076 )
0077 eval 'swif2 run ${Workflow}'
0078 break;;
0079 [Nn]* )
0080 exit;;
0081 * ) echo "Please answer yes or no.";;
0082 esac
0083 done
0084