Index: /Interface_Web/trunk/pspaWT/History
===================================================================
--- /Interface_Web/trunk/pspaWT/History	(revision 454)
+++ /Interface_Web/trunk/pspaWT/History	(revision 455)
@@ -5,4 +5,173 @@
      PSPA - Plateforme de simulation en physique des accÃ©lÃ©rateurs
      =========================================================
+
+16 Décembre 2013 : Laurent Garnier
+Un certain nombre d'arguments/méthodes sont postfixés par "deprecated". Ils vont être supprimé prochainement et ne servent déja probablement plus a rien pour la plupart d'entre eux.
+
+- abstractSoftware :
+  o DEPRECATED : Passage a "deprecated" des fonctions et arguments suivants :
+    - initComputationLimits()
+    - ComputationLimitsOk()
+    - numeroDeb 
+    - numeroFin
+  o Suppression des paramètres globParamPtr_ et sectParamPtr_
+    qui sont désormais des paramètres de "dataManager" et "section"
+  o Ajout de la méthode getSectionToExecute()
+  o Changement du constructeur : 
+   - abstractSoftware(string,globalParameters*,dataManager*);  
+   Par
+   - abstractSoftware(string, sectionToExecute*);
+  o Changement de la méthode createInputFile qui ne prend désormais plus de numéroDeb ni numéroFin.
+   - createInputFile(particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir)
+   Remplacé par :
+   - createInputFile(particleBeam* beamBefore, string workingDir)
+
+- dataManager
+   o DEPRECATED : Passage a "deprecated" des fonctions et arguments suivants :
+     - getBeamLineSize()
+     - getDiagnosticBeam(string)
+     - getLabelFromElementNumero()
+     - getLabelFromElementLabel()
+   o Supression de :
+     - addSectionToExecute()
+     - addElement()
+     - getElementPointerFromNumero()
+     - clearSectionToExecute()
+
+- unknowSoftware :
+  o Changement de la méthode createInputFile qui ne prend désormais plus de numéroDeb ni numéroFin.
+   - createInputFile(particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir)
+   Remplacé par :
+   - createInputFile(particleBeam* beamBefore, string workingDir)
+
+- sectionToExecute : Désormais cette classe possède un vector d'abstractElement.
+  o Changement du constructeur :
+   - sectionToExecute(abstractElement*,abstractElement*,abstractSoftware*)
+   Remplacé par :
+   - sectionToExecute(abstractElement*,abstractSoftware*) -> Plus besoin de connaitre la fin, on ajoute les éléments au et
+     à mesure dans la sectionToExecute.
+  o supression de :
+    - getFirstElement() -> On parcours désormais un vecteur d'éléments
+    - getLastElement()
+    - getElementNumberInSection()
+    - getLastElementNumberInSection()
+    - firstElementNumberInBeamLine, lastElementNumberInBeamLine, firstElement, lastElement
+  o ajout d'un vecteur d'"abstractElement*" à cette section et des méthodes associées
+
+- sector :
+  o ajout des méthodes et paramètres :
+    - addElementAfter()
+    - setSoftware()
+    - clearSectionToExecute()
+    - clearSectionToExecute(int)
+    - dataManager_, sectorParam_ 
+
+- sectorParameters :
+  o Changement du constructeur en ajoutant un paramètre vers le "sector" d'origine
+  o Renommage de "sector_" en "sectorsStatements_" pour éviter les confusions
+
+- softwareGenerator :
+  o Changement du constructeur :
+    - softwareGenerator(string inputFileName, globalParameters* globals, dataManager* dt);
+    Par :
+    - softwareGenerator(string inputFileName, sectionToExecute*)
+  o Changement de la méthode createInputFile qui ne prend désormais plus de numéroDeb ni numéroFin.
+   - createInputFile(particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir)
+
+- softwareParmela :
+  o Changement du constructeur :
+    - softwareParmela(string inputFileName, globalParameters* globals, dataManager* dt);
+    Par :
+    - softwareParmela(string inputFileName, sectionToExecute*)
+  o Changement de la méthode createInputFile qui ne prend désormais plus de numéroDeb ni numéroFin.
+   - createInputFile(particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir)
+
+- softwareTest :
+  o Changement du constructeur :
+    - softwareTest(string inputFileName, globalParameters* globals, dataManager* dt);
+    Par :
+    - softwareTest(string inputFileName, sectionToExecute*)
+  o Changement de la méthode createInputFile qui ne prend désormais plus de numéroDeb ni numéroFin.
+   - createInputFile(particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir)
+
+- softwareUsersProgram :
+  o Changement du constructeur :
+    - softwareUsersProgram(string inputFileName, globalParameters* globals, dataManager* dt);
+    Par :
+    - softwareUsersProgram(string inputFileName, sectionToExecute*)
+  o Changement de la méthode createInputFile qui ne prend désormais plus de numéroDeb ni numéroFin.
+   - createInputFile(particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir)
+
+
+- softwareMadX :
+  o Changement du constructeur :
+    - softwareMadX(string inputFileName, globalParameters* globals, dataManager* dt);
+    Par :
+    - softwareMadX(string inputFileName, sectionToExecute*)
+  o Changement de la méthode createInputFile qui ne prend désormais plus de numéroDeb ni numéroFin.
+   - createInputFile(particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir)
+
+
+- softwareTransport :
+  o Changement du constructeur :
+    - softwareTransport(string inputFileName, globalParameters* globals, dataManager* dt);
+    Par :
+    - softwareTransport(string inputFileName, sectionToExecute*)
+  o Changement de la méthode createInputFile qui ne prend désormais plus de numéroDeb ni numéroFin.
+   - createInputFile(particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir)
+
+- GWt_elementBeam, Cell, Bend, Drift... :
+  o Changement du constructeur pour l'associer à un abstrastElement
+
+- GWt_elementLigneFaisceu :
+  o Remplacement de :
+    - initialize_ligneFaisceau(nomdElements::typedElement eType,GWt_ligneFaisceau* ligne);
+    Par :
+    - initialize_ligneFaisceau(GWt_ligneFaisceau* ligne, abstractElement* abstractElem)
+  o Suppression du pointeur vers PspaApplication*
+  o DEPRECATED : GWt_abstractElement
+
+- GWt_dropZoneLigneFaisceau :
+  o Desormais une dropZone n'est plus lié à PspaApplication mais à un dataManager
+
+- GWt_sectionToExecute :
+  o Ajout d'un pointer vers le section qui contient cette section
+
+- GWt_softwarePanel :
+  o Cette classe n'est plus liée à PspaApplication, mais au GWt_sector qui la contient
+
+- GWt_ligneFaisceau :
+  o Desormais cette classe n'est plus lié à PspaApplication mais à un dataManager et un GWt_sector
+  o DEPRECATED : 
+    - update()
+    - manageLineFaisceauLayout()
+
+- GWt_sectorParameters
+  o DEPRECATED :
+    - createSector()
+    - buttons()
+    - execDialog()
+
+- PspaApplication :
+  o La beamLine n'est plus gérée dans cette classe mais dans le dataManager, de ce fait, un certain nombre de fonctions et arguments disparaissent :
+  o DEPRECATED : 
+    - beamLine
+    - createBeamLine()
+  o Un certain nombre de fonction sont déplacée dans la nouvelle classe GWt_accelerator :
+    - dialogOnGraphics()
+    - faireDessinPhaseSpace(WContainerWidget* toto, particleBeam* beam, string elementLabel, string namex, string namey, int typeFaisceau)
+    - faireDessinEnveloppe(WContainerWidget* toto, string type)
+    - chartPlot2vec(WContainerWidget* toto,vector<double>& xcor,vector<double>& ycor,Wt::Chart::SeriesType seriesType,Wt::Chart::FillRangeType fillRange,Wt::Chart::AxisValue value,bool isGridLinesEnables,string title,string legendx,string legendy,int width,int height,bool makeIcon = false)
+    - removePathFromConfigName(string& config)
+    - removeExtensionFromConfigName(string& config)
+    - removeBeamLine()
+    - dessiner()
+    - dessinerEnveloppe()
+    - dessinerPhaseSpace()
+    - dessinerHistogramme()
+
+- GWt_accelerator : 
+  o Nouvelle classe afin de gérer toutes les fonctions spécifiques à un accélérateur et non pas à l'application PSPA. Cette classe pourra servir si l'on à plusieurs accélérateurs dans PSPA.
+
 
 12 Décembre 2013 : Laurent Garnier
Index: /Interface_Web/trunk/pspaWT/sources/controler/include/abstractSoftware.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/include/abstractSoftware.h	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/controler/include/abstractSoftware.h	(revision 455)
@@ -15,4 +15,5 @@
 
 class dataManager;
+class sectionToExecute;
 
 class abstractSoftware
@@ -21,7 +22,5 @@
  protected :
   
-  unsigned numeroDeb_, numeroFin_;
-  globalParameters* globParamPtr_;
-  sectorParameters* sectParamPtr_; //xx
+  unsigned numeroDeb_deprecated_, numeroFin_deprecated_;
   dataManager* dataManager_;
   string inputFileName_;
@@ -41,13 +40,16 @@
 
   bool launchJob(string commandLine, string& resul);
-  bool initComputationLimits(unsigned int numeroDeb,unsigned int numeroFin);
-  bool ComputationLimitsOk() const;
+  bool initComputationLimits_deprecated(unsigned int numeroDeb,unsigned int numeroFin);
+  bool ComputationLimitsOk_deprecated() const;
 
   void registerElement(nomdElements::typedElement nomdel,trivaluedBool b);
 
- public :
+  sectionToExecute* getSectionToExecute() {
+    return sectionToExecute_;
+  }
 
-  abstractSoftware(string,globalParameters*,dataManager*);
-  abstractSoftware(string,sectorParameters*,dataManager*);
+  public :
+
+  abstractSoftware(string, sectionToExecute*);
   ~abstractSoftware() {;}
 
@@ -58,5 +60,5 @@
   trivaluedBool doAcceptElement(nomdElements::typedElement typdel);
 
-  virtual bool createInputFile(particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir) = 0;
+  virtual bool createInputFile(particleBeam* beamBefore, string workingDir) = 0;
   virtual bool execute(string workingDir) = 0;
   virtual bool buildBeamAfterElements(string workingDir) = 0;
@@ -72,4 +74,7 @@
     return nameOfSoftware_.getString();
   }
+  private :
+  sectionToExecute* sectionToExecute_;
+  
 };
 #endif
Index: /Interface_Web/trunk/pspaWT/sources/controler/include/dataManager.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/include/dataManager.h	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/controler/include/dataManager.h	(revision 455)
@@ -28,19 +28,11 @@
   virtual ~dataManager();
   void consoleMessage(string message);
-  int getBeamLineSize();
+  int getBeamLineSize_deprecated();
   inline globalParameters* getGlobalParameters()  {return &globParam_;}
   inline particleBeam* getCurrentBeam() {return currentBeam_;}
-
-  // xx
-  inline sectorParameters* getSectorParameters() {return &sectorParam_;}
     
   particleBeam* getDiagnosticBeam(unsigned index);
-  particleBeam* getDiagnosticBeam(string elementLabel);
+  particleBeam* getDiagnosticBeam_deprecated(string elementLabel);
 
-  sectionToExecute*  addSectionToExecute(abstractElement* debut,int debutIndex, abstractElement* fin, int finIndex, nomDeLogiciel logiciel);
-
-  abstractElement* addElement(nomdElements::typedElement elemType);
-  void removeElement(string);
-  
 /** Add a new sector
  */
@@ -49,5 +41,5 @@
   /** return all sectors
    */
-  inline std::vector <sector*> getSectors() {return sectors_;};
+  inline std::vector <sector*> getSectors() {return jobList_;};
   
   /**
@@ -55,5 +47,5 @@
      @return return "" if not found
   */
-  string getLabelFromElementNumero(int numero);
+  string getLabelFromElementNumero_deprecated(int numero);
   
   /**
@@ -61,6 +53,5 @@
      @return return -1 if not found
   */
-  int getNumeroFromElementLabel(string);
-  abstractElement*  getElementPointerFromNumero(int);
+  int getNumeroFromElementLabel_deprecated(string);
   
   void initializeExecution();
@@ -82,5 +73,5 @@
   /** return the jobList size
    */
-  inline int getJobListSize() const {
+  inline unsigned long getJobListSize() const {
     return jobList_.size();
   }
@@ -96,23 +87,23 @@
   }
     
-  /** Clear a specific jobList */
-  void clearSectionToExecute(int a);
-    
+  
+  /**
+   Return the application attatch to this controler
+   */
+  inline PspaApplication* getPspaApplication() {
+    return pspa_;
+  };
+
+  
  private:
 
   globalParameters globParam_;
-  sectorParameters sectorParam_; //xx
   particleBeam* currentBeam_;
   PspaApplication* pspa_;
-  unsigned firstComputedElemNumero_;
-  unsigned lastComputedElemNumero_;
   
   vector<particleBeam> diagnosticBeam_;
   vector<unsigned> indexElementToIndexDiag_;
-  vector<sectionToExecute*> jobList_;
-  vector <sector*> sectors_;
+  vector <sector*> jobList_;
   void removeFile(string nameOfFile);
-  void clearSectionToExecute();
-  abstractSoftware* createSoftwareConnexion(nomDeLogiciel logi);
 };
 #endif
Index: /Interface_Web/trunk/pspaWT/sources/controler/include/particleBeam.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/include/particleBeam.h	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/controler/include/particleBeam.h	(revision 455)
@@ -108,5 +108,5 @@
   void buildMomentRepresentation();
   void clear();
-  int getNbParticles() const;
+  unsigned long getNbParticles() const;
   const beam2Moments&  getTransportMoments() const;
   double getUnnormalizedEmittanceX();
Index: /Interface_Web/trunk/pspaWT/sources/controler/include/sectionToExecute.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/include/sectionToExecute.h	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/controler/include/sectionToExecute.h	(revision 455)
@@ -9,6 +9,11 @@
 {
  public :
+  /** Create a new sectionToExecute and initialize it with the given element
+   */
+  sectionToExecute(abstractElement*);
 
-  sectionToExecute(abstractElement*,abstractElement*,abstractSoftware*);
+  /** Create a new sectionToExecute and initialize it with the given element and software
+   */
+  sectionToExecute(abstractElement*,abstractSoftware*);
   
   /** Deprecated : To be removed ! */
@@ -17,34 +22,24 @@
   ~sectionToExecute() {;}
 
-  inline abstractElement* getFirstElement() {
-    return firstElement;
-  }
-    
-  inline abstractElement* getLastElement() {
-    return lastElement;
-  }
-    
-  /** Deprecated : To be removed ! */
-  inline int getElementNumberInSection() const {
-    return firstElementNumberInBeamLine;
-  }
-    
-  /** Deprecated : To be removed ! */
-  inline int getLastElementNumberInSection()  const {
-    return lastElementNumberInBeamLine;
-  }
-
   inline abstractSoftware* getSoftware() const {
-    return software;
+    return software_;
   }
   
- private :
+  inline abstractSoftware* setSoftware(abstractSoftware* soft) {
+    software_ = soft;
+  }
+  
+  /**
+   Get the vector of elements of this sector
+   */
+  inline std::vector< abstractElement* > getElements() {return elements_;};
+  
+  bool insertAfter(abstractElement*,abstractElement*);
 
-  abstractElement*  firstElement;
-  abstractElement*  lastElement;
-  abstractSoftware* software;
+  private :
 
-  int firstElementNumberInBeamLine;
-  int lastElementNumberInBeamLine;  
+  abstractSoftware* software_;
+
+  std::vector< abstractElement* > elements_;
 };
 #endif
Index: /Interface_Web/trunk/pspaWT/sources/controler/include/sector.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/include/sector.h	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/controler/include/sector.h	(revision 455)
@@ -3,5 +3,12 @@
 
 #include <vector>
-#include "sectionToExecute.h"
+#include <string>
+
+#include "nomDeLogiciel.h"
+#include "sectorParameters.h"
+
+class sectionToExecute;
+class abstractElement;
+class dataManager;
 
 class sector
@@ -9,5 +16,5 @@
   public :
   
-  sector(std::string name = "sector default name");
+  sector(dataManager*, std::string name = "sector default name");
   virtual ~sector();
   /**
@@ -47,16 +54,4 @@
    */
   inline std::string getName() { return name_;};
-
-  /**
-   Return the vector of sectors inside this sector
-   */
-  inline std::vector <sector*> getInnerSectors() { return sectors_;};
-
-  /**
-   Add an inner sector
-   */
-  inline void addInnerSector(sector* s) {
-    if (s) sectors_.push_back(s);
-  };
   
   /**
@@ -72,6 +67,24 @@
   };
   
+  /** Add an element after another one. Will put it in the same sectionToExecuteList. If the element after is NULL
+   it will create a new sectionToExecute and put it inside.
+   */
+  void addElementAfter(abstractElement*,abstractElement*);
+  
+  /**
+ set the specific software for the given sectionToExecute number
+ */
+  bool setSoftware(nomDeLogiciel, unsigned int sectionToExecuteNumber);
+
+  void clearSectionToExecute();
+  /** Clear a specific jobList */
+  void clearSectionToExecute(int a);
+
+  inline sectorParameters getSectorParameters() {
+    return sectorParam_;
+  }
+
 private:
-  std::vector <sector*> sectors_;
+
   std::vector <sectionToExecute*> sectionToExecute_;
 
@@ -80,4 +93,6 @@
   sector* duplicatedFrom_;
   unsigned int repetitionNumber_;
+  dataManager* dataManager_;
+  sectorParameters sectorParam_; //xx
 };
 #endif
Index: /Interface_Web/trunk/pspaWT/sources/controler/include/sectorParameters.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/include/sectorParameters.h	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/controler/include/sectorParameters.h	(revision 455)
@@ -10,12 +10,14 @@
 typedef pair<string, vector<string> > statements;
 
+class sector;
+
 class sectorParameters  
 {
   string geometry_;
-  vector<statements> sectors_;
+  vector<statements> sectorsStatements_;
 
  public :
   
-  sectorParameters();
+  sectorParameters(sector*);
   ~sectorParameters() {;}
   
@@ -27,4 +29,5 @@
   void setSectors(const vector<statements>&);
   vector<statements> getSectors() const;
+  sector* sector_;
 };
 #endif
Index: /Interface_Web/trunk/pspaWT/sources/controler/include/softwareGenerator.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/include/softwareGenerator.h	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/controler/include/softwareGenerator.h	(revision 455)
@@ -18,9 +18,9 @@
   
   softwareGenerator();  
-  softwareGenerator(string inputFileName, globalParameters* globals, dataManager* dt);
+  softwareGenerator(string inputFileName, sectionToExecute*);
 
   virtual ~softwareGenerator() {;}
 
-  virtual bool createInputFile(particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin, string workingDir);
+  virtual bool createInputFile(particleBeam* beamBefore, string workingDir);
   virtual bool execute(string workingDir);
   virtual bool buildBeamAfterElements(string workingDir);
Index: /Interface_Web/trunk/pspaWT/sources/controler/include/softwareMadx.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/include/softwareMadx.h	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/controler/include/softwareMadx.h	(revision 455)
@@ -13,8 +13,8 @@
   
   softwareMadx();
-  softwareMadx(string,sectorParameters*,dataManager*);
+  softwareMadx(string,sectionToExecute*);
   virtual ~softwareMadx() {;}
 
-  virtual bool createInputFile(particleBeam*,unsigned int,unsigned int,string);
+  virtual bool createInputFile(particleBeam*, string);
   virtual bool execute(string);
   virtual bool buildBeamAfterElements(string);
Index: /Interface_Web/trunk/pspaWT/sources/controler/include/softwareParmela.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/include/softwareParmela.h	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/controler/include/softwareParmela.h	(revision 455)
@@ -36,10 +36,10 @@
     softwareParmela();
     
-    softwareParmela(string inputFileName, globalParameters* globals, dataManager* beamLine);
+    softwareParmela(string inputFileName, sectionToExecute*);
 
   virtual ~softwareParmela() {;}
 
 
-  virtual bool createInputFile(particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin, string workingDir);
+  virtual bool createInputFile(particleBeam* beamBefore, string workingDir);
 
   virtual bool  execute(string workingDir);
Index: /Interface_Web/trunk/pspaWT/sources/controler/include/softwareTest.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/include/softwareTest.h	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/controler/include/softwareTest.h	(revision 455)
@@ -18,10 +18,10 @@
     softwareTest();
     
-    softwareTest(string inputFileName, globalParameters* globals, dataManager* );
+    softwareTest(string inputFileName, sectionToExecute*);
 
   virtual ~softwareTest() {;}
 
 
-  virtual bool createInputFile( particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin, string workingDir);
+  virtual bool createInputFile( particleBeam* beamBefore, string workingDir);
 
 
Index: /Interface_Web/trunk/pspaWT/sources/controler/include/softwareTransport.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/include/softwareTransport.h	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/controler/include/softwareTransport.h	(revision 455)
@@ -20,8 +20,8 @@
  public : 
     softwareTransport();
-    softwareTransport(string inputFileName, globalParameters* globals, dataManager* beamLine);
+    softwareTransport(string inputFileName, sectionToExecute*);
 
   virtual ~softwareTransport() {;}
-  virtual bool createInputFile( particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir);
+  virtual bool createInputFile( particleBeam* beamBefore, string workingDir);
 
   virtual bool  execute(string workingDir);
Index: /Interface_Web/trunk/pspaWT/sources/controler/include/softwareUnknown.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/include/softwareUnknown.h	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/controler/include/softwareUnknown.h	(revision 455)
@@ -11,5 +11,5 @@
   virtual ~softwareUnknown() {;}
 
-  virtual bool createInputFile(particleBeam*,unsigned int,unsigned int,string);
+  virtual bool createInputFile(particleBeam*,sectionToExecute* sectionToExe, string);
   virtual bool execute(string);
   virtual bool buildBeamAfterElements(string);
Index: /Interface_Web/trunk/pspaWT/sources/controler/include/softwareUsersprogram.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/include/softwareUsersprogram.h	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/controler/include/softwareUsersprogram.h	(revision 455)
@@ -13,8 +13,8 @@
  public : 
     softwareUsersprogram();
-    softwareUsersprogram(string inputFileName, globalParameters* globals, dataManager* beamLine);
+    softwareUsersprogram(string inputFileName, sectionToExecute*);
 
   virtual ~softwareUsersprogram() {;}
-  virtual bool createInputFile( particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir);
+  virtual bool createInputFile( particleBeam* beamBefore, string workingDir);
 
   virtual bool  execute(string workingDir);
Index: /Interface_Web/trunk/pspaWT/sources/controler/src/abstractSoftware.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/src/abstractSoftware.cc	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/controler/src/abstractSoftware.cc	(revision 455)
@@ -7,42 +7,28 @@
 abstractSoftware::abstractSoftware()
 {
-  globParamPtr_ = NULL;
-  sectParamPtr_ = NULL; //xx
   dataManager_ = NULL;
   nameOfSoftware_ = nomDeLogiciel("unknownSoftware");
 }
 
-abstractSoftware::abstractSoftware(string inputFileName, globalParameters* globals, dataManager* dt) 
+abstractSoftware::abstractSoftware(string inputFileName, sectionToExecute* sect)
 {
   inputFileName_ = inputFileName;
-  globParamPtr_ = globals;
-  sectParamPtr_ = NULL; //xx
-  dataManager_ = dt;
-  numeroDeb_ = 0;
-  numeroFin_ = 0;
+  sectionToExecute_ = sect;
+  numeroDeb_deprecated_ = 0;
+  numeroFin_deprecated_ = 0;
   nameOfSoftware_ = nomDeLogiciel("unknownSoftware");
 }
 
-abstractSoftware::abstractSoftware(string inputFileName,sectorParameters* lattice,dataManager* dt) 
+bool abstractSoftware::initComputationLimits_deprecated(unsigned int numeroDeb,unsigned int numeroFin_deprecated_)
 {
-  inputFileName_ = inputFileName;
-  globParamPtr_ = NULL;
-  sectParamPtr_ = lattice;
-  dataManager_ = dt;
-  numeroDeb_ = 0;
-  numeroFin_ = 0;
-  nameOfSoftware_ = nomDeLogiciel("unknownSoftware");
+/*  numeroDeb_deprecated_ = numeroDeb;
+  numeroFin_deprecated__ = numeroFin_deprecated_;
+  return ComputationLimitsOk_deprecated();
+*/
 }
 
-bool abstractSoftware::initComputationLimits(unsigned int numeroDeb,unsigned int numeroFin) 
+bool abstractSoftware::ComputationLimitsOk_deprecated() const 
 {
-  numeroDeb_ = numeroDeb;
-  numeroFin_ = numeroFin;
-  return ComputationLimitsOk();
-}
-
-bool abstractSoftware::ComputationLimitsOk() const 
-{
-  if (numeroDeb_ < 1 || numeroFin_ < 1 || numeroDeb_ > dataManager_->getBeamLineSize() || numeroFin_ > dataManager_->getBeamLineSize() ) {
+/*  if (numeroDeb_deprecated_ < 1 || numeroFin_deprecated__ < 1 || numeroDeb_deprecated_ > dataManager_->getBeamLineSize() || numeroFin_deprecated__ > dataManager_->getBeamLineSize() ) {
     dataManager_->consoleMessage(" abstractSoftware::initComputationLimit : num of element out of limits in software " + getName() );
     return false;
@@ -50,4 +36,6 @@
     return true;
   }
+*/
+  return true;
 }
 
Index: /Interface_Web/trunk/pspaWT/sources/controler/src/dataManager.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/src/dataManager.cc	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/controler/src/dataManager.cc	(revision 455)
@@ -8,13 +8,5 @@
 #include "GWt_pspaApplication.h"
 #include "GWt_console.h"
-
-#include "softwareParmela.h"
-#include "softwareTransport.h"
-#include "softwareGenerator.h"
-#include "softwareGenerator.h"
-#include "softwareUsersprogram.h"
-#include "softwareTest.h"
-#include "softwareMadx.h" //xx
-#include "softwareUnknown.h" //xx
+#include "GWt_ligneFaisceau.h" // FIXME to be removed !
 
 #include <boost/filesystem.hpp>
@@ -46,14 +38,17 @@
 }
 
-string dataManager::getLabelFromElementNumero(int numero)
-{
-  abstractElement* ptr = pspa_->getBeamLine()->getAbstractElement(numero-1);
+string dataManager::getLabelFromElementNumero_deprecated(int numero)
+{
+/*
+ abstractElement* ptr = pspa_->getBeamLine()->getAbstractElement(numero-1);
   if ( ptr == NULL ) return "";
   return ptr->getLabel();
-}
-
-int dataManager::getNumeroFromElementLabel(string label)
-{
-  int index = -1;    
+*/
+return "";
+}
+
+int dataManager::getNumeroFromElementLabel_deprecated(string label)
+{
+/*  int index = -1;
   for (int k = 0; k < getBeamLineSize() ; k++) {
     if (pspa_->getBeamLine()->getAbstractElement(k) != NULL) {
@@ -66,68 +61,8 @@
   }
   return index;
-}
-
-abstractElement* dataManager::getElementPointerFromNumero(int k)
-{
-  return pspa_->getBeamLine()->getAbstractElement(k-1);
-}
-
-sectionToExecute* dataManager::addSectionToExecute(abstractElement* debut,int debutIndex, abstractElement* fin, int finIndex, nomDeLogiciel logiciel)
-{
-#if BAVARD > 0
-  cout << "***********************************" << endl;
-  cout << " dataManager::addSectionToExecute " << endl << endl;
-#endif
-
-  abstractSoftware* prog;
-  string inputFileName;
-  if(logiciel == nomDeLogiciel::parmela) {
-    inputFileName = "parmin";
-    prog = new softwareParmela(inputFileName, &globParam_, this);
-  } else if (logiciel  == nomDeLogiciel::transport) {
-    inputFileName = "transport.input";
-    prog =  new softwareTransport(inputFileName, &globParam_, this);
-  } else if (logiciel == nomDeLogiciel::generator) {
-    inputFileName = "generator.in";
-    prog = new softwareGenerator(inputFileName, &globParam_, this);
-  } else if (logiciel  == nomDeLogiciel::madx) {
-    inputFileName = "madx.input";
-    prog = new softwareMadx(inputFileName,&sectorParam_,this);  
-  } else if (logiciel  == nomDeLogiciel::usersprogram) {
-    inputFileName = "dummy";
-    prog = new softwareUsersprogram(inputFileName, &globParam_, this);
-  } else if (logiciel  == nomDeLogiciel::test) {
-    prog = new softwareTest(inputFileName, &globParam_, this);
-  } else {
-    prog = new softwareUnknown(); // xx
-  }
-
-  jobList_.push_back(new sectionToExecute(debut,debutIndex,fin,finIndex,prog));
-  return jobList_.back();
-}
-
-void dataManager::clearSectionToExecute()
-{
-  unsigned k;
-  for(k = 0; k < jobList_.size(); k++)
-    {
-      if ( jobList_[k] != NULL ) clearSectionToExecute(k);
-    }
-  jobList_.clear();
-}
-
-void dataManager::clearSectionToExecute(int a)
-{
-  cout << " dataManager::clearSectionToExecute : effacement de la section d'index = " << a << endl;
-  if (a < 0) return;
-  if (a >= (int)jobList_.size()) return;
-  
-  // lors de la creation de la section on a fait un 'new' d'un 
-  // softwareXXXX : on fait ici le 'delete'
-  
-  const abstractSoftware* soft = jobList_.at(a)->getSoftware();
-  if ( soft != NULL ) delete soft;
-  jobList_.erase (jobList_.begin()+a);
-}
+*/
+  return 0;
+}
+
 
 void dataManager::initializeExecution()
@@ -148,7 +83,7 @@
   indexElementToIndexDiag_.clear();
   currentBeam_ = NULL;
-  firstComputedElemNumero_ = getBeamLineSize();
-  lastComputedElemNumero_ = 1;
-  clearSectionToExecute();
+  for (unsigned int a=0; a< jobList_.size(); a++) {
+      jobList_[a]->clearSectionToExecute();
+  }
 }
 
@@ -171,32 +106,22 @@
 
   bool success = true;
-  abstractSoftware* softw = NULL;
   string workingDir = pspa_->getWorkingDir();
   
-  // on verifie la consecution des sections
-  int lastel = 0;
+
+  // Main loop !
   for(unsigned k = 0; k < jobList_.size(); k++) {
-    if ( jobList_[k]->getElementNumberInSection() != lastel +1 ) {
-      consoleMessage("dataManager::executeAll ERROR : sections should be consecutive ");
-      return false;
-    } else {
-      lastel = jobList_[k]->getLastElementNumberInSection();
-    }
-  }
-  
-  unsigned debut;
-  unsigned fin;
-  for(unsigned k = 0; k < jobList_.size(); k++) {
-
-#if BAVARD > 0  
+    sector* sector = jobList_[k];
+    
+    // for the moment, we put everything in one line without loops
+    for (unsigned int l=0; l <sector->getSectionsToExecute().size(); l++) {
+      sectionToExecute* section = sector->getSectionsToExecute()[l];
+      abstractSoftware* softw = section->getSoftware();
+      
+#if BAVARD > 0
     cout << " dataManager::executeAll je m'apprete a executer : " << (jobList_[k]->getSoftware()->getName()) << endl;
 #endif
-    
-    debut = jobList_[k]->getElementNumberInSection();
-    fin = jobList_[k]->getLastElementNumberInSection();
-    softw = jobList_[k]->getSoftware();
-    
-    //cout << "k= " << k << ", de " << jobList_[k]->getFirstElement()->getLabel() << " Ã  " << jobList_[k]->getLastElement()->getLabel() << " avec " << softw->getName() << endl;
-
+      
+      //cout << "k= " << k << ", de " << jobList_[k]->getFirstElement()->getLabel() << " Ã  " << jobList_[k]->getLastElement()->getLabel() << " avec " << softw->getName() << endl;
+      
     if (softw == NULL) {
       success = false;
@@ -205,5 +130,5 @@
     }
     
-    success = softw->createInputFile(currentBeam_,debut,fin,workingDir);
+    success = softw->createInputFile(currentBeam_,workingDir);
     if ( success ) {
       success = softw->execute(workingDir);
@@ -222,16 +147,13 @@
     if ( !success ) break;
     
-    if ( debut < firstComputedElemNumero_ ) firstComputedElemNumero_ = debut;
-    if ( fin > lastComputedElemNumero_ ) lastComputedElemNumero_ = fin;
-
-#if BAVARD > 0    
-    cout << "dataManager::executeAll #diagnosticBeam= " << diagnosticBeam_.size() << endl;
-    cout << "dataManager::executeAll #getBeamLineSize()= " << getBeamLineSize() << endl;
-    for (unsigned j = debut; j <= fin; j++) {
-      abstractElement* elPtr= getElementPointerFromNumero(j);
-      cout << "[" << j << "] " << elPtr->getNomdElement().getExpandedName() << endl;
-    }
+#if BAVARD > 0
+      cout << "dataManager::executeAll #diagnosticBeam= " << diagnosticBeam_.size() << endl;
+      cout << "dataManager::executeAll #getBeamLineSize()= " << getBeamLineSize() << endl;
+      std::vector< abstractElement* > elements = section->getElements();
+      for (unsigned j = 0; j < elements.size(); j++) {
+        cout << "[" << j << "] " << elements[j]->getNomdElement().getExpandedName() << endl;
+      }
 #endif
-
+    } //l
   } //k
   // if ( currentBeam_ ) {
@@ -241,5 +163,5 @@
   //   currentBeam_->readFromAMLFile(aml_file);
   // }
-  cout << " dataManager::executeAll() : premier element = " << firstComputedElemNumero_ << " dernier = " << lastComputedElemNumero_ << endl;
+  cout << " dataManager::executeAll() " << endl;
 
   return success;
@@ -264,12 +186,22 @@
   
   outfile << globParam_.FileOutputFlow();
-  outfile << sectorParam_.FileOutputFlow();
-
+
+  // FIXME Francois: Comment sauver la configuration des section ?
+  for (unsigned int a=0; a< jobList_.size(); a++) {
+    outfile << jobList_[a]->getSectorParameters().FileOutputFlow();
+  }
+  // END
+  
   abstractElement* elPtr;
-  for(int k = 0; k < getBeamLineSize() ; k++)
-    {
-      elPtr = pspa_->getBeamLine()->getAbstractElement(k);
-      outfile << elPtr->FileOutputFlow();
-    }
+  for (unsigned k = 0; k < jobList_.size(); k++) {
+    sector* sector = jobList_[k];
+    for (unsigned l = 0; l < sector->getSectionsToExecute().size(); l++) {
+      sectionToExecute* section = sector->getSectionsToExecute()[l];
+      for (unsigned m = 0; m < section->getElements().size(); m++) {
+        elPtr = section->getElements()[m];
+        outfile << elPtr->FileOutputFlow();
+      }
+    }
+  }
   outfile.close();
 }
@@ -300,9 +232,14 @@
 
   abstractElement* elPtr;
-  for(int k = 0; k < getBeamLineSize() ; k++) {
-    elPtr = pspa_->getBeamLine()->getAbstractElement(k);
-    elPtr->InputRep(sect);
-  }
-  
+  for (unsigned k = 0; k < jobList_.size(); k++) {
+    sector* sector = jobList_[k];
+    for (unsigned l = 0; l < sector->getSectionsToExecute().size(); l++) {
+      sectionToExecute* section = sector->getSectionsToExecute()[l];
+      for (unsigned m = 0; m < section->getElements().size(); m++) {
+        elPtr = section->getElements()[m];
+        elPtr->InputRep(sect);
+      }
+    }
+  }
   cout << "!Create the AML file ---------------------------" << endl;
   AMLReader reader;
@@ -335,6 +272,8 @@
       globParam_.FileInput(infile);
     } else if (elementLabel == string("sectors") ) {
-      sectorParam_.raz();
-      sectorParam_.FileInput(infile);
+      // FIXME Francois !!!!!!!
+//      sectorParam_.raz();
+//      sectorParam_.FileInput(infile);
+      // END
     } else {
       elementType = nomdElements::getTypeFromLabel(elementLabel);
@@ -371,7 +310,23 @@
 }
 
-particleBeam* dataManager::getDiagnosticBeam(string elementLabel)
-{
-  return getDiagnosticBeam( getNumeroFromElementLabel(elementLabel) -1);
+particleBeam* dataManager::getDiagnosticBeam_deprecated(string elementLabel)
+{
+  // FIXME : Devra etre changÃ© par une rÃ©cupÃ©ration par "abstractElement" et non pas par label
+  unsigned int number = 0;
+  abstractElement* elPtr;
+  for (unsigned k = 0; k < jobList_.size(); k++) {
+    sector* sector = jobList_[k];
+    for (unsigned l = 0; l < sector->getSectionsToExecute().size(); l++) {
+      sectionToExecute* section = sector->getSectionsToExecute()[l];
+      for (unsigned m = 0; m < section->getElements().size(); m++) {
+        elPtr = section->getElements()[m];
+        if (elPtr->getLabel() == elementLabel) {
+          return getDiagnosticBeam(number);
+        }
+        number ++;
+      }
+    }
+  }
+  return NULL;
 }
 
@@ -390,21 +345,27 @@
   if ( type == "x" ) {
     unsigned i = 0;
-    cout << " dataManager::donneesRmsEnveloppe BeamLineSize = " << getBeamLineSize() << endl;
+    cout << " dataManager::donneesRmsEnveloppe " << endl;
     //    for (unsigned k = 0; k < getBeamLineSize(); k++) {
-    for (unsigned k = firstComputedElemNumero_ -1 ; k < lastComputedElemNumero_ ; k++) {
-      abstractElement* elPtr = pspa_->getBeamLine()->getAbstractElement(k);
-      //     if(elPtr->getNomdElement().getElementType() == snapshot) continue;
-      //      if(elPtr->getNomdElement().getElementType() == fit) continue;
-      particleBeam* beamToDraw = getDiagnosticBeam(i);
-      if ( !beamToDraw->momentRepresentationOk() ) {
-	beamToDraw->buildMomentRepresentation();
-      }
-
-      longueur += elPtr->getLenghtOfElement();
-      valeur = beamToDraw->getXmaxRms();
-      cout << " dataManager::donneesRmsEnveloppe index = " << k <<  " longueur = " << longueur << " enveloppe : " << valeur << endl;
-      xcor.push_back(0.01*longueur);  // on passe en metres
-      ycor.push_back(valeur);
-      i++;
+    for (unsigned k = 0; k < jobList_.size(); k++) {
+      sector* sector = jobList_[k];
+      for (unsigned l = 0; l < sector->getSectionsToExecute().size(); l++) {
+        sectionToExecute* section = sector->getSectionsToExecute()[l];
+        for (unsigned m = 0; m < section->getElements().size(); m++) {
+          abstractElement* elPtr = section->getElements()[m];
+          //     if(elPtr->getNomdElement().getElementType() == snapshot) continue;
+          //      if(elPtr->getNomdElement().getElementType() == fit) continue;
+          particleBeam* beamToDraw = getDiagnosticBeam(i);
+          if ( !beamToDraw->momentRepresentationOk() ) {
+            beamToDraw->buildMomentRepresentation();
+          }
+          
+          longueur += elPtr->getLenghtOfElement();
+          valeur = beamToDraw->getXmaxRms();
+          cout << " dataManager::donneesRmsEnveloppe index = " << k <<  " longueur = " << longueur << " enveloppe : " << valeur << endl;
+          xcor.push_back(0.01*longueur);  // on passe en metres
+          ycor.push_back(valeur);
+          i++;
+        }
+      }
     }
     legendy.clear();
@@ -413,32 +374,16 @@
 }
 
-int dataManager::getBeamLineSize() {
-    return pspa_->getBeamLine()->getBeamLineSize();
-}
-
-
-abstractSoftware* dataManager::createSoftwareConnexion(nomDeLogiciel logi)
-{
-  string inputFileName;
-  if(logi == nomDeLogiciel::parmela) {
-    cout << " dataManager::createSoftwareConnexion : logiciel identifie : parmela " << endl;
-    inputFileName = "parmin";
-    return new softwareParmela(inputFileName, &globParam_, this);
-  } else if (logi == nomDeLogiciel::transport) {
-    cout << " dataManager::createSoftwareConnexion : logiciel identifie : transport " << endl;
-    inputFileName = "transport.input";
-    return new softwareTransport(inputFileName, &globParam_, this);
-  } else if (logi == nomDeLogiciel::generator) {
-    cout << " dataManager::createSoftwareConnexion : logiciel identifie : generator " << endl;
-    inputFileName = "generator.in";
-    return new softwareGenerator(inputFileName, &globParam_, this);
-  } else if (logi == nomDeLogiciel::test) {
-    cout << " dataManager::createSoftwareConnexion : logiciel identifie : test " << endl;
-        return new softwareTest(inputFileName, &globParam_, this);
-  } else {
-    cout << " dataManager::createSoftwareConnexion : logiciel identifie : null " << endl;
-    return NULL;
-  }
-}
+int dataManager::getBeamLineSize_deprecated() {
+// FIXME : Cette methode ne doit pas exister, mis a part pour savoir quelle est la taille de la beamLine
+  unsigned int i = 0;
+  for (unsigned k = 0; k < jobList_.size(); k++) {
+    sector* sector = jobList_[k];
+    for (unsigned l = 0; l < sector->getSectionsToExecute().size(); l++) {
+      i += sector->getSectionsToExecute()[l]->getElements().size();
+    }
+  }
+  return i;
+}
+
 
 sector* dataManager::addNewSector() {
@@ -448,6 +393,6 @@
   str >> result;
   
-  sector* sect = new sector(std::string("sector ") + result);
-  sectors_.push_back(sect);
+  sector* sect = new sector(this, std::string("sector ") + result);
+  jobList_.push_back(sect);
   return sect;
 }
Index: /Interface_Web/trunk/pspaWT/sources/controler/src/particleBeam.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/src/particleBeam.cc	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/controler/src/particleBeam.cc	(revision 455)
@@ -30,5 +30,5 @@
 }
 
-int particleBeam::getNbParticles() const {
+unsigned long particleBeam::getNbParticles() const {
   return relativePartic_.size();
 }
Index: /Interface_Web/trunk/pspaWT/sources/controler/src/sectionToExecute.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/src/sectionToExecute.cc	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/controler/src/sectionToExecute.cc	(revision 455)
@@ -2,19 +2,59 @@
 
 
-sectionToExecute::sectionToExecute(abstractElement* f, abstractElement* l , abstractSoftware* s) {
-    firstElement = f;
-    lastElement =l;
-    software = s;
+sectionToExecute::sectionToExecute(abstractElement* a) {
+  elements_.push_back(a);
 }
 
 
-sectionToExecute::sectionToExecute(abstractElement* f, int fI, abstractElement* l , int lI, abstractSoftware* s) {
-    firstElement = f;
-    lastElement =l;
-
-    firstElementNumberInBeamLine = fI;
-    lastElementNumberInBeamLine =lI;
-
-    software = s;
+sectionToExecute::sectionToExecute(abstractElement* f, abstractSoftware* s) {
+  elements_.push_back(f);
+    software_ = s;
 }
 
+
+bool sectionToExecute::insertAfter(abstractElement* previousElement,abstractElement* currentElement) {
+
+  std::vector<abstractElement*>::iterator it;
+  for (it = elements_.begin(); it < elements_.end(); it++) {
+    if (*it == previousElement ) {
+      elements_.insert (it+1,currentElement);
+      return true;
+    }
+  }
+  return false;
+}
+
+/*
+bool sectionToExecute::setSoftware(nomDeLogiciel logiciel) {
+  
+  if (sectionToExecuteNumber >= sectionToExecute_.size()) {
+    return false;
+  }
+  
+  abstractSoftware* prog;
+  string inputFileName;
+  if(logiciel == nomDeLogiciel::parmela) {
+    inputFileName = "parmin";
+    prog = new softwareParmela(inputFileName, this);
+  } else if (logiciel  == nomDeLogiciel::transport) {
+    inputFileName = "transport.input";
+    prog =  new softwareTransport(inputFileName, this);
+  } else if (logiciel == nomDeLogiciel::generator) {
+    inputFileName = "generator.in";
+    prog = new softwareGenerator(inputFileName, this);
+  } else if (logiciel  == nomDeLogiciel::madx) {
+    inputFileName = "madx.input";
+    prog = new softwareMadx(inputFileName,this);
+  } else if (logiciel  == nomDeLogiciel::usersprogram) {
+    inputFileName = "dummy";
+    prog = new softwareUsersprogram(inputFileName, this);
+  } else if (logiciel  == nomDeLogiciel::test) {
+    prog = new softwareTest(inputFileName, this);
+  } else {
+    prog = new softwareUnknown(); // xx
+  }
+  
+  sectionToExecute_[sectionToExecuteNumber]->setSoftware(prog);
+  return true;
+}
+*/
Index: /Interface_Web/trunk/pspaWT/sources/controler/src/sector.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/src/sector.cc	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/controler/src/sector.cc	(revision 455)
@@ -8,10 +8,23 @@
 
 #include "sector.h"
+#include "softwareParmela.h"
+#include "softwareTransport.h"
+#include "softwareGenerator.h"
+#include "softwareGenerator.h"
+#include "softwareUsersprogram.h"
+#include "softwareTest.h"
+#include "softwareMadx.h" //xx
+#include "softwareUnknown.h" //xx
 
-sector::sector(std::string name):
+#include "sectionToExecute.h"
+#include "dataManager.h"
+
+sector::sector(dataManager* data, std::string name):
 reflected_(false),
 duplicatedFrom_(NULL),
 repetitionNumber_(1),
-name_(name)
+name_(name),
+dataManager_(data),
+sectorParam_(this)
 {
   
@@ -20,2 +33,44 @@
 sector::~sector()  {
 }
+
+void sector::addElementAfter(abstractElement* currentElement ,abstractElement* previousElement){
+  if (previousElement == NULL) {
+    if (sectionToExecute_.size() == 0) {
+      sectionToExecute_.push_back(new sectionToExecute(currentElement));
+    } else {
+      sectionToExecute_.insert ( sectionToExecute_.begin() , new sectionToExecute(currentElement) );
+    }
+  } else {
+ 
+    for (unsigned int i=0; i<sectionToExecute_.size(); i++) {
+      sectionToExecute* section = sectionToExecute_[i];
+      if (section->insertAfter(previousElement,currentElement)) {
+        return;
+      }
+    }
+  }
+}
+
+void sector::clearSectionToExecute()
+{
+  unsigned k;
+  for(k = 0; k < sectionToExecute_.size(); k++)
+  {
+    if ( sectionToExecute_[k] != NULL ) clearSectionToExecute(k);
+  }
+  sectionToExecute_.clear();
+}
+
+void sector::clearSectionToExecute(int a)
+{
+  cout << " dataManager::clearSectionToExecute : effacement de la section d'index = " << a << endl;
+  if (a < 0) return;
+  if (a >= (int)sectionToExecute_.size()) return;
+  
+  // lors de la creation de la section on a fait un 'new' d'un
+  // softwareXXXX : on fait ici le 'delete'
+  
+  const abstractSoftware* soft = sectionToExecute_.at(a)->getSoftware();
+  if ( soft != NULL ) delete soft;
+  sectionToExecute_.erase (sectionToExecute_.begin()+a);
+}
Index: /Interface_Web/trunk/pspaWT/sources/controler/src/sectorParameters.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/src/sectorParameters.cc	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/controler/src/sectorParameters.cc	(revision 455)
@@ -5,12 +5,13 @@
 #define BAVARD 1
 
-sectorParameters::sectorParameters()
+sectorParameters::sectorParameters(sector* sect):
+sector_(sect)
 {
   geometry_= string("CIRCULAR");
-  sectors_.push_back(statements("vide",vector<string>()));
-  sectors_.back().second.push_back("xxx");
-  sectors_.back().second.push_back("xxx");
-  sectors_.back().second.push_back("Unchecked");
-  sectors_.back().second.push_back("1");
+  sectorsStatements_.push_back(statements("vide",vector<string>()));
+  sectorsStatements_.back().second.push_back("xxx");
+  sectorsStatements_.back().second.push_back("xxx");
+  sectorsStatements_.back().second.push_back("Unchecked");
+  sectorsStatements_.back().second.push_back("1");
 }
 
@@ -45,5 +46,5 @@
 void sectorParameters::raz()
 {
-  if(!sectors_.empty()) sectors_.clear();
+  if(!sectorsStatements_.empty()) sectorsStatements_.clear();
 }
 
@@ -52,7 +53,7 @@
   ostringstream sortie;
   sortie << " sectors " << endl;
-  sortie << sectors_.size() << endl;
-  for(int i = 0; i < sectors_.size(); i++) {
-    sortie << sectors_.at(i).first << " " << sectors_.at(i).second.at(0) << " " << sectors_.at(i).second.at(1) << " " << sectors_.at(i).second.at(2) << " " << sectors_.at(i).second.at(3) << endl;
+  sortie << sectorsStatements_.size() << endl;
+  for(int i = 0; i < sectorsStatements_.size(); i++) {
+    sortie << sectorsStatements_.at(i).first << " " << sectorsStatements_.at(i).second.at(0) << " " << sectorsStatements_.at(i).second.at(1) << " " << sectorsStatements_.at(i).second.at(2) << " " << sectorsStatements_.at(i).second.at(3) << endl;
   }
   return sortie.str();  
@@ -66,8 +67,8 @@
   for(int i = 0; i < n; i++) {
     ifs >> txt;
-    sectors_.push_back(statements(txt,vector<string>()));
+    sectorsStatements_.push_back(statements(txt,vector<string>()));
     for(int j = 0; j < 4; j++) {
       ifs >> txt;
-      sectors_.back().second.push_back(txt);
+      sectorsStatements_.back().second.push_back(txt);
     }
   } 
@@ -104,5 +105,5 @@
 
 vector<statements> sectorParameters::getSectors() const {
-  return sectors_;
+  return sectorsStatements_;
 }
 
@@ -114,16 +115,16 @@
 #endif
 
-  if(!sectors_.empty()) sectors_.clear();
+  if(!sectorsStatements_.empty()) sectorsStatements_.clear();
 
   for(int i = 0; i < v.size(); i++) {
-    sectors_.push_back(statements(v.at(i).first,vector<string>()));
+    sectorsStatements_.push_back(statements(v.at(i).first,vector<string>()));
     for(int j = 0; j < 4; j++) 
-      sectors_.back().second.push_back(v.at(i).second.at(j));
+      sectorsStatements_.back().second.push_back(v.at(i).second.at(j));
   }
 
 #if BAVARD > 0
-  cout << "sectors_.size()= " << sectors_.size() << endl;
-  for(int i = 0; i < sectors_.size(); i++) {
-    cout << "name= " << sectors_.at(i).first << ", de " << sectors_.at(i).second.at(0) << ", Ã  " << sectors_.at(i).second.at(1) << ", reflection = " << sectors_.at(i).second.at(2) << ", repeat= " << sectors_.at(i).second.at(3) << endl << endl;
+  cout << "sectorsStatements_.size()= " << sectorsStatements_.size() << endl;
+  for(int i = 0; i < sectorsStatements_.size(); i++) {
+    cout << "name= " << sectorsStatements_.at(i).first << ", de " << sectorsStatements_.at(i).second.at(0) << ", Ã  " << sectorsStatements_.at(i).second.at(1) << ", reflection = " << sectorsStatements_.at(i).second.at(2) << ", repeat= " << sectorsStatements_.at(i).second.at(3) << endl << endl;
   }
 #endif
Index: /Interface_Web/trunk/pspaWT/sources/controler/src/softwareGenerator.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/src/softwareGenerator.cc	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/controler/src/softwareGenerator.cc	(revision 455)
@@ -12,5 +12,5 @@
 }
 
-softwareGenerator::softwareGenerator(string inputFileName, globalParameters* globals, dataManager* dt) : abstractSoftware(inputFileName, globals, dt)
+softwareGenerator::softwareGenerator(string inputFileName, sectionToExecute* sect) : abstractSoftware(inputFileName, sect)
 {
   cout << " softwareUsersprogram::softwareGenerator ENREGISTREMENT " << endl;
@@ -19,14 +19,9 @@
 }
 
-bool softwareGenerator::createInputFile(particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin, string workingDir)
+bool softwareGenerator::createInputFile(particleBeam* beamBefore, string workingDir)
 {
-  if ( !initComputationLimits(numeroDeb,numeroFin) ) return false;
-
-  if ( numeroDeb_ != numeroFin_ ) return false;
-
-  abstractElement* elPtr;
-  elPtr = dataManager_->getElementPointerFromNumero(numeroDeb_);
-
-  if ( elPtr->getNomdElement().getElementType() != nomdElements::RFgun ) {
+  abstractElement* firstElement = getSectionToExecute()->getElements().front();
+  
+  if ( firstElement->getNomdElement().getElementType() != nomdElements::RFgun ) {
     dataManager_->consoleMessage(" softwareGenerator::createInputFile : the element must be rfgun " );
     cerr << " softwareGenerator::createInputFile : the element must be rfgun" << endl;
@@ -47,7 +42,7 @@
   outfile << " Add=FALSE, N_add=0" << endl;
   outfile << " Species='electrons'" << endl;
-  //  outfile << elPtr->generatorOutputFlow() << endl;
-
-  outfile << elementsData(elPtr->parametersToSoftware()) << endl;
+  //  outfile << firstElement->generatorOutputFlow() << endl;
+
+  outfile << elementsData(firstElement->parametersToSoftware()) << endl;
 
   outfile << "/" << endl;
@@ -62,5 +57,5 @@
   
   ostringstream sortie;
-  sortie << " EXECUTION DE GENERATOR DE l'ELEMENT " << numeroDeb_ << " A L'ELEMENT " << numeroFin_ << endl;
+  sortie << " EXECUTION DE GENERATOR DE l'ELEMENT " << numeroDeb_deprecated_ << " A L'ELEMENT " << numeroFin_deprecated_ << endl;
 
   string generatorJob = workingDir + "generator";
@@ -97,7 +92,7 @@
 
   bool result = true;
-  if ( !ComputationLimitsOk() ) return false;
-
-  if ( numeroDeb_ != numeroFin_ ) {
+  if ( !ComputationLimitsOk_deprecated() ) return false;
+
+  if ( numeroDeb_deprecated_ != numeroFin_deprecated_ ) {
     dataManager_->consoleMessage(" softwareGenerator::buildBeamAfterElements : only one element (rfgun) must be calculated " );
     return false;
Index: /Interface_Web/trunk/pspaWT/sources/controler/src/softwareMadx.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/src/softwareMadx.cc	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/controler/src/softwareMadx.cc	(revision 455)
@@ -8,5 +8,5 @@
 }
 
-softwareMadx::softwareMadx(string inputFileName,sectorParameters* lattice,dataManager* dt) : abstractSoftware(inputFileName,lattice,dt)
+softwareMadx::softwareMadx(string inputFileName,sectionToExecute* sect) : abstractSoftware(inputFileName,sect)
 {
   nameOfSoftware_ = nomDeLogiciel("madx");
@@ -16,5 +16,5 @@
 }
 
-bool softwareMadx::createInputFile(particleBeam* beamBefore,unsigned int numeroDeb,unsigned int numeroFin,string workingDir)
+bool softwareMadx::createInputFile(particleBeam* beamBefore, string workingDir)
 {
   cout << "***********************************" << endl;
@@ -22,5 +22,4 @@
 
   dataManager_->consoleMessage(" softwareMadx::createInputFile");
-  if (!initComputationLimits(numeroDeb,numeroFin)) return false;
 
   string name = workingDir + inputFileName_;
@@ -33,5 +32,5 @@
   }
 
-  cout << " softwareMadx::createInputFile(...) lecture des elts de " << numeroDeb_ << " Ã  " << numeroFin_ << endl;
+  cout << " softwareMadx::createInputFile(...) lecture des elts " << endl;
   
   // element label //////////////////////////
@@ -40,7 +39,8 @@
 
   abstractElement* elPtr;
-  for(unsigned k = numeroDeb_; k <= numeroFin_; k++)
+  std::vector <abstractElement*> elements = getSectionToExecute()->getElements();
+  for(unsigned k = 0; k < elements.size(); k++)
     {
-      elPtr = dataManager_->getElementPointerFromNumero(k);
+      elPtr = elements[k];
       //cout << " debug:: element [" << k << "] " << elPtr->getNomdElement().getExpandedName() << endl;
       vector<statements> v= elPtr->parametersToSoftware();
@@ -52,4 +52,8 @@
   outfile << endl; // saut de ligne
 
+  //_______________________________________________________
+  // FIXME Francois !!!!!
+  //_______________________________________________________
+ /*
   vector<statements> u = sectParamPtr_->getSectors();
   for(unsigned int i = 0; i < u.size(); i++) {
@@ -59,6 +63,7 @@
     unsigned bi = dataManager_->getNumeroFromElementLabel(u.at(i).second.at(1));
 
-    for(unsigned k = numeroDeb_; k <= numeroFin_; k++) {
-      elPtr = dataManager_->getElementPointerFromNumero(k);
+    std::vector <abstractElement*> elements = getSectionToExecute()->getElements();
+    for(unsigned k = 0; k < elements.size(); k++) {
+      elPtr = elements[k];
       
       if(k >= ai && k <= bi) { 
@@ -85,6 +90,6 @@
   ostringstream os;
   os << "all: " << "line=(";
-  for(unsigned k = numeroDeb_; k <= numeroFin_; k++) {
-    elPtr = dataManager_->getElementPointerFromNumero(k);
+  for(unsigned k = 0; k < elements.size(); k++) {
+    elPtr = elements[k];
     bool isMember = false;
 
@@ -112,8 +117,8 @@
     }// i
     
-    if(isMember && k == numeroFin_) os << ");";
-   
+    if(isMember && k == (elements.size()-1)) os << ");";
+    
     if(!isMember) {
-      if(k == numeroFin_) os << elPtr->getLabel() << ");";
+      if(k == (elements.size()-1)) os << elPtr->getLabel() << ");";
       else os << elPtr->getLabel() << ",";
     }
@@ -131,4 +136,9 @@
   outfile << "twiss,save,centre,file = "+workingDir+"twiss.out;" << endl; //p51
   outfile << "stop;" << endl;
+
+  */
+  //_______________________________________________________
+  // FIXME Francois !!!!!
+  //_______________________________________________________
 
   outfile.close();
@@ -174,5 +184,5 @@
 
   ostringstream sortie;
-  sortie << " run madx from " << numeroDeb_ << " to " << numeroFin_ << endl;
+  sortie << " run madx " << endl;
 
   string mjob = workingDir + "madx64";
Index: /Interface_Web/trunk/pspaWT/sources/controler/src/softwareParmela.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/src/softwareParmela.cc	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/controler/src/softwareParmela.cc	(revision 455)
@@ -12,5 +12,5 @@
 }
 
-softwareParmela::softwareParmela(string inputFileName, globalParameters* globals, dataManager* dt) : abstractSoftware(inputFileName, globals, dt)
+softwareParmela::softwareParmela(string inputFileName,sectionToExecute* sect) : abstractSoftware(inputFileName, sect)
 {
   nameOfSoftware_ = nomDeLogiciel("parmela");
@@ -26,7 +26,7 @@
 void softwareParmela::setRelativeParmelaElementIndices() {
   relativeParmelaElementIndices_.clear();
-  relativeParmelaElementIndices_.resize(numeroFin_ - numeroDeb_ + 1, -1);
+  relativeParmelaElementIndices_.resize(numeroFin_deprecated_ - numeroDeb_deprecated_ + 1, -1);
   cout << " setRelativeParmelaElementIndices() taille a priori : " << relativeParmelaElementIndices_.size() << endl;
-  abstractElement* elPtr = dataManager_->getElementPointerFromNumero(numeroDeb_);
+  abstractElement* elPtr = getSectionToExecute()->getElements().front();
 
   bool there_is_rfgun = ( elPtr->getNomdElement().getElementType() == nomdElements::RFgun );
@@ -34,16 +34,16 @@
   // les elements de parmela sont indexes de 1 Ã  max, s'il n'y a pas de rfgun
   if ( !there_is_rfgun ) {
-    offsetNumElem = numeroDeb_ -1;
+    offsetNumElem = numeroDeb_deprecated_ -1;
     // les elements de parmela sont indexes de 0 Ã  max, s'il y a un rfgun
   } else {
-    offsetNumElem = numeroDeb_;
+    offsetNumElem = numeroDeb_deprecated_;
   }
 
   // index du premier element de parmela
-  int id= numeroDeb_ - offsetNumElem;
+  int id= numeroDeb_deprecated_ - offsetNumElem;
   unsigned k;
   unsigned curseur = 0;
-  for ( k=numeroDeb_; k <= numeroFin_ ; k++ ) {
-    abstractElement* elem = dataManager_->getElementPointerFromNumero(k);
+  for ( k=0; k < getSectionToExecute()->getElements().size() ; k++ ) {
+    abstractElement* elem = getSectionToExecute()->getElements()[k];
     cout << " liste PARMELA no absolu " << k << " relatif provisoire " << relativeParmelaElementIndices_.at(curseur) << endl;
     // if ( elem->is_accepted_by_software(nameOfSoftware_) == TBoolOk ) {
@@ -58,8 +58,8 @@
 
 
-bool softwareParmela::createInputFile(particleBeam* beamBefore,unsigned int numeroDeb,unsigned int numeroFin,string workingDir)
+bool softwareParmela::createInputFile(particleBeam* beamBefore, string workingDir)
 {
   unsigned int k;
-  if ( !initComputationLimits(numeroDeb,numeroFin) ) return false;
+
   setRelativeParmelaElementIndices();
   string name = workingDir + inputFileName_;
@@ -72,8 +72,7 @@
   }
   
-  abstractElement* elPtr;
+  abstractElement* elPtr = getSectionToExecute()->getElements().front();
   double initalKineticEnergy = 0.0;
-  elPtr = dataManager_->getElementPointerFromNumero(numeroDeb_);
-  bool there_is_rfgun = ( elPtr->getNomdElement().getElementType() == nomdElements::RFgun );
+  bool there_is_rfgun = (elPtr->getNomdElement().getElementType() == nomdElements::RFgun );
   
   if ( !there_is_rfgun ) {
@@ -84,34 +83,28 @@
     //    offsetNumElem_ = numeroDeb_ -1;
   } else {
-    elPtr->setPhaseStep( globParamPtr_->getIntegrationStep() );
+    elPtr->setPhaseStep( dataManager_->getGlobalParameters()->getIntegrationStep() );
     initalKineticEnergy = elPtr->getInitialKineticEnergy();
     // les elements de parmela sont indexes de 0 Ã  max, s'il y a un rfgun
-    //    offsetNumElem_ = numeroDeb_;
   }
   
   outfile << "TITLE" << endl;
   outfile << " titre provisoire " << endl;
-  outfile << "RUN /n0=1 /ip=999 /freq=" << globParamPtr_->getFrequency() << "  /z0=0.0 /W0=" << initalKineticEnergy << "  /itype=1" << endl;
+  outfile << "RUN /n0=1 /ip=999 /freq=" << dataManager_->getGlobalParameters()->getFrequency() << "  /z0=0.0 /W0=" << initalKineticEnergy << "  /itype=1" << endl;
   outfile << "OUTPUT 0" << endl;
-  unsigned int premier = numeroDeb_ ;
   if ( there_is_rfgun ) {
-    //    outfile << dataManager_->getElementPointerFromNumero(numeroDeb_)->parmelaOutputFlow();
-    outfile << elementsData(dataManager_->getElementPointerFromNumero(numeroDeb_)->parametersToSoftware());
-    premier++;
+    //    outfile << dataManager_->getElementPointerFromNumero(numeroDeb_deprecated_)->parmelaOutputFlow();
+    outfile << elementsData(elPtr->parametersToSoftware());
   } else {
     outfile << "INPUT 0 /NP=" << beamBefore->getNbParticles() << endl;
   }
   
-  for ( k = premier; k <= numeroFin_; k++)
+ // retrouver le sector !!
+  for ( k =1; k <= getSectionToExecute()->getElements().size(); k++)
     {
-      elPtr = dataManager_->getElementPointerFromNumero(k);
-      if (elPtr) {
-	//	outfile << elPtr->parmelaOutputFlow();
-	outfile << elementsData(elPtr->parametersToSoftware());
-      }
+      outfile << elementsData(getSectionToExecute()->getElements()[k]->parametersToSoftware());
     }
     
   outfile << "ZOUT" << endl;
-  outfile << "START /wt=0.0 /dwt=" << globParamPtr_->getIntegrationStep() << "  /nsteps=" << globParamPtr_->getNbSteps() << "  nsc=" << globParamPtr_->getScPeriod() << "  /nout=10" << endl;
+  outfile << "START /wt=0.0 /dwt=" << dataManager_->getGlobalParameters()->getIntegrationStep() << "  /nsteps=" << dataManager_->getGlobalParameters()->getNbSteps() << "  nsc=" << dataManager_->getGlobalParameters()->getScPeriod() << "  /nout=10" << endl;
   outfile << "END" << endl;
   outfile.close();
@@ -125,5 +118,5 @@
   
   ostringstream sortie;
-  sortie << " EXECUTION DE PARMELA DE l'ELEMENT " << numeroDeb_ << " A L'ELEMENT " << numeroFin_ << endl;
+  sortie << " EXECUTION DE PARMELA DE l'ELEMENT " << numeroDeb_deprecated_ << " A L'ELEMENT " << numeroFin_deprecated_ << endl;
     
   string parmelaJob = workingDir + "parmela";
@@ -158,9 +151,8 @@
   bool result = true;
 
-  if ( !ComputationLimitsOk() ) return false;
+  if ( !ComputationLimitsOk_deprecated() ) return false;
   unsigned curseur;
-  for(unsigned k = numeroDeb_; k <= numeroFin_; k++)
-    {
-      abstractElement* elem = dataManager_->getElementPointerFromNumero(k);
+  for ( unsigned int k=0; k < getSectionToExecute()->getElements().size() ; k++ ) {
+    abstractElement* elem = getSectionToExecute()->getElements()[k];
       if ( elem == NULL ) {
 	dataManager_->consoleMessage(" softwareParmela::buildBeamAfterElements : null pointer on element " );
@@ -168,5 +160,5 @@
       }
 
-      curseur = k - numeroDeb_;
+      curseur = k - numeroDeb_deprecated_;
 
       if ( relativeParmelaElementIndices_.at(curseur) < 0 ) {
@@ -192,5 +184,5 @@
 	  bareParticle refPart;
 	  vector<bareParticle> particles;
-	  double freq= globParamPtr_->getFrequency();
+	  double freq= dataManager_->getGlobalParameters()->getFrequency();
 	  unsigned numeroParmel;
 	  numeroParmel = (unsigned)relativeParmelaElementIndices_.at(curseur);
Index: /Interface_Web/trunk/pspaWT/sources/controler/src/softwareTest.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/src/softwareTest.cc	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/controler/src/softwareTest.cc	(revision 455)
@@ -14,10 +14,10 @@
 
 
-softwareTest::softwareTest(string inputFileName, globalParameters* globals, dataManager* dt) : abstractSoftware( inputFileName, globals, dt)
+softwareTest::softwareTest(string inputFileName,sectionToExecute* sect) : abstractSoftware(inputFileName, sect)
 {
   nameOfSoftware_ = nomDeLogiciel("test");
 }
 
-bool softwareTest::createInputFile( particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin, string workingDir)
+bool softwareTest::createInputFile( particleBeam* beamBefore, string workingDir)
 {
     dataManager_->consoleMessage(" softwareTest::createInputFile  " );
@@ -39,5 +39,5 @@
   bool result = true;
   unsigned k;
-  for ( k= numeroDeb_; k <= numeroFin_; k++)
+  for ( k= numeroDeb_deprecated_; k <= numeroFin_deprecated_; k++)
     {
       particleBeam* newDiag = dataManager_->updateCurrentDiagnostic(true);
Index: /Interface_Web/trunk/pspaWT/sources/controler/src/softwareTransport.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/src/softwareTransport.cc	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/controler/src/softwareTransport.cc	(revision 455)
@@ -11,5 +11,5 @@
 }
 
-softwareTransport::softwareTransport(string inputFileName,globalParameters* globals, dataManager* dt) : abstractSoftware(inputFileName, globals, dt)
+softwareTransport::softwareTransport(string inputFileName,sectionToExecute* sect) : abstractSoftware(inputFileName, sect)
 {
   nameOfSoftware_ = nomDeLogiciel("transport");
@@ -22,13 +22,9 @@
 }
 
-bool softwareTransport::createInputFile(particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin, string workingDir)
+bool softwareTransport::createInputFile(particleBeam* beamBefore, string workingDir)
 { 
 
 
-
-  if ( !initComputationLimits(numeroDeb,numeroFin) ) return false;
-
-  abstractElement* premierEl = NULL;
-  premierEl = dataManager_->getElementPointerFromNumero(numeroDeb_);
+  abstractElement* premierEl = getSectionToExecute()->getElements().front();
 
   // ceinture et bretelles
@@ -88,7 +84,7 @@
 
   abstractElement* elPtr;
-  for (unsigned k = numeroDeb_; k <= numeroFin_; k++)
+  for (unsigned k = 0; k < getSectionToExecute()->getElements().size(); k++)
     {
-      elPtr = dataManager_->getElementPointerFromNumero(k);
+      elPtr = getSectionToExecute()->getElements()[k];
       cout << "debug:: element [" << k << "] " << elPtr->getNomdElement().getExpandedName() << endl;
       //      outfile << elPtr->transportOutputFlow();
@@ -109,5 +105,5 @@
 
   ostringstream sortie;
-  sortie << " EXECUTION DE TRANSPORT DE " << numeroDeb_ << " a " << numeroFin_ << endl;
+  sortie << " EXECUTION DE TRANSPORT DE " << numeroDeb_deprecated_ << " a " << numeroFin_deprecated_ << endl;
   
   string transportJob = workingDir + "transport";
@@ -145,9 +141,9 @@
 
   bool result = true;
-  if ( !ComputationLimitsOk() ) return false;
-
-  for (unsigned k = numeroDeb_; k <= numeroFin_; k++)
+  if ( !ComputationLimitsOk_deprecated() ) return false;
+
+  for (unsigned k = 0; k < getSectionToExecute()->getElements().size(); k++)
     {
-      abstractElement* ptr = dataManager_->getElementPointerFromNumero(k);
+      abstractElement* ptr = getSectionToExecute()->getElements()[k];
       if ( ptr == NULL ) {
 	dataManager_->consoleMessage(" softwareTransport::buildBeamAfterElements : null pointer on element " );
Index: /Interface_Web/trunk/pspaWT/sources/controler/src/softwareUnknown.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/src/softwareUnknown.cc	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/controler/src/softwareUnknown.cc	(revision 455)
@@ -17,5 +17,5 @@
 }
 
-bool softwareUnknown::createInputFile(particleBeam* beamBefore,unsigned int numeroDeb,unsigned int numeroFin,string workingDir)
+bool softwareUnknown::createInputFile(particleBeam* beamBefore,sectionToExecute* sectionToExe, string workingDir)
 {
   return true;
Index: /Interface_Web/trunk/pspaWT/sources/controler/src/softwareUsersprogram.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/src/softwareUsersprogram.cc	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/controler/src/softwareUsersprogram.cc	(revision 455)
@@ -10,5 +10,5 @@
 }
 
-softwareUsersprogram::softwareUsersprogram(string inputFileName,globalParameters* globals, dataManager* dt) : abstractSoftware(inputFileName, globals, dt)
+softwareUsersprogram::softwareUsersprogram(string inputFileName, sectionToExecute* sect) : abstractSoftware(inputFileName, sect)
 {
   cout << " softwareUsersprogram::softwareUsersprogram ENREGISTREMENT " << endl;
@@ -17,16 +17,9 @@
 }
 
-bool softwareUsersprogram::createInputFile(particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin, string workingDir)
+bool softwareUsersprogram::createInputFile(particleBeam* beamBefore, string workingDir)
 { 
 
+  abstractElement* element = getSectionToExecute()->getElements().front();
 
-  if ( !initComputationLimits(numeroDeb,numeroFin) ) return false;
-  if ( numeroDeb_ != numeroFin_ ) {
-    cout << " ERROR softwareUsersprogram::createInputFile : plusieurs elements  " << endl;
-    return false;
-  }
-
-  abstractElement* element = NULL;
-  element = dataManager_->getElementPointerFromNumero(numeroDeb_);
   // Dans le cas oÃ¹ l'element n'est pas snapshot
   if ( element->getNomdElement().getElementType() != nomdElements::snapshot ) {
@@ -63,5 +56,5 @@
 
   ostringstream sortie;
-  sortie << " EXECUTION DE " << nomProgram_ << " element " << numeroDeb_  << endl;
+  sortie << " EXECUTION DE " << nomProgram_ << endl;
   
   string usersprogramJob = workingDir + nomProgram_;
@@ -103,9 +96,9 @@
 
 
-  if ( !ComputationLimitsOk() ) return false;
-
+  if ( !ComputationLimitsOk_deprecated() ) return false;
+  
   //  for (unsigned k = numeroDeb_; k <= numeroFin_; k++)
-    
-      abstractElement* ptr = dataManager_->getElementPointerFromNumero(numeroDeb_);
+  
+  abstractElement* ptr = getSectionToExecute()->getElements().front();
       if ( ptr == NULL ) {
 	dataManager_->consoleMessage("ERROR  softwareUsersprogram::buildBeamAfterElements : null pointer on element " );
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_accelerator.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_accelerator.h	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_accelerator.h	(revision 455)
@@ -6,7 +6,13 @@
 #include <Wt/WContainerWidget>
 #include <Wt/WScrollArea>
-#include "GWt_pspaApplication.h"
+#include <Wt/WComboBox>
+#include <Wt/WDialog>
+#include <Wt/WPdfImage>
+#include <Wt/Chart/WCartesianChart>
+#include <Wt/WLength>
+
 #include "dataManager.h"
 
+#include "GWt_dialog.h"
 
 using namespace Wt;
@@ -18,16 +24,43 @@
   
 public:
-  GWt_accelerator(WContainerWidget* parent,PspaApplication* pspa);
+  GWt_accelerator(WContainerWidget*, dataManager*);
   virtual ~GWt_accelerator();
   inline WContainerWidget* getAcceleratorDetailledView() {return acceleratorDetailledView_;};
   inline WLayout* getAcceleratorGlobalViewLayout() {return acceleratorGlobalViewLayout_;};
-  inline PspaApplication* getControler() { return pspa_;};
-  
+  inline dataManager* getDataManager() { return dataManager_;};
+  void faireDessin();
+  WContainerWidget* createDrawingWidget();
+
   private :
   WContainerWidget* acceleratorDetailledView_;
   void addSector();
   void run();
+  void closeGraphicDialog();
+  void dialogOnGraphics();
+  void dessiner();
+  void faireDessinPhaseSpace(WContainerWidget* toto, particleBeam* beam, string elementLabel, string namex, string namey, int typeFaisceau);
+  void faireDessinEnveloppe(WContainerWidget* toto, string type);
+  void dessinerEnveloppe();
+  void dessinerPhaseSpace();
+  void dessinerHistogramme();
+  void chartPlot2vec(WContainerWidget* toto,vector<double>& xcor,vector<double>& ycor,Wt::Chart::SeriesType seriesType,Wt::Chart::FillRangeType fillRange,Wt::Chart::AxisValue value,bool isGridLinesEnables,string title,string legendx,string legendy,int width,int height,bool makeIcon = false);
+  
+
+
   WLayout* acceleratorGlobalViewLayout_;
-  PspaApplication* pspa_;
+  dataManager* dataManager_;
+  WComboBox* choixElementDessin_;
+  WComboBox* choixTypeDessinFaisceau_;
+  WComboBox* choixAbsPhase_;
+  WComboBox* choixOrdPhase_;
+  WComboBox* choixEnveloppeDessin_;
+  WComboBox* choixHistoDessin_;
+  WComboBox* choixVariableHisto_;
+  GWt_dialog* graphicsDialog_;
+  WButtonGroup *group_;
+  vector<GWt_dialog*> eDialog_;
+  WContainerWidget* toto_;
+  string nameOfCase_;
+
 };
 
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_dropZoneLigneFaisceau.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_dropZoneLigneFaisceau.h	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_dropZoneLigneFaisceau.h	(revision 455)
@@ -2,5 +2,5 @@
 #define GWT_DROPZONELIGNEFAISEAU_SEEN
 
-#include "GWt_pspaApplication.h"
+#include "dataManager.h"
 #include "GWt_ligneFaisceau.h"
 
@@ -14,10 +14,10 @@
     public :
     
-    GWt_dropZoneLigneFaisceau(PspaApplication* pspa_,GWt_ligneFaisceau* parent);
+    GWt_dropZoneLigneFaisceau(dataManager* ,GWt_ligneFaisceau* );
     ~GWt_dropZoneLigneFaisceau();
     inline GWt_ligneFaisceau* getParent() {return parent_;};
 
 private:
-    void initialise( PspaApplication* pspa);
+    void initialise( dataManager*);
     void mouseOver(const WMouseEvent &e );
     void mouseOut(const WMouseEvent &e );
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementBeam.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementBeam.h	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementBeam.h	(revision 455)
@@ -18,5 +18,5 @@
     
   GWt_elementBeam() {;}
-  GWt_elementBeam(GWt_elementLigneFaisceau* );
+  GWt_elementBeam(GWt_elementLigneFaisceau*, abstractElement* );
   ~GWt_elementBeam() {;}
   
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementBend.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementBend.h	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementBend.h	(revision 455)
@@ -17,5 +17,5 @@
     
   GWt_elementBend() {;}
-  GWt_elementBend(GWt_elementLigneFaisceau* );
+  GWt_elementBend(GWt_elementLigneFaisceau*, abstractElement* );
   ~GWt_elementBend() {;}
   
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementCell.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementCell.h	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementCell.h	(revision 455)
@@ -26,5 +26,5 @@
     
   GWt_elementCell() {;}
-  GWt_elementCell(GWt_elementLigneFaisceau* );
+  GWt_elementCell(GWt_elementLigneFaisceau*, abstractElement* );
   ~GWt_elementCell() {;}
  
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementDrift.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementDrift.h	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementDrift.h	(revision 455)
@@ -20,5 +20,5 @@
     
   GWt_elementDrift() {;}
-  GWt_elementDrift(GWt_elementLigneFaisceau* );
+  GWt_elementDrift(GWt_elementLigneFaisceau*, abstractElement* );
   ~GWt_elementDrift() {;}
   
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementFit.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementFit.h	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementFit.h	(revision 455)
@@ -14,5 +14,5 @@
     
   GWt_elementFit() {;}
-  GWt_elementFit(GWt_elementLigneFaisceau* );
+  GWt_elementFit(GWt_elementLigneFaisceau*, abstractElement* );
   ~GWt_elementFit() {;}
   
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementLigneFaisceau.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementLigneFaisceau.h	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementLigneFaisceau.h	(revision 455)
@@ -4,5 +4,5 @@
 #include "GWt_abstractElement.h"
 #include "GWt_dropZoneLigneFaisceau.h"
-#include "GWt_pspaApplication.h"
+#include "dataManager.h"
 
 #include <Wt/WContainerWidget>
@@ -31,6 +31,5 @@
      */
     
-    GWt_elementLigneFaisceau(PspaApplication*,GWt_ligneFaisceau*);
-    GWt_elementLigneFaisceau(nomdElements::typedElement,PspaApplication*,GWt_ligneFaisceau*);
+    GWt_elementLigneFaisceau(dataManager*,GWt_ligneFaisceau*, abstractElement* abstractElem);
     
     ~GWt_elementLigneFaisceau();
@@ -46,6 +45,6 @@
     
     void setElementLabel(std::string label);
-    void update();
-    
+
+  
     inline GWt_dropZoneLigneFaisceau* getDropZoneLeft() {
         return dropZoneLeft_;
@@ -57,5 +56,5 @@
 
     inline GWt_abstractElement* getGWt_AbstractElement() {
-        return GWt_abstractElement_;
+        return GWt_abstractElement_deprecated_;
     }
     inline void setSoftwareName(std::string name) {
@@ -67,7 +66,11 @@
     void removeDone(GWt_abstractElement*);
     std::string getElementNumberInBeamLine(nomdElements el);
-    void initialize_ligneFaisceau(nomdElements::typedElement eType,GWt_ligneFaisceau* ligne);
+    void initialize_ligneFaisceau(GWt_ligneFaisceau* ligne, abstractElement* abstractElem);
     void mouseWentOut();
     void mouseWentOver();
+  /**
+   Update the software of this element according to the sectionToExecute software. Will change the color of this object
+   */
+  void updateSoftware();
     void setBGColor(const WColor);
     GWt_dialog* messageDropZone_;
@@ -77,6 +80,6 @@
     GWt_dropZoneLigneFaisceau* dropZoneRight_;
     WText* elementLabel_;
-    PspaApplication* pspa_;
-    GWt_abstractElement* GWt_abstractElement_;
+    dataManager* dataManager_;
+    GWt_abstractElement* GWt_abstractElement_deprecated_;
     WContainerWidget* elementContainer_;
     WText* actionParameters_;
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementMpole.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementMpole.h	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementMpole.h	(revision 455)
@@ -21,5 +21,5 @@
   
   GWt_elementMpole()  {;}
-  GWt_elementMpole(GWt_elementLigneFaisceau*);
+  GWt_elementMpole(GWt_elementLigneFaisceau*, abstractElement*);
   ~GWt_elementMpole() {;}
   
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementRfgun.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementRfgun.h	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementRfgun.h	(revision 455)
@@ -25,5 +25,5 @@
     
   GWt_elementRfgun() {;}
-  GWt_elementRfgun(GWt_elementLigneFaisceau* );
+  GWt_elementRfgun(GWt_elementLigneFaisceau* , abstractElement*);
   ~GWt_elementRfgun() {;}
   
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementSnapshot.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementSnapshot.h	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementSnapshot.h	(revision 455)
@@ -21,5 +21,5 @@
     
   GWt_elementSnapshot() {;}
-  GWt_elementSnapshot(GWt_elementLigneFaisceau*,int);
+  GWt_elementSnapshot(GWt_elementLigneFaisceau*, abstractElement*, int);
   ~GWt_elementSnapshot() {;}
   
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementSoleno.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementSoleno.h	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementSoleno.h	(revision 455)
@@ -26,5 +26,5 @@
     
   GWt_elementSoleno() {;}
-  GWt_elementSoleno(GWt_elementLigneFaisceau* );
+  GWt_elementSoleno(GWt_elementLigneFaisceau* , abstractElement*);
   ~GWt_elementSoleno() {;}
   
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_ligneFaisceau.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_ligneFaisceau.h	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_ligneFaisceau.h	(revision 455)
@@ -15,4 +15,5 @@
 
 class GWt_dropZoneLigneFaisceau;
+class GWt_sector;
 
 class compteur {
@@ -26,11 +27,10 @@
 class GWt_ligneFaisceau : public WContainerWidget
 {
-    PspaApplication* pspa_;
-    
+  dataManager* dataManager_;
+  
     public :
-    
-    GWt_ligneFaisceau() {;}
-    GWt_ligneFaisceau(PspaApplication*);
-    
+  
+  GWt_ligneFaisceau(dataManager*,GWt_sector*);
+  
     /**
      
@@ -75,15 +75,21 @@
     
     void update();
-    
-    /** update the status of the given index element
-     */
-    void update(int);
-
+  
+  /** update the status of the given index element
+   */
+  void update_deprecated(int);
+  
     void initializeSoftwares();
-
-    private :
-    void manageLineFaisceauLayout();
-    GWt_dropZoneLigneFaisceau* allDropZone_;
-    WHBoxLayout* ligneFaisceauLayout_;
+  
+  /** Return the sector of this beamLine */
+  inline GWt_sector* getUISector() { return UI_sector_;};
+  
+  private :
+  void manageLineFaisceauLayout_deprecated();
+  void buildBeamLineWidget();
+  
+  GWt_dropZoneLigneFaisceau* allDropZone_;
+  WHBoxLayout* ligneFaisceauLayout_;
+  GWt_sector* UI_sector_;
 };
 
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_pspaApplication.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_pspaApplication.h	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_pspaApplication.h	(revision 455)
@@ -14,8 +14,4 @@
 #include <Wt/WComboBox>
 #include <Wt/WPushButton>
-#include <Wt/WDialog>
-#include <Wt/WPdfImage>
-#include <Wt/Chart/WCartesianChart>
-#include <Wt/WLength>
 #include <Wt/WButtonGroup>
 
@@ -23,5 +19,4 @@
 #include "GWt_console.h"
 #include "GWt_softwarePanel.h"
-#include "GWt_ligneFaisceau.h"
 #include "GWt_globalParameters.h"
 #include "GWt_sectorParameters.h"
@@ -30,4 +25,5 @@
 
 class GWt_abstractElementFactory;
+class GWt_ligneFaisceau;
 
 using namespace Wt;
@@ -39,5 +35,4 @@
   
   dataManager* dtmanage_;
-  string nameOfCase_;
   string workingDir_;
   WDialog* dialogSave_;
@@ -45,26 +40,14 @@
   WLineEdit* saveNameEdit_;
   WLineEdit* openNameEdit_;
-  GWt_ligneFaisceau* beamLine_;
+  GWt_ligneFaisceau* beamLine_deprecated_;
     
   GWt_globalParameters* globalParam_;
   GWt_sectorParameters* sectorParam_;
-  
-  GWt_dialog* graphicsDialog_;
-  WButtonGroup *group_;
-  vector<GWt_dialog*> eDialog_;
-  
+  string nameOfCase_;
+
   WText* probleme_;
-  WComboBox* choixElementDessin_;
-  WComboBox* choixTypeDessinFaisceau_;
-  WComboBox* choixAbsPhase_;
-  WComboBox* choixOrdPhase_;
-  WComboBox* choixEnveloppeDessin_;
-  WComboBox* choixHistoDessin_;
-  WComboBox* choixVariableHisto_;
 
-  WContainerWidget* toto_;
   WString applicationDefaultTitle_;
     
-  GWt_softwarePanel* executeWidget_;
   WFileUpload* uploadFileSelectorWidget_;
   GWt_console* console_;
@@ -73,9 +56,9 @@
   WText* createTitle(const WString&);
   WWidget* createPalette(WContainerWidget* parent);
-  WWidget* createBeamLine();
+  WWidget* createBeamLine_deprecated();
   WWidget* createExecuteWidget();
-  WContainerWidget* createDrawingWidget();
 
   WWidget* createDashBoard(WContainerWidget*);
+  
   void messageBox1();
   void messageBox2();
@@ -83,5 +66,4 @@
   // extensions (.001, .002,...) pour les fichiers "snapshot" 
   int extensionFile_;
-  void closeGraphicDialog();
   
   void createDragImage(const char *url,const char *smallurl,const char *mimeType,WContainerWidget *p,WString());
@@ -93,18 +75,7 @@
   void fileTooLarge();
   
-  void dialogOnGraphics();
-  void faireDessinPhaseSpace(WContainerWidget* toto, particleBeam* beam, string elementLabel, string namex, string namey, int typeFaisceau);
-  void faireDessinEnveloppe(WContainerWidget* toto, string type);
-  void chartPlot2vec(WContainerWidget* toto,vector<double>& xcor,vector<double>& ycor,Wt::Chart::SeriesType seriesType,Wt::Chart::FillRangeType fillRange,Wt::Chart::AxisValue value,bool isGridLinesEnables,string title,string legendx,string legendy,int width,int height,bool makeIcon = false);
-
   bool removePathFromConfigName(string& config);
   bool removeExtensionFromConfigName(string& config);
-  void removeBeamLine();
     
-  void dessiner();
-  void dessinerEnveloppe();
-  void dessinerPhaseSpace();
-  void dessinerHistogramme();
-
  public :
   
@@ -122,10 +93,6 @@
   }
 
-  inline GWt_softwarePanel* getExecuteWidget() {
-    return executeWidget_;
-  }
-
   inline GWt_ligneFaisceau* getBeamLine() {
-    return beamLine_;
+    return beamLine_deprecated_;
   }
 
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_sectionToExecute.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_sectionToExecute.h	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_sectionToExecute.h	(revision 455)
@@ -7,9 +7,10 @@
 
 class GWt_softwarePanel;
+class GWt_sector;
 
 class GWt_sectionToExecute : public Wt::WContainerWidget
 {
     public :
-    GWt_sectionToExecute(Wt::WComboBox*,Wt::WComboBox*,Wt::WComboBox*,Wt::WContainerWidget* buttonPanel,GWt_softwarePanel* sPanel);
+    GWt_sectionToExecute(Wt::WComboBox*,Wt::WComboBox*,Wt::WComboBox*,Wt::WContainerWidget* buttonPanel,GWt_softwarePanel* sPanel,GWt_sector*);
 
     ~GWt_sectionToExecute() {;}
@@ -65,4 +66,5 @@
     Wt::WContainerWidget* warningsContainer_;
     Wt::WContainerWidget* errorsContainer_;
+    GWt_sector* UI_sector_;
 };
 
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_sector.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_sector.h	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_sector.h	(revision 455)
@@ -6,6 +6,6 @@
 #include <Wt/WContainerWidget>
 #include "sector.h"
-#include "GWt_pspaApplication.h"
 #include "GWt_accelerator.h"
+#include "GWt_ligneFaisceau.h"
 
 using namespace Wt;
@@ -17,14 +17,27 @@
   
 public:
-  GWt_sector(GWt_accelerator* parent,sector*);
+  GWt_sector(GWt_accelerator*,sector*);
   virtual ~GWt_sector();
-  void createWidgetBeamLine(PspaApplication* pspa,WContainerWidget* parent);
-
+  void createWidgetBeamLine(WContainerWidget* parent);
+  /* Return the controler sector element for this UI sector*/
+  inline sector* getSectorControler() {return sectorControler_;};
+  inline GWt_softwarePanel* getExecuteWidget() {
+    return executeWidget_;
+  }
+  /**
+   Get the accelerator for this sector
+   */
+  inline GWt_accelerator* getAccelerator() {
+    return UI_Accelerator_;
+  }
+  
   private :
-  GWt_ligneFaisceau* beamLine_;
+  GWt_ligneFaisceau* UI_beamLine_;
   void setIcon(WLayout*);
   void displayWidgetBeamLine();
-  GWt_accelerator* parent_;
-  sector* sector_;
+  GWt_accelerator* UI_Accelerator_;
+  sector* sectorControler_;
+  GWt_softwarePanel* executeWidget_;
+
 };
 
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_sectorParameters.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_sectorParameters.h	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_sectorParameters.h	(revision 455)
@@ -19,5 +19,4 @@
 class GWt_sectorParameters : public WContainerWidget
 {
-  dataManager* dt_;
   vector<statements> sectors_;
   
@@ -33,6 +32,6 @@
   WGroupBox *gb_;
   
-  void createSector();
-  WContainerWidget* buttons(int);
+  void createSector_deprecated();
+  WContainerWidget* buttons_deprecated(int);
   void dialogDone(WDialog::DialogCode code);
   void add();
@@ -43,9 +42,8 @@
  public :
   
-  GWt_sectorParameters() {;}
-  GWt_sectorParameters(dataManager*);
+  GWt_sectorParameters() {;};
   virtual ~GWt_sectorParameters() {;}
 
-  void execDialog();
+  void execDialog_deprecated();
   void setText(WText*);
 };
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_softwarePanel.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_softwarePanel.h	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_softwarePanel.h	(revision 455)
@@ -20,4 +20,5 @@
 
 class PspaApplication;
+class GWt_sector;
 
 class GWt_softwarePanel  : public WContainerWidget
@@ -25,5 +26,5 @@
  public :
   
-  GWt_softwarePanel(dataManager*, PspaApplication*,WContainerWidget*);
+  GWt_softwarePanel(dataManager*, GWt_sector*);
   virtual ~GWt_softwarePanel();
 
@@ -45,5 +46,5 @@
   WPushButton *exec_go_;
   WContainerWidget* contenuSections_;
-  PspaApplication* pspa_;
+  GWt_sector* UIsector_;
 
   std::vector <GWt_sectionToExecute*> sections_;
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_accelerator.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_accelerator.cc	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_accelerator.cc	(revision 455)
@@ -8,16 +8,20 @@
 #include <Wt/WHBoxLayout>
 #include <Wt/WComboBox>
+#include <Wt/WRadioButton>
 #include <Wt/WPushButton>
 #include <Wt/WGroupBox>
+#include <Wt/WStandardItemModel>
 
 #include <string>
 
-GWt_accelerator::GWt_accelerator(WContainerWidget* parent, PspaApplication* pspa) :
+GWt_accelerator::GWt_accelerator(WContainerWidget* parent, dataManager* dt) :
 WContainerWidget(parent),
-pspa_(pspa)
+dataManager_(dt)
 {
   setObjectName("accelerator");
   addStyleClass("acceleratorPanel");
-    
+  nameOfCase_ = "pspa"; // default  // FIXME
+  
+
   WContainerWidget* menu = new WContainerWidget(this);
   menu->addStyleClass("acceleratorMenu");
@@ -59,4 +63,11 @@
   runParameters->setMinimumSize(32,32);
   
+  WPushButton* boutongraphicalAnalysis = new WPushButton("",menu);
+  boutongraphicalAnalysis->setStyleClass("histoButton");
+  boutongraphicalAnalysis->setToolTip ("analyse graphique");
+  boutongraphicalAnalysis->setMaximumSize(32,32);
+  boutongraphicalAnalysis->setMinimumSize(32,32);
+
+  
   new WBreak(this);
   
@@ -79,5 +90,10 @@
   addSectorParameters->clicked().connect(this,&GWt_accelerator::addSector);
   runParameters->clicked().connect(this,&GWt_accelerator::run);
-
+  boutongraphicalAnalysis->clicked().connect(this, &GWt_accelerator::dialogOnGraphics);
+
+  graphicsDialog_ = new GWt_dialog("graphical analysis",createDrawingWidget(),false);
+  graphicsDialog_->setMinimumSize(400,400);
+  graphicsDialog_->setClosable(true);
+  graphicsDialog_->hide();
   
 }
@@ -90,5 +106,5 @@
 void GWt_accelerator::addSector()
 {
-  sector* sect = pspa_->getDataManager()->addNewSector();
+  sector* sect = getDataManager()->addNewSector();
   GWt_sector* addedSector = new GWt_sector(this,sect);
 }
@@ -97,2 +113,520 @@
 {
 }
+
+void GWt_accelerator::faireDessin()
+{
+  choixElementDessin_->clear();
+  choixHistoDessin_->clear();
+  
+  for (unsigned k = 0; k < getDataManager()->getSectors().size(); k++) {
+    sector* sector = getDataManager()->getSectors()[k];
+    for (unsigned l = 0; l < sector->getSectionsToExecute().size(); l++) {
+      sectionToExecute* section = sector->getSectionsToExecute()[l];
+      for (unsigned m = 0; m < section->getElements().size(); m++) {
+        
+        abstractElement* elPtr = section->getElements()[m];
+        //    if(elPtr->getNomdElement().getElementType() == snapshot) continue;
+        
+        choixElementDessin_->addItem(elPtr->getLabel());
+        choixHistoDessin_->addItem(elPtr->getLabel());
+      }
+    }
+  }
+}
+
+WContainerWidget* GWt_accelerator::createDrawingWidget()
+{
+  WGridLayout *glayout= new WGridLayout();
+  WContainerWidget* dessin = new WContainerWidget();
+  dessin->setLayout(glayout);
+  
+  group_ = new Wt::WButtonGroup(this);
+  
+  /////////////////////////////////////////////////////////////////////
+  
+  choixEnveloppeDessin_ = new WComboBox();
+  choixEnveloppeDessin_->addItem("x");
+  // choixEnveloppeDessin_->addItem("y");
+  Wt::WRadioButton *button1= new WRadioButton(" enveloppe");
+  group_->addButton(button1,1);
+  glayout->addWidget(button1,0,1);
+  glayout->addWidget(choixEnveloppeDessin_,0,2);
+  /////////////////////////////////////////////////////////////////////
+  
+  choixElementDessin_ = new WComboBox();
+  choixElementDessin_->setMinimumSize(50,10);
+  choixTypeDessinFaisceau_ = new WComboBox();
+  choixTypeDessinFaisceau_->addItem("courant_snyder");
+  choixTypeDessinFaisceau_->addItem("macroparticles");
+  Wt::WRadioButton *button2= new WRadioButton(" phase space after element");
+  
+  choixAbsPhase_ = new WComboBox();
+  choixAbsPhase_->addItem("x");
+  choixAbsPhase_->addItem("y");
+  choixAbsPhase_->addItem("dz");
+  choixAbsPhase_->addItem("xp");
+  choixAbsPhase_->addItem("yp");
+  choixAbsPhase_->addItem("dE/E");
+  choixAbsPhase_->setCurrentIndex(0);
+  
+  choixOrdPhase_ = new WComboBox();
+  choixOrdPhase_->addItem("x");
+  choixOrdPhase_->addItem("y");
+  choixOrdPhase_->addItem("dz");
+  choixOrdPhase_->addItem("xp");
+  choixOrdPhase_->addItem("yp");
+  choixOrdPhase_->addItem("dE/E");
+  choixOrdPhase_->setCurrentIndex(3);
+  
+  group_->addButton(button2,2);
+  glayout->addWidget(button2,1,1);
+  glayout->addWidget(choixElementDessin_,1,2);
+  glayout->addWidget(choixTypeDessinFaisceau_,1,3);
+  //  glayout->addWidget(new WText("abs. :"),2,2);
+  glayout->addWidget(choixAbsPhase_,2,2);
+  //  glayout->addWidget(new WText("ord. :"),2,4);
+  glayout->addWidget(choixOrdPhase_,2,3);
+  /////////////////////////////////////////////////////////////////////
+  
+  choixVariableHisto_= new WComboBox();
+  choixVariableHisto_->addItem("x");
+  choixVariableHisto_->addItem("y");
+  choixVariableHisto_->addItem("z");
+  choixVariableHisto_->addItem("xp");
+  choixVariableHisto_->addItem("yp");
+  choixVariableHisto_->addItem("dE/E");
+  choixVariableHisto_->setCurrentIndex(5);
+  
+  choixHistoDessin_ = new WComboBox();
+  Wt::WRadioButton *button3= new WRadioButton(" histogram after element ");
+  group_->addButton(button3,3);
+  
+  glayout->addWidget(button3,3,1);
+  glayout->addWidget(choixHistoDessin_,3,2);
+  glayout->addWidget(choixVariableHisto_,3,3);
+  /////////////////////////////////////////////////////////////////////
+  
+  WPushButton *close= new WPushButton("close");
+  glayout->addWidget(close,4,1);
+  close->clicked().connect(this,&GWt_accelerator::closeGraphicDialog);
+  
+  WPushButton *draw= new WPushButton("draw");
+  glayout->addWidget(draw,4,2,2,1);
+  draw->clicked().connect(this,&GWt_accelerator::dessiner);
+  /////////////////////////////////////////////////////////////////////
+  
+  toto_ = new WContainerWidget();
+  dessin->addWidget(toto_);
+  return dessin;
+}
+
+
+void GWt_accelerator::dialogOnGraphics()
+{
+  graphicsDialog_->show();
+}
+
+
+void GWt_accelerator::closeGraphicDialog()
+{
+  cout << " close graphicsDialog_" << endl;
+  for(unsigned i = 0; i < eDialog_.size(); i++) eDialog_[i]->done(WDialog::Rejected);
+  eDialog_.clear();
+  graphicsDialog_->done(WDialog::Rejected);
+}
+
+
+
+void GWt_accelerator::dessiner()
+{
+  int k= group_->checkedId();
+  cout << "dessiner k= " << k << endl;
+  
+  switch(k) {
+    case  1:
+      dessinerEnveloppe();
+      break;
+    case 2:
+      dessinerPhaseSpace();
+      break;
+    case 3:
+      dessinerHistogramme();
+      break;
+    default:
+      GWt_dialog graphicalWarning("graphical analysis","select a button",GWt_dialog::Warning,false,true);
+      graphicalWarning.exec();
+      break;
+  }
+}
+
+void GWt_accelerator::dessinerPhaseSpace()
+{
+  
+  int typeFaisceau = choixTypeDessinFaisceau_->currentIndex();
+  //  int index = choixElementDessin_->currentIndex();
+  string nameAbs = choixAbsPhase_->currentText().toUTF8();
+  string nameOrd = choixOrdPhase_->currentText().toUTF8();
+  if ( nameAbs == nameOrd ) {
+    GWt_dialog phaseSpaceError(" graphical analysis", "the beam coordinates must be different !", GWt_dialog::Error, false,true);
+    phaseSpaceError.exec();
+    return;
+  }
+  string elementLabel = choixElementDessin_->currentText().toUTF8();
+  particleBeam* beam = dataManager_->getDiagnosticBeam_deprecated(elementLabel);
+  //  particleBeam* beam = dtmanage_->getDiagnosticBeam(index);
+  
+  if ( beam == NULL ) {
+    GWt_dialog warningBeamState(" graphical analysis", "the beam does not exist at the end of this element !", GWt_dialog::Error, false,true);
+    warningBeamState.exec();
+    return;
+  }
+  
+  toto_->clear();
+  faireDessinPhaseSpace(toto_, beam, elementLabel, nameAbs, nameOrd, typeFaisceau);
+  
+  // if ( typeFaisceau == 0 )
+  //   {
+  //     if ( !beam->momentRepresentationOk() ) beam->buildMomentRepresentation();
+  //     faireDessinTransport(toto_, beam, nameAbs, nameOrd );
+  //   }
+  // else if ( typeFaisceau == 1 )
+  //   {
+  //     if ( beam->particleRepresentationOk() ) faireDessinParmela(toto_, beam, nameAbs, nameOrd );
+  //     else {
+  // 	GWt_dialog warningBeamState(" graphical analysis", "the beam state does not allow providing a drawing with macroparticles !", GWt_dialog::Error, false,true);
+  // 	warningBeamState.exec();
+  //     }
+  //   }
+  // else {
+  //   GWt_dialog warningTypeDrawing(" graphical analysis", "type of  drawing not programmed !", GWt_dialog::Error, false,true);
+  //   warningTypeDrawing.exec();
+  // }
+}
+
+void GWt_accelerator::dessinerEnveloppe()
+{
+  toto_->clear();
+  
+  int typeEnveloppe = choixEnveloppeDessin_->currentIndex();
+  if ( typeEnveloppe == 0 )
+  {
+    faireDessinEnveloppe(toto_, "x");
+  }
+  else {
+    GWt_dialog warningTypeEnveloppe(" graphical analysis", "type of enveloppe drawing not programmed !", GWt_dialog::Error, false,true);
+    warningTypeEnveloppe.exec();
+  }
+}
+
+void GWt_accelerator::faireDessinEnveloppe(WContainerWidget* toto, string type)
+{
+  
+  std::time_t result = std::time(NULL);
+  
+  GWt_dialog* envDialog = new GWt_dialog(WString("enveloppe&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(")+std::asctime(std::localtime(&result))+")",toto,false);
+  eDialog_.push_back(envDialog);
+  envDialog->setMinimumSize(400,400);
+  envDialog->setClosable(true);
+  envDialog->show();
+  
+  //  unsigned nbel = dtmanage_->getBeamLineSize();
+  vector<double> xcor;
+  vector<double> ycor;
+  string titre;
+  string legendx;
+  string legendy;
+  dataManager_->donneesRmsEnveloppe(type,xcor,ycor,titre,legendx,legendy);
+  
+  Wt::Chart::SeriesType seriesType = Wt::Chart::LineSeries;
+  Wt::Chart::FillRangeType fillRange = Wt::Chart::NoFill;
+  Wt::Chart::AxisValue location = Wt::Chart::ZeroValue;
+  bool isGridLinesEnabled = false;
+  chartPlot2vec(envDialog->contents(),xcor,ycor,seriesType,fillRange,location,isGridLinesEnabled,titre,legendx,legendy,500,300);
+}
+
+void GWt_accelerator::faireDessinPhaseSpace(WContainerWidget* toto, particleBeam* beam, string elementLabel, string namex, string namey, int typeFaisceau)
+{
+  
+  vector<double> xcor;
+  vector<double> ycor;
+  vector<string> legende;
+  string titre;
+  Wt::Chart::SeriesType seriesType;
+  
+  if ( typeFaisceau == 0 ) {
+    seriesType = Wt::Chart::LineSeries;
+    titre = "phase space rms";
+    beam->donneesDessinEllipse(xcor,ycor,legende,namex,namey);
+  } else if (  typeFaisceau == 1 ) {
+    seriesType = Wt::Chart::PointSeries;
+    titre = " phase space ";
+    beam->particlesPhaseSpaceData(xcor,ycor,legende,namex,namey);
+    // for ( int kk=0; kk < xcor.size(); kk++)
+    //   {
+    // 	cout << " dess. phas. x= " << xcor.at(kk) << " x'= " << ycor.at(kk) << endl;
+    //   }
+  } else {
+    GWt_dialog warningBeamState(" graphical analysis", "the beam state does not allow providing a drawing with macroparticles !", GWt_dialog::Error, false,true);
+    warningBeamState.exec();
+    return;
+  }
+  
+  std::time_t result = std::time(NULL);
+  GWt_dialog* phaseSpaceDialog = new GWt_dialog(WString("phase space&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(")+std::asctime(std::localtime(&result))+")",toto,false);
+  eDialog_.push_back(phaseSpaceDialog);
+  phaseSpaceDialog->setMinimumSize(400,400);
+  phaseSpaceDialog->setClosable(true);
+  new WText(" case : " + nameOfCase_, phaseSpaceDialog->contents());
+  new WBreak(phaseSpaceDialog->contents());
+  new WText(" after element :  " + elementLabel, phaseSpaceDialog->contents());
+  
+  for (int k=0 ; k < (int)legende.size(); k++) {
+    new WBreak(phaseSpaceDialog->contents());
+    new WText(legende.at(k), phaseSpaceDialog->contents());
+  }
+  
+  Wt::Chart::FillRangeType fillRange = Wt::Chart::NoFill;
+  Wt::Chart::AxisValue location = Wt::Chart::ZeroValue;
+  bool isGridLinesEnabled = false;
+  chartPlot2vec(phaseSpaceDialog->contents(),xcor,ycor,seriesType,fillRange,location,isGridLinesEnabled,titre,namex,namey,500,300);
+  
+  phaseSpaceDialog->show();
+}
+
+
+void GWt_accelerator::dessinerHistogramme()
+{
+  toto_->clear();
+  
+  // std::time_t result = std::time(NULL);
+  // GWt_dialog* histoDialog = new GWt_dialog(WString("histogramme&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(")+std::asctime(std::localtime(&result))+")",toto_,false);
+  // eDialog_.push_back(histoDialog);
+  // histoDialog->setMinimumSize(400,400);
+  // histoDialog->setClosable(true);
+  
+  string elementLabel = choixHistoDessin_->currentText().toUTF8();
+  particleBeam* beam = dataManager_->getDiagnosticBeam_deprecated(elementLabel);
+  if (beam == NULL) {
+    GWt_dialog warningBeamState("histogram","the beam does not exist at the end of this element !", GWt_dialog::Error, false,true);
+    warningBeamState.exec();
+    return;
+  }
+  
+  if (!beam->particleRepresentationOk()) {
+    GWt_dialog warningBeamState("histogram", "the beam state does not allow providing a drawing with macroparticles !", GWt_dialog::Error, false,true);
+    warningBeamState.exec();
+    return;
+  }
+  
+  unsigned iabs= choixVariableHisto_->currentIndex();
+  vector<double> xcor;
+  vector<int> hist;
+  //  double out[3]= {0.0};
+  vector<string> legende;
+  beam->histogramme(iabs,xcor,hist,legende);
+  
+  cout<<"xcor.size()= "<<xcor.size()<<", hist.size()= "<<hist.size()<<endl;
+  //////////////////////////////////////////////////////////////////////////////////
+  
+  int n = hist.size();
+  vector<double> x;
+  x.resize(2*n+2);
+  vector<double> y;
+  y.resize(2*n+2);
+  
+  int j= 0;
+  x.at(j)= xcor[0];
+  y.at(j)= 0.0;
+  j++;
+  x.at(j)= xcor[0];
+  y.at(j)= hist[0];
+  j++;
+  
+  for (int i = 1; i < n; ++i) {
+    x.at(j)= xcor[i];
+    y.at(j)= hist[i-1];
+    j++;
+    x.at(j)= xcor[i];
+    y.at(j)= hist[i];
+    j++;
+  }
+  
+  x.at(j)= xcor[n];
+  y.at(j)= hist[n-1];
+  j++;
+  x.at(j)= xcor[n];
+  y.at(j)= 0.0;
+  //////////////////////////////////////////////////////////////////////////////////
+  std::time_t result = std::time(NULL);
+  GWt_dialog* histoDialog = new GWt_dialog(WString("histogramme&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(")+std::asctime(std::localtime(&result))+")",toto_,false);
+  eDialog_.push_back(histoDialog);
+  histoDialog->setMinimumSize(400,400);
+  histoDialog->setClosable(true);
+  
+  histoDialog->show();
+  
+  WContainerWidget *w= histoDialog->contents();
+  
+  // // legendes
+  // string unites[2];
+  // if(iabs == 0 || iabs == 1 || iabs == 2) {
+  //   unites[0]= unites[1]= " mm";
+  // }
+  // if(iabs == 3 || iabs == 4) {
+  //   unites[0]= unites[1]= " mrad";
+  // }
+  // if(iabs == 5) {
+  //   unites[0]= " MeV"; unites[1]= " KeV";
+  // }
+  
+  new WText(" case : " + nameOfCase_, w);
+  new WBreak(w);
+  new WText(" after element :  " + elementLabel, w);
+  
+  for (int k=0 ; k < (int)legende.size(); k++) {
+    new WBreak(w);
+    new WText(legende.at(k), w);
+  }
+  
+  
+  // new WText(" entries : "+ mixedTools::intToString((int)out[0]),w);
+  // new WBreak(w);
+  // new WText(" mean : "+ mixedTools::doubleToString(out[1])+unites[0],w);
+  // new WBreak(w);
+  // new WText(" sigma rms : "+ mixedTools::doubleToString(out[2])+unites[1],w);
+  //////////////////////////////////////////////////////////////////////////////////
+  
+  string titre;
+  if(iabs == 0) titre="x-coordinate";
+  if(iabs == 1) titre="y-coordinate";
+  if(iabs == 2) titre="z-coordinate";
+  if(iabs == 3) titre="xp-divergence";
+  if(iabs == 4) titre="yp-devergence";
+  if(iabs == 5) titre="kinetic energy";
+  
+  string xname;
+  if(iabs == 0) xname=" x (mm)";
+  if(iabs == 1) xname=" y (mm)";
+  if(iabs == 2) xname=" z (mm)";
+  if(iabs == 3) xname=" xp (mrad)";
+  if(iabs == 4) xname=" yp (mrad)";
+  if(iabs == 5) xname=" dEcin/Ecin (%)";
+  
+  string yname;
+  Wt::Chart::SeriesType seriesType = Wt::Chart::LineSeries;
+  Wt::Chart::FillRangeType fillRange = Wt::Chart::ZeroValueFill;
+  Wt::Chart::AxisValue location = Wt::Chart::MinimumValue;
+  bool isGridLinesEnabled = true;
+  chartPlot2vec(w,x,y,seriesType,fillRange,location,isGridLinesEnabled,titre,xname,yname,500,300);
+}
+
+
+
+void GWt_accelerator::chartPlot2vec(WContainerWidget* toto,vector<double>& xcor,vector<double>& ycor,Wt::Chart::SeriesType seriesType,Wt::Chart::FillRangeType fillRange,Wt::Chart::AxisValue value,bool isGridLinesEnables,string title,string legendx,string legendy,int width,int height,bool makeIcon)
+{
+  int nbpts = xcor.size();
+  cout << " PspaApplication::chartPlot2vec 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::chartPlot2vec el= " << i+1 << " x= " << xcor.at(i) << " y= " << ycor.at(i) << endl;
+  }
+  //  cout << " PspaApplication::chartPlot2vec FLAG 0 " << endl;
+  Wt::Chart::WCartesianChart *chart = new Wt::Chart::WCartesianChart(toto);
+  if (!makeIcon) chart->setTitle(title);
+  chart->initLayout();
+  chart->setModel(model);        // set the model
+  chart->setXSeriesColumn(0);    // set the column that holds the X data
+  
+  chart->setType(Wt::Chart::ScatterPlot);   // set type to ScatterPlot
+  chart->setLegendEnabled(false); // enable the legend
+  
+  // Provide space for the X and Y axis and title.
+  chart->setPlotAreaPadding(80, Left);
+  chart->setPlotAreaPadding(40, Bottom);
+  chart->setPlotAreaPadding(60, Top);
+  
+  // Typically, for mathematical functions, you want the axes to cross
+  // at the 0 mark (value= ZeroValue)
+  chart->axis(Wt::Chart::XAxis).setLocation(value);
+  chart->axis(Wt::Chart::YAxis).setLocation(value);
+  
+  //  cout << " PspaApplication::chartPlot2vec FLAG 1 " << endl;
+  
+  Wt::Chart::WDataSeries s(1,seriesType);
+  s.setPen(WColor("red"));
+  s.setFillRange(fillRange);
+  chart->addSeries(s);
+  
+  Wt::Chart::WAxis& axis = chart->axis(Wt::Chart::XAxis);
+  axis.setLabelFormat("%.3f");
+  axis.setTitle(legendx);
+  
+  chart->axis(Wt::Chart::Y1Axis).setTitle(legendy);
+  
+  if(isGridLinesEnables) {
+    axis.setGridLinesEnabled(true);
+    chart->axis(Wt::Chart::Y1Axis).setGridLinesEnabled(true);
+  }
+  //   cout << " PspaApplication::chartPlot2vec FLAG 2 " << endl;
+  
+  chart->resize(width,height); // WPaintedWidget must be given explicit size
+  chart->setMargin(10, Top | Bottom); // ?
+  chart->setMargin(WLength::Auto, Left | Right); //?
+  
+  if (makeIcon) {
+    chart->setLegendEnabled(false); // enable the legend
+    chart->setPlotAreaPadding(0);
+    chart->setAxisPadding(0);
+    WFont xAxisFont = chart->axis(Wt::Chart::XAxis).labelFont();
+    xAxisFont.setSize(8);
+    WFont yAxisFont = chart->axis(Wt::Chart::YAxis).labelFont();
+    yAxisFont.setSize(8);
+    chart->axis(Wt::Chart::XAxis).setLabelFont(xAxisFont);
+    chart->axis(Wt::Chart::YAxis).setLabelFont(yAxisFont);
+  }
+  //  cout << " PspaApplication::chartPlot2vec FLAG 3 " << endl;
+  
+#ifdef HAS_IMAGEMAGIC
+  
+  //  cout << " PspaApplication::chartPlot2vec FLAG MAGIC " << endl;
+  
+  // no background
+  chart->setBackground(WBrush(Wt::NoBrush));
+  
+  // axis black
+  chart->axis(XAxis).setPen(WColor("black"));
+  chart->axis(YAxis).setPen(WColor("black"));
+  
+  std::string name;
+  /*
+   Wt::WRasterImage pngImage("png", 1000, 1000);
+   Wt::WPainter p(&pngImage);
+   chart->paint(p);
+   name = workingDir_ + "/chart-"+sessionId ()+".png";
+   std::ofstream f(name.c_str(), std::ios::out |std::ios::trunc | std::ios::binary);
+   pngImage.write(f);
+   */
+  
+  Wt::WPdfImage pdfImage("1000", "600");
+  {
+    Wt::WPainter p1(&pdfImage);
+    chart->paint(p1);
+  }
+  
+  name = workingDir_ + "/chart-"+sessionId ()+".pdf";
+  std::ofstream f1(name.c_str(), std::ios::out | std::ios::binary);
+  pdfImage.write(f1);
+  
+  new WText("<a href='workingArea/chart-"+sessionId ()+".pdf' target='_blank'>Sauvegarder l'image</a>",toto);
+  
+#endif
+  //  cout << " PspaApplication::chartPlot2vec FLAG FIN" << endl;
+  
+}
+
+
+
+
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_dropZoneLigneFaisceau.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_dropZoneLigneFaisceau.cc	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_dropZoneLigneFaisceau.cc	(revision 455)
@@ -10,9 +10,11 @@
 #include "nomdElements.h"
 
-GWt_dropZoneLigneFaisceau::GWt_dropZoneLigneFaisceau( PspaApplication* pspa,GWt_ligneFaisceau* parent)
+class dataManager;
+
+GWt_dropZoneLigneFaisceau::GWt_dropZoneLigneFaisceau( dataManager* data,GWt_ligneFaisceau* parent)
   : WContainerWidget(),
 parent_(parent)
 {
-  initialise(pspa);
+  initialise(data);
 }
 
@@ -21,5 +23,5 @@
 }
 
-void GWt_dropZoneLigneFaisceau::initialise( PspaApplication* pspa)
+void GWt_dropZoneLigneFaisceau::initialise(dataManager* dataMgr)
 {
   
@@ -32,5 +34,5 @@
   
   // accept drops
-  vector <GWt_abstractElement*> elems = pspa->getAbstractElementFactory()->getAllElements();
+  vector <GWt_abstractElement*> elems = dataMgr->getPspaApplication()->getAbstractElementFactory()->getAllElements();
   for(int a = 0; a < elems.size(); a++) {
     acceptDrops(elems[a]->getMimeType());
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementBeam.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementBeam.cc	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementBeam.cc	(revision 455)
@@ -8,6 +8,6 @@
 #include <Wt/WPushButton>
 
-GWt_elementBeam::GWt_elementBeam(GWt_elementLigneFaisceau* elemLigne)
-:GWt_abstractElement(new elementBeam())
+GWt_elementBeam::GWt_elementBeam(GWt_elementLigneFaisceau* elemLigne,abstractElement* abstract)
+:GWt_abstractElement(abstract)
 {
   elementLigneFaiseauContainer_ = elemLigne;
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementBend.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementBend.cc	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementBend.cc	(revision 455)
@@ -9,6 +9,6 @@
 #include <Wt/WPushButton>
 
-GWt_elementBend::GWt_elementBend(GWt_elementLigneFaisceau* elemLigne )
-:GWt_abstractElement(new elementBend())
+GWt_elementBend::GWt_elementBend(GWt_elementLigneFaisceau* elemLigne ,abstractElement* abstract)
+:GWt_abstractElement(abstract)
 {
   elementLigneFaiseauContainer_ = elemLigne;
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementCell.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementCell.cc	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementCell.cc	(revision 455)
@@ -10,6 +10,6 @@
 #include <Wt/WPanel>
 
-GWt_elementCell::GWt_elementCell(GWt_elementLigneFaisceau* elemLigne)
-:GWt_abstractElement(new elementCell())
+GWt_elementCell::GWt_elementCell(GWt_elementLigneFaisceau* elemLigne,abstractElement* abstract)
+:GWt_abstractElement(abstract)
 {
     elementLigneFaiseauContainer_ = elemLigne;
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementDrift.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementDrift.cc	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementDrift.cc	(revision 455)
@@ -9,6 +9,6 @@
 #include <Wt/WPushButton>
 
-GWt_elementDrift::GWt_elementDrift(GWt_elementLigneFaisceau* elemLigne)
-:GWt_abstractElement(new elementDrift())
+GWt_elementDrift::GWt_elementDrift(GWt_elementLigneFaisceau* elemLigne,abstractElement* abstract)
+:GWt_abstractElement(abstract)
 {
   elementLigneFaiseauContainer_ = elemLigne;
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementFit.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementFit.cc	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementFit.cc	(revision 455)
@@ -9,6 +9,6 @@
 #include <Wt/WComboBox>
 
-GWt_elementFit::GWt_elementFit(GWt_elementLigneFaisceau* elemLigne)
-:GWt_abstractElement(new elementFit())
+GWt_elementFit::GWt_elementFit(GWt_elementLigneFaisceau* elemLigne,abstractElement* abstract)
+:GWt_abstractElement(abstract)
 {
   elementLigneFaiseauContainer_ = elemLigne;
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementLigneFaisceau.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementLigneFaisceau.cc	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementLigneFaisceau.cc	(revision 455)
@@ -19,35 +19,21 @@
 #define PSPA_DEBUG 1
 
-GWt_elementLigneFaisceau::GWt_elementLigneFaisceau(PspaApplication* pspa,GWt_ligneFaisceau* ligne)
+
+GWt_elementLigneFaisceau::GWt_elementLigneFaisceau(dataManager* data,GWt_ligneFaisceau* ligne, abstractElement* abstractElem)
   : WContainerWidget(),
     firstTimeInsertMessage_(NULL),
     dropZoneLeft_(NULL),
     dropZoneRight_(NULL),
-    GWt_abstractElement_(NULL),
+    GWt_abstractElement_deprecated_(NULL),
     elementLabel_(NULL),
-    pspa_(pspa)
-{
-  initialize_ligneFaisceau(nomdElements::inconnu,ligne);
-}
-
-
-GWt_elementLigneFaisceau::GWt_elementLigneFaisceau(nomdElements::typedElement type,PspaApplication* pspa,GWt_ligneFaisceau* ligne)
-  : WContainerWidget(),
-    firstTimeInsertMessage_(NULL),
-    dropZoneLeft_(NULL),
-    dropZoneRight_(NULL),
-    GWt_abstractElement_(NULL),
-    elementLabel_(NULL),
-    pspa_(pspa)
+    dataManager_(data)
 {
   // set the css name
   setObjectName("elementLigneFaisceau");
-  initialize_ligneFaisceau(type,ligne);
-}
-
-void GWt_elementLigneFaisceau::initialize_ligneFaisceau(nomdElements::typedElement eType,GWt_ligneFaisceau* ligne)
+  initialize_ligneFaisceau(ligne,abstractElem);
+}
+
+void GWt_elementLigneFaisceau::initialize_ligneFaisceau(GWt_ligneFaisceau* ligne, abstractElement* abstractElem)
 {   
-  cout << " new GWt_elementLigneFaisceau : "<< nomdElements::getLabelFromType(eType) << endl;
-    
   // set layout
   //     +----------+--------+---------+
@@ -62,6 +48,6 @@
   
   // add first line :  initialize arrow and link images
-  dropZoneLeft_ = new GWt_dropZoneLigneFaisceau(pspa_,ligne);
-  dropZoneRight_ = new GWt_dropZoneLigneFaisceau(pspa_,ligne);
+  dropZoneLeft_ = new GWt_dropZoneLigneFaisceau(dataManager_,ligne);
+  dropZoneRight_ = new GWt_dropZoneLigneFaisceau(dataManager_,ligne);
   
   // change object name in order to manage css :
@@ -73,6 +59,6 @@
   
   // add first line :  initialize arrow and link images
-  dropZoneLeft_ = new GWt_dropZoneLigneFaisceau(pspa_,ligne);
-  dropZoneRight_ = new GWt_dropZoneLigneFaisceau(pspa_,ligne);
+  dropZoneLeft_ = new GWt_dropZoneLigneFaisceau(dataManager_,ligne);
+  dropZoneRight_ = new GWt_dropZoneLigneFaisceau(dataManager_,ligne);
   
   // change object name in order to manage css :
@@ -84,40 +70,42 @@
   
   // add the image if present
-    
+  
+  nomdElements::typedElement eType = abstractElem->getNomdElement().getElementType();
+
   switch (  eType ) {
   case nomdElements::RFgun :
-    GWt_abstractElement_ = new GWt_elementRfgun(this);
+    GWt_abstractElement_deprecated_ = new GWt_elementRfgun(this,abstractElem);
     break;
   case nomdElements::drift :
-    GWt_abstractElement_ = new GWt_elementDrift(this);
+    GWt_abstractElement_deprecated_ = new GWt_elementDrift(this,abstractElem);
     break;
   case nomdElements::cell  :
-    GWt_abstractElement_ = new GWt_elementCell(this);
+    GWt_abstractElement_deprecated_ = new GWt_elementCell(this,abstractElem);
     break;
   case nomdElements::bend  :
-    GWt_abstractElement_ = new GWt_elementBend(this);
+    GWt_abstractElement_deprecated_ = new GWt_elementBend(this,abstractElem);
     break;
   case nomdElements::soleno  :
-    GWt_abstractElement_ = new GWt_elementSoleno(this);
+    GWt_abstractElement_deprecated_ = new GWt_elementSoleno(this,abstractElem);
     break;
   case nomdElements::beam  :
-    GWt_abstractElement_ = new GWt_elementBeam(this);
+    GWt_abstractElement_deprecated_ = new GWt_elementBeam(this,abstractElem);
     break;
   case nomdElements::fit  :
-    GWt_abstractElement_ = new GWt_elementFit(this);
+    GWt_abstractElement_deprecated_ = new GWt_elementFit(this,abstractElem);
     break;
   case nomdElements::mpole  :
-    GWt_abstractElement_ = new GWt_elementMpole(this);
+    GWt_abstractElement_deprecated_ = new GWt_elementMpole(this,abstractElem);
     break;
   case nomdElements::snapshot :
     {
-      int incr = pspa_->getExtensionFile();
+      int incr = dataManager_->getPspaApplication()->getExtensionFile();
       incr++;
-      pspa_->setExtensionFile(incr);
-      GWt_abstractElement_ = new GWt_elementSnapshot(this,incr);
+      dataManager_->getPspaApplication()->setExtensionFile(incr);
+      GWt_abstractElement_deprecated_ = new GWt_elementSnapshot(this,abstractElem,incr);
       break;
     }
   case nomdElements::inconnu :
-    GWt_abstractElement_ = NULL;
+    GWt_abstractElement_deprecated_ = NULL;
   }
   
@@ -129,14 +117,14 @@
   elementContainer_->setLayout(vLayoutElementContainer);
   
-  if (GWt_abstractElement_ != NULL) {
-    vLayoutElementContainer->addWidget(GWt_abstractElement_);
-    GWt_abstractElement_->setMaximumSize(64,40);
-    GWt_abstractElement_->setMinimumSize(64,40);
-  }
-  
-  if (GWt_abstractElement_ == NULL) {
+  if (GWt_abstractElement_deprecated_ != NULL) {
+    vLayoutElementContainer->addWidget(GWt_abstractElement_deprecated_);
+    GWt_abstractElement_deprecated_->setMaximumSize(64,40);
+    GWt_abstractElement_deprecated_->setMinimumSize(64,40);
+  }
+  
+  if (GWt_abstractElement_deprecated_ == NULL) {
     elementLabel_ = new WText();
   } else {
-    elementLabel_ = new WText(GWt_abstractElement_->getAbstractElement()->getLabel());
+    elementLabel_ = new WText(GWt_abstractElement_deprecated_->getAbstractElement()->getLabel());
     }
   
@@ -191,6 +179,8 @@
   elementContainer_->mouseWentOut().connect(this,&GWt_elementLigneFaisceau::mouseWentOut);
   elementContainer_->mouseWentOver().connect(this,&GWt_elementLigneFaisceau::mouseWentOver);
-  actionParameters_->clicked().connect(GWt_abstractElement_,&GWt_abstractElement::showParameters);
-  actionTrash_->clicked().connect(GWt_abstractElement_,&GWt_abstractElement::deleteElement);
+  actionParameters_->clicked().connect(GWt_abstractElement_deprecated_,&GWt_abstractElement::showParameters);
+  actionTrash_->clicked().connect(GWt_abstractElement_deprecated_,&GWt_abstractElement::deleteElement);
+
+  updateSoftware();
 }
 
@@ -198,5 +188,5 @@
 {}
 
-void GWt_elementLigneFaisceau::update() 
+void GWt_elementLigneFaisceau::updateSoftware() 
 {
   if (getGWt_AbstractElement()->getAbstractElement()) {
@@ -229,6 +219,6 @@
 {
   clear();
-  GWt_abstractElement_ = elem;
-  addWidget(GWt_abstractElement_);
+  GWt_abstractElement_deprecated_ = elem;
+  addWidget(GWt_abstractElement_deprecated_);
   if (static_cast <WContainerWidget*> (parent())) {
     WContainerWidget* wc = static_cast <WContainerWidget*> (parent());
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementMpole.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementMpole.cc	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementMpole.cc	(revision 455)
@@ -9,5 +9,6 @@
 #include <Wt/WPushButton>
 
-GWt_elementMpole::GWt_elementMpole(GWt_elementLigneFaisceau* elm) : GWt_abstractElement(new elementMultipole())
+GWt_elementMpole::GWt_elementMpole(GWt_elementLigneFaisceau* elm,abstractElement* abstract) :
+GWt_abstractElement(abstract)
 {
   elementLigneFaiseauContainer_ = elm;
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementRfgun.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementRfgun.cc	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementRfgun.cc	(revision 455)
@@ -8,6 +8,6 @@
 #include <Wt/WPushButton>
 
-GWt_elementRfgun::GWt_elementRfgun(GWt_elementLigneFaisceau* elemLigne)
-:GWt_abstractElement(new elementRfgun())
+GWt_elementRfgun::GWt_elementRfgun(GWt_elementLigneFaisceau* elemLigne,abstractElement* abstract)
+:GWt_abstractElement(abstract)
 {
   elementLigneFaiseauContainer_ = elemLigne;
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementSnapshot.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementSnapshot.cc	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementSnapshot.cc	(revision 455)
@@ -9,5 +9,6 @@
 #include <Wt/WPushButton>
 
-GWt_elementSnapshot::GWt_elementSnapshot(GWt_elementLigneFaisceau* elemLigne, int num) : GWt_abstractElement(new elementSnapshot(num))
+GWt_elementSnapshot::GWt_elementSnapshot(GWt_elementLigneFaisceau* elemLigne,abstractElement* abstract, int num) :
+GWt_abstractElement(abstract)
 {
   elementLigneFaiseauContainer_ = elemLigne;
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementSoleno.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementSoleno.cc	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementSoleno.cc	(revision 455)
@@ -8,6 +8,6 @@
 #include <Wt/WPushButton>
 
-GWt_elementSoleno::GWt_elementSoleno(GWt_elementLigneFaisceau* elemLigne)
-:GWt_abstractElement(new elementSoleno())
+GWt_elementSoleno::GWt_elementSoleno(GWt_elementLigneFaisceau* elemLigne,abstractElement* abstract)
+:GWt_abstractElement(abstract)
 {
   elementLigneFaiseauContainer_ = elemLigne;
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_ligneFaisceau.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_ligneFaisceau.cc	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_ligneFaisceau.cc	(revision 455)
@@ -3,5 +3,6 @@
 #include "GWt_elementLigneFaisceau.h"
 #include "GWt_ligneFaisceau.h"
-
+#include "GWt_sector.h"
+#include "abstractElement.h"
 #include "nomDeLogiciel.h"
 
@@ -11,7 +12,8 @@
 
 
-GWt_ligneFaisceau::GWt_ligneFaisceau(PspaApplication* ps) :
-  WContainerWidget(),
-  pspa_(ps)
+GWt_ligneFaisceau::GWt_ligneFaisceau(dataManager* data,GWt_sector* sect) :
+WContainerWidget(),
+dataManager_(data),
+UI_sector_(sect)
 {
   
@@ -24,5 +26,5 @@
   // set the object name
   setObjectName("ligneFaisceau");
-  clear();
+  buildBeamLineWidget();
 }
 
@@ -34,5 +36,5 @@
   // add the first drop zone
   decorationStyle().setBorder (WBorder (WBorder::Dotted));
-  allDropZone_ = new GWt_dropZoneLigneFaisceau(pspa_,this);
+  allDropZone_ = new GWt_dropZoneLigneFaisceau(dataManager_,this);
   WVBoxLayout* fit = new WVBoxLayout();
   allDropZone_->setLayout(fit);
@@ -49,69 +51,72 @@
 GWt_abstractElement* GWt_ligneFaisceau::addElement(nomdElements::typedElement eType, GWt_dropZoneLigneFaisceau* dropContainer )
 {
-
-  GWt_abstractElement* GWtAbstractElem = NULL;  
-  cout << " addElement::element : " << nomdElements::getLabelFromType(eType) << endl;
-    
-  // 3 cases :
-  // -dropContainer is an element of the ligneFaisceauLayout_
-  // -dropContainer is an element of the GWt_elementLigneFaisceau_
-  // -dropContainer is NULL, insert in the last element
-  
-  if(eType == nomdElements::inconnu) {
-    cout << "GWt_ligneFaisceau::element type " << eType << " inconnu " << endl;
-    return NULL;
-  }
-  
-  // add the element to the datamanager
-  
-  // first time we insert an element :
-  GWt_elementLigneFaisceau* firstElemIsElement = dynamic_cast <GWt_elementLigneFaisceau*> (ligneFaisceauLayout_->itemAt(0)->widget());
-
-  if( (ligneFaisceauLayout_->count() == 1) && (!firstElemIsElement) ) {
-    int index = indexOf(dropContainer);
-    if( (index != -1) || (dropContainer == NULL) ) { // found
-      // remove global drop zone
-      ligneFaisceauLayout_->clear();
-      // add first element
-      GWt_elementLigneFaisceau* elemLigneFaisceau = new GWt_elementLigneFaisceau(eType,pspa_,this);
-      ligneFaisceauLayout_->addWidget(elemLigneFaisceau,1);
-      GWtAbstractElem = elemLigneFaisceau->getGWt_AbstractElement();
-      // remove arrow from begin and end
-      
-    } else { // error
-      return NULL;
-    }
-  } else {
-    int index = -1;
+  
+  
+  GWt_abstractElement* UIabstractElement = NULL;
+  
+  // Add this element to the DataManager
+
+  // create a new abstractElement
+    // FIXME : To be move in an abstractFactory in the controler !!
+    abstractElement* currentElement = NULL;
+    switch (  eType ) {
+      case nomdElements::RFgun :
+        currentElement = new elementRfgun();
+        break;
+      case nomdElements::drift :
+        currentElement = new elementDrift();
+        break;
+      case nomdElements::cell  :
+        currentElement = new elementCell();
+        break;
+      case nomdElements::bend  :
+        currentElement = new elementBend();
+        break;
+      case nomdElements::soleno  :
+        currentElement = new elementSoleno();
+        break;
+      case nomdElements::beam  :
+        currentElement = new elementBeam();
+        break;
+      case nomdElements::fit  :
+        currentElement = new elementFit();
+        break;
+      case nomdElements::mpole  :
+        currentElement = new elementMultipole();
+        break;
+      case nomdElements::snapshot :
+      {
+        // FIXME : Snapshot a gÃ©rÃ©r
+/*        int incr = dataManager_->getPspaApplication()->getExtensionFile();
+        incr++;
+        dataManager_->getPspaApplication()->setExtensionFile(incr);
+*/
+        currentElement = new elementSnapshot();
+        break;
+      }
+    }
+
+    
+    // look for the previous element
+    abstractElement* previousElement = NULL;
+    
     for (int a=0; a< ligneFaisceauLayout_->count(); a++) {
       GWt_elementLigneFaisceau* elem = static_cast <GWt_elementLigneFaisceau*> (ligneFaisceauLayout_->itemAt(a)->widget ());
       if (elem) {
-	if (elem->getDropZoneLeft() == dropContainer) {
-	  index = a;
-	}
-	if (elem->getDropZoneRight() == dropContainer) {
-	  index = a+1;
-	}
-      }
-      
-    }
-    
-    //  ligneFaisceauLayout_->addWidget(new GWt_elementLigneFaiseau(ptr),0);
-    GWt_elementLigneFaisceau* elemLigneFaisceau = new GWt_elementLigneFaisceau(eType, pspa_,this);
-    if (index != -1) {
-      ligneFaisceauLayout_->insertWidget(index,elemLigneFaisceau,1);
-      GWtAbstractElem = elemLigneFaisceau->getGWt_AbstractElement();
-    } else {
-      ligneFaisceauLayout_->addWidget(elemLigneFaisceau,1);
-      GWtAbstractElem = elemLigneFaisceau->getGWt_AbstractElement();
-    }
-  }
-  manageLineFaisceauLayout();
-  
-  return GWtAbstractElem;
-}
-
-
-void GWt_ligneFaisceau::manageLineFaisceauLayout() {
+        if (elem->getDropZoneRight() == dropContainer) {
+          previousElement = elem->getGWt_AbstractElement()->getAbstractElement();
+        }
+      }
+    }
+
+    getUISector()->getSectorControler()->addElementAfter(currentElement,previousElement );
+  
+  buildBeamLineWidget();
+  return UIabstractElement;
+
+}
+
+
+void GWt_ligneFaisceau::manageLineFaisceauLayout_deprecated() {
   // special : hide/setVisible arrow :
   for (int a=0; a< ligneFaisceauLayout_->count(); a++) {
@@ -151,11 +156,54 @@
   }
   
-  pspa_->getExecuteWidget()->updateSections();
-}
-
+  // FIXME
+  UI_sector_->getExecuteWidget()->updateSections();
+}
+
+
+void GWt_ligneFaisceau::buildBeamLineWidget() {
+  // clear the layout and set default text
+  clear();
+  bool first = true;
+
+  // Get the dataManager's sector
+  // rebuild the beamLine
+
+  GWt_elementLigneFaisceau* elemLigneFaisceau = NULL;
+  for (unsigned int i =0; i< UI_sector_->getSectorControler()->getSectionsToExecute().size(); i++) {
+    std::vector <abstractElement*> abstractElem = UI_sector_->getSectorControler()->getSectionsToExecute()[i]->getElements();
+    for (unsigned int j=0; j< abstractElem.size(); j++) {
+
+      elemLigneFaisceau = new GWt_elementLigneFaisceau(dataManager_,
+                                                       this,
+                                                       abstractElem[j]);
+      
+      // remove default text
+      if (first) {
+        first = false;
+        ligneFaisceauLayout_->clear();
+        ligneFaisceauLayout_->addWidget(elemLigneFaisceau);
+
+        elemLigneFaisceau->getDropZoneLeft()->setStyleClass("elementLigneFaiseau_transparent");
+        elemLigneFaisceau->getDropZoneRight()->setStyleClass("elementLigneFaiseau_line");
+      
+      } else {
+        ligneFaisceauLayout_->addWidget(elemLigneFaisceau);
+
+        elemLigneFaisceau->getDropZoneLeft()->setStyleClass( "elementLigneFaiseau_line");
+        elemLigneFaisceau->getDropZoneRight()->setStyleClass("elementLigneFaiseau_line");
+      }
+      
+    }
+  }
+  // remove last line
+  if (elemLigneFaisceau != NULL) {
+    elemLigneFaisceau->getDropZoneRight()->setStyleClass("elementLigneFaiseau_transparent");
+  }
+  
+}
 
 
 void GWt_ligneFaisceau::update() {
-  manageLineFaisceauLayout();
+  manageLineFaisceauLayout_deprecated();
 }
 
@@ -186,5 +234,5 @@
     
     // manage widgets if necessary
-    manageLineFaisceauLayout();
+    manageLineFaisceauLayout_deprecated();
   }
 }
@@ -201,39 +249,39 @@
             
             if (GWt_elementLigneFaisceau* elem = dynamic_cast <GWt_elementLigneFaisceau*> (ligneFaisceauLayout_->itemAt(a)->widget ())) {
-                if (index == i) {
-                    if (elem->getGWt_AbstractElement()) {
-                        return elem->getGWt_AbstractElement()->getAbstractElement();
-                    }
+              if (index == i) {
+                if (elem->getGWt_AbstractElement()) {
+                  return elem->getGWt_AbstractElement()->getAbstractElement();
                 }
-                index ++;
-            }
-        }
-    }
+           }
+             index ++;
+        }
+    }
+  }
+  return NULL;
+}
+
+
+
+int GWt_ligneFaisceau::getAbstractElementNumeroFromLabel(std::string txt){
+  int index = 1;
+  if (txt == "") {
     return NULL;
-}
-
-
-
-int GWt_ligneFaisceau::getAbstractElementNumeroFromLabel(std::string txt){
-    int index = 1;
-    if (txt == "") {
-        return NULL;
-    }
-    
-    for (int a=0; a< ligneFaisceauLayout_->count(); a++) {
-        if (ligneFaisceauLayout_->itemAt(a)) {
-            
-            if (GWt_elementLigneFaisceau* elem = dynamic_cast <GWt_elementLigneFaisceau*> (ligneFaisceauLayout_->itemAt(a)->widget ())) {
-                if (elem->getGWt_AbstractElement()) {
-                    if (elem->getGWt_AbstractElement()->getAbstractElement()->getLabel() == txt) {
-                        return index;
-                    }
-                }
-                index ++;
-            }
-        }
-    }
-    return NULL;
-    
+  }
+  
+  for (int a=0; a< ligneFaisceauLayout_->count(); a++) {
+    if (ligneFaisceauLayout_->itemAt(a)) {
+      
+      if (GWt_elementLigneFaisceau* elem = dynamic_cast <GWt_elementLigneFaisceau*> (ligneFaisceauLayout_->itemAt(a)->widget ())) {
+        if (elem->getGWt_AbstractElement()) {
+          if (elem->getGWt_AbstractElement()->getAbstractElement()->getLabel() == txt) {
+            return index;
+          }
+        }
+        index ++;
+      }
+    }
+  }
+  return NULL;
+  
 }
 
@@ -263,14 +311,14 @@
 }
 
-void GWt_ligneFaisceau::update(int i){
+void GWt_ligneFaisceau::update_deprecated(int i){
     int index = 0;
-    
+  
     // first if 1
     //    i--;
-    
+  
     for (int a=0; a< ligneFaisceauLayout_->count(); a++) {
         if (GWt_elementLigneFaisceau* elem = dynamic_cast <GWt_elementLigneFaisceau*> (ligneFaisceauLayout_->itemAt(a)->widget ())) {
             if (index == i) {
-                elem->update();
+    //        elem->update();
             }
             index ++;
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc	(revision 455)
@@ -45,5 +45,4 @@
   WApplication(env),
   applicationDefaultTitle_("portail PSPA"),
-  beamLine_(NULL),
   extensionFile_(0)
 {
@@ -79,5 +78,4 @@
   WPushButton* boutonRestaure = new WPushButton();
   WPushButton* boutonLoadNew = new WPushButton();
-  WPushButton* boutongraphicalAnalysis = new WPushButton();
   WPushButton* boutonTrash = new WPushButton();
   
@@ -85,5 +83,4 @@
   boutonRestaure->setStyleClass("restoreButton");
   boutonLoadNew->setStyleClass("loadNewButton");
-  boutongraphicalAnalysis->setStyleClass("histoButton");
   boutonTrash->setStyleClass("trashButton");
   
@@ -91,6 +88,5 @@
   boutonRestaure->setToolTip ("restaurer la configuration depuis le serveur");
   boutonLoadNew->setToolTip ("charger une configuration");
-  boutongraphicalAnalysis->setToolTip ("analyse graphique");
-  boutonTrash->setToolTip ("tout effacer");
+  boutonTrash->setToolTip ("supprimer l'accÃ©lerateur"); // FIXME ! a terminer
   
   boutonSauve->setMaximumSize(38,38);
@@ -100,6 +96,4 @@
   boutonLoadNew->setMaximumSize(38,38);
   boutonLoadNew->setMinimumSize(38,38);
-  boutongraphicalAnalysis->setMaximumSize(38,38);
-  boutongraphicalAnalysis->setMinimumSize(38,38);
   boutonTrash->setMaximumSize(38,38);
   boutonTrash->setMinimumSize(38,38);
@@ -109,10 +103,7 @@
   // Upload when the button is clicked. React to a succesfull upload.
   boutonLoadNew->clicked().connect(this, &PspaApplication::openFileSelector);
-  boutongraphicalAnalysis->clicked().connect(this, &PspaApplication::dialogOnGraphics);
-  boutonTrash->clicked().connect(this, &PspaApplication::removeBeamLine);
   toolbarLayout->addWidget(boutonSauve , 0,Wt::AlignMiddle);
   toolbarLayout->addWidget(boutonRestaure , 0,Wt::AlignMiddle);
   toolbarLayout->addWidget(boutonLoadNew , 0,Wt::AlignMiddle);
-  toolbarLayout->addWidget(boutongraphicalAnalysis , 0,Wt::AlignMiddle);
   toolbarLayout->addWidget(boutonTrash , 0,Wt::AlignMiddle);
   toolbarLayout->addWidget(new WText("") , 1,Wt::AlignMiddle);
@@ -138,11 +129,18 @@
 
   
-  GWt_accelerator* accel = new GWt_accelerator(acceleratorContainerWidget,this);
+  new GWt_accelerator(acceleratorContainerWidget,dtmanage_);
   new WBreak(acceleratorContainerWidget);
 
-  WScrollArea* scroll = new  WScrollArea(acceleratorContainerWidget);
-  scroll->setWidget(createBeamLine());
-  scroll->setMinimumSize(300,150);
-
+
+  // ---------------------------------------------------------------
+  // ********************* Ancien code : A supprimer ***************
+  // ---------------------------------------------------------------
+  beamLine_deprecated_ = NULL;
+  /*
+   WScrollArea* scroll = new  WScrollArea(acceleratorContainerWidget);
+   scroll->setWidget(createBeamLine__deprecated());
+   scroll->setMinimumSize(300,150);
+   */
+  
   new WBreak(acceleratorContainerWidget);
   //-----------
@@ -153,5 +151,5 @@
 
   globalParam_ = new GWt_globalParameters(dtmanage_);
-  sectorParam_ = new GWt_sectorParameters(dtmanage_);
+  sectorParam_ = new GWt_sectorParameters();
   WWidget* dboard = createDashBoard(acceleratorContainerWidget);
   dboard->setMinimumSize(300,100);
@@ -161,11 +159,4 @@
   //-----------
 
-  graphicsDialog_ = new GWt_dialog("graphical analysis",createDrawingWidget(),false);
-  graphicsDialog_->setMinimumSize(400,400);
-  graphicsDialog_->setClosable(true);
-  graphicsDialog_->hide();
-  
-  executeWidget_ = new GWt_softwarePanel(dtmanage_,this,acceleratorContainerWidget);
-  executeWidget_->setMinimumSize(400,100);
   
   new WBreak(acceleratorContainerWidget);
@@ -219,5 +210,5 @@
 void PspaApplication::messageBox2()
 {
-  sectorParam_->execDialog();
+  sectorParam_->execDialog_deprecated();
   return;
 }
@@ -245,9 +236,10 @@
 }
 
-Wt::WWidget* PspaApplication::createBeamLine()
+/*Wt::WWidget* PspaApplication::createBeamLine__deprecated()
 {
   extensionFile_= 0;
-  if (!beamLine_) {
-    beamLine_ = new GWt_ligneFaisceau(this);
+  if (!beamLine__deprecated_) {
+    // FIXME : get the one of the first app/sector for the moment
+    beamLine__deprecated_ = accel_toBeRenameAsLocal->firstSector__deprecated()->getUIBeamLine ?
   } else {
     beamLine_->clear();
@@ -256,128 +248,7 @@
   setTitle(applicationDefaultTitle_);
 
-  return beamLine_;
-}
-
-void PspaApplication::dialogOnGraphics()
-{
-  graphicsDialog_->show();
-}
-
-WContainerWidget* PspaApplication::createDrawingWidget()
-{
-  WGridLayout *glayout= new WGridLayout();
-  WContainerWidget* dessin = new WContainerWidget();
-  dessin->setLayout(glayout);
-
-  group_ = new Wt::WButtonGroup(this);
-  
-  /////////////////////////////////////////////////////////////////////
-       
-  choixEnveloppeDessin_ = new WComboBox();
-  choixEnveloppeDessin_->addItem("x");
-  // choixEnveloppeDessin_->addItem("y");
-  Wt::WRadioButton *button1= new WRadioButton(" enveloppe");
-  group_->addButton(button1,1);
-  glayout->addWidget(button1,0,1);
-  glayout->addWidget(choixEnveloppeDessin_,0,2);
-  /////////////////////////////////////////////////////////////////////
-
-  choixElementDessin_ = new WComboBox();
-  choixElementDessin_->setMinimumSize(50,10);
-  choixTypeDessinFaisceau_ = new WComboBox();
-  choixTypeDessinFaisceau_->addItem("courant_snyder");
-  choixTypeDessinFaisceau_->addItem("macroparticles");
-  Wt::WRadioButton *button2= new WRadioButton(" phase space after element");
-
-  choixAbsPhase_ = new WComboBox();
-  choixAbsPhase_->addItem("x");
-  choixAbsPhase_->addItem("y");
-  choixAbsPhase_->addItem("dz");
-  choixAbsPhase_->addItem("xp");
-  choixAbsPhase_->addItem("yp");
-  choixAbsPhase_->addItem("dE/E");
-  choixAbsPhase_->setCurrentIndex(0);
-  
-  choixOrdPhase_ = new WComboBox();
-  choixOrdPhase_->addItem("x");
-  choixOrdPhase_->addItem("y");
-  choixOrdPhase_->addItem("dz");
-  choixOrdPhase_->addItem("xp");
-  choixOrdPhase_->addItem("yp");
-  choixOrdPhase_->addItem("dE/E");
-  choixOrdPhase_->setCurrentIndex(3);
-  
-  group_->addButton(button2,2);
-  glayout->addWidget(button2,1,1);
-  glayout->addWidget(choixElementDessin_,1,2);
-  glayout->addWidget(choixTypeDessinFaisceau_,1,3);
-  //  glayout->addWidget(new WText("abs. :"),2,2);
-  glayout->addWidget(choixAbsPhase_,2,2);
-  //  glayout->addWidget(new WText("ord. :"),2,4);
-  glayout->addWidget(choixOrdPhase_,2,3);
-  /////////////////////////////////////////////////////////////////////
-
-  choixVariableHisto_= new WComboBox();
-  choixVariableHisto_->addItem("x");
-  choixVariableHisto_->addItem("y");
-  choixVariableHisto_->addItem("z");
-  choixVariableHisto_->addItem("xp");
-  choixVariableHisto_->addItem("yp");
-  choixVariableHisto_->addItem("dE/E");
-  choixVariableHisto_->setCurrentIndex(5);
-
-  choixHistoDessin_ = new WComboBox();
-  Wt::WRadioButton *button3= new WRadioButton(" histogram after element ");
-  group_->addButton(button3,3);
-
-  glayout->addWidget(button3,3,1);
-  glayout->addWidget(choixHistoDessin_,3,2);
-  glayout->addWidget(choixVariableHisto_,3,3);
-  /////////////////////////////////////////////////////////////////////
-  
-  WPushButton *close= new WPushButton("close"); 
-  glayout->addWidget(close,4,1);
-  close->clicked().connect(this,&PspaApplication::closeGraphicDialog);
-  
-  WPushButton *draw= new WPushButton("draw"); 
-  glayout->addWidget(draw,4,2,2,1);
-  draw->clicked().connect(this,&PspaApplication::dessiner);
-  /////////////////////////////////////////////////////////////////////
-
-  toto_ = new WContainerWidget();
-  dessin->addWidget(toto_);
-  return dessin;
-}
-
-void PspaApplication::closeGraphicDialog()
-{
-  cout << " close graphicsDialog_" << endl;
-  for(unsigned i = 0; i < eDialog_.size(); i++) eDialog_[i]->done(WDialog::Rejected);
-  eDialog_.clear();
-  graphicsDialog_->done(WDialog::Rejected);
-}
-
-void PspaApplication::dessiner()
-{
-  int k= group_->checkedId();
-  cout << "dessiner k= " << k << endl;
-
-  switch(k) {
-  case  1: 
-    dessinerEnveloppe();
-    break;
-  case 2:
-    dessinerPhaseSpace();
-    break;
-  case 3:
-    dessinerHistogramme();
-    break;
-  default:
-    GWt_dialog graphicalWarning("graphical analysis","select a button",GWt_dialog::Warning,false,true);
-    graphicalWarning.exec();
-    break;
-  }
-}
-
+  return beamLine__deprecated_;
+}
+*/
 
 void PspaApplication::sauver()
@@ -511,153 +382,4 @@
   GWt_dialog*  messageBox= new GWt_dialog("Error during upload file" ,message ,GWt_dialog::Error,false,true); 
   messageBox->show();
-}
-
-void PspaApplication::faireDessin()
-{
-  choixElementDessin_->clear();
-  choixHistoDessin_->clear();
-
-  int nombre = dtmanage_->getBeamLineSize();  
-  for(int i = 1; i <= nombre; i++) {
-    abstractElement* elPtr = dtmanage_->getElementPointerFromNumero(i);
-    //    if(elPtr->getNomdElement().getElementType() == snapshot) continue;
-
-    choixElementDessin_->addItem(elPtr->getLabel());
-    choixHistoDessin_->addItem(elPtr->getLabel());
-  } 
-}
-
-void PspaApplication::dessinerPhaseSpace()
-{    
-    
-  int typeFaisceau = choixTypeDessinFaisceau_->currentIndex();
-  //  int index = choixElementDessin_->currentIndex();
-  string nameAbs = choixAbsPhase_->currentText().toUTF8();
-  string nameOrd = choixOrdPhase_->currentText().toUTF8();
-  if ( nameAbs == nameOrd ) {
-	GWt_dialog phaseSpaceError(" graphical analysis", "the beam coordinates must be different !", GWt_dialog::Error, false,true);
-	phaseSpaceError.exec();
-	return;
-  }
-  string elementLabel = choixElementDessin_->currentText().toUTF8();
-  particleBeam* beam = dtmanage_->getDiagnosticBeam(elementLabel);
-  //  particleBeam* beam = dtmanage_->getDiagnosticBeam(index);
-    
-  if ( beam == NULL ) {
-    GWt_dialog warningBeamState(" graphical analysis", "the beam does not exist at the end of this element !", GWt_dialog::Error, false,true);
-    warningBeamState.exec();
-    return;
-  }
-    
-    toto_->clear();
-    faireDessinPhaseSpace(toto_, beam, elementLabel, nameAbs, nameOrd, typeFaisceau);
-
-  // if ( typeFaisceau == 0 )
-  //   {
-  //     if ( !beam->momentRepresentationOk() ) beam->buildMomentRepresentation();
-  //     faireDessinTransport(toto_, beam, nameAbs, nameOrd );
-  //   }
-  // else if ( typeFaisceau == 1 )
-  //   {
-  //     if ( beam->particleRepresentationOk() ) faireDessinParmela(toto_, beam, nameAbs, nameOrd );
-  //     else {
-  // 	GWt_dialog warningBeamState(" graphical analysis", "the beam state does not allow providing a drawing with macroparticles !", GWt_dialog::Error, false,true);
-  // 	warningBeamState.exec();
-  //     }
-  //   }
-  // else {
-  //   GWt_dialog warningTypeDrawing(" graphical analysis", "type of  drawing not programmed !", GWt_dialog::Error, false,true);
-  //   warningTypeDrawing.exec();
-  // }
-}
-
-void PspaApplication::dessinerEnveloppe()
-{
-  toto_->clear();
-  
-  int typeEnveloppe = choixEnveloppeDessin_->currentIndex();
-  if ( typeEnveloppe == 0 )
-    {
-      faireDessinEnveloppe(toto_, "x");
-    }
-  else {
-    GWt_dialog warningTypeEnveloppe(" graphical analysis", "type of enveloppe drawing not programmed !", GWt_dialog::Error, false,true);
-    warningTypeEnveloppe.exec();
-  }
-}
-
-void PspaApplication::faireDessinEnveloppe(WContainerWidget* toto, string type)
-{
-  
-  std::time_t result = std::time(NULL);
-  
-  GWt_dialog* envDialog = new GWt_dialog(WString("enveloppe&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(")+std::asctime(std::localtime(&result))+")",toto,false);
-  eDialog_.push_back(envDialog);
-  envDialog->setMinimumSize(400,400);
-  envDialog->setClosable(true);
-  envDialog->show();
-      
-  //  unsigned nbel = dtmanage_->getBeamLineSize();
-  vector<double> xcor;
-  vector<double> ycor;
-  string titre;
-  string legendx;
-  string legendy;
-  dtmanage_->donneesRmsEnveloppe(type,xcor,ycor,titre,legendx,legendy);
-
-  Wt::Chart::SeriesType seriesType = LineSeries;
-  Wt::Chart::FillRangeType fillRange = NoFill;
-  Wt::Chart::AxisValue location = ZeroValue;
-  bool isGridLinesEnabled = false; 
-  chartPlot2vec(envDialog->contents(),xcor,ycor,seriesType,fillRange,location,isGridLinesEnabled,titre,legendx,legendy,500,300);
-}
-
-void PspaApplication::faireDessinPhaseSpace(WContainerWidget* toto, particleBeam* beam, string elementLabel, string namex, string namey, int typeFaisceau)
-{
-
-  vector<double> xcor;
-  vector<double> ycor;
-  vector<string> legende;
-  string titre;
-  Wt::Chart::SeriesType seriesType;
-  
-  if ( typeFaisceau == 0 ) {
-    seriesType = LineSeries;
-    titre = "phase space rms";
-    beam->donneesDessinEllipse(xcor,ycor,legende,namex,namey);
-  } else if (  typeFaisceau == 1 ) {
-    seriesType = PointSeries;
-    titre = " phase space ";
-    beam->particlesPhaseSpaceData(xcor,ycor,legende,namex,namey);
-    // for ( int kk=0; kk < xcor.size(); kk++) 
-    //   {
-    // 	cout << " dess. phas. x= " << xcor.at(kk) << " x'= " << ycor.at(kk) << endl;
-    //   }
-  } else {
-    GWt_dialog warningBeamState(" graphical analysis", "the beam state does not allow providing a drawing with macroparticles !", GWt_dialog::Error, false,true);
-    warningBeamState.exec();
-    return;
-  }
-  
-  std::time_t result = std::time(NULL);
-  GWt_dialog* phaseSpaceDialog = new GWt_dialog(WString("phase space&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(")+std::asctime(std::localtime(&result))+")",toto,false);
-  eDialog_.push_back(phaseSpaceDialog);
-  phaseSpaceDialog->setMinimumSize(400,400);
-  phaseSpaceDialog->setClosable(true);
-  new WText(" case : " + nameOfCase_, phaseSpaceDialog->contents());
-  new WBreak(phaseSpaceDialog->contents());
-  new WText(" after element :  " + elementLabel, phaseSpaceDialog->contents());
-
-  for (int k=0 ; k < (int)legende.size(); k++) {
-    new WBreak(phaseSpaceDialog->contents());
-    new WText(legende.at(k), phaseSpaceDialog->contents());
-  }
-
-  Wt::Chart::FillRangeType fillRange = NoFill;
-  Wt::Chart::AxisValue location = ZeroValue;
-  bool isGridLinesEnabled = false; 
-  chartPlot2vec(phaseSpaceDialog->contents(),xcor,ycor,seriesType,fillRange,location,isGridLinesEnabled,titre,namex,namey,500,300);
-  
-  phaseSpaceDialog->show();
 }
 
@@ -878,240 +600,9 @@
 
 
-
+/*
 void PspaApplication::removeBeamLine() {
-  createBeamLine();
+  createBeamLine__deprecated();
   executeWidget_->updateSections();
 }
-
-void PspaApplication::chartPlot2vec(WContainerWidget* toto,vector<double>& xcor,vector<double>& ycor,SeriesType seriesType,FillRangeType fillRange,AxisValue value,bool isGridLinesEnables,string title,string legendx,string legendy,int width,int height,bool makeIcon)
-{
-  int nbpts = xcor.size();
-  cout << " PspaApplication::chartPlot2vec 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::chartPlot2vec el= " << i+1 << " x= " << xcor.at(i) << " y= " << ycor.at(i) << endl;
-  }
-  //  cout << " PspaApplication::chartPlot2vec FLAG 0 " << endl;
-  WCartesianChart *chart = new WCartesianChart(toto);
-  if (!makeIcon) chart->setTitle(title);
-  chart->initLayout();  
-  chart->setModel(model);        // set the model
-  chart->setXSeriesColumn(0);    // set the column that holds the X data
-  
-  chart->setType(ScatterPlot);   // set type to ScatterPlot
-  chart->setLegendEnabled(false); // enable the legend  
-
-  // Provide space for the X and Y axis and title.
-  chart->setPlotAreaPadding(80, Left); 
-  chart->setPlotAreaPadding(40, Bottom);
-  chart->setPlotAreaPadding(60, Top);
- 
-  // Typically, for mathematical functions, you want the axes to cross
-  // at the 0 mark (value= ZeroValue)
-  chart->axis(XAxis).setLocation(value);
-  chart->axis(YAxis).setLocation(value);
-  
-  //  cout << " PspaApplication::chartPlot2vec FLAG 1 " << endl;
-
-  WDataSeries s(1,seriesType);
-  s.setPen(WColor("red"));
-  s.setFillRange(fillRange);
-  chart->addSeries(s);
-  
-  WAxis& axis = chart->axis(XAxis);
-  axis.setLabelFormat("%.3f");
-  axis.setTitle(legendx);
-    
-  chart->axis(Y1Axis).setTitle(legendy);
-
-  if(isGridLinesEnables) {
-    axis.setGridLinesEnabled(true);
-    chart->axis(Y1Axis).setGridLinesEnabled(true);
-  }
-  //   cout << " PspaApplication::chartPlot2vec FLAG 2 " << endl;
-
-  chart->resize(width,height); // WPaintedWidget must be given explicit size
-  chart->setMargin(10, Top | Bottom); // ?
-  chart->setMargin(WLength::Auto, Left | Right); //?
-
-  if (makeIcon) {
-    chart->setLegendEnabled(false); // enable the legend
-    chart->setPlotAreaPadding(0);
-    chart->setAxisPadding(0);
-    WFont xAxisFont = chart->axis(XAxis).labelFont();
-    xAxisFont.setSize(8);
-    WFont yAxisFont = chart->axis(YAxis).labelFont();
-    yAxisFont.setSize(8);
-    chart->axis(XAxis).setLabelFont(xAxisFont);
-    chart->axis(YAxis).setLabelFont(yAxisFont);
-  }
-  //  cout << " PspaApplication::chartPlot2vec FLAG 3 " << endl;
-
-#ifdef HAS_IMAGEMAGIC
-
-  //  cout << " PspaApplication::chartPlot2vec FLAG MAGIC " << endl;
-
-  // no background
-  chart->setBackground(WBrush(Wt::NoBrush));
-
-  // axis black
-  chart->axis(XAxis).setPen(WColor("black"));
-  chart->axis(YAxis).setPen(WColor("black"));
-    
-  std::string name;
-  /*
- Wt::WRasterImage pngImage("png", 1000, 1000);
-  Wt::WPainter p(&pngImage);
-  chart->paint(p);
-  name = workingDir_ + "/chart-"+sessionId ()+".png";
-  std::ofstream f(name.c_str(), std::ios::out |std::ios::trunc | std::ios::binary);
-  pngImage.write(f);
-  */
-
-  Wt::WPdfImage pdfImage("1000", "600");
-    {
-   Wt::WPainter p1(&pdfImage);
-    chart->paint(p1);
-      }
-
-  name = workingDir_ + "/chart-"+sessionId ()+".pdf";
-  std::ofstream f1(name.c_str(), std::ios::out | std::ios::binary);
-  pdfImage.write(f1);
-
-  new WText("<a href='workingArea/chart-"+sessionId ()+".pdf' target='_blank'>Sauvegarder l'image</a>",toto);
-
-#endif
-  //  cout << " PspaApplication::chartPlot2vec FLAG FIN" << endl;
-
-}
-
-void PspaApplication::dessinerHistogramme()
-{
-  toto_->clear();
-  
-  // std::time_t result = std::time(NULL);
-  // GWt_dialog* histoDialog = new GWt_dialog(WString("histogramme&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(")+std::asctime(std::localtime(&result))+")",toto_,false);
-  // eDialog_.push_back(histoDialog);
-  // histoDialog->setMinimumSize(400,400);
-  // histoDialog->setClosable(true);
-
-  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);
-    warningBeamState.exec();
-    return;
-  }
-  
-  if (!beam->particleRepresentationOk()) {
-    GWt_dialog warningBeamState("histogram", "the beam state does not allow providing a drawing with macroparticles !", GWt_dialog::Error, false,true);
-    warningBeamState.exec();
-    return;
-  }
-
-  unsigned iabs= choixVariableHisto_->currentIndex();  
-  vector<double> xcor;
-  vector<int> hist;
-  //  double out[3]= {0.0};
-  vector<string> legende;
-  beam->histogramme(iabs,xcor,hist,legende);
-
-  cout<<"xcor.size()= "<<xcor.size()<<", hist.size()= "<<hist.size()<<endl;
-  //////////////////////////////////////////////////////////////////////////////////
-  
-  int n = hist.size();
-  vector<double> x;
-  x.resize(2*n+2);
-  vector<double> y;
-  y.resize(2*n+2);
-
-  int j= 0;
-  x.at(j)= xcor[0];
-  y.at(j)= 0.0;
-  j++;
-  x.at(j)= xcor[0];
-  y.at(j)= hist[0];
-  j++;
- 
-  for (int i = 1; i < n; ++i) {
-    x.at(j)= xcor[i];
-    y.at(j)= hist[i-1];
-    j++;
-    x.at(j)= xcor[i];
-    y.at(j)= hist[i];
-    j++;
-  }
-
-  x.at(j)= xcor[n];
-  y.at(j)= hist[n-1];
-  j++;
-  x.at(j)= xcor[n];
-  y.at(j)= 0.0;
-  //////////////////////////////////////////////////////////////////////////////////
-  std::time_t result = std::time(NULL);
-  GWt_dialog* histoDialog = new GWt_dialog(WString("histogramme&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(")+std::asctime(std::localtime(&result))+")",toto_,false);
-  eDialog_.push_back(histoDialog);
-  histoDialog->setMinimumSize(400,400);
-  histoDialog->setClosable(true);
-
-  histoDialog->show();
-
-  WContainerWidget *w= histoDialog->contents();
-
-  // // legendes
-  // string unites[2];
-  // if(iabs == 0 || iabs == 1 || iabs == 2) {
-  //   unites[0]= unites[1]= " mm";
-  // }
-  // if(iabs == 3 || iabs == 4) {
-  //   unites[0]= unites[1]= " mrad";
-  // }
-  // if(iabs == 5) {
-  //   unites[0]= " MeV"; unites[1]= " KeV";
-  // }
-
-  new WText(" case : " + nameOfCase_, w);
-  new WBreak(w);
-  new WText(" after element :  " + elementLabel, w);
-
-  for (int k=0 ; k < (int)legende.size(); k++) {
-    new WBreak(w);
-    new WText(legende.at(k), w);
-  }
-
-
-  // new WText(" entries : "+ mixedTools::intToString((int)out[0]),w);
-  // new WBreak(w);
-  // new WText(" mean : "+ mixedTools::doubleToString(out[1])+unites[0],w);
-  // new WBreak(w);
-  // new WText(" sigma rms : "+ mixedTools::doubleToString(out[2])+unites[1],w);
-  //////////////////////////////////////////////////////////////////////////////////
-
-  string titre;
-  if(iabs == 0) titre="x-coordinate";
-  if(iabs == 1) titre="y-coordinate";
-  if(iabs == 2) titre="z-coordinate";
-  if(iabs == 3) titre="xp-divergence";
-  if(iabs == 4) titre="yp-devergence";
-  if(iabs == 5) titre="kinetic energy";
-
-  string xname;
-  if(iabs == 0) xname=" x (mm)";
-  if(iabs == 1) xname=" y (mm)";
-  if(iabs == 2) xname=" z (mm)";
-  if(iabs == 3) xname=" xp (mrad)";
-  if(iabs == 4) xname=" yp (mrad)";
-  if(iabs == 5) xname=" dEcin/Ecin (%)";
-
-  string yname;
-  Wt::Chart::SeriesType seriesType = LineSeries;
-  Wt::Chart::FillRangeType fillRange = ZeroValueFill;
-  Wt::Chart::AxisValue location = MinimumValue;
-  bool isGridLinesEnabled = true; 
-  chartPlot2vec(w,x,y,seriesType,fillRange,location,isGridLinesEnabled,titre,xname,yname,500,300);
-}
-
-
+*/
+
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_sectionToExecute.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_sectionToExecute.cc	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_sectionToExecute.cc	(revision 455)
@@ -9,10 +9,11 @@
 #include "GWt_softwarePanel.h"
 
-GWt_sectionToExecute::GWt_sectionToExecute(Wt::WComboBox* first,Wt::WComboBox* last,Wt::WComboBox* soft,Wt::WContainerWidget* buttonPanel, GWt_softwarePanel* sPanel)
+GWt_sectionToExecute::GWt_sectionToExecute(Wt::WComboBox* first,Wt::WComboBox* last,Wt::WComboBox* soft,Wt::WContainerWidget* buttonPanel, GWt_softwarePanel* sPanel,GWt_sector* sect)
 :WContainerWidget(),
 firstElement(first),
 lastElement(last),
 software(soft),
-softwarePanel(sPanel)
+softwarePanel(sPanel),
+UI_sector_(sect)
 {
   Wt::WGridLayout* mainContainerLayout = new Wt::WGridLayout();
@@ -138,2 +139,11 @@
 
 }
+
+/*
+ void GWt_sectionToExecute::setSoftware(nomDeLogiciel logiciel)
+{
+  UI_sector_->getSectorControler()->setSoftware(logiciel);
+
+}
+
+*/
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_sector.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_sector.cc	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_sector.cc	(revision 455)
@@ -11,8 +11,8 @@
 
 GWt_sector::GWt_sector(GWt_accelerator* parent,sector* sect) :
-parent_(parent),
-sector_(sect)
+UI_Accelerator_(parent),
+sectorControler_(sect)
 {
-  setIcon(parent->getAcceleratorGlobalViewLayout());
+  setIcon(UI_Accelerator_->getAcceleratorGlobalViewLayout());
 }
 
@@ -34,5 +34,5 @@
   parentLineLayout->addWidget(sectorContainer);
   
-  WLabel* icon = new WLabel(sector_->getName(),sectorContainer);
+  WLabel* icon = new WLabel(sectorControler_->getName(),sectorContainer);
   icon->setStyleClass("sectionIcon");
   icon->setHeight(100);
@@ -42,5 +42,5 @@
 
   std::stringstream str;
-  str << sector_->getRepetitionNumber();
+  str << sectorControler_->getRepetitionNumber();
   std::string result;
   str >> result;
@@ -48,16 +48,16 @@
   // Add repetition times
   WText* t = new WText(" x"+result+" ",sectorContainer);
-  if (sector_->getRepetitionNumber() > 1) {
-    t->setToolTip("repeted "+result+" times");
+  if (sectorControler_->getRepetitionNumber() > 1) {
+    t->setToolTip("executed "+result+" times");
   } else {
-    t->setToolTip("repeted "+result+" time");
+    t->setToolTip("executed "+result+" time");
   }
   new WBreak(sectorContainer);
 
   // Add refected
-  if (sector_->getReflected()) {
-    WText* t = new WText(" reflected from "+sector_->getDuplicatedFrom()->getName(),sectorContainer);
-  } else if (sector_->getDuplicatedFrom() != NULL) {
-    WText* t = new WText(" duplicated from "+sector_->getDuplicatedFrom()->getName(),sectorContainer);
+  if (sectorControler_->getReflected()) {
+    WText* t = new WText(" reflected from "+sectorControler_->getDuplicatedFrom()->getName(),sectorContainer);
+  } else if (sectorControler_->getDuplicatedFrom() != NULL) {
+    WText* t = new WText(" duplicated from "+sectorControler_->getDuplicatedFrom()->getName(),sectorContainer);
   }
   new WBreak(sectorContainer);
@@ -68,9 +68,10 @@
 
 
-void GWt_sector::createWidgetBeamLine(PspaApplication* pspa,WContainerWidget* parent) {
+void GWt_sector::createWidgetBeamLine(WContainerWidget* parent) {
 
   // suppress old detailled view if present
   parent->clear();
   
+  // add the detailled view
   WContainerWidget* wdg = new WContainerWidget(parent);
 
@@ -89,5 +90,5 @@
   //  menu->setLayout(hmenuLayout);
   
-  new WLabel(sector_->getName()+" ",menu);
+  new WLabel(sectorControler_->getName()+" ",menu);
   
   WPushButton* actionParameters = new WPushButton("",menu);
@@ -110,6 +111,12 @@
   
   // Add beamLine for this sector
-  beamLine_ = new GWt_ligneFaisceau(pspa);
-  vContainerLayout->addWidget(beamLine_);
+  UI_beamLine_ = new GWt_ligneFaisceau(getAccelerator()->getDataManager(),this);
+  vContainerLayout->addWidget(UI_beamLine_);
+  
+  // add the software panel
+  executeWidget_ = new GWt_softwarePanel(getAccelerator()->getDataManager(),this);
+  vContainerLayout->addWidget(executeWidget_);
+  
+
   wdg->setLayout(vContainerLayout);
 }
@@ -117,4 +124,4 @@
 
 void GWt_sector::displayWidgetBeamLine() {
-  createWidgetBeamLine(parent_->getControler(),parent_->getAcceleratorDetailledView());
+  createWidgetBeamLine(getAccelerator()->getAcceleratorDetailledView());
 }
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_sectorParameters.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_sectorParameters.cc	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_sectorParameters.cc	(revision 455)
@@ -15,9 +15,4 @@
 #define BAVARD 0
 
-GWt_sectorParameters::GWt_sectorParameters(dataManager* dt)
-{
-  dt_ = dt;
-}
-
 void GWt_sectorParameters::setText(WText *st)
 {
@@ -25,5 +20,5 @@
 }
 
-void GWt_sectorParameters::execDialog()
+void GWt_sectorParameters::execDialog_deprecated()
 {
 #if BAVARD > 0
@@ -41,5 +36,5 @@
 
   gb_ = new WGroupBox("sectors",dialog_->contents());
-  createSector();
+//  createSector();
 
   dialog_->contents()->addWidget(new WBreak());
@@ -58,5 +53,5 @@
 }
 
-void GWt_sectorParameters::createSector()
+void GWt_sectorParameters::createSector_deprecated()
 {
 #if BAVARD > 0
@@ -68,5 +63,5 @@
   hbox->setContentsMargins(0,0,0,0);
 
-  vector<statements> v = dt_->getSectorParameters()->getSectors();
+/*  vector<statements> v = getSectors();
 
   hbox->addWidget(new WText("name&nbsp;:&nbsp;"));
@@ -89,5 +84,5 @@
   hbox->addWidget(repeat_);
 
-  WContainerWidget* bs= buttons(cnt_.size());
+  WContainerWidget* bs= buttons_deprecated(cnt_.size());
   hbox->addWidget(bs);
 
@@ -115,8 +110,9 @@
  
   w3->setLayout(grid); 
-  gb_->addWidget(w3); 
-}
-
-WContainerWidget* GWt_sectorParameters::buttons(int num)
+  gb_->addWidget(w3);
+ */
+}
+
+WContainerWidget* GWt_sectorParameters::buttons_deprecated(int num)
 {
 #if BAVARD > 0
@@ -157,5 +153,5 @@
     setStatus("OK...");
     setAttributes();
-    dt_->getSectorParameters()->setSectors(sectors_);
+//    setSectors(sectors_);
   } else {
     setStatus("Cancelled!");
@@ -163,5 +159,5 @@
   }
 
-#if BAVARD > 0
+/*#if BAVARD > 0
   cout << "dialogDone():: sectors_.size()= " << sectors_.size() << endl;
   for(int i = 0; i < sectors_.size(); i++) {
@@ -169,5 +165,5 @@
   }
 #endif
-
+*/
   cnt_.clear();
 }
@@ -182,5 +178,5 @@
   setStatus("add sector");
   setAttributes();
-  createSector();
+//  createSector();
 }
 
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_softwarePanel.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_softwarePanel.cc	(revision 454)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_softwarePanel.cc	(revision 455)
@@ -17,4 +17,5 @@
 #include "GWt_dialog.h"
 #include "GWt_console.h"
+#include "GWt_sector.h"
 #include "GWt_globalParameters.h"
 #include "GWt_sectionToExecute.h"
@@ -23,9 +24,9 @@
 #define BAVARD 0
 
-GWt_softwarePanel::GWt_softwarePanel(dataManager* dataManager,PspaApplication* pspa,WContainerWidget* parent)
-  : WContainerWidget(parent)
-{
-  dtmanage_ = dataManager;
-  pspa_ = pspa;
+GWt_softwarePanel::GWt_softwarePanel(dataManager* dataManager,GWt_sector* sect)
+  : WContainerWidget(),
+dtmanage_(dataManager),
+UIsector_(sect)
+{
   
   // bouton execute
@@ -51,4 +52,8 @@
 void GWt_softwarePanel::addSectionToExecuteW()
 {      
+  cout << "***********************************" << endl;
+  cout << "*  A rÃ©Ã©crire  *" << endl;
+  cout << "***********************************" << endl;
+  return;
 #if BAVARD > 0
   cout << "***********************************" << endl;
@@ -56,6 +61,6 @@
 #endif
 
-  abstractElement* premierElement;
-  abstractElement* dernierElement;
+  abstractElement* premierElement = NULL;
+  abstractElement* dernierElement = NULL;
 
   int premierIndex = 0;
@@ -63,5 +68,5 @@
   
   cout << "sections_.size() = " << sections_.size() << endl;
-
+/*
   // if there is no section
   if(sections_.size() == 0) {
@@ -87,5 +92,5 @@
   
   dtmanage_->addSectionToExecute(premierElement,premierIndex,dernierElement,dernierIndex,nomDeLogiciel());
-
+*/
   std::string premierElementLabel = "";
   std::string dernierElementLabel = "";
@@ -109,5 +114,5 @@
   fillComboWithSoftwares(softCombo);
 
-  GWt_sectionToExecute* newSection = new GWt_sectionToExecute(lineFromCombo,lineToCombo,softCombo,createAddDeletePushButtons(sections_.size()),this);
+  GWt_sectionToExecute* newSection = new GWt_sectionToExecute(lineFromCombo,lineToCombo,softCombo,createAddDeletePushButtons(sections_.size()),this,UIsector_);
 
   stringstream st;
@@ -165,5 +170,15 @@
   // traitement de la premiere ligne
   // on impose le depart du calcul au premier element
-  string premier = dtmanage_->getLabelFromElementNumero(1);
+  string premier = "";
+  if (UIsector_->getSectorControler()) {
+    if (UIsector_->getSectorControler()->getSectionsToExecute().size() > 0) {
+      if (UIsector_->getSectorControler()->getSectionsToExecute()[0]->getElements().size() > 0) {
+        premier = UIsector_->getSectorControler()->getSectionsToExecute()[0]->getElements()[0]->getLabel();
+      }
+    }
+  }
+  
+  // FIXME :  A rÃ©Ã©crire
+  /*
   if (sections_.size() > 0) {
     sections_[0]->setFirstElementCurrentSelection(premier);
@@ -235,5 +250,5 @@
     exec_go_->enable();
   }
-
+*/
   return true;
 }
@@ -241,4 +256,9 @@
 bool GWt_softwarePanel::areDataCoherent()
 {
+// FIXME
+  cout << "***********************************" << endl;
+  cout << "**  To be move in controler  **" << endl;
+  cout << "***********************************" << endl;
+  return true;
 #if BAVARD > 0
   cout << "***********************************" << endl;
@@ -247,5 +267,5 @@
 
   bool caMarche = true;
-
+/*
   // initialize dataManager
   dtmanage_->initializeExecution();
@@ -299,5 +319,5 @@
       sections_[a]->setWarnings(diagnosticWarnings);
     }//a
-    
+    */
   return caMarche;
 }
@@ -319,5 +339,5 @@
 
       // delete from dataManager
-      dtmanage_->clearSectionToExecute(sectionIndex);
+      UIsector_->getSectorControler()->clearSectionToExecute(sectionIndex);
 
       // delete from User Interface
@@ -352,10 +372,16 @@
   //  exec_go_->setDisabled(true);
   calculDialog.hide();  
-  pspa_->faireDessin();
+  UIsector_->getAccelerator()->faireDessin();
 }
 
 void GWt_softwarePanel::fillComboWithElements(Wt::WComboBox* cBox) 
 {
-  if (cBox == NULL) return;
+  // FIXME
+  cout << "***********************************" << endl;
+  cout << "**  To be move in controler  **" << endl;
+  cout << "***********************************" << endl;
+  return;
+
+/*  if (cBox == NULL) return;
 
   // get the last item selected
@@ -376,4 +402,5 @@
   }
   cBox->refresh();
+*/
 }
 
