-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrunCARE
More file actions
executable file
·144 lines (119 loc) · 4.13 KB
/
runCARE
File metadata and controls
executable file
·144 lines (119 loc) · 4.13 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#!/bin/bash
set -o errexit # abort on nonzero exitstatus
set -o pipefail # don't hide errors within pipes
SECONDS=0
echo "Starting runCARE"
show_help() {
echo ""
echo "Syntax: ./runCARE [ -arg value ]"
echo "Options:"
echo "-src (source directory)"
echo "-run (run number)"
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 ""
}
run_list="2010000"
zenith=20
wobble="0"
atm="winter"
mode="std"
nsb_list="200"
while :; do
case $1 in
-h|-\?|--help)
show_help
exit
;;
-src)
source_dir=$2
shift
;;
-run)
run_list=$2
shift
;;
-zenith)
zenith=$2
shift
;;
-wobble)
wobble=$2
shift
;;
-atm)
atm=$2
shift
;;
-nsb)
nsb_list=$2
shift
;;
-mode)
mode=$2
shift
;;
*)
break
esac
shift
done
# shellcheck disable=SC1091,SC1090
source "${source_dir}/util.sh"
# shellcheck disable=SC1091,SC1090
source "${source_dir}/setupMC.sh"
######################
# Processing arguments
atm=$(validate_atm "${atm}")
zenith=$(validate_zenith "${zenith}")
wobble=$(validate_wobble "${wobble}")
mode=$(validate_mode "${mode}")
care_config=$(care_config_file "${source_dir}" "${mode}")
care_low_gain_file=$(care_low_gain "${source_dir}")
care_high_gain_file=$(care_high_gain "${source_dir}")
printf "DEBUG: CARE config file %s\n" "${care_config}"
printf "DEBUG: Pulse shape low gain %s\n" "${care_low_gain_file}"
printf "DEBUG: Pulse shape high gain %s\n" "${care_high_gain_file}"
# TMP DIR
if [ "${TMPDIR}" == "" ]; then
tmp_dir="${PWD}"
else
tmp_dir="${TMPDIR}"
fi
for run in ${run_list}; do
gro_file=$(groptics_file "${run}" "${zenith}" "${atm}" "${wobble}")
gro_file_loc="${tmp_dir}/$(basename ${gro_file})"
if [ ! -f "${gro_file}" ]; then
printf "GrOptics file not found for run %s\n" "${run}"
continue
fi
printf "Copying gro file to %s\n" "${gro_file_loc}"
cp "${gro_file}" "${gro_file_loc}"
for nsb in ${nsb_list}; do
care_file=$(care_file "${run}" "${zenith}" "${atm}" "${wobble}" "${nsb}" "${mode}")
care_file_loc="${tmp_dir}/$(basename ${care_file})"
mkdir -p "$(dirname "${care_file}")"
# chgrp -R veritas "$(dirname "${care_file}")"
printf "CARE file:%s\n" "${care_file}"
printf "CARE file (LOC):%s\n" "${care_file_loc}"
echo "----------------------------------------"
printf "Running CARE (NSB %s) ...\n" "${nsb}"
# shellcheck disable=SC2086
echo "Running cmd: " ${SW_DIR}/CARE/CameraAndReadout NSBRATEPERPIXEL "0 ${nsb}" HIGHGAINPULSESHAPE "0 ${care_high_gain_file}" LOWGAINPULSESHAPE "0 ${care_low_gain_file}" --notraces --seed "${run}" --configfile "${care_config}" --outputfile "${care_file}" --inputfile "${gro_file}" --vbfrunnumber 10000 --writepedestals 1
# shellcheck disable=SC2086
${SW_DIR}/CARE/CameraAndReadout NSBRATEPERPIXEL "0 ${nsb}" \
HIGHGAINPULSESHAPE "0 ${care_high_gain_file}" LOWGAINPULSESHAPE "0 ${care_low_gain_file}" \
--notraces --seed "${run}" --configfile "${care_config}" --outputfile "${care_file_loc}" \
--inputfile "${gro_file_loc}" --vbfrunnumber 10000 --writepedestals 1 || true
printf "Moving output to %s\n" "${care_file}"
mv "${care_file_loc}.root" "${care_file}.root" || true
mv "${care_file_loc}.vbf" "${care_file}.vbf" || true
echo "CARE DONE-------------------------------"
done # nsb
printf "Removing loc groptics file\n"
rm "${gro_file_loc}" || true
done # run
print_runtime "$SECONDS"