Index: /Interface_Web/trunk/pspaWT/History
===================================================================
--- /Interface_Web/trunk/pspaWT/History	(revision 340)
+++ /Interface_Web/trunk/pspaWT/History	(revision 341)
@@ -5,4 +5,8 @@
      PSPA - Plateforme de simulation en physique des accÃ©lÃ©rateurs
      =========================================================
+
+22 février 2013 Guy Le Meur
+- complété le tracé des espaces de phases pour le généraliser aux couples (y,yp), (x,y) etc. 
+_ corrigé un bug concernant la sauvegarde de la configuration : l'attribut nameOfCase_ de la classe PspaApplication contient le 'nom du cas de calcul' sans extension ni chemin. Donc, pour le cas test, nameOfCase_ vaut 'pspa'.
 
 20 Février 2013 Laurent Garnier
Index: /Interface_Web/trunk/pspaWT/sources/controler/include/dataManager.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/include/dataManager.h	(revision 340)
+++ /Interface_Web/trunk/pspaWT/sources/controler/include/dataManager.h	(revision 341)
@@ -51,10 +51,10 @@
     trivaluedBool checkElementsForExec(nomDeLogiciel logiciel, unsigned indexDeb, unsigned indexFin, string& diagnostic);
     bool executeAll();
-    void saveConfiguration(string nameOfFile);
+    void saveConfiguration(string nameOfCase);
     bool restoreElements(string inputFileName);
     void donneesRmsEnveloppe( string type, unsigned int numeroDeb, unsigned int numeroFin, vector<double>& xcor, vector<double>& ycor);
-    inline void setWorkingDir(string wd) {
-        workingDir_ = wd;
-    }
+    /* inline void setWorkingDir(string wd) { */
+    /*     workingDir_ = wd; */
+    /* } */
     
 private:
@@ -69,5 +69,5 @@
     void clearSectionToExecute();
 
-    string workingDir_;
+    //   string workingDir_;
     PspaApplication* pspa_;
 };
Index: /Interface_Web/trunk/pspaWT/sources/controler/include/particleBeam.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/include/particleBeam.h	(revision 340)
+++ /Interface_Web/trunk/pspaWT/sources/controler/include/particleBeam.h	(revision 341)
@@ -81,5 +81,5 @@
 
   void donneesDessinEllipseXxp(vector<double>& xcor, vector<double>& ycor);
-
+  void donneesDessinEllipse(vector<double>& xcor, vector<double>& ycor, unsigned indexAbs, unsigned indexOrd);
 
   virtual string FileOutputFlow() const;
Index: /Interface_Web/trunk/pspaWT/sources/controler/src/dataManager.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/src/dataManager.cc	(revision 340)
+++ /Interface_Web/trunk/pspaWT/sources/controler/src/dataManager.cc	(revision 341)
@@ -16,7 +16,7 @@
 dataManager::dataManager(PspaApplication* pspa) :
 currentBeam_(NULL)
-,workingDir_("")
 ,pspa_ ( pspa)
 {
+  //  workingDir_ = pspa_->getWorkingDir();
 }
 
@@ -145,15 +145,16 @@
 void dataManager::initializeExecution()
 {
-    if (workingDir_ == "") {
+  string workingDir = pspa_->getWorkingDir();
+    if (workingDir == "") {
         return;
     }
-    removeFile(workingDir_ + "parmdesz");
-    removeFile(workingDir_ + "parmin");
-    removeFile(workingDir_ + "parin.input0");
-    removeFile(workingDir_ + "transport.input");
-    removeFile(workingDir_ + "transport.output");
-    removeFile(workingDir_ + "generator.in");
-    removeFile(workingDir_ + "faisceau.ini");
-    removeFile(workingDir_ + "generator.output");
+    removeFile(workingDir + "parmdesz");
+    removeFile(workingDir + "parmin");
+    removeFile(workingDir + "parin.input0");
+    removeFile(workingDir + "transport.input");
+    removeFile(workingDir + "transport.output");
+    removeFile(workingDir + "generator.in");
+    removeFile(workingDir + "faisceau.ini");
+    removeFile(workingDir + "generator.output");
     diagnosticBeam_.clear();
     currentBeam_ = NULL;
@@ -178,5 +179,5 @@
     unsigned k;
     abstractSoftware* softw =NULL;
-    
+    string workingDir = pspa_->getWorkingDir();
     for(k = 0; k < jobList_.size(); k++)
     {
@@ -194,9 +195,9 @@
       }
 
-      success = softw->createInputFile(currentBeam_, debut, fin, workingDir_);
+      success = softw->createInputFile(currentBeam_, debut, fin, workingDir);
       if ( success ) {
-	success = softw->execute(debut,fin,workingDir_);
+	success = softw->execute(debut,fin,workingDir);
 	if ( success ) {
-	  success = softw->buildBeamAfterElements(debut, fin, diagnosticBeam_, workingDir_);
+	  success = softw->buildBeamAfterElements(debut, fin, diagnosticBeam_, workingDir);
 	}
       }
@@ -215,8 +216,8 @@
 
 
-void dataManager::saveConfiguration( string nameOfFile)
+void dataManager::saveConfiguration( string nameOfCase)
 {
     ofstream outfile;
-    string name = workingDir_ + nameOfFile + ".save";
+    string name = pspa_->getWorkingDir() + nameOfCase + ".save";
     outfile.open(name.c_str(), ios::out);
     if (!outfile) {
Index: /Interface_Web/trunk/pspaWT/sources/controler/src/particleBeam.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/src/particleBeam.cc	(revision 340)
+++ /Interface_Web/trunk/pspaWT/sources/controler/src/particleBeam.cc	(revision 341)
@@ -426,4 +426,108 @@
 }
 
+
+
+void particleBeam::donneesDessinEllipse(vector<double>& xcor, vector<double>& ycor, unsigned indexAbs, unsigned indexOrd) {
+  int k;
+  double x,y;
+
+  if ( !momentRepresentationOk_ ) return;
+
+  if ( indexAbs > 5 || indexOrd > 5 ) return;
+
+  xcor.clear();
+  ycor.clear();
+  // les index sont dans l'ordre x,y,z,xp,yp, de/E
+  // on traduit en TRANSPORT
+  if ( indexAbs == 1 ) indexAbs = 2;  // y
+  if ( indexAbs == 2 ) indexAbs = 4;  // z -> l
+  if ( indexAbs == 3 ) indexAbs = 1;  // xp
+  if ( indexAbs == 4 ) indexAbs = 3;  // yp
+
+  if ( indexOrd == 1 ) indexOrd = 2;  // y
+  if ( indexOrd == 2 ) indexOrd = 4;  // z -> l
+  if ( indexOrd == 3 ) indexOrd = 1;  // xp
+  if ( indexOrd == 4 ) indexOrd = 3;  // yp
+
+  cout << " index x" << indexAbs << " index y " << indexOrd << endl;
+
+  double xm = ( rij_.getMatrix().at(indexAbs) ).at(indexAbs);
+  double ym = ( rij_.getMatrix().at(indexOrd) ).at(indexOrd);
+  double r;
+  if ( indexOrd > indexAbs ) {
+    r  = ( rij_.getMatrix().at(indexOrd) ).at(indexAbs);
+  } else {
+    r  = ( rij_.getMatrix().at(indexAbs) ).at(indexOrd);
+  }
+
+  cout <<  " racs11= " << xm << " racs22= " << ym << " r12= " << r << endl;
+
+
+  int nbintv = 50;
+  if ( xm == 0.0 ) return;
+  double pas = 2.0 * xm / nbintv;
+
+  //  cout << " r= " << r << endl;
+  double rac = (1 - r*r);
+  if ( rac > 0.0 ) 
+    {
+      cout << " cas rac > " << endl;
+      rac = sqrt(1 - r*r);
+      double alpha = -r / rac;
+      double beta = xm / ( ym * rac);
+      //  double gamma = ym / ( xm * rac );
+      double epsil = xm * ym * rac;
+      double fac1 = -1.0 / ( beta * beta);
+      double fac2 = epsil/beta;
+      double fac3 = -alpha/beta;
+      double aux;
+      for ( k=0; k < nbintv; k++)
+	{
+	  x = -xm + k*pas;
+	  aux = fac1 * x * x + fac2;
+	  //     cout << " aux2= " << aux << endl;
+	  if ( aux <= 0.0 )
+	    {
+	      aux = 0.0;
+	    }
+	  else aux = sqrt(aux);
+      
+	  //        y = fac3*x;
+	  y = fac3*x + aux;
+	  xcor.push_back(x);
+	  ycor.push_back(y);
+	}
+
+      for ( k=0; k <= nbintv; k++)
+	{
+	  x = xm - k*pas;
+	  aux =  fac1 * x * x + fac2;
+	  if ( aux <= 0.0 ) 
+	    {
+	      aux = 0.0;
+	    }
+	  else aux = sqrt(aux);
+	  //   y = fac3*x;
+	  y = fac3*x - aux;
+	  xcor.push_back(x);
+	  ycor.push_back(y);
+	}
+    }
+  else
+    // cas degenere
+    {
+      cout << " cas degenere " << endl;
+      double fac = ym/xm;
+      for ( k=0; k < nbintv; k++)
+	{
+	  x = -xm + k*pas;
+	  y = fac*x;
+	  xcor.push_back(x);
+	  ycor.push_back(y);
+	}
+	
+    }
+}
+
 void particleBeam::histogramme(vector<double>&xcor,vector<int>& hist,int& cnts,double out[3])
 {
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_pspaApplication.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_pspaApplication.h	(revision 340)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_pspaApplication.h	(revision 341)
@@ -78,9 +78,11 @@
   
   void dialogOnGraphics();
-  void faireDessinParmela(WContainerWidget* toto, particleBeam* beam, unsigned indexAbs, unsigned indexOrd );
-  void faireDessinTransport(WContainerWidget* toto, particleBeam* beam);
+  void setModelComponentForPhaseSpace(WStandardItemModel* model, vector<bareParticle>& partic, unsigned indexParticleComponent, unsigned modelComponent); 
+void faireDessinParmela(WContainerWidget* toto, particleBeam* beam, unsigned indexAbs, unsigned indexOrd, string namex, string namey  );
+  void faireDessinTransport(WContainerWidget* toto, particleBeam* beam, unsigned indexAbs, unsigned indexOrd, string namex, string namey);
   void faireDessinEnveloppe(WContainerWidget* toto, string type);
   void scatterPlot1D(WContainerWidget* toto, vector<double>& xcor, vector<double>& ycor);
     
+  bool removePathFromConfigName(string& config);
   bool removeExtensionFromConfigName(string& config);
   
@@ -116,4 +118,9 @@
     return abstractElementFactory_;
   }
+
+    inline string getWorkingDir() const {
+        return workingDir_;
+    }
+
 };
 #endif
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc	(revision 340)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc	(revision 341)
@@ -70,5 +70,5 @@
     useStyleSheet	("htdocs/pspa.css");
     dtmanage_ = new dataManager(this);
-    dtmanage_->setWorkingDir(workingDir_);
+    //    dtmanage_->setWorkingDir(workingDir_);
     /*
      * The main layout is a 3x2 grid layout.
@@ -346,5 +346,5 @@
   else { console_->addConsoleMessage("sauvegarde sur repertoire : " + workingDir_);}
   nameOfCase_ = saveNameEdit_->text().toUTF8();
-  cout << " PspaApplication::dialogSaveDone() nameOfCase_= " << nameOfCase_ << endl;
+  cout << " PspaApplication::dialogSaveDone() sur fichier = " << nameOfCase_ << endl;
   delete dialogSave_;
   dialogSave_ = NULL;
@@ -359,14 +359,19 @@
 {
     GWt_serverFileSelector * fs = new GWt_serverFileSelector("Select a configuration file",workingDir_);
-    nameOfCase_ = fs->exec();
-    
+    string fileName = fs->exec();
+     nameOfCase_ = fileName;
+   
+    removePathFromConfigName(nameOfCase_ );
+    cout << " nom sans path " << nameOfCase_ << endl;
+    removeExtensionFromConfigName(nameOfCase_);
+    cout << " nom sans extension " << nameOfCase_ << endl;
     if (nameOfCase_ == "")
         return;
-    
+    cout << " je restaure le fichier " << fileName << endl;
     dialogSave_ = NULL;
     
-    bool test = dtmanage_->restoreElements(nameOfCase_);
+    bool test = dtmanage_->restoreElements(fileName);
     if ( !test ) {
-        GWt_dialog restoreWarning(" element restoring", "failure in restoring elements !", GWt_dialog::Error, false,true);
+        GWt_dialog restoreWarning(" element restoring", "failure in restoring elements from file : " + fileName , GWt_dialog::Error, false,true);
         restoreWarning.exec();
     }
@@ -466,5 +471,4 @@
 void PspaApplication::dessinerPhaseSpace()
 {    
-  toto_->clear();
     
   int typeFaisceau = choixTypeDessinFaisceau_->currentIndex();
@@ -472,5 +476,12 @@
   unsigned xabs = choixAbsPhase_->currentIndex();
   unsigned yord = choixOrdPhase_->currentIndex();
-       
+  if ( xabs == yord ) {
+	GWt_dialog phaseSpaceError(" graphical analysis", "the beam coordinates must be different !", GWt_dialog::Error, false,true);
+	phaseSpaceError.exec();
+	return;
+  }
+  string nameAbs = choixAbsPhase_->currentText().toUTF8();
+  string nameOrd = choixOrdPhase_->currentText().toUTF8();
+
   particleBeam* beam = dtmanage_->getDiagnosticBeam(index);
     
@@ -481,13 +492,14 @@
   }
     
-    
+    toto_->clear();
+  
   if ( typeFaisceau == 0 )
     {
       if ( !beam->momentRepresentationOk() ) beam->buildMomentRepresentation();
-      faireDessinTransport(toto_, beam);
+      faireDessinTransport(toto_, beam, xabs, yord, nameAbs, nameOrd );
     }
   else if ( typeFaisceau == 1 )
     {
-      if ( beam->particleRepresentationOk() ) faireDessinParmela(toto_, beam, xabs, yord);
+      if ( beam->particleRepresentationOk() ) faireDessinParmela(toto_, beam, xabs, yord, nameAbs, nameOrd );
       else {
 	GWt_dialog warningBeamState(" graphical analysis", "the beam state does not allow providing a drawing with macroparticles !", GWt_dialog::Error, false,true);
@@ -533,6 +545,32 @@
 }
 
-
-void PspaApplication::faireDessinParmela(WContainerWidget* toto, particleBeam* beam, unsigned indexAbs, unsigned indexOrd )
+void PspaApplication::setModelComponentForPhaseSpace(WStandardItemModel* model, vector<bareParticle>& partic, unsigned indexParticleComponent, unsigned modelComponent) {
+  double valeur;
+  if ( indexParticleComponent > 5  ) return;
+
+  if ( indexParticleComponent <= 2 ) {
+    for (unsigned i = 0; i < partic.size(); ++i) {
+      valeur = partic.at(i).getPosition().getComponent(indexParticleComponent);
+      model->setData(i, modelComponent, valeur);
+    }
+  } else {
+    if ( indexParticleComponent == 5 ) {
+      cout << " PspaApplication::faireDessinParmela : deltap non programme " << endl;
+      return;
+    } else {
+      for (unsigned i = 0; i < partic.size(); ++i) {
+	double begamz = partic.at(i).getBetaGamma().getComponent(2);
+	if ( begamz != 0.0) {
+	  valeur = 1.e3*partic.at(i).getBetaGamma().getComponent(indexParticleComponent-3)/begamz;
+	} else {
+	  valeur = 0.0;
+	}
+	model->setData(i, modelComponent, valeur);
+      }
+    }
+  }
+}
+
+void PspaApplication::faireDessinParmela(WContainerWidget* toto, particleBeam* beam, unsigned indexAbs, unsigned indexOrd, string namex, string namey )
 {
   cout << " faireDessinParmela " << endl;
@@ -542,114 +580,60 @@
   pointsDialog->setClosable(true);
   // pointsDialog->show();
-  
-    
-    
-    vector<bareParticle>& partic = beam->getParticleVector();
-    new WText(nameOfCase_ + " : espace de phase x,x' "+ " nb partic. "+ mixedTools::intToString(partic.size()), pointsDialog->contents());
-    WStandardItemModel *model = new WStandardItemModel(partic.size(), 2, pointsDialog->contents());
-    //    model->setHeaderData(0, WString("X"));
-    //   model->setHeaderData(1, WString("Y = sin(X)"));
-    
-    if ( indexAbs > 5 || indexOrd > 5 ) return;
-
-    for (unsigned i = 0; i < partic.size(); ++i) {
-      double valAbs, valOrd;
-      double begamz = partic.at(i).getBetaGamma().getComponent(2);
-      if ( indexAbs <= 2 ) {
-	valAbs = partic.at(i).getPosition().getComponent(indexAbs);
-	cout << " i= " << i << " valabs = " << valAbs << endl;
-      } else {
-	if ( indexAbs == 5 ) {
-	  cout << " PspaApplication::faireDessinParmela : deltap non programme " << endl;
-	  return;
-	} else {
-	  if ( begamz != 0.0) {
-	    valAbs = 1.e3*partic.at(i).getBetaGamma().getComponent(indexAbs-3)/begamz;
-	  } else {
-	    valAbs = 0.0;
-	  }
-	}
-      }
-
-      if ( indexOrd <= 2 ) {
-	valOrd = partic.at(i).getPosition().getComponent(indexOrd);
-      } else {
-	if ( indexOrd == 5 ) {
-	  cout << " PspaApplication::faireDessinParmela : deltap non programme " << endl;
-	  return;
-	} else {
-
-
-	  if ( begamz != 0.0) {
-	    valOrd = 1.e3*partic.at(i).getBetaGamma().getComponent(indexOrd-3)/begamz;
-	  } else {
-	    valOrd = 0.0;
-	  }
-	cout << " i= " << i << " valord = " << valOrd << endl;
-	}
-      }
       
-
-        // double x= partic.at(i).getPosition().getComponent(0);
-        // double begamz = partic.at(i).getBetaGamma().getComponent(2);
-	// double xp;
-	// if ( begamz != 0.0) {
-	//   xp = partic.at(i).getBetaGamma().getComponent(0)/begamz;
-	// } else {
-	//   xp = 0.0;
-	// }
-        // //    cout << "x = " << x << " xp= " << xp << endl;
-        // model->setData(i, 0, x);
-        // model->setData(i, 1,1.e3*xp);
-        // model->setData(i, 2,2.e3*xp);
-        model->setData(i, 0, valAbs);
-        model->setData(i, 1,  valOrd);
-    }
-      cout << " faireDessinParmela : FAISCEAU VU  " << endl;
-
-    WCartesianChart *chart = new WCartesianChart(pointsDialog->contents());
-    chart->setModel(model);        // set the model
-    chart->setXSeriesColumn(0);    // set the column that holds the X data
-    chart->setLegendEnabled(true); // enable the legend
-    
-    chart->setType(ScatterPlot);   // set type to ScatterPlot
-    
-    // Typically, for mathematical functions, you want the axes to cross
-    // at the 0 mark:
-    chart->axis(XAxis).setLocation(ZeroValue);
-    chart->axis(YAxis).setLocation(ZeroValue);
-    
-    // Provide space for the X and Y axis and title.
-    chart->setPlotAreaPadding(80, Left);
-    chart->setPlotAreaPadding(40, Top | Bottom);
-    // Add the curves
-    WDataSeries s(1, PointSeries, Y1Axis);
-    //  s.setShadow(WShadow(3, 3, WColor(0, 0, 0, 127), 3));
-    //    s.setMarker(SquareMarker);
-    //  s.setMarkerSize(600.);
-    //  cout << "le marker est : " << s.marker() << endl;
-    chart->addSeries(s);
-    
-    chart->resize(400, 400); // WPaintedWidget must be given explicit size
+  vector<bareParticle>& partic = beam->getParticleVector();
+  new WText(nameOfCase_ + " : phase space " + namex + " ," + namey + " ; particle number : "+ mixedTools::intToString(partic.size()), pointsDialog->contents());
+
+  WStandardItemModel *model = new WStandardItemModel(partic.size(), 2, pointsDialog->contents());
+
+
+  setModelComponentForPhaseSpace(model, partic, indexAbs, 0);
+  setModelComponentForPhaseSpace(model, partic, indexOrd, 1);
+
+  cout << " faireDessinParmela : FAISCEAU VU  " << endl;
+
+  WCartesianChart *chart = new WCartesianChart(pointsDialog->contents());
+  chart->setModel(model);        // set the model
+  chart->setXSeriesColumn(0);    // set the column that holds the X data
+  chart->setLegendEnabled(true); // enable the legend
+    
+  chart->setType(ScatterPlot);   // set type to ScatterPlot
+    
+  // Typically, for mathematical functions, you want the axes to cross
+  // at the 0 mark:
+  chart->axis(XAxis).setLocation(ZeroValue);
+  chart->axis(YAxis).setLocation(ZeroValue);
+    
+  // Provide space for the X and Y axis and title.
+  chart->setPlotAreaPadding(80, Left);
+  chart->setPlotAreaPadding(40, Top | Bottom);
+  // Add the curves
+  WDataSeries s(1, PointSeries, Y1Axis);
+  //  s.setShadow(WShadow(3, 3, WColor(0, 0, 0, 127), 3));
+  //    s.setMarker(SquareMarker);
+  //  s.setMarkerSize(600.);
+  //  cout << "le marker est : " << s.marker() << endl;
+  chart->addSeries(s);
+    
+  chart->resize(400, 400); // WPaintedWidget must be given explicit size
     
     
 #ifdef HAS_IMAGEMAGIC
-    Wt::WRasterImage pngImage("png", 600, 600);
-    Wt::WPainter p(&pngImage);
-    chart->paint(p);
-    std::string name;
-    name = workingDir_ + "/chart-"+sessionId ()+".png";
-    std::ofstream f(name.c_str(), std::ios::out |std::ios::trunc | std::ios::binary);
-    pngImage.write(f);
-    new WText("<a href='workingArea/chart-"+sessionId ()+".png' target='_blank'>Afficher l'image</a>",toto);
+  Wt::WRasterImage pngImage("png", 600, 600);
+  Wt::WPainter p(&pngImage);
+  chart->paint(p);
+  std::string name;
+  name = workingDir_ + "/chart-"+sessionId ()+".png";
+  std::ofstream f(name.c_str(), std::ios::out |std::ios::trunc | std::ios::binary);
+  pngImage.write(f);
+  new WText("<a href='workingArea/chart-"+sessionId ()+".png' target='_blank'>Afficher l'image</a>",toto);
 #endif
     
-    pointsDialog->show();
-    
-    //  chart->setMargin(10, Top | Bottom);            // add margin vertically
-    //  chart->setMargin(WLength::Auto, Left | Right); // center horizontally
-}
-
-void PspaApplication::faireDessinTransport(WContainerWidget* toto, particleBeam* beam)
+  pointsDialog->show();
+    
+  //  chart->setMargin(10, Top | Bottom);            // add margin vertically
+  //  chart->setMargin(WLength::Auto, Left | Right); // center horizontally
+}
+
+void PspaApplication::faireDessinTransport(WContainerWidget* toto, particleBeam* beam, unsigned indexAbs, unsigned indexOrd, string namex, string namey)
 {
   GWt_dialog* ellipseDialog = new GWt_dialog("ellipse",toto,false);
@@ -659,5 +643,5 @@
   ellipseDialog->show();
     
-  new WText(nameOfCase_ + " : emittance x,x' " + mixedTools::doubleToString(beam->getUnnormalizedEmittanceX()) + " pi.mm.mrad" , ellipseDialog->contents());
+  new WText(nameOfCase_ + " : emittance " + namex + " , " + namey + " : " + mixedTools::doubleToString(beam->getUnnormalizedEmittanceX()) + " pi.mm.mrad" , ellipseDialog->contents());
   new WBreak(ellipseDialog->contents());
   new WText(" xmax = " + mixedTools::doubleToString(beam->getSigmaTransportij(1,1)) + " cm ", ellipseDialog->contents());
@@ -669,66 +653,9 @@
   vector<double> xcor;
   vector<double> ycor;
-  //  dtmanage_->getCurrentBeam()->donneesDessinEllipseXxp(xcor,ycor);
-  beam->donneesDessinEllipseXxp(xcor,ycor);
+  beam->donneesDessinEllipse(xcor,ycor,indexAbs, indexOrd);
+  //  beam->donneesDessinEllipseXxp(xcor,ycor);
   scatterPlot1D(ellipseDialog->contents(),xcor,ycor);  
 }
 
-// void PspaApplication::scatterPlot1D(WContainerWidget* toto, vector<double>& xcor, vector<double>& ycor)
-// {
-//   int nbpts = xcor.size();
-//   cout << " PspaApplication::scatterPlot1D nbpts = " << nbpts << endl;
-//   WStandardItemModel *model = new WStandardItemModel(nbpts, 2, toto);
-//   for (int i = 0; i < nbpts; ++i) {
-//     model->setData(i, 0, xcor.at(i));
-//     model->setData(i, 1, ycor.at(i));
-//     //    cout << " PspaApplication::scatterPlot1D el= " << i+1 << " x= " << xcor.at(i) << " y= " << ycor.at(i) << endl;
-//   }
-
-//   WCartesianChart *chart = new WCartesianChart(toto);
-
-//   chart->initLayout();
-
-//   chart->setModel(model);        // set the model
-//   chart->setXSeriesColumn(0);    // set the column that holds the X data
-//   chart->setLegendEnabled(true); // enable the legend
-
-//   chart->setType(ScatterPlot);   // set type to ScatterPlot
-
-//   // Typically, for mathematical functions, you want the axes to cross
-//   // at the 0 mark:
-//    chart->axis(XAxis).setLocation(ZeroValue);
-//    chart->axis(YAxis).setLocation(ZeroValue);
-
-//   // Provide space for the X and Y axis and title.
-// //   chart->setPlotAreaPadding(80, Left);
-// //   chart->setPlotAreaPadding(40, Top | Bottom);
-//   // Add the curves
-//   WDataSeries s(1, CurveSeries, Y1Axis);
-//   chart->addSeries(s);
-
-//   // chart->setBackground (WBrush(WColor("blue")));
-//   chart->resize(300, 300); // WPaintedWidget must be given explicit size
-
-// #ifdef HAS_IMAGEMAGIC
-//  Wt::WRasterImage pngImage("png", 600, 600);
-//  Wt::WPainter p(&pngImage);
-
-//  chart->paint(p);
-//  std::string name;
-//  name = workingDir_ + "/chart-"+sessionId ()+".png";
-//  std::ofstream f(name.c_str(), std::ios::out |std::ios::trunc | std::ios::binary);
-//  pngImage.write(f);
-
-//  new WText("<a href='workingArea/chart-"+sessionId ()+".png' target='_blank'>Afficher l'image</a>",toto);
-
-//  /*
-//  Wt::WPdfImage pdfImage("30cm", "30cm");
-//  Wt::WPainter p1(&pdfImage);
-//  chart->paint(p1);
-//  std::ofstream f1("chart.pdf", std::ios::out | std::ios::binary);
-//  pdfImage.write(f1);
-//  */
-// #endif
-// }
 
 
@@ -818,4 +745,16 @@
 
 // }
+
+bool PspaApplication::removePathFromConfigName(string& config) {
+  string toExtract = workingDir_ + "/";
+  string::size_type nn = config.find(toExtract);
+  if ( nn == string::npos ) {
+        GWt_dialog checkremovePath(" checking config file name", " failed to recognize path name for file  " + config, GWt_dialog::Error,true,true);
+        checkremovePath.exec();
+    return false;
+  }
+  config.replace(nn, toExtract.size(), "");
+  return true;
+}
 
 bool PspaApplication::removeExtensionFromConfigName(string& config)
