4# --------------------------------------------------------------------------------------------
 
    6# Steering script for the global-fit-of-global-fits procedure of the D0ARCA021 (133) 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            133
 
   18set_array     RUNS                   13290-13297
 
   19set_variable: MUL                    ACOUSTICS_MUL          -1.21e-2
 
   20set_variable: THREADS                ACOUSTICS_THREADS       5
 
   21set_variable  SINGULARITY            -
 
   22set_variable  WORKDIR                `pwd`
 
   23set_variable  HOMEDIR                $WORKDIR
 
   26    usage "$script <source directory> [user directory]"\
 
   27          "\nThe source directory corresponds to a pre-calibrated D0ARCA009 detector."\
 
   28          "\nThe user directory should be specified when this script is submitted in a batch queue."
 
   32    2)  set_variable HOMEDIR              $2;&
 
   33    1)  set_variable DIR                  ${1:a};;
 
   34    *)  fatal "Wrong number of arguments."
 
   37source JAcousticsToolkit.sh
 
   40# post-calibration of input detector
 
   42mkdir -p $WORKDIR/post-calibration
 
   43pushd    $WORKDIR/post-calibration
 
   45post-calibration_D0ARCA009.sh  $DIR
 
   49set_variable  DETECTOR               $WORKDIR/post-calibration/detector.datx
 
   50set_variable  TRIPOD                 $WORKDIR/post-calibration/tripod.txt
 
   51set_variable  DETECTOR_INITIAL       detector_initial.datx
 
   52set_variable  TRIPOD_INITIAL         tripod_initial.txt
 
   68cat>$TRIPOD_INITIAL<<EOF
 
   69# Very preliminary acoustic emitter positions from survey
 
   707   +587198.628  +4016228.693  -3433.306
 
   718   +588257.896  +4017034.442  -3457.240
 
   729   +587646.419  +4017109.956  -3456.980
 
   7310  +587763.722  +4017253.398  -3453.894
 
   7412  +587600.000  +4017500.000  -3457.240
 
   7513  +587510.740  +4016869.160  -3451.700
 
   81    -o detector_tmp.datx --!
 
   83eval `JPrintDetector -a $DETECTOR_INITIAL -O SUMMARY`;  FINAL_STRINGS=($STRINGS[*])
 
   84eval `JPrintDetector -a detector_tmp.datx -O SUMMARY`;  FIXED_STRINGS=($STRINGS[*])
 
   89    -a $DETECTOR_INITIAL     \
 
   93eval `JPrintDetector -a detector.datx -O SUMMARY`
 
   95for STRING in ${STRINGS[*]}; do
 
   97    set_variable  MODULE  `getModule -a detector.datx -L "$STRING 0"`
 
  101        -M "$MODULE setz -11.7"  \
 
  105JEditDetector   -a detector.datx  -r "$FIXED_STRINGS[*]"  -o detector.datx --!
 
  106JMergeDetector  -a detector.datx  -a detector_tmp.datx    -o detector.datx --!
 
  107JEditDetector   -a detector.datx  -k "$FINAL_STRINGS[*]"  -o detector.datx --!
 
  111    -M "817802210 lower $((-60.0 * $PI / 180.0 ))" \
 
  116get_tripods  $TRIPOD_INITIAL  TRIPODS;  FINAL_TRIPODS=(${(k)TRIPODS[*]})
 
  117get_tripods  $TRIPOD          TRIPODS;  FIXED_TRIPODS=(${(k)TRIPODS[*]})
 
  119cp -p  $TRIPOD_INITIAL  tripod.txt
 
  121JEditTripod   -f tripod.txt  -r "${FIXED_TRIPODS}" -o tripod.txt
 
  122JMergeTripod  -f tripod.txt  -f $TRIPOD            -o tripod.txt
 
  123JEditTripod   -f tripod.txt  -k "${FINAL_TRIPODS}" -o tripod.txt
 
  126# waveform identifier; emitter identifier
 
  145cat>acoustics_trigger_parameters.txt<<EOF
 
  152# disable transmissions
 
  153# $e807fd96-3473-48a0-a5d8-5cbe0cc1ebc4$
 
  154# GIT 18.3.0-305-g4e82b04f4-D
 
  156# application JEditDisable
 
  157# command /data1/dejong/km3net/GIT/Jpp/out//Linux/bin//JEditDisable -f disable.log -o disable.log -a detector.datx -q -d 2 --!
 
  159# system Linux verster.lorentz.leidenuniv.nl 6.6.8-200.fc39.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 21 04:01:49 UTC 2023 x86_64
 
  235cat>transmitter.txt<<EOF
 
  236# Data from D0ARCA021_baseAcousticBeacon.csv
 
  23711   16  0   0.03  -0.77   0.48
 
  23915   32  0  -0.38  -0.67   0.48
 
  242cat>hydrophone.txt<<EOF
 
  243# Data from D0ARCA021_hydrophones.csv
 
  244   9 -1  -0.57  -0.42   0.57
 
  247  13  0  -0.68  -0.37   0.62
 
  248  14  0  -0.20  -0.75   0.62
 
  250  15  0  -0.72  -0.27   0.62
 
  251  19  0  -0.16  -0.76   0.62
 
  254  23  0  -0.59  -0.49   0.62
 
  255  24  0  -0.68  -0.37   0.62
 
  258  25  0  -0.74  -0.22   0.62
 
  259  30  0  -0.08  -0.77   0.62
 
  267JAcousticsEventBuilder.sh  detector.datx  $RUNS[*]
 
  269INPUT_FILES=(`ls KM3NeT_${(l:8::0::0:)DETECTOR_ID}_0*${^RUNS}_event.root`)
 
  276if [ ! $HOMEDIR -ef $WORKDIR ]; then
 
  277    cp -p $HOMEDIR/$ACOUSTICS_DETECTOR     $WORKDIR
 
  278    cp -p $HOMEDIR/${^ACOUSTICS_KEYS}.txt  $WORKDIR
 
  279    cp -p $HOMEDIR/${^ACOUSTICS_AUXS}.txt  $WORKDIR
 
  280    cp -p $HOMEDIR/${^INPUT_FILES}         $WORKDIR
 
  285fix  string  $FIXED_STRINGS[*]
 
  286fix  tripod  $FIXED_TRIPODS[*]
 
  288stage   0  0                2  250.0e-6  10.0  20  0.5       
 
  289stage  1A  0                2  250.0e-6  10.0  20  0.5    0.5
 
  290stage  1B  0                2  250.0e-6  10.0   0  0.0005 0.2
 
  291stage  1C  ${SINGULARITY}2  0  250.0e-6  10.0  20  0.3       
 
  292stage  2A  ${SINGULARITY}2  0  100.0e-6  10.0  20  0.2    0.2
 
  293stage  2C  ${SINGULARITY}2  0  100.0e-6  10.0  20  0.2       
 
  297stage  2a  ${SINGULARITY}2  0  100.0e-6  10.0  20  0.2    0.2
 
  298stage  2c  ${SINGULARITY}2  0  100.0e-6  10.0  20  0.2       
 
  299stage  3a  ${SINGULARITY}2  0   50.0e-6  10.0  20  0.2    0.2
 
  300stage  3c  ${SINGULARITY}2  0   50.0e-6  10.0  20  0.2       
 
  303JSydney.sh  detector.datx  $INPUT_FILES[*]  script.txt
 
  305if [ ! $HOMEDIR -ef $WORKDIR ]; then