Jpp  debug
the software that should make you happy
JORCAShowerReconstruction.sh
Go to the documentation of this file.
1 #!/bin/zsh
2 #
3 # \author adomi
4 #
5 script=${0##*/}
6 
7 
8 # ------------------------------------------------------------------------------------------
9 #
10 # Script to run the JPP Shower Reconstruction Chain for ORCA.
11 #
12 # ------------------------------------------------------------------------------------------
13 
14 
15 if [ -z $JPP_DIR ]; then
16  echo "Variable JPP_DIR undefined."
17  exit
18 fi
19 
20 source $JPP_DIR/setenv.sh $JPP_DIR
21 source $JPP_DIR/externals/km3net-dataformat/definitions/reconstruction.sh
22 
23 set_variable: DEBUG RECONSTRUCTION_DEBUG 1
24 set_variable: PDF RECONSTRUCTION_PDF $JPP_DATA/J%p.dat
25 set_variable: SUFFIX RECONSTRUCTION_SUFFIX jshower
26 set_variable: ENERGY_CORRECTION RECONSTRUCTION_ENERGY_CORRECTION energy_correction_showerfit_fullorca.txt
27 set_variable: NUMBER_OF_EVENTS RECONSTRUCTION_NUMBER_OF_EVENTS $((2**31))
28 set_variable+ OVERWRITE RECONSTRUCTION_OVERWRITE 1
29 set_variable: TMAX_S RECONSTRUCTION_TMAX_S 100
30 
31 if do_usage $*; then
32  usage "$script <detector file> <input file> <output file> <PMT parameters file> [(calibration file)+]"
33 fi
34 
35 set_variable DETECTOR $argv[1]
36 set_variable INPUT_FILE $argv[2]
37 set_variable OUTPUT_FILE $argv[3]
38 set_variable PMT $argv[4]
39 set_array CALIBRATION $argv[5,-1]
40 
41 if [[ ! "$OUTPUT_FILE" == *"%"* ]]; then
42  fatal "The output file must have the wildcard % in the name, e.g. %.root"
43 fi
44 
45 typeset -A PARAMETERS
46 typeset -a APPLICATIONS
47 
48 APPLICATIONS=()
49 
50 
51 if [[ "$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}
61 fi
62 
63 
64 if (( ${#CALIBRATION} != 0 )); then
65  getMechanics.sh $DETECTOR
66 fi
67 
68 
69 # ------------------------------------------------------------------------------------------
70 # JShowerPrefit
71 # ------------------------------------------------------------------------------------------
72 
73 PARAMETERS=(
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 
88 timer_start
89 
90 eval 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 
100 CHECK_EXIT_CODE
101 
102 APPLICATIONS+=$JSHOWERPREFIT
103 
104 timer_stop
105 timer_print
106 
107 
108 # ------------------------------------------------------------------------------------------
109 # JShowerPointSimplex
110 # ------------------------------------------------------------------------------------------
111 
112 PARAMETERS=(
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 
122 timer_start
123 
124 eval 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 
133 CHECK_EXIT_CODE
134 
135 rm -vf ${OUTPUT_FILE/\%/jshprefit}
136 
137 APPLICATIONS+=$JSHOWERPOINTSIMPLEX
138 
139 timer_stop
140 timer_print
141 
142 
143 # ------------------------------------------------------------------------------------------
144 # JShowerPositionFit
145 # ------------------------------------------------------------------------------------------
146 
147 PARAMETERS=(
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 
158 timer_start
159 
160 eval 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 
170 CHECK_EXIT_CODE
171 
172 rm -vf ${OUTPUT_FILE/\%/jshpointsimplex}
173 
174 APPLICATIONS+=$JSHOWERPOSITIONFIT
175 
176 timer_stop
177 timer_print
178 
179 
180 
181 # ------------------------------------------------------------------------------------------
182 # JShowerDirectionPrefit
183 # ------------------------------------------------------------------------------------------
184 
185 PARAMETERS=(
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 
197 timer_start
198 
199 eval 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 
209 CHECK_EXIT_CODE
210 
211 rm -vf ${OUTPUT_FILE/\%/jshpositionfit}
212 
213 APPLICATIONS+=$JSHOWERDIRECTIONPREFIT
214 
215 timer_stop
216 timer_print
217 
218 
219 # ------------------------------------------------------------------------------------------
220 # JShowerFit
221 # ------------------------------------------------------------------------------------------
222 
223 PARAMETERS=(
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 
233 timer_start
234 
235 eval 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 
246 CHECK_EXIT_CODE
247 
248 rm -vf ${OUTPUT_FILE/\%/jshdirectionprefit}
249 
250 APPLICATIONS+=$JSHOWERCOMPLETEFIT
251 
252 timer_stop
253 timer_print
254 
255 
256 # ------------------------------------------------------------------------------------------
257 # JHistory
258 # ------------------------------------------------------------------------------------------
259 
260 timer_start
261 
262 JHistory \
263  -f ${OUTPUT_FILE/\%/jshfit} \
264  -o ${OUTPUT_FILE/\%/jhistory} \
265  -A "$APPLICATIONS[*]" \
266  -d $DEBUG --!
267 
268 CHECK_EXIT_CODE
269 
270 rm -vf ${OUTPUT_FILE/\%/jshfit}
271 
272 timer_stop
273 timer_print
274 
275 
276 # ------------------------------------------------------------------------------------------
277 # rename outputfile
278 # ------------------------------------------------------------------------------------------
279 
280 timer_start
281 
282 mv -v \
283  ${OUTPUT_FILE/\%/jhistory} \
284  ${OUTPUT_FILE/\%/${SUFFIX}}
285 
286 timer_stop
287 timer_print
288 
289 
290 # ------------------------------------------------------------------------------------------
291 # JConvertEvt
292 # ------------------------------------------------------------------------------------------
293 
294 timer_start
295 
296 JConvertEvt \
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 
305 timer_stop
306 timer_print