Index: trunk/tools/ipp_apply_burntool.pl
===================================================================
--- trunk/tools/ipp_apply_burntool.pl	(revision 23585)
+++ trunk/tools/ipp_apply_burntool.pl	(revision 24018)
@@ -91,4 +91,20 @@
 
 my $REALRUN = 1;
+my $RAWTABLES = 1;
+# XXX if we want to avoid using the raw tables in this script, we need to delay deletion of the tempfile until the next pass.
+
+# first pass: mark the db entries to catch failures
+# these will not be identified as burned by chip processing (user_1 > 0.5)
+if (! $skip_burned)  {
+    foreach my $file (@files) {
+	my $exp_id = $file->{exp_id};
+
+	my $status;
+	$status = vsystem ("$regtool -dbname $dbname -updateprocessedimfile -exp_id $exp_id -class_id $class_id -user_1 0.1", 1);
+	if ($status) {
+	    &my_die("failed to update imfile");
+	}
+    }
+}
 
 my $prevFileOpt = "";
@@ -120,9 +136,14 @@
     # print "outImfile: $outImfile -> $outImfileReal\n";
 
-    # destination for the burntool artifacts
-    my $artImfile = $rawImfile;
-    $artImfile =~ s/fits$/burn.tbl/;
-    my $artImfileReal = $ipprc->file_resolve($artImfile, 1);
-    # print "artImfile: $artImfile -> $artImfileReal\n";
+    # burntool now can write the artifacts to the fits file.
+    # destination for the burntool artifacts.  use this if RAWTABLES is set.
+    my $artImfile;
+    my $artImfileReal;
+    if ($RAWTABLES) {
+	$artImfile = $rawImfile;
+	$artImfile =~ s/fits$/burn.tbl/;
+	$artImfileReal = $ipprc->file_resolve($artImfile, 1);
+	# print "artImfile: $artImfile -> $artImfileReal\n";
+    }
 
     # uncompress the image (do we need to check if it is compressed?)
@@ -132,5 +153,9 @@
     }
 
-    $status = vsystem ("$burntool $tmpImfileReal out=$artImfileReal $prevFileOpt", $REALRUN);
+    if ($RAWTABLES) {
+	$status = vsystem ("$burntool $tmpImfileReal out=$artImfileReal $prevFileOpt", $REALRUN);
+    } else {
+	$status = vsystem ("$burntool $tmpImfileReal $prevFileOpt", $REALRUN);
+    }
     if ($status) {
 	&my_die("failed on burntool");
@@ -149,5 +174,9 @@
 
     # save the artifact file for the next image
-    $prevFileOpt = "in=$artImfileReal";
+    if ($RAWTABLES) {
+	$prevFileOpt = "in=$artImfileReal";
+    } else {
+	$prevFileOpt = "infits=$artImfileReal";
+    }
     print "\n";
 }
