Index: trunk/ArchTOIPipe/TestPipes/tsttoi2map.cc
===================================================================
--- trunk/ArchTOIPipe/TestPipes/tsttoi2map.cc	(revision 1502)
+++ trunk/ArchTOIPipe/TestPipes/tsttoi2map.cc	(revision 1516)
@@ -19,9 +19,35 @@
  cout<<"tsttoi2map [-h] [-p lp] [-s samplemin,samplemax] [-w data_window_size]"<<endl
      <<"           [-a label_coord1] [-d label_coord2] [-b label_bolomuv]"<<endl
-     <<"           [-n nlat] coord_ini coord_fin fitsin_bolo fitsin_point fitsphout fitsphwout"<<endl
-     <<" coord_ini[_fin] = G for Galactic coordinates"<<endl
-     <<"                 = Q for equatorial coordinates"<<endl
-     <<" coord1 = alpha or longitude ; coord2 = delta or latitude"<<endl;
- return;
+     <<"           [-n nlat] [-i c,h] [-o c,h]"<<endl
+     <<"           fitsin_point fitsin_bolo fitsphout [fitsphwout]"<<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
+     <<" -n nlat : nlat for Healpix sphere (def=128)"<<endl
+     <<" -i c,h : coord1 caracteristics (c=G/E h=H/D) (def=G,D)"<<endl
+     <<" -o c,h : idem -i for coord2"<<endl
+     <<" fitsin_point : fits file for pointing"<<endl
+     <<" fitsin_bolo : fits file for bolo values"<<endl
+     <<" fitsphout : fits file for output Healpix sphere"<<endl
+     <<" fitsphwout : fits file for output Healpix nFilled sphere (def=no)"<<endl;
+}
+
+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;
 }
 
@@ -36,6 +62,8 @@
 char *label_coord1 = "coord1", *label_coord2 = "coord2", *label_bolomuv = "boloMuV";
 long sdeb,sfin;
-int c;
-while((c = getopt(narg,arg,"hGp:s:w:a:d:b:n:")) != -1) {
+string fitsphwout = "";
+unsigned long tcoorin=typecoord(), tcoorout=typecoord();
+int c; char t=' ',h=' ';
+while((c = getopt(narg,arg,"hp:s:w:a:d:b:n:i:o:")) != -1) {
   switch (c) {
   case 's' :
@@ -43,5 +71,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(2);}
     break;
   case 'w' :
@@ -67,34 +95,43 @@
     if(nlat<0) nlat=128;
     break;
+  case 'i' :
+    sscanf(optarg,"%c,%c",&t,&h);
+    tcoorin=typecoord(t,h);
+    break;
+  case 'o' :
+    sscanf(optarg,"%c,%c",&t,&h);
+    tcoorout=typecoord(t,h);
+    break;
   case 'h' :
-    usage(); exit(-1);
-    break;
   default:
-    usage(); exit(-1);
+    usage(); exit(1);
+    break;
   }
 }
-if(optind+3>=narg) {usage(); exit(-2);}
-bool mcoorgal=true;
-bool fcoorgal=true;
+if(optind+2>=narg) {usage(); exit(3);}
  
-if ( strcmp(arg[optind],"Q") == 0) mcoorgal=false; 
-if ( strcmp(arg[optind+1],"Q") == 0) fcoorgal=false; 
- 
-char * fitsin_bolo = arg[optind+2];
-char * fitsin_point = arg[optind+3];
-string const fitsphout = arg[optind+4];
-string fitsphwout = "";
-if(optind+5<narg) fitsphwout = arg[optind+5];
-
+char * fitsin_point = arg[optind];
+char * fitsin_bolo = arg[optind+1];
+string const fitsphout = arg[optind+2];
+if(optind+3<narg) fitsphwout = arg[optind+3];
+
+{
+unsigned long tg,te,hd,dd;
 cout<<">>>> tsttoi2map:"<<endl
-    <<"Fits Infile(snum,bolomuv)= "<<fitsin_bolo<<endl
-    <<"Fits Infile(snum,coord1,coord2)= "<<fitsin_point<<endl
-    <<"  ...label_coord1 "<<label_coord1<<"  ,  label_coord2 "<<label_coord2<<endl
-    <<"  with coordinates Gal "<<mcoorgal<<endl
-    <<"  ...label_bolomuv "<<label_bolomuv<<endl
-    <<"Fits Sphere Healpix"<<fitsphout<<endl
+    <<"Pipe Window Size "<<width<<endl
+    <<"Fits Infile Bolo "<<fitsin_bolo<<endl
+    <<"  ...label_bolomuv "<<label_bolomuv<<endl;
+tg = tcoorin&TypCoordGal; te = tcoorin&TypCoordEq;
+hd = tcoorin&TypCoordHD;  dd = tcoorin&TypCoordDD;
+cout<<"  ...label_coord1 "<<label_coord1<<endl
+    <<"  ...label_coord2 "<<label_coord2<<endl
+    <<"  ...... Gal="<<tg<<" Eq="<<te<<"   hour="<<hd<<" deg="<<dd<<endl;
+tg = tcoorout&TypCoordGal; te = tcoorout&TypCoordEq;
+hd = tcoorout&TypCoordHD;  dd = tcoorout&TypCoordDD; 
+cout<<"Fits Healpix Sphere "<<fitsphout<<endl
     <<"  ...nlat "<<nlat<<endl
-    <<"  with coordinates Gal "<<fcoorgal<<endl
-    <<"Fits Sphere Healpix Error "<<fitsphwout<<endl;
+    <<"  ...... Gal="<<tg<<" Eq="<<te<<"   hour="<<hd<<" deg="<<dd<<endl;
+cout<<"Fits Healpix Weight Sphere "<<fitsphwout<<endl;
+}
 
 SophyaInit();
@@ -109,10 +146,10 @@
  int ncolb = rfitsb.getNOut();
  cout<<"Number of columns in fits Infile_bolo : "<<ncolb<<endl;
- if(ncolb<1) exit(-3);
+ if(ncolb<1) exit(-4);
 
  FITSTOIReader rfitsp(fitsin_point);
  int ncolp = rfitsp.getNOut();
  cout<<"Number of columns in fits Infile_point : "<<ncolp<<endl;
- if(ncolp<2) exit(-3);
+ if(ncolp<2) exit(-5);
 
  // Creation de la sphere Healpix
@@ -126,5 +163,5 @@
    wsph = new SphereHEALPix<r_8>;
    cout<<"SphereHEALPix Weight: Type de map : "<<wsph->TypeOfMap()<<endl
-       <<"               Nombre de pixels : "<<wsph->NbPixels()<<endl;
+       <<"              Nombre de pixels : "<<wsph->NbPixels()<<endl;
  }
 
@@ -132,19 +169,21 @@
  TOI2Map toi2m(sph,wsph);
  cout<<"TOI2Map created"<<endl;
- toi2m.SetCoorGal(mcoorgal,fcoorgal,2000.);  // equinoxe de ref. 2000. (pour archtoi)
+ toi2m.SetEquinox(2000.);
+ toi2m.SetCoorIn((TypAstroCoord) tcoorin);
+ toi2m.SetCoorOut((TypAstroCoord) tcoorout);
 
  // Definition des tuyaux
  TOISeqBuffered * toicoord1in = new TOISeqBuffered("toi_coord1_in",width);
- if(lp) toicoord1in->setDebugLevel(1);
+ // toicoord1in->setDebugLevel(1);
  rfitsp.addOutput(label_coord1,toicoord1in);
  toi2m.addInput("Coord1In",toicoord1in);
 
  TOISeqBuffered * toicoord2in = new TOISeqBuffered("toi_coord2_in",width);
- if(lp) toicoord2in->setDebugLevel(1);
+ // toicoord2in->setDebugLevel(1);
  rfitsp.addOutput(label_coord2,toicoord2in);
  toi2m.addInput("Coord2In",toicoord2in);
  
  TOISeqBuffered * toibolin = new TOISeqBuffered("toi_bolo_in",width);
- if(lp) toibolin->setDebugLevel(1);
+ // toibolin->setDebugLevel(1);
  rfitsb.addOutput(label_bolomuv,toibolin);
  toi2m.addInput("BoloIn",toibolin);
