Jpp 20.0.0-rc.2
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
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
69if (( ${#CALIBRATION} != 0 )); then
70 getMechanics.sh $DETECTOR
71fi
72
73
74# ------------------------------------------------------------------------------------------
75# JMuonPrefit
76# ------------------------------------------------------------------------------------------
77
78PARAMETERS=(
79 sigma_ns 5.0
80 gridAngle_deg 1.0
81 useL0 0
82 numberOfOutliers 3
83 numberOfPrefits 60
84 numberOfPostfits 20
85 TMaxLocal_ns 18.0
86 ctMin 0.0
87 roadWidth_m 200.0)
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.0
116 TMaxLocal_ns 15.0
117 ctMin 0.0
118 roadWidth_m 200.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# JMuonGandalf
145# ------------------------------------------------------------------------------------------
146
147PARAMETERS=(
148 TTS_ns 1.0
149 E_GeV 1.0e3
150 TMin_ns -50.0
151 TMax_ns +450.0
152 R_Hz $RATE_HZ
153 roadWidth_m 175.0
154 cosLR 0.7
155 numberOfPrefits 0)
156
157timer_start
158
159eval JMuonGandalf \
160 -a $DETECTOR \
161 -+${^CALIBRATION} \
162 -T $TMAX_S \
163 -f ${OUTPUT_FILE/\%/jsimplex} \
164 -o ${OUTPUT_FILE/\%/jgandalf} \
165 -F $PDF \
166 -N ${NUMBER_OF_THREADS} \
167 -@ `make_equation PARAMETERS` \
168 -d $DEBUG --!
169
170CHECK_EXIT_CODE
171
172rm -vf ${OUTPUT_FILE/\%/jsimplex}
173
174APPLICATIONS+=$JMUONGANDALF
175
176timer_stop
177timer_print
178
179
180# ------------------------------------------------------------------------------------------
181# JMuonStart
182# ------------------------------------------------------------------------------------------
183
184PARAMETERS=(
185 roadWidth_m 160.0
186 R_Hz $RATE_HZ
187 TMin_ns -25.0
188 TMax_ns +75.0
189 Pmin 1.0e-8
190 Pmin1 2.0e-4
191 Pmin2 1.0e-2
192 numberOfPrefits 1
193 numberOfPostfits 0)
194
195timer_start
196
197eval JMuonStart \
198 -a $DETECTOR \
199 -+${^CALIBRATION} \
200 -T $TMAX_S \
201 -f ${OUTPUT_FILE/\%/jgandalf} \
202 -o ${OUTPUT_FILE/\%/jstart} \
203 -F $PDF \
204 -N ${NUMBER_OF_THREADS} \
205 -@ `make_equation PARAMETERS` \
206 -d $DEBUG --!
207
208CHECK_EXIT_CODE
209
210rm -vf ${OUTPUT_FILE/\%/jgandalf}
211
212APPLICATIONS+=$JMUONSTART
213
214timer_stop
215timer_print
216
217
218# ------------------------------------------------------------------------------------------
219# JMuonEnergy
220# ------------------------------------------------------------------------------------------
221
222PARAMETERS=(
223 roadWidth_m 300.0
224 R_Hz $RATE_HZ
225 EMin_log 0.0
226 EMax_log 8.0
227 TMin_ns -50.0
228 TMax_ns +450.0
229 mestimator 1
230 numberOfPrefits 0)
231
232timer_start
233
234eval JMuonEnergy \
235 -a $DETECTOR \
236 -+${^CALIBRATION} \
237 -T $TMAX_S \
238 -f ${OUTPUT_FILE/\%/jstart} \
239 -o ${OUTPUT_FILE/\%/jenergy} \
240 -F $PDF \
241 -E $ENERGY_CORRECTION \
242 -@ `make_equation PARAMETERS` \
243 -P $PMT \
244 -N ${NUMBER_OF_THREADS} \
245 -d $DEBUG --!
246
247CHECK_EXIT_CODE
248
249rm -vf ${OUTPUT_FILE/\%/jstart}
250
251APPLICATIONS+=$JMUONENERGY
252
253timer_stop
254timer_print
255
256
257# ------------------------------------------------------------------------------------------
258# JHistory
259# ------------------------------------------------------------------------------------------
260
261timer_start
262
263JHistory \
264 -f ${OUTPUT_FILE/\%/jenergy} \
265 -o ${OUTPUT_FILE/\%/jhistory} \
266 -A "$APPLICATIONS[*]" \
267 -d $DEBUG --!
268
269CHECK_EXIT_CODE
270
271rm -vf ${OUTPUT_FILE/\%/jenergy}
272
273timer_stop
274timer_print
275
276
277# ------------------------------------------------------------------------------------------
278# rename outputfile and remove intermediate files
279# ------------------------------------------------------------------------------------------
280
281timer_start
282
283mv -v \
284 ${OUTPUT_FILE/\%/jhistory} \
285 ${OUTPUT_FILE/\%/${SUFFIX}}
286
287timer_stop
288timer_print
289
290
291# ------------------------------------------------------------------------------------------
292# JConvertEvt
293# ------------------------------------------------------------------------------------------
294
295timer_start
296
297JConvertEvt \
298 -f ${OUTPUT_FILE/\%/${SUFFIX}} \
299 -o ${OUTPUT_FILE/\%/${SUFFIX}.offline} \
300 -a $DETECTOR \
301 -+${^CALIBRATION} \
302 -T $TMAX_S \
303 -P $PMT \
304 -d $DEBUG --!
305
306timer_stop
307timer_print