File indexing completed on 2025-01-18 10:18:31
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 SimDir="/group/eic/users/${USER}/ePIC/"
0012 echo "Running as ${USER}"
0013 echo "Assuming simulation directory - ${SimDir}"
0014 if [ ! -d $SimDir ]; then
0015 echo "!!! WARNING !!!"
0016 echo "!!! $SimDir - Does not exist - Double check pathing and try again !!!"
0017 echo "!!! WARNNING !!!"
0018 exit 1
0019 fi
0020
0021 FileNum=$1
0022 if [[ -z "$1" ]]; then
0023 echo "I need a number of files to run!"
0024 echo "Please provide a number of files to run as the first argument"
0025 exit 2
0026 fi
0027 NumEvents=$2
0028 if [[ -z "$2" ]]; then
0029 echo "I need a number of events to generate per file!"
0030 echo "Please provide a number of event to generate per file as the second argument"
0031 exit 3
0032 fi
0033
0034
0035 if [[ -z "$3" ]]; then
0036 Arg3=10
0037 echo "Arg3 not specified, defaulting to 10"
0038 else
0039 Arg=$3
0040 fi
0041
0042
0043 if [[ -z "$4" ]]; then
0044 Arg4=10
0045 echo "Arg4 not specified, defaulting to 10"
0046 else
0047 Arg4=$4
0048 fi
0049
0050
0051 OutputPath="/volatile/eic/${USER}"
0052 export Output_tmp="$OutputPath/im_${FileNum}_${NumEvents}_${Arg3/./p}_${Arg4/./p}"
0053 if [ ! -d "${Output_tmp}" ]; then
0054 mkdir $Output_tmp
0055 else
0056 if [ "$(ls -A $Output_tmp)" ]; then
0057 if [[ "${HOSTNAME}" == *"ifarm"* ]]; then
0058 echo "!!!!! Warning, ${Output_tmp} directory exists and is not empty! Files may be overwritten! !!!!!"
0059 fi
0060 fi
0061 fi
0062
0063 export EICSHELL=${SimDir}/eic-shell
0064 cd ${SimDir}
0065
0066 if test -f "${Output_tmp}/ddsimOut_${FileNum}_${NumEvents}.edm4hep.root"; then
0067
0068 echo "${Output_tmp}/ddsimOut_${FileNum}_${NumEvents}.edm4hep.root already exists, running reconstruction only"
0069
0070 cat <<EOF | $EICSHELL
0071 source Init_Env.sh
0072 cd $Output_tmp
0073 eicrecon -Pjana:nevents=${NumEvents} -Phistsfile=EICReconOut_${FileNum}_${NumEvents}.root ${Output_tmp}/ddsimOut_${FileNum}_${NumEvents}.edm4hep.root
0074 sleep 5
0075
0076 echo; echo; echo "Reconstruction finished, output file is - ${Output_tmp}/EICReconOut_${FileNum}_${NumEvents}.root"; echo; echo;
0077 EOF
0078
0079 else
0080 cat <<EOF | $EICSHELL
0081 source Init_Env.sh
0082
0083
0084
0085
0086 npsim -v 4 --inputFiles PATH_TO_INPUT_FILE --outputFile ${Output_tmp}/ddsimOut_${FileNum}_${NumEvents}.edm4hep.root --compactFile ${SimDir}/epic/epic_ip6.xml -N ${NumEvents}
0087 sleep 5
0088
0089
0090 echo; echo; echo "Simulation finished, running reconstruction."; echo; echo;
0091 cd $Output_tmp
0092 eicrecon -Pplugins=PLUGINS -Pjana:nevents=${NumEvents} -Phistsfile=EICReconOut_${FileNum}_${NumEvents}.root ${Output_tmp}/ddsimOut_${FileNum}_${NumEvents}.edm4hep.root
0093 sleep 5
0094
0095 echo; echo; echo "Reconstruction finished, output file is - ${Output_tmp}/EICReconOut_${FileNum}_${NumEvents}.root"; echo; echo;
0096
0097 EOF
0098 fi
0099
0100 exit 0