Jpp master_rocky-44-g75b7c4f75
the software that should make you happy
Loading...
Searching...
No Matches
JARCAMuonReconstruction.sh
Go to the documentation of this file.
1#!/bin/zsh
2#
3# \author bofearraigh
4#
5script=${0##*/}
6
7# ------------------------------------------------------------------------------------------
8#
9# Script to run the JPP Track Reconstruction Chain for ARCA.
10#
11# ------------------------------------------------------------------------------------------
12
13if [ -z $JPP_DIR ]; then
14 echo "Variable JPP_DIR undefined."
15 exit
16fi
17
18source $JPP_DIR/setenv.sh $JPP_DIR
19source $JPP_DIR/externals/km3net-dataformat/definitions/reconstruction.sh
20
21set_variable: DEBUG RECONSTRUCTION_DEBUG 1
22set_variable: PDF RECONSTRUCTION_PDF $JPP_DATA/J%p.dat
23set_variable: SUFFIX RECONSTRUCTION_SUFFIX jmuon
24set_variable: ENERGY_CORRECTION RECONSTRUCTION_ENERGY_CORRECTION energy_correction_arca.txt
25set_variable: NUMBER_OF_EVENTS RECONSTRUCTION_NUMBER_OF_EVENTS $((2**31))
26set_variable+ OVERWRITE RECONSTRUCTION_OVERWRITE 1
27set_variable: TMAX_S RECONSTRUCTION_TMAX_S 100
28set_variable: RATE_HZ RECONSTRUCTION_RATE_HZ 6.0e3
29
30if do_usage $*; then
31 usage "$script <detector file> <input file> <output file> <PMT parameters file> [(calibration file)+]"
32fi
33
34if (( $# < 4 )); then
35 fatal "Wrong number of arguments."
36fi
37
38set_variable DETECTOR $argv[1]
39set_variable INPUT_FILE $argv[2]
40set_variable OUTPUT_FILE $argv[3]
41set_variable PMT $argv[4]
42set_array CALIBRATION $argv[5,-1]
43
44if [[ ! "$OUTPUT_FILE" == *"%"* ]]; then
45 fatal "The output file must have the wildcard % in the name, e.g. %.root"
46fi
47
48typeset -A PARAMETERS
49typeset -a APPLICATIONS
50
51APPLICATIONS=()
52
53
54if [[ "$OVERWRITE" == 1 ]]; then
55 rm -vf \
56 ${OUTPUT_FILE/\%/jprefit} \
57 ${OUTPUT_FILE/\%/jsimplex} \
58 ${OUTPUT_FILE/\%/jgandalf} \
59 ${OUTPUT_FILE/\%/jstart} \
60 ${OUTPUT_FILE/\%/jenergy} \
61 ${OUTPUT_FILE/\%/jhistory} \
62 ${OUTPUT_FILE/\%/${SUFFIX}} \
63 ${OUTPUT_FILE/\%/${SUFFIX}.offline}
64fi
65
66if (( ${#CALIBRATION} != 0 )); then
67 getMechanics.sh $DETECTOR
68fi
69
70
71# ------------------------------------------------------------------------------------------
72# JMuonPrefit
73# ------------------------------------------------------------------------------------------
74
75PARAMETERS=(
76 sigma_ns 5
77 gridAngle_deg 1
78 useL0 0
79 numberOfOutliers 3
80 numberOfPrefits 50
81 DZMax 0.0
82 numberOfDZMax 1
83 TMaxLocal_ns 18
84 ctMin 0.0
85 roadWidth_m 200.0)
86
87timer_start
88
89eval JMuonPrefit \
90 -a $DETECTOR \
91 -+${^CALIBRATION} \
92 -T $TMAX_S \
93 -f $INPUT_FILE \
94 -o ${OUTPUT_FILE/\%/jprefit} \
95 -n ${NUMBER_OF_EVENTS} \
96 -@ `make_equation PARAMETERS` \
97 -d $DEBUG --!
98
99CHECK_EXIT_CODE
100
101APPLICATIONS+=$JMUONPREFIT
102
103timer_stop
104timer_print
105
106
107# ------------------------------------------------------------------------------------------
108# JMuonSimplex
109# ------------------------------------------------------------------------------------------
110
111PARAMETERS=(
112 sigma_ns 3
113 TMaxLocal_ns 15.0
114 ctMin 0.0
115 roadWidth_m 200.0
116 numberOfPrefits 0)
117
118timer_start
119
120eval JMuonSimplex \
121 -a $DETECTOR \
122 -+${^CALIBRATION} \
123 -T $TMAX_S \
124 -f ${OUTPUT_FILE/\%/jprefit} \
125 -o ${OUTPUT_FILE/\%/jsimplex} \
126 -@ `make_equation PARAMETERS` \
127 -d ${DEBUG} --!
128
129CHECK_EXIT_CODE
130
131rm -vf ${OUTPUT_FILE/\%/jprefit}
132
133APPLICATIONS+=$JMUONSIMPLEX
134
135timer_stop
136timer_print
137
138
139# ------------------------------------------------------------------------------------------
140# JMuonGandalf
141# ------------------------------------------------------------------------------------------
142
143PARAMETERS=(
144 TTS_ns 2
145 E_GeV 1.0e3
146 TMin_ns -50.0
147 TMax_ns +450.0
148 R_Hz $RATE_HZ
149 roadWidth_m 175.0
150 numberOfPrefits 0)
151
152timer_start
153
154eval JMuonGandalf \
155 -a $DETECTOR \
156 -+${^CALIBRATION} \
157 -T $TMAX_S \
158 -f ${OUTPUT_FILE/\%/jsimplex} \
159 -o ${OUTPUT_FILE/\%/jgandalf} \
160 -P $PDF \
161 -@ `make_equation PARAMETERS` \
162 -d $DEBUG --!
163
164CHECK_EXIT_CODE
165
166rm -vf ${OUTPUT_FILE/\%/jsimplex}
167
168APPLICATIONS+=$JMUONGANDALF
169
170timer_stop
171timer_print
172
173
174# ------------------------------------------------------------------------------------------
175# JMuonStart
176# ------------------------------------------------------------------------------------------
177
178PARAMETERS=(
179 roadWidth_m 160.0
180 R_Hz $RATE_HZ
181 TMin_ns -25.0
182 TMax_ns +75.0
183 Pmin1 1.0e-3
184 Pmin2 1.0e-2
185 numberOfPrefits 1)
186
187timer_start
188
189eval JMuonStart \
190 -a $DETECTOR \
191 -+${^CALIBRATION} \
192 -T $TMAX_S \
193 -f ${OUTPUT_FILE/\%/jgandalf} \
194 -o ${OUTPUT_FILE/\%/jstart} \
195 -P $PDF \
196 -@ `make_equation PARAMETERS` \
197 -d $DEBUG --!
198
199CHECK_EXIT_CODE
200
201rm -vf ${OUTPUT_FILE/\%/jgandalf}
202
203APPLICATIONS+=$JMUONSTART
204
205timer_stop
206timer_print
207
208
209# ------------------------------------------------------------------------------------------
210# JMuonEnergy
211# ------------------------------------------------------------------------------------------
212
213PARAMETERS=(
214 roadWidth_m 300.0
215 R_Hz $RATE_HZ
216 EMin_log 0.0
217 EMax_log 8.0
218 TMin_ns -50.0
219 TMax_ns +450.0
220 mestimator 1
221 numberOfPrefits 1)
222
223timer_start
224
225eval JMuonEnergy \
226 -a $DETECTOR \
227 -+${^CALIBRATION} \
228 -T $TMAX_S \
229 -f ${OUTPUT_FILE/\%/jstart} \
230 -o ${OUTPUT_FILE/\%/jenergy} \
231 -P $PDF \
232 -E $ENERGY_CORRECTION \
233 -@ `make_equation PARAMETERS` \
234 -d $DEBUG --!
235
236CHECK_EXIT_CODE
237
238rm -vf ${OUTPUT_FILE/\%/jstart}
239
240APPLICATIONS+=$JMUONENERGY
241
242timer_stop
243timer_print
244
245
246# ------------------------------------------------------------------------------------------
247# JHistory
248# ------------------------------------------------------------------------------------------
249
250timer_start
251
252JHistory \
253 -f ${OUTPUT_FILE/\%/jenergy} \
254 -o ${OUTPUT_FILE/\%/jhistory} \
255 -A "$APPLICATIONS[*]" \
256 -d $DEBUG --!
257
258CHECK_EXIT_CODE
259
260rm -vf ${OUTPUT_FILE/\%/jenergy}
261
262timer_stop
263timer_print
264
265
266# ------------------------------------------------------------------------------------------
267# rename outputfile and remove intermediate files
268# ------------------------------------------------------------------------------------------
269
270timer_start
271
272mv -v \
273 ${OUTPUT_FILE/\%/jhistory} \
274 ${OUTPUT_FILE/\%/${SUFFIX}}
275
276timer_stop
277timer_print
278
279
280# ------------------------------------------------------------------------------------------
281# JConvertEvt
282# ------------------------------------------------------------------------------------------
283
284timer_start
285
286JConvertEvt \
287 -f ${OUTPUT_FILE/\%/${SUFFIX}} \
288 -o ${OUTPUT_FILE/\%/${SUFFIX}.offline} \
289 -a $DETECTOR \
290 -+${^CALIBRATION} \
291 -T $TMAX_S \
292 -P $PMT \
293 -d $DEBUG --!
294
295timer_stop
296timer_print