#! /bin/csh -fe
# Last edited on 2003-11-20 22:58:07 by stolfi

echo "=== begin $0 =========" 

set usage = "$0 [ -show ] RUN BAND TAG CHAINA TOTA INIA LENA CHAINB TOTB INIB LENB"

unset show
while ( ( $#argv > 0 ) && ( "x$1" =~ x-* ) )
  if ( "x$1" == "x-show" ) then
    set show; shift
  else
    echo "usage: ${usage}"; exit 1
  endif
end

if ( $#argv != 11 ) then
  echo "usage: ${usage}"; exit 1
endif

set run = "$1"; shift
set band = "$1"; shift;
set tag = "$1"; shift;
set chaina = "$1"; shift;
set tota = "$1"; shift;
set inia = "$1"; shift;
set lena = "$1"; shift;
set chainb = "$1"; shift;
set totb = "$1"; shift;
set inib = "$1"; shift;
set lenb = "$1"; shift;

source RUN-${run}/f${band}.parms

set input = RUN-${run}/f${band}-${tag}
set output = RUN-${run}/f${band}-${tag}

echo "converting ${input}.can to ${output}.ps..."

nice -n 19 \
PZDrawCandGrids \
  -input ${input} \
  -output ${output} \
  -segments \
    ${chaina} ${tota} ${inia} ${lena} + \
    ${chainb} ${totb} ${inib} ${lenb} - \
  -cellSize 3.0 \
  -refGridLine  0.05   0.80 0.65 0.00 \
  -candGridLine 0.07   0.60 0.45 0.00 \
  -matchLine    0.10   0.00 0.00 0.50 \
  -dots         0.15   0.00 0.00 0.50 \
  -maxCands 999

if ( $?show ) then
  ghostview ${output}-grid.ps
endif

echo "=== end $0 =========" 


