Jpp 19.3.0-rc.1
the software that should make you happy
Loading...
Searching...
No Matches
JORCAMuonReconstruction.sh
Go to the documentation of this file.
1#!/usr/bin/env zsh
2#
3# \author bofearraigh
4#
5script=${0##*/}
6
7# ------------------------------------------------------------------------------------------
8#
9# Script to run the JPP Track Reconstruction Chain for ORCA.
10#
11# ------------------------------------------------------------------------------------------
12
13if [ -z $JPP_DIR ]; then
14 echo "Variable JPP_DIR undefined."
15 exit
16fi
17
18source $JPP_DIR/setenv.sh $JPP_DIR
19source $JPP_DIR/externals/km3net-dataformat/definitions/reconstruction.sh
20
21set_variable: DEBUG RECONSTRUCTION_DEBUG 1
22set_variable: PDF RECONSTRUCTION_PDF $JPP_DATA/J%p.dat
23set_variable: SUFFIX RECONSTRUCTION_SUFFIX jmuon
24set_variable: NUMBER_OF_EVENTS RECONSTRUCTION_NUMBER_OF_EVENTS $((2**31))
25set_variable: NUMBER_OF_THREADS RECONSTRUCTION_NUMBER_OF_THREADS 0
26set_variable+ OVERWRITE RECONSTRUCTION_OVERWRITE 1
27set_variable: TMAX_S RECONSTRUCTION_TMAX_S 100
28
29if do_usage $*; then
30 usage "$script <detector file> <input file> <output file> <PMT parameters file> [(calibration file)+]"
31fi
32
33if (( $# < 4 )); then
34 fatal "Wrong number of arguments."
35fi
36
37set_variable DETECTOR $argv[1]
38set_variable INPUT_FILE $argv[2]
39set_variable OUTPUT_FILE $argv[3]
40set_variable PMT $argv[4]
41set_array CALIBRATION $argv[5,-1]
42
43if [[ ! "$OUTPUT_FILE" == *"%"* ]]; then
44 fatal "The output file must have the wildcard % in the name, e.g. %.root"
45fi
46
47typeset -A PARAMETERS
48typeset -a APPLICATIONS
49
50APPLICATIONS=()
51
52
53if [[ "$OVERWRITE" == 1 ]]; then
54 rm -vf \
55 ${OUTPUT_FILE/\%/jprefit} \
56 ${OUTPUT_FILE/\%/jsimplex} \
57 ${OUTPUT_FILE/\%/jstart} \
58 ${OUTPUT_FILE/\%/jgandalf} \
59 ${OUTPUT_FILE/\%/jstart2} \
60 ${OUTPUT_FILE/\%/jenergy} \
61 ${OUTPUT_FILE/\%/jhistory} \
62 ${OUTPUT_FILE/\%/${SUFFIX}} \
63 ${OUTPUT_FILE/\%/${SUFFIX}.offline}
64fi
65
66
67if (( ${#CALIBRATION} != 0 )); then
68 getMechanics.sh $DETECTOR
69fi
70
71
72# ------------------------------------------------------------------------------------------
73# JMuonPrefit
74# ------------------------------------------------------------------------------------------
75
76PARAMETERS=(
77 sigma_ns 5
78 gridAngle_deg 4
79 useL0 1
80 numberOfOutliers 2
81 numberOfPrefits 50
82 DZMax 0.0
83 numberOfDZMax 1
84 TMaxLocal_ns 12
85 ctMin 0.0
86 roadWidth_m 50.0
87 Qmin 1.5)
88
89timer_start
90
91eval JMuonPrefit \
92 -a $DETECTOR \
93 -+${^CALIBRATION} \
94 -T $TMAX_S \
95 -f $INPUT_FILE \
96 -o ${OUTPUT_FILE/\%/jprefit} \
97 -n ${NUMBER_OF_EVENTS} \
98 -N ${NUMBER_OF_THREADS} \
99 -@ `make_equation PARAMETERS` \
100 -d $DEBUG --!
101
102CHECK_EXIT_CODE
103
104APPLICATIONS+=$JMUONPREFIT
105
106timer_stop
107timer_print
108
109
110# ------------------------------------------------------------------------------------------
111# JMuonSimplex
112# ------------------------------------------------------------------------------------------
113
114PARAMETERS=(
115 sigma_ns 3
116 TMaxLocal_ns 15.0
117 ctMin 0.0
118 roadWidth_m 50.0
119 numberOfPrefits 0)
120
121timer_start
122
123eval JMuonSimplex \
124 -a $DETECTOR \
125 -+${^CALIBRATION} \
126 -T $TMAX_S \
127 -f ${OUTPUT_FILE/\%/jprefit} \
128 -o ${OUTPUT_FILE/\%/jsimplex} \
129 -N ${NUMBER_OF_THREADS} \
130 -@ `make_equation PARAMETERS` \
131 -d ${DEBUG} --!
132
133CHECK_EXIT_CODE
134
135rm -vf ${OUTPUT_FILE/\%/jprefit}
136
137APPLICATIONS+=$JMUONSIMPLEX
138
139timer_stop
140timer_print
141
142
143# ------------------------------------------------------------------------------------------
144# JMuonStart
145# ------------------------------------------------------------------------------------------
146
147PARAMETERS=(
148 roadWidth_m 50.0
149 R_Hz 7.0e3
150 TMin_ns -25.0
151 TMax_ns +25.0
152 Pmin1 1.0e-3
153 Pmin2 1.0e-2
154 numberOfPrefits 0)
155
156timer_start
157
158eval JMuonStart \
159 -a $DETECTOR \
160 -+${^CALIBRATION} \
161 -T $TMAX_S \
162 -f ${OUTPUT_FILE/\%/jsimplex} \
163 -o ${OUTPUT_FILE/\%/jstart} \
164 -P $PDF \
165 -N ${NUMBER_OF_THREADS} \
166 -@ `make_equation PARAMETERS` \
167 -d $DEBUG --!
168
169CHECK_EXIT_CODE
170
171rm -vf ${OUTPUT_FILE/\%/jsimplex}
172
173APPLICATIONS+=$JMUONSTART
174
175timer_stop
176timer_print
177
178
179# ------------------------------------------------------------------------------------------
180# JMuonGandalf
181# ------------------------------------------------------------------------------------------
182
183PARAMETERS=(
184 TTS_ns 2
185 E_GeV 10.0
186 TMin_ns -50.0
187 TMax_ns +450.0
188 ZMin_m -3.0
189 ZMax_m +9.0
190 R_Hz 7.0e3
191 roadWidth_m 50.0
192 numberOfPrefits 0)
193
194timer_start
195
196eval JMuonGandalf \
197 -a $DETECTOR \
198 -+${^CALIBRATION} \
199 -T $TMAX_S \
200 -f ${OUTPUT_FILE/\%/jstart} \
201 -o ${OUTPUT_FILE/\%/jgandalf} \
202 -P $PDF \
203 -N ${NUMBER_OF_THREADS} \
204 -@ `make_equation PARAMETERS` \
205 -d $DEBUG --!
206
207CHECK_EXIT_CODE
208
209rm -vf ${OUTPUT_FILE/\%/jstart}
210
211APPLICATIONS+=$JMUONGANDALF
212
213timer_stop
214timer_print
215
216
217# ------------------------------------------------------------------------------------------
218# JMuonStart
219# ------------------------------------------------------------------------------------------
220
221PARAMETERS=(
222 roadWidth_m 50.0
223 R_Hz 7.0e3
224 TMin_ns -25.0
225 TMax_ns +25.0
226 Pmin1 1.0e-3
227 Pmin2 1.0e-2
228 numberOfPrefits 1)
229
230timer_start
231
232eval JMuonStart \
233 -a $DETECTOR \
234 -+${^CALIBRATION} \
235 -T $TMAX_S \
236 -f ${OUTPUT_FILE/\%/jgandalf} \
237 -o ${OUTPUT_FILE/\%/jstart2} \
238 -P $PDF \
239 -N ${NUMBER_OF_THREADS} \
240 -@ `make_equation PARAMETERS` \
241 -d $DEBUG --!
242
243CHECK_EXIT_CODE
244
245rm -vf ${OUTPUT_FILE/\%/jgandalf}
246
247APPLICATIONS+=$JMUONSTART
248
249timer_stop
250timer_print
251
252
253# ------------------------------------------------------------------------------------------
254# JMuonEnergy
255# ------------------------------------------------------------------------------------------
256
257PARAMETERS=(
258 roadWidth_m 80.0
259 R_Hz 7.0e3
260 EMin_log 0.0
261 EMax_log 7.0
262 TMin_ns -25.0
263 TMax_ns +25.0
264 ZMin_m -7.5
265 resolution 0.01
266 mestimator 3
267 numberOfPrefits 1)
268
269timer_start
270
271eval JMuonEnergy \
272 -a $DETECTOR \
273 -+${^CALIBRATION} \
274 -T $TMAX_S \
275 -f ${OUTPUT_FILE/\%/jstart2} \
276 -o ${OUTPUT_FILE/\%/jenergy} \
277 -P $PDF \
278 -N ${NUMBER_OF_THREADS} \
279 -@ `make_equation PARAMETERS` \
280 -d $DEBUG --!
281
282CHECK_EXIT_CODE
283
284rm -vf ${OUTPUT_FILE/\%/jstart2}
285
286APPLICATIONS+=$JMUONENERGY
287
288timer_stop
289timer_print
290
291
292# ------------------------------------------------------------------------------------------
293# JHistory
294# ------------------------------------------------------------------------------------------
295
296timer_start
297
298JHistory \
299 -f ${OUTPUT_FILE/\%/jenergy} \
300 -o ${OUTPUT_FILE/\%/jhistory} \
301 -A "$APPLICATIONS[*]" \
302 -d $DEBUG --!
303
304CHECK_EXIT_CODE
305
306rm -vf ${OUTPUT_FILE/\%/jenergy}
307
308timer_stop
309timer_print
310
311
312# ------------------------------------------------------------------------------------------
313# rename outputfile and remove intermediate files
314# ------------------------------------------------------------------------------------------
315
316timer_start
317
318mv -v \
319 ${OUTPUT_FILE/\%/jhistory} \
320 ${OUTPUT_FILE/\%/${SUFFIX}}
321
322timer_stop
323timer_print
324
325
326# ------------------------------------------------------------------------------------------
327# JConvertEvt
328# ------------------------------------------------------------------------------------------
329
330timer_start
331
332JConvertEvt \
333 -f ${OUTPUT_FILE/\%/${SUFFIX}} \
334 -o ${OUTPUT_FILE/\%/${SUFFIX}.offline} \
335 -a $DETECTOR \
336 -+${^CALIBRATION} \
337 -T $TMAX_S \
338 -P $PMT \
339 -d $DEBUG --!
340
341timer_stop
342timer_print