Jpp 20.0.0-195-g190c9e876
the software that should make you happy
Loading...
Searching...
No Matches
examples/JReconstruction/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
19
20
21source reconstruction.sh
22
23set_variable: DEBUG RECONSTRUCTION_DEBUG 1
24set_variable: PDF RECONSTRUCTION_PDF $JPP_DATA/J%p.dat.gz
25set_variable: SUFFIX RECONSTRUCTION_SUFFIX jmuon
26set_variable: NUMBER_OF_EVENTS RECONSTRUCTION_NUMBER_OF_EVENTS $((2**31))
27set_variable: NUMBER_OF_THREADS RECONSTRUCTION_NUMBER_OF_THREADS 0
28set_variable+ OVERWRITE RECONSTRUCTION_OVERWRITE 1
29set_variable: TMAX_S RECONSTRUCTION_TMAX_S 100
30set_variable: RATE_HZ RECONSTRUCTION_RATE_HZ 7.0e3
31
32if do_usage $*; then
33 usage "$script <detector file> <input file> <output file> <PMT parameters file> [(calibration file)+]"
34fi
35
36if (( $# < 4 )); then
37 fatal "Wrong number of arguments."
38fi
39
40set_variable DETECTOR $argv[1]
41set_variable INPUT_FILE $argv[2]
42set_variable OUTPUT_FILE $argv[3]
43set_variable PMT $argv[4]
44set_array CALIBRATION $argv[5,-1]
45
46if [[ ! "$OUTPUT_FILE" == *"%"* ]]; then
47 fatal "The output file must have the wildcard % in the name, e.g. %.root"
48fi
49
50typeset -A PARAMETERS
51typeset -a APPLICATIONS
52
53APPLICATIONS=()
54
55
56if [[ "$OVERWRITE" == 1 ]]; then
57 rm -vf \
58 ${OUTPUT_FILE/\%/jprefit} \
59 ${OUTPUT_FILE/\%/jsimplex} \
60 ${OUTPUT_FILE/\%/jstart} \
61 ${OUTPUT_FILE/\%/jgandalf} \
62 ${OUTPUT_FILE/\%/jstart2} \
63 ${OUTPUT_FILE/\%/jenergy} \
64 ${OUTPUT_FILE/\%/jhistory} \
65 ${OUTPUT_FILE/\%/${SUFFIX}} \
66 ${OUTPUT_FILE/\%/${SUFFIX}.offline}
67fi
68
69
70# ------------------------------------------------------------------------------------------
71# JMuonPrefit
72# ------------------------------------------------------------------------------------------
73
74PARAMETERS=(
75 sigma_ns 5.0
76 gridAngle_deg 4.0
77 useL0 1
78 numberOfOutliers 2
79 numberOfPrefits 60
80 numberOfPostfits 20
81 TMaxLocal_ns 12.0
82 ctMin 0.0
83 roadWidth_m 50.0
84 Qwatershed 1.5)
85
86timer_start
87
88eval JMuonPrefit \
89 -a $DETECTOR \
90 -+${^CALIBRATION} \
91 -T $TMAX_S \
92 -f $INPUT_FILE \
93 -o ${OUTPUT_FILE/\%/jprefit} \
94 -n ${NUMBER_OF_EVENTS} \
95 -N ${NUMBER_OF_THREADS} \
96 -@ `make_equation PARAMETERS` \
97 -d $DEBUG --!
98
99CHECK_EXIT_CODE
100
101APPLICATIONS+=$JMUONPREFIT
102
103timer_stop
104timer_print
105
106
107# ------------------------------------------------------------------------------------------
108# JMuonSimplex
109# ------------------------------------------------------------------------------------------
110
111PARAMETERS=(
112 sigma_ns 3.0
113 TMaxLocal_ns 15.0
114 ctMin 0.0
115 roadWidth_m 50.0
116 numberOfPrefits 0)
117
118timer_start
119
120eval JMuonSimplex \
121 -a $DETECTOR \
122 -+${^CALIBRATION} \
123 -T $TMAX_S \
124 -f ${OUTPUT_FILE/\%/jprefit} \
125 -o ${OUTPUT_FILE/\%/jsimplex} \
126 -N ${NUMBER_OF_THREADS} \
127 -@ `make_equation PARAMETERS` \
128 -d $DEBUG --!
129
130CHECK_EXIT_CODE
131
132rm -vf ${OUTPUT_FILE/\%/jprefit}
133
134APPLICATIONS+=$JMUONSIMPLEX
135
136timer_stop
137timer_print
138
139
140# ------------------------------------------------------------------------------------------
141# JMuonStart
142# ------------------------------------------------------------------------------------------
143
144PARAMETERS=(
145 roadWidth_m 50.0
146 R_Hz $RATE_HZ
147 TMin_ns -25.0
148 TMax_ns +25.0
149 Pmin 1.0e-8
150 Pmin1 1.0e-3
151 Pmin2 1.0e-2
152 numberOfPrefits 0)
153
154timer_start
155
156eval JMuonStart \
157 -a $DETECTOR \
158 -+${^CALIBRATION} \
159 -T $TMAX_S \
160 -f ${OUTPUT_FILE/\%/jsimplex} \
161 -o ${OUTPUT_FILE/\%/jstart} \
162 -F $PDF \
163 -N ${NUMBER_OF_THREADS} \
164 -@ `make_equation PARAMETERS` \
165 -d $DEBUG --!
166
167CHECK_EXIT_CODE
168
169rm -vf ${OUTPUT_FILE/\%/jsimplex}
170
171APPLICATIONS+=$JMUONSTART
172
173timer_stop
174timer_print
175
176
177# ------------------------------------------------------------------------------------------
178# JMuonGandalf
179# ------------------------------------------------------------------------------------------
180
181PARAMETERS=(
182 TTS_ns 1.0
183 E_GeV 10.0
184 TMin_ns -50.0
185 TMax_ns +450.0
186 ZMin_m -3.0
187 ZMax_m +9.0
188 R_Hz $RATE_HZ
189 roadWidth_m 50.0
190 cosLR 0.7
191 numberOfPrefits 0)
192
193timer_start
194
195eval JMuonGandalf \
196 -a $DETECTOR \
197 -+${^CALIBRATION} \
198 -T $TMAX_S \
199 -f ${OUTPUT_FILE/\%/jstart} \
200 -o ${OUTPUT_FILE/\%/jgandalf} \
201 -F $PDF \
202 -N ${NUMBER_OF_THREADS} \
203 -@ `make_equation PARAMETERS` \
204 -d $DEBUG --!
205
206CHECK_EXIT_CODE
207
208rm -vf ${OUTPUT_FILE/\%/jstart}
209
210APPLICATIONS+=$JMUONGANDALF
211
212timer_stop
213timer_print
214
215
216# ------------------------------------------------------------------------------------------
217# JMuonStart
218# ------------------------------------------------------------------------------------------
219
220PARAMETERS=(
221 roadWidth_m 50.0
222 R_Hz $RATE_HZ
223 TMin_ns -25.0
224 TMax_ns +25.0
225 Pmin1 1.0e-3
226 Pmin2 1.0e-2
227 numberOfPrefits 1
228 numberOfPostfits 0)
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 -F $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 $RATE_HZ
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 0)
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 -F $PDF \
278 -@ `make_equation PARAMETERS` \
279 -P $PMT \
280 -N ${NUMBER_OF_THREADS} \
281 -d $DEBUG --!
282
283CHECK_EXIT_CODE
284
285rm -vf ${OUTPUT_FILE/\%/jstart2}
286
287APPLICATIONS+=JMUONENERGY
288
289timer_stop
290timer_print
291
292
293# ------------------------------------------------------------------------------------------
294# JHistory
295# ------------------------------------------------------------------------------------------
296
297timer_start
298
299JHistory \
300 -f ${OUTPUT_FILE/\%/jenergy} \
301 -o ${OUTPUT_FILE/\%/jhistory} \
302 -A "$APPLICATIONS[*]" \
303 -d $DEBUG --!
304
305CHECK_EXIT_CODE
306
307rm -vf ${OUTPUT_FILE/\%/jenergy}
308
309timer_stop
310timer_print
311
312
313# ------------------------------------------------------------------------------------------
314# rename outputfile and remove intermediate files
315# ------------------------------------------------------------------------------------------
316
317timer_start
318
319mv -v \
320 ${OUTPUT_FILE/\%/jhistory} \
321 ${OUTPUT_FILE/\%/${SUFFIX}}
322
323timer_stop
324timer_print
325
326
327# ------------------------------------------------------------------------------------------
328# JConvertEvt
329# ------------------------------------------------------------------------------------------
330
331timer_start
332
333JConvertEvt \
334 -f ${OUTPUT_FILE/\%/${SUFFIX}} \
335 -o ${OUTPUT_FILE/\%/${SUFFIX}.offline} \
336 -a $DETECTOR \
337 -+${^CALIBRATION} \
338 -T $TMAX_S \
339 -P $PMT \
340 -d $DEBUG --!
341
342timer_stop
343timer_print