-
Notifications
You must be signed in to change notification settings - Fork 15
/
run-digi-replay.sh
executable file
·97 lines (82 loc) · 2.79 KB
/
run-digi-replay.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/bin/bash
# ------------------------------------------------------------------------- #
# This script runs replay jobs of pseudo (i.e. digitized) data. #
# --------- #
# 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
inputfile=$1
sbsconfig=$2
maxevents=$3
datadir=$4
run_on_ifarm=$5
analyzerenv=$6
sbsofflineenv=$7
sbsreplayenv=$8
ANAVER=$9 # Analyzer version
useJLABENV=${10} # Use 12gev_env instead of modulefiles?
JLABENV=${11} # /site/12gev_phys/softenv.sh version
# paths to necessary libraries (ONLY User specific part) ---- #
export ANALYZER=$analyzerenv
export SBSOFFLINE=$sbsofflineenv
export SBS_REPLAY=$sbsreplayenv
# ----------------------------------------------------------- #
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
experiment="${sbsconfig:0:3}"
config="${sbsconfig:3}"
# 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
source $ANALYZER/bin/setup.sh
else
module use /group/halla/modulefiles
module load analyzer/$ANAVER
module list
fi
# setting analyzer specific paths
export ANALYZER_CONFIGPATH=$SBS_REPLAY/replay
source $SBSOFFLINE/bin/sbsenv.sh
export DB_DIR=$SBS_REPLAY/DB_MC
export OUT_DIR=$SWIF_JOB_WORK_DIR
export DATA_DIR=$datadir
# handling any existing .rootrc file in the work directory
# mainly necessary while running the jobs on ifarm
if [[ -f .rootrc ]]; then
mv .rootrc .rootrc_temp
fi
cp $SBS/run_replay_here/.rootrc $SWIF_JOB_WORK_DIR
if [ $experiment == 'GMN' ] #GMN replay
then
analyzer -b -q 'replay_gmn_mc.C+("'$inputfile'",'$config','$maxevents')'
fi
if [ $experiment == 'GEN' ] #GEN replay
then
analyzer -b -q 'replay_gen_mc.C+("'$inputfile'",'$config','$maxevents')'
fi
if [ $experiment == 'GEP' ] #GEP replay
then
analyzer -b -q 'replay_gep_mc.C+("'$inputfile'",'$config','$maxevents')'
fi
# move output files
mv $OUT_DIR'/replayed_'$inputfile'.root' $DATA_DIR
mv $OUT_DIR'/replayed_'$inputfile'.log' $DATA_DIR
# clean up the work directory
rm .rootrc
if [[ -f .rootrc_temp ]]; then
mv .rootrc_temp .rootrc
fi