4 if [ -z $JPP_DIR ]; then
 
    5     echo "Variable JPP_DIR undefined."
 
    9 source $JPP_DIR/setenv.sh $JPP_DIR >& /dev/null
 
   11 set_variable:  DEBUG              CALIBRATION_DEBUG          1
 
   12 set_variable:  WORKDIR            CALIBRATION_WORKDIR        `pwd`
 
   13 set_variable:  DAQ_TIMESLICE      CALIBRATION_TIMESLICE      JDAQTimesliceL1
 
   14 set_variable+  DATABASE_OPTION    CALIBRATION_USEPMTID       -U
 
   15 set_variable:  FORMAT             GRAPHICS_FORMAT            gif
 
   16 set_variable+  BATCH              GRAPHICS_BATCH             -B
 
   19     usage "$script <detector file> <input file> <input file> <input file>"\
 
   20           "\nThe 1st and 3rd input file should correspond to a data taking run in which the HV settings are complete (e.g. \"vendor\" or \"tuned\")."\
 
   21           "\nThe 2nd input file should correspond to a run with hybrid HV settings."\
 
   22           "\nIn this, half of the PMTs should have the same HV settings as either the 1st or 3rd input file."
 
   25 if (( $# == 4 )); then
 
   26     set_variable  DETECTOR      $argv[1]
 
   27     set_array     INPUT_FILES   $argv[2,-1]
 
   29     fatal "Wrong number of arguments."
 
   35 for INPUT_FILE in $INPUT_FILES[*]; do
 
   37     JPrintDAQHeader -f $INPUT_FILE  |  read  DETECTOR_ID  RUN  FRAME_INDEX  UTC
 
   43     if (( `JPrintTree -f $INPUT_FILE -@ "type = JDAQSummaryslice" -k number_of_entries` > 0 )); then
 
   44         set_variable OPTION  rates
 
   46         set_variable OPTION  counts
 
   49     set_variable  OUTPUT_FILE              $WORKDIR/monitor_${RUN}.root
 
   51     if [[ ! -f $OUTPUT_FILE ]]; then
 
   64 # Monitor pair of data taking runs.
 
   71     $JPP_DIR/examples/JCalibrate/JCheckK40 \
 
   73         -f "$WORKDIR/monitor_${1}.root  $WORKDIR/monitor_${2}.root"            \
 
   74         -o  $WORKDIR/monitor\[${1}-${2}\].root                                 \
 
   81 monitor  $RUNS[1]   $RUNS[2]
 
   82 monitor  $RUNS[2]   $RUNS[3]
 
   86     eval `JPrintDetector -a $DETECTOR -O SUMMARY`
 
   88     kill_child_processes_at_exit
 
   90     attach getModule -a $DETECTOR
 
   95     for STRING in $STRINGS[*]; do
 
   96         for (( FLOOR = 1; $FLOOR <= 18; ++FLOOR )); do
 
  102                 -f $WORKDIR/monitor\[${RUNS[1]}-${RUNS[2]}\].root:${MODULE}    \
 
  103                 -f $WORKDIR/monitor\[${RUNS[2]}-${RUNS[3]}\].root:${MODULE}    \
 
  107                 -T "${STRING}.${FLOOR} ($MODULE)"                              \
 
  109                 -o ${MODULE}-${RUNS[1]}-${RUNS[2]}-${RUNS[3]}.${FORMAT}        $BATCH