Index: trunk/ippScripts/scripts/detrend_process_exp.pl
===================================================================
--- trunk/ippScripts/scripts/detrend_process_exp.pl	(revision 9524)
+++ trunk/ippScripts/scripts/detrend_process_exp.pl	(revision 9892)
@@ -19,8 +19,9 @@
 use Pod::Usage qw( pod2usage );
 
-my ($det_id, $exp_tag, $no_update);
+my ($det_id, $exp_tag, $camera, $no_update);
 GetOptions(
     'det_id|d=s'        => \$det_id,
     'exp_tag|e=s'       => \$exp_tag,
+    'camera|c=s'        => \$camera,
     'no-update'         => \$no_update
 ) or pod2usage( 2 );
@@ -28,8 +29,11 @@
 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
 pod2usage(
-    -msg => "Required options: --det_id --exp_tag",
+    -msg => "Required options: --det_id --exp_tag --camera",
     -exitval => 3,
 ) unless defined $det_id
-    and defined $exp_tag;
+    and defined $exp_tag,
+    and defined $camera;
+
+$ipprc->define_camera($camera);
 
 use constant RECIPE1 => 'PPIMAGE_J1'; # Recipe to use for ppImage to make JPEGs
@@ -105,7 +109,7 @@
 close $list2File;
 
-# Output products --- need to synch with the camera configuration!
-my $jpeg1Name = $outputRoot . ".b1.jpg"; # Binned JPEG #1
-my $jpeg2Name = $outputRoot . ".b2.jpg"; # Binned JPEG #2
+# Output products
+my $jpeg1 = $ipprc->filename("PPIMAGE.JPEG1", $outputRoot); # Binned JPEG #1
+my $jpeg2 = $ipprc->filename("PPIMAGE.JPEG2", $outputRoot); # Binned JPEG #2
 
 # Make the jpeg for binning 1
@@ -114,5 +118,5 @@
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
 	run(command => $command, verbose => 1);
-    die "Unable to find expected output file: $jpeg1Name\n" if not -f $jpeg1Name;
+    die "Unable to find expected output file: $jpeg1\n" if not -f $jpeg1;
 }
 
@@ -122,5 +126,5 @@
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
 	run(command => $command, verbose => 1);
-    die "Unable to find expected output file: $jpeg2Name\n" if not -f $jpeg2Name;
+    die "Unable to find expected output file: $jpeg2\n" if not -f $jpeg2;
 }
 
@@ -128,9 +132,9 @@
 # Add the result into the database
 $outputRoot = File::Spec->abs2rel( $outputRoot, $ipprc->workdir() );
-$jpeg1Name  = File::Spec->abs2rel( $jpeg1Name, $ipprc->workdir() );
-$jpeg2Name  = File::Spec->abs2rel( $jpeg2Name, $ipprc->workdir() );
+$jpeg1  = File::Spec->abs2rel( $jpeg1, $ipprc->workdir() );
+$jpeg2  = File::Spec->abs2rel( $jpeg2, $ipprc->workdir() );
 unless ($no_update) {
     my $command = "$dettool -addprocessedexp -det_id $det_id -exp_tag $exp_tag " .
-	"-recip " . RECIPE1() . "," . RECIPE2() . " -b1_uri $jpeg1Name -b2_uri $jpeg2Name " .
+	"-recip " . RECIPE1() . "," . RECIPE2() . " -b1_uri $jpeg1 -b2_uri $jpeg2 " .
 	"-bg $bg -bg_stdev $bg_stdev -bg_mean_stdev $bg_mean_stdev"; # Command to run
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
