Index: trunk/AddOn/TAcq/acqparam_exemple.d
===================================================================
--- trunk/AddOn/TAcq/acqparam_exemple.d	(revision 3912)
+++ trunk/AddOn/TAcq/acqparam_exemple.d	(revision 3913)
@@ -4,4 +4,10 @@
 #          2009 - 2010 
 #################################################################
+#####      Variables d'environnement de configuration
+## BRACQ_TMPDIR , TMPDIR  : Repertoire de fichiers temporaires (defaut=/tmp/)
+## BRACQ_BASEDIR : Base directory (/Raid)
+## BRACQ_FIBERIDS : FiberIds   (defaut 1,2,3,4,5,6,7,8)
+#################################################################
+
 #   Liste des fibres  - @fibres I[,J,K...]  ou @fibers 
 #   @fibers 1,2,3   OU   @fibres 1,2,3
@@ -58,4 +64,10 @@
 #  @ethrtargets Target1 [ Target2 ... ] 
 ethrtargets machine1 machine2 ...
+##  Liste de cible pour chaque machine 
+#  @ethrtargetsf1 targ1 [targ2 ...]
+#  @ethrtargetsf8 targ1 [targ2 ...]
+ethrtargetsf1 machine1 machine2 ...
+ethrtargetsf2 machine1 machine2 ...
+##
 #  Activation du mode transfert direct DMA -> Ethernet , sans decoupage/verification en paquet a la source
 #  @pci2ethdirect
Index: trunk/AddOn/TAcq/brparam.cc
===================================================================
--- trunk/AddOn/TAcq/brparam.cc	(revision 3912)
+++ trunk/AddOn/TAcq/brparam.cc	(revision 3913)
@@ -42,33 +42,75 @@
 }
 
+#define PMAXNBFIBRES 64
 /* --Methode-- */
 BRConfList::BRConfList()
-  : basedir_("./")
-{
+  : basedir_("./"), fiberIds_(PMAXNBFIBRES), tmpdir_("/tmp")
+{
+  InitFromEnv();
 }
 
 /* --Methode-- */
 BRConfList::BRConfList(string basedir)
-  : basedir_(basedir)
-{
+  : basedir_("./"), fiberIds_(PMAXNBFIBRES), tmpdir_("/tmp")
+{
+  InitFromEnv();
+  SetBaseDirectory(basedir);
 }
 
 /* --Methode-- */
 BRConfList::BRConfList(string basedir, vector<ADCBoardDesc> boards)
-  : basedir_(basedir), boards_(boards)
-{
-  size_t len = basedir_.length();
-  if ((len>1)&&(basedir_[len-1]!='/')) basedir_ += '/';
+  : basedir_("./"), fiberIds_(PMAXNBFIBRES), tmpdir_("/tmp")
+{
+  InitFromEnv();
+  SetBaseDirectory(basedir);
+  boards_=boards;
 }
 
 /* --Methode-- */
 BRConfList::BRConfList(BRConfList const & cf)
-  : basedir_(cf.basedir_), boards_(cf.boards_)
-{
-}
-
-/* --Methode-- */
-void BRConfList::SetBaseDirectory(string basedir)
-{
+  : basedir_(cf.basedir_), boards_(cf.boards_), fiberIdsS_(cf.fiberIdsS_), fiberIds_(cf.fiberIds_), tmpdir_(cf.tmpdir_)
+{
+}
+
+/* --Methode-- */
+void BRConfList::InitFromEnv()
+{
+  const char* venvp = NULL; 
+  venvp=getenv("BRACQ_TMPDIR");
+  if (venvp!=NULL) tmpdir_=venvp;
+  else {
+    if (venvp!=NULL) tmpdir_=venvp;
+    venvp = getenv("TMPDIR");
+  }
+  venvp=getenv("BRACQ_BASEDIR");
+  if (venvp!=NULL) { 
+    string ebd=venvp;
+    SetBaseDirectory(ebd);
+  }
+  string fibids="1,2,3,4,5,6,7,8";
+  venvp=getenv("BRACQ_FIBERIDS");
+  if (venvp!=NULL)  fibids=venvp;
+  SetFiberIds(fibids);
+}
+
+/* --Methode-- */
+int BRConfList::SetFiberIds(string& sfids)
+{
+  fiberIdsS_=sfids;
+  vector<string> fibids;
+  FillVStringFrString(sfids, fibids, ',');
+  int rc=0;
+  for (size_t fib=0; fib<fibids.size(); fib++) {
+    if (fib>fiberIds_.size())  break;
+    fiberIds_[fib]=atoi(fibids[fib].c_str()); 
+    rc++;
+  }
+  return rc;
+}
+
+/* --Methode-- */
+void BRConfList::SetBaseDirectory(string& basedir)
+{
+  if (basedir.length()<1)  return;
   basedir_=basedir;
   size_t len = basedir_.length();
@@ -77,8 +119,12 @@
 
 /* --Methode-- */
-void BRConfList::Set(BRConfList const & cf)
+BRConfList& BRConfList::Set(BRConfList const & cf)
 {
   basedir_=cf.basedir_;
   boards_=cf.boards_;
+  fiberIdsS_=cf.fiberIdsS_;
+  fiberIds_=cf.fiberIds_;
+  tmpdir_=cf.tmpdir_;
+  return (*this);
 }
 
@@ -86,6 +132,8 @@
 ostream& BRConfList::Print(ostream& os)
 {
-  os << " ----- BRConfList:: BaseDir:" << basedir_ << " NBoards= " << boards_.size() << endl;
+  os << " ----- BRConfList:: BaseDir=" << basedir_ << " TmpDir=" << tmpdir_ 
+     << " NBoards= " << boards_.size() << endl;
   for(size_t k=0; k<boards_.size(); k++)  boards_[k].Print(os);
+  os << " FiberIdString=" << fiberIdsS_ << endl;
   return os;
 }
@@ -98,5 +146,4 @@
 
 // Classe qui memorise tous les parametres importants de l'acquisition
-#define PMAXNBFIBRES 64
 
 /* --Methode-- */
@@ -110,6 +157,4 @@
 
   FiberListS=fibres;
-  FiberIdsS="1,2,3,4,5,6,7,8";
-  for (int ii=0; ii<PMAXNBFIBRES; ii++)  FiberIds.push_back(ii+1); 
 
   PaqSize=paqsz;
@@ -188,7 +233,5 @@
 
   FiberListS=p.FiberListS;
-  FiberNum=p.FiberNum;
-  FiberIdsS=p.FiberIdsS;
-  FiberIds=p.FiberIds;
+  fiberNum_=p.fiberNum_;
 
   PaqSize=p.PaqSize;
@@ -222,4 +265,7 @@
   pci2eth_fgdirect=p.pci2eth_fgdirect;
   eths_targets=p.eths_targets;
+  eths_stargs=p.eths_stargs;
+  eths_fibtargs=p.eths_fibtargs;
+
   ethr_nlink=p.ethr_nlink;
   ethr_forcesamefc_=p.ethr_forcesamefc_;
@@ -254,6 +300,4 @@
   else if(conf.HasKey("fibers")) 
     FiberListS= conf.SParam("fibers",0,"1");
-  if(conf.HasKey("fiberids"))   
-    FiberIdsS= conf.SParam("fiberids",0,"1");
 
   OutPathName= conf.SParam("outpathname",0,"TstAcq");
@@ -280,8 +324,21 @@
   tcpportid=conf.IParam("tcpportid",0,BRSPORTID);
   if (conf.HasKey("pci2ethdirect"))  pci2eth_fgdirect = true;   // Transfer direct DMA -> Ethernet
-  if (conf.HasKey("ethrtargets")) {    // Machines destinations des paquets 
+  if (conf.HasKey("ethrtargets")) {    // Machines destinations des paquets - memes destinations pour toutes les fibres
     for(int it=0; it<conf.NbParam("ethrtargets"); it++) 
-      eths_targets.push_back(conf.SParam("ethrtargets",it));
-  }
+      eths_stargs.push_back(conf.SParam("ethrtargets",it));
+  }
+
+  const char* ethtf[9]={"ethrtargetsf1","ethrtargetsf2","ethrtargetsf3","ethrtargetsf4",
+                        "ethrtargetsf5","ethrtargetsf6","ethrtargetsf7","ethrtargetsf8"};
+  for(int jj=0;jj<8;jj++) {
+    if (conf.HasKey( ethtf[jj] )) {
+      vector<string> ftargs;
+      int fid=jj+1;
+      for(int it=0; it<conf.NbParam( ethtf[jj] ); it++)
+	ftargs.push_back(conf.SParam( ethtf[jj] ,it));
+      eths_fibtargs[fid]=ftargs;      
+    }
+  }
+
   ethr_nlink=conf.IParam("ethrnlink",0,0);   // Nombre de sources de paquets en reception ethernet 
   if (conf.HasKey("ethrforcesamefc"))  {
@@ -328,12 +385,14 @@
   vector<string> fiblist;
   FillVStringFrString(FiberListS, fiblist, ',');
-  FiberNum.resize(fiblist.size());
+  fiberNum_.resize(fiblist.size());
   for (int fib=0; fib<fiblist.size(); fib++) {
-    FiberNum[fib]=atoi(fiblist[fib].c_str()); 
-  }
-  vector<string> fibids;
-  FillVStringFrString(FiberIdsS, fibids, ',');
-  for (int fib=0; fib<fibids.size(); fib++) {
-    FiberIds[fib]=atoi(fibids[fib].c_str()); 
+    fiberNum_[fib]=atoi(fiblist[fib].c_str()); 
+  }
+
+  eths_targets.resize(fiberNum_.size());
+  for (int fib=0; fib<fiberNum_.size(); fib++) {
+    map< int, vector<string> >::const_iterator itm=eths_fibtargs.find(fiberNum_[fib]);
+    if (itm != eths_fibtargs.end())   eths_targets[fib]=itm->second;
+    else eths_targets[fib]=eths_stargs;
   }
 
@@ -414,8 +473,4 @@
   os << " ------ BRParList::Print() ----- " << endl;
   os << " FiberListS=" << FiberListS ;
-  os << " FiberIdsS=" << FiberIdsS ;
-  os << " Fibers (Num->Id): ";
-  for(size_t f=0; f<NbFibers(); f++)   cout << FiberNum[f] << " -> " << FiberIds[f] << " ; " ;
-  os << endl;
   os << " PaqSize=" <<PaqSize;
   os << " DMA_Size_kb=" <<dmasizekb << " (EndDMA: Maxkw=" << maxkwedma_ << " NRetry=" << nretrydma_ 
@@ -432,17 +487,22 @@
     os << " PaquetSize Reduction, ReducedSize=" << redpqsize << " Offset=" << reducoffset << endl;
   }
-  if (eths_targets.size()>0)   {
-    cout << " DMA->Ethernet NbTargets=" << eths_targets.size() 
-	 << ((pci2eth_fgdirect)?" (DirectTransferMode) " : " " ) << " :";
-    for(size_t it=0; it<eths_targets.size(); it++) cout << eths_targets[it] << " , ";
-    cout << endl;
-  }
-  cout << " TCP-PortId=" << tcpportid << " EthernetRead NbSources (=NbLinks)= " << ethr_nlink << endl;
+  if ((eths_stargs.size()>0)||(eths_fibtargs.size()>0))   {
+    os << " DMA->Ethernet Targets=" << eths_targets.size() 
+	 << ((pci2eth_fgdirect)?" (DirectTransferMode) " : " " ) << endl;
+    
+    for(size_t fib=0; fib<eths_targets.size(); fib++) {
+      os << " Fiber Num=" << fiberNum_[fib] << " --> eth_targets: ";
+      for(size_t it=0; it<eths_targets[fib].size(); it++)
+	os << eths_targets[fib][it] << " ; ";
+    os << endl;
+    }
+  }
+  os << " TCP-PortId=" << tcpportid << " EthernetRead NbSources (=NbLinks)= " << ethr_nlink << endl;
   if (ethr_forcesamefc_)
-    cout << "EthernetReader mode: ForceSameFrameCounter read mode with Max_PaquetCounterDiff= " 
+    os << "EthernetReader mode: ForceSameFrameCounter read mode with Max_PaquetCounterDiff= " 
 	 << ethr_sfc_maxdpc_ << " MaxNbResync=" << ethr_sfc_maxresync_ 
 	 << ((ethr_waitendmsg_)?" Wait_For_END_Message_Before_Terminate ":" ") << endl;
   else
-    cout << "EthernetReader mode: AllOKPaquets read mode " 
+    os << "EthernetReader mode: AllOKPaquets read mode " 
 	 << ((ethr_waitendmsg_)?" Wait_For_END_Message_Before_Terminate ":" ") << endl;
 
@@ -483,4 +543,8 @@
   config_->Print(os);
   param_->Print(os); 
+  os << " Fibers f: Num->Id  ";
+  for(size_t f=0; f<NbFibers(); f++)   
+    os << f << ": " << FiberNum(f) << " -> " << FiberId(f) << " ; " ;
+  os << endl;
   os << " ----------------------------------------------------- " << endl;
 }
@@ -501,5 +565,5 @@
     memset(cmd,0,1024); 
     for (int  i= 0; i< NFibers() ; i++)  {
-      sprintf(cmd,"mkdir %s%s/Fiber%d",config_->BaseDirectory().c_str(), param_->OutPathName.c_str(),param_->FiberNum[i]);
+      sprintf(cmd,"mkdir %s%s/Fiber%d",config_->BaseDirectory().c_str(), param_->OutPathName.c_str(),param_->fiberNum_[i]);
       if (system(cmd) < 0) {
 	cout << "CreateOutputDirectories()/Error: Can not create subdirectory " 
@@ -529,5 +593,5 @@
 {
   char buff[24];
-  sprintf(buff,"Fiber%d/",param_->FiberNum[ifib]);
+  sprintf(buff,"Fiber%d/",param_->fiberNum_[ifib]);
   return ( config_->BaseDirectory() + param_->OutPathName + buff );
 }
Index: trunk/AddOn/TAcq/brparam.h
===================================================================
--- trunk/AddOn/TAcq/brparam.h	(revision 3912)
+++ trunk/AddOn/TAcq/brparam.h	(revision 3913)
@@ -20,4 +20,5 @@
 #include <string>
 #include <vector>
+#include <map>
 #include <iostream>
 #include "brpaqu.h"
@@ -61,12 +62,25 @@
   BRConfList(BRConfList const & cf);
 
-  void SetBaseDirectory(string basedir);
-  void Set(BRConfList const & cf);
+  void SetBaseDirectory(string& basedir);
+  BRConfList& Set(BRConfList const & cf);
+  inline BRConfList& operator = (BRConfList const & cf) { return Set(cf); }
+
+  int SetFiberIds(string& sfids);  // Identification absolue des fibres sous forme de 3,5,8 
+
   ostream& Print(ostream& os) ;
   void ReadDCFile(string file);
   inline const string& BaseDirectory() const { return basedir_; }
+  inline const string& TmpDirectory() const { return tmpdir_; }
+
+  inline int FiberId(int numfib) 
+  { size_t ff=numfib-1; if (ff<fiberIds_.size())  return fiberIds_[ff]; else return 0; }
+
+  void InitFromEnv();  // initialisation a partir de variables d'environnement 
 //.......................................
   string basedir_;
   vector<ADCBoardDesc> boards_;
+  string fiberIdsS_;     // String_liste des numeros 'absolu' des fibres 12,13,14,15 par exemple
+  vector<int> fiberIds_;  // liste des numero d'identification 'absolu' des fibres {12,13,14,15} par ex.
+  string tmpdir_;       // repertoire pour fichiers temporaires 
 };
 
@@ -86,7 +100,10 @@
   void ReadDCFile(string file);
 
-  // Nombre de fibres 
-  inline size_t NFibers() { return FiberNum.size(); } 
-  inline size_t NbFibers() { return FiberNum.size(); } 
+  // Nombre de fibres pour acquisition
+  inline size_t NFibers() { return fiberNum_.size(); } 
+  inline size_t NbFibers() { return fiberNum_.size(); } 
+  // Numeros des fibres pour acquisition 
+  inline int FiberNum(size_t fib) 
+    { if (fib<fiberNum_.size())  return fiberNum_[fib]; else return 0; }
   // Taille des operations DMA (en octets) 
   inline uint_4 DMASizeBytes() { return dmasizekb*1024; }
@@ -114,7 +131,5 @@
   inline uint_4 PatternSize() { return ((PaqSize-(BRHDRSIZE+BRTRLSIZE))/4); }
 
-  // Liste des machines cibles pour transfert sur ethernet
-  inline void SetEthTargets(vector<string>& targs) { eths_targets=targs; return; }
-  inline vector<string>& GetEthTargets() { return eths_targets; }
+  inline vector< vector<string> >& GetEthTargets() { return eths_targets; }
   // Nombre de liens ethernet comme source de donnees (paquets) 
   inline int NbEthLinks() { return ethr_nlink; }
@@ -130,8 +145,6 @@
   bool fgsinglechannel; // true -> un seul canal par fibre (par defaut=2 canaux/fibres)
 
-  string FiberListS ;    // String_liste des fibres a utiliser 1,3,4 par exemple
-  vector<int> FiberNum;  // liste des fibres a utiliser {1,3,4} par exemple
-  string FiberIdsS ;     // String_liste des numeros 'absolu' des fibres 12,13,14,15 par exemple
-  vector<int> FiberIds;  // liste des numero d'identification 'absolu' des fibres {12,13,14,15} par ex.
+  string FiberListS ;    // String_liste des numeros de fibres a utiliser 1,3,4 par exemple
+  vector<int> fiberNum_;  // liste des numeros fibres a utiliser {1,3,4} par exemple
 
   string OutPathName;  // directory de base
@@ -170,7 +183,9 @@
   // Cote Send DMA -> Ethernet 
   bool pci2eth_fgdirect;   // true -> direct transfer DMA to Ethernet  
-  vector< string > eths_targets;   // Liste des machines cibles pour les transferts DMA -> ethernet 
+  vector< vector<string> > eths_targets;   // Liste des machines cibles pour les transferts DMA -> ethernet pour chaque fibre
+  vector<string> eths_stargs;    // cibles communes pour toutes les fibres 
+  map< int, vector<string> > eths_fibtargs;  // Cibles specifiees pour les differentes fibres ds les datacards
   // Cote reception 
-  int ethr_nlink;    // Nombre total de source d'envoi (= nb total de fibre de fibre) 
+  int ethr_nlink;    // Nombre total de source d'envoi (= nb total de fibres = nb total liens ethernet) 
   bool ethr_forcesamefc_;   // true -> on force receptions de paquets avec SAME FrameCounter sur tous les liens 
   uint_4 ethr_sfc_maxdpc_;   // valeur maximum de difference tolere entre compteurs de paquets de differentes fibres 
@@ -241,7 +256,11 @@
   inline bool GetFileDevNull() { return param_->fgnulldev4fits; };
 
-  // Nombre de fibres 
+  // Nombre de fibres pour l'acquisition 
   inline int  NFibers() { return param_->NbFibers(); } 
   inline int  NbFibers() { return param_->NbFibers(); } 
+  // Numeros des fibres pour l'acquisition 
+  inline int FiberNum(size_t fib) { return param_->FiberNum(fib); } 
+  // Identificateurs des fibres 
+  inline int FiberId(size_t fib) { return config_->FiberId( param_->FiberNum(fib) ); }
 
   // Taille des operations DMA (en octets) 
@@ -273,4 +292,6 @@
   inline string OutputDirectory() { return (config_->BaseDirectory()+param_->OutPathName); }
   string OutputDirectoryFib(int fib);
+  // repertoire temporaire
+  inline const string& TmpDirectory() const { return config_->TmpDirectory(); }
 
  protected:
Index: trunk/AddOn/TAcq/mfacq.cc
===================================================================
--- trunk/AddOn/TAcq/mfacq.cc	(revision 3912)
+++ trunk/AddOn/TAcq/mfacq.cc	(revision 3913)
@@ -53,45 +53,12 @@
   
   const char* desact[4] = {"PCIE_To_Ethernet", "Ethernet_To_Disk", "Ethernet_To_Visibilities","PCIE_DMA_To_Disk"};
-  string action=arg[1];
-  int act = 0;
-  if ((action != "-pci2eth")&&(action != "-pci2disk")&&(action != "-eth2disk")&&(action != "-eth2visib")) {
-    cout << " mfacq/Error , Bad action argument : " << action << endl;
-    return 2;
-  }
-  if (action == "-pci2eth")  act=0;
-  else if (action == "-eth2disk") act=1;  
-  else if (action == "-eth2visib") act=2; 
-  else if (action == "-pci2disk")  act=3;
-
-  string pardcfile=arg[2];
-#ifndef NOPCIECARD  
-  string basedir="/Raid";
-#else 
-  string basedir="./";
-#endif 
-  vector<string> oargs;
-  if (narg>3)  {
-    basedir=arg[2];
-    for(int jj=3; jj<narg; jj++)  oargs.push_back(arg[jj]);
-  }
   try {
     // Creation/initialisation parametres Acq
-    BRAcqConfig acpar;
-    acpar.ReadParamFile(pardcfile);
-    acpar.GetConfig().SetBaseDirectory(basedir); 
-    if ((act==0)&&(oargs.size()>0))
-      acpar.GetParams().SetEthTargets(oargs);
-    // Creation des repertoires 
-    if (act > 0) 
-      if (acpar.CreateOutputDirectories()!=0)  return 9;
-    acpar.GetParams().fgdoVisiC=false;
-    if (act == 2)  acpar.GetParams().fgdoVisiC=true;
-
-    acpar.Print(cout);
-    struct sigaction siact;  
-    if (!acpar.GetParams().fg_hard_ctrlc) {
-      siact.sa_handler=Stop;
-      sigaction(SIGINT,&siact,NULL);        
+    int act = DecodeArgs(narg,arg);
+    if ((act < 0)||(act>3))  { 
+      cout << "mfacq/ERROR decoding arguments act=" << act << " -> exit -5" << endl;
+      return -5;
     }
+    cout << " mfacq/INFO action: " << desact[act] << endl; 
     switch (act) {
     case 0:
@@ -139,5 +106,5 @@
 void Usage(bool fgshort) 
 {
-  cout << " Usage: mfacq Action DataCardFile [BaseDirectory / TargetMachines]" << endl;
+  cout << " Usage: mfacq Action DataCardFileName [-dc DataCard -dc DataCard] [TargetMachines]" << endl;
   if (fgshort) return;
   cout << " o Action = -pci2disk , -pci2eth , -eth2disk , -eth2visib \n " 
@@ -145,9 +112,84 @@
        << "     fibres outpathname skysource paqsize dmasizekb nbfiles \n" 
        << "     nblocperfile acqmode memmgr monitor reducpaqsz ... "<< endl;
-  cout << " o BaseDirectory (default= /Raid ) for -pci2disk , -eth2disk" << endl;
+  cout << " o -dc DataCard : datacard appended for DataCardFileName" << endl;
   cout << " o TargetMachines : List of target machines for PCIe2Ethernet (-pci2eth) \n " << endl;
   return;
 }
- 
+
+/* --Nouvelle-Fonction-- */
+int DecodeArgs(int narg, char* arg[])
+{
+  string action=arg[1];
+  int act = 0;
+  if ((action != "-pci2eth")&&(action != "-pci2disk")&&(action != "-eth2disk")&&(action != "-eth2visib")) {
+    cout << " mfacq/Error , Bad action argument : " << action << endl;
+    return -2;
+  }
+  if (action == "-pci2eth")  act=0;
+  else if (action == "-eth2disk") act=1;  
+  else if (action == "-eth2visib") act=2; 
+  else if (action == "-pci2disk")  act=3;
+
+  BRAcqConfig acpar;
+  char tmpdcname[128];
+  sprintf(tmpdcname,"%s/dc_XXXXXX",acpar.TmpDirectory().c_str());
+  mktemp(tmpdcname);
+  string dcardfile=tmpdcname;
+  dcardfile+=".d";
+  string pardcfile=arg[2];
+  char cmd[512];
+  sprintf(cmd,"cp %s %s",pardcfile.c_str(),dcardfile.c_str());
+  cout << " mfacq/DecodeArgs() executing command: " << cmd << endl;
+  int rc;
+  rc=system(cmd);
+  if (rc!=0) { 
+    cout << " mfacq/ERROR system(cmd) , Rc=" << rc << endl;
+    return -3;
+  }
+  
+  vector<string> oargs;
+  int aoff=3;
+  {
+    ofstream dcf( dcardfile.c_str(), ios_base::out|ios_base::app);
+    dcf << "#### Appended datacards from command line " << endl;
+    while (aoff<(narg-1)) {
+      if (strcmp(arg[aoff],"-dc") != 0) break;
+      dcf << arg[aoff+1] << endl;
+    }
+    if ((act==0)&&(aoff<narg)) {  // default ethernet target destinations 
+      dcf << "@ethrtargets  ";
+      for(int jj=aoff; jj<narg; jj++)  dcf << arg[jj] << " ";
+      dcf << endl;
+    }
+  }
+
+  acpar.GetParams().fgdoVisiC=false;
+  if (act == 2)  acpar.GetParams().fgdoVisiC=true;
+  
+  acpar.ReadParamFile(dcardfile);
+  acpar.CreateOutputDirectories();
+
+  sprintf(cmd,"cp %s %s/acqparm.d",dcardfile.c_str(),acpar.OutputDirectory().c_str());
+  cout << " mfacq/DecodeArgs() executing command: " << cmd << endl;
+  rc=system(cmd);
+  if (rc!=0) { 
+    cout << " mfacq/ERROR system(cmd) , Rc=" << rc << endl;
+    return -3;
+  }
+
+  acpar.Print(cout);
+  string pflnm=acpar.OutputDirectory();
+  pflnm+="/params.log";
+  ofstream pfile(pflnm.c_str());
+  acpar.Print(pfile);
+
+  struct sigaction siact;  
+  if (!acpar.GetParams().fg_hard_ctrlc) {
+    siact.sa_handler=Stop;
+    sigaction(SIGINT,&siact,NULL);        
+  }
+
+  return act;
+}
  
 /* --Nouvelle-Fonction-- */
@@ -210,5 +252,5 @@
   vector<PCIEWrapperInterface*> vec_pciw;
   for  (size_t i=0 ;i<bpar.NFibers();i++)  {
-    pciwp[i]->SetFiberNumId(acpar.FiberNum[i], acpar.FiberIds[i]);
+    pciwp[i]->SetFiberNumId(bpar.FiberNum(i), bpar.FiberId(i));
     vec_pciw.push_back( pciwp[i]);
     //    cout << " mfacq[3.b]/Debug - pciwp[" << i << "] " << hex << pciwp[i] << dec << endl;
@@ -299,5 +341,5 @@
   vector<PCIEWrapperInterface*> vec_pciw;
   for  (size_t i=0 ;i<bpar.NFibers();i++)  { 
-    pciwp[i]->SetFiberNumId(acpar.FiberNum[i], acpar.FiberIds[i]);
+    pciwp[i]->SetFiberNumId(bpar.FiberNum(i), bpar.FiberId(i));
     vec_pciw.push_back( pciwp[i]);
   }
@@ -329,7 +371,4 @@
 }
 
-
-/* Fonction-Utilitaire : Voir en fin de fichier  */
-MemZaction ConvertMemZ_Status2Action( MemZStatus st );
 
 /* --Nouvelle-Fonction-- */
@@ -385,5 +424,5 @@
   string ppath=bpar.OutputDirectory();
   MonitorProc PrThr(mmgr);
-  PrThr.SetMemZAction( ConvertMemZ_Status2Action( mskmon ) );
+  PrThr.SetMemZAction( RAcqMemZoneMgr::Convert_Status2Action( mskmon ) );
   BRVisCalcGroup VCGThr(acpar.nbcalgrpVisiC, mmgr, bpar.OutputDirectory(), acpar.nmeanVisiC, acpar.nthrVisiC);
   VCGThr.SelectFreqBinning(acpar.freqminVisiC, acpar.freqmaxVisiC, acpar.nbinfreqVisiC);
@@ -436,40 +475,2 @@
 
 
-/* --Nouvelle-Fonction-Utilitaire */
-MemZaction ConvertMemZ_Status2Action( MemZStatus st )
-{
-  MemZaction ra=MemZA_None;
-  switch (st) {
-  case MemZS_Filled:
-    ra=MemZA_Fill;
-    break;
-  case MemZS_Saved:
-    ra=MemZA_Save;
-    break;
-  case MemZS_Proc:
-    ra=MemZA_Proc;
-    break;
-  case MemZS_ProcA:
-    ra=MemZA_ProcA;
-    break;
-  case MemZS_ProcB:
-    ra=MemZA_ProcB;
-    break;
-  case MemZS_ProcC:
-    ra=MemZA_ProcC;
-    break;
-  case MemZS_ProcD:
-    ra=MemZA_ProcD;
-    break;
-  case MemZS_ProcE:
-    ra=MemZA_ProcE;
-    break;
-  case MemZS_ProcF:
-    ra=MemZA_ProcF;
-    break;
-  default:
-    ra=MemZA_None;
-    break;
-  }
-  return ra;
-}
Index: trunk/AddOn/TAcq/mfacq.h
===================================================================
--- trunk/AddOn/TAcq/mfacq.h	(revision 3912)
+++ trunk/AddOn/TAcq/mfacq.h	(revision 3913)
@@ -3,4 +3,6 @@
 #include <signal.h>
 #include <iostream>
+#include <fstream>
+
 #include <stdlib.h>
 #include <string.h>
@@ -40,6 +42,5 @@
 // Fonctions appelees par le main 
 void Usage(bool fgshort=true);
-int DecodeArgs(string Fibres);
-
+int DecodeArgs(int narg, char* arg[]);
 
 int PCIEToEthernetTransfer();
Index: trunk/AddOn/TAcq/racqueth.cc
===================================================================
--- trunk/AddOn/TAcq/racqueth.cc	(revision 3912)
+++ trunk/AddOn/TAcq/racqueth.cc	(revision 3913)
@@ -32,5 +32,26 @@
 /* --Methode-- */
 PCIEToEthernet::PCIEToEthernet(vector<PCIEWrapperInterface*> vec_pciw, vector<string>& destname, BRParList const& par, int portid)
-  :   par_(par), vec_pciw_ (vec_pciw), destname_(destname), tcpportid_(portid)
+  :   par_(par), vec_pciw_ (vec_pciw), tcpportid_(portid)
+{
+  if (vec_pciw_.size() > MAXNBFIB) 
+    throw ParmError("PCIEToEthernet:ERROR/  vec_pciw.size() > MAXNBFIB ");
+  for(size_t i=0; i<vec_pciw_.size(); i++) destname_.push_back(destname);
+  InitConnections();
+}
+
+/* --Methode-- */
+PCIEToEthernet::PCIEToEthernet(vector<PCIEWrapperInterface*> vec_pciw, vector< vector<string> >& destname, BRParList const& par, int portid)
+  :   par_(par), vec_pciw_ (vec_pciw), tcpportid_(portid)
+{
+  if (vec_pciw_.size() > MAXNBFIB) 
+    throw ParmError("PCIEToEthernet:ERROR/  vec_pciw.size() > MAXNBFIB ");
+  if (destname.size()!=vec_pciw.size()) 
+    throw ParmError("PCIEToEthernet:ERROR/  vec_pciw.size() != destname_.size() ");
+  destname_= destname;
+  InitConnections();
+}
+
+/* --Methode-- */
+void PCIEToEthernet::InitConnections()
 {
   nmaxpaq_ = par_.MaxNbPaquets();	
@@ -40,7 +61,6 @@
   packSizeInMgr_=par_.MMgrPaquetSize();
   sizeFr_=par_.DMASizeBytes();
-  if (vec_pciw.size() > MAXNBFIB) 
-    throw ParmError("PCIEToEthernet:ERROR/  vec_pciw.size() > MAXNBFIB ");
-  nbDma_= vec_pciw.size();
+  
+  nbDma_= vec_pciw_.size();
 
  //  true -> direct transfer of data to ethernet
@@ -51,6 +71,7 @@
     vector<ClientSocket> vskt;
     vector<uint_8> verrcnt;
-    for(size_t j=0; j<destname_.size(); j++) {
-      ClientSocket sok(destname_[j], tcpportid_);
+    vector<string>& sdestnm=destname_[i];
+    for(size_t j=0; j<sdestnm.size(); j++) {
+      ClientSocket sok(sdestnm[j], tcpportid_);
       for(int ii=0; ii<BRTCPMSGLEN; ii++) msg[ii]='\0';
       uint_4 dmasz = (fgdirectsend_)  ? vec_pciw_[0]->TransferSize() : 0;
@@ -66,5 +87,5 @@
 	throw SocketException("PCIEToEthernet:ERROR/  Connection to EthernetReader not established ");
       }
-      cout << " PCIEToEthernet: Ethernet connection established for DMA/fiber" << i << " with " << destname_[j] << endl;
+      cout << " PCIEToEthernet: Ethernet connection established for DMA/fiber" << i << " with " << sdestnm[j] << endl;
       vskt.push_back(sok);
       verrcnt.push_back(0);
@@ -78,5 +99,5 @@
   totrdsnd_ = 0;
   stopreason_="??Unknown??";
-  SetPrintLevel(par.prtlevel_,par.prtmodulo_);
+  SetPrintLevel(par_.prtlevel_,par_.prtmodulo_);
 }
 
@@ -87,5 +108,5 @@
     vector<ClientSocket>& vskt = vvec_skt_[i];
     vector<uint_8>& verrcnt = vvec_errorcnt_[i];
-    for(size_t j=0; j<destname_.size(); j++) { 
+    for(size_t j=0; j<vskt.size(); j++) { 
       cout << " ~PCIEToEthernet() closing socket, fiber/pcieNum=" << i << " ethernet_destNum=" << j 
 	   << " ErrorCount=" << verrcnt[j] << endl;
@@ -162,5 +183,5 @@
 	throw SocketException("PCIEToEthernet:ERROR/  BAD Go message from EthernetReader ");
       }
-    cout << " PCIEToEthernet::run() Received GO message for Fiber/DMA " << i << " from " << destname_[j] << endl;
+    cout << " PCIEToEthernet::run() Received GO message for Fiber/DMA " << i << " from " << destname_[i][j] << endl;
     }
   }
@@ -175,4 +196,5 @@
     vec_pciw_[i]->SetMaxWaitEndDMA(par_.first_maxkwedma_,par_.first_nretrydma_);
 
+  bool fg_change_timeout=true;
   while (npaqfaitg < nmaxpaq_) {  // Boucle global G 
     if (fgarret) break;
@@ -184,7 +206,8 @@
     // Lancement des DMA 
     for (int dma=0; dma < (int)nbDma_ ;dma++) vec_pciw_[dma]->StartTransfers();
-    if (npaqfaitg==1)  { 
+    if ((npaqfaitg>1)&&fg_change_timeout)  { 
       for (int i=0;i< (int)nbDma_ ;i++)
 	vec_pciw_[i]->SetMaxWaitEndDMA(par_.maxkwedma_,par_.nretrydma_);
+      fg_change_timeout=false;
     }
     
Index: trunk/AddOn/TAcq/racqueth.h
===================================================================
--- trunk/AddOn/TAcq/racqueth.h	(revision 3912)
+++ trunk/AddOn/TAcq/racqueth.h	(revision 3913)
@@ -51,5 +51,9 @@
 class PCIEToEthernet : public ZThread {
 public:
-  PCIEToEthernet(vector<PCIEWrapperInterface*> vec_pciw , vector<string>& destname, BRParList const& par, int portid=BRSPORTID);
+  // Specification de destinations : nom_de_machine ou numero IP (192.168.55.2 ...)
+  //  Meme series de destination pour toutes les fibres (DMA) 
+  PCIEToEthernet(vector<PCIEWrapperInterface*> vec_pciw, vector<string>& destname, BRParList const& par, int portid=BRSPORTID);
+  //  Une serie  de destinations pour chaque fibres
+  PCIEToEthernet(vector<PCIEWrapperInterface*> vec_pciw, vector< vector<string> >& destname, BRParList const& par, int portid=BRSPORTID);
   virtual ~PCIEToEthernet();
   virtual void run(); 
@@ -61,4 +65,5 @@
 
 protected: 
+  virtual void InitConnections();
   virtual size_t SendToTargets(int fib, Byte* data, size_t len, bool fgfin=false);
   virtual void CleanUpEndSendAllLinks();
@@ -71,5 +76,5 @@
   unsigned int sizeFr_ ;
   vector<PCIEWrapperInterface *> vec_pciw_;
-  vector<string> destname_; 
+  vector< vector<string> > destname_; 
   int tcpportid_;
   vector< vector<ClientSocket> > vvec_skt_;
Index: trunk/AddOn/TAcq/racqumem.cc
===================================================================
--- trunk/AddOn/TAcq/racqumem.cc	(revision 3912)
+++ trunk/AddOn/TAcq/racqumem.cc	(revision 3913)
@@ -263,4 +263,5 @@
 }
 
+/* --Methode-- */
 ostream& RAcqMemZoneMgr::Print(ostream& os)
 {
@@ -280,4 +281,5 @@
 }
 
+/* --Methode-- */
 void RAcqMemZoneMgr::Stop()
 {
@@ -287,2 +289,42 @@
   mex.broadcast();
 }
+
+/* --Methode-- */
+MemZaction RAcqMemZoneMgr::Convert_Status2Action(MemZStatus st)
+// methode statique 
+{
+  MemZaction ra=MemZA_None;
+  switch (st) {
+  case MemZS_Filled:
+    ra=MemZA_Fill;
+    break;
+  case MemZS_Saved:
+    ra=MemZA_Save;
+    break;
+  case MemZS_Proc:
+    ra=MemZA_Proc;
+    break;
+  case MemZS_ProcA:
+    ra=MemZA_ProcA;
+    break;
+  case MemZS_ProcB:
+    ra=MemZA_ProcB;
+    break;
+  case MemZS_ProcC:
+    ra=MemZA_ProcC;
+    break;
+  case MemZS_ProcD:
+    ra=MemZA_ProcD;
+    break;
+  case MemZS_ProcE:
+    ra=MemZA_ProcE;
+    break;
+  case MemZS_ProcF:
+    ra=MemZA_ProcF;
+    break;
+  default:
+    ra=MemZA_None;
+    break;
+  }
+  return ra;
+}
Index: trunk/AddOn/TAcq/racqumem.h
===================================================================
--- trunk/AddOn/TAcq/racqumem.h	(revision 3912)
+++ trunk/AddOn/TAcq/racqumem.h	(revision 3913)
@@ -169,4 +169,7 @@
     { runstate_ = st; return runstate_; }
 
+  // Conversion Status -> action 
+  static MemZaction Convert_Status2Action(MemZStatus st);
+
 protected:
   void Init();  // Fait l'allocation des differents buffers - est appele par les constructeurs
Index: trunk/AddOn/TAcq/racqurw.cc
===================================================================
--- trunk/AddOn/TAcq/racqurw.cc	(revision 3912)
+++ trunk/AddOn/TAcq/racqurw.cc	(revision 3913)
@@ -546,5 +546,6 @@
   for (int i=0;i< (int)nbDma_ ;i++) npaqfait[i]=0;
     // Byte* nextdma = locdata+((kmz%memgr.NbZones())*(paqsz*memgr.NbPaquets()));
-  uint_4 npaqfaitg = 0;      
+  uint_4 npaqfaitg = 0; 
+  bool fg_change_timeout=true;     
   //      for (uint_4 i=0; i<memgr.NbPaquets(); i += pktInDMATr) {  // attention pktInDMATr paquets dans 1 seul DMA
   while (npaqfaitg < nmax_*memgr.NbPaquets()) {  // Boucle global G 
@@ -554,7 +555,8 @@
     // Lancement des DMA 
     for (int dma=0; dma < (int)nbDma_ ;dma++) vec_pciw_[dma]->StartTransfers();
-    if (npaqfaitg==1)  { 
+    if ((npaqfaitg>1)&&fg_change_timeout)  { 
       for (int i=0;i< (int)nbDma_ ;i++)
 	vec_pciw_[i]->SetMaxWaitEndDMA(par_.maxkwedma_,par_.nretrydma_);
+      fg_change_timeout=false;
     }
     // On pointe vers le debut de la zone a remplir aver le prochain DMA
@@ -938,5 +940,5 @@
     mff[fib].AddKeyS("BRPAQCFMT", BRPaquet::FmtConvToString(acpar.GetParams().GetDataConvFg()), 
 		         " BAORadio BRPaquet DataFormatConversion" );
-    mff[fib].AddKeyI("FIBERNUM", acpar.GetParams().FiberNum[fib], " Fiber number") ;
+    mff[fib].AddKeyI("FIBERNUM", acpar.FiberNum(fib), " Fiber number") ;
     mff[fib].AddKeyI("FIBERID",memgr.FiberId(fib), " Fiber identifier (absolute id)"); 
     if (hassrc) 
