Index: /trunk/ArchTOIPipe/TestPipes/aksj02.cc
===================================================================
--- /trunk/ArchTOIPipe/TestPipes/aksj02.cc	(revision 2027)
+++ /trunk/ArchTOIPipe/TestPipes/aksj02.cc	(revision 2028)
@@ -42,7 +42,8 @@
 	 << "         [-dbg] [-wtoi sz] [-wclean wsz,nbw] [-range min,max] \n"
 	 << "         [-soff wsz,nptfit,degpol] [-soffnt PPFName] \n"
-	 << "         [-soff2 wsz,nptfit,degpol] [-soffnt2 PPFName] \n"
-	 << "         [-gfilt wsz,sigma] \n"
 	 << "         [-bgalcut bmin,bmax] [-bgal toiname] [-bgalfile pointFitsName] \n"
+	 << "         [-soff2 wsz,nptfit,degpol] [-soff2nt PPFName] \n"
+	 << "         [-bgal2cut bmin,bmax] \n"
+	 << "         [-gfilt wsz,sigma] \n" 
 	 << "         [-nooutflg] [-wrtms] [-wrtifo] [-prstat] [-useseqbuff] \n"
 	 << "         inFitsName outFitsName \n" 
@@ -57,4 +58,10 @@
 	 << "   -soff wsz,nptfit,degpol : set SimpleOffsetEstimator parameters\n"
 	 << "   -soffnt PPFName : Writes out SimpleOffsetEstimator NTuple \n"
+         << "   -bgalcut bmin,bmax: Galactic latitude cut (in degree) for SimpleOffsetEstimator\n"
+         << "   -bgal toiname: Galactic latitude toiname \n"
+         << "   -bgalfile pointFitsName: Pointing FITS file name (for gal. latitude) \n"
+	 << "   -soff2 wsz,nptfit,degpol : set SimpleOffsetEstimator_2 parameters\n"
+	 << "   -soff2nt PPFName : Writes out SimpleOffsetEstimator_2 NTuple \n"
+         << "   -bgal2cut bmin,bmax: Galactic latitude cut (in degree) for SimpleOffsetEstimator_2\n"
 	 << "   -gfilt wsz,sigma : Activate gaussian filter (par= window size, sigma) \n"
       //	 << "   -wfft sz : Activate Fourier filter and sets its width \n"
@@ -124,8 +131,12 @@
   // Coordinate file for galactic cut
   string pointfile = "pointgal.fits";
-  double bmin = -20;
-  double bmax = 20.;
+  double bmin = -10;
+  double bmax = 10.;
+  bool bgalcut = false;
   string bgaltoi = "bgal";
-  bool bgalcut = false;
+  bool bgalfile = false;
+  double bmin2 = -10;
+  double bmax2 = 10.;
+  bool bgal2cut = false;
 
   // File names 
@@ -183,5 +194,5 @@
       ia++;
     }
-    else if (strcmp(arg[ia],"-soffnt2") == 0) { 
+    else if (strcmp(arg[ia],"-soff2nt") == 0) { 
       soff2_nt = true;
       soff2_nt_ppfname = arg[ia+1];  ia++;
@@ -199,7 +210,14 @@
       ia++;
     }
+    else if (strcmp(arg[ia],"-bgal2cut") == 0) {
+      if (ia == narg-1) Usage(true);
+      sscanf(arg[ia+1],"%lf,%lf", &bmin2, &bmax2);
+      bgal2cut = true;
+      ia++;
+    }
     else if (strcmp(arg[ia],"-bgalfile") == 0) {
       if (ia == narg-1) Usage(true);
       pointfile = arg[ia+1];
+      bgalfile = true;
       ia++;
     }
@@ -241,4 +259,6 @@
   InitTim();
   if ((soff2_dofg == true) && (wtoi < 32768))      wtoi = 32768;
+  if (!bgalfile)  bgalcut = bgal2cut = false;
+
   cout << ">>>> aksj02: Infile= " << infile << " outFile=" 
        << outfile << endl; 
@@ -285,10 +305,17 @@
          
     FITSTOIReader* rbgal = NULL;
-    if (bgalcut) {  // if Galactic cut 
+    if (bgalfile) {  // if Galactic cut 
       cout << "> Creating bgal FITSTOIReader object - InFile=" << pointfile 
 	   << " bgaltoiname= " << bgaltoi << endl;
+      rbgal = new FITSTOIReader(pointfile); 
+    }
+    
+    if (bgalfile && bgalcut) { 
       cout << "  offes.SetBGalCut( " << bmin << "," << bmax << ")" << endl;
-      rbgal = new FITSTOIReader(pointfile); 
       offes.SetBGalCut(bmin, bmax);      
+    }
+    if (soff2_dofg && bgalfile && bgal2cut) { 
+      cout << "  offes2.SetBGalCut( " << bmin2 << "," << bmax2 << ")" << endl;
+      offes2.SetBGalCut(bmin, bmax);      
     }
 
@@ -304,6 +331,16 @@
     plombier.Connect(r, intoi, cleaner, inname);
     plombier.Connect(cleaner, "out", offes, "in");
-      
-    if (bgalcut) {
+
+    if (soff2_dofg && bgalcut && bgal2cut ) {
+      inname = "bgal";
+      outname = "bgalcopie";
+      plombier.Connect(*rbgal, bgaltoi, offes, inname);      
+      plombier.Connect(offes, outname, offes2, inname);      
+    }
+    else if (soff2_dofg && bgal2cut) {
+      inname = "bgal";
+      plombier.Connect(*rbgal, bgaltoi, offes2, inname);      
+    }
+    else if (bgalcut) {
       inname = "bgal";
       plombier.Connect(*rbgal, bgaltoi, offes, inname);      
