-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathctr_mono_test
257 lines (231 loc) · 6.88 KB
/
ctr_mono_test
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
#!/bin/bash
# This script is for running a prod-4 5 SST simulation for Paranal.
if [ "$1" = "--help" ]; then
echo "Run a Paranal (CTA-South) 5 SST (from baseline layout) simulation with"
echo "either storing only the CORSIKA IACT output (default) or full simulation with"
echo "prod-4 configurations for Paranal site, primary type, azimuth, and zenith angle."
echo ""
echo "Syntax: $0 [ option(s) ] site primary from_direction zenith_angle"
echo " Site must be Paranal (default: Paranal)"
echo " Primary can be any of gamma,gamma-diffuse,electron,proton,helium,... (default: gamma)"
echo " From_direction can be any of North,South,East,West (default: South)"
echo " Default zenith_angle is 20 deg."
echo ""
echo "Options:"
echo " -B or --align-b-field : Turn off geomagnetic field declination (align to x/z plane)."
echo " --with-telescope-simulation : Directly pipe into telescope simulation rather than"
echo " storing just the CORSIKA IACT output."
echo " --without-multipipe : Output directly to (compressed) file, without multipipe_corsika."
echo " --with-multipipe : Output to (compressed) file produced via multipipe_corsika."
echo " --full-range : Use the full energy range as for baseline simulations with LST+MST."
echo ""
echo "There are also a number of environment variables which can be used to control"
echo "the number of showers, the energy spectrum, core positions and view cone radius:"
echo " NSHOW ESLOPE EMIN [TeV] EMAX [TeV] NSCAT CSCAT [m] VIEWCONE [deg]"
echo ""
exit
fi
if [ -x ${HOME}/bin/init_batch_job ]; then
. ${HOME}/bin/init_batch_job
fi
# Top-level path under which we normally installed everything
if [ -z "${CTA_PATH}" ]; then
if [ -d "pa-baseline/sim_telarray" ]; then
export CTA_PATH="$(pwd -P)/pa-baseline"
elif [ -d "demo/sim_telarray" ]; then
export CTA_PATH="$(pwd -P)/demo"
elif [ -d "sim_telarray" ]; then
export CTA_PATH="$(pwd -P)"
fi
fi
extras="-DWITHOUT_MULTIPIPE"
extrab=""
extrae=""
with_simtel="0"
# Use a loop to avoid dependence on order of options.
for ((i=0; i<5; i++)); do
if [ "$1" = "--align-b-field" -o "$1" == "--align-B-field" -o "$1" = "-B" ]; then
shift
extrab="-DALIGN_B_FIELD"
elif [ "$1" = "--with-telescope-simulation" ]; then
shift
extras="-DWITH_TELESCOPE_SIMULATION"
with_simtel="1"
elif [ "$1" = "--without-multipipe" ]; then
shift
extras="-DWITHOUT_MULTIPIPE"
with_simtel="0"
elif [ "$1" = "--with-multipipe" ]; then
shift
extras=""
with_simtel="0"
elif [ "$1" = "--full-range" ]; then
shift
extrae="-DFULL_RANGE"
export extra_suffix2="-full"
else
break
fi
done
extra="${extras} ${extrab} ${extrae} -DYEAR2020"
prod4site="Paranal"
if [ ! -z "${PROD4_SITE}" ]; then
prod4site="${PROD4_SITE}"
fi
if [ ! -z "$1" ]; then
prod4site="$1"
shift
fi
export PROD4_SITE="${prod4site}"
prod4primary="gamma"
if [ ! -z "${PROD4_PRIMARY}" ]; then
prod4primary="${PROD4_PRIMARY}"
fi
if [ ! -z "$1" ]; then
prod4primary="$1"
shift
fi
export PROD4_PRIMARY="${prod4primary}"
prod4pointing="North"
if [ ! -z "${PROD4_POINTING}" ]; then
prod4pointing="${PROD4_POINTING}"
fi
if [ ! -z "$1" ]; then
prod4pointing="$1"
shift
fi
export PROD4_POINTING="${prod4pointing}"
prod4zenith="20"
if [ ! -z "${PROD4_ZENITH}" ]; then
prod4zenith="${PROD4_ZENITH}"
fi
if [ ! -z "$1" ]; then
prod4zenith="$1"
shift
fi
export PROD4_ZENITH="${prod4zenith}"
input_tmpl="INPUTS_Arkaroola-1000m"
site_type="CTA-South"
prod_base="INPUTS_CTA_PROD4-${prod4site}-5-SST"
defs=""
case "$prod4site" in
Paranal)
defs="-DSITE_PARANAL"
site_type="CTA-South"
;;
*)
echo "Undefined Prod-4 SST site $prod4site"
exit 1
;;
esac
case "$prod4primary" in
gamma|g)
defs="${defs} -DPRIMARY_GAMMA"
prod4primary="gamma"
;;
gamma-diffuse|gamma_diffuse|diffuse)
defs="${defs} -DPRIMARY_GAMMA_DIFFUSE"
prod4primary="gamma_diffuse"
;;
electron|e)
defs="${defs} -DPRIMARY_ELECTRON"
prod4primary="electron"
;;
proton|p)
defs="${defs} -DPRIMARY_PROTON"
prod4primary="proton"
;;
Helium|helium|He|he)
defs="${defs} -DPRIMARY_HELIUM"
prod4primary="helium"
;;
Nitrogen|nitrogen|N|n)
defs="${defs} -DPRIMARY_NITROGEN"
prod4primary="nitrogen"
;;
Silicon|silicon|Si|si)
defs="${defs} -DPRIMARY_SILICON"
prod4primary="silicon"
;;
Iron|iron|Fe|fe)
defs="${defs} -DPRIMARY_IRON"
prod4primary="iron"
;;
*)
echo "Undefined primary type $prod4primary"
exit 1
;;
esac
case "$prod4pointing" in
North|north|N)
defs="${defs} -DFROM_NORTH"
prod4pointing="North"
;;
South|south|S)
defs="${defs} -DFROM_SOUTH"
prod4pointing="South"
;;
East|east|E)
defs="${defs} -DFROM_EAST"
prod4pointing="East"
;;
West|west|W)
defs="${defs} -DFROM_WEST"
prod4pointing="West"
;;
*)
echo "Undefined pointing direction $prod4pointing"
exit 1
;;
esac
export CTA_PATH=/fast/users/a1779903/mc_simtels/CTA_MC
. ${CTA_PATH}/examples_common.sh
echo ""
echo "This is a prod-4 ${prod4site} 5 SST run with primaries of type ${prod4primary} from ${prod4pointing} at z=${prod4zenith} deg."
if [ "${with_simtel}" = "1" ]; then
echo "Output is piped into telescope simulation for all relevant SST configurations."
else
echo "Output from CORSIKA IACT interface is stored for later processing."
fi
echo ""
cd ${CORSIKA_DATA} || exit 1
inputs_tmp="inputs.tmp.${HOSTNAME}.$$.${prod4site}.${prod4primary}.${prod4pointing}.${prod4zenith}"
if [ ! -z "${NSHOW}" ]; then
defs="${defs} -DNSHOW=${NSHOW}"
fi
if [ ! -z "${ESLOPE}" ]; then
defs="${defs} -DESLOPE=${ESLOPE}"
fi
if [ ! -z "${EMIN}" ]; then
defs="${defs} -DEMIN=${EMIN}"
fi
if [ ! -z "${EMAX}" ]; then
defs="${defs} -DEMAX=${EMAX}"
fi
if [ ! -z "${NSCAT}" ]; then
defs="${defs} -DNSCAT=${NSCAT}"
fi
if [ ! -z "${CSCAT}" ]; then
defs="${defs} -DCSCAT=${CSCAT}"
fi
if [ ! -z "${VIEWCONE}" ]; then
defs="${defs} -DVIEWCONE=${VIEWCONE}"
fi
# Note: preprocessing with cpp would also work but pfp is less intrusive (retains comments, no '# nn' lines added).
${SIM_TELARRAY_PATH}/bin/pfp -V $defs $extra - < ${CORSIKA_PATH}/${input_tmpl} \
> "$inputs_tmp"
${SIM_TELARRAY_PATH}/bin/corsika_autoinputs \
--run ${CORSIKA_PATH}/corsika \
-p ${CORSIKA_DATA} \
"$inputs_tmp" || exit 1
echo "Waiting 30 seconds for output pipes to get finished ..."
sleep 30
rm "$inputs_tmp"
echo ""
echo "CTA Prod-4 5 SST run for site $prod4site, primary $prod4primary, showers coming from $prod4pointing, zenith angle $prod4zenith complete."
echo ""
if [ ! -z "${FINDDATA}" ]; then
echo "New data:"
find ${SIM_TELARRAY_DATA} -type f -mmin -1 | sed 's:^.*/\(Data/sim.*\)$:\1:'
echo ""
fi