Index: trunk/tools/eam/teleff/diffmask.pro
===================================================================
--- trunk/tools/eam/teleff/diffmask.pro	(revision 41720)
+++ trunk/tools/eam/teleff/diffmask.pro	(revision 41742)
@@ -12,5 +12,4 @@
 
 if (not($?MATCH_RADIUS)) set MATCH_RADIUS = 2.0
-
 if (not($?USE_CAMSOURCE)) set USE_CAMSOURCE = 0
 
@@ -228,5 +227,9 @@
    end
 
-   sprintf filename "%s.cmf" $diffPath:$i
+   if ($diffOrder == 0)
+     sprintf filename "%s.cmf" $diffPath:$i
+   else
+     sprintf filename "%s.inv.cmf" $diffPath:$i
+   end
    $diffCMF:$i  = `neb-locate -p $filename`
    if ($VERBOSE) echo "found mask: $diffMask:$i CMF: $diffCMF:$i"
@@ -288,5 +291,8 @@
  $diffMode = $4
 
- $diffID = 0
+ $diffID    = 0
+ $diffOrder = 0; # 0 : A of A-B, 1 : B of A-B
+
+ # we do not know if the exposure was used as A or B in the A-B diff.  First try A:
 #$command = difftool -dbname $dbname -listrun -exp_name $expname -warp_id $warpID -dist_group $distGroup -diff_mode $diffMode
  $command = difftool -dbname $dbname -listrun -exp_name $expname -warp_id $warpID -diff_mode $diffMode
@@ -302,4 +308,5 @@
  
   $command = difftool -dbname $dbname -listrun -exp_name $expname -warp_id $warpID -diff_mode $diffMode -template
+  $diffOrder = 1
   
   queueload  myqueue -x "$command"
