-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmergeCARE
More file actions
executable file
·125 lines (107 loc) · 2.95 KB
/
mergeCARE
File metadata and controls
executable file
·125 lines (107 loc) · 2.95 KB
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#!/bin/bash
set -o errexit # abort on nonzero exitstatus
set -o pipefail # don't hide errors within pipes
SECONDS=0
echo "Starting mergeCARE"
show_help() {
echo ""
echo "Syntax: ./mergeCARE [ -arg value ]"
echo "Options:"
echo "-src (source directory)"
echo "-zenith (zenith angle)"
echo "-wobble (wobble)"
echo "-atm (summer/62 or winter/61)"
echo "-nsb (list of NSB levels)"
echo "-mode (std or rhv)"
echo "-n_max ()"
echo "-n_min ()"
echo "-n_merge ()"
echo ""
}
atm="winter"
zenith="20"
wobble="0.25"
mode="std"
nsb="200"
n_min=0 # min run
n_max=100000 # max run (100000)
n_merge=""
while :; do
case $1 in
-h|-\?|--help)
show_help
exit
;;
-src)
source_dir=$2
shift
;;
-zenith)
zenith=$2
shift
;;
-wobble)
wobble=$2
shift
;;
-atm)
atm=$2
shift
;;
-nsb)
nsb=$2
shift
;;
-mode)
mode=$2
shift
;;
-n_max)
n_max=$2
shift
;;
-n_min)
n_min=$2
shift
;;
-n_merge)
n_merge=$2
shift
;;
*)
break
esac
shift
done
echo "Source:${source_dir}"
# shellcheck disable=SC1091,SC1090
source "${source_dir}/util.sh"
# shellcheck disable=SC1091,SC1090
source "${source_dir}/setupMC6.sh"
# shellcheck disable=SC1091,SC1090
source "${source_dir}/loadVBF.sh"
# shellcheck disable=SC1091,SC1090
# source "${source_dir}/loadRoot.sh"
source "/afs/ifh.de/group/cta/scratch/prado/VTS/setEnv.sh" "v501_rd"
all_n=$(seq "${n_min}" "${n_max}")
atm=$(validate_atm "${atm}")
zenith=$(validate_zenith "${zenith}")
wobble=$(validate_wobble "${wobble}")
mode=$(validate_mode "${mode}")
files_to_merge="${source_dir}/lists/files_to_merge_${RANDOM}.lis"
true > "${files_to_merge}"
for n in ${all_n}; do
run=$(compute_run "${zenith}" "${n}")
care_file=$(care_file "${run}" "${zenith}" "${atm}" "${wobble}" "${nsb}" "${mode}")
if [ -f "${care_file}.vbf" ]; then
echo "${care_file}.vbf" >> "${files_to_merge}"
fi
done
merged_care_file=$(merged_care_file "${zenith}" "${atm}" "${wobble}" "${nsb}" "${mode}" "${n_merge}")
mkdir -p "$(dirname "${merged_care_file}")"
echo "Merging ..."
printf "%s\n" "${merged_care_file}"
# shellcheck disable=SC2086
${EVNDISPSYS}/bin/mergeVBF "${files_to_merge}" "${merged_care_file}" 1
rm "${files_to_merge}"
print_runtime "${SECONDS}"