Index: /trunk/AddOn/TAcq/branap.cc
===================================================================
--- /trunk/AddOn/TAcq/branap.cc	(revision 3945)
+++ /trunk/AddOn/TAcq/branap.cc	(revision 3946)
@@ -232,4 +232,5 @@
        << " Bands: N=" <<  nbands_ << " First=" << bandfirst_ << " Last=" << bandlast_
        << endl;
+  cout << " force frequence median filtering (action gain)" << endl;
   cout << " Spectra TimeWindow (Nb.Paquets) Size=" << spec_win_sz_ << " ExtensionSize=" << spw_ext_sz_ 
        << " MaxNbFile=" << nbmax_specwfiles_ << endl; 
Index: /trunk/AddOn/TAcq/brproc.cc
===================================================================
--- /trunk/AddOn/TAcq/brproc.cc	(revision 3945)
+++ /trunk/AddOn/TAcq/brproc.cc	(revision 3946)
@@ -94,6 +94,6 @@
   
   //  cout << "(JEC) creation tuple de " << nchan*(1+numberOfBands_) << " doubles " << endl;
-  // CHECK : ATTENTION , on alloue une taille minimum pour le tableau xnt, reallocation si DefineDataTable() appele
-  xnt_=new double[nchan*2];
+  //  xnt_=new double[nchan*(1+numberOfBands_)];  // CHECK : ATTENTION la taille depend de nombre de colonne du NTuple !
+  xnt_=NULL;
 }
 
@@ -168,5 +168,4 @@
   //  xnt_=new double[nchan*2];  CHECK : faut-il reallouer ?
   cout << "(JEC) creation tuple de " << nchan*(1+numberOfBands_) << " doubles " << endl;
-  if (xnt_) delete[] xnt_;
   xnt_=new double[nchan*(1+numberOfBands_)];
   cout << "(JEC) BRMeanSpecCalculator::DefineDataTable END" << endl;
@@ -320,33 +319,36 @@
     // Boucle sur les numeros de voie (canaux) 
     for(sa_size_t i=0; i<spec_window_.SizeY(); i++)  {
+
+      clnflg_(i,kz)=0;
+
       double mean, sigma;
       ////////BUG      sa_size_t kz=PaqNumToArrayIndex(totnbpaq_); 
       double variance=0.;
       variance=spec_window_(Range(1,Range::lastIndex()), Range(i), Range(kz)).Sum();
-      xnt_[i]=variance;
-      //Compute nomalized variance in bands freq. 
-      sa_size_t fMin;
-      sa_size_t fMax;
-      int bandW = spec_window_.SizeX()/numberOfBands_;
-      vector<double> varNomBinned(numberOfBands_);
-      for (sa_size_t j=0; j<numberOfBands_; j++){
-	fMin = j*bandW;
-	fMax =fMin+bandW-1;
-	varNomBinned[j]=spec_window_(Range(fMin,fMax), Range(i), Range(kz)).Sum();
-	varNomBinned[j]/=(r_4)bandW;
-	xnt_[spec_window_.SizeY()+i*numberOfBands_+j] =  varNomBinned[j];
-      }//eof
-
-      clnflg_(i,kz)=0;
-      for (sa_size_t j=ibandfirst_; j<=ibandlast_; j++){
-	//        cout << "(jec) var["<<j<<"] =" << varNomBinned[j]
-	//     << " min " << varmin_
-	//     << " max " << varmax_ << endl;
-	if(varNomBinned[j]<varmin_)      { clnflg_(i,kz)=10+j;  nbadpaq_[i]++; break;}
-	else if(varNomBinned[j]>varmax_) { clnflg_(i,kz)=100+j; nbadpaq_[i]++; break;}
-      }
-      //cout << "clnflg_("<<i<<","<<kz<<"): " << clnflg_(i,kz)  << endl;
-    }
-    if (dtp_)  dtp_->AddRow(xnt_);
+      if(xnt_)xnt_[i]=variance;
+      if(numberOfBands_>0){
+	//Compute nomalized variance in bands freq. 
+	sa_size_t fMin;
+	sa_size_t fMax;
+	int bandW = spec_window_.SizeX()/numberOfBands_;
+	vector<double> varNomBinned(numberOfBands_);
+	for (sa_size_t j=ibandfirst_; j<=ibandlast_; j++){
+	  fMin = j*bandW;
+	  fMax =fMin+bandW-1;
+	  varNomBinned[j]=spec_window_(Range(fMin,fMax), Range(i), Range(kz)).Sum();
+	  varNomBinned[j]/=(r_4)bandW;
+	  if(xnt_)xnt_[spec_window_.SizeY()+i*numberOfBands_+j] =  varNomBinned[j];
+
+	  //        cout << "(jec) var["<<j<<"] =" << varNomBinned[j]
+	  //     << " min " << varmin_
+	  //     << " max " << varmax_ << endl;
+	  if(varNomBinned[j]<varmin_)      { clnflg_(i,kz)=10+j;  nbadpaq_[i]++; break;}
+	  else if(varNomBinned[j]>varmax_) { clnflg_(i,kz)=100+j; nbadpaq_[i]++; break;}
+	}
+	//cout << "clnflg_("<<i<<","<<kz<<"): " << clnflg_(i,kz)  << endl;
+      }//if bands
+    }//loop on channels
+
+    if (dtp_ && xnt_)  dtp_->AddRow(xnt_);
   }
   return;
Index: /trunk/AddOn/TAcq/brprocGain.cc
===================================================================
--- /trunk/AddOn/TAcq/brprocGain.cc	(revision 3945)
+++ /trunk/AddOn/TAcq/brprocGain.cc	(revision 3946)
@@ -49,4 +49,5 @@
 
   uint_4 nb_octets_entrop = 0; //this value is valid for Dec. 2010 data at Nancay
+  
   const char* venvp = NULL; 
   venvp=getenv("BRANA_NBYTECUT");
@@ -86,7 +87,7 @@
 {
 
-  cout << "(JEC): BRGainCalculator ProcSpecWin: "<<   nbtot_specwin_ 
-       << " nbwin4mean = " << nbwin4mean_
-       << endl;
+//   cout << "(JEC): BRGainCalculator ProcSpecWin: "<<   nbtot_specwin_ 
+//        << " nbwin4mean = " << nbwin4mean_
+//        << endl;
   
   //  cout<< "(Spec_window info) Start" << endl;
@@ -133,5 +134,5 @@
 			 val2.begin()+val2.size()/2,
 			 val2.end());
-	medianFilterFreq(f) += *(val2.begin()+val2.size()/2); //Notice the "+" for later take the mean
+	medianFilterFreq(f) = *(val2.begin()+val2.size()/2); //Notice the "+" for later take the mean
       }//eo loop on frequencies
     } else {
@@ -139,5 +140,5 @@
       //      medfiltspecmtx_.Row(i).Show();
       //      medianFilterPaq.Transpose().Show();
-      medfiltspecmtx_.Row(i) = medianFilterPaq.Transpose();
+      medfiltspecmtx_.Row(i) += medianFilterPaq.Transpose();
     }
   }//eo loop on channels
Index: /trunk/AddOn/TAcq/specmfib.cc
===================================================================
--- /trunk/AddOn/TAcq/specmfib.cc	(revision 3945)
+++ /trunk/AddOn/TAcq/specmfib.cc	(revision 3946)
@@ -92,4 +92,5 @@
 	new BRGainCalculator(mmgr, par.outpath_, par.nmean_, par.fgdatafft_, par.fgsinglechannel_);
       procgain_p->SetPrintLevel(par.prtlevel_,par.prtmodulo_);
+      if(par.fgfreqfilter_) procgain_p->SetOnMedianFreqFilt();
     }
 
