Index: /trunk/ArchTOIPipe/ProcWSophya/toi2toi_addsp.cc
===================================================================
--- /trunk/ArchTOIPipe/ProcWSophya/toi2toi_addsp.cc	(revision 2098)
+++ /trunk/ArchTOIPipe/ProcWSophya/toi2toi_addsp.cc	(revision 2099)
@@ -3,5 +3,5 @@
 //                               Christophe Magneville
 //                               Reza Ansari
-// $Id: toi2toi_addsp.cc,v 1.1 2002-07-16 08:48:06 cecile Exp $
+// $Id: toi2toi_addsp.cc,v 1.2 2002-07-16 15:26:19 cecile Exp $
 
 #include "machdefs.h"
@@ -9,11 +9,11 @@
 #include "pexceptions.h"
 #include "ctimer.h"
-#include "toi2map.h"
+#include "toi2toi_addsp.h"
 // La valeur "Pi" doit etre celle de smathconst.h a cause du test sur theta
 #include "smathconst.h"
 
 ////////////////////////////////////////////////////////////////////////
-TOI2Map::TOI2Map()
-  : totnscount(0)
+Toi2toi_Addsp::Toi2toi_Addsp(Info_src* info, int_4 ns)
+  : src(info), nb_src(ns)
 {
  SetEquinox();
@@ -26,19 +26,19 @@
 }
 
-TOI2Map::~TOI2Map()
+Toi2toi_Addsp::~Toi2toi_Addsp()
 {
 }
 
 ////////////////////////////////////////////////////////////////////////
-void TOI2Map::Print(::ostream & os)
+void Toi2toi_Addsp::Print(::ostream & os)
 {
 }
 
 ////////////////////////////////////////////////////////////////////////
-void TOI2Map::init() {
-  cout << "TOI2Map::init" << endl;
+void Toi2toi_Addsp::init() {
+  cout << "Toi2toi_Addsp::init" << endl;
+  declareInput("BoloIn"); 
   declareInput("Coord1In");
   declareInput("Coord2In");
-  declareInput("BoloIn"); 
   declareInput("utc"); 
   declareInput("lon"); 
@@ -49,6 +49,5 @@
 
 ////////////////////////////////////////////////////////////////////////
-// define SANS_BUFFER
-void TOI2Map::run()
+void Toi2toi_Addsp::run()
 {
 long snb = getMinIn();
@@ -56,18 +55,18 @@
 
 if(snb>sne) {
-  cout<<"TOI2Map::run() - Bad sample interval"<<snb<<" , "<<sne<<endl;
-  throw ParmError("TOI2Map::run() - Bad sample interval");
+  cout<<"Toi2toi_Addsp::run() - Bad sample interval"<<snb<<" , "<<sne<<endl;
+  throw ParmError("Toi2toi_Addsp::run() - Bad sample interval");
 }
 if(!checkInputTOIIndex(0) || !checkInputTOIIndex(1) || !checkInputTOIIndex(2)) {
-  cout<<"TOI2Map::run() - Input TOI (Coord1In or Coord2In or BoloIn) not connected! "<<endl;
-  throw ParmError("TOI2Map::run() Output TOI (Coord1In or Coord2In or BoloIn) not connected!");
+  cout<<"Toi2toi_Addsp::run() - Input TOI (Coord1In or Coord2In or BoloIn) not connected! "<<endl;
+  throw ParmError("Toi2toi_Addsp::run() Output TOI (Coord1In or Coord2In or BoloIn) not connected!");
 }
 if( !(mTypCoorIn&TypCoordEq || mTypCoorIn&TypCoordGal) ) {
-  cout<<"TOI2Map::run() - Input Coordinates not Eq or Gal! "<<endl;
-  throw ParmError("TOI2Map::run() - Input Coordinates not Eq or Gal!");
+  cout<<"Toi2toi_Addsp::run() - Input Coordinates not Eq or Gal! "<<endl;
+  throw ParmError("Toi2toi_Addsp::run() - Input Coordinates not Eq or Gal!");
 }
 if( !(mTypCoorMap&TypCoordEq || mTypCoorMap&TypCoordGal) ) {
-  cout<<"TOI2Map::run() - Output Coordinates not Eq or Gal! "<<endl;
-  throw ParmError("TOI2Map::run() - Output Coordinates not Eq or Gal!");
+  cout<<"Toi2toi_Addsp::run() - Output Coordinates not Eq or Gal! "<<endl;
+  throw ParmError("Toi2toi_Addsp::run() - Output Coordinates not Eq or Gal!");
 }
 
@@ -76,32 +75,17 @@
 try {
 
-int ii;
-uint_4 mNSnFill=0, mNpixFill=0, NFill[NFILL], BadCoorRange=0;
-for(ii=0;ii<NFILL;ii++) NFill[ii]=0;
 double mjd = MJDfrYear(mActualYear);
 
-cout<<"TOI2Map::run() from "<<snb<<" to "<<sne;
-#ifndef SANS_BUFFER
-int bufsz = 100;
-uint_8* bfgbolo = new uint_8[bufsz];
-double* bbolo   = new double[bufsz];
-double* bc1     = new double[bufsz];
-double* bc2     = new double[bufsz];
-int i0 = -1;
-cout<<" (getData() bufferized)"<<endl;
-#else
-cout<<" (getData() not bufferized)"<<endl;
-#endif
+cout<<"Toi2toi_Addsp::run() from "<<snb<<" to "<<sne;
 
 for(int s=snb;s<=sne;s++) {
   uint_8 fgbolo = 0;
-  double bolo,coord1,coord2;
+  double bolo,bolo_sp,coord1,coord2;
   //              Equatoriales   /   Galactiques
   // coord1,2 =   alpha,delta    /   gLon,gLat
 
-  getData(2,s,bolo,fgbolo);
-  coord1 = getData(0,s);
-  coord2 = getData(1,s);
-  totnscount++;
+  getData(0,s,bolo,fgbolo);
+  coord1 = getData(1,s);
+  coord2 = getData(2,s);
 
   // Comme il n'y a pas de toi en sortie, il faut dire
@@ -129,5 +113,6 @@
   }
   ToCoLat(&coord2,TypUniteD);
-
+  bolo_sp=bolo;
+  
   putData(0,s,bolo_sp,fgbolo);
 
@@ -135,13 +120,13 @@
  
 
- cout<<"TOI2Map::run(): Fin de boucle sur les sampleNum"<<endl;
+ cout<<"Toi2toi_Addsp::run(): Fin de boucle sur les sampleNum"<<endl;
 
 
 //---------------------------------------------------------
 } catch (PException & exc) {
-  cout<<"TOI2Map: Catched Exception "<<(string)typeid(exc).name()
+  cout<<"Toi2toi_Addsp: Catched Exception "<<(string)typeid(exc).name()
       <<"\n .... Msg= "<<exc.Msg()<<endl;
 }
 
-return;                                                                            
+return;      
 }
Index: /trunk/ArchTOIPipe/ProcWSophya/toi2toi_addsp.h
===================================================================
--- /trunk/ArchTOIPipe/ProcWSophya/toi2toi_addsp.h	(revision 2098)
+++ /trunk/ArchTOIPipe/ProcWSophya/toi2toi_addsp.h	(revision 2099)
@@ -5,5 +5,5 @@
 //                               Christophe Magneville
 //                               Reza Ansari
-// $Id: toi2toi_addsp.h,v 1.1 2002-07-16 08:48:06 cecile Exp $
+// $Id: toi2toi_addsp.h,v 1.2 2002-07-16 15:26:19 cecile Exp $
 
 #ifndef TOI2MAP_H
@@ -35,9 +35,17 @@
 // Si les CoordIn et les CoordMap sont equatoriales -> meme equinoxe!
 
-class TOI2Map : public TOIProcessor {
+struct Info_src 
+{
+  double glon,glat;
+  double azi,elv;
+  double amp,tau1,tau2;
+};
+
+void Fill_Info_scr(Info_src* scr, int_4 ns);
+
+class Toi2toi_Addsp : public TOIProcessor {
 public:
-                 TOI2Map();
-                 //TOI2Map(SphereHEALPix<r_8>* map,SphereHEALPix<r_8>* wmap=NULL);
-  virtual	~TOI2Map();
+                 Toi2toi_Addsp(Info_src* info, int_4 ns);
+  virtual	~Toi2toi_Addsp();
 
   virtual void	init(void);
@@ -71,5 +79,4 @@
   // Print
   void Print(::ostream & os);
-  inline int_8	ProcessedSampleCount() const { return totnscount; }
 
 protected:
@@ -77,9 +84,10 @@
   unsigned long mTypCoorIn, mTypCoorMap;
   double mActualYear;
+  Info_src* src;
+  int_4 nb_src;
 
   bool mTFlag,mTMin,mTMax;
   uint_8 mBadFlag;
   r_8 mValMin,mValMax;
-  int_8 totnscount;   // Nombre total d'echantillon processe
 
 };
Index: /trunk/ArchTOIPipe/TestPipes/tsttoi2toi_addsp.cc
===================================================================
--- /trunk/ArchTOIPipe/TestPipes/tsttoi2toi_addsp.cc	(revision 2098)
+++ /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;
+  }
+}
