4# --------------------------------------------------------------------------------------------
 
    6# Auxiliary script to derive the geometry of the D0ORCA011 (123) detector from other detectors.
 
    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            123
 
   20    usage "$script <source directory A> <source directory B>"                           \
 
   21          "\nThe source directory A corresponds to a pre-calibrated D0ORCA010 detector."  \
 
   22          "\nThe source directory B corresponds to a pre-calibrated D1ORCA011 detector."
 
   26    2)  set_variable DIR_DETECTOR_A       ${1:a}
 
   27        set_variable DIR_DETECTOR_B       ${2:a};;
 
   28    *)  fatal "Wrong number of arguments."
 
   31set_variable  DETECTOR_A      $DIR_DETECTOR_A/detector.datx
 
   32set_variable  TRIPOD_A        $DIR_DETECTOR_A/tripod.txt
 
   33set_variable  DETECTOR_B      $DIR_DETECTOR_B/detector.datx
 
   34set_variable  TRIPOD_B        $DIR_DETECTOR_B/tripod.txt
 
   36if [[ ! -f $DETECTOR_A ]]; then
 
   37    fatal "Missing pre-calibrated D0ORCA010 input detector file"
 
   40if [[ ! -f $DETECTOR_B ]]; then
 
   41    fatal "Missing pre-calibrated D1ORCA011 input detector file"
 
   44if [[ ! -f $TRIPOD_B ]]; then
 
   45    fatal "Missing pre-calibrated D1ORCA011 input tripod file"
 
   48# D1ORCA011 detector striped of all the new strings wrt D0ORCA011 and ID of D0ORCA011 assigned
 
   51    -@ "id=$DETECTOR_ID"            \
 
   52    -k "1 2 3 4 9 10 12 18 28"      \
 
   55# D0ORCA010 detector striped of all strings but the ones in D0ORCA011
 
   58    -k "1 2 3 9 10 11 12 19"           \
 
   61cat >tripod_tmp.txt<<EOF
 
   64# D0ORCA010 detector aligned with D1ORCA011 at the base level.
 
   68    -a detector_tmp.datx               \
 
   73# D0ORCA010 detector striped of all the strings but ORCA.0011
 
   75    -a detector_tmp.datx               \
 
   79# The two detector merged
 
   82    -a detector_tmp.datx               \
 
   91rm -f detector_tmp.datx
 
   94    -f $DIR_DETECTOR_A/disable.txt     \
 
   95    -f $DIR_DETECTOR_B/disable.txt     \
 
   99    -f $DIR_DETECTOR_B/transmitter.txt \
 
  100    -k "1 2 3 4 9 10 12 18 28"         \
 
  104    -f $DIR_DETECTOR_A/transmitter.txt \
 
  106    -o transmitter_tmp.txt
 
  110    -f transmitter_tmp.txt \
 
  113rm -f transmitter_tmp.txt
 
  116    -f $DIR_DETECTOR_B/hydrophone.txt  \
 
  117    -k "1 2 3 4 9 10 12 18 28"         \
 
  121    -f $DIR_DETECTOR_A/hydrophone.txt  \
 
  123    -o hydrophone_tmp.txt
 
  127    -f hydrophone_tmp.txt \
 
  130rm -f hydrophone_tmp.txt
 
  133# waveform identifier; emitter identifier