Index: trunk/Cosmo/SimLSS/pkspectrum.cc
===================================================================
--- trunk/Cosmo/SimLSS/pkspectrum.cc	(revision 3329)
+++ trunk/Cosmo/SimLSS/pkspectrum.cc	(revision 3348)
@@ -52,5 +52,5 @@
   : lp_(lp)
   , Oc_(OmegaCDM0) , Ob_(OmegaBaryon0) , h_(h100) , tcmb_(tcmb)
-  , nobaryon_(nobaryon) , nooscenv_(0), retpart_(0)
+  , nobaryon_(nobaryon) , nooscenv_(0), retpart_(ALL)
 {
  zero_();
@@ -192,12 +192,11 @@
 }
 
-void TransfertEisenstein::SetReturnPart(unsigned short retpart)
+void TransfertEisenstein::SetReturnPart(ReturnPart retpart)
 // To return only baryon or CDM part part of transfert function
-// retpart = 1 : return only CDM part of transfert function
-// retpart = 2 : return only Baryon part of transfert function
-// retpart = anything else: return only full transfert function
+// retpart = ALL: return full transfert function
+//         = CDM : return only CDM part of transfert function
+//         = BARYON : return only Baryon part of transfert function
 // WARNING: only relevant for nobaryon_=false AND nooscenv!=2
 {
- if(retpart!=1 && retpart!=2) retpart = 0;
  retpart_ = retpart;
 }
@@ -244,5 +243,5 @@
   double f = 1. / (1. + pow(k*s_/5.4,4.));
   double Tc = f*T0tild(k,1.,betac_) + (1.-f)*T0tild(k,alphac_,betac_);
-  if(retpart_ == 1) return Tc; 
+  if(retpart_ == CDM) return Tc; 
 
   // --- Baryons
@@ -264,5 +263,5 @@
   Tb += alphab_/(1.+pow(betab_/(k*s_),3.)) * exp(-pow(k/ksilk_,1.4));
   Tb *= j0kst;
-  if(retpart_ == 2) return Tb;
+  if(retpart_ == BARYON) return Tb;
 
   // --- Total
@@ -413,5 +412,5 @@
 //------------------------------------
 PkSpectrumZ::PkSpectrumZ(PkSpectrum0& pk0,GrowthFactor& d1,double zref)
-  : pk0_(pk0) , d1_(d1) , zref_(zref) , scale_(1.) , typspec_(0)
+  : pk0_(pk0) , d1_(d1) , zref_(zref) , scale_(1.) , typspec_(PK)
   , zold_(-1.) , d1old_(1.)
 {
@@ -419,5 +418,5 @@
 
 PkSpectrumZ::PkSpectrumZ(PkSpectrumZ& pkz)
-  : pk0_(pkz.pk0_) , d1_(pkz.d1_) , zref_(pkz.zref_) , scale_(pkz.scale_) , typspec_(0)
+  : pk0_(pkz.pk0_) , d1_(pkz.d1_) , zref_(pkz.zref_) , scale_(pkz.scale_) , typspec_(PK)
   , zold_(pkz.zold_) , d1old_(pkz.d1old_)
 {
@@ -428,12 +427,8 @@
 }
 
-void PkSpectrumZ::SetTypSpec(unsigned short typspec)
-  // typsec = 0 : compute Pk(k)
-  //        = 1 : compute Delta^2(k) = k^3*Pk(k)/2Pi^2
-{
-  if(typspec>1) {
-    cout<<"PkSpectrumZ::SetTypSpec: Error bad typspec value: "<<typspec<<endl;
-    throw ParmError("PkSpectrumZ::SetTypSpec: Error bad typspec value");
-  }
+void PkSpectrumZ::SetTypSpec(ReturnSpectrum typspec)
+// typsec = PK : compute Pk(k)
+//        = DELTA : compute Delta^2(k) = k^3*Pk(k)/2Pi^2
+{
   typspec_ = typspec;
 }
@@ -451,5 +446,5 @@
 
   double v = pk0_(k) * d1*d1;
-  if(typspec_) v *= k*k*k/(2.*M_PI*M_PI);
+  if(typspec_==DELTA) v *= k*k*k/(2.*M_PI*M_PI);
 
   return scale_ * v;
@@ -462,7 +457,8 @@
 ///////////////////////////////////////////////////////////
 
-VarianceSpectrum::VarianceSpectrum(GenericFunc& pk,unsigned short typfilter=0)
-  : pk_(pk) , R_(0.)
-{
+VarianceSpectrum::VarianceSpectrum(GenericFunc& pk,double R,TypeFilter typfilter)
+  : pk_(pk)
+{
+  SetRadius(R);
   SetFilter(typfilter);
 }
@@ -478,14 +474,22 @@
 }
 
+void VarianceSpectrum::SetRadius(double R)
+// R = taille du filter top-hat ou gaussien
+{
+ if(R<=0.) {
+    cout<<"VarianceSpectrum::SetRadius: Error R<=0"<<endl;
+    throw ParmError("VarianceSpectrum::SetRadius: Error R<=0");
+  }
+  R_ = R;
+}
+
 //------------------------------------
-void VarianceSpectrum::SetFilter(unsigned short typfilter)
-// typfilter = 0 : spherical 3D top-hat
-//           = 1 : spherical 3D gaussian
-//           = 2 : no filter juste integrate spectrum)
-{
-  if(typfilter>2) {
-    cout<<"VarianceSpectrum::SetFilter: Error bad value for type of filter"<<endl;
-    throw ParmError("VarianceSpectrum::SetFilter: Error bad value for type of filter");
-  }
+void VarianceSpectrum::SetFilter(TypeFilter typfilter)
+// typfilter = TOPHAT : spherical 3D top-hat
+//           = GAUSSIAN : spherical 3D gaussian
+//           = NOFILTER : no filter juste integrate spectrum)
+// Remarque:
+//   la meilleure approximation du filtre top-hat (R) est un filtre gaussien avec (Rg=R/sqrt(5))
+{
   typfilter_ = typfilter;
 }
@@ -507,5 +511,5 @@
 {
   // Just integrate the spectrum without filtering
-  if(typfilter_ == 2) return 1.;
+  if(typfilter_ == NOFILTER) return 1.;
 
   double x2 = x*x;
@@ -515,5 +519,5 @@
   //             DL(x) = 1-x^2*(1-x^2/2)
   //             pour x<0.01  |DL(x)-G(X)^2|<2.0e-13
-  if(typfilter_ == 1)
+  if(typfilter_ == GAUSSIAN)
     if(x<0.01) return 1.-x2*(1.-x2/2.); else return exp(-x2);
 
@@ -534,21 +538,18 @@
 }
 
-double VarianceSpectrum::Variance(double R,double kmin,double kmax)
+double VarianceSpectrum::Variance(double kmin,double kmax)
 // Compute variance of spectrum pk_ by integration
 // Input:
-//     R = taille du filter top-hat ou gaussien
 //     kmin,kmax = bornes en k de l'integrale pour calculer la variance
 // Return:
 //     valeur de la variance (sigma^2)
 // Remarque:
-//   la meilleure approximation du filtre top-hat (R) est un filtre gaussien avec (Rg=R/sqrt(5))
 //   la variance renvoyee est la variance de la masse
 {
-  if(R<=0. || kmin<=0 || kmax<=0. || kmin>=kmax) {
-    cout<<"VarianceSpectrum::Variance: Error R<=0 or kmin<=0 or kmax<=0 or kmin>=kmax"<<endl;
-    throw ParmError("VarianceSpectrum::Variance: Error R<=0 or kmin<=0 or kmax<=0 or kmin>=kmax");
-  }
-
-  R_ = R;
+  if(kmin<=0 || kmax<=0. || kmin>=kmax) {
+    cout<<"VarianceSpectrum::Variance: Error kmin<=0 or kmax<=0 or kmin>=kmax"<<endl;
+    throw ParmError("VarianceSpectrum::Variance: Error kmin<=0 or kmax<=0 or kmin>=kmax");
+  }
+
   double lkmin = log10(kmin), lkmax = log10(kmax);
 
@@ -559,9 +560,8 @@
 
 //------------------------------------
-double VarianceSpectrum::FindMaximum(double R,double kmin,double kmax,double eps)
+double VarianceSpectrum::FindMaximum(double kmin,double kmax,double eps)
 // Retourne le maximum de la fonction a integrer
 // La recherche a lieu entre [kmin,kmax] par pas logarithmiques
 // Input:
-//     R : taille du filter top-hat ou gaussien
 //     kmin,kmax : intervalle de recherche
 //     eps : precision requise sur les valeurs
@@ -569,10 +569,8 @@
 //     position (en k) du maximum
 {
-  if(R<=0. || kmin<=0 || kmax<=0. || kmin>=kmax) {
-    cout<<"VarianceSpectrum::FindMaximum: Error R<=0 or kmin<=0 or kmax<=0 or kmin>=kmax || eps<=0"<<endl;
-    throw ParmError("VarianceSpectrum::FindMaximum: Error R<=0 or kmin<=0 or kmax<=0 or kmin>=kmax || eps<=0");
-  }
-
-  R_ = R;
+  if(kmin<=0 || kmax<=0. || kmin>=kmax) {
+    cout<<"VarianceSpectrum::FindMaximum: Error kmin<=0 or kmax<=0 or kmin>=kmax || eps<=0"<<endl;
+    throw ParmError("VarianceSpectrum::FindMaximum: Error kmin<=0 or kmax<=0 or kmin>=kmax || eps<=0");
+  }
 
   int n = 10; // toujours >2
@@ -600,9 +598,8 @@
 }
 
-int VarianceSpectrum::FindLimits(double R,double high,double &kmin,double &kmax,double eps)
+int VarianceSpectrum::FindLimits(double high,double &kmin,double &kmax,double eps)
 // Retourne "[kmin,kmax]" tel que la fonction a integrer soit "f(k) <= high"
 //   La recherche a lieu entre [kmin,kmax] par pas logarithmiques
 // Input:
-//     R : taille du filter top-hat ou gaussien
 //     kmin,kmax : intervalle de recherche
 //     eps : precision requise sur les valeurs kmin et kmax
@@ -615,10 +612,9 @@
 //     rc |= 4 "f(k) < high pour tout k"   (bit2 =1)
 {
-  if(R<=0. || kmin<=0 || kmax<=0. || kmin>=kmax  || eps<=0.) {
-    cout<<"VarianceSpectrum::FindLimits: Error R<=0 or kmin<=0 or kmax<=0 or kmin>=kmax or eps<=0"<<endl;
-    throw ParmError("VarianceSpectrum::FindLimits: Error R<=0 or kmin<=0 or kmax<=0 or kmin>=kmax || eps<=0");
-  }
-
-  R_ = R;
+  if(kmin<=0 || kmax<=0. || kmin>=kmax  || eps<=0.) {
+    cout<<"VarianceSpectrum::FindLimits: Error kmin<=0 or kmax<=0 or kmin>=kmax or eps<=0"<<endl;
+    throw ParmError("VarianceSpectrum::FindLimits: Error kmin<=0 or kmax<=0 or kmin>=kmax || eps<=0");
+  }
+
   int n = 10; // toujours >2
 
