Index: /trunk/SophyaLib/NTools/integ.cc
===================================================================
--- /trunk/SophyaLib/NTools/integ.cc	(revision 2422)
+++ /trunk/SophyaLib/NTools/integ.cc	(revision 2423)
@@ -117,5 +117,5 @@
 
 Integrator::~Integrator()
-{delete mFunc;}
+{if(mFunc) delete mFunc;}
 
 //++
@@ -222,4 +222,13 @@
   Limits(xmin,xmax);
   return Value();
+}
+
+void
+Integrator::Print(int lp)
+{
+ cout<<"Integrator between "<<mXMin<<" and "<<mXMax
+     <<" in "<<mNStep<<" steps"<<endl;
+ if(lp>1) cout<<"mFunc="<<mFunc<<"mGFF="<<mGFF
+              <<"mReqPrec="<<mReqPrec<<"mDX="<<mDX<<endl;
 }
 
@@ -332,5 +341,5 @@
 //	fonction aux zéros des polynomes de Legendre. Avec les poids
 //	qui vont bien, GL d'ordre n est exacte pour des polynomes de 
-//	degré <= 2n+1.
+//	degré <= 2n+1 (monome le + haut x^(2*n-1).
 //	Impossible de demander une précision donnée.
 //
@@ -408,7 +417,6 @@
 GLInteg::~GLInteg()
 {
-  delete[] mXPos;
-  delete[] mWeights;
-  mXPos = mWeights = NULL;
+ if(mXPos)    delete[] mXPos;     mXPos    = NULL;
+ if(mWeights) delete[] mWeights;  mWeights = NULL;
 }
 
@@ -416,7 +424,6 @@
 GLInteg::InvalWeights()
 {
-  delete[] mXPos;
-  delete[] mWeights;
-  mXPos = mWeights = NULL;
+ if(mXPos)    delete[] mXPos;     mXPos    = NULL;
+ if(mWeights) delete[] mWeights;  mWeights = NULL;
 }
 
@@ -425,5 +432,5 @@
 GLInteg::LimitsChanged()
 {
-  ComputeBounds();
+ ComputeBounds();
 }
 
@@ -431,5 +438,5 @@
 GLInteg::StepsChanged()
 {
-  ComputeBounds();
+ ComputeBounds();
 }
 
@@ -437,9 +444,9 @@
 GLInteg::AddBound(double x)
 {
-  if (x<=mXMin || x>=mXMax) THROW(rangeCheckErr); 
-  // On introduira les classes d'exections apres reflexion et de maniere systematique (Rz+cmv)
-  // if (x<=mXMin || x>=mXMax) throw range_error("GLInteg::AddBound  bound outside interval");
-  mBounds.insert(x);
-  return *this;
+ if (x<=mXMin || x>=mXMax) THROW(rangeCheckErr); 
+ // On introduira les classes d'exections apres reflexion et de maniere systematique (Rz+cmv)
+ // if (x<=mXMin || x>=mXMax) throw range_error("GLInteg::AddBound  bound outside interval");
+ mBounds.insert(x);
+ return *this;
 }
 
@@ -448,7 +455,7 @@
 GLInteg::SetOrder(int order)
 {
-  mOrder = order;
-  InvalWeights();
-  return *this;
+ mOrder = order;
+ InvalWeights();
+ return *this;
 }
 
@@ -458,18 +465,18 @@
 GLInteg::Value()
 {
-  if (!mXPos) ComputeWeights();
-  double s = 0;
-  set<double>::iterator i=mBounds.begin();
-  set<double>::iterator j=i; j++;
-  while (j != mBounds.end()) {
-    double s1 = 0;
-    double x1 = *i;
-    double x2 = *j;
-    for (int k=0; k<mOrder; k++)
-       s1 += mWeights[k] * FVal(x1 + (x2-x1)*mXPos[k]);
-    s += s1*(x2-x1);
-    i++; j++;
-  }
-  return s;
+ if (!mXPos) ComputeWeights();
+ double s = 0;
+ set<double>::iterator i=mBounds.begin();
+ set<double>::iterator j=i; j++;
+ while (j != mBounds.end()) {
+   double s1 = 0;
+   double x1 = *i;
+   double x2 = *j;
+   for(int k=0; k<mOrder; k++)
+      s1 += mWeights[k] * FVal(x1 + (x2-x1)*mXPos[k]);
+   s += s1*(x2-x1);
+   i++; j++;
+ }
+ return s;
 }
 
@@ -485,5 +492,5 @@
 GLInteg::ComputeWeights()
 {
-   const double EPS_gauleg = 3.0e-11;
+   const double EPS_gauleg = 5.0e-12;
 
    int m=(mOrder+1)/2;
@@ -519,2 +526,13 @@
 }
 
+void
+GLInteg::Print(int lp)
+{
+ Integrator::Print(lp);
+ cout<<"GLInteg order="<<mOrder<<endl;
+ if(lp>0 && mOrder>0) {
+   for(int i=0;i<mOrder;i++)
+     cout<<" ("<<mXPos[i]<<","<<mWeights[i]<<")";
+   cout<<endl;
+ }
+}
Index: /trunk/SophyaLib/NTools/integ.h
===================================================================
--- /trunk/SophyaLib/NTools/integ.h	(revision 2422)
+++ /trunk/SophyaLib/NTools/integ.h	(revision 2423)
@@ -43,4 +43,7 @@
   virtual Integrator& Func(FUNC);
   virtual Integrator& Func(GeneralFunction*, double* par);
+
+  virtual inline  int GetNStep(void) {return mNStep;}
+  virtual void Print(int lp=0);
 
 protected:
@@ -92,4 +95,6 @@
   virtual GLInteg& AddBound(double x);
   virtual GLInteg& SetOrder(int order);
+  virtual inline  int GetOrder(void) {return mOrder;}
+  virtual void Print(int lp=0);
 protected:
 
