#!/bin/csh -f

if ($#argv != 2) then
  echo "USAGE: 01_stacks.cmd (label) [commit]"
  exit 2
endif

set label = $1
if ("$2" == "commit") then
  set pretend = ""
else
  set pretend = "-pretend"
endif

set common_opts = ""
set common_opts = "$common_opts -dbname gpc1"
set common_opts = "$common_opts -definebyquery"
set common_opts = "$common_opts -select_label $label"
set common_opts = "$common_opts -set_label $label"
set common_opts = "$common_opts -set_data_group $label"
set common_opts = "$common_opts -set_dist_group $label"
set common_opts = "$common_opts -min_num 4"
set common_opts = "$common_opts -simple"

set common_opts = "$common_opts -set_workdir neb://@HOST@.0/POLE/$label"

set common_opts = "$common_opts  -set_reduction THREEPI_STACK_1DG"

stacktool $pretend $common_opts -select_filter g.00000
stacktool $pretend $common_opts -select_filter r.00000
stacktool $pretend $common_opts -select_filter i.00000
stacktool $pretend $common_opts -select_filter z.00000
stacktool $pretend $common_opts -select_filter y.00000
