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