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
61#cp -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
94# Also available getFile.sh $JPP_DIR/inputs 277 1 mechanics $WORKDIR/mechanics
102# Also available getFile.sh $JPP_DIR/inputs 277 1 acoustics_trigger_parameters $WORKDIR/acoustics_trigger_parameters
103cat>acoustics_trigger_parameters.txt<<EOF
383cat>transmitter.txt<<EOF
384# Data from D1ARCA051_transmitters.csv
387cat>hydrophone.txt<<EOF
388# Data from D1ARCA051_hydrophones.csv
392JAcousticsEventBuilder.sh detector.datx $RUNS[*]
394INPUT_FILES=(`ls KM3NeT_${(l:8::0::0:)DETECTOR_ID}_0*${^RUNS}_event.root`)
400if [ ! $HOMEDIR -ef $WORKDIR ]; then
401 cp -p $HOMEDIR/$ACOUSTICS_DETECTOR $WORKDIR
402 cp -p $HOMEDIR/${^ACOUSTICS_KEYS}.txt $WORKDIR
403 cp -p $HOMEDIR/${^ACOUSTICS_AUXS}.txt $WORKDIR
404 cp -p $HOMEDIR/${^INPUT_FILES} $WORKDIR
409fix tripod $FIXED_TRIPODS[*]
410fix string $FIXED_STRINGS[*]
412stage 1A 0 2 250.0e-6 10.0 20 1.0 1.0
413stage 1B 0 2 250.0e-6 10.0 0 0.0005 0.2
414stage 1C ${SINGULARITY}2 0 250.0e-6 10.0 20 0.3
415stage 2A ${SINGULARITY}2 0 100.0e-6 10.0 30 0.05 0.05
416stage 2C ${SINGULARITY}2 0 100.0e-6 10.0 30 0.05
417stage 3A ${SINGULARITY}2 0 50.0e-6 10.0 10 0.15 0.15
418stage 3C ${SINGULARITY}2 0 50.0e-6 10.0 20 0.3
421print "FIXED STRINGS:" $FIXED_STRINGS
422print "FINAL STRINGS:" $FINAL_STRINGS
423print "FIXED TRIPODS:" $FIXED_TRIPODS
424print "FINAL TRIPODS:" $FINAL_TRIPODS
426JSydney.sh detector.datx $INPUT_FILES[*] script.txt
428# copy detector to apply z-adjustment
429cp -p detector.datx detector_z_adjusted.datx
431set_variable DETECTOR_FINAL detector_z_adjusted.datx
433# Adjust Z positions of all modules using the acoustic event files
434JAdjustZpos -a $DETECTOR_FINAL \
435 -f KM3NeT_00000277_00027923_event.root \
436 -f KM3NeT_00000277_00027924_event.root \
437 -f KM3NeT_00000277_00027925_event.root \
438 -f KM3NeT_00000277_00027926_event.root \
439 -f KM3NeT_00000277_00027927_event.root \
440 -f KM3NeT_00000277_00027928_event.root \
441 -f KM3NeT_00000277_00027929_event.root \
442 -f KM3NeT_00000277_00027930_event.root \
443 -f KM3NeT_00000277_00027931_event.root \
444 -f KM3NeT_00000277_00027932_event.root \
445 -f KM3NeT_00000277_00027933_event.root \
446 -f KM3NeT_00000277_00027934_event.root \
447 -f KM3NeT_00000277_00027935_event.root \
448 -f KM3NeT_00000277_00027936_event.root \
449 -f KM3NeT_00000277_00027937_event.root \
450 -f KM3NeT_00000277_00027938_event.root \
453#cp -p $DETECTOR_FINAL detector_z_adjusted_backup.datx
455# Apply floor spacing of 64.72 m to all strings
456eval `JPrintDetector -a $DETECTOR_FINAL -O SUMMARY`;
457echo "STRINGS = ${STRINGS[@]}"
458echo "Nombre de strings = ${#STRINGS[@]}"
459for STRING in ${STRINGS[*]}; do
463 -o $DETECTOR_FINAL --!
467if [ ! $HOMEDIR -ef $WORKDIR ]; then