Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
software/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
21source $JPP_DIR/externals/km3net-dataformat/definitions/reconstruction.sh
22
23set_variable: DEBUG RECONSTRUCTION_DEBUG 1
24set_variable: PDF RECONSTRUCTION_PDF $JPP_DATA/J%p.dat
25set_variable: SUFFIX RECONSTRUCTION_SUFFIX jshower
26set_variable: ENERGY_CORRECTION RECONSTRUCTION_ENERGY_CORRECTION energy_correction_showerfit_fullorca.txt
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
31
32if do_usage $*; then
33 usage "$script <detector file> <input file> <output file> <PMT parameters file> [(calibration file)+]"
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/\%/jshprefit} \
55 ${OUTPUT_FILE/\%/jshpointsimplex} \
56 ${OUTPUT_FILE/\%/jshpositionfit} \
57 ${OUTPUT_FILE/\%/jshdirectionprefit} \
58 ${OUTPUT_FILE/\%/jshfit} \
59 ${OUTPUT_FILE/\%/jhistory} \
60 ${OUTPUT_FILE/\%/${SUFFIX}} \
61 ${OUTPUT_FILE/\%/${SUFFIX}.offline}
62fi
63
64
65if (( ${#CALIBRATION} != 0 )); then
66 getMechanics.sh $DETECTOR
67fi
68
69
70# ------------------------------------------------------------------------------------------
71# JShowerPrefit
72# ------------------------------------------------------------------------------------------
73
74PARAMETERS=(
75 numberOfPrefits 200
76 numberOfGrids 2
77 factoryLimit 20
78 sigma_ns 2.5
79 numberOfOutliers 4
80 TMaxLocal_ns 10
81 TMaxExtra_ns 80
82 ctMin -0.3
83 DMax_m 50
84 pos_grid_m 10
85 pos_step_m 10
86 time_grid_ns 50
87 time_step_ns 50)
88
89timer_start
90
91eval JShowerPrefit \
92 -a $DETECTOR \
93 -+${^CALIBRATION} \
94 -T $TMAX_S \
95 -f $INPUT_FILE \
96 -o ${OUTPUT_FILE/\%/jshprefit} \
97 -n ${NUMBER_OF_EVENTS} \
98 -N ${NUMBER_OF_THREADS} \
99 -@ `make_equation PARAMETERS` \
100 -d ${DEBUG} --!
101
102CHECK_EXIT_CODE
103
104APPLICATIONS+=$JSHOWERPREFIT
105
106timer_stop
107timer_print
108
109
110# ------------------------------------------------------------------------------------------
111# JShowerPointSimplex
112# ------------------------------------------------------------------------------------------
113
114PARAMETERS=(
115 numberOfPrefits 0
116 sigma_ns 2.5
117 TMaxLocal_ns 15
118 TMax_ns 60
119 TMin_ns -60
120 DMax_m 50
121 ctMin 0.0
122 mestimator 1)
123
124timer_start
125
126eval JShowerPointSimplex \
127 -a $DETECTOR \
128 -+${^CALIBRATION} \
129 -T $TMAX_S \
130 -N ${NUMBER_OF_THREADS} \
131 -f ${OUTPUT_FILE/\%/jshprefit} \
132 -o ${OUTPUT_FILE/\%/jshpointsimplex} \
133 -@ `make_equation PARAMETERS` \
134 -d ${DEBUG} --!
135
136CHECK_EXIT_CODE
137
138rm -vf ${OUTPUT_FILE/\%/jshprefit}
139
140APPLICATIONS+=$JSHOWERPOINTSIMPLEX
141
142timer_stop
143timer_print
144
145
146# ------------------------------------------------------------------------------------------
147# JShowerPositionFit
148# ------------------------------------------------------------------------------------------
149
150PARAMETERS=(
151 numberOfPrefits 100
152 TMax_ns 120
153 TMin_ns -120
154 DMax_m 80
155 Emin_GeV 1
156 Emax_GeV 200
157 En 3
158 R_Hz 10000
159 TTS_ns 2)
160
161timer_start
162
163eval JShowerPositionFit \
164 -a $DETECTOR \
165 -+${^CALIBRATION} \
166 -T $TMAX_S \
167 -N ${NUMBER_OF_THREADS} \
168 -f ${OUTPUT_FILE/\%/jshpointsimplex} \
169 -P $PDF \
170 -o ${OUTPUT_FILE/\%/jshpositionfit} \
171 -@ `make_equation PARAMETERS` \
172 -d ${DEBUG} --!
173
174CHECK_EXIT_CODE
175
176rm -vf ${OUTPUT_FILE/\%/jshpointsimplex}
177
178APPLICATIONS+=$JSHOWERPOSITIONFIT
179
180timer_stop
181timer_print
182
183
184
185# ------------------------------------------------------------------------------------------
186# JShowerDirectionPrefit
187# ------------------------------------------------------------------------------------------
188
189PARAMETERS=(
190 numberOfPrefits 1
191 TMax_ns 30
192 TMin_ns -30
193 DMax_m 60
194 R_Hz 10000
195 scanAngle_deg 10
196 Emin_GeV 1
197 Emax_GeV 1000
198 En 100
199)
200
201timer_start
202
203eval JShowerDirectionPrefit \
204 -a $DETECTOR \
205 -+${^CALIBRATION} \
206 -T $TMAX_S \
207 -f ${OUTPUT_FILE/\%/jshpositionfit} \
208 -P $PDF \
209 -o ${OUTPUT_FILE/\%/jshdirectionprefit} \
210 -@ `make_equation PARAMETERS` \
211 -N ${NUMBER_OF_THREADS} \
212 -d $DEBUG --!
213
214CHECK_EXIT_CODE
215
216rm -vf ${OUTPUT_FILE/\%/jshpositionfit}
217
218APPLICATIONS+=$JSHOWERDIRECTIONPREFIT
219
220timer_stop
221timer_print
222
223
224# ------------------------------------------------------------------------------------------
225# JShowerFit
226# ------------------------------------------------------------------------------------------
227
228PARAMETERS=(
229 numberOfPrefits 4
230 TMax_ns 30
231 TMin_ns -30
232 DMax_m 60
233 DStep_m 5
234 R_Hz 10000
235 mestimator 3
236 )
237
238timer_start
239
240eval JShowerFit \
241 -a $DETECTOR \
242 -+${^CALIBRATION} \
243 -T $TMAX_S \
244 -f ${OUTPUT_FILE/\%/jshdirectionprefit} \
245 -P $PDF \
246 -N ${NUMBER_OF_THREADS} \
247 -o ${OUTPUT_FILE/\%/jshfit} \
248 -@ `make_equation PARAMETERS` \
249 -E $ENERGY_CORRECTION \
250 -d $DEBUG --!
251
252CHECK_EXIT_CODE
253
254rm -vf ${OUTPUT_FILE/\%/jshdirectionprefit}
255
256APPLICATIONS+=$JSHOWERCOMPLETEFIT
257
258timer_stop
259timer_print
260
261
262# ------------------------------------------------------------------------------------------
263# JHistory
264# ------------------------------------------------------------------------------------------
265
266timer_start
267
268JHistory \
269 -f ${OUTPUT_FILE/\%/jshfit} \
270 -o ${OUTPUT_FILE/\%/jhistory} \
271 -A "$APPLICATIONS[*]" \
272 -d $DEBUG --!
273
274CHECK_EXIT_CODE
275
276rm -vf ${OUTPUT_FILE/\%/jshfit}
277
278timer_stop
279timer_print
280
281
282# ------------------------------------------------------------------------------------------
283# rename outputfile
284# ------------------------------------------------------------------------------------------
285
286timer_start
287
288mv -v \
289 ${OUTPUT_FILE/\%/jhistory} \
290 ${OUTPUT_FILE/\%/${SUFFIX}}
291
292timer_stop
293timer_print
294
295
296# ------------------------------------------------------------------------------------------
297# JConvertEvt
298# ------------------------------------------------------------------------------------------
299
300timer_start
301
302JConvertEvt \
303 -f ${OUTPUT_FILE/\%/${SUFFIX}} \
304 -o ${OUTPUT_FILE/\%/${SUFFIX}.offline} \
305 -a $DETECTOR \
306 -+${^CALIBRATION} \
307 -T $TMAX_S \
308 -P $PMT \
309 -d $DEBUG --!
310
311timer_stop
312timer_print