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

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

set usage = "$0 RUN INBAND OUTBAND TAG"

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

set run = "$1"; shift;
set inBand = "$1"; shift;
set outBand = "$1"; shift;
set tag = "$1"; shift;

if ( "x${inBand}" != "x${outBand}" ) then

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

  echo "mapping ${input}.can to ${output}.can..."

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

  set extraLength = 0.0
  set blurFactor = 3.0
  echo "extraLength = ${extraLength}"
  echo "blurFactor = ${blurFactor}"
  echo "step = ${step}"

  nice -n 19 PZMapCands \
    -input ${input} \
    -inBand ${inBand} \
    -chainDir . -chainPrefix f \
    -output ${output} \
    -outStep ${step} \
    -outBand ${outBand} \
    -blurFactor ${blurFactor} \
    -extraLength ${extraLength} \
    -verbose

  echo "wrote ${output}.can"

else
  echo "mapping to same band, skipped"
endif

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


