Index: trunk/ArchTOIPipe/TestPipes/tsttoi2toi_addsp.cc
===================================================================
--- trunk/ArchTOIPipe/TestPipes/tsttoi2toi_addsp.cc	(revision 2094)
+++ trunk/ArchTOIPipe/TestPipes/tsttoi2toi_addsp.cc	(revision 2099)
@@ -1,4 +1,6 @@
 //#define TOISEQBUFFERED
 
+#include <iostream.h>
+#include <string>
 #include <unistd.h>
 #include <stdlib.h>
@@ -10,10 +12,6 @@
 #include "fitstoiwtr.h"
 #include "toimanager.h"
-#ifdef TOISEQBUFFERED
+#include "toisegment.h"
 #include "toiseqbuff.h"
-#else
-#include "toisegment.h"
-#endif
-
 #include "sambainit.h"
 #include "toi2toi_addsp.h"
@@ -22,5 +20,4 @@
 #include <stdexcept>
 
-void usage(void);
 void usage(void) {
  cout<<"tsttoi2toi_addsp [-h] [-p lp] [-s samplemin,samplemax] [-w data_window_size]"<<endl
@@ -35,12 +32,18 @@
      <<" -d label_coord2 : label fits for delta/gLat (def=coord2)"<<endl
      <<"          coord1 = alpha or gLong ; coord2 = delta or gLat"<<endl
-     <<" -b label_bolomuv : label fits for bolo value (def=boloMuV)"<<endl
+     <<" -b label_bolo_in : label fits for bolo value (def=boloMuV)"<<endl
+     <<" -n label_bolo_out : label fits for bolo value (def=boloMuV_sp)"<<endl
+     <<" -u label_out : label fits for utc (def=UTC)"<<endl
+     <<" -l label_out : label fits for longitude (def=longitude)"<<endl
+     <<" -L label_out : label fits for latitude (def=latitude)"<<endl
      <<" -m vmin : samples are good if sample value >= vmin"<<endl
      <<" -M vmax : samples are good if sample value <= vmax"<<endl
      <<" -f flag : samples are bad if match flag"<<endl
-     <<" -I : sampleNum are implicit in fits files (def=no)"<<endl
      <<" fitsin_point : fits file for pointing"<<endl
      <<" fitsin_bolo : fits file for bolo values"<<endl
-     <<" fitsout_bolo : fits file for output bolo value"<<endl
+     <<" fitsin_utc : fits file for UTC values"<<endl
+     <<" fitsin_lon : fits file for longitude values"<<endl
+     <<" fitsin_lat : fits file for latitude values"<<endl
+     <<" fitsout_bolo : fits file for output bolo value"<<endl;
 }
 
@@ -48,5 +51,9 @@
 int main(int narg, char** arg) {
 
+int_4 ns = 10;
+
 TOIManager* mgr = TOIManager::getManager();
+int wsize = 512; /// Segment size for TOISegmented 
+bool fgsegmented = true;
 
 //-- Decodage arguments
@@ -54,10 +61,15 @@
 bool tflg=false, tmin=false, tmax=false;
 r_8 vmin=-1.e30, vmax=1.e30; uint_8 badflg=0;
-char *label_coord1 = "coord1", *label_coord2 = "coord2"
-   , *label_bolomuv = "boloMuV";
+char * label_coord1 = "coord1";
+char * label_coord2 = "coord2";
+char * label_bolo_in = "boloMuV";
+char * label_bolo_out = "boloMuV_sp";
+char * label_utc= "UTC";
+char * label_lon = "longitude";
+char * label_lat = "latitude";
 double equi=2000.;
 char *tcoorin="gdcdl", *tcoormap="g";
 long sdeb,sfin;
-bool snimplicit = false;
+
 int c;
 while((c = getopt(narg,arg,"hIp:s:w:a:d:b:n:i:o:m:M:f:e:")) != -1) {
@@ -120,7 +132,4 @@
     tflg = true;
     break;
-  case 'I' :
-    snimplicit = true;
-    break;
   case 'h' :
   default:
@@ -136,15 +145,21 @@
 char * fitsin_lon = arg[optind+3];
 char * fitsin_lat = arg[optind+4];
-char * fitsout_bolo = arg[optind+5];
+char * fitsout = arg[optind+5];
 
 cout<<">>>> tsttoi2toi_addsp:"<<endl
     <<"Pipe Window Size "<<width<<endl
     <<"Fits Infile Bolo "<<fitsin_bolo<<endl
-    <<"  ...label_bolo_in "<<label_bolo_in<<endl;
+    <<"  ...label_bolo_in "<<label_bolo_in<<endl
+    <<"Fits Infile Utc "<<fitsin_utc<<endl
+    <<"  ...label_utc "<<label_utc<<endl
+    <<"Fits Infile Lon "<<fitsin_lon<<endl
+    <<"  ...label_lon "<<label_lon<<endl
+    <<"Fits Infile Lat "<<fitsin_lat<<endl
+    <<"  ...label_lat "<<label_lat<<endl;
 cout<<"Fits Infile Pointing "<<fitsin_point<<endl
     <<"  ...label_coord1 "<<label_coord1<<endl
     <<"  ...label_coord2 "<<label_coord2<<endl
     <<"  ...... ctype="<<tcoorin<<endl;
-cout<<"Fits Outfile Bolo"<<fitsout_bolo<<endl
+cout<<"Fits Outfile Bolo "<<fitsout<<endl
     <<"  ...label_bolo_out "<<label_bolo_out<<endl;
 
@@ -155,30 +170,23 @@
 try {
 //--------------------------------------------------------------------
+
+  CGT plombier(fgsegmented,wsize);
+  plombier.SetDebugLevel(99);
   
-  CGT plombier(fgsegmented,wsize);
-  plombier.SetDebugLevel(0);
-
  // FITS reader
  FITSTOIReader rfitsb(fitsin_bolo);
- if(snimplicit) rfitsb.setImplicitSN();
- int ncolb = rfitsb.getNOut();
- cout<<"Number of columns in fits Infile_bolo : "<<ncolb<<endl;
- if(ncolb<1) exit(-4);
-
  FITSTOIReader rfitsp(fitsin_point);
- if(snimplicit) rfitsp.setImplicitSN();
- int ncolp = rfitsp.getNOut();
- cout<<"Number of columns in fits Infile_point : "<<ncolp<<endl;
- if(ncolp<2) exit(-5);
-
-
  FITSTOIReader rfitsu(fitsin_utc);
  FITSTOIReader rfitsl(fitsin_lon);
  FITSTOIReader rfitsL(fitsin_lat);
-
-
+ FITSTOIWriter wfits(fitsout);
+
+ Info_src* scr;
+ Fill_Info_scr(scr,ns);
+ 
  // TOI Processor
- Toi2toi_Addsp toi2t_sp();
+ Toi2toi_Addsp toi2t_sp(scr,ns);
  cout<<"Toi2toi_Addsp created"<<endl;
+
  toi2t_sp.SetEquinox(equi);
  toi2t_sp.SetCoorIn(tcoorin);
@@ -190,7 +198,14 @@
 
  // Definition des tuyaux
+ plombier.Connect(toi2t_sp,"BoloOut",wfits,label_bolo_out);
+ plombier.Connect(rfitsb,label_bolo_in,toi2t_sp,"BoloIn");
+ 
+ // pb dans  prout.addOutput(out, toi);
+ cout << " tout va bien " << endl;
+ //pb dans chkinit(); dans  afterinit()
  plombier.Connect(rfitsp,label_coord1,toi2t_sp,"Coord1In");
+ cout << " ca va plus " << endl;
+
  plombier.Connect(rfitsp,label_coord2,toi2t_sp,"Coord2In");
- plombier.Connect(rfitsb,label_bolo_in,toi2t_sp,"BoloIn");
 
  plombier.Connect(rfitsu,label_utc,toi2t_sp,"utc");
@@ -198,5 +213,4 @@
  plombier.Connect(rfitsL,label_lat,toi2t_sp,"lat");
 
- plombier.Connect(toi2t_sp,"BoloOut",wfits,label_bolo_out);
 
  // Run
@@ -225,2 +239,19 @@
 exit(0);
 }
+
+//--------------------------------------------------------------------
+//--------------------------------------------------------------------
+//--------------------------------------------------------------------
+//--------------------------------------------------------------------
+//--------------------------------------------------------------------
+//--------------------------------------------------------------------
+void Fill_Info_scr(Info_src* scr, int_4 ns)
+{
+  for (int i=0; i<ns ; i++){
+    scr[i].glon = 80.+i*10.;
+    scr[i].glat = 0.;
+    scr[i].amp  = 1.;
+    scr[i].tau1 = 0.5;
+    scr[i].tau2 = 0.5;
+  }
+}
