Index: trunk/ArchTOIPipe/TestPipes/simtst.cc
===================================================================
--- trunk/ArchTOIPipe/TestPipes/simtst.cc	(revision 1491)
+++ trunk/ArchTOIPipe/TestPipes/simtst.cc	(revision 1500)
@@ -31,4 +31,5 @@
 #include "toimanager.h"
 #include "simtoipr.h"
+#include "nooppr.h"
 #include "toiseqbuff.h"
 #include "timing.h"
@@ -45,5 +46,7 @@
     cout << "\n Usage : simtst [-intoi toiname] [-start snb] [-end sne] \n" 
 	 << "         [-dbg] [-wtoi sz] [-wdegli sz] [-range min,max] \n"
-	 <<"          [-wfft sz] [-keepfft n] [-killfreq bf,nharm,sigf \n"
+	 << "         [-degli ns,ns2,mxpt,mnpt,wrec] [-gfilt wsz,sigma] \n"
+	 << "         [-wfft sz] [-keepfft n] [-killfreq bf,nharm,sigf] \n"
+	 << "         [-nooutflg] [-nowrtms] [-nowrticd] \n"
 	 << "         inFitsName outFitsName  outPPFName \n" 
 	 << "   -dbg : sets TOISeqBuffered debug level to 1 \n"
@@ -55,10 +58,14 @@
 	 << "   -wtoi sz : sets TOISeqBuff buffer size (def= 8192)\n"
 	 << "   -wdegli sz : sets deglitcher window size (def= 512) \n"
+	 << "   -degli ns,ns2,maxnpt,minnpt,wrec : sets deglitcher parameters\n"
+	 << "   -gfilt wsz,sigma : Gaussian filter window size and sigma\n"
 	 << "   -wfft sz : Activate Fourier filter and sets its width \n"
 	 << "   -keepfft n : Keeps n spectra (if Fourier filter activated) \n" 
 	 << "   -killfreq bf,nharm,sigf : kills nharm frequency, basefreq=bf \n"
-            "              with a gaussian with width=sigf \n" 
+         << "              with a gaussian with width=sigf \n"
+	 << "   -nooutflg : Don't write flags to output FITS \n"
+	 << "   -nowrtms : Don't write mean/sigma TOI's \n"
+	 << "   -nowrticd : Don't write incopie,degli,deglioffset TOI's \n"
 	 << endl;
-    exit(0);
   }
 }
@@ -74,4 +81,5 @@
   int wtoi = 8192;
   int wdegli = 512;
+  
   int wfft = 4096;
   int keepfft = 0;
@@ -81,8 +89,27 @@
   double range_min = -16000;
   double range_max = 16000.;
+
+  // Deglitcher parameters
+  double degli_ns1 = 3.;
+  double degli_ns2 = 1.5;
+  int degli_minnpt = 2;
+  int degli_maxnpt = 4;
+  int degli_wrec = 10;
+
+  // Gaussian filter parameters
+  int gfilt_wsz = 16;
+  double gfilt_sigma = 2.;
+
+  // File names 
   string infile;
   string outfile;
   string outppfname;
   string intoi = "boloMuV_27";
+
+  bool fg_wrtflag = true;
+  bool fg_nowrtms = false;
+  bool fg_nowrticd = false;
+
+
   bool fg_f_filt = false;
   bool fg_killfreq = false;
@@ -112,4 +139,15 @@
       wdegli = atoi(arg[ia+1]); ia++;
     }    
+    else if (strcmp(arg[ia],"-degli") == 0) {
+      if (ia == narg-1) Usage(true);
+      sscanf(arg[ia+1],"%lf,%lf,%d,%d,%d",  &degli_ns1, &degli_ns2,
+             &degli_maxnpt, &degli_minnpt, &degli_wrec);
+      ia++;
+    }    
+    else if (strcmp(arg[ia],"-gfilt") == 0) {
+      if (ia == narg-1) Usage(true);
+      sscanf(arg[ia+1],"%d,%lf", &gfilt_wsz, &gfilt_sigma);
+      ia++;
+    }    
     else if (strcmp(arg[ia],"-wfft") == 0) {
       if (ia == narg-1) Usage(true);  
@@ -137,4 +175,7 @@
     }    
     else if (strcmp(arg[ia],"-dbg") == 0)  fgdbg = true;
+    else if (strcmp(arg[ia],"-nooutflg") == 0)  fg_wrtflag = false;
+    else if (strcmp(arg[ia],"-nowrtms") == 0)  fg_nowrtms = true;
+    else if (strcmp(arg[ia],"-nowrticd") == 0)  fg_nowrticd = true;
 
     else { ko = ia; break; }  // Debut des noms
@@ -177,5 +218,4 @@
 
     //    char * colname[5] = {"MJD", "UTC","boloMuV_11","magnFlux","pivot"};
-    //    char * toiname[5] = {"MJD", "UTC","bolo11","magneto","pivot"};
     TOISeqBuffered * toiin = new TOISeqBuffered("f2in", w1);
     if (fgdbg) toiin->setDebugLevel(1);
@@ -206,5 +246,7 @@
     cout << " Creating SimpleDeglitcher() " << endl;
     SimpleDeglitcher degl(wdegli);
-    degl.SetDetectionParam(3.,1.5, 4, 2, 10);
+    degl.SetDetectionParam(degli_ns1, degli_ns2, degli_maxnpt,
+                           degli_minnpt, degli_wrec);
+
     cout << " Setting Range for deglitcher: " << range_min 
 	 << " - " << range_max << endl;
@@ -288,6 +330,12 @@
     cout << " Connecting to output (FitsWriter) " << endl;
     
-    w.setOutFlags(true);
-    w.addInput("in", toiincopie);
+    w.setOutFlags(fg_wrtflag);
+
+    // Pour connecter les lignes non connectees au FitsWriter 
+    NoOpProcessor noop[3];
+
+    if (fg_nowrticd) noop[0].addInput("in", toiincopie);
+    else w.addInput("in", toiincopie);
+
     if (fg_f_filt) {
       w.addInput("filtout", toifiltcopie);
@@ -295,8 +343,21 @@
     } 
     else   w.addInput("filtout", toiout);
-    w.addInput("degli", toidegli1);
-    w.addInput("deglioff", toideglioffcopie);
-    w.addInput("mean", toimean1);
-    w.addInput("sigma", toisig);
+
+    if (fg_nowrticd) {
+      noop[1].addInput("in", toidegli1);
+      noop[1].addInput("in2", toideglioffcopie);
+    }
+    else {
+      w.addInput("degli", toidegli1);
+      w.addInput("deglioff", toideglioffcopie);
+    }
+    if (fg_nowrtms) {
+      noop[2].addInput("in", toimean1);
+      noop[2].addInput("in2", toisig);
+    }
+    else {
+      w.addInput("mean", toimean1);
+      w.addInput("sigma", toisig);
+    }
 
     cout << " ------ FITSReaderTOI::PrintStatus() : ----- " << endl;
@@ -319,4 +380,10 @@
     if (fg_f_filt) sfft.start();
     w.start();
+    if (fg_nowrticd) {
+      noop[0].start();
+      noop[1].start();
+    }
+    if (fg_nowrtms) 
+      noop[2].start();
 
     /*
@@ -354,13 +421,13 @@
   }
   catch (PThrowable & exc) {
-    cerr << "\nrztsttoi: Catched Exception \n" << (string)typeid(exc).name() 
+    cerr << "\n simtst: Catched Exception \n" << (string)typeid(exc).name() 
 	 << " - Msg= " << exc.Msg() << endl;
   }
   catch (const std::exception & sex) {
-    cerr << "\nrztsttoi: Catched std::exception \n" 
+    cerr << "\n simtst: Catched std::exception \n" 
 	 << (string)typeid(sex).name() << endl; 
   }
   catch (...) {
-    cerr << "\nrztsttoi: some other exception was caught ! " << endl;
+    cerr << "\n simtst: some other exception was caught ! " << endl;
   }
 
