#! /bin/csh -fe
# Last edited on 1999-11-16 21:03:23 by hcgl

set usage = "$0 RUN BAND TRUETAG FALSETAG CRITDIST MAXDIST SKIPDIST MAXSHIFT"

# Runs PZPlotMatchCost on the numeric curvature chains
#  of the synthetic candidate files (ideal and bogus)

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

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

set run = "$1"; shift;
set band = "$1"; shift;
source RUN-${run}/f${band}.parms
set trueTag = "$1"; shift;
set falseTag = "$1"; shift;
set critDist = "$1"; shift;
set maxDist = "$1"; shift;
set skipDist = "$1"; shift;
set maxShift = "$1"; shift;

echo "run = ${run}  band = ${band}"
echo "critDist = ${critDist}  maxDist = ${maxDist}  skipDist = ${skipDist}"
echo "plotting curvature mismatch for true and false cands"

foreach tag ( ${trueTag} ${falseTag} )
  
  set input = "RUN-${run}/f${band}-${tag}"
  set output = "RUN-${run}/f${band}-${tag}"
  
  echo "${input}.can -> ${output}.plt"

  /n/gnu/bin/nice -n 19 PZPlotMatchCost \
    -input ${input} -maxCands 10 \
    -chainDir . -chainPrefix f \
    -output ${output} \
    -band ${band} -step ${step} \
    -critDist ${critDist} \
    -maxDist ${maxDist} \
    -skipDist ${skipDist} \
    -maxShift ${maxShift}

end

set yRef = "${critDist}"
set yFac = 2.0

draw-PZMatchCost-plot \
  -eps \
  -title "xi = ${critDist}  xi* = ${maxDist}  zeta = ${skipDist}  q = ${maxShift}" \
  ${yRef} ${yFac} \
  RUN-${run}/f${band}-${trueTag} \
  RUN-${run}/f${band}-${falseTag} \
  RUN-${run}/f${band}-${trueTag}-${falseTag}-mtc-$$.eps
  
echo "=== end $0 ======"