Index: /Interface_Web/trunk/pspaWT/History
===================================================================
--- /Interface_Web/trunk/pspaWT/History	(revision 385)
+++ /Interface_Web/trunk/pspaWT/History	(revision 386)
@@ -5,4 +5,7 @@
      PSPA - Plateforme de simulation en physique des accÃ©lÃ©rateurs
      =========================================================
+12 mars : Guy Le Meur
+-softwareXXX : changé l'indexation ders éléments pour tenir compte des éléments ignorés par les softwares.
+-dataManager : création d'une méthode getDiagnosticBeam(string elementLabel);
 
 11 Mars : Laurent Garnier
Index: /Interface_Web/trunk/pspaWT/sources/controler/include/abstractSoftware.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/include/abstractSoftware.h	(revision 385)
+++ /Interface_Web/trunk/pspaWT/sources/controler/include/abstractSoftware.h	(revision 386)
@@ -4,5 +4,5 @@
 #include "globalParameters.h"
 #include "particleBeam.h"
-
+#include "nomDeLogiciel.h"
 #include <iostream>
 #include <string>
@@ -17,12 +17,14 @@
  protected :
 
+  unsigned numeroDeb_, numeroFin_;
   globalParameters* globParamPtr_;
   dataManager* dataManager_;
   string inputFileName_;
-
+  nomDeLogiciel nameOfSoftware_;
   abstractSoftware();
 
   bool launchJob(string commandLine, string& resul);
-
+  bool initComputationLimits(unsigned int numeroDeb,unsigned int numeroFin);
+  bool ComputationLimitsOk() const;
  public :
 
@@ -30,10 +32,14 @@
   ~abstractSoftware() {;}
 
+  inline nomDeLogiciel getNomDeLogiciel() const {
+    return nameOfSoftware_;
+  }
+
   virtual bool createInputFile(particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir) = 0;
 
 
-  virtual bool  execute(unsigned int numeroDeb,unsigned int numeroFin,string workingDir) = 0;
+  virtual bool  execute(string workingDir) = 0;
 
- virtual bool buildBeamAfterElements(unsigned int numeroDeb,unsigned int numeroFin, vector<particleBeam>& beams, string workingDir) = 0;
+ virtual bool buildBeamAfterElements(string workingDir) = 0;
 
     /** Color of the background of this sofware
@@ -44,5 +50,7 @@
     /** Name of this software
      */
-    virtual string getName() = 0;
+    inline string getName() const {
+      return nameOfSoftware_.getString();
+    }
 
 };
Index: /Interface_Web/trunk/pspaWT/sources/controler/include/beam2Moments.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/include/beam2Moments.h	(revision 385)
+++ /Interface_Web/trunk/pspaWT/sources/controler/include/beam2Moments.h	(revision 386)
@@ -36,5 +36,5 @@
 
  // void readFromTransportOutput(ifstream& inp);
- void readFromTransportOutput(stringstream& inp);
+ bool readFromTransportOutput(stringstream& inp);
  string writeToTransportInput(double P0) const;
 
Index: /Interface_Web/trunk/pspaWT/sources/controler/include/dataManager.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/include/dataManager.h	(revision 385)
+++ /Interface_Web/trunk/pspaWT/sources/controler/include/dataManager.h	(revision 386)
@@ -29,5 +29,6 @@
     
   particleBeam* getDiagnosticBeam(unsigned index);
-    
+  particleBeam* getDiagnosticBeam(string elementLabel);
+
   void addSectionToExecute(int debut, int fin, nomDeLogiciel prog);
 
@@ -64,5 +65,14 @@
     bool restoreElements(string inputFileName);
     
-    
+
+    // si newBeam = true, on cree un nouveau diag
+    // si newBeam = false, on utilise le dernier
+    inline particleBeam* updateCurrentDiagnostic(bool newBeam) {
+      if ( newBeam ) {
+	diagnosticBeam_.push_back(particleBeam());
+      }
+      indexElementToIndexDiag_.push_back(diagnosticBeam_.size() -1);
+      return &diagnosticBeam_.back();
+    }
 
     
@@ -73,6 +83,10 @@
   unsigned firstComputedElemNumero_;
   unsigned lastComputedElemNumero_;
+
     vector<particleBeam> diagnosticBeam_;
-    
+    vector<unsigned> indexElementToIndexDiag_;
+    // numeroElementToIndexDiag_[k] contient, pour l'element d'index k, l'indice ind tel que diagnosticBeam_[ind]
+    // soit le faisceau resultat, en l'etat qu'il doit avoir apres l'element k
+
     vector<sectionToExecute*> jobList_;
     
Index: /Interface_Web/trunk/pspaWT/sources/controler/include/softwareGenerator.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/include/softwareGenerator.h	(revision 385)
+++ /Interface_Web/trunk/pspaWT/sources/controler/include/softwareGenerator.h	(revision 386)
@@ -27,8 +27,8 @@
 
 
-  virtual bool  execute(unsigned int numeroDeb,unsigned int numeroFin,string workingDir);
+  virtual bool  execute(string workingDir);
 
 
-  virtual bool buildBeamAfterElements(unsigned int numeroDeb,unsigned int numeroFin, vector<particleBeam>& beams, string workingDir);
+  virtual bool buildBeamAfterElements(string workingDir);
 
     inline string getColor() {
@@ -36,7 +36,7 @@
     }
 
-    inline string getName() {
-        return "generator";
-    }
+    /* inline string getName() const { */
+    /*     return "generator"; */
+    /* } */
 };
 
Index: /Interface_Web/trunk/pspaWT/sources/controler/include/softwareParmela.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/include/softwareParmela.h	(revision 385)
+++ /Interface_Web/trunk/pspaWT/sources/controler/include/softwareParmela.h	(revision 386)
@@ -9,13 +9,16 @@
  protected : 
 
+
+  
   //    les elements de parmela sont indexes Ã  partir du premier, il faut 
   // donc prevoir un offset pour le raccord a pspa
-  unsigned offsetNumElem_;
-  //  vector<unsigned> relativeParmelaElementNumbers_;
+  //  unsigned offsetNumElem_;
+
+    vector<int> relativeParmelaElementIndices_;
 
   bool beamFromParmela(string workingDir,unsigned numeroElement, double referencefrequency, vector<double>& centroid, bareParticle& refPart,vector<bareParticle>& particles );
 
   bool beamToParmela(string workingDir, particleBeam* partic );
-
+  void setRelativeParmelaElementIndices();
  public : 
     softwareParmela();
@@ -28,8 +31,8 @@
   virtual bool createInputFile(particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin, string workingDir);
 
-  virtual bool  execute(unsigned int numeroDeb,unsigned int numeroFin,string workingDir);
+  virtual bool  execute(string workingDir);
 
 
-virtual bool buildBeamAfterElements(unsigned int numeroDeb,unsigned int numeroFin, vector<particleBeam>& beams, string workingDir);
+virtual bool buildBeamAfterElements(string workingDir);
 
     inline string getColor() {
@@ -37,7 +40,7 @@
     }
 
-    inline string getName() {
-        return "parmela";
-    }
+    /* inline string getName() const { */
+    /*     return "parmela"; */
+    /* } */
 
 };
Index: /Interface_Web/trunk/pspaWT/sources/controler/include/softwareTest.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/include/softwareTest.h	(revision 385)
+++ /Interface_Web/trunk/pspaWT/sources/controler/include/softwareTest.h	(revision 386)
@@ -26,8 +26,8 @@
 
 
-  virtual bool  execute(unsigned int numeroDeb,unsigned int numeroFin,string workingDir);
+  virtual bool  execute(string workingDir);
 
 
-  virtual bool buildBeamAfterElements(unsigned int numeroDeb,unsigned int numeroFin, vector<particleBeam>& beams, string workingDir);
+  virtual bool buildBeamAfterElements(string workingDir);
 
   inline string getColor() {
@@ -35,7 +35,7 @@
   }
     
-  inline string getName() {
-        return "test";
-    }
+  /* inline string getName() const { */
+  /*       return "test"; */
+  /*   } */
 
 };
Index: /Interface_Web/trunk/pspaWT/sources/controler/include/softwareTransport.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/include/softwareTransport.h	(revision 385)
+++ /Interface_Web/trunk/pspaWT/sources/controler/include/softwareTransport.h	(revision 386)
@@ -18,8 +18,8 @@
   virtual bool createInputFile( particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir);
 
-  virtual bool  execute(unsigned int numeroDeb,unsigned int numeroFin,string workingDir);
+  virtual bool  execute(string workingDir);
 
 
-virtual bool buildBeamAfterElements(unsigned int numeroDeb,unsigned int numeroFin, vector<particleBeam>& beams, string workingDir);
+virtual bool buildBeamAfterElements(string workingDir);
 
     inline string getColor() {
@@ -27,7 +27,7 @@
     }
     
-    inline string getName() {
-        return "transport";
-    }
+    /* inline string getName() const { */
+    /*     return "transport"; */
+    /* } */
 
 };
Index: /Interface_Web/trunk/pspaWT/sources/controler/src/abstractSoftware.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/src/abstractSoftware.cc	(revision 385)
+++ /Interface_Web/trunk/pspaWT/sources/controler/src/abstractSoftware.cc	(revision 386)
@@ -6,4 +6,5 @@
   globParamPtr_ = NULL;
   dataManager_ = NULL;
+  nameOfSoftware_ = nomDeLogiciel("unknownSoftware");
 }
 
@@ -12,6 +13,23 @@
   globParamPtr_ = globals;
   dataManager_ = dt;
+  numeroDeb_ = 0;
+  numeroFin_ = 0;
+  nameOfSoftware_ = nomDeLogiciel("unknownSoftware");
 }
 
+bool abstractSoftware::initComputationLimits(unsigned int numeroDeb,unsigned int numeroFin) {
+  numeroDeb_ = numeroDeb;
+  numeroFin_ = numeroFin;
+  return ComputationLimitsOk();
+}
+
+bool abstractSoftware::ComputationLimitsOk() const {
+  if (   numeroDeb_ < 1 ||  numeroFin_ < 1 || numeroDeb_ > dataManager_->getBeamLineSize() || numeroFin_ > dataManager_->getBeamLineSize() ) {
+  dataManager_->consoleMessage(" abstractSoftware::initComputationLimit : numero of element out of limits in software " + getName() );
+    return false;
+  } else {
+    return true;
+  }
+}
 
 bool abstractSoftware::launchJob(string commandLine, string& resul)
Index: /Interface_Web/trunk/pspaWT/sources/controler/src/beam2Moments.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/src/beam2Moments.cc	(revision 385)
+++ /Interface_Web/trunk/pspaWT/sources/controler/src/beam2Moments.cc	(revision 386)
@@ -78,5 +78,5 @@
 
 // suppose qu'on est bien positionnÃ© dans le stream (a revoir)
-void beam2Moments::readFromTransportOutput(stringstream& inp) {
+bool beam2Moments::readFromTransportOutput(stringstream& inp) {
   string bidString, bidString1, bidString2;
   double bidon, bidon1, bidon2;
@@ -87,22 +87,100 @@
   string buf;
   // sauter les eventuels 'VARY'
+
+  string varied = "VARIED:";
+  // while ( varied == "VARIED:" ) {
+  //   getline(inp, buf);
+  //   cout << " beam2Moments::readFromTransportOutput ligne lue : " << buf << endl;
+  //   stringstream str(buf); 
+  //   str >> varied;
+  // }
+
+  string testVary;
   while ( notFound ) {
     getline(inp, buf);
-    stringstream str(buf);        
+    //    cout << " beam2Moments::readFromTransportOutput ligne lue : " << buf << endl;
+    stringstream str(buf); 
     if ( str >> bidon1 >>  bidString1 >>  bidon2 >>  ( rij_secondOrderMoments_.at(0) ).at(0) >> bidString2 )  {
-       notFound = false;
-    }
-  }
-  //     test = inp >> bidon >>  bidString >>  bidon >>  ( rij_secondOrderMoments_.at(0) ).at(0) >> bidString;
-  //   cout << " beam2Moments::readFromTransportOutput TEST= " << test << endl;
-  //  }
-  inp >> bidon >> ( rij_secondOrderMoments_.at(1) ).at(1) >>  bidString >> ( rij_secondOrderMoments_.at(1) ).at(0);
-  inp >> bidon >> ( rij_secondOrderMoments_.at(2) ).at(2) >>  bidString >> ( rij_secondOrderMoments_.at(2) ).at(0)  >> ( rij_secondOrderMoments_.at(2) ).at(1);
-  inp >> bidon >> ( rij_secondOrderMoments_.at(3) ).at(3) >>  bidString >> ( rij_secondOrderMoments_.at(3) ).at(0)  >> ( rij_secondOrderMoments_.at(3) ).at(1) >> ( rij_secondOrderMoments_.at(3) ).at(2);
-    
-  inp >> bidon >> ( rij_secondOrderMoments_.at(4) ).at(4) >>  bidString >> ( rij_secondOrderMoments_.at(4) ).at(0)  >> ( rij_secondOrderMoments_.at(4) ).at(1) >> ( rij_secondOrderMoments_.at(4) ).at(2) >> ( rij_secondOrderMoments_.at(4) ).at(3);
-    
-  inp >> bidon >> ( rij_secondOrderMoments_.at(5) ).at(5) >>  bidString >> ( rij_secondOrderMoments_.at(5) ).at(0)  >> ( rij_secondOrderMoments_.at(5) ).at(1) >> ( rij_secondOrderMoments_.at(5) ).at(2) >> ( rij_secondOrderMoments_.at(5) ).at(3) >> ( rij_secondOrderMoments_.at(5) ).at(4);
-    
+      // le format semble correct
+      if ( bidString1 != "M" ) {
+	// c'est bien ce qu'on attend : la longuer en metres
+	cout << " beam2Moments::readFromTransportOutput ON N'A PAS 'M' ligne lue : " << buf << endl;
+	notFound = true;
+	break;
+      } else {
+	// on a trouve la bonne ligne
+	cout << " beam2Moments::readFromTransportOutput lecture OK :  ligne lue : " << buf << endl;
+	notFound = false;
+      }
+    } else { 
+      // la ligne lue n'est pas au format
+      cout << "  beam2Moments::readFromTransportOutput format non conforme ligne lue : " << buf << endl;
+      stringstream test(buf);
+      if ( test >> testVary ) {
+	if ( testVary == varied ) {
+	  // ca peut arriver... on continue
+	  cout << "  beam2Moments::readFromTransportOutput VARIED RENCONTRE ligne lue : " << buf << endl;
+	  notFound = true;
+	} else {
+	  // on essaie de voir ce qui se passe (ce sera probablement a completer)
+	  if ( testVary == "(" ) {
+	  // on est trop loin, on est sur l'element suivant, on arrete
+	  cout << "  beam2Moments::readFromTransportOutput ON EST TOMBE SUR ELEMNT SUIVANT ligne lue : " << buf << endl;
+	    notFound = true;
+	    break;
+	  }
+	  if ( testVary == "0" ) {
+	    // on doit etre a la fin du fichier, ce qu'on verifie
+	    if ( test >> bidString ) {
+	      if ( bidString == "*LENGTH*" ) {
+		// c'est bien ca, on arrete
+		cout << "  beam2Moments::readFromTransportOutput ON EST A LA FIN DU FICHIER ligne lue : " << buf << endl;
+		notFound = true;
+		break;
+	      } else {
+		// on n'y comprend plus grans chose, on arrete de toute facon
+		cout << "  beam2Moments::readFromTransportOutput SITUATION NON PREVUE 1 ligne lue : " << buf << endl;
+		notFound = true;
+		break;
+	      }                // fin test lecture d'une chaine de caracteres
+	    } else {
+	      // on n'a pas pu lire la chaine, on n'y comprend rien, on arrete
+		cout << "  beam2Moments::readFromTransportOutput SITUATION NON PREVUE 2 ligne lue : " << buf << endl;
+		notFound = true;
+		break;
+	    }
+	  } else {
+	    // le premier element lu n'est pas 0, on n'est pas a la fin
+	    // mais il n'y a pas de faisceau a cet endroit, sortie normale
+		cout << "  beam2Moments::readFromTransportOutput SORTIE NORMALE ligne lue : " << buf << endl;
+	    notFound = true;
+	    break;
+	  }
+	  // si on arrive la, on est en pleine panade
+		cout << "  beam2Moments::readFromTransportOutput SITUATION NON PREVUE 4 ligne lue : " << buf << endl;
+	    notFound = true;
+	    break;
+	} 
+      } else {
+	// on n'a pas pu lire le premier element de la ligne (bizarre)
+		cout << "  beam2Moments::readFromTransportOutput SITUATION NON PREVUE 5 ligne lue : " << buf << endl;
+	notFound = true;
+	break;
+      }
+    }
+  } // fin de boucle sur les lignes
+
+  if ( notFound ) return false;
+
+
+  if ( ! ( inp >> bidon >> ( rij_secondOrderMoments_.at(1) ).at(1) >>  bidString >> ( rij_secondOrderMoments_.at(1) ).at(0) ) ) return false;
+  if ( ! (inp >> bidon >> ( rij_secondOrderMoments_.at(2) ).at(2) >>  bidString >> ( rij_secondOrderMoments_.at(2) ).at(0)  >> ( rij_secondOrderMoments_.at(2) ).at(1) ) ) return false;
+  if ( ! (inp >> bidon >> ( rij_secondOrderMoments_.at(3) ).at(3) >>  bidString >> ( rij_secondOrderMoments_.at(3) ).at(0)  >> ( rij_secondOrderMoments_.at(3) ).at(1) >> ( rij_secondOrderMoments_.at(3) ).at(2) ) ) return false; 
+    
+  if ( ! ( inp >> bidon >> ( rij_secondOrderMoments_.at(4) ).at(4) >>  bidString >> ( rij_secondOrderMoments_.at(4) ).at(0)  >> ( rij_secondOrderMoments_.at(4) ).at(1) >> ( rij_secondOrderMoments_.at(4) ).at(2) >> ( rij_secondOrderMoments_.at(4) ).at(3) ) ) return false;
+    
+  if ( ! (inp >> bidon >> ( rij_secondOrderMoments_.at(5) ).at(5) >>  bidString >> ( rij_secondOrderMoments_.at(5) ).at(0)  >> ( rij_secondOrderMoments_.at(5) ).at(1) >> ( rij_secondOrderMoments_.at(5) ).at(2) >> ( rij_secondOrderMoments_.at(5) ).at(3) >> ( rij_secondOrderMoments_.at(5) ).at(4) ) ) return false;
+
+  return true;    
 }
 
Index: /Interface_Web/trunk/pspaWT/sources/controler/src/dataManager.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/src/dataManager.cc	(revision 385)
+++ /Interface_Web/trunk/pspaWT/sources/controler/src/dataManager.cc	(revision 386)
@@ -98,4 +98,5 @@
   removeFile(workingDir + "generator.output");
   diagnosticBeam_.clear();
+  indexElementToIndexDiag_.clear();
   currentBeam_ = NULL;
   firstComputedElemNumero_ = getBeamLineSize();
@@ -136,7 +137,7 @@
       success = softw->createInputFile(currentBeam_,debut,fin,workingDir);
       if ( success ) {
-	success = softw->execute(debut,fin,workingDir);
+	success = softw->execute(workingDir);
 	if ( success ) {
-	  success = softw->buildBeamAfterElements(debut,fin,diagnosticBeam_,workingDir);
+	  success = softw->buildBeamAfterElements(workingDir);
 	}
       }
@@ -144,5 +145,5 @@
       delete softw;
       if ( success ) {
-	currentBeam_ = &diagnosticBeam_.back();
+	currentBeam_ = &diagnosticBeam_.at(indexElementToIndexDiag_.back());
 	cout << " execute termine avec succes " << endl;
       } else {
@@ -251,11 +252,16 @@
 particleBeam* dataManager::getDiagnosticBeam(unsigned index)
 {
-    if (index >= diagnosticBeam_.size()) {
-        return NULL;
-    } else {
-        return &diagnosticBeam_.at(index);
-    }
-}
-
+  if (index >= indexElementToIndexDiag_.size() ) {
+    return NULL;
+  } else {
+    int indDiag = indexElementToIndexDiag_.at(index);
+    return &diagnosticBeam_.at(indDiag);
+  }
+}
+
+particleBeam* dataManager::getDiagnosticBeam(string elementLabel)
+{
+  return getDiagnosticBeam( getNumeroFromElementLabel(elementLabel) -1);
+}
 
 
@@ -277,13 +283,13 @@
     for (unsigned k = firstComputedElemNumero_ -1 ; k < lastComputedElemNumero_ ; k++) {
       abstractElement* elPtr = pspa_->getBeamLine()->getAbstractElement(k);
-           if(elPtr->getNomdElement().getElementType() == snapshot) continue;
+      //     if(elPtr->getNomdElement().getElementType() == snapshot) continue;
       //      if(elPtr->getNomdElement().getElementType() == fit) continue;
-
-      if ( !diagnosticBeam_.at(i).momentRepresentationOk() ) {
-	diagnosticBeam_.at(i).buildMomentRepresentation();
+      particleBeam* beamToDraw = getDiagnosticBeam(i);
+      if ( !beamToDraw->momentRepresentationOk() ) {
+	beamToDraw->buildMomentRepresentation();
       }
 
       longueur += elPtr->getLenghtOfElement();
-      valeur = diagnosticBeam_.at(i).getXmaxRms();
+      valeur = beamToDraw->getXmaxRms();
       cout << " dataManager::donneesRmsEnveloppe index = " << k <<  " longueur = " << longueur << " enveloppe : " << valeur << endl;
       xcor.push_back(0.01*longueur);  // on passe en metres
Index: /Interface_Web/trunk/pspaWT/sources/controler/src/softwareGenerator.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/src/softwareGenerator.cc	(revision 385)
+++ /Interface_Web/trunk/pspaWT/sources/controler/src/softwareGenerator.cc	(revision 386)
@@ -8,15 +8,21 @@
 
 softwareGenerator::softwareGenerator() : abstractSoftware()
-{;}
+{
+  nameOfSoftware_ = nomDeLogiciel("generator");
+}
 
 softwareGenerator::softwareGenerator(string inputFileName, globalParameters* globals, dataManager* dt) : abstractSoftware(inputFileName, globals, dt)
-{;}
+{
+  nameOfSoftware_ = nomDeLogiciel("generator");
+}
 
 bool softwareGenerator::createInputFile(particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin, string workingDir)
 {
-  if ( numeroDeb != numeroFin ) return false;
+  if ( !initComputationLimits(numeroDeb,numeroFin) ) return false;
+
+  if ( numeroDeb_ != numeroFin_ ) return false;
 
   abstractElement* elPtr;
-  elPtr = dataManager_->getElementPointerFromNumero(numeroDeb);
+  elPtr = dataManager_->getElementPointerFromNumero(numeroDeb_);
 
   if ( elPtr->getNomdElement().getElementType() != RFgun ) {
@@ -46,10 +52,10 @@
 }
 
-bool softwareGenerator::execute(unsigned int numeroDeb,unsigned int numeroFin,string workingDir) {
+bool softwareGenerator::execute(string workingDir) {
   
   bool ExecuteStatus = true;
   
   ostringstream sortie;
-  sortie << " EXECUTION DE GENERATOR DE l'ELEMENT " << numeroDeb << " A L'ELEMENT " << numeroFin << endl;
+  sortie << " EXECUTION DE GENERATOR DE l'ELEMENT " << numeroDeb_ << " A L'ELEMENT " << numeroFin_ << endl;
 
   string generatorJob = workingDir + "generator";
@@ -83,13 +89,17 @@
 }
 
-bool  softwareGenerator::buildBeamAfterElements(unsigned int numeroDeb,unsigned int numeroFin, vector<particleBeam>& beams, string workingDir) {
+bool  softwareGenerator::buildBeamAfterElements( string workingDir) {
 
   bool result = true;
-  if ( numeroDeb != numeroFin ) {
+  if ( !ComputationLimitsOk() ) return false;
+
+  if ( numeroDeb_ != numeroFin_ ) {
     dataManager_->consoleMessage(" softwareGenerator::buildBeamAfterElements : only one element (rfgun) must be calculated " );
     return false;
   }
-
-  beams.push_back(particleBeam());
+  // on initialise une nouvelle sortie diagnostic 
+  particleBeam* newDiag = dataManager_->updateCurrentDiagnostic(true);
+
+  //  beams.push_back(particleBeam());
   vector<double> centroid;
   bareParticle refPart;
@@ -97,5 +107,5 @@
   vector<bareParticle> particlesPassives; // on ne fait rien de ces particules pour l'instant
   if (beamFromGenerator(string("faisceau.ini"),workingDir, centroid, refPart,particles, particlesPassives )) {
-    beams.back().setWithParticles(centroid, refPart,particles); 
+    newDiag->setWithParticles(centroid, refPart,particles); 
   } else {
     dataManager_->consoleMessage(" softwareGenerator::buildBeamAfterElements : error  " );
Index: /Interface_Web/trunk/pspaWT/sources/controler/src/softwareParmela.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/src/softwareParmela.cc	(revision 385)
+++ /Interface_Web/trunk/pspaWT/sources/controler/src/softwareParmela.cc	(revision 386)
@@ -6,21 +6,52 @@
 #include "dataManager.h"
 #include "mixedTools.h"
-
+//#include "nomDeLogiciel.h"
 softwareParmela::softwareParmela() : abstractSoftware()
-{;}
+{
+  nameOfSoftware_ = nomDeLogiciel("parmela");
+}
 
 softwareParmela::softwareParmela(string inputFileName, globalParameters* globals, dataManager* dt) : abstractSoftware(inputFileName, globals, dt)
-{;}
+{
+  nameOfSoftware_ = nomDeLogiciel("parmela");
+}
+
+void softwareParmela::setRelativeParmelaElementIndices() {
+  relativeParmelaElementIndices_.clear();
+  relativeParmelaElementIndices_.resize(numeroFin_ - numeroDeb_ + 1, -1);
+  cout << " setRelativeParmelaElementIndices() taille a priori : " << relativeParmelaElementIndices_.size() << endl;
+  abstractElement* elPtr = dataManager_->getElementPointerFromNumero(numeroDeb_);
+  bool there_is_rfgun = ( elPtr->getNomdElement().getElementType() == RFgun );
+  unsigned offsetNumElem;
+  // les elements de parmela sont indexes de 1 Ã  max, s'il n'y a pas de rfgun
+  if ( !there_is_rfgun ) {
+    offsetNumElem = numeroDeb_ -1;
+    // les elements de parmela sont indexes de 0 Ã  max, s'il y a un rfgun
+  } else {
+    offsetNumElem = numeroDeb_;
+  }
+
+  // index du premier element de parmela
+  int id= numeroDeb_ - offsetNumElem;
+  unsigned k;
+  unsigned curseur = 0;
+  for ( k=numeroDeb_; k <= numeroFin_ ; k++ ) {
+    abstractElement* elem = dataManager_->getElementPointerFromNumero(k);
+    cout << " liste PARMELA no absolu " << k << " relatif provisoire " << relativeParmelaElementIndices_.at(curseur) << endl;
+    if ( elem->is_accepted_by_software(nameOfSoftware_) == TBoolOk ) {
+      relativeParmelaElementIndices_.at(curseur) = id;
+      cout << " mis a " << id << endl;
+      id++;
+    }
+    curseur++;
+  }
+}
+
 
 bool softwareParmela::createInputFile(particleBeam* beamBefore,unsigned int numeroDeb,unsigned int numeroFin,string workingDir)
 {
   unsigned int k;
-    
-  if ( numeroDeb < 1 || numeroFin > dataManager_->getBeamLineSize() ) {
-    dataManager_->consoleMessage(" softwareParmela::createInputFile : numero of element out of limits " );
-    cerr << " numero of element out of limits " << endl;
-    return false;
-  }
-    
+  if ( !initComputationLimits(numeroDeb,numeroFin) ) return false;
+  setRelativeParmelaElementIndices();
   string name = workingDir + inputFileName_;
   ofstream outfile;
@@ -34,5 +65,5 @@
   abstractElement* elPtr;
   double initalKineticEnergy = 0.0;
-  elPtr = dataManager_->getElementPointerFromNumero(numeroDeb);
+  elPtr = dataManager_->getElementPointerFromNumero(numeroDeb_);
   bool there_is_rfgun = ( elPtr->getNomdElement().getElementType() == RFgun );
   
@@ -42,10 +73,10 @@
     initalKineticEnergy = beamBefore->referenceKineticEnergyMeV();
     // les elements de parmela sont indexes de 1 Ã  max, s'il n'y a pas de rfgun
-    offsetNumElem_ = numeroDeb -1;
+    //    offsetNumElem_ = numeroDeb_ -1;
   } else {
     elPtr->setPhaseStep( globParamPtr_->getIntegrationStep() );
     initalKineticEnergy = elPtr->getInitialKineticEnergy();
     // les elements de parmela sont indexes de 0 Ã  max, s'il y a un rfgun
-    offsetNumElem_ = numeroDeb;
+    //    offsetNumElem_ = numeroDeb_;
   }
   
@@ -54,7 +85,7 @@
   outfile << "RUN /n0=1 /ip=999 /freq=" << globParamPtr_->getFrequency() << "  /z0=0.0 /W0=" << initalKineticEnergy << "  /itype=1" << endl;
   outfile << "OUTPUT 0" << endl;
-  unsigned int premier = numeroDeb ;
+  unsigned int premier = numeroDeb_ ;
   if ( there_is_rfgun ) {
-    outfile << dataManager_->getElementPointerFromNumero(numeroDeb)->parmelaOutputFlow() << endl;
+    outfile << dataManager_->getElementPointerFromNumero(numeroDeb_)->parmelaOutputFlow() << endl;
     premier++;
   } else {
@@ -63,5 +94,5 @@
   
   // commentaire :  si l'element est un snapshot ne rien ecrire dans inputFileName_ (= parmin) un saut de ligne perturbe l'execution de parmela
-  for ( k = premier; k <= numeroFin; k++)
+  for ( k = premier; k <= numeroFin_; k++)
     {
       elPtr = dataManager_->getElementPointerFromNumero(k);
@@ -80,10 +111,10 @@
 }
 
-bool softwareParmela::execute(unsigned int numeroDeb,unsigned int numeroFin,string workingDir)
+bool softwareParmela::execute(string workingDir)
 {
   bool ExecuteStatus = true;
   
   ostringstream sortie;
-  sortie << " EXECUTION DE PARMELA DE l'ELEMENT " << numeroDeb << " A L'ELEMENT " << numeroFin << endl;
+  sortie << " EXECUTION DE PARMELA DE l'ELEMENT " << numeroDeb_ << " A L'ELEMENT " << numeroFin_ << endl;
     
   string parmelaJob = workingDir + "parmela";
@@ -114,59 +145,60 @@
 
 
-bool softwareParmela::buildBeamAfterElements(unsigned int numeroDeb,unsigned int numeroFin, vector<particleBeam>& beams, string workingDir)
+bool softwareParmela::buildBeamAfterElements( string workingDir)
 {
   bool result = true;
-  //cout << "debug:: debut " << numeroDeb << ", fin " << numeroFin << endl;
-  
-  // index du premier element de parmela
-  int id= numeroDeb-offsetNumElem_;
-  
-  for(unsigned k = numeroDeb; k <= numeroFin; k++)
+
+  if ( !ComputationLimitsOk() ) return false;
+  unsigned curseur;
+  for(unsigned k = numeroDeb_; k <= numeroFin_; k++)
     {
       abstractElement* elem = dataManager_->getElementPointerFromNumero(k);
-    
-      // si l'element est un snapshot, recuperer la sortie precedente
-      if(elem->getNomdElement().getElementType() == snapshot) {
-	int avantDernier = beams.size() - 1;
-	string* param = elem->getParametersString();
-	string cliche = workingDir + param[2].c_str();
-	if( beamToParmela(cliche,&beams.at(avantDernier)) ) {
-	  cout  <<  "["  <<  k  <<  "] : ecrit sur fichier " << cliche << " le contenu de beam["<<avantDernier<<"]"<<endl;
+      if ( elem == NULL ) {
+	dataManager_->consoleMessage(" softwareParmela::buildBeamAfterElements : null pointer on element " );
+	return  false;	      
+      }
+
+      curseur = k - numeroDeb_;
+
+      if ( relativeParmelaElementIndices_.at(curseur) < 0 ) {
+
+	// si l'element doit etre ignore de parmela, on renvoie sur le diag precedent
+	particleBeam* lastDiag = dataManager_->updateCurrentDiagnostic(false);
+
+	if(elem->getNomdElement().getElementType() == snapshot) {
+	  // si cet element est un snapshot, on organise la sortie correspondante
+	  string* param = elem->getParametersString();
+	  string cliche = workingDir + param[2].c_str();
+	  if( beamToParmela(cliche,lastDiag) ) {
+	      //	    cout  <<  "["  <<  k  <<  "] : ecrit sur fichier " << cliche << " le contenu de beam["<<avantDernier<<"]"<<endl;
+	    cout  <<  "["  <<  k  <<  "] : ecrit sur fichier " << cliche << " le contenu de beam[ ]"<<endl;
+	  }
 	}
-	// continue;
-      }
-      
-      // sinon c'est un element de parmela d'index id
-      beams.push_back(particleBeam());
-      cout << " creation diagn. no " << beams.size() << " par PARMELA " << endl;
-
-      vector<double> centroid;
-      bareParticle refPart;
-      vector<bareParticle> particles;
-      double freq= globParamPtr_->getFrequency();
-      
-      cout << " lecture PARMELA el no absolu " << k << " nom " << elem->getNomdElement().getElementName() << endl;
-      if(!beamFromParmela(workingDir,id,freq,centroid,refPart,particles))
-        {
-	  if(elem->is_accepted_by_software(nomDeLogiciel::parmela) == TBoolIgnore) {
-	    int avantDernier = beams.size() -2;
-	    beams.back() = beams.at(avantDernier);
+	// si le numero est reconnu de parmela
+      } else {
+	 
+	// on initialise une nouvelle sortie diagnostic 
+	  particleBeam* newDiag = dataManager_->updateCurrentDiagnostic(true);
+	  vector<double> centroid;
+	  bareParticle refPart;
+	  vector<bareParticle> particles;
+	  double freq= globParamPtr_->getFrequency();
+	  unsigned numeroParmel;
+	  numeroParmel = (unsigned)relativeParmelaElementIndices_.at(curseur);
+	  cout << " lecture PARMELA el no absolu " << k << " numero relatif " << numeroParmel << " nom " << elem->getNomdElement().getElementName() << endl;
+      	// lecture sortie parmela
+	if(!beamFromParmela(workingDir,numeroParmel,freq,centroid,refPart,particles))
+	  {
+	    // si echec, fin
+	    dataManager_->consoleMessage(" softwareParmela::buildBeamAfterElements : failure in reading parmela result for element " + elem->getLabel() + " for unknown reason " );
+	    return  false;
 	  } else {
-	    dataManager_->consoleMessage("softwareParmela::buildBeamAfterElements : reading parmdesz failed");
-	    result = false;
-	    break;
-	  }
-          
-        } else {
-	beams.back().setWithParticles(centroid,refPart,particles);
-      }
-      
-      // l'element de parmela suivant
-      id++;
-    }
-  
+	  // si succes, on complete le diagnostic
+	  newDiag->setWithParticles(centroid,refPart,particles);
+	}
+      }
+    }
   return result;
 }
-
 bool softwareParmela::beamFromParmela(string workingDir,unsigned numeroParmel, double referencefrequency, vector<double>& centroid, bareParticle& refPart,vector<bareParticle>& particles )
 {    
Index: /Interface_Web/trunk/pspaWT/sources/controler/src/softwareTest.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/src/softwareTest.cc	(revision 385)
+++ /Interface_Web/trunk/pspaWT/sources/controler/src/softwareTest.cc	(revision 386)
@@ -8,5 +8,5 @@
 softwareTest::softwareTest() : abstractSoftware()
 {
-  ;
+  nameOfSoftware_ = nomDeLogiciel("test");
 }
 
@@ -16,5 +16,5 @@
 softwareTest::softwareTest(string inputFileName, globalParameters* globals, dataManager* dt) : abstractSoftware( inputFileName, globals, dt)
 {
-  ;
+  nameOfSoftware_ = nomDeLogiciel("test");
 }
 
@@ -30,16 +30,17 @@
 }
 
-bool  softwareTest::execute( unsigned int numeroDeb,unsigned int numeroFin,string workingDir) {
+bool  softwareTest::execute(string workingDir) {
     dataManager_->consoleMessage(" softwareTest::execute  " );
   return true;
 }
 
-bool  softwareTest::buildBeamAfterElements(unsigned int numeroDeb,unsigned int numeroFin, vector<particleBeam>& beams, string workingDir) {
+bool  softwareTest::buildBeamAfterElements(string workingDir) {
   dataManager_->consoleMessage(" softwareTest::buildBeamAfterElements  " );
   bool result = true;
   unsigned k;
-  for ( k= numeroDeb; k <= numeroFin; k++)
+  for ( k= numeroDeb_; k <= numeroFin_; k++)
     {
-      beams.push_back(particleBeam());
+      particleBeam* newDiag = dataManager_->updateCurrentDiagnostic(true);
+  //      beams.push_back(particleBeam());
       vector<double> centroid = vector<double>(6,0.0);
       bareParticle refPart;
@@ -55,5 +56,5 @@
       else {
 	bareParticle refPart (particles.at(0));
-	beams.back().setWithParticles(centroid, refPart,particles); 
+	newDiag->setWithParticles(centroid, refPart,particles); 
       }
     }
Index: /Interface_Web/trunk/pspaWT/sources/controler/src/softwareTransport.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/src/softwareTransport.cc	(revision 385)
+++ /Interface_Web/trunk/pspaWT/sources/controler/src/softwareTransport.cc	(revision 386)
@@ -7,19 +7,20 @@
 
 softwareTransport::softwareTransport() : abstractSoftware()
-{;}
+{
+  nameOfSoftware_ = nomDeLogiciel("transport");
+}
 
 softwareTransport::softwareTransport(string inputFileName,globalParameters* globals, dataManager* dt) : abstractSoftware(inputFileName, globals, dt)
-{;}
+{
+  nameOfSoftware_ = nomDeLogiciel("transport");
+}
 
 bool softwareTransport::createInputFile(particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin, string workingDir)
 { 
-  if ( numeroDeb < 1 || numeroFin > dataManager_->getBeamLineSize() ) {
-    dataManager_->consoleMessage(" softwareTransport::createInputFile : numero of element out of limits " );
-    cerr << " numero of element out of limits " << endl;
-    return false;
-  }
+
+  if ( !initComputationLimits(numeroDeb,numeroFin) ) return false;
 
   abstractElement* premierEl = NULL;
-  premierEl = dataManager_->getElementPointerFromNumero(numeroDeb);
+  premierEl = dataManager_->getElementPointerFromNumero(numeroDeb_);
 
   // ceinture et bretelles
@@ -79,9 +80,8 @@
 
   abstractElement* elPtr;
-  for (unsigned k = numeroDeb; k <= numeroFin; k++)
+  for (unsigned k = numeroDeb_; k <= numeroFin_; k++)
     {
       elPtr = dataManager_->getElementPointerFromNumero(k);
       cout << "debug:: element [" << k << "] " << elPtr->getNomdElement().getElementName() << endl;
-      if(elPtr->getNomdElement().getElementType() == snapshot) continue;
       outfile << elPtr->transportOutputFlow() << endl;
     }
@@ -95,10 +95,10 @@
 }
 
-bool softwareTransport::execute( unsigned int numeroDeb, unsigned int numeroFin, string workingDir)
+bool softwareTransport::execute(string workingDir)
 {
   bool ExecuteStatus = true;
 
   ostringstream sortie;
-  sortie << " EXECUTION DE TRANSPORT DE " << numeroDeb << " a " << numeroFin << endl;
+  sortie << " EXECUTION DE TRANSPORT DE " << numeroDeb_ << " a " << numeroFin_ << endl;
   
   string transportJob = workingDir + "transport";
@@ -132,10 +132,11 @@
 }
 
-bool softwareTransport::buildBeamAfterElements(unsigned int numeroDeb,unsigned int numeroFin, vector<particleBeam>& beams,string workingDir) 
+bool softwareTransport::buildBeamAfterElements(string workingDir) 
 {
 
   bool result = true;
-  
-  for (unsigned k = numeroDeb; k <= numeroFin; k++)
+  if ( !ComputationLimitsOk() ) return false;
+
+  for (unsigned k = numeroDeb_; k <= numeroFin_; k++)
     {
       abstractElement* ptr = dataManager_->getElementPointerFromNumero(k);
@@ -143,34 +144,44 @@
 	dataManager_->consoleMessage(" softwareTransport::buildBeamAfterElements : null pointer on element " );
 	cout << " softwareTransport::buildBeamAfterElements : null pointer on element " << endl;
-	result = false;
-	break;	      
-      }
-
+	return false;	      
+      }
+
+
+      if ( ptr->is_accepted_by_software(nameOfSoftware_) != TBoolOk ) {
+	// si l'element doit etre ignore, on renvoie sur le diag precedent
+	dataManager_->updateCurrentDiagnostic(false);
       // si l'element est un snapshot, recuperer la sortie precedente
-      if(ptr->getNomdElement().getElementType() == snapshot) {
-	int avantDernier = beams.size() - 1;
-	string* param = ptr->getParametersString();
-	string cliche = workingDir + param[2].c_str();
-	 cout<<"["<<k<<"] : ecrit sur fichier " << cliche << " le contenu de beam["<<avantDernier<<"]"<<endl;
-	 //	 continue;
-      }
-
-      beams.push_back(particleBeam());
-      cout << " creation diagn. no " << beams.size() << " par TRANSPORT " << endl;
-      string elemLabel = ptr->getLabel();
-      beam2Moments transpMoments;
-      
-      if (!moments2FromTransport(workingDir,elemLabel,ptr->getNomdElement(),transpMoments) )
-	{
-	  dataManager_->consoleMessage(" softwareTransport::buildBeamAfterElements : failure in reading moments " );
-	  cout << " softwareTransport::buildBeamAfterElements plantage dans lecture moments " << endl;
-	  result = false;
-	  break;
-	} 
-      beams.back().set2Moments(transpMoments);
+	if(ptr->getNomdElement().getElementType() == snapshot) {
+	  string* param = ptr->getParametersString();
+	  string cliche = workingDir + param[2].c_str();
+	  cout<<"["<<k<<"] : ecrit sur fichier " << cliche << " le contenu de beam[ ]"<<endl;
+	}
+      } else {
+	// si le numero est reconnu de transport
+
+
+
+	string elemLabel = ptr->getLabel();
+	beam2Moments transpMoments;
+      	// lecture sortie transport
+	if (!moments2FromTransport(workingDir,elemLabel,ptr->getNomdElement(),transpMoments) )
+	  {
+	    // si echec, on renvoie sur le diag precedent
+	    dataManager_->updateCurrentDiagnostic(false);
+
+	    dataManager_->consoleMessage(" softwareTransport::buildBeamAfterElements : element skipped in reading moments from transport output :  " + elemLabel);
+	    //   cout << " softwareTransport::buildBeamAfterElements plantage dans lecture moments " << endl;
+	    return true;
+	  } else {
+	  // si succes, 
+	// on initialise une nouvelle sortie diagnostic 
+	  particleBeam* newDiag = dataManager_->updateCurrentDiagnostic(true);
+	// et on la complete
+	  newDiag->set2Moments(transpMoments);
+	}
+      }
     }
   return result;
 }
-
 bool softwareTransport::moments2FromTransport(string workingDir,string elLab,const nomdElements elem,beam2Moments& moments) const 
 {
@@ -226,5 +237,4 @@
   }
 
-  moments.readFromTransportOutput(fichierStream);
-  return true;
-}
+  return moments.readFromTransportOutput(fichierStream);
+}
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_pspaApplication.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_pspaApplication.h	(revision 385)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_pspaApplication.h	(revision 386)
@@ -87,6 +87,6 @@
 
  //  void setModelComponentForPhaseSpace(WStandardItemModel* model, vector<bareParticle>& partic, unsigned indexParticleComponent, unsigned modelComponent); 
-void faireDessinParmela(WContainerWidget* toto, particleBeam* beam, string namex, string namey  );
-  void faireDessinTransport(WContainerWidget* toto, particleBeam* beam, string namex, string namey);
+  //void faireDessinParmela(WContainerWidget* toto, particleBeam* beam, string namex, string namey  );
+  //  void faireDessinTransport(WContainerWidget* toto, particleBeam* beam, string namex, string namey);
   void faireDessinEnveloppe(WContainerWidget* toto, string type);
   //  void scatterPlot1D(WContainerWidget* toto, vector<double>& xcor, vector<double>& ycor);
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc	(revision 385)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc	(revision 386)
@@ -500,5 +500,5 @@
   for(int i = 1; i <= nombre; i++) {
     abstractElement* elPtr = dtmanage_->getElementPointerFromNumero(i);
-    if(elPtr->getNomdElement().getElementType() == snapshot) continue;
+    //    if(elPtr->getNomdElement().getElementType() == snapshot) continue;
 
     choixElementDessin_->addItem(elPtr->getLabel());
@@ -511,5 +511,5 @@
     
   int typeFaisceau = choixTypeDessinFaisceau_->currentIndex();
-  int index = choixElementDessin_->currentIndex();
+  //  int index = choixElementDessin_->currentIndex();
   string nameAbs = choixAbsPhase_->currentText().toUTF8();
   string nameOrd = choixOrdPhase_->currentText().toUTF8();
@@ -519,6 +519,7 @@
 	return;
   }
-
-  particleBeam* beam = dtmanage_->getDiagnosticBeam(index);
+  string elementLabel = choixElementDessin_->currentText().toUTF8();
+  particleBeam* beam = dtmanage_->getDiagnosticBeam(elementLabel);
+  //  particleBeam* beam = dtmanage_->getDiagnosticBeam(index);
     
   if ( beam == NULL ) {
@@ -626,56 +627,56 @@
 
 
-void PspaApplication::faireDessinParmela(WContainerWidget* toto, particleBeam* beam, string namex, string namey )
-{
-  cout << " faireDessinParmela " << endl;
-  GWt_dialog* pointsDialog = new GWt_dialog("space phase",toto,false);
-  eDialog_.push_back(pointsDialog);
-  pointsDialog->setMinimumSize(400,400);
-  pointsDialog->setClosable(true);
-  // pointsDialog->show();
+// void PspaApplication::faireDessinParmela(WContainerWidget* toto, particleBeam* beam, string namex, string namey )
+// {
+//   cout << " faireDessinParmela " << endl;
+//   GWt_dialog* pointsDialog = new GWt_dialog("space phase",toto,false);
+//   eDialog_.push_back(pointsDialog);
+//   pointsDialog->setMinimumSize(400,400);
+//   pointsDialog->setClosable(true);
+//   // pointsDialog->show();
       
-  new WText(nameOfCase_, pointsDialog->contents());
-
-
-  vector<double> xcor;
-  vector<double> ycor;
-  vector<string> legende;
-  beam->particlesPhaseSpaceData(xcor, ycor, legende, namex, namey);
-  for (int k=0 ; k < legende.size(); k++) {
-    new WBreak(pointsDialog->contents());
-    new WText(legende.at(k), pointsDialog->contents());
-  }
-  string titre = " phase space ";
-  chartPlot2vec(pointsDialog->contents(), xcor, ycor, true,titre,namex, namey,400,400);
-
-
-    
-  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, string namex, string namey)
-{
-  GWt_dialog* ellipseDialog = new GWt_dialog("ellipse",toto,false);
-  eDialog_.push_back(ellipseDialog);
-  ellipseDialog->setMinimumSize(400,400);
-  ellipseDialog->setClosable(true);
-  ellipseDialog->show();
-  new WText(nameOfCase_, ellipseDialog->contents());
-  
-  vector<double> xcor;
-  vector<double> ycor;
-  vector<string> legende;
-  beam->donneesDessinEllipse(xcor,ycor,legende, namex, namey);
-
-  for (int k=0 ; k < legende.size(); k++) {
-    new WBreak(ellipseDialog->contents());
-    new WText(legende.at(k), ellipseDialog->contents());
-  }
-  string titre = "phase space rms";
-  chartPlot2vec(ellipseDialog->contents(), xcor, ycor, false,titre, namex, namey,500,300);
-}
+//   new WText(nameOfCase_, pointsDialog->contents());
+
+
+//   vector<double> xcor;
+//   vector<double> ycor;
+//   vector<string> legende;
+//   beam->particlesPhaseSpaceData(xcor, ycor, legende, namex, namey);
+//   for (int k=0 ; k < legende.size(); k++) {
+//     new WBreak(pointsDialog->contents());
+//     new WText(legende.at(k), pointsDialog->contents());
+//   }
+//   string titre = " phase space ";
+//   chartPlot2vec(pointsDialog->contents(), xcor, ycor, true,titre,namex, namey,400,400);
+
+
+    
+//   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, string namex, string namey)
+// {
+//   GWt_dialog* ellipseDialog = new GWt_dialog("ellipse",toto,false);
+//   eDialog_.push_back(ellipseDialog);
+//   ellipseDialog->setMinimumSize(400,400);
+//   ellipseDialog->setClosable(true);
+//   ellipseDialog->show();
+//   new WText(nameOfCase_, ellipseDialog->contents());
+  
+//   vector<double> xcor;
+//   vector<double> ycor;
+//   vector<string> legende;
+//   beam->donneesDessinEllipse(xcor,ycor,legende, namex, namey);
+
+//   for (int k=0 ; k < legende.size(); k++) {
+//     new WBreak(ellipseDialog->contents());
+//     new WText(legende.at(k), ellipseDialog->contents());
+//   }
+//   string titre = "phase space rms";
+//   chartPlot2vec(ellipseDialog->contents(), xcor, ycor, false,titre, namex, namey,500,300);
+// }
 
 
@@ -848,6 +849,8 @@
   histoDialog->setClosable(true);
   
-  int index = choixHistoDessin_->currentIndex();    
-  particleBeam* beam = dtmanage_->getDiagnosticBeam(index);
+  // int index = choixHistoDessin_->currentIndex();    
+  // particleBeam* beam = dtmanage_->getDiagnosticBeam(index);
+   string elementLabel = choixHistoDessin_->currentText().toUTF8();    
+   particleBeam* beam = dtmanage_->getDiagnosticBeam(elementLabel);
   if (beam == NULL) {
     GWt_dialog warningBeamState("histogram","the beam does not exist at the end of this element !", GWt_dialog::Error, false,true);
