Index: branches/eam_branches/ipp-20110710/tools/refstacktool
===================================================================
--- branches/eam_branches/ipp-20110710/tools/refstacktool	(revision 31852)
+++ branches/eam_branches/ipp-20110710/tools/refstacktool	(revision 32337)
@@ -25,4 +25,5 @@
 my $tess_version = 'V2';
 my $input_data_group;
+my $object;
 
 my $dbname = "gpc1";
@@ -50,4 +51,5 @@
     'tess_version=s'=> \$tess_version,
     'tess_id=s'     => \$tess_id,
+    'object=s'      => \$object,
     'workdir=s'     => \$workdir,
     'reduction=s'   => \$reduction,
@@ -60,4 +62,6 @@
 
 pod2usage( -msg => "Only one of --queue and --pretend may be supplied ", -exitval => 2 ) if $queue and $pretend;
+
+$n_inputs_min = $n_inputs_max if ($n_inputs_max < $n_inputs_min);
 
 my ($d, $m, $y) = (gmtime) [3,4,5];
@@ -82,4 +86,5 @@
 $selection_args .= " AND dateobs >= '$date_begin'";
 $selection_args .= " AND date(dateobs) <= '$date_end'" if $date_end;
+$selection_args .= " AND object like '$object'" if $object;
 
 $input_data_group = "'$field.%'";
@@ -289,4 +294,11 @@
 Optional. The default value is "field.%. For example 'MD05%'
 
+=item * --object <object>
+
+Select exposures whose "object" matches the supplied value. (The SQL wild
+chard character '%' is useful here.
+
+Optional.
+
 =item * --n_inputs_min <n_inputs_min>
 
