-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrun_many_local.sh
87 lines (74 loc) · 2.06 KB
/
run_many_local.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
#!/bin/bash
# This is just a bash script running many jobs in series
#
# Usage:
# . run_many.sh file_list.txt
#
# where file_list.txt is just a collection of file path
#======================================
# Run Parameters
run_script_option=0 #0: run all; 1: run raw_data_rooter.py; 2: run_drop.py; 3: dqom.py
drop_version=v1.0.2
subdir=muon
MVD_DIR=/media/disk_a/BNLBOX/WbLS-DATA
#======================================
# path to the yaml config file
config_file=$2
function do_raw_data_rooter() {
local file_path=$1
output_dir=${MVD_DIR}/raw_root/${subdir}/
while read fpath; do
case "$fpath" in \#*) continue ;; esac
echo " "
echo "processing $fpath ..."
python src/raw_data_rooter.py --if_path=${fpath} --output_dir=${output_dir}
done < $file_path
}
function do_run_drop() {
local file_path=$1
local config_file=$2
output_dir=${MVD_DIR}/rq/${drop_version}/${subdir}
mkdir -p $output_dir
while read fpath; do
case "$fpath" in \#*) continue ;; esac
echo " "
echo "processing $fpath ..."
python src/run_drop.py -i ${fpath} -c ${config_file} --output_dir=${output_dir}
done < $file_path
}
function do_dqom() {
local file_path=$1
output_dir=${MVD_DIR}/dqom/${drop_version}/${subdir}
mkdir -p $output_dir
file_path=$1
while read fpath; do
case "$fpath" in \#*) continue ;; esac
echo " "
echo "processing $fpath ..."
python tools/dqom.py ${fpath} ${output_dir}
done < $file_path
}
file_path=$1
if [ $run_script_option -eq 1 ]; then
do_raw_data_rooter $file_path
fi
if [ $run_script_option -eq 2 ]; then
do_run_drop $file_path $config_file
fi
if [ $run_script_option -eq 3 ]; then
do_dqom $file_path
fi
if [ $run_script_option -eq 0 ]; then
tmp=$(pwd)/tmp.txt
cp $file_path $tmp
do_raw_data_rooter $tmp
sed -i -e 's/binary/root/g' $tmp
sed -i -e 's/.bin/.root/g' $tmp
do_run_drop $tmp $config_file
olddir="raw_root/${subdir}"
newdir="rq/${drop_version}/${subdir}"
sed -i "s|$olddir|$newdir|g" $tmp
sed -i -e 's/.root/_rq.root/g' $tmp
do_dqom $tmp
rm $tmp
fi