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

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

set usage = "$0 [ -show ] RUN BAND TAG"

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 != 3 ) then
  echo "usage: ${usage}"; exit 1
endif

set run = "$1"; shift
set band = "$1"; shift;
set tag = "$1"; shift;

source RUN-${run}/f${band}.parms
echo "candDrawStep = ${candDrawStep}"

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

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

nice -n 19 \
PZDrawSegs \
  -input ${input} \
  -chainDir . -chainPrefix f \
  -band ${band} \
  -output ${output} \
  -nSegsPerPage 3 4 \
  -maxSegs 999 \
  -drawEvery  ${candDrawStep}

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

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


