Index: trunk/AddOn/TAcq/brfitsrd.cc
===================================================================
--- trunk/AddOn/TAcq/brfitsrd.cc	(revision 3639)
+++ trunk/AddOn/TAcq/brfitsrd.cc	(revision 3640)
@@ -38,9 +38,10 @@
 {
   setRC(1);	
-  BRPaqChecker pcheck;  // Verification/comptage des paquets 
 
   try {
     TimeStamp ts; 
-    Timer tm("BRFitsReader");
+    Timer tm("BRFitsReader", false);
+    BRPaqChecker pcheck(~fgnotrl_);  // Verification/comptage des paquets 
+    
     size_t totnbytesrd = 0;
     cout << " BRFitsReader::run() - Starting " << ts << " NbFiles=" << infiles_.size() 
@@ -49,4 +50,11 @@
     uint_4  nfileok = 0; 
     uint_8 nbytesrd = 0;  
+    /*  Variables pour la logique des zones memoire et numeros de paquets dans la zone memoire */
+    int mid = -2;
+    Byte* buff = NULL;  
+    int kmp = 0;   
+    int kmpmax=memgr.NbPaquets(); 
+
+    int paqsz = 0;
     for(int ifile=0; ifile<infiles_.size(); ifile++) {
       string ffname = infiles_[ifile];
@@ -62,18 +70,13 @@
 // Les fichier FITS contiennent l'entet (24 bytes), mais pas le trailer (16 bytes) si fgnotrl=true
       int incpaqsz=0;
-      int paqsz = 0;
       if (fgnotrl_) {
         incpaqsz=16;
         cout << " Warning : FITS files without frame trailers ..." << endl;
       }
-      if (paqsz == 0)  {  // premier passage, on fixe la taille de paquet et on alloue le buffer
+      if (paqsz == 0)  {  // premier passage, on fixe la taille de paquet et on verifie compatibilite avec memgr
         paqsz = mff.NAxis1()+incpaqsz;
         if (paqsz != memgr.PaqSize()) {
          cout << "BRFitsReader::run() mff.NAxis1() incompatible with memgr.PaqSize() -> exception " << endl;
          throw SzMismatchError(" fits file size incompatible with memgr.PaqSize()"); 
-        }
-       if (mff.NAxis2() != memgr.NbPaquets())  {
-         cout << "BRFitsReader::run() mff.NAxis2() <> memgr.NbPaquets() -> exception " << endl;
-         throw SzMismatchError(" fits file NAxies2() <> memgr.NbPaquets()"); 
         }
       }
@@ -83,31 +86,56 @@
         continue;
         }
-        if (memgr.NbPaquets() != mff.NAxis2()) {
-        cout << " PB memgr.NbPaquets() != mff.NAxis2()  --> skipping " << endl;
-        continue;
-        }
-      }
-      int mid = memgr.FindMemZoneId(MemZA_Fill);  
-      Byte* buff = memgr.GetMemZone(mid);
-      if (buff == NULL) {
-	cout << " BRFitsReader::run()/ERROR memgr.GetMemZone(" << mid << ") -> NULL" << endl;
-	setRC(2);	
-	return;	
+      }   
+      if (mid < 0) {
+        mid = memgr.FindMemZoneId(MemZA_Fill);  
+        buff = memgr.GetMemZone(mid);
+        if (buff == NULL) {
+	      cout << " BRFitsReader::run()/ERROR memgr.GetMemZone(" << mid << ") -> NULL" << endl;
+	      setRC(2);	
+	       return;	
+         }
+         kmp=0;
       }
       size_t sx = mff.NAxis1(); 
-      size_t sy = mff.NAxis2();
-      
-      for(int j=0; j<mff.NAxis2(); j++) {
-        mff.ReadB(buff+j*paqsz, sx, j*sx);
-	BRPaquet paq(NULL, buff+j*paqsz, paqsz);
-	pcheck.Check(paq);   // Verification du paquet / FrameCounter 
-
+      size_t sy = mff.NAxis2();      
+      int nprt=0;
+      for(int j=0; j<sy; j++) {
+        mff.ReadB(buff+kmp*paqsz, sx, j*sx);
+        BRPaquet paq(NULL, buff+kmp*paqsz, paqsz);
+        bool pqok = pcheck.Check(paq);   // Verification du paquet / FrameCounter
+        if (!pqok && (nprt < 10)) {
+          cout << "--BUG-- i=" << ifile << " mid=" << mid << " j=" << j << " kmp=" << kmp 
+               << " paqsz=" << paqsz << endl;
+          nprt++; 
+          paq.Print();	
+        }
+        kmp++;
+        if (kmp >= kmpmax)  {   // Zone memoire rempli !
+          memgr.FreeMemZone(mid, MemZS_Filled);
+	      mid = -2;
+          if (j<sy) { 
+            mid = memgr.FindMemZoneId(MemZA_Fill);  
+            buff = memgr.GetMemZone(mid);
+            if (buff == NULL) {
+	          cout << " BRFitsReader::run()/ERROR memgr.GetMemZone(" << mid << ") -> NULL" << endl;
+	          setRC(2);	
+	           return;	
+             }
+             kmp=0;
+          }
+        } 
       }
       nfileok++;   
       size_t nbytesrd = sx*sy;
       totnbytesrd += nbytesrd;
+    }   // Fin de la boucle sur les fichiers
+// Gestion d'une zone partiellement remplie
+    if (mid>=0) {
+      for(int k=kmp;k<kmpmax;k++) {
+      	Byte* bp=buff+k*paqsz;
+      	for(int l=0;l<paqsz;l++) bp[l]=0;
+      }
       memgr.FreeMemZone(mid, MemZS_Filled);
-    }   // Fin de la boucle sur les fichiers
-
+    }
 
 //    sprintf(fname,"%s/.log",path_.c_str());
@@ -120,9 +148,11 @@
     cout << " ------------------  BRFitsReader::run() END ----------------- " << endl;
     ts.SetNow();
-    tm.Split();
+    tm.SplitQ();
     cout << "  END reading " << ts << " NFileOK=" << nfileok << endl; 
     cout << "  TotalDiskRead= " << totnbytesrd/(1024*1024) << " MBytes Disk-Read rate= " 
          << (double)(totnbytesrd)/1024./tm.PartialElapsedTimems() << " MB/s" << endl;    
     pcheck.Print(cout);
+    cout << " BRFitsReader::run()/Timing: \n"; 
+    tm.Print();
     cout << " ---------------------------------------------------------- " << endl;
 
Index: trunk/AddOn/TAcq/brpaqu.cc
===================================================================
--- trunk/AddOn/TAcq/brpaqu.cc	(revision 3639)
+++ trunk/AddOn/TAcq/brpaqu.cc	(revision 3640)
@@ -1,5 +1,2 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
 #include "brpaqu.h"
 
@@ -439,10 +436,13 @@
 // --------------------------------------------------------------------------
 
-BRPaqChecker::BRPaqChecker()
-{
+BRPaqChecker::BRPaqChecker(bool cktrl, int maxprt)
+{
+  cktrl_ = cktrl;	
   totnframes = 0;
   nframeok = 0;
   lostframes = 0;
   frclst = 0;
+  cnt_saut = 0;
+  maxprt_ = maxprt;
   DefineHDRTag();
   DefineTRLTag();
@@ -466,10 +466,9 @@
 
 
-static int cnt_pb = 0;
 bool BRPaqChecker::Check(BRPaquet& paq)
 {
   totnframes++; 
   if (paq.HDRMarker64() != HDRTag()) return false;
-  if (paq.TRLMarker64() != TRLTag()) return false;
+  if (cktrl_&&(paq.TRLMarker64() != TRLTag())) return false;
   /*  DBG 
   if (paq.TRLMarker64() != TRLTag()) { 
@@ -486,6 +485,6 @@
     lostframes += (unsigned long long)delfc - 1;
     if (delfc != 1) { 
-      cnt_pb++; 
-      if (cnt_pb < 5) { 
+      cnt_saut++; 
+      if (cnt_saut < maxprt_) { 
         cout << "BRPaqChecker::Check([NumFrameOK=" << nframeok 
              << ")/Debug  FrameCounter Cur=" << curfc 
@@ -500,11 +499,15 @@
 }
 
-ostream& BRPaqChecker::Print(ostream& os)
+ostream& BRPaqChecker::Print(ostream& os) const
 {
   //  os << "BRPaqChecker:  HDRTag=" << hex << HDRTag() << " TRLTag=" << TRLTag() << dec << "\n"
   //     << " ... Tot.Nb.Frames.Proc=" << totnframes << " NbFrame HDR/TRL OK=" << nframeok 
-  os << "BRPaqChecker: Tot.Nb.Frames.Proc=" << totnframes << " NbFrame HDR/TRL OK=" << nframeok 
-     << " LostFrames=" << lostframes 
-     << " Loss=" << (double)lostframes*100./(double)totnframes << " %" << endl;
+  os << "BRPaqChecker: Tot.Nb.Frames.Proc=" << totnframes << " Nb.HDR/TRL OK=" << nframeok;
+  if (cktrl_) os << " (Check Header AND Trailer)" << endl;
+  else os << " (Header Check only)" << endl;
+  float meangap = (cnt_saut>0)?((float)lostframes/(float)cnt_saut):0.;
+  os   << " ... LostFrames=" << lostframes 
+       << " LossRate=" << (double)lostframes*100./(double)totnframes << " %" 
+       << " NbGaps=" << cnt_saut << " MeanGap=" << meangap << endl;
   return os;
 }
Index: trunk/AddOn/TAcq/brpaqu.h
===================================================================
--- trunk/AddOn/TAcq/brpaqu.h	(revision 3639)
+++ trunk/AddOn/TAcq/brpaqu.h	(revision 3640)
@@ -179,5 +179,5 @@
 class BRPaqChecker {
 public: 
-  BRPaqChecker();
+  BRPaqChecker(bool cktrl=true, int maxprt=0);
   ~BRPaqChecker();
 
@@ -191,5 +191,6 @@
   bool Check(BRPaquet& paq);
   // Imprime le compte de paquets ... 
-  ostream & Print(ostream& os);
+  ostream & Print(ostream& os) const;
+  inline ostream & Print() const { return Print(cout); }
 
   unsigned long long totnframes;    // Nombre totale de frames/paquets traites 
@@ -198,7 +199,15 @@
   unsigned int frclst;         // derniere valeur du frame-counter 
 
+  bool cktrl_;    // Verifie aussi le trailer si true
+  unsigned int cnt_saut;          // Nb de fois ou DeltaFrameCounter>1
+  unsigned int maxprt_;        // Nb maxi de print paquets perdus / probleme
+
   UInt64 hdrtag_;
   UInt64 trltag_; 
 };
+
+// Definition de l'operator << overloading - Appel de Prin() 
+inline ostream& operator << (ostream& s, BRPaqChecker const & chk)
+  {  return chk.Print(s);  }
 
 #endif
Index: trunk/AddOn/TAcq/brproc.cc
===================================================================
--- trunk/AddOn/TAcq/brproc.cc	(revision 3639)
+++ trunk/AddOn/TAcq/brproc.cc	(revision 3640)
@@ -26,5 +26,6 @@
 //---------------------------------------------------------------
 
-BRProcARaw2C::BRProcARaw2C(RAcqMemZoneMgr& mem, string& path, uint_4 nmean, uint_4 step, uint_4 nmax)
+BRProcARaw2C::BRProcARaw2C(RAcqMemZoneMgr& mem, string& path, uint_4 nmean, 
+                           uint_4 step, uint_4 nmax, bool fgnotrl)
   :  memgr(mem) 
 {
@@ -34,4 +35,5 @@
   stop_ = false;	
   path_ = path;	
+  fgnotrl_ = fgnotrl;
 }
 
@@ -50,6 +52,11 @@
   setRC(1);	
   try {
-    Timer tm("BRProcARaw2C");
+    Timer tm("BRProcARaw2C", false);
     TimeStamp ts; 
+    BRPaqChecker pcheck(~fgnotrl_);  // Verification/comptage des paquets 
+    
+    size_t totnbytesout = 0;
+    size_t totnbytesproc = 0;
+
     cout << " BRProcARaw2C::run() - Starting " << ts << " NMaxMemZones=" << nmax_ 
 	 << " NMean=" << nmean_ << " Step=" << step_ << endl;	
@@ -62,5 +69,5 @@
 
 // Initialisation pour calcul FFT 
-    TVector< complex<r_4> > cfour;  // composant TF
+    TVector< complex<r_4> > cfour1;  // composant TF
     uint_4 paqsz = memgr.PaqSize();
     uint_4 procpaqsz = memgr.ProcPaqSize();
@@ -69,12 +76,16 @@
     vx = (r_4)(0.);
     FFTPackServer ffts;
-    ffts.FFTForward(vx, cfour);
-    TVector<r_4> spectreV1, spectreV2;
-  
-    spectreV1.ReSize(cfour.Size());
-    spectreV2.ReSize(cfour.Size());
+    ffts.FFTForward(vx, cfour1);
+    TVector< complex<r_4> > cfour2(cfour1.Size());
     
-    TVector< complex<r_4> > visiV12( cfour.Size() );
+    TVector<r_4> spectreV1(cfour1.Size());
+    TVector<r_4> spectreV2(cfour1.Size());
+    TVector< complex<r_4> > visiV12( cfour1.Size() );
 
+
+    fftwf_plan plan1 = fftwf_plan_dft_r2c_1d(vx.Size(), vx.Data(), 
+                          (fftwf_complex*)cfour1.Data(), FFTW_ESTIMATE); 
+    fftwf_plan plan2 = fftwf_plan_dft_r2c_1d(vx.Size(), vx.Data(), 
+                          (fftwf_complex*)cfour2.Data(), FFTW_ESTIMATE); 
 
     uint_4 ifile = 0;  			        
@@ -85,46 +96,47 @@
       Byte* buff = memgr.GetMemZone(mid);
       if (buff == NULL) {
-  	cout << " BRProcARaw2C::run()/ERROR memgr.GetMemZone(" << mid << ") -> NULL" << endl;
-  	break;		
+         cout << " BRProcARaw2C::run()/ERROR memgr.GetMemZone(" << mid << ") -> NULL" << endl;
+  	     break;		
       }
       Byte* procbuff = memgr.GetProcMemZone(mid);
       if (procbuff == NULL) {
-  	cout << " BRProcARaw2C::run()/ERROR memgr.GetProcMemZone(" << mid << ") -> NULL" << endl;
-  	break;	
+  	    cout << " BRProcARaw2C::run()/ERROR memgr.GetProcMemZone(" << mid << ") -> NULL" << endl;
+        break;	
       }
-      BRPaquet paq0(NULL, buff, paqsz); 
+
       for(uint_4 i=0; i<memgr.NbPaquets(); i+=step_) {
-  	BRPaquet paq(NULL, buff+i*paqsz, paqsz); 
-  	Byte min = 255;
-  	Byte max = 0;
- 
+  	    BRPaquet paq(NULL, buff+i*paqsz, paqsz); 
+        if (!pcheck.Check(paq)) continue;   // on ne traite que les paquets OK
+
 // Traitement voie 1  	    
-  	for(sa_size_t j=0; j<vx.Size(); j++) 
-  	  vx(j) = (r_4)(*(paq.Data1()+j))-127.5;
-        fftwf_complex* coeff1 = (fftwf_complex*)(procbuff+i*procpaqsz);
-        fftwf_plan plan = fftwf_plan_dft_r2c_1d(vx.Size(), vx.Data(), coeff1, FFTW_ESTIMATE); 
-  	fftwf_execute(plan); 
-        //   ffts_.FFTForward(vx, cfour_);
-        complex<r_4>* zp1 = (complex<r_4>*)(coeff1);
+  	    for(sa_size_t j=0; j<vx.Size(); j++) 
+  	      vx(j) = (r_4)(*(paq.Data1()+j))-127.5;
+//        fftwf_complex* coeff1 = (fftwf_complex*)(procbuff+i*procpaqsz);
+  	    fftwf_execute(plan1); 
+//        complex<r_4>* zp1 = (complex<r_4>*)(coeff1);
+//        ffts.FFTForward(vx, cfour1);
         for(sa_size_t j=0; j<spectreV1.Size(); j++) 
-          spectreV1(j) += Zmod2(zp1[j]);
- 
+          spectreV1(j) += Zmod2(cfour1(j));
+        memcpy(procbuff+i*procpaqsz, cfour1.Data(), sizeof(complex<r_4>)*cfour1.Size());
 // Traitement voie 2  	    
-   	for(sa_size_t j=0; j<vx.Size(); j++) 
- 	  vx(j) = (r_4)(*(paq.Data2()+j))-127.5;
-        fftwf_complex* coeff2 = (fftwf_complex*)(procbuff+i*procpaqsz+procpaqsz/2);
-        plan = fftwf_plan_dft_r2c_1d(vx.Size(), vx.Data(), coeff2, FFTW_ESTIMATE); 
-  	fftwf_execute(plan); 
-        //    ffts_.FFTForward(vx, cfour_);
-        complex<r_4>* zp2 = (complex<r_4>*)(coeff2);
+   	    for(sa_size_t j=0; j<vx.Size(); j++) 
+ 	      vx(j) = (r_4)(*(paq.Data2()+j))-127.5;
+
+  	    fftwf_execute(plan2); 
+
         for(sa_size_t j=0; j<spectreV2.Size(); j++) 
-          spectreV2(j) += Zmod2(zp2[j]); 
+          spectreV2(j) += Zmod2(cfour2(j));  // Zmod2(zp2[j]); 
+        memcpy(procbuff+i*procpaqsz+procpaqsz/2, cfour2.Data(), sizeof(complex<r_4>)*cfour2.Size());
 
 // Calcul correlation (visibilite V1 * V2)
-        for(sa_size_t j=0; j<visiV12.Size(); j++) visiV12(j)+=zp1[j]*zp2[j];
+        for(sa_size_t j=0; j<visiV12.Size(); j++) 
+          visiV12(j)+=cfour1(j)*conj(cfour2(j));
+//        for(sa_size_t j=0; j<visiV12.Size(); j++) visiV12(j)+=zp1[j]*zp2[j];
+        nzm++;   
+        totnbytesproc += paq.DataSize();
+        totnbytesout += (2*sizeof(complex<r_4>)*cfour1.Size());
 
-        nzm++;
-      }
-      if ((nzm >= nmean_) ||(kmz==(nmax_-1))) {
+      } // Fin de boucle sur les paquets d'une zone
+      if ((nzm >= nmean_) || ((kmz==(nmax_-1))&&(nzm>1))) {
         spectreV1 /= (r_4)(nzm);
         spectreV2 /= (r_4)(nzm);
@@ -135,5 +147,5 @@
         spectreV2.Info()["NPaqMoy"] = nzm;
         visiV12.Info()["NPaqMoy"] = nzm;
-	{
+	    {
     	sprintf(fname,"%s_%d.ppf",path_.c_str(),(int)ifile);
         POutPersist po(fname);
@@ -141,5 +153,5 @@
         po << PPFNameTag("specV2") << spectreV2; 
         po << PPFNameTag("visiV12") << visiV12; 
-	}
+	    }
         spectreV1 = (r_4)(0.);
         spectreV2 = (r_4)(0.);
@@ -149,8 +161,19 @@
 //        filog << ts << " :  proc file  " << fname << endl;		       
         cout << " BRProcARaw2C::run() created file  " << fname << endl;
-      }
+      }   
       
       memgr.FreeMemZone(mid, MemZS_ProcA);
-    }
+    }  // Fin de boucle sur les zones a traiter 
+  cout << " ------------------  BRProcARaw2C::run() END ----------------- " << endl;
+  ts.SetNow();
+  tm.SplitQ();
+  cout << "  TotalProc= " << totnbytesproc/(1024*1024) << " MBytes, rate= " 
+       << (double)(totnbytesproc)/1024./tm.PartialElapsedTimems() << " MB/s" 
+       << " ProcDataOut=" <<  totnbytesout/(1024*1024) << " MB" << endl;    
+  cout << pcheck;
+  cout << " BRProcARaw2C::run()/Timing: \n"; 
+  tm.Print();
+  cout << " ---------------------------------------------------------- " << endl;
+    
   }
   catch (PException& exc) {
Index: trunk/AddOn/TAcq/brproc.h
===================================================================
--- trunk/AddOn/TAcq/brproc.h	(revision 3639)
+++ trunk/AddOn/TAcq/brproc.h	(revision 3640)
@@ -25,5 +25,6 @@
 class BRProcARaw2C : public ZThread {
 public:	
-  BRProcARaw2C(RAcqMemZoneMgr& mem, string& path, uint_4 nmean=1, uint_4 step=1, uint_4 nmax=100);
+  BRProcARaw2C(RAcqMemZoneMgr& mem, string& path, uint_4 nmean=1, 
+               uint_4 step=1, uint_4 nmax=100, bool fgnotrl=false);
   virtual void run(); 
   void Stop();
@@ -36,4 +37,5 @@
   uint_4 nmean_;  // Nombre de blocs pour le calcul des moyennes 
   string path_;  
+  bool fgnotrl_;   // if true, don't check packet trailer - when using pre-june fits files
 };
 
Index: trunk/AddOn/TAcq/mcrd.cc
===================================================================
--- trunk/AddOn/TAcq/mcrd.cc	(revision 3639)
+++ trunk/AddOn/TAcq/mcrd.cc	(revision 3640)
@@ -59,9 +59,11 @@
   if (narg < 4) {
     cout << " --- Reading/Processing BAORadio FITS files" << endl;
-    cout << " Usage:  mcrd ACT OutPPF -infits DirName Imin Imax " << endl;
+    cout << " Usage:  mcrd ACT OutPPF -infits DirName Imin Imax [NZones,NbPaqinZone] " << endl;
     cout << " ACT= notrl FITS files without frame trailer \n" 
          << " OutPPF : Output PPF file name (without .ppf)" << endl;
     cout << " -infiles DirName Imin Imax : Input fits directory and sequence numbers \n" 
-         << "    FileNames=DirName/signalII.fits Imin<=II<=Imax " << endl;  
+         << "    FileNames=DirName/signalII.fits Imin<=II<=Imax \n"
+         << " - NZones,NbPaqinZone : Number of Zones and number of paquets in one zone\n" 
+         << "     of the RAcqMemZoneMgr memory manager (default = 4,128) " << endl;
     return 1;
   }
@@ -86,4 +88,7 @@
       infiles.push_back(nbuff);
     }
+    int nzones = 4;
+    int npaqz = 128;
+    if (narg>7) sscanf(arg[7],"%d,%d",&nzones,&npaqz);	
 
     cout << " ---------- mcrd.cc Start - ACT= " << act << " ------------- " << endl;
@@ -92,13 +97,15 @@
     if (act=="notrl") fgnotrl=true;  // fichier fits SANS trailer 
 
-    uint_4 paqsz, npaq;
-    DecodeMiniFitsHeader(infiles[0],paqsz, npaq, fgnotrl); 
+    uint_4 paqsz, npaqf;
+    DecodeMiniFitsHeader(infiles[0],paqsz, npaqf, fgnotrl); 
 
-    int nzones = 3;
-    RAcqMemZoneMgr mmgr(nzones, npaq, paqsz, sizeof(complex<r_4>)*paqsz);
+    cout << " mcrd: NZones=" << nzones << " NbPaq=" << npaqz << "(in file=" << npaqf
+         << " ) PaqSz=" << paqsz << endl;
+         
+    RAcqMemZoneMgr mmgr(nzones, npaqz, paqsz, sizeof(complex<r_4>)*paqsz);
     mmgr.SetFinalizedMask((uint_4)MemZS_ProcA);
 
     BRFitsReader reader(mmgr, infiles, fgnotrl);
-    BRProcARaw2C proc(mmgr, outname, npaq, 1, npaq*infiles.size());
+    BRProcARaw2C proc(mmgr, outname, npaqf, 1, npaqf*infiles.size()/npaqz);
 
     cout << " mcrd.cc : Starting threads (reader, proc) ... " << endl;
Index: trunk/AddOn/TAcq/racqumem.cc
===================================================================
--- trunk/AddOn/TAcq/racqumem.cc	(revision 3639)
+++ trunk/AddOn/TAcq/racqumem.cc	(revision 3640)
@@ -54,5 +54,5 @@
 	if (rid < 0) for(uint_4 k=0; k<NbZones(); k++) {
 	  if ((states[k].act == MemZA_None) && 
-	      ((states[k].stat == MemZS_Free)||(states[k].stat & mask_finalized_)) ) {
+	      ((states[k].stat == MemZS_Free)||((states[k].stat&mask_finalized_)==mask_finalized_) )) {
             if (states[k].serial < bestserial) { rid=k; bestserial=states[k].serial; } 
           }
Index: trunk/AddOn/TAcq/racqurw.cc
===================================================================
--- trunk/AddOn/TAcq/racqurw.cc	(revision 3639)
+++ trunk/AddOn/TAcq/racqurw.cc	(revision 3640)
@@ -243,5 +243,7 @@
         sprintf(fname,"%s/signal%d.fits",path_.c_str(),(int)fnum++);
         mff.Open(fname,MF_Write);  //Reza - Ouverture conditionnel fichier 
-        mff.setDTypeNaxis(MF_Byte, paq0.DataSize()+paq0.HeaderSize(), npaqperfile); 
+        // Entete correspondant a l'ecriture tout le paquet - trailer compris (modif Mai 2009)
+        mff.setDTypeNaxis(MF_Byte, paq0.PaquetSize(), npaqperfile);
+        // Sans TRAILER de paquet mff.setDTypeNaxis(MF_Byte, paq0.DataSize()+paq0.HeaderSize(), npaqperfile); 
       }
       else sprintf(fname,"MemDataBloc[%d]-NoDataFile",(int)fnum++);
@@ -274,7 +276,7 @@
 
 	  if (savesig_) // Reza - Ecriture conditionnel fichier fits signal 
-	    mff.WriteB(paq.Header(),paq.PaquetSize()); // ecriture tout le paquet (modif Mai 2009
-	  //  mff.WriteB(paq.Data1(), paq.DataSize());
-	    mff.WriteB(paq.Header(),paq.DataSize()+paq.HeaderSize()); // ecriture datas + header
+	    mff.WriteB(paq.Header(),paq.PaquetSize()); // ecriture tout le paquet (modif Mai 2009)
+	    //  mff.WriteB(paq.Data1(), paq.DataSize());
+	    //  mff.WriteB(paq.Header(),paq.DataSize()+paq.HeaderSize()); // ecriture datas + header
 	}
 	memgr.FreeMemZone(mid, MemZS_Saved);
