4# --------------------------------------------------------------------------------------------
6# Steering script for the global-fit-of-global-fits procedure of the D1ARCA051 (277) detector.
8# --------------------------------------------------------------------------------------------
10if [ -z $JPP_DIR ]; then
11 echo "Variable JPP_DIR undefined."
15source $JPP_DIR/setenv.sh $JPP_DIR >& /dev/null
17set_variable DETECTOR_ID 277
18set_array RUNS 27923-27938
19set_variable: THREADS ACOUSTICS_THREADS 32
20set_variable SINGULARITY -
21set_variable WORKDIR `pwd`
22set_variable HOMEDIR $WORKDIR
25 usage "$script [user directory]"\
26 "\nThe user directory should be specified when this script is submitted in a batch queue."
30 1) set_variable HOMEDIR $1;;
32 *) fatal "Wrong number of arguments."
35source JAcousticsToolkit.sh
37# Run post-calibration on D1ARCA030 in a dedicated subdirectory
39mkdir -p $WORKDIR/post-calibration
40pushd $WORKDIR/post-calibration
42$WORKDIR/post-calibration-D1ARCA030.sh
46set_variable DETECTOR $WORKDIR/post-calibration/detector.datx
47set_variable DETECTOR_INITIAL detector_initial.datx
54# Download D1ARCA051 detector from DB with correct acoustic T0
61cp -p $DETECTOR_INITIAL detector_initial_backup.datx
63eval `JPrintDetector -a $DETECTOR_INITIAL -O SUMMARY`; FINAL_STRINGS=($STRINGS[*])
64eval `JPrintDetector -a $DETECTOR -O SUMMARY`; FIXED_STRINGS=($STRINGS[*])
66# Remove BC strings from D1ARCA051 initial detector, then merge with post-calibrated D1ARCA030
67JEditDetector -a $DETECTOR_INITIAL -r "$FIXED_STRINGS[*]" -o detector_tmp.datx --!
68JMergeDetector -a detector_tmp.datx -a $DETECTOR -o detector.datx --!
69JEditDetector -a detector.datx -k "$FINAL_STRINGS[*]" -o detector.datx --!
72eval `JPrintDetector -a detector.datx -O SUMMARY`
73echo "Toutes les DUs / chaƮnes : $STRINGS"
74FINAL_STRINGS=($STRINGS[*])
76cp -p detector.datx detector_after_merge.datx
78# Retrieve auxiliary files from calibration archive
79getFile.sh $CALIBRATION_ARCHIVE 267 1 tripod $WORKDIR/tripod_D1ARCA030
80getFile.sh $CALIBRATION_ARCHIVE 267 1 waveform $WORKDIR/waveform_D1ARCA030
81getFile.sh $JPP_DIR/inputs 267 1 acoustics_fit_parameters $WORKDIR/acoustics_fit_parameters
82getFile.sh $JPP_DIR/inputs 267 1 sound_velocity $WORKDIR/sound_velocity
86get_tripods $WORKDIR/tripod_D1ARCA030.txt TRIPODS; FIXED_TRIPODS=(${(k)TRIPODS[*]})
87get_tripods $WORKDIR/tripod_D1ARCA030.txt TRIPODS; FINAL_TRIPODS=(${(k)TRIPODS[*]})
89cp -p $WORKDIR/tripod_D1ARCA030.txt tripod.txt
91cp -p $WORKDIR/waveform_D1ARCA030.txt waveform.txt
93# New mechanical model and particular model for lines without buoy
101cat>acoustics_trigger_parameters.txt<<EOF
381cat>transmitter.txt<<EOF
382# Data from D1ARCA051_transmitters.csv
385cat>hydrophone.txt<<EOF
386# Data from D1ARCA051_hydrophones.csv
390JAcousticsEventBuilder.sh detector.datx $RUNS[*]
392INPUT_FILES=(`ls KM3NeT_${(l:8::0::0:)DETECTOR_ID}_0*${^RUNS}_event.root`)
398if [ ! $HOMEDIR -ef $WORKDIR ]; then
399 cp -p $HOMEDIR/$ACOUSTICS_DETECTOR $WORKDIR
400 cp -p $HOMEDIR/${^ACOUSTICS_KEYS}.txt $WORKDIR
401 cp -p $HOMEDIR/${^ACOUSTICS_AUXS}.txt $WORKDIR
402 cp -p $HOMEDIR/${^INPUT_FILES} $WORKDIR
407fix tripod $FIXED_TRIPODS[*]
408fix string $FIXED_STRINGS[*]
410stage 1A 0 2 250.0e-6 10.0 20 1.0 1.0
411stage 1B 0 2 250.0e-6 10.0 0 0.0005 0.2
412stage 1C ${SINGULARITY}2 0 250.0e-6 10.0 20 0.3
413stage 2A ${SINGULARITY}2 0 100.0e-6 10.0 30 0.05 0.05
414stage 2C ${SINGULARITY}2 0 100.0e-6 10.0 30 0.05
415stage 3A ${SINGULARITY}2 0 50.0e-6 10.0 10 0.15 0.15
416stage 3C ${SINGULARITY}2 0 50.0e-6 10.0 20 0.3
419print "FIXED STRINGS:" $FIXED_STRINGS
420print "FINAL STRINGS:" $FINAL_STRINGS
421print "FIXED TRIPODS:" $FIXED_TRIPODS
422print "FINAL TRIPODS:" $FINAL_TRIPODS
424JSydney.sh detector.datx $INPUT_FILES[*] script.txt
426# copy detector to apply z-adjustment
427cp -p detector.datx detector_z_adjusted.datx
429set_variable DETECTOR_FINAL detector_z_adjusted.datx
431# Adjust Z positions of all modules using the acoustic event files
432JAdjustZpos -a $DETECTOR_FINAL \
433 -f KM3NeT_00000277_00027923_event.root \
434 -f KM3NeT_00000277_00027924_event.root \
435 -f KM3NeT_00000277_00027925_event.root \
436 -f KM3NeT_00000277_00027926_event.root \
437 -f KM3NeT_00000277_00027927_event.root \
438 -f KM3NeT_00000277_00027928_event.root \
439 -f KM3NeT_00000277_00027929_event.root \
440 -f KM3NeT_00000277_00027930_event.root \
441 -f KM3NeT_00000277_00027931_event.root \
442 -f KM3NeT_00000277_00027932_event.root \
443 -f KM3NeT_00000277_00027933_event.root \
444 -f KM3NeT_00000277_00027934_event.root \
445 -f KM3NeT_00000277_00027935_event.root \
446 -f KM3NeT_00000277_00027936_event.root \
447 -f KM3NeT_00000277_00027937_event.root \
448 -f KM3NeT_00000277_00027938_event.root \
451cp -p $DETECTOR_FINAL detector_z_adjusted_backup.datx
453# Apply floor spacing of 64.72 m to all strings
454eval `JPrintDetector -a $DETECTOR_FINAL -O SUMMARY`;
455echo "STRINGS = ${STRINGS[@]}"
456echo "Nombre de strings = ${#STRINGS[@]}"
457for STRING in ${STRINGS[*]}; do
461 -o $DETECTOR_FINAL --!
465if [ ! $HOMEDIR -ef $WORKDIR ]; then