4# --------------------------------------------------------------------------------------------
6# Steering script for the global-fit-of-global-fits procedure of the D1ARCA030 (267) detector.
8# --------------------------------------------------------------------------------------------
10# The start geometry is from D0ARCA030 version 1.1.3. The different
11# files are expected to be in the $DIR directory, provided as command
12# line argument to the script. Then can be recovered from the git
13# archive with the following commands:
15# git clone git@git.km3net.de:auxiliary_data/calibration.git
16# getFile.sh calibration/ 232 1 detector G_DOM_1.1.3 detector
17# getFile.sh calibration/ 232 1 tripod D_1.1.3 tripod
20if [ -z $JPP_DIR ]; then
21 echo "Variable JPP_DIR undefined."
25source $JPP_DIR/setenv.sh $JPP_DIR >& /dev/null
27set_variable DETECTOR_ID 267
28set_array RUNS 24523-24538
29set_variable: MUL ACOUSTICS_MUL -1.21e-2
30set_variable: THREADS ACOUSTICS_THREADS 16
31set_variable SINGULARITY -
32set_variable WORKDIR `pwd`
33set_variable HOMEDIR $WORKDIR
36 usage "$script <source directory> [user directory]"\
37 "\nThe source directory corresponds to a pre-calibrated D0ARCA030 detector."\
38 "\nThe user directory should be specified when this script is submitted in a batch queue."
42 2) set_variable HOMEDIR $2;&
43 1) set_variable DIR ${1:a};;
44 *) fatal "Wrong number of arguments."
47source JAcousticsToolkit.sh
49# post-calibration of input detector
51mkdir -p $WORKDIR/post-calibration
52pushd $WORKDIR/post-calibration
54post-calibration_D0ARCA030.sh $DIR
58set_variable DETECTOR $WORKDIR/post-calibration/detector.datx
59set_variable TRIPOD $WORKDIR/post-calibration/tripod.txt
60set_variable DETECTOR_INITIAL detector_initial.datx
61set_variable TRIPOD_ABSOLUTE tripod_absolute.txt
69cat>$TRIPOD_ABSOLUTE<<EOF
70# TAB6 and TAB1, with there absolute coordinates
71# values corresponding to acoustic emitter position,
72# see https://git.km3net.de/working_groups/calibration/-/issues/124
7322 +587756.91 +4016036.98 -3429.73
7423 +586738.80 +4018233.81 -3452.69
78# ID of D1ARCA030 assigned to the calibrated D0ARCA030 detector
79JEditDetector -a $DETECTOR -@ "id=$DETECTOR_ID" -o detector.datx --!
81# Copy the initial position of tripods
82cp -p $TRIPOD tripod.txt
84JEditTripod -f tripod.txt -o tripod.txt -r 20
86# Shift the input geometry 10m up
89JEditTripod -f tripod.txt -o tripod.txt -T "-1 add $SHIFT"
90JEditDetector -a detector.datx -o detector.datx -M "-1 add $SHIFT"
93# Add the tripods with absolute positioning
95get_tripods $TRIPOD_ABSOLUTE TRIPODS; FIXED_TRIPODS=(${(k)TRIPODS[*]})
97JEditTripod -f tripod.txt -r "${FIXED_TRIPODS}" -o tripod.txt
98JMergeTripod -f tripod.txt -f $TRIPOD_ABSOLUTE -o tripod.txt
100get_tripods tripod.txt TRIPODS; FINAL_TRIPODS=(${(k)TRIPODS[*]})
102print "FIXED STRINGS:" $FIXED_STRINGS
103print "FIXED TRIPODS:" $FIXED_TRIPODS
104print "FINAL TRIPODS:" $FINAL_TRIPODS
108# Data from D1ARCA030_waveforms.csv
135cat>acoustics_trigger_parameters.txt<<EOF
142# list of bad transmissions
248cat>transmitter.txt<<EOF
249# Data from D1ARCA030_transmitters.csv
254cat>hydrophone.txt<<EOF
255# Data from D0ARCA028_hydrophones.csv
256 9 -1 -0.57 -0.42 0.57
259 13 0 -0.68 -0.37 0.62
260 14 0 -0.20 -0.75 0.62
262 15 0 -0.72 -0.27 0.62
263 19 0 -0.16 -0.76 0.62
266 23 0 -0.59 -0.49 0.62
267 24 0 -0.68 -0.37 0.62
270 25 0 -0.74 -0.22 0.62
271 30 0 -0.08 -0.77 0.62
281 14 0 -0.20 -0.75 0.62
282 15 0 -0.75 -0.20 0.62
284 18 0 -0.22 -0.74 0.62
288JAcousticsEventBuilder.sh detector.datx $RUNS[*]
290INPUT_FILES=(`ls KM3NeT_${(l:8::0::0:)DETECTOR_ID}_0*${^RUNS}_event.root`)
297if [ ! $HOMEDIR -ef $WORKDIR ]; then
298 cp -p $HOMEDIR/$ACOUSTICS_DETECTOR $WORKDIR
299 cp -p $HOMEDIR/${^ACOUSTICS_KEYS}.txt $WORKDIR
300 cp -p $HOMEDIR/${^ACOUSTICS_AUXS}.txt $WORKDIR
301 cp -p $HOMEDIR/${^INPUT_FILES} $WORKDIR
306fix tripod $FIXED_TRIPODS[*]
308stage 1a 0 2 250.0e-6 10.0 20 1.0 1.0
309stage 2a ${SINGULARITY}2 0 100.0e-6 10.0 20 0.2 0.2
310stage 2c ${SINGULARITY}2 0 100.0e-6 10.0 20 0.2
311stage 3a ${SINGULARITY}2 0 50.0e-6 10.0 10 0.15 0.15
312stage 3c ${SINGULARITY}2 0 50.0e-6 10.0 20 0.3
316# stage 4a ${SINGULARITY}2 0 50.0e-6 10.0 20 0.2 0.2
317# stage 4c ${SINGULARITY}2 0 50.0e-6 10.0 20 0.2
320JSydney.sh detector.datx $INPUT_FILES[*] script.txt
322#forcing the F0-F1 distance to its nominal value (private comm. with Edward).
323set_variable DETECTOR_FINAL detector.datx
324eval `JPrintDetector -a $DETECTOR_FINAL -O SUMMARY`;
325for STRING in ${STRINGS[*]}; do
329 -o $DETECTOR_FINAL --!
332if [ ! $HOMEDIR -ef $WORKDIR ]; then