forked from provakar1994/jlab-HPC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-g4sbs-simu.sh
executable file
·70 lines (59 loc) · 2.02 KB
/
run-g4sbs-simu.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
# ------------------------------------------------------------------------- #
# This script runs g4sbs simulation jobs. #
# --------- #
# P. Datta <[email protected]> CREATED 11-09-2022 #
# --------- #
# ** Do not tamper with this sticker! Log any updates to the script above. #
# ------------------------------------------------------------------------- #
#SBATCH --partition=production
#SBATCH --account=halla
#SBATCH --mem-per-cpu=1500
# list of arguments
preinit=$1
postscript=$2
nevents=$3
outfilebase=$4
outdirpath=$5
run_on_ifarm=$6
g4sbsenv=$7
ANAVER=$8 # Analyzer version
useJLABENV=$9 # Use 12gev_env instead of modulefiles?
JLABENV=${10} # /site/12gev_phys/softenv.sh version
# paths to necessary libraries (ONLY User specific part) ---- #
export G4SBS=$g4sbsenv
# ----------------------------------------------------------- #
ifarmworkdir=${PWD}
if [[ $run_on_ifarm == 1 ]]; then
SWIF_JOB_WORK_DIR=$ifarmworkdir
echo -e "Running all jobs on ifarm!"
fi
echo -e 'Work directory = '$SWIF_JOB_WORK_DIR
# Enabling module
MODULES=/etc/profile.d/modules.sh
if [[ $(type -t module) != function && -r ${MODULES} ]]; then
source ${MODULES}
fi
# Choosing software environment
if [[ (! -d /group/halla/modulefiles) || ($useJLABENV -eq 1) ]]; then
source /site/12gev_phys/softenv.sh $JLABENV
else
module use /group/halla/modulefiles
module load analyzer/$ANAVER
module list
fi
# Setup g4sbs specific environments
source $G4SBS/bin/g4sbs.sh
# creating post script
echo '/g4sbs/filename '$outfilebase'.root' >>$postscript
echo '/g4sbs/run '$nevents >>$postscript
#cat $postscript
g4sbs --pre=$preinit'.mac' --post=$postscript
# idiot proofing
if [[ ! -d $outdirpath ]]; then
mkdir $outdirpath
fi
mv $outfilebase'.root' $outdirpath
mv $outfilebase'.csv' $outdirpath
# clean up the work directory
rm $postscript