4source $JPP_DIR/setenv.sh $JPP_DIR >& /dev/null
 
    7set_variable   WORKDIR                  `pwd`
 
    8set_variable   ACOUSTICS_THREADS        32
 
   11    usage "$script [version]"\
 
   12          "\nAuxiliary script to run pre-calibrations of all detectors,"\
 
   13          "\nincluding automatic disabling of 'bad' transmissions (see JAcousticsDisable.sh)."
 
   19    fatal "Wrong number of arguments."
 
   23# -----------------------------------------------------------------------------------------------
 
   24# Run pre-calibration of given detector with optional inputs.
 
   25# The last directory corresponds to the target detector and
 
   26# the optional preceding directories to the source detectors.
 
   28# \param 1-N   directories
 
   29# -----------------------------------------------------------------------------------------------
 
   32    DETECTORS=($argv[1,-2])     
 
   35    if [[ ! -f $JPP_DIR/software/JAcoustics/pre-calibration_${DETECTOR}.sh ]]; then
 
   36        fatal "No calibration for detector $DETECTOR."
 
   39    DIR=$WORKDIR/${DETECTOR}.${VERSION}.A     # without disabled transmissions
 
   41    if [[ ! -d $DIR ]]; then
 
   46        JMergeDisable -f$WORKDIR/${^DETECTORS}.${VERSION}.B/disable.txt -o disable.log
 
   48        # replace disabled transmissions by those of input detectors
 
   50        sed '/cat>disable.txt<<EOF/,/EOF/ccat>disable.txt<<EOF\n# disable transmissions\nEOF'  \
 
   51            $JPP_DIR/software/JAcoustics/pre-calibration_${DETECTOR}.sh                        >  pre-calibration_${DETECTOR}.sh
 
   52        sed -i '/disable transmissions/r disable.log'                                             pre-calibration_${DETECTOR}.sh
 
   54        chmod +x pre-calibration_${DETECTOR}.sh
 
   56        ./pre-calibration_${DETECTOR}.sh  $WORKDIR/${^DETECTORS}.${VERSION}.B  >&  pre-calibration.log
 
   59        # disable transmissions
 
   61        eval `JPrintDetector -a detector.datx -O IDENTIFIER`
 
   63        JAcousticsDisable.sh  detector.datx  KM3NeT_${(l:8::0::0:)DETECTOR_ID}_*_event.root  disable.log
 
   68    DIR=$WORKDIR/${DETECTOR}.${VERSION}.B     # with disabled transmissions
 
   70    if [[ ! -d $DIR ]]; then
 
   75        cp $WORKDIR/${DETECTOR}.${VERSION}.A/disable.log .
 
   77        # introduce disabled transmissions
 
   79        sed '/cat>disable.txt<<EOF/,/EOF/ccat>disable.txt<<EOF\n# disable transmissions\nEOF'  \
 
   80            $JPP_DIR/software/JAcoustics/pre-calibration_${DETECTOR}.sh                        >  pre-calibration_${DETECTOR}.sh
 
   81        sed -i '/disable transmissions/r disable.log'                                             pre-calibration_${DETECTOR}.sh
 
   83        chmod +x pre-calibration_${DETECTOR}.sh
 
   85        ./pre-calibration_${DETECTOR}.sh  $WORKDIR/${^DETECTORS}.${VERSION}.B  >&  pre-calibration.log
 
   91# -----------------------------------------------------------------------------------------------
 
   92# Run 'empty' pre-calibration of given detector with required inputs.
 
   93# The last directory corresponds to the target detector and
 
   94# the required preceding directories to the source detectors.
 
   96# \param 1-N   directories
 
   97# -----------------------------------------------------------------------------------------------
 
  100    DETECTORS=($argv[1,-2])
 
  103    DIR=$WORKDIR/${DETECTOR}.${VERSION}.B
 
  105    if [[ ! -d $DIR ]]; then
 
  110        $JPP_DIR/software/JAcoustics/pre-calibration_${DETECTOR}.sh  $WORKDIR/${^DETECTORS}.${VERSION}.B  >&  pre-calibration.B.log
 
  119run  D_ORCA006             D0ORCA010
 
  120run  D0ORCA010             D1ORCA011
 
  121fcc  D0ORCA010  D1ORCA011  D0ORCA007
 
  122fcc  D0ORCA010  D1ORCA011  D0ORCA011
 
  123fcc  D0ORCA010  D1ORCA011  D1ORCA013
 
  124run  D1ORCA011             D0ORCA015
 
  125run  D0ORCA015             D1ORCA015
 
  126run  D1ORCA015             D0ORCA018
 
  127run  D1ORCA015             DBORCA018
 
  128run  D0ORCA018             D1ORCA024
 
  133run  D0ARCA006             D0ARCA009
 
  134run  D0ARCA009             D0ARCA021
 
  135fcc  D0ARCA021             D0ARCA020
 
  136run  D0ARCA021             D0ARCA028
 
  137run  D0ARCA028             D0ARCA030
 
  138run  D0ARCA030             D0ARCW003