Jpp 20.0.0-195-g190c9e876
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.gz
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
68# ------------------------------------------------------------------------------------------
69# JShowerPrefit
70# ------------------------------------------------------------------------------------------
71
72PARAMETERS=(
73 numberOfPrefits 200
74 numberOfGrids 2
75 factoryLimit 20
76 sigma_ns 2.5
77 numberOfOutliers 4
78 TMaxLocal_ns 10.0
79 TMaxExtra_ns 80.0
80 ctMin -0.3
81 DMax_m 50.0
82 pos_grid_m 10.0
83 pos_step_m 10.0
84 time_grid_ns 50.0
85 time_step_ns 50.0)
86
87timer_start
88
89eval JShowerPrefit \
90 -a $DETECTOR \
91 -+${^CALIBRATION} \
92 -T $TMAX_S \
93 -f $INPUT_FILE \
94 -o ${OUTPUT_FILE/\%/jshprefit} \
95 -n ${NUMBER_OF_EVENTS} \
96 -N ${NUMBER_OF_THREADS} \
97 -@ `make_equation PARAMETERS` \
98 -d ${DEBUG} --!
99
100CHECK_EXIT_CODE
101
102APPLICATIONS+=$JSHOWERPREFIT
103
104timer_stop
105timer_print
106
107
108# ------------------------------------------------------------------------------------------
109# JShowerPointSimplex
110# ------------------------------------------------------------------------------------------
111
112PARAMETERS=(
113 numberOfPrefits 0
114 sigma_ns 2.5
115 TMaxLocal_ns 15.0
116 TMax_ns +60.0
117 TMin_ns -60.0
118 DMax_m 50.0
119 ctMin 0.0
120 mestimator 1)
121
122timer_start
123
124eval JShowerPointSimplex \
125 -a $DETECTOR \
126 -+${^CALIBRATION} \
127 -T $TMAX_S \
128 -N ${NUMBER_OF_THREADS} \
129 -f ${OUTPUT_FILE/\%/jshprefit} \
130 -o ${OUTPUT_FILE/\%/jshpointsimplex} \
131 -@ `make_equation PARAMETERS` \
132 -d ${DEBUG} --!
133
134CHECK_EXIT_CODE
135
136rm -vf ${OUTPUT_FILE/\%/jshprefit}
137
138APPLICATIONS+=$JSHOWERPOINTSIMPLEX
139
140timer_stop
141timer_print
142
143
144# ------------------------------------------------------------------------------------------
145# JShowerPositionFit
146# ------------------------------------------------------------------------------------------
147
148PARAMETERS=(
149 numberOfPrefits 100
150 TMax_ns +120.0
151 TMin_ns -120.0
152 DMax_m 80.0
153 Emin_GeV 1.0
154 Emax_GeV 200.0
155 En 3.0
156 R_Hz $RATE_HZ
157 TTS_ns 2.0)
158
159timer_start
160
161eval JShowerPositionFit \
162 -a $DETECTOR \
163 -+${^CALIBRATION} \
164 -T $TMAX_S \
165 -N ${NUMBER_OF_THREADS} \
166 -f ${OUTPUT_FILE/\%/jshpointsimplex} \
167 -F $PDF \
168 -o ${OUTPUT_FILE/\%/jshpositionfit} \
169 -@ `make_equation PARAMETERS` \
170 -d ${DEBUG} --!
171
172CHECK_EXIT_CODE
173
174rm -vf ${OUTPUT_FILE/\%/jshpointsimplex}
175
176APPLICATIONS+=$JSHOWERPOSITIONFIT
177
178timer_stop
179timer_print
180
181
182
183# ------------------------------------------------------------------------------------------
184# JShowerDirectionPrefit
185# ------------------------------------------------------------------------------------------
186
187PARAMETERS=(
188 numberOfPrefits 1
189 TMax_ns +30.0
190 TMin_ns -30.0
191 DMax_m 60.0
192 R_Hz $RATE_HZ
193 scanAngle_deg 10
194 Emin_GeV 1
195 Emax_GeV 1000
196 En 100)
197
198timer_start
199
200eval JShowerDirectionPrefit \
201 -a $DETECTOR \
202 -+${^CALIBRATION} \
203 -T $TMAX_S \
204 -f ${OUTPUT_FILE/\%/jshpositionfit} \
205 -F $PDF \
206 -o ${OUTPUT_FILE/\%/jshdirectionprefit} \
207 -@ `make_equation PARAMETERS` \
208 -N ${NUMBER_OF_THREADS} \
209 -d $DEBUG --!
210
211CHECK_EXIT_CODE
212
213rm -vf ${OUTPUT_FILE/\%/jshpositionfit}
214
215APPLICATIONS+=$JSHOWERDIRECTIONPREFIT
216
217timer_stop
218timer_print
219
220
221# ------------------------------------------------------------------------------------------
222# JShowerFit
223# ------------------------------------------------------------------------------------------
224
225PARAMETERS=(
226 numberOfPrefits 4
227 TMax_ns +30.0
228 TMin_ns -30.0
229 DMax_m 60.0
230 DStep_m 5
231 R_Hz $RATE_HZ
232 mestimator 3)
233
234timer_start
235
236eval JShowerFit \
237 -a $DETECTOR \
238 -+${^CALIBRATION} \
239 -T $TMAX_S \
240 -f ${OUTPUT_FILE/\%/jshdirectionprefit} \
241 -F $PDF \
242 -N ${NUMBER_OF_THREADS} \
243 -o ${OUTPUT_FILE/\%/jshfit} \
244 -@ `make_equation PARAMETERS` \
245 -E $ENERGY_CORRECTION \
246 -d $DEBUG --!
247
248CHECK_EXIT_CODE
249
250rm -vf ${OUTPUT_FILE/\%/jshdirectionprefit}
251
252APPLICATIONS+=$JSHOWERCOMPLETEFIT
253
254timer_stop
255timer_print
256
257
258# ------------------------------------------------------------------------------------------
259# JHistory
260# ------------------------------------------------------------------------------------------
261
262timer_start
263
264JHistory \
265 -f ${OUTPUT_FILE/\%/jshfit} \
266 -o ${OUTPUT_FILE/\%/jhistory} \
267 -A "$APPLICATIONS[*]" \
268 -d $DEBUG --!
269
270CHECK_EXIT_CODE
271
272rm -vf ${OUTPUT_FILE/\%/jshfit}
273
274timer_stop
275timer_print
276
277
278# ------------------------------------------------------------------------------------------
279# rename outputfile
280# ------------------------------------------------------------------------------------------
281
282timer_start
283
284mv -v \
285 ${OUTPUT_FILE/\%/jhistory} \
286 ${OUTPUT_FILE/\%/${SUFFIX}}
287
288timer_stop
289timer_print
290
291
292# ------------------------------------------------------------------------------------------
293# JConvertEvt
294# ------------------------------------------------------------------------------------------
295
296timer_start
297
298JConvertEvt \
299 -f ${OUTPUT_FILE/\%/${SUFFIX}} \
300 -o ${OUTPUT_FILE/\%/${SUFFIX}.offline} \
301 -a $DETECTOR \
302 -+${^CALIBRATION} \
303 -T $TMAX_S \
304 -P $PMT \
305 -d $DEBUG --!
306
307timer_stop
308timer_print