Jpp 20.0.0-rc.2
the software that should make you happy
Loading...
Searching...
No Matches
examples/JReconstruction/JORCAShowerReconstruction.sh
Go to the documentation of this file.
1#!/usr/bin/env zsh
2#
3# \author adomi
4#
5script=${0##*/}
6
7
8# ------------------------------------------------------------------------------------------
9#
10# Script to run the JPP Shower Reconstruction Chain for ORCA.
11#
12# ------------------------------------------------------------------------------------------
13
14
15if [ -z $JPP_DIR ]; then
16 echo "Variable JPP_DIR undefined."
17 exit
18fi
19
20source $JPP_DIR/setenv.sh $JPP_DIR
21
22
23source reconstruction.sh
24
25set_variable: DEBUG RECONSTRUCTION_DEBUG 1
26set_variable: PDF RECONSTRUCTION_PDF $JPP_DATA/J%p.dat
27set_variable: SUFFIX RECONSTRUCTION_SUFFIX jshower
28set_variable: ENERGY_CORRECTION RECONSTRUCTION_ENERGY_CORRECTION energy_correction_showerfit_fullorca.txt
29set_variable: NUMBER_OF_EVENTS RECONSTRUCTION_NUMBER_OF_EVENTS $((2**31))
30set_variable: NUMBER_OF_THREADS RECONSTRUCTION_NUMBER_OF_THREADS 0
31set_variable+ OVERWRITE RECONSTRUCTION_OVERWRITE 1
32set_variable: TMAX_S RECONSTRUCTION_TMAX_S 100
33set_variable: RATE_HZ RECONSTRUCTION_RATE_HZ 6.0e3
34
35if do_usage $*; then
36 usage "$script <detector file> <input file> <output file> <PMT parameters file> [(calibration file)+]"
37fi
38
39set_variable DETECTOR $argv[1]
40set_variable INPUT_FILE $argv[2]
41set_variable OUTPUT_FILE $argv[3]
42set_variable PMT $argv[4]
43set_array CALIBRATION $argv[5,-1]
44
45if [[ ! "$OUTPUT_FILE" == *"%"* ]]; then
46 fatal "The output file must have the wildcard % in the name, e.g. %.root"
47fi
48
49typeset -A PARAMETERS
50typeset -a APPLICATIONS
51
52APPLICATIONS=()
53
54
55if [[ "$OVERWRITE" == 1 ]]; then
56 rm -vf \
57 ${OUTPUT_FILE/\%/jshprefit} \
58 ${OUTPUT_FILE/\%/jshpointsimplex} \
59 ${OUTPUT_FILE/\%/jshpositionfit} \
60 ${OUTPUT_FILE/\%/jshdirectionprefit} \
61 ${OUTPUT_FILE/\%/jshfit} \
62 ${OUTPUT_FILE/\%/jhistory} \
63 ${OUTPUT_FILE/\%/${SUFFIX}} \
64 ${OUTPUT_FILE/\%/${SUFFIX}.offline}
65fi
66
67
68if (( ${#CALIBRATION} != 0 )); then
69 getMechanics.sh $DETECTOR
70fi
71
72
73# ------------------------------------------------------------------------------------------
74# JShowerPrefit
75# ------------------------------------------------------------------------------------------
76
77PARAMETERS=(
78 numberOfPrefits 200
79 numberOfGrids 2
80 factoryLimit 20
81 sigma_ns 2.5
82 numberOfOutliers 4
83 TMaxLocal_ns 10.0
84 TMaxExtra_ns 80.0
85 ctMin -0.3
86 DMax_m 50.0
87 pos_grid_m 10.0
88 pos_step_m 10.0
89 time_grid_ns 50.0
90 time_step_ns 50.0)
91
92timer_start
93
94eval JShowerPrefit \
95 -a $DETECTOR \
96 -+${^CALIBRATION} \
97 -T $TMAX_S \
98 -f $INPUT_FILE \
99 -o ${OUTPUT_FILE/\%/jshprefit} \
100 -n ${NUMBER_OF_EVENTS} \
101 -N ${NUMBER_OF_THREADS} \
102 -@ `make_equation PARAMETERS` \
103 -d ${DEBUG} --!
104
105CHECK_EXIT_CODE
106
107APPLICATIONS+=$JSHOWERPREFIT
108
109timer_stop
110timer_print
111
112
113# ------------------------------------------------------------------------------------------
114# JShowerPointSimplex
115# ------------------------------------------------------------------------------------------
116
117PARAMETERS=(
118 numberOfPrefits 0
119 sigma_ns 2.5
120 TMaxLocal_ns 15.0
121 TMax_ns +60.0
122 TMin_ns -60.0
123 DMax_m 50.0
124 ctMin 0.0
125 mestimator 1)
126
127timer_start
128
129eval JShowerPointSimplex \
130 -a $DETECTOR \
131 -+${^CALIBRATION} \
132 -T $TMAX_S \
133 -N ${NUMBER_OF_THREADS} \
134 -f ${OUTPUT_FILE/\%/jshprefit} \
135 -o ${OUTPUT_FILE/\%/jshpointsimplex} \
136 -@ `make_equation PARAMETERS` \
137 -d ${DEBUG} --!
138
139CHECK_EXIT_CODE
140
141rm -vf ${OUTPUT_FILE/\%/jshprefit}
142
143APPLICATIONS+=$JSHOWERPOINTSIMPLEX
144
145timer_stop
146timer_print
147
148
149# ------------------------------------------------------------------------------------------
150# JShowerPositionFit
151# ------------------------------------------------------------------------------------------
152
153PARAMETERS=(
154 numberOfPrefits 100
155 TMax_ns +120.0
156 TMin_ns -120.0
157 DMax_m 80.0
158 Emin_GeV 1.0
159 Emax_GeV 200.0
160 En 3.0
161 R_Hz $RATE_HZ
162 TTS_ns 2.0)
163
164timer_start
165
166eval JShowerPositionFit \
167 -a $DETECTOR \
168 -+${^CALIBRATION} \
169 -T $TMAX_S \
170 -N ${NUMBER_OF_THREADS} \
171 -f ${OUTPUT_FILE/\%/jshpointsimplex} \
172 -F $PDF \
173 -o ${OUTPUT_FILE/\%/jshpositionfit} \
174 -@ `make_equation PARAMETERS` \
175 -d ${DEBUG} --!
176
177CHECK_EXIT_CODE
178
179rm -vf ${OUTPUT_FILE/\%/jshpointsimplex}
180
181APPLICATIONS+=$JSHOWERPOSITIONFIT
182
183timer_stop
184timer_print
185
186
187
188# ------------------------------------------------------------------------------------------
189# JShowerDirectionPrefit
190# ------------------------------------------------------------------------------------------
191
192PARAMETERS=(
193 numberOfPrefits 1
194 TMax_ns +30.0
195 TMin_ns -30.0
196 DMax_m 60.0
197 R_Hz $RATE_HZ
198 scanAngle_deg 10
199 Emin_GeV 1
200 Emax_GeV 1000
201 En 100)
202
203timer_start
204
205eval JShowerDirectionPrefit \
206 -a $DETECTOR \
207 -+${^CALIBRATION} \
208 -T $TMAX_S \
209 -f ${OUTPUT_FILE/\%/jshpositionfit} \
210 -F $PDF \
211 -o ${OUTPUT_FILE/\%/jshdirectionprefit} \
212 -@ `make_equation PARAMETERS` \
213 -N ${NUMBER_OF_THREADS} \
214 -d $DEBUG --!
215
216CHECK_EXIT_CODE
217
218rm -vf ${OUTPUT_FILE/\%/jshpositionfit}
219
220APPLICATIONS+=$JSHOWERDIRECTIONPREFIT
221
222timer_stop
223timer_print
224
225
226# ------------------------------------------------------------------------------------------
227# JShowerFit
228# ------------------------------------------------------------------------------------------
229
230PARAMETERS=(
231 numberOfPrefits 4
232 TMax_ns +30.0
233 TMin_ns -30.0
234 DMax_m 60.0
235 DStep_m 5
236 R_Hz $RATE_HZ
237 mestimator 3)
238
239timer_start
240
241eval JShowerFit \
242 -a $DETECTOR \
243 -+${^CALIBRATION} \
244 -T $TMAX_S \
245 -f ${OUTPUT_FILE/\%/jshdirectionprefit} \
246 -F $PDF \
247 -N ${NUMBER_OF_THREADS} \
248 -o ${OUTPUT_FILE/\%/jshfit} \
249 -@ `make_equation PARAMETERS` \
250 -E $ENERGY_CORRECTION \
251 -d $DEBUG --!
252
253CHECK_EXIT_CODE
254
255rm -vf ${OUTPUT_FILE/\%/jshdirectionprefit}
256
257APPLICATIONS+=$JSHOWERCOMPLETEFIT
258
259timer_stop
260timer_print
261
262
263# ------------------------------------------------------------------------------------------
264# JHistory
265# ------------------------------------------------------------------------------------------
266
267timer_start
268
269JHistory \
270 -f ${OUTPUT_FILE/\%/jshfit} \
271 -o ${OUTPUT_FILE/\%/jhistory} \
272 -A "$APPLICATIONS[*]" \
273 -d $DEBUG --!
274
275CHECK_EXIT_CODE
276
277rm -vf ${OUTPUT_FILE/\%/jshfit}
278
279timer_stop
280timer_print
281
282
283# ------------------------------------------------------------------------------------------
284# rename outputfile
285# ------------------------------------------------------------------------------------------
286
287timer_start
288
289mv -v \
290 ${OUTPUT_FILE/\%/jhistory} \
291 ${OUTPUT_FILE/\%/${SUFFIX}}
292
293timer_stop
294timer_print
295
296
297# ------------------------------------------------------------------------------------------
298# JConvertEvt
299# ------------------------------------------------------------------------------------------
300
301timer_start
302
303JConvertEvt \
304 -f ${OUTPUT_FILE/\%/${SUFFIX}} \
305 -o ${OUTPUT_FILE/\%/${SUFFIX}.offline} \
306 -a $DETECTOR \
307 -+${^CALIBRATION} \
308 -T $TMAX_S \
309 -P $PMT \
310 -d $DEBUG --!
311
312timer_stop
313timer_print