Index: trunk/ippScripts/scripts/flatcorr_proc.pl
===================================================================
--- trunk/ippScripts/scripts/flatcorr_proc.pl	(revision 20378)
+++ trunk/ippScripts/scripts/flatcorr_proc.pl	(revision 20379)
@@ -42,7 +42,8 @@
 use Pod::Usage qw( pod2usage );
 
-my ($corr_id, $dvodb, $camera, $region, $filter, $dbname, $workdir, $verbose, $no_update, $no_op);
+my ($corr_id, $det_type, $dvodb, $camera, $region, $filter, $dbname, $workdir, $verbose, $no_update, $no_op);
 GetOptions(
     'corr_id|i=s'      => \$corr_id,
+    'det_type|d=s'     => \$det_type,
     'dvodb|c=s'        => \$dvodb,
     'camera=s'         => \$camera,
@@ -61,4 +62,5 @@
     defined $corr_id and
     defined $dvodb and
+    defined $det_type and
     defined $camera and
     defined $region and
@@ -86,6 +88,14 @@
 # XXX either workdir needs to be non-nebulous here, or addstar / relphot need to handle 
 # nebulous interactions...
-my $outgrid = "$workdir/grid.$camera.$filter.$corr_id";
-my $outcorr = "$workdir/corr.$camera.$filter.$corr_id";
+my $outgrid = "$dvodb/flatcorr/$camera.$filter.$corr_id";
+my $outcorr = "$workdir/$camera.$filter.$corr_id";
+
+# check for existing directory, generate if needed
+print "preparing $outcorr";
+$ipprc->outroot_prepare($outcorr);
+
+if (not -e "$dvodb/flatcorr") { 
+    mkdir "$dvodb/flatcorr" or &my_die ("Unable to make output directory for relphot $dvodb/flatcorr", $corr_id, 3);
+}
 
 # parse the region (RAs,RAe:DECs,DECe) : item = +/-NNN.NNNN
@@ -191,6 +201,9 @@
     my $filter    = $file->{filter};
 
+    print "det_type: $det_type\n";
+    exit 1;
+
     my $command = "$dettool -register_detrend";
-    $command .= " -det_type FLATCORR";
+    $command .= " -det_type $det_type";
     $command .= " -filelevel $filelevel";
     $command .= " -workdir $workdir";
