Index: trunk/ArchTOIPipe/TestPipes/tstmap2toi.cc
===================================================================
--- trunk/ArchTOIPipe/TestPipes/tstmap2toi.cc	(revision 1476)
+++ trunk/ArchTOIPipe/TestPipes/tstmap2toi.cc	(revision 1520)
@@ -17,7 +17,35 @@
 void usage(void) {
  cout<<"tstmap2toi [-h] [-p lp] [-s samplemin,samplemax] [-w data_window_size]"<<endl
-     <<"           [-a label_alpha] [-d label_delta] [-b label_bolomuv]"<<endl
-     <<"           fitsin fitsphere fitsout"<<endl;
+     <<"           [-a label_coord1In] [-d label_coord2In] [-b label_bolomuv]"<<endl
+     <<"           [-i c,h] [-m c,h]"<<endl
+     <<"           fitsin_point fitsphere fitsout"<<endl
+     <<" -p lp : print level (def=0)"<<endl
+     <<" -s samplemin,samplemax : sample range to be treated (def=all)"<<endl
+     <<" -w data_window_size : window size for pipe (def=8192)"<<endl
+     <<" -a label_coord1 : label fits for alpha/gLong (def=coord1)"<<endl
+     <<" -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
+     <<" -i c,h : coordIn caracteristics (c=G/E h=H/D) (def=G,D)"<<endl
+     <<" -m c,h : idem -i for Sphere"<<endl
+     <<" fitsin_point : fits file for pointing"<<endl
+     <<" fitsphere : fits file for input Healpix sphere"<<endl
+     <<" fitsout : fits file for output"<<endl;
  return;
+}
+
+unsigned long typecoord(char typc=' ',char hd=' ');
+unsigned long typecoord(char typc,char hd)
+// typc : G=galactiques, E=equatoriales, autres=galactiques
+// hd : H=heure, D=degre, autres=(heure si typc==E, degre si typc==G)
+{
+  if(typc!='G' && typc!='E') typc='G';
+  if(hd!='H' && hd!='D') {if(typc=='E') hd='H'; else hd='D';}
+ unsigned long rc=TypCoordUndef;
+  if(typc=='G') rc |= TypCoordGal;
+    else        rc |= TypCoordEq;
+  if(hd=='D')   rc |= TypCoordDD;
+    else        rc |= TypCoordHD;
+  return rc;
 }
 
@@ -29,8 +57,9 @@
 //-- Decodage arguments
 int lp = 0, width = 8192;
-char *label_alpha = "alpha", *label_delta = "delta", *label_bolomuv = "boloMuV";
+char *label_coord1 = "coord1", *label_coord2 = "coord2", *label_bolomuv = "boloMuV";
 long sdeb,sfin;
-int c;
-while((c = getopt(narg,arg,"hp:s:w:a:d:b:")) != -1) {
+unsigned long tcoorin=typecoord(), tcoormap=typecoord();
+int c; char t=' ',h=' ';
+while((c = getopt(narg,arg,"hp:s:w:a:d:b:i:m:")) != -1) {
   switch (c) {
   case 's' :
@@ -38,5 +67,5 @@
     cout<<"Requested Samples from "<<sdeb<<" , "<<sfin<<endl;
     if(sfin>=sdeb) mgr->setRequestedSample(sdeb,sfin);
-    else {cout<<"Bad sample interval "<<endl; exit(-2);}
+    else {cout<<"Bad sample interval "<<endl; exit(1);}
     break;
   case 'w' :
@@ -50,30 +79,47 @@
     break;
   case 'a' :
-    label_alpha = optarg;
+    label_coord1 = optarg;
     break;
   case 'd' :
-    label_delta = optarg;
+    label_coord2 = optarg;
     break;
   case 'b' :
     label_bolomuv = optarg;
     break;
+  case 'i' :
+    sscanf(optarg,"%c,%c",&t,&h);
+    tcoorin=typecoord(t,h);
+    break;
+  case 'm' :
+    sscanf(optarg,"%c,%c",&t,&h);
+    tcoormap=typecoord(t,h);
+    break;
   case 'h' :
-    usage(); exit(-1);
-    break;
   default:
-    usage(); exit(-1);
+    usage(); exit(1);
   }
 }
-if(optind+2>=narg) {usage(); exit(-2);}
-char * fitsin          = arg[optind];
+if(optind+2>=narg) {usage(); exit(2);}
+char * fitsin_point    = arg[optind];
 string const fitsphere = arg[optind+1];
 char * fitsout         = arg[optind+2];
 
+{
+unsigned long tg,te,hd,dd;
 cout<<">>>> tstmap2toi:"<<endl
-    <<"Fits Infile(snum,alpha,delta)= "<<fitsin<<endl
-    <<"  ...label_alpha "<<label_alpha<<"  ,  label_delta "<<label_delta<<endl
-    <<"Fits Sphere Healpix"<<fitsphere<<endl
-    <<"Fits Outfile(snum,[alpha,delta],boloMuV)"<<fitsout<<endl
+    <<"Pipe Window Size "<<width<<endl
+    <<"Fits OutFile "<<fitsout<<endl
     <<"  ...label_bolomuv "<<label_bolomuv<<endl;
+tg = tcoorin&TypCoordGal; te = tcoorin&TypCoordEq;
+hd = tcoorin&TypCoordHD;  dd = tcoorin&TypCoordDD;
+cout<<"Fits Infile Pointing "<<fitsin_point<<endl
+    <<"  ...label_coord1 "<<label_coord1<<endl
+    <<"  ...label_coord2 "<<label_coord2<<endl
+    <<"  ...... Gal="<<tg<<" Eq="<<te<<"   hour="<<hd<<" deg="<<dd<<endl;
+tg = tcoormap&TypCoordGal; te = tcoormap&TypCoordEq;
+hd = tcoormap&TypCoordHD;  dd = tcoormap&TypCoordDD; 
+cout<<"Fits Healpix Sphere "<<fitsphere<<endl
+    <<"  ...... Gal="<<tg<<" Eq="<<te<<"   hour="<<hd<<" deg="<<dd<<endl;
+}
 
 SophyaInit();
@@ -85,8 +131,8 @@
 
  // FITS reader et writer
- FITSTOIReader rfits(fitsin);
+ FITSTOIReader rfits(fitsin_point);
  int ncol = rfits.getNOut();
- cout<<"Number of columns in fits Infile : "<<ncol<<endl;
- if(ncol<2) exit(-3);
+ cout<<"Number of columns in fits Infile Pointing : "<<ncol<<endl;
+ if(ncol<2) exit(3);
 
  FITSTOIWriter wfits(fitsout);
@@ -104,26 +150,29 @@
  Map2TOI m2toi(sph);
  cout<<"Map2TOI created"<<endl;
+ m2toi.SetEquinox(2000.);
+ m2toi.SetCoorIn((TypAstroCoord) tcoorin);
+ m2toi.SetCoorMap((TypAstroCoord) tcoormap);
 
  // Definition des tuyaux
- TOISeqBuffered * toialphain = new TOISeqBuffered("toi_alpha_in",width);
- if(lp) toialphain->setDebugLevel(1);
- rfits.addOutput(label_alpha,toialphain);
- m2toi.addInput("AlphaIn",toialphain);
-
- TOISeqBuffered * toialphaout = new TOISeqBuffered("toi_alpha_out",width);
- m2toi.addOutput("AlphaOut",toialphaout);
- wfits.addInput(label_alpha,toialphaout);
-
- TOISeqBuffered * toideltain = new TOISeqBuffered("toi_delta_in",width);
- if(lp) toideltain->setDebugLevel(1);
- rfits.addOutput(label_delta,toideltain);
- m2toi.addInput("DeltaIn",toideltain);
-
- TOISeqBuffered * toideltaout = new TOISeqBuffered("toi_delta_out",width);
- m2toi.addOutput("DeltaOut",toideltaout);
- wfits.addInput(label_delta,toideltaout);
+ TOISeqBuffered * toicoord1in = new TOISeqBuffered("toi_coord1_in",width);
+ // toicoord1in->setDebugLevel(1);
+ rfits.addOutput(label_coord1,toicoord1in);
+ m2toi.addInput("Coord1In",toicoord1in);
+
+ TOISeqBuffered * toicoord1out = new TOISeqBuffered("toi_coord1_out",width);
+ m2toi.addOutput("Coord1Out",toicoord1out);
+ wfits.addInput(label_coord1,toicoord1out);
+
+ TOISeqBuffered * toicoord2in = new TOISeqBuffered("toi_coord2_in",width);
+ // toicoord2in->setDebugLevel(1);
+ rfits.addOutput(label_coord2,toicoord2in);
+ m2toi.addInput("Coord2In",toicoord2in);
+
+ TOISeqBuffered * toicoord2out = new TOISeqBuffered("toi_coord2_out",width);
+ m2toi.addOutput("Coord2Out",toicoord2out);
+ wfits.addInput(label_coord2,toicoord2out);
 
  TOISeqBuffered * toibolout = new TOISeqBuffered("toi_bolo_out",width);
- if(lp) toibolout->setDebugLevel(1);
+ // toibolout->setDebugLevel(1);
  m2toi.addOutput("BoloOut",toibolout);
  wfits.addInput(label_bolomuv,toibolout);
@@ -142,5 +191,5 @@
  if(lp>1)
    for(int jjjj=0;jjjj<5;jjjj++) {
-     cout<<*toialphain; 
+     cout<<*toicoord1in; 
      cout<<*toibolout; 
      sleep(2);
