Jpp 20.0.0-195-g190c9e876
the software that should make you happy
Loading...
Searching...
No Matches
examples/JReconstruction/JARCAMuonReconstruction.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 ARCA.
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: ENERGY_CORRECTION RECONSTRUCTION_ENERGY_CORRECTION energy_correction_arca.root
27set_variable: NUMBER_OF_EVENTS RECONSTRUCTION_NUMBER_OF_EVENTS $((2**31))
28set_variable: NUMBER_OF_THREADS RECONSTRUCTION_NUMBER_OF_THREADS 0
29set_variable+ OVERWRITE RECONSTRUCTION_OVERWRITE 1
30set_variable: TMAX_S RECONSTRUCTION_TMAX_S 100
31set_variable: RATE_HZ RECONSTRUCTION_RATE_HZ 6.0e3
32
33if do_usage $*; then
34 usage "$script <detector file> <input file> <output file> <PMT parameters file> [(calibration file)+]"
35fi
36
37if (( $# < 4 )); then
38 fatal "Wrong number of arguments."
39fi
40
41set_variable DETECTOR $argv[1]
42set_variable INPUT_FILE $argv[2]
43set_variable OUTPUT_FILE $argv[3]
44set_variable PMT $argv[4]
45set_array CALIBRATION $argv[5,-1]
46
47if [[ ! "$OUTPUT_FILE" == *"%"* ]]; then
48 fatal "The output file must have the wildcard % in the name, e.g. %.root"
49fi
50
51typeset -A PARAMETERS
52typeset -a APPLICATIONS
53
54APPLICATIONS=()
55
56
57if [[ "$OVERWRITE" == 1 ]]; then
58 rm -vf \
59 ${OUTPUT_FILE/\%/jprefit} \
60 ${OUTPUT_FILE/\%/jsimplex} \
61 ${OUTPUT_FILE/\%/jgandalf} \
62 ${OUTPUT_FILE/\%/jstart} \
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 1.0
77 useL0 0
78 numberOfOutliers 3
79 numberOfPrefits 60
80 numberOfPostfits 20
81 TMaxLocal_ns 18.0
82 ctMin 0.0
83 roadWidth_m 200.0)
84
85timer_start
86
87eval JMuonPrefit \
88 -a $DETECTOR \
89 -+${^CALIBRATION} \
90 -T $TMAX_S \
91 -f $INPUT_FILE \
92 -o ${OUTPUT_FILE/\%/jprefit} \
93 -n ${NUMBER_OF_EVENTS} \
94 -N ${NUMBER_OF_THREADS} \
95 -@ `make_equation PARAMETERS` \
96 -d $DEBUG --!
97
98CHECK_EXIT_CODE
99
100APPLICATIONS+=$JMUONPREFIT
101
102timer_stop
103timer_print
104
105
106# ------------------------------------------------------------------------------------------
107# JMuonSimplex
108# ------------------------------------------------------------------------------------------
109
110PARAMETERS=(
111 sigma_ns 3.0
112 TMaxLocal_ns 15.0
113 ctMin 0.0
114 roadWidth_m 200.0
115 numberOfPrefits 0)
116
117timer_start
118
119eval JMuonSimplex \
120 -a $DETECTOR \
121 -+${^CALIBRATION} \
122 -T $TMAX_S \
123 -f ${OUTPUT_FILE/\%/jprefit} \
124 -o ${OUTPUT_FILE/\%/jsimplex} \
125 -N ${NUMBER_OF_THREADS} \
126 -@ `make_equation PARAMETERS` \
127 -d $DEBUG --!
128
129CHECK_EXIT_CODE
130
131rm -vf ${OUTPUT_FILE/\%/jprefit}
132
133APPLICATIONS+=$JMUONSIMPLEX
134
135timer_stop
136timer_print
137
138
139# ------------------------------------------------------------------------------------------
140# JMuonGandalf
141# ------------------------------------------------------------------------------------------
142
143PARAMETERS=(
144 TTS_ns 1.0
145 E_GeV 1.0e3
146 TMin_ns -50.0
147 TMax_ns +450.0
148 R_Hz $RATE_HZ
149 roadWidth_m 175.0
150 cosLR 0.7
151 numberOfPrefits 0)
152
153timer_start
154
155eval JMuonGandalf \
156 -a $DETECTOR \
157 -+${^CALIBRATION} \
158 -T $TMAX_S \
159 -f ${OUTPUT_FILE/\%/jsimplex} \
160 -o ${OUTPUT_FILE/\%/jgandalf} \
161 -F $PDF \
162 -N ${NUMBER_OF_THREADS} \
163 -@ `make_equation PARAMETERS` \
164 -d $DEBUG --!
165
166CHECK_EXIT_CODE
167
168rm -vf ${OUTPUT_FILE/\%/jsimplex}
169
170APPLICATIONS+=$JMUONGANDALF
171
172timer_stop
173timer_print
174
175
176# ------------------------------------------------------------------------------------------
177# JMuonStart
178# ------------------------------------------------------------------------------------------
179
180PARAMETERS=(
181 roadWidth_m 160.0
182 R_Hz $RATE_HZ
183 TMin_ns -25.0
184 TMax_ns +75.0
185 Pmin 1.0e-8
186 Pmin1 2.0e-4
187 Pmin2 1.0e-2
188 numberOfPrefits 1
189 numberOfPostfits 0)
190
191timer_start
192
193eval JMuonStart \
194 -a $DETECTOR \
195 -+${^CALIBRATION} \
196 -T $TMAX_S \
197 -f ${OUTPUT_FILE/\%/jgandalf} \
198 -o ${OUTPUT_FILE/\%/jstart} \
199 -F $PDF \
200 -N ${NUMBER_OF_THREADS} \
201 -@ `make_equation PARAMETERS` \
202 -d $DEBUG --!
203
204CHECK_EXIT_CODE
205
206rm -vf ${OUTPUT_FILE/\%/jgandalf}
207
208APPLICATIONS+=$JMUONSTART
209
210timer_stop
211timer_print
212
213
214# ------------------------------------------------------------------------------------------
215# JMuonEnergy
216# ------------------------------------------------------------------------------------------
217
218PARAMETERS=(
219 roadWidth_m 300.0
220 R_Hz $RATE_HZ
221 EMin_log 0.0
222 EMax_log 8.0
223 TMin_ns -50.0
224 TMax_ns +450.0
225 mestimator 1
226 numberOfPrefits 0)
227
228timer_start
229
230eval JMuonEnergy \
231 -a $DETECTOR \
232 -+${^CALIBRATION} \
233 -T $TMAX_S \
234 -f ${OUTPUT_FILE/\%/jstart} \
235 -o ${OUTPUT_FILE/\%/jenergy} \
236 -F $PDF \
237 -E $ENERGY_CORRECTION \
238 -@ `make_equation PARAMETERS` \
239 -P $PMT \
240 -N ${NUMBER_OF_THREADS} \
241 -d $DEBUG --!
242
243CHECK_EXIT_CODE
244
245rm -vf ${OUTPUT_FILE/\%/jstart}
246
247APPLICATIONS+=$JMUONENERGY
248
249timer_stop
250timer_print
251
252
253# ------------------------------------------------------------------------------------------
254# JHistory
255# ------------------------------------------------------------------------------------------
256
257timer_start
258
259JHistory \
260 -f ${OUTPUT_FILE/\%/jenergy} \
261 -o ${OUTPUT_FILE/\%/jhistory} \
262 -A "$APPLICATIONS[*]" \
263 -d $DEBUG --!
264
265CHECK_EXIT_CODE
266
267rm -vf ${OUTPUT_FILE/\%/jenergy}
268
269timer_stop
270timer_print
271
272
273# ------------------------------------------------------------------------------------------
274# rename outputfile and remove intermediate files
275# ------------------------------------------------------------------------------------------
276
277timer_start
278
279mv -v \
280 ${OUTPUT_FILE/\%/jhistory} \
281 ${OUTPUT_FILE/\%/${SUFFIX}}
282
283timer_stop
284timer_print
285
286
287# ------------------------------------------------------------------------------------------
288# JConvertEvt
289# ------------------------------------------------------------------------------------------
290
291timer_start
292
293JConvertEvt \
294 -f ${OUTPUT_FILE/\%/${SUFFIX}} \
295 -o ${OUTPUT_FILE/\%/${SUFFIX}.offline} \
296 -a $DETECTOR \
297 -+${^CALIBRATION} \
298 -T $TMAX_S \
299 -P $PMT \
300 -d $DEBUG --!
301
302timer_stop
303timer_print