Jpp  17.2.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
acoustics-fit-toolkit.sh
Go to the documentation of this file.
1 #!/bin/zsh
2 script=${0##*/}
3 
4 # -----------------------------------------------------------------------------------------------------
5 #
6 # Toolkit for the determination of the fixed parameters in the system, a.k.a. "pre-calibration".
7 # The list of parameters includes (x,y,z) positions of strings and tripods, stretching of strings,
8 # z-positions of the optical modules, orientations of the strings and possibly z-positions of anchors.
9 #
10 # The value of a given parameter is optimised by minimising the average chi2/NDF
11 # of a series of global fits applied to a predefined set of acoustic events.
12 # For each parameter, there exists a designated function.
13 #
14 # There are also steering functions to consistently determine the optimal values for a set of parameters.
15 # In these, the current accuracy of the parameter values is taken into account.
16 # These are therefore referred to as "stages".
17 # The pre-calibration thus consists of a sequence of stages.
18 # For each detector, a complete pre-calibration procedure is implemented in a designated script.
19 #
20 # Mandatory input variables:
21 #
22 # DETECTOR # detector file
23 # INPUT_FILES # list of input files (output of JAcousticsEventBuilder[.sh])
24 #
25 # Optional input variables:
26 #
27 # HYDROPHONE # if defined, use hydrophones in global fit; else do not use hydrophones
28 #
29 # In the following:
30 #
31 # STRINGS corresponds to list of strings to be fitted; this can be changed with function fixStrings.
32 # TRIPODS corresponds to list of tripods to be fitted; this can be changed with function fixTripods.
33 #
34 # TRANSMITTERS corresponds to list of strings which have an emitter on the anchor (maybe empty).
35 # For these strings, the orientations and the z-positions of the anchors will separately be fitted.
36 # This list will also be changed with function fixStrings.
37 # -----------------------------------------------------------------------------------------------------
38 
39 source $JPP_DIR/setenv.sh $JPP_DIR >& /dev/null
40 source $JPP_BIN/gradient.sh
41 
42 if [[ ! $ZSH_EVAL_CONTEXT =~ :file$ ]]; then
43  echo "Auxiliary script for the pre-calibrations."
44  echo "This script should be sourced by the steering script for a specific detector."
45  echo "Consult the script '$0' for more details."
46  exit
47 fi
48 
49 source JAcousticsToolkit.sh
50 
51 set_variable TMPDIR `pwd`/.$$ # temporary directory
52 set_variable: DEBUG ACOUSTICS_DEBUG 3 # debug level
53 set_variable: JOBS ACOUSTICS_JOBS 0 # number of parallel threads
54 set_variable: SLEEP_US ACOUSTICS_SLEEP_US 100 # sleep time [us] of main thread when data queue exceeds limit
55 
56 typeset -A TRIPODS # tripods
57 typeset -a CHI2 # chi2 values; index [1] corresponds to best value
58 
59 let "NUMBER_OF_ITERATIONS = 100" # maximal number of iterations
60 let "EPSILON = 5.0E-4" # maximal distance to minimum of chi2
61 let "RADIUS_M = 1.0" # maximal horizontal distance between T-bar and emitter/hydrophone
62 let "PRECISION = 10" # number of decimals of chi2 evaluation
63 
64 
65 # -----------------------------------------------------------------------------------------------------
66 # Initialise.
67 #
68 # Install input files in working directory and create temporary directory TMPDIR.
69 #
70 # -----------------------------------------------------------------------------------------------------
71 function initialise()
72 {
73  eval `JPrintDetector -a $DETECTOR -O IDENTIFIER`
74  eval `JPrintDetector -a $DETECTOR -O SUMMARY`
75  eval `JPrintDetector -a $DETECTOR -O CAN`
76 
77  JAcoustics.sh $DETECTOR_ID
78 
79  get_tripods tripod.txt TRIPODS
80 
81  TRANSMITTERS=(`get_strings_with_transmitter transmitter.txt`)
82 
83  if [[ "${HYDROPHONE+YES}" == "YES" ]]; then
84  HYDROPHONES=(`get_strings_with_hydrophone hydrophone.txt`)
85  else
86  HYDROPHONES=()
87  fi
88 
89  mkdir -p $TMPDIR
90 }
91 
92 
93 # -----------------------------------------------------------------------------------------------------
94 # Backup files in given directory.
95 #
96 # \param 1 directory
97 # -----------------------------------------------------------------------------------------------------
98 function backup()
99 {
100  mkdir -p $1
101 
102  cp -p {$DETECTOR,tripod.txt,transmitter.txt,hydrophone.txt} $1
103 
104 }
105 
106 
107 # -----------------------------------------------------------------------------------------------------
108 # Remove temporary directory and restore input files in working directory.
109 #
110 # -----------------------------------------------------------------------------------------------------
111 function clean()
112 {
113  rm -rf $TMPDIR >& /dev/null
114 
115  rm -f {acoustics_fit_parameters,acoustics_trigger_parameters}.txt
116 
117  JAcoustics.sh $DETECTOR_ID
118 }
119 
120 
121 # -----------------------------------------------------------------------------------------------------
122 # Fix strings.
123 #
124 # \param 1-N identifiers
125 # -----------------------------------------------------------------------------------------------------
126 function fixStrings()
127 {
128  typeset -a BUFFER
129 
130  BUFFER=(`echo $*`)
131 
132  if (( ${#BUFFER} > 0 )); then
133  STRINGS=(${STRINGS:|BUFFER})
134  TRANSMITTERS=(${TRANSMITTERS:|BUFFER})
135  HYDROPHONES=(${HYDROPHONES:|BUFFER})
136  fi
137 }
138 
139 
140 # -----------------------------------------------------------------------------------------------------
141 # Fix tripods.
142 #
143 # \param 1-N identifiers
144 # -----------------------------------------------------------------------------------------------------
145 function fixTripods()
146 {
147  typeset -a BUFFER
148 
149  BUFFER=(`echo $*`)
150 
151  if (( ${#BUFFER} > 0 )); then
152  for ID in $BUFFER[*]; do
153  unset "TRIPODS[${ID}]"
154  done
155  fi
156 }
157 
158 
159 # -----------------------------------------------------------------------------------------------------
160 # Evaluate current chi2.
161 #
162 # \param 1 variable containing chi2 value on return
163 # -----------------------------------------------------------------------------------------------------
164 function getChi2()
165 {
166  rm -f $TMPDIR/katoomba.root >& /dev/null
167 
168  if (( $JOBS == 0 )); then
169 
170  JKatoomba \
171  -a $DETECTOR \
172  -f "$INPUT_FILES[*]" \
173  -o $TMPDIR/katoomba.root \
174  -T tripod.txt \
175  -Y transmitter.txt \
176  -V sound_velocity.txt \
177  -M mechanics.txt \
178  -@ $TMPDIR/acoustics_fit_parameters.txt \
179  -! disable.txt \
180  ${HYDROPHONE+-H hydrophone.txt} \
181  -u \
182  -d 0 --! >& $TMPDIR/job.log
183 
184  else
185 
186  JFremantle \
187  -a $DETECTOR \
188  -f "$INPUT_FILES[*]" \
189  -o $TMPDIR/katoomba.root \
190  -T tripod.txt \
191  -Y transmitter.txt \
192  -V sound_velocity.txt \
193  -M mechanics.txt \
194  -@ $TMPDIR/acoustics_fit_parameters.txt \
195  -! disable.txt \
196  ${HYDROPHONE+-H hydrophone.txt} \
197  -u \
198  -N $JOBS \
199  -s $SLEEP_US \
200  -d 0 --! >& $TMPDIR/job.log
201  fi
202 
203  if (( $? != 0 )); then
204  fatal "non-zero exit code, see $TMPDIR/job.log"
205  fi
206 
207  let "UV = $($JPP_DIR/examples/JAcoustics/JPrintChi2 -f $TMPDIR/katoomba.root -p $PRECISION)"
208 
209  if (( $? != 0 )); then
210  fatal "non-zero exit code let."
211  fi
212 
213  eval $1=$UV
214 }
215 
216 
217 # -----------------------------------------------------------------------------------------------------
218 # Stage 0.
219 # This stage can be used to determine the (x,y,z) positions of tripods when a number of strings is fixed.
220 #
221 # \param 1 step size
222 # \param 2 maximum number of extra steps
223 # -----------------------------------------------------------------------------------------------------
224 function stage_0()
225 {
226  cat>$TMPDIR/acoustics_fit_parameters.txt<<EOF
227 `egrep Tmax_s acoustics_fit_parameters.txt`
228 Nmin = 3;
229 sigma_s = 100.0e-6;
230 stdev = 10.0;
231 mestimator = 0;
232 option = 1;
233 EOF
234 
235  if (( ${#STRINGS} > 0 )); then
236  JEditDetector -a $DETECTOR -o $TMPDIR/detector_0.datx -k "$STRINGS[*]" -q -d 0 >& /dev/null
237  JEditDetector -a $DETECTOR -o $DETECTOR -r "$STRINGS[*]" -q -d 0 >& /dev/null
238  fi
239 
240  PARAMETERS=()
241 
242  for ID in ${(k)TRIPODS}; do
243  PARAMETERS['JEditTripod -f tripod.txt -T "$ID addx %" -o tripod.txt -q -d 0 >& /dev/null']=$1
244  PARAMETERS['JEditTripod -f tripod.txt -T "$ID addy %" -o tripod.txt -q -d 0 >& /dev/null']=$1
245  PARAMETERS['JEditTripod -f tripod.txt -T "$ID addz %" -o tripod.txt -q -d 0 >& /dev/null']=$1
246  done
247 
248  gradient $2 Y
249 
250  printf "detector %6d %8.4f\n" $N $Y
251 
252  if (( ${#STRINGS} > 0 )); then
253  JMergeDetector -a $DETECTOR -a $TMPDIR/detector_0.datx -o $DETECTOR >& /dev/null
254  fi
255 }
256 
257 
258 # -----------------------------------------------------------------------------------------------------
259 # Stage 1a.
260 # This stage can be used to roughly determine the positions of the strings and tripods.
261 # During this procedure, the strings are kept vertical in the global fits.
262 #
263 # \param 1 step size strings
264 # \param 2 step size tripods
265 # \param 3 maximum number of extra steps
266 # -----------------------------------------------------------------------------------------------------
267 function stage_1a()
268 {
269  cat>$TMPDIR/acoustics_fit_parameters.txt<<EOF
270 `egrep Tmax_s acoustics_fit_parameters.txt`
271 Nmin = 3;
272 sigma_s = 250.0e-6;
273 stdev = 10.0;
274 mestimator = 2;
275 option = 0;
276 EOF
277 
278  PARAMETERS=()
279 
280  for STRING in $STRINGS[*]; do
281  PARAMETERS['JEditDetector -a $DETECTOR -S "$STRING addx %" -o $DETECTOR -q -d 0 >& /dev/null']=$1
282  PARAMETERS['JEditDetector -a $DETECTOR -S "$STRING addy %" -o $DETECTOR -q -d 0 >& /dev/null']=$1
283  PARAMETERS['JEditDetector -a $DETECTOR -s "$STRING addz %" -o $DETECTOR -q -d 0 >& /dev/null']=$1
284  done
285 
286  for ID in ${(k)TRIPODS}; do
287  PARAMETERS['JEditTripod -f tripod.txt -T "$ID addx %" -o tripod.txt -q -d 0 >& /dev/null']=$2
288  PARAMETERS['JEditTripod -f tripod.txt -T "$ID addy %" -o tripod.txt -q -d 0 >& /dev/null']=$2
289  PARAMETERS['JEditTripod -f tripod.txt -T "$ID addz %" -o tripod.txt -q -d 0 >& /dev/null']=$2
290  done
291 
292  for STRING in ${HYDROPHONES:|TRANSMITTERS}; do
293  PARAMETERS['JEditHydrophone -f hydrophone.txt -S "$STRING rot %" -o hydrophone.txt -q -d 0 >& /dev/null; JEditTransmitter -f transmitter.txt -S "$STRING rot %" -o transmitter.txt -q -d 0 >& /dev/null']=$(($1 / $RADIUS_M))
294  done
295 
296  for STRING in $TRANSMITTERS[*]; do
297 
298  set_variable MODULE `getModule -a $DETECTOR -L "$STRING 0"`
299 
300  PARAMETERS['JEditDetector -a $DETECTOR -M "$MODULE addz %" -o $DETECTOR -q -d 0 >& /dev/null']=$1
301  PARAMETERS['JEditHydrophone -f hydrophone.txt -S "$STRING rot %" -o hydrophone.txt -q -d 0 >& /dev/null; JEditTransmitter -f transmitter.txt -S "$STRING rot %" -o transmitter.txt -q -d 0 >& /dev/null']=$(($1 / $RADIUS_M))
302  done
303 
304  gradient $3 Y
305 
306  printf "detector %6d %8.4f\n" $N $Y
307 }
308 
309 
310 # -----------------------------------------------------------------------------------------------------
311 # Stage 1b.
312 # This stage can be used to roughly determine the z-positions of the modules.
313 # During this procedure, the strings are kept vertical in the global fits.
314 #
315 # \param 1 step size
316 # \param 2 maximum number of extra steps
317 # -----------------------------------------------------------------------------------------------------
318 function stage_1b()
319 {
320  cat>$TMPDIR/acoustics_fit_parameters.txt<<EOF
321 `egrep Tmax_s acoustics_fit_parameters.txt`
322 Nmin = 3;
323 sigma_s = 250.0e-6;
324 stdev = 10.0;
325 mestimator = 2;
326 option = 0;
327 EOF
328 
329  PARAMETERS=()
330 
331  for STRING in $STRINGS[*]; do
332 
333  for (( FLOOR = 1; $FLOOR <= 18; FLOOR += 1 )); do
334 
335  set_variable MODULE `getModule -a $DETECTOR -L "$STRING $FLOOR"`
336 
337  PARAMETERS['JEditDetector -a $DETECTOR -M "$MODULE addz %" -o $DETECTOR -q -d 0 >& /dev/null']=$1
338  done
339  done
340 
341  gradient $2 Y
342 
343  printf "detector %6d %8.4f\n" $N $Y
344 }
345 
346 
347 # -----------------------------------------------------------------------------------------------------
348 # Stage 1B.
349 # This stage can be used to simultaneously determine the stretching and z-positions of individual strings.
350 #
351 # \param 1 step size stretching
352 # \param 2 step size z-position
353 # \param 3 maximum number of extra steps
354 # -----------------------------------------------------------------------------------------------------
355 function stage_1B()
356 {
357  cat>$TMPDIR/acoustics_fit_parameters.txt<<EOF
358 `egrep Tmax_s acoustics_fit_parameters.txt`
359 Nmin = 3;
360 sigma_s = 100.0e-6;
361 stdev = 10.0;
362 mestimator = 0;
363 option = 1;
364 EOF
365 
366  for STRING in $STRINGS[*]; do
367 
368  JEditDetector -a $DETECTOR -o $TMPDIR/detector_1.datx -r "$STRING" -q -d 0 >& /dev/null
369  JEditDetector -a $DETECTOR -o $DETECTOR -k "$STRING" -q -d 0 >& /dev/null
370 
371  PARAMETERS=()
372 
373  PARAMETERS['JEditDetector -a $DETECTOR -s "$STRING mul %" -o $DETECTOR -q -d 0 >& /dev/null; JEditDetector -a $DETECTOR -s "$STRING subz \$\(\(% * $CAN_ZMAX_M\)\)" -o $DETECTOR -q -d 0 >& /dev/null']=$1
374  PARAMETERS['JEditDetector -a $DETECTOR -s "$STRING addz %" -o $DETECTOR -q -d 0 >& /dev/null']=$2
375 
376  gradient $3 Y
377 
378  printf "string %04d %6d %8.4f\n" $STRING $N $Y
379 
380  JMergeDetector -a $DETECTOR -a $TMPDIR/detector_1.datx -o $DETECTOR >& /dev/null
381  done
382 }
383 
384 
385 # -----------------------------------------------------------------------------------------------------
386 # Stage 2a.
387 # This stage can be used to improve the determination the positions of the strings and tripods.
388 #
389 # \param 1 step size strings
390 # \param 2 step size tripods
391 # \param 3 maximum number of extra steps
392 # -----------------------------------------------------------------------------------------------------
393 function stage_2a()
394 {
395  cat>$TMPDIR/acoustics_fit_parameters.txt<<EOF
396 `egrep Tmax_s acoustics_fit_parameters.txt`
397 Nmin = 3;
398 sigma_s = 100.0e-6;
399 stdev = 10.0;
400 mestimator = 0;
401 option = 1;
402 EOF
403 
404  PARAMETERS=()
405 
406  for STRING in $STRINGS[*]; do
407  PARAMETERS['JEditDetector -a $DETECTOR -S "$STRING addx %" -o $DETECTOR -q -d 0 >& /dev/null']=$1
408  PARAMETERS['JEditDetector -a $DETECTOR -S "$STRING addy %" -o $DETECTOR -q -d 0 >& /dev/null']=$1
409  PARAMETERS['JEditDetector -a $DETECTOR -s "$STRING addz %" -o $DETECTOR -q -d 0 >& /dev/null']=$1
410  done
411 
412  for ID in ${(k)TRIPODS}; do
413  PARAMETERS['JEditTripod -f tripod.txt -T "$ID addx %" -o tripod.txt -q -d 0 >& /dev/null']=$2
414  PARAMETERS['JEditTripod -f tripod.txt -T "$ID addy %" -o tripod.txt -q -d 0 >& /dev/null']=$2
415  PARAMETERS['JEditTripod -f tripod.txt -T "$ID addz %" -o tripod.txt -q -d 0 >& /dev/null']=$2
416  done
417 
418  for STRING in ${HYDROPHONES:|TRANSMITTERS}; do
419  PARAMETERS['JEditHydrophone -f hydrophone.txt -S "$STRING rot %" -o hydrophone.txt -q -d 0 >& /dev/null; JEditTransmitter -f transmitter.txt -S "$STRING rot %" -o transmitter.txt -q -d 0 >& /dev/null']=$(($1 / $RADIUS_M))
420  done
421 
422  for STRING in $TRANSMITTERS[*]; do
423 
424  set_variable MODULE `getModule -a $DETECTOR -L "$STRING 0"`
425 
426  PARAMETERS['JEditDetector -a $DETECTOR -M "$MODULE addz %" -o $DETECTOR -q -d 0 >& /dev/null']=$1
427  PARAMETERS['JEditHydrophone -f hydrophone.txt -S "$STRING rot %" -o hydrophone.txt -q -d 0 >& /dev/null; JEditTransmitter -f transmitter.txt -S "$STRING rot %" -o transmitter.txt -q -d 0 >& /dev/null']=$(($1 / $RADIUS_M))
428  done
429 
430  gradient $3 Y
431 
432  printf "detector %6d %8.4f\n" $N $Y
433 }
434 
435 
436 # -----------------------------------------------------------------------------------------------------
437 # Stage 2b.
438 # This stage can be used to improve the determination the z-positions of the modules.
439 #
440 # \param 1 step size
441 # \param 2 maximum number of extra steps
442 # -----------------------------------------------------------------------------------------------------
443 function stage_2b()
444 {
445  cat>$TMPDIR/acoustics_fit_parameters.txt<<EOF
446 `egrep Tmax_s acoustics_fit_parameters.txt`
447 Nmin = 3;
448 sigma_s = 100.0e-6;
449 stdev = 10.0;
450 mestimator = 0;
451 option = 1;
452 EOF
453 
454  PARAMETERS=()
455 
456  for STRING in $STRINGS[*]; do
457 
458  for (( FLOOR = 1; $FLOOR <= 18; FLOOR += 1 )); do
459 
460  set_variable MODULE `getModule -a $DETECTOR -L "$STRING $FLOOR"`
461 
462  PARAMETERS['JEditDetector -a $DETECTOR -M "$MODULE addz %" -o $DETECTOR -q -d 0 >& /dev/null']=$1
463  done
464 
465  #PARAMETERS['JEditDetector -a $DETECTOR -S "$STRING addx %" -o $DETECTOR -q -d 0 >& /dev/null']=$1
466  #PARAMETERS['JEditDetector -a $DETECTOR -S "$STRING addy %" -o $DETECTOR -q -d 0 >& /dev/null']=$1
467  done
468 
469  gradient $2 Y
470 
471  printf "detector %6d %8.4f\n" $N $Y
472 }
473 
474 
475 # -----------------------------------------------------------------------------------------------------
476 # Stage 3a.
477 # This stage can be used to finalise the determination of the positions of the strings and tripods.
478 #
479 # \param 1 step size strings
480 # \param 2 step size tripods
481 # \param 3 maximum number of extra steps
482 # -----------------------------------------------------------------------------------------------------
483 function stage_3a()
484 {
485  cat>$TMPDIR/acoustics_fit_parameters.txt<<EOF
486 `egrep Tmax_s acoustics_fit_parameters.txt`
487 Nmin = 3;
488 sigma_s = 50.0e-6;
489 stdev = 10.0;
490 mestimator = 0;
491 option = 1;
492 EOF
493 
494  PARAMETERS=()
495 
496  for STRING in $STRINGS[*]; do
497  PARAMETERS['JEditDetector -a $DETECTOR -S "$STRING addx %" -o $DETECTOR -q -d 0 >& /dev/null']=$1
498  PARAMETERS['JEditDetector -a $DETECTOR -S "$STRING addy %" -o $DETECTOR -q -d 0 >& /dev/null']=$1
499  PARAMETERS['JEditDetector -a $DETECTOR -s "$STRING addz %" -o $DETECTOR -q -d 0 >& /dev/null']=$1
500  done
501 
502  for ID in ${(k)TRIPODS}; do
503  PARAMETERS['JEditTripod -f tripod.txt -T "$ID addx %" -o tripod.txt -q -d 0 >& /dev/null']=$2
504  PARAMETERS['JEditTripod -f tripod.txt -T "$ID addy %" -o tripod.txt -q -d 0 >& /dev/null']=$2
505  PARAMETERS['JEditTripod -f tripod.txt -T "$ID addz %" -o tripod.txt -q -d 0 >& /dev/null']=$2
506  done
507 
508  for STRING in ${HYDROPHONES:|TRANSMITTERS}; do
509  PARAMETERS['JEditHydrophone -f hydrophone.txt -S "$STRING rot %" -o hydrophone.txt -q -d 0 >& /dev/null; JEditTransmitter -f transmitter.txt -S "$STRING rot %" -o transmitter.txt -q -d 0 >& /dev/null']=$(($1 / $RADIUS_M))
510  done
511 
512  for STRING in $TRANSMITTERS[*]; do
513 
514  set_variable MODULE `getModule -a $DETECTOR -L "$STRING 0"`
515 
516  PARAMETERS['JEditDetector -a $DETECTOR -M "$MODULE addz %" -o $DETECTOR -q -d 0 >& /dev/null']=$1
517  PARAMETERS['JEditHydrophone -f hydrophone.txt -S "$STRING rot %" -o hydrophone.txt -q -d 0 >& /dev/null; JEditTransmitter -f transmitter.txt -S "$STRING rot %" -o transmitter.txt -q -d 0 >& /dev/null']=$(($1 / $RADIUS_M))
518  done
519 
520  gradient $3 Y
521 
522  printf "detector %6d %8.4f\n" $N $Y
523 }
524 
525 
526 # -----------------------------------------------------------------------------------------------------
527 # Stage 3b.
528 # This stage can be used to finalise the determination of the z-positions of the modules.
529 #
530 # \param 1 step size
531 # \param 2 maximum number of extra steps
532 # -----------------------------------------------------------------------------------------------------
533 function stage_3b()
534 {
535  cat>$TMPDIR/acoustics_fit_parameters.txt<<EOF
536 `egrep Tmax_s acoustics_fit_parameters.txt`
537 Nmin = 3;
538 sigma_s = 50.0e-6;
539 stdev = 10.0;
540 mestimator = 0;
541 option = 1;
542 EOF
543 
544  PARAMETERS=()
545 
546  for STRING in $STRINGS[*]; do
547 
548  for (( FLOOR = 1; $FLOOR <= 18; FLOOR += 1 )); do
549 
550  set_variable MODULE `getModule -a $DETECTOR -L "$STRING $FLOOR"`
551 
552  PARAMETERS['JEditDetector -a $DETECTOR -M "$MODULE addz %" -o $DETECTOR -q -d 0 >& /dev/null']=$1
553  done
554 
555  #PARAMETERS['JEditDetector -a $DETECTOR -S "$STRING addx %" -o $DETECTOR -q -d 0 >& /dev/null']=$1
556  #PARAMETERS['JEditDetector -a $DETECTOR -S "$STRING addy %" -o $DETECTOR -q -d 0 >& /dev/null']=$1
557  done
558 
559  gradient $2 Y
560 
561  printf "detector %6d %8.4f\n" $N $Y
562 }
563 
564 
565 # -----------------------------------------------------------------------------------------------------
566 # Stage D.
567 # This stage can be used to determine the rotations of the strings and z-positions of the anchors
568 # including the response of hydrophones.
569 # It includes a determination of the positions of the strings, tripods and modules.
570 #
571 # \param 1 step size strings
572 # \param 2 step size tripods
573 # \param 3 maximum number of extra steps
574 # -----------------------------------------------------------------------------------------------------
575 function stage_D()
576 {
577  cat>$TMPDIR/acoustics_fit_parameters.txt<<EOF
578 `egrep Tmax_s acoustics_fit_parameters.txt`
579 Nmin = 3;
580 sigma_s = 50.0e-6;
581 stdev = 10.0;
582 mestimator = 0;
583 option = 1;
584 EOF
585 
587 
588  PARAMETERS=()
589 
590  for STRING in $STRINGS[*]; do
591 
592  set_variable MODULE `getModule -a $DETECTOR -L "$STRING 0"`
593 
594  PARAMETERS['JEditDetector -a $DETECTOR -S "$STRING addx %" -o $DETECTOR -q -d 0 >& /dev/null']=$1
595  PARAMETERS['JEditDetector -a $DETECTOR -S "$STRING addy %" -o $DETECTOR -q -d 0 >& /dev/null']=$1
596  PARAMETERS['JEditDetector -a $DETECTOR -s "$STRING addz %" -o $DETECTOR -q -d 0 >& /dev/null']=$1
597  PARAMETERS['JEditDetector -a $DETECTOR -M "$MODULE addz %" -o $DETECTOR -q -d 0 >& /dev/null']=$1
598 
599  PARAMETERS['JEditHydrophone -f hydrophone.txt -S "$STRING rot %" -o hydrophone.txt -q -d 0 >& /dev/null; JEditTransmitter -f transmitter.txt -S "$STRING rot %" -o transmitter.txt -q -d 0 >& /dev/null']=$(($1 / $RADIUS_M))
600  done
601 
602  for ID in ${(k)TRIPODS}; do
603  PARAMETERS['JEditTripod -f tripod.txt -T "$ID addx %" -o tripod.txt -q -d 0 >& /dev/null']=$2
604  PARAMETERS['JEditTripod -f tripod.txt -T "$ID addy %" -o tripod.txt -q -d 0 >& /dev/null']=$2
605  PARAMETERS['JEditTripod -f tripod.txt -T "$ID addz %" -o tripod.txt -q -d 0 >& /dev/null']=$2
606  done
607 
608  for STRING in ${HYDROPHONES:|TRANSMITTERS}; do
609  PARAMETERS['JEditHydrophone -f hydrophone.txt -S "$STRING rot %" -o hydrophone.txt -q -d 0 >& /dev/null; JEditTransmitter -f transmitter.txt -S "$STRING rot %" -o transmitter.txt -q -d 0 >& /dev/null']=$(($1 / $RADIUS_M))
610  done
611 
612  for STRING in $TRANSMITTERS[*]; do
613 
614  set_variable MODULE `getModule -a $DETECTOR -L "$STRING 0"`
615 
616  PARAMETERS['JEditDetector -a $DETECTOR -M "$MODULE addz %" -o $DETECTOR -q -d 0 >& /dev/null']=$1
617  PARAMETERS['JEditHydrophone -f hydrophone.txt -S "$STRING rot %" -o hydrophone.txt -q -d 0 >& /dev/null; JEditTransmitter -f transmitter.txt -S "$STRING rot %" -o transmitter.txt -q -d 0 >& /dev/null']=$(($1 / $RADIUS_M))
618  done
619 
620  gradient $3 Y
621 
622  printf "detector %6d %8.4f\n" $N $Y
623 }
then fatal No hydrophone data file $HYDROPHONE_TXT fi sort gr k
int main(int argc, char *argv[])
Definition: Main.cc:15
clean eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY set_variable STRING
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
then JLigier sh continue fi cat
Definition: JDAQDriver.sh:51
then echo Submitting reweighting and histogram comparison jobs to nikhef stbc batch queue
o $QUALITY_ROOT d $DEBUG!JPlot1D f
Definition: JDataQuality.sh:66
then JShowerPostfit f $INPUT_FILE o $OUTPUT_FILE N
static const double H
Planck constant [eV s].
exit
Definition: JPizza.sh:36
then fatal Number of tripods
Definition: JFootprint.sh:45
data_type r[M+1]
Definition: JPolint.hh:779
then fatal Wrong number of arguments fi set_variable STRING $argv[1] set_variable DETECTORXY_TXT $WORKDIR $DETECTORXY_TXT tail read X Y CHI2 RMS printf optimum n $X $Y $CHI2 $RMS awk v Y
V(JDAQEvent-JTriggerReprocessor)*1.0/(JDAQEvent+1.0e-10)
then fatal Wrong number of arguments fi JConvertDetectorFormat a o
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR &dev null if do_usage *then usage source $script nToolkit for acoustics scripts fi function get_tripods()
then echo
do JCanberra a $DETECTOR f $INPUT_FILE o $WORKDIR canberra[${EMITTER}\] root T $WORKDIR tripod txt V $WORKDIR sound_velocity txt M $WORKDIR mechanics txt H $WORKDIR hydrophone txt E $EMITTER $DISABLE d $DEBUG!done kill_child_processes_at_exit attach getModule a $DETECTOR typeset Z STRING typeset Z FLOOR for STRING in $STRINGS[*]
Definition: JCanberra.sh:68
then fatal Invalid string $STRING
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR &dev null set_variable
Definition: JAcoustics.sh:21
case $OPTION in clean clean
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR if do_usage *then usage $script[(input file)+] fi set_variable DEBUG set_variable WORKDIR TMPDIR
do set_variable OUTPUT_DIRECTORY $WORKDIR T
set_array INPUT_FILES argv[2,$((START_INDEX_STRING-1))] set_array STRINGS
then $DIR JKatoomba a $DETECTOR o $WORKDIR katoomba root T $TRIPOD n sigma_s
then JMuonMCEvt f $INPUT_FILE o $INTERMEDIATE_FILE d
Definition: JMuonPath.sh:47
then JCalibrateToT a
Definition: JTuneHV.sh:116
then set_variable MODULE getModule a $DETECTOR L $STRING $FLOOR JEditDetector a $DETECTOR M $MODULE add $X o $DETECTOR else echo No update of detector $DETECTOR
static const JPBS_t HYDROPHONE(4, 5)
PBS of hydrophone
then if[[!-f $DETECTOR]] then JDetector sh $DETECTOR fi cat $WORKDIR trigger_parameters txt<< EOFtrigger3DMuon.enabled=1;trigger3DMuon.numberOfHits=5;trigger3DMuon.gridAngle_deg=1;ctMin=0.0;TMaxLocal_ns=15.0;EOF set_variable TRIGGEREFFICIENCY_TRIGGERED_EVENTS_ONLY INPUT_FILES=() for((i=1;$i<=$NUMBER_OF_RUNS;++i));do JSirene.sh $DETECTOR $JPP_DATA/genhen.km3net_wpd_V2_0.evt.gz $WORKDIR/sirene_ ${i}.root JTriggerEfficiency.sh $DETECTOR $DETECTOR $WORKDIR/sirene_ ${i}.root $WORKDIR/trigger_efficiency_ ${i}.root $WORKDIR/trigger_parameters.txt $JPP_DATA/PMT_parameters.txt INPUT_FILES+=($WORKDIR/trigger_efficiency_ ${i}.root) done for ANGLE_DEG in $ANGLES_DEG[*];do set_variable SIGMA_NS 3.0 set_variable OUTLIERS 3 set_variable OUTPUT_FILE $WORKDIR/matrix\[${ANGLE_DEG}\deg\].root $JPP_DIR/examples/JReconstruction-f"$INPUT_FILES[*]"-o $OUTPUT_FILE-S ${SIGMA_NS}-A ${ANGLE_DEG}-O ${OUTLIERS}-d ${DEBUG}--!fiif[[$OPTION=="plot"]];then if((0));then for H1 in h0 h1;do JPlot1D-f"$WORKDIR/matrix["${^ANGLES_DEG}" deg].root:${H1}"-y"1 2e3"-Y-L TR-T""-\^"number of events [a.u.]"-> o chi2
Definition: JMatrixNZ.sh:106
esac typeset A BUFFER $JPP_DIR examples JAcoustics JCreep f $INPUT_FILE BUFFER
Definition: JCreep.sh:34
then cp
possible values
then echo Creating output directory
Definition: JTuneHV.sh:83
double u[N+1]
Definition: JPolint.hh:776
double getChi2(const double P)
Get chi2 corresponding to given probability.
Definition: JFitToolkit.hh:56
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:46
source $JPP_DIR setenv csh $JPP_DIR &dev null eval JShellParser o a A
script
Definition: JAcoustics.sh:2
esac $JPP_BIN JLogger sh $LOGGER until pgrep JGetMessage</dev/null > dev null
const JModule & getModule(const JDetector &detector, const JModuleLocation &location)
find module with a given string and floor number
int debug
debug level
esac done
Definition: JAddHDE.sh:21
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62