Jpp  debug
the software that should make you happy
JARCAMuonReconstruction.sh
Go to the documentation of this file.
1 #!/bin/zsh
2 #
3 # \author bofearraigh
4 #
5 script=${0##*/}
6 
7 # ------------------------------------------------------------------------------------------
8 #
9 # Script to run the JPP Track Reconstruction Chain for ARCA.
10 #
11 # ------------------------------------------------------------------------------------------
12 
13 if [ -z $JPP_DIR ]; then
14  echo "Variable JPP_DIR undefined."
15  exit
16 fi
17 
18 source $JPP_DIR/setenv.sh $JPP_DIR
19 source $JPP_DIR/externals/km3net-dataformat/definitions/reconstruction.sh
20 
21 set_variable: DEBUG RECONSTRUCTION_DEBUG 1
22 set_variable: PDF RECONSTRUCTION_PDF $JPP_DATA/J%p.dat
23 set_variable: SUFFIX RECONSTRUCTION_SUFFIX jmuon
24 set_variable: ENERGY_CORRECTION RECONSTRUCTION_ENERGY_CORRECTION energy_correction_arca.txt
25 set_variable: NUMBER_OF_EVENTS RECONSTRUCTION_NUMBER_OF_EVENTS $((2**31))
26 set_variable+ OVERWRITE RECONSTRUCTION_OVERWRITE 1
27 set_variable: TMAX_S RECONSTRUCTION_TMAX_S 100
28 set_variable: RATE_HZ RECONSTRUCTION_RATE_HZ 6.0e3
29 
30 if do_usage $*; then
31  usage "$script <detector file> <input file> <output file> <PMT parameters file> [(calibration file)+]"
32 fi
33 
34 if (( $# < 4 )); then
35  fatal "Wrong number of arguments."
36 fi
37 
38 set_variable DETECTOR $argv[1]
39 set_variable INPUT_FILE $argv[2]
40 set_variable OUTPUT_FILE $argv[3]
41 set_variable PMT $argv[4]
42 set_array CALIBRATION $argv[5,-1]
43 
44 if [[ ! "$OUTPUT_FILE" == *"%"* ]]; then
45  fatal "The output file must have the wildcard % in the name, e.g. %.root"
46 fi
47 
48 typeset -A PARAMETERS
49 typeset -a APPLICATIONS
50 
51 APPLICATIONS=()
52 
53 
54 if [[ "$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}
64 fi
65 
66 if (( ${#CALIBRATION} != 0 )); then
67  getMechanics.sh $DETECTOR
68 fi
69 
70 
71 # ------------------------------------------------------------------------------------------
72 # JMuonPrefit
73 # ------------------------------------------------------------------------------------------
74 
75 PARAMETERS=(
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 
87 timer_start
88 
89 eval 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 
99 CHECK_EXIT_CODE
100 
101 APPLICATIONS+=$JMUONPREFIT
102 
103 timer_stop
104 timer_print
105 
106 
107 # ------------------------------------------------------------------------------------------
108 # JMuonSimplex
109 # ------------------------------------------------------------------------------------------
110 
111 PARAMETERS=(
112  sigma_ns 3
113  TMaxLocal_ns 15.0
114  ctMin 0.0
115  roadWidth_m 200.0
116  numberOfPrefits 0)
117 
118 timer_start
119 
120 eval 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 
129 CHECK_EXIT_CODE
130 
131 rm -vf ${OUTPUT_FILE/\%/jprefit}
132 
133 APPLICATIONS+=$JMUONSIMPLEX
134 
135 timer_stop
136 timer_print
137 
138 
139 # ------------------------------------------------------------------------------------------
140 # JMuonGandalf
141 # ------------------------------------------------------------------------------------------
142 
143 PARAMETERS=(
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 
152 timer_start
153 
154 eval 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 
164 CHECK_EXIT_CODE
165 
166 rm -vf ${OUTPUT_FILE/\%/jsimplex}
167 
168 APPLICATIONS+=$JMUONGANDALF
169 
170 timer_stop
171 timer_print
172 
173 
174 # ------------------------------------------------------------------------------------------
175 # JMuonStart
176 # ------------------------------------------------------------------------------------------
177 
178 PARAMETERS=(
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 
187 timer_start
188 
189 eval 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 
199 CHECK_EXIT_CODE
200 
201 rm -vf ${OUTPUT_FILE/\%/jgandalf}
202 
203 APPLICATIONS+=$JMUONSTART
204 
205 timer_stop
206 timer_print
207 
208 
209 # ------------------------------------------------------------------------------------------
210 # JMuonEnergy
211 # ------------------------------------------------------------------------------------------
212 
213 PARAMETERS=(
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 
223 timer_start
224 
225 eval 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 
236 CHECK_EXIT_CODE
237 
238 rm -vf ${OUTPUT_FILE/\%/jstart}
239 
240 APPLICATIONS+=$JMUONENERGY
241 
242 timer_stop
243 timer_print
244 
245 
246 # ------------------------------------------------------------------------------------------
247 # JHistory
248 # ------------------------------------------------------------------------------------------
249 
250 timer_start
251 
252 JHistory \
253  -f ${OUTPUT_FILE/\%/jenergy} \
254  -o ${OUTPUT_FILE/\%/jhistory} \
255  -A "$APPLICATIONS[*]" \
256  -d $DEBUG --!
257 
258 CHECK_EXIT_CODE
259 
260 rm -vf ${OUTPUT_FILE/\%/jenergy}
261 
262 timer_stop
263 timer_print
264 
265 
266 # ------------------------------------------------------------------------------------------
267 # rename outputfile and remove intermediate files
268 # ------------------------------------------------------------------------------------------
269 
270 timer_start
271 
272 mv -v \
273  ${OUTPUT_FILE/\%/jhistory} \
274  ${OUTPUT_FILE/\%/${SUFFIX}}
275 
276 timer_stop
277 timer_print
278 
279 
280 # ------------------------------------------------------------------------------------------
281 # JConvertEvt
282 # ------------------------------------------------------------------------------------------
283 
284 timer_start
285 
286 JConvertEvt \
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 
295 timer_stop
296 timer_print