Jpp master_rocky-44-g75b7c4f75
the software that should make you happy
Loading...
Searching...
No Matches
JORCAShowerReconstruction.sh
Go to the documentation of this file.
1#!/bin/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+ OVERWRITE RECONSTRUCTION_OVERWRITE 1
29set_variable: TMAX_S RECONSTRUCTION_TMAX_S 100
30
31if do_usage $*; then
32 usage "$script <detector file> <input file> <output file> <PMT parameters file> [(calibration file)+]"
33fi
34
35set_variable DETECTOR $argv[1]
36set_variable INPUT_FILE $argv[2]
37set_variable OUTPUT_FILE $argv[3]
38set_variable PMT $argv[4]
39set_array CALIBRATION $argv[5,-1]
40
41if [[ ! "$OUTPUT_FILE" == *"%"* ]]; then
42 fatal "The output file must have the wildcard % in the name, e.g. %.root"
43fi
44
45typeset -A PARAMETERS
46typeset -a APPLICATIONS
47
48APPLICATIONS=()
49
50
51if [[ "$OVERWRITE" == 1 ]]; then
52 rm -vf \
53 ${OUTPUT_FILE/\%/jshprefit} \
54 ${OUTPUT_FILE/\%/jshpointsimplex} \
55 ${OUTPUT_FILE/\%/jshpositionfit} \
56 ${OUTPUT_FILE/\%/jshdirectionprefit} \
57 ${OUTPUT_FILE/\%/jshfit} \
58 ${OUTPUT_FILE/\%/jhistory} \
59 ${OUTPUT_FILE/\%/${SUFFIX}} \
60 ${OUTPUT_FILE/\%/${SUFFIX}.offline}
61fi
62
63
64if (( ${#CALIBRATION} != 0 )); then
65 getMechanics.sh $DETECTOR
66fi
67
68
69# ------------------------------------------------------------------------------------------
70# JShowerPrefit
71# ------------------------------------------------------------------------------------------
72
73PARAMETERS=(
74 numberOfPrefits 200
75 numberOfGrids 2
76 factoryLimit 20
77 sigma_ns 2.5
78 numberOfOutliers 4
79 TMaxLocal_ns 10
80 TMaxExtra_ns 80
81 ctMin -0.3
82 DMax_m 50
83 pos_grid_m 10
84 pos_step_m 10
85 time_grid_ns 50
86 time_step_ns 50)
87
88timer_start
89
90eval JShowerPrefit \
91 -a $DETECTOR \
92 -+${^CALIBRATION} \
93 -T $TMAX_S \
94 -f $INPUT_FILE \
95 -o ${OUTPUT_FILE/\%/jshprefit} \
96 -n ${NUMBER_OF_EVENTS} \
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
116 TMax_ns 60
117 TMin_ns -60
118 DMax_m 50
119 ctMin 0.0
120 mestimator 1)
121
122timer_start
123
124eval JShowerPointSimplex \
125 -a $DETECTOR \
126 -+${^CALIBRATION} \
127 -T $TMAX_S \
128 -f ${OUTPUT_FILE/\%/jshprefit} \
129 -o ${OUTPUT_FILE/\%/jshpointsimplex} \
130 -@ `make_equation PARAMETERS` \
131 -d ${DEBUG} --!
132
133CHECK_EXIT_CODE
134
135rm -vf ${OUTPUT_FILE/\%/jshprefit}
136
137APPLICATIONS+=$JSHOWERPOINTSIMPLEX
138
139timer_stop
140timer_print
141
142
143# ------------------------------------------------------------------------------------------
144# JShowerPositionFit
145# ------------------------------------------------------------------------------------------
146
147PARAMETERS=(
148 numberOfPrefits 100
149 TMax_ns 120
150 TMin_ns -120
151 DMax_m 80
152 Emin_GeV 1
153 Emax_GeV 200
154 En 3
155 R_Hz 10000
156 TTS_ns 2)
157
158timer_start
159
160eval JShowerPositionFit \
161 -a $DETECTOR \
162 -+${^CALIBRATION} \
163 -T $TMAX_S \
164 -f ${OUTPUT_FILE/\%/jshpointsimplex} \
165 -F $PDF \
166 -o ${OUTPUT_FILE/\%/jshpositionfit} \
167 -@ `make_equation PARAMETERS` \
168 -d ${DEBUG} --!
169
170CHECK_EXIT_CODE
171
172rm -vf ${OUTPUT_FILE/\%/jshpointsimplex}
173
174APPLICATIONS+=$JSHOWERPOSITIONFIT
175
176timer_stop
177timer_print
178
179
180
181# ------------------------------------------------------------------------------------------
182# JShowerDirectionPrefit
183# ------------------------------------------------------------------------------------------
184
185PARAMETERS=(
186 numberOfPrefits 1
187 TMax_ns 30
188 TMin_ns -30
189 DMax_m 60
190 R_Hz 10000
191 scanAngle_deg 10
192 Emin_GeV 1
193 Emax_GeV 1000
194 En 100
195)
196
197timer_start
198
199eval JShowerDirectionPrefit \
200 -a $DETECTOR \
201 -+${^CALIBRATION} \
202 -T $TMAX_S \
203 -f ${OUTPUT_FILE/\%/jshpositionfit} \
204 -F $PDF \
205 -o ${OUTPUT_FILE/\%/jshdirectionprefit} \
206 -@ `make_equation PARAMETERS` \
207 -d $DEBUG --!
208
209CHECK_EXIT_CODE
210
211rm -vf ${OUTPUT_FILE/\%/jshpositionfit}
212
213APPLICATIONS+=$JSHOWERDIRECTIONPREFIT
214
215timer_stop
216timer_print
217
218
219# ------------------------------------------------------------------------------------------
220# JShowerFit
221# ------------------------------------------------------------------------------------------
222
223PARAMETERS=(
224 numberOfPrefits 4
225 TMax_ns 30
226 TMin_ns -30
227 DMax_m 60
228 DStep_m 5
229 R_Hz 10000
230 mestimator 3
231 )
232
233timer_start
234
235eval JShowerFit \
236 -a $DETECTOR \
237 -+${^CALIBRATION} \
238 -T $TMAX_S \
239 -f ${OUTPUT_FILE/\%/jshdirectionprefit} \
240 -F $PDF \
241 -o ${OUTPUT_FILE/\%/jshfit} \
242 -@ `make_equation PARAMETERS` \
243 -E $ENERGY_CORRECTION \
244 -d $DEBUG --!
245
246CHECK_EXIT_CODE
247
248rm -vf ${OUTPUT_FILE/\%/jshdirectionprefit}
249
250APPLICATIONS+=$JSHOWERCOMPLETEFIT
251
252timer_stop
253timer_print
254
255
256# ------------------------------------------------------------------------------------------
257# JHistory
258# ------------------------------------------------------------------------------------------
259
260timer_start
261
262JHistory \
263 -f ${OUTPUT_FILE/\%/jshfit} \
264 -o ${OUTPUT_FILE/\%/jhistory} \
265 -A "$APPLICATIONS[*]" \
266 -d $DEBUG --!
267
268CHECK_EXIT_CODE
269
270rm -vf ${OUTPUT_FILE/\%/jshfit}
271
272timer_stop
273timer_print
274
275
276# ------------------------------------------------------------------------------------------
277# rename outputfile
278# ------------------------------------------------------------------------------------------
279
280timer_start
281
282mv -v \
283 ${OUTPUT_FILE/\%/jhistory} \
284 ${OUTPUT_FILE/\%/${SUFFIX}}
285
286timer_stop
287timer_print
288
289
290# ------------------------------------------------------------------------------------------
291# JConvertEvt
292# ------------------------------------------------------------------------------------------
293
294timer_start
295
296JConvertEvt \
297 -f ${OUTPUT_FILE/\%/${SUFFIX}} \
298 -o ${OUTPUT_FILE/\%/${SUFFIX}.offline} \
299 -a $DETECTOR \
300 -+${^CALIBRATION} \
301 -T $TMAX_S \
302 -P $PMT \
303 -d $DEBUG --!
304
305timer_stop
306timer_print