Index: Interface_Web/trunk/pspaWT/sources/controler/include/particleBeam.h
===================================================================
--- Interface_Web/trunk/pspaWT/sources/controler/include/particleBeam.h	(revision 370)
+++ Interface_Web/trunk/pspaWT/sources/controler/include/particleBeam.h	(revision 371)
@@ -43,6 +43,7 @@
   unsigned indexFromPspaToTransport(unsigned index) const;
 
-  void preparationDesHistogrammes(int index,vector<double>& vshf,double out[3]);
-  void remplissageDesHistogrammes(double val[2],vector<double>vshf,vector<double>&xcor,vector<int>& hist,int& cnts);
+  void histogramComponent(vector<double>& coord,unsigned int index);
+  void histogramInitialize(unsigned int index,vector<double>& vshf,double out[3]);
+  void histogramPacking(double ecatyp,vector<double>vshf,vector<double>&xcor,vector<int>& hist);
 
   double getSigmaTransportij(unsigned indexI, unsigned indexJ);
@@ -112,6 +113,6 @@
   virtual string FileOutputFlow() const;
   virtual bool FileInput(ifstream& ifs);
-  //void histogramme(vector<double>&xcor,vector<int>& hist,int& cnts,double out[3]);
-  void histogramme(int index,vector<double>&xcor,vector<int>& hist,int& cnts,double out[3]);
+
+  void histogramme(unsigned int index,vector<double>&xcor,vector<int>& hist,double out[3]);
 };
 #endif
Index: Interface_Web/trunk/pspaWT/sources/controler/src/abstractElement.cc
===================================================================
--- Interface_Web/trunk/pspaWT/sources/controler/src/abstractElement.cc	(revision 370)
+++ Interface_Web/trunk/pspaWT/sources/controler/src/abstractElement.cc	(revision 371)
@@ -119,16 +119,17 @@
         tb = TBoolError;
     }
+
     if ((tb == TBoolOk) || (tb == TBoolIgnore)) {
-        if (prog == nomDeLogiciel::parmela){
-            abstractSoftware_ = new softwareParmela();
-        } else if (prog == nomDeLogiciel::transport) {
-            abstractSoftware_ = new softwareTransport();
-        } else if (prog == nomDeLogiciel::generator) {
-            abstractSoftware_ = new softwareGenerator();
-        } else if (prog == nomDeLogiciel::test) {
-            abstractSoftware_ = new softwareTest();
-        } else if (prog == nomDeLogiciel::unknownSoftware) {
-            abstractSoftware_ = NULL;
-        }
+      if (prog == nomDeLogiciel::parmela) {
+	abstractSoftware_ = new softwareParmela();
+      } else if (prog == nomDeLogiciel::transport) {
+	abstractSoftware_ = new softwareTransport();
+      } else if (prog == nomDeLogiciel::generator) {
+	abstractSoftware_ = new softwareGenerator();
+      } else if (prog == nomDeLogiciel::test) {
+	abstractSoftware_ = new softwareTest();
+      } else if (prog == nomDeLogiciel::unknownSoftware) {
+	abstractSoftware_ = NULL;
+      }
     }
     return tb;
Index: Interface_Web/trunk/pspaWT/sources/controler/src/dataManager.cc
===================================================================
--- Interface_Web/trunk/pspaWT/sources/controler/src/dataManager.cc	(revision 370)
+++ Interface_Web/trunk/pspaWT/sources/controler/src/dataManager.cc	(revision 371)
@@ -61,7 +61,6 @@
 abstractElement* dataManager::getElementPointerFromNumero(int k)
 {
-    return pspa_->getBeamLine()->getAbstractElement(k-1);
-}
-
+  return pspa_->getBeamLine()->getAbstractElement(k-1);
+}
 
 void dataManager::addSectionToExecute(int debut, int fin, nomDeLogiciel prog)
@@ -84,26 +83,23 @@
 
 
-
-
-
 void dataManager::initializeExecution()
 {
-    string workingDir = pspa_->getWorkingDir();
-    if (workingDir == "") {
-        return;
-    }
-    removeFile(workingDir + "parmdesz");
-    removeFile(workingDir + "parmin");
-    removeFile(workingDir + "parin.input0");
-    removeFile(workingDir + "transport.input");
-    removeFile(workingDir + "transport.output");
-    removeFile(workingDir + "generator.in");
-    removeFile(workingDir + "faisceau.ini");
-    removeFile(workingDir + "generator.output");
-    diagnosticBeam_.clear();
-    currentBeam_ = NULL;
-    firstComputedElemNumero_ = getBeamLineSize();
-    lastComputedElemNumero_ = 1;
-    clearSectionToExecute();
+  string workingDir = pspa_->getWorkingDir();
+  if (workingDir == "") {
+    return;
+  }
+  removeFile(workingDir + "parmdesz");
+  removeFile(workingDir + "parmin");
+  removeFile(workingDir + "parin.input0");
+  removeFile(workingDir + "transport.input");
+  removeFile(workingDir + "transport.output");
+  removeFile(workingDir + "generator.in");
+  removeFile(workingDir + "faisceau.ini");
+  removeFile(workingDir + "generator.output");
+  diagnosticBeam_.clear();
+  currentBeam_ = NULL;
+  firstComputedElemNumero_ = getBeamLineSize();
+  lastComputedElemNumero_ = 1;
+  clearSectionToExecute();
 }
 
@@ -120,55 +116,56 @@
 bool dataManager::executeAll()
 {
-    bool success = true;
-    abstractSoftware* softw = NULL;
-    string workingDir = pspa_->getWorkingDir();
-    
-    for(unsigned k = 0; k < jobList_.size(); k++)
+  bool success = true;
+  abstractSoftware* softw = NULL;
+  string workingDir = pspa_->getWorkingDir();
+  
+  for(unsigned k = 0; k < jobList_.size(); k++)
     {
-        cout << " dataManager::executeAll je m'apprete a executer : " << (jobList_[k]->software).getString() << endl;
+      cout << " dataManager::executeAll je m'apprete a executer : " << (jobList_[k]->software).getString() << endl;
+      
+      int debut = jobList_[k]->firstElement;
+      int fin = jobList_[k]->lastElement;
+      softw = createSoftwareConnexion(jobList_[k]->software);
+      
+      if (softw == NULL) {
+	success = false;
+	consoleMessage("dataManager::executeAll : unknown software");
+	break;
+      }
         
-        int debut = jobList_[k]->firstElement;
-        int fin = jobList_[k]->lastElement;
-        softw = createSoftwareConnexion(jobList_[k]->software);
+      success = softw->createInputFile(currentBeam_,debut,fin,workingDir);
+      if ( success ) {
+	success = softw->execute(debut,fin,workingDir);
+	if ( success ) {
+	  success = softw->buildBeamAfterElements(debut,fin,diagnosticBeam_,workingDir);
+	}
+      }
         
-        if (softw == NULL) {
-            success = false;
-            consoleMessage("dataManager::executeAll : unknown software");
-            break;
-        }
-        
-        success = softw->createInputFile(currentBeam_,debut,fin,workingDir);
-        if ( success ) {
-            success = softw->execute(debut,fin,workingDir);
-            if ( success ) {
-                success = softw->buildBeamAfterElements(debut,fin,diagnosticBeam_,workingDir);
-            }
-        }
-        
-        delete softw;
-        if ( success ) {
-            currentBeam_ = &diagnosticBeam_.back();
-            cout << " execute termine avec succes " << endl;
-        } else {
-            currentBeam_ = NULL;
-            cout << " execute termine en ECHEC " << endl;
-        }
-        if ( !success ) break;
-        
-
-	if ( debut < firstComputedElemNumero_ ) firstComputedElemNumero_ = debut;
-	if ( fin > lastComputedElemNumero_ ) lastComputedElemNumero_ = fin;
-
-        //debug
-        cout << "dataManager::executeAll #diagnosticBeam= " << diagnosticBeam_.size() << endl;
-        cout << "dataManager::executeAll #getBeamLineSize()= " << getBeamLineSize() << endl;
-        for (int j = debut; j <= fin; j++) {
-            abstractElement* elPtr= getElementPointerFromNumero(j);
-            cout << "[" << j << "] " << elPtr->getNomdElement().getElementName() << endl;
-        }
-        
+      delete softw;
+      if ( success ) {
+	currentBeam_ = &diagnosticBeam_.back();
+	cout << " execute termine avec succes " << endl;
+      } else {
+	currentBeam_ = NULL;
+	cout << " execute termine en ECHEC " << endl;
+      }
+      if ( !success ) break;
+      
+      
+      if ( debut < firstComputedElemNumero_ ) firstComputedElemNumero_ = debut;
+      if ( fin > lastComputedElemNumero_ ) lastComputedElemNumero_ = fin;
+      
+      //debug
+      cout << "dataManager::executeAll #diagnosticBeam= " << diagnosticBeam_.size() << endl;
+      cout << "dataManager::executeAll #getBeamLineSize()= " << getBeamLineSize() << endl;
+      for (int j = debut; j <= fin; j++) {
+	abstractElement* elPtr= getElementPointerFromNumero(j);
+	cout << "[" << j << "] " << elPtr->getNomdElement().getElementName() << endl;
+      }
     } //k
-    cout << " dataManager::executeAll premier element : " << firstComputedElemNumero_ << " dernier : " << lastComputedElemNumero_ << endl;
-    return success;
+  
+  cout << " dataManager::executeAll premier element : " << firstComputedElemNumero_ << " dernier : " << lastComputedElemNumero_ << endl;
+  
+  return success;
 }
 
Index: Interface_Web/trunk/pspaWT/sources/controler/src/particleBeam.cc
===================================================================
--- Interface_Web/trunk/pspaWT/sources/controler/src/particleBeam.cc	(revision 370)
+++ Interface_Web/trunk/pspaWT/sources/controler/src/particleBeam.cc	(revision 371)
@@ -350,6 +350,8 @@
 }
 
-void particleBeam::particlesPhaseSpaceComponent(vector<double>& coord, unsigned index) {
+void particleBeam::particlesPhaseSpaceComponent(vector<double>& coord, unsigned index) 
+{
   if ( !particleRepresentationOk_ ) return;
+  
   coord.clear();
   coord.resize(goodPartic_.size(), 0.0 );
@@ -527,30 +529,60 @@
 }
 
-void particleBeam::histogramme(int iabs,vector<double>&xcor,vector<int>& hist,int& cnts,double out[3])
-{ 
+void particleBeam::histogramme(unsigned int iabs,vector<double>&xcor,vector<int>& hist,double out[3])
+{
   vector<double> vshf;
-  preparationDesHistogrammes(iabs,vshf,out);
- 
-  double val[2];
-  if(iabs < 3) {
-     val[0] = 100.0;
-     val[1] = out[2];
-   } else {
-     val[0] = out[1];
-     val[1] = out[2];
-   }
-  remplissageDesHistogrammes(val,vshf,xcor,hist,cnts);
-
-  // sortie pour la legende: out[0]= entries, out[1]= mean, out[2]= std deviation
-  if(iabs < 3) {
-    out[1] *= 1.0 ; // en m ?
-    out[2] *= 1000.0; //mm
-  } else {
-    out[1] *= EREST_MeV ; //MeV
-    out[2] *= EREST_keV; //KeV
-  }
-}
-
-void particleBeam::preparationDesHistogrammes(int index,vector<double>& vshf,double out[3])
+  histogramComponent(vshf,iabs);
+  histogramInitialize(iabs,vshf,out);
+  histogramPacking(out[2],vshf,xcor,hist);
+
+  // out[0]= nbre de particules, out[1]= moyenne, out[2]= ecart-type
+  if(iabs == 0 || iabs == 1 || iabs == 2) {
+    out[2] *= 1000.0; // ecart-type en mm
+  }
+
+  if(iabs == 5) {
+    for (unsigned int i = 0; i <= xcor.size(); ++i) {
+      xcor[i] = 100.*xcor[i]/out[1]; // en %
+    }
+    out[1] *= EREST_MeV; // moyenne en MeV
+    out[2] *= EREST_keV; // ecart-type en KeV
+  }
+}
+
+void particleBeam::histogramComponent(vector<double>& coord,unsigned int index) 
+{  
+  coord.clear();
+  coord.resize(goodPartic_.size(),0.0);
+  
+  if(index == 0 || index == 1 || index == 2) 
+    {
+      // collecte d'une coordonnee x(index= 0), y(index= 1) ou z(index= 2) des particules
+      for (unsigned int k = 0; k < goodPartic_.size(); k++) {
+	coord.at(k) = goodPartic_.at(k).getPosition().getComponent(index);
+      }
+    }
+
+  if(index == 3 || index == 4)
+    {
+      // collecte de begamx (index= 3), begamy (index= 4)
+      for (unsigned int k = 0; k < goodPartic_.size(); k++) {
+	double begamz = goodPartic_.at(k).getBetaGamma().getComponent(2);
+	if (begamz == 0.0) continue;
+	double begam = goodPartic_.at(k).getBetaGamma().getComponent(index-3);
+	coord.at(k) = 1000.0*begam/begamz;  //pi.mm.mradians
+      }
+    }
+  
+  if(index == 5)
+    {
+      // collecte de l'energie acquise par les particules
+      for (unsigned int k = 0; k < goodPartic_.size(); k++) {
+	double gamma = goodPartic_.at(k).getGamma();
+	coord.at(k) = gamma-1.0;
+      }
+    }
+}
+
+void particleBeam::histogramInitialize(unsigned int index,vector<double>& vshf,double out[3])
 {
   double vmin= GRAND;
@@ -558,51 +590,36 @@
   double vmoy= 0.0;
   double ecatyp= 0.0;
+  
+  for (unsigned int k = 0; k < goodPartic_.size(); k++) {
+    if (vshf[k] < vmin) vmin = vshf[k];
+    else if (vshf[k] > vmax) vmax = vshf[k];
+    vmoy += vshf[k];
+    ecatyp += vshf[k]*vshf[k];
+  }
 
   double sum= (float)goodPartic_.size();
-  if(index < 3) 
-    {
-      // collecte d'une coordonnee x(index= 0), y(index= 1) ou z(index= 2) des particules
-      for (unsigned int k = 0; k < goodPartic_.size(); k++) {
-	double val = goodPartic_.at(k).getPosition().getComponent(index);
-	if (val < vmin) vmin = val;
-	else if (val > vmax) vmax = val;
-	vmoy += val;
-	ecatyp += val*val;
-      }
-
-      out[0]= sum;
-      vmoy /= sum;
-      out[1]= vmoy;
-      ecatyp /= sum;
-      ecatyp = sqrt(abs(ecatyp-vmoy*vmoy));
-      out[2]= ecatyp;
-    } 
-  else 
-    {
-      // collecte de l'energie acquise par les particules
-      for (unsigned int k = 0; k < goodPartic_.size(); k++) {
-	double gamma = goodPartic_.at(k).getGamma();
-	if (gamma < vmin) vmin = gamma;
-	else if (gamma > vmax) vmax = gamma;
-	double val = gamma-1.0;
-	vmoy += val;
-	ecatyp += val*val;
-      }
-      
-      out[0]= sum;
-      vmoy /= sum;
-      out[1]= vmoy;
-      ecatyp /= sum;
-      ecatyp = sqrt(abs(ecatyp-vmoy*vmoy));
-      out[2]= ecatyp;
-    }
-  
+  out[0]= sum; 
+  vmoy /= sum;
+  out[1]= vmoy;
+  ecatyp /= sum;
+  ecatyp = sqrt(abs(ecatyp-vmoy*vmoy));
+  out[2]= ecatyp;
+
   if(index == 0) {
-    cout << "position X -moyenne " << vmoy << " m " << "-mini " << vmin << " m " << "-maxi " << vmax << " m " << "ecart type " << ecatyp*1000.0 << " mm" << endl;
-  } else if(index == 1) {
-    cout << "position Y -moyenne " << vmoy << " m " << "-mini " << vmin << " m " << "-maxi " << vmax << " m " << "ecart type " << ecatyp*1000.0 << " mm" << endl;
-  } else if(index == 2) {
-    cout << "position Z -moyenne " << vmoy << " m " << "-mini " << vmin << " m " << "-maxi " << vmax << " m " << "ecart type " << ecatyp*1000.0 << " mm" << endl;
-  } else {
+    cout << "position x -moyenne " << vmoy << " m " << "-mini " << vmin << " m " << "-maxi " << vmax << " m " << "ecart type " << ecatyp*1000.0 << " mm" << endl;
+  } 
+  if(index == 1) {
+    cout << "position y -moyenne " << vmoy << " m " << "-mini " << vmin << " m " << "-maxi " << vmax << " m " << "ecart type " << ecatyp*1000.0 << " mm" << endl;
+  } 
+  if(index == 2) {
+    cout << "position z -moyenne " << vmoy << " m " << "-mini " << vmin << " m " << "-maxi " << vmax << " m " << "ecart type " << ecatyp*1000.0 << " mm" << endl;
+  }
+  if(index == 3) {
+    cout << "divergence xp -moyenne " << vmoy << " pi.mm.mrad " << "-mini " << vmin << " pi.mm.mrad " << "-maxi " << vmax << " pi.mm.mrad " << "ecart type " << ecatyp << " pi.mm.mrad" << endl;
+  } 
+  if(index == 4) {
+    cout << "divergence yp -moyenne " << vmoy << " pi.mm.mrad " << "-mini " << vmin << " pi.mm.mrad " << "-maxi " << vmax << " pi.mm.mrad " << "ecart type " << ecatyp << " pi.mm.mrad" << endl;
+  } 
+  if(index == 5) {
     double gmin = vmin-1.0;
     double gmax = vmax-1.0;
@@ -610,37 +627,11 @@
   }
 
-  //pouVoir: autre maniere de calculer l'ecart-type
-  double stdev= 0.0;
-
-  if(!vshf.empty()) vshf.clear();
-  vshf.resize(goodPartic_.size());  
-  if(index < 3) 
-    {
-      for (unsigned int k = 0; k < goodPartic_.size(); k++) {
-	double val = goodPartic_.at(k).getPosition().getComponent(index);
-	vshf[k]= val-vmoy;
-	stdev += vshf[k]*vshf[k];
-      }
-    } 
-  else 
-    {
-      for (unsigned int k = 0; k < goodPartic_.size(); k++) {
-	double gamma = goodPartic_.at(k).getGamma();
-	double val = gamma-1.0;
-	vshf[k]= val-vmoy;
-	stdev += vshf[k]*vshf[k];
-      }
-    }
-
-  stdev /= sum;
-  stdev = sqrt(stdev);
-  cout << "stdev " << stdev << ", ecatyp " << ecatyp << ", diff " << stdev-ecatyp << endl;
-}
-
-void particleBeam::remplissageDesHistogrammes(double val[2],vector<double>vshf,vector<double>&xcor,vector<int>& hist,int& cnts)
+  for (unsigned int k = 0; k < goodPartic_.size(); k++) {
+    vshf[k] -= vmoy;
+  }
+}
+
+void particleBeam::histogramPacking(double ecatyp,vector<double>vshf,vector<double>&xcor,vector<int>& hist)
 {
-  double vmoy  = val[0];
-  double ecatyp= val[1];
-
   // demi fenetre hfene= max(3.*ecatyp-vmoy,vmoy-3.*ecatyp);
   double hfene= 3.*ecatyp;
@@ -661,24 +652,17 @@
   double vmax= vmin+hpas*ihist;
   
-  cout << "'xAxisNumberOfBins= " << ihist <<", xAxisMinimum= " << vmin << ", xAxisMaximum= " << vmax << ", NParticules= " << vshf.size() << ", phist " << phist << endl;
-
+  cout << "xAxisNumberOfBins= " << ihist <<", xAxisMinimum= " << vmin << ", xAxisMaximum= " << vmax << ", NParticules= " << vshf.size() << ", phist " << phist << endl;
+  
   if(!xcor.empty()) xcor.clear();
- 
-  // pourVoir /////////////////////////////////////
-  // xcor.resize(ihist);  
-  // for (int i = 0; i < ihist; ++i) {
-  //   // on gradue l'abscisse en pourcents
-  //   xcor[i]= 100.*( vmin+i*hpas )/vmoy;
-  // }
-
   xcor.resize(ihist+1);  
   for (int i = 0; i <= ihist; ++i) {
-    xcor[i]= 100.*( vmin+i*hpas )/vmoy;
-  }
+    xcor[i] = vmin+i*hpas;
+  }
+
   /////////////////////////////////////
 
   if(!hist.empty()) hist.clear();
   hist.resize(ihist,0);  
-  for (unsigned i = 0; i < vshf.size(); ++i) {
+  for (unsigned int i = 0; i < vshf.size(); ++i) {
     double var= vshf[i]-vmin;
     if(var < 0 ) {
@@ -695,117 +679,4 @@
     hist[kk]++;
   }
-
-  cnts= 0;
-  for (int i = 0; i < ihist; ++i) {
-    if(hist.at(i) > 0) cnts++;
-  }
-  cout<< " ... cnts=  " << cnts << endl;
-}
-
-// void particleBeam::histogramme(vector<double>&xcor,vector<int>& hist,int& cnts,double out[3])
-// {
-//   // sortie pour la legende: out[0]= entries, out[1]= mean, out[2]= rms
-
-//   // on calcule avec les gammas ; les MeV c'est pour les sorties
-
-//   double gammin= GRAND;
-//   double gammax= -gammin;
-//   //  double Emoy= 0.0;
-//   double ecatyp= 0.0;
-//   double gmoy=0.0;
-//   for (unsigned int k = 0; k < goodPartic_.size(); k++)
-//     {
-//       double gamma = goodPartic_.at(k).getGamma();
-//       //      double EMev = (gamma-1.0)*ERESTMeV;
-//       if (gamma < gammin) gammin = gamma;
-//       else if (gamma > gammax) gammax = gamma;
-//       //      Emoy += EMev;
-//       double g = gamma-1.0;
-//       gmoy += g;
-//       //      ecatyp += EMev*EMev;
-//       ecatyp += g*g;
-//     }
-
-//   double sum= (float)goodPartic_.size();
-//   out[0]= sum;
-//   //  Emoy /= sum;
-//   gmoy /= sum;
-//   //  out[1]= Emoy; //MeV
-//   out[1]= gmoy*EREST_MeV ; //MeV
-//   ecatyp /= sum;
-//   //  out[2]= 1000.0*sqrt(ecatyp); //KeV
-//   //  ecatyp = sqrt(abs(ecatyp-Emoy*Emoy));
-
-//   ecatyp = sqrt(abs(ecatyp-gmoy*gmoy));
-//   out[2]= ecatyp*EREST_keV; //KeV
-
-//   double gmin = gammin-1.0;
-//   double gmax = gammax-1.0;
-//   cout << "energie cinetique -moyenne " << gmoy*EREST_MeV << " Mev " << "-mini " << gmin*EREST_MeV << " Mev " << "-maxi " << gmax*EREST_MeV << " Mev " << "ecart type " << ecatyp*EREST_keV << " Kev" << endl;
-
-//   vector<double> Eshf;
-//   for (unsigned int k = 0; k < goodPartic_.size(); k++)
-//     {
-//       double gamma = goodPartic_.at(k).getGamma();
-//       // double EMev = (gamma-1.0)*ERESTMeV;
-//       // Eshf.push_back(EMev-Emoy);
-//       // modif glm 2/03/2013
-//       double g = (gamma-1.0);
-//       Eshf.push_back( (g-gmoy) );
-//     }
-
-//   //////////////////////////////////////////////////////////////////////////////
-  
-//   // demi fenetre en energie, et pas de l'histogramme
-//   //  double hfene= max(3.*ecatyp-Emoy,Emoy-3.*ecatyp);
-//   double hfene= 3.*ecatyp;
-//   double hpas = hfene/25.;
-
-//   cout << "demi fenetre " << hfene << ", hpas= " << hpas << endl;
-
-//   double vmin = -hfene;
-//   double dfen = 2.*hfene;
-//   int ihist = dfen/hpas;
-//   double phist = ihist*hpas;
-//   double dpas = hpas-(dfen-phist);
-//   if(dpas <= hpas*1.e-03) {
-//     ihist++;
-//     phist= ihist*hpas;
-//   }
-//   double vmax= vmin+hpas*ihist;
-  
-//   cout << "'xAxisNumberOfBins= " << ihist <<", xAxisMinimum= " << vmin << ", xAxisMaximum= " << vmax << ", NParticules= " << Eshf.size() << ", phist " << phist << endl;
-
-//   xcor= vector<double>(ihist);
-//   for (int i = 0; i < ihist; ++i) {
-
-//     // on gradue l'abscisse en pourcents
-//     //   xcor[i]= 100.*( vmin+i*hpas );
-//     xcor[i]= 100.*( vmin+i*hpas )/gmoy;
-//   }
-
-//   hist= vector<int>(ihist,0);
-//   for (unsigned i = 0; i < Eshf.size(); ++i) {
-//     double var= Eshf[i]-vmin;
-//     //    if(var < 0 || var >= phist) cout<<"out of range "<<var<<", ("<< i<<")"<< endl;
-//     if(var < 0 ) {
-//       cout<<"lesser that the minimum "<<var<<", ("<< i<<")"<< endl;
-//       hist[0]++;
-//     }
-//     if(var >= phist) {
-//       cout<<"greater that the maximum "<<var<<", ("<< i<<")"<< endl;
-//       hist[ihist-1]++;
-//     }
-//     //    int k= var/hpas;
-//     int kk= (int)floor(var/hpas);
-//     //if(i%20 == 0) cout<<"v("<<i<<")= " <<var<<" ["<<k<<"-"<<kk<<"], "<<endl; 
-//     hist[kk]++;
-//   }
-
-//   cnts= 0;
-//   for (int i = 0; i < ihist; ++i) {
-//     if(hist.at(i) > 0) cnts++;
-//     //cout<<"("<<xcor.at(i)<<","<<hist.at(i)<<") ";
-//   }
-//   cout<< " ... cnts=  " << cnts << endl;
-// }
+}
+
Index: Interface_Web/trunk/pspaWT/sources/controler/src/softwareParmela.cc
===================================================================
--- Interface_Web/trunk/pspaWT/sources/controler/src/softwareParmela.cc	(revision 370)
+++ Interface_Web/trunk/pspaWT/sources/controler/src/softwareParmela.cc	(revision 371)
@@ -15,152 +15,152 @@
 bool softwareParmela::createInputFile(particleBeam* beamBefore,unsigned int numeroDeb,unsigned int numeroFin,string workingDir)
 {
-    unsigned int k;
-    
-    if ( numeroDeb < 1 || numeroFin > dataManager_->getBeamLineSize() ) {
-        dataManager_->consoleMessage(" softwareParmela::createInputFile : numero of element out of limits " );
-        cerr << " numero of element out of limits " << endl;
-        return false;
-    }
-    
-    string name = workingDir + inputFileName_;
-    ofstream outfile;
-    outfile.open(name.c_str(), ios::out);
-    if (!outfile) {
-        dataManager_->consoleMessage(" softwareParmela::createInputFile : error opening output stream " );
-        cerr << " softwareParmela::createInputFile : error opening output stream " << name << endl;
-        return false;
-    }
-    
-    abstractElement* elPtr;
-    double initalKineticEnergy = 0.0;
-    elPtr = dataManager_->getElementPointerFromNumero(numeroDeb);
-    bool there_is_rfgun = ( elPtr->getNomdElement().getElementType() == RFgun );
-    
-    if ( !there_is_rfgun ) {
-        string nameOfInput = workingDir + "parin.input0";
-        if ( !beamToParmela(nameOfInput,beamBefore) ) return false;
-        initalKineticEnergy = beamBefore->referenceKineticEnergyMeV();
-        // les elements de parmela sont indexes de 1 Ã  max, s'il n'y a pas de rfgun
-        offsetNumElem_ = numeroDeb -1;
-    } else {
-        elPtr->setPhaseStep( globParamPtr_->getIntegrationStep() );
-        initalKineticEnergy = elPtr->getInitialKineticEnergy();
-        // les elements de parmela sont indexes de 0 Ã  max, s'il y a un rfgun
-        offsetNumElem_ = numeroDeb;
-    }
-    
-    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 << "OUTPUT 0" << endl;
-    unsigned int premier = numeroDeb ;
-    if ( there_is_rfgun ) {
-        outfile << dataManager_->getElementPointerFromNumero(numeroDeb)->parmelaOutputFlow() << endl;
-        premier++;
-    } else {
-        outfile << "INPUT 0 /NP=" << beamBefore->getNbParticles() << endl;
-    }
-    
-    // commentaire :  si l'element est un snapshot ne rien ecrire dans inputFileName_ (= parmin) un saut de ligne perturbe l'execution de parmela
-    for ( k = premier; k <= numeroFin; k++)
-    {
-        elPtr = dataManager_->getElementPointerFromNumero(k);
-        if (elPtr) {
-            if(elPtr->getNomdElement().getElementType() == snapshot) continue;
-            outfile << elPtr->parmelaOutputFlow() << endl;
-        }
-    }
-    
-    outfile << "ZOUT" << endl;
-    outfile << "START /wt=0.0 /dwt=" << globParamPtr_->getIntegrationStep() << "  /nsteps=" << globParamPtr_->getNbSteps() << "  nsc=" << globParamPtr_->getScPeriod() << "  /nout=10" << endl;
-    outfile << "END" << endl;
-    outfile.close();
-    dataManager_->consoleMessage("fichier input termine pour PARMELA");
-    return true;
+  unsigned int k;
+    
+  if ( numeroDeb < 1 || numeroFin > dataManager_->getBeamLineSize() ) {
+    dataManager_->consoleMessage(" softwareParmela::createInputFile : numero of element out of limits " );
+    cerr << " numero of element out of limits " << endl;
+    return false;
+  }
+    
+  string name = workingDir + inputFileName_;
+  ofstream outfile;
+  outfile.open(name.c_str(), ios::out);
+  if (!outfile) {
+    dataManager_->consoleMessage(" softwareParmela::createInputFile : error opening output stream " );
+    cerr << " softwareParmela::createInputFile : error opening output stream " << name << endl;
+    return false;
+  }
+  
+  abstractElement* elPtr;
+  double initalKineticEnergy = 0.0;
+  elPtr = dataManager_->getElementPointerFromNumero(numeroDeb);
+  bool there_is_rfgun = ( elPtr->getNomdElement().getElementType() == RFgun );
+  
+  if ( !there_is_rfgun ) {
+    string nameOfInput = workingDir + "parin.input0";
+    if ( !beamToParmela(nameOfInput,beamBefore) ) return false;
+    initalKineticEnergy = beamBefore->referenceKineticEnergyMeV();
+    // les elements de parmela sont indexes de 1 Ã  max, s'il n'y a pas de rfgun
+    offsetNumElem_ = numeroDeb -1;
+  } else {
+    elPtr->setPhaseStep( globParamPtr_->getIntegrationStep() );
+    initalKineticEnergy = elPtr->getInitialKineticEnergy();
+    // les elements de parmela sont indexes de 0 Ã  max, s'il y a un rfgun
+    offsetNumElem_ = numeroDeb;
+  }
+  
+  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 << "OUTPUT 0" << endl;
+  unsigned int premier = numeroDeb ;
+  if ( there_is_rfgun ) {
+    outfile << dataManager_->getElementPointerFromNumero(numeroDeb)->parmelaOutputFlow() << endl;
+    premier++;
+  } else {
+    outfile << "INPUT 0 /NP=" << beamBefore->getNbParticles() << endl;
+  }
+  
+  // commentaire :  si l'element est un snapshot ne rien ecrire dans inputFileName_ (= parmin) un saut de ligne perturbe l'execution de parmela
+  for ( k = premier; k <= numeroFin; k++)
+    {
+      elPtr = dataManager_->getElementPointerFromNumero(k);
+      if (elPtr) {
+	if(elPtr->getNomdElement().getElementType() == snapshot) continue;
+	outfile << elPtr->parmelaOutputFlow() << endl;
+      }
+    }
+    
+  outfile << "ZOUT" << endl;
+  outfile << "START /wt=0.0 /dwt=" << globParamPtr_->getIntegrationStep() << "  /nsteps=" << globParamPtr_->getNbSteps() << "  nsc=" << globParamPtr_->getScPeriod() << "  /nout=10" << endl;
+  outfile << "END" << endl;
+  outfile.close();
+  dataManager_->consoleMessage("fichier input termine pour PARMELA");
+  return true;
 }
 
 bool softwareParmela::execute(unsigned int numeroDeb,unsigned int numeroFin,string workingDir)
 {
-    bool ExecuteStatus = true;
-    
-    ostringstream sortie;
-    sortie << " EXECUTION DE PARMELA DE l'ELEMENT " << numeroDeb << " A L'ELEMENT " << numeroFin << endl;
-    
-    string parmelaJob = workingDir + "parmela";
-    parmelaJob += string("   ");
-    parmelaJob += workingDir;
-    
-    string resultOfRun;
-    bool success = launchJob(parmelaJob,resultOfRun);
-    sortie << resultOfRun << endl;
-    if ( !success ) {
-        sortie << " launching of parmela failed " << endl;
-        ExecuteStatus = false;
-    } else {
-        sortie << " successful launching of parmela " << endl;
-        cout << " execution parmela MARCHE " << endl;
-        string::size_type nn = (resultOfRun).find("normal");
-        if ( nn == string::npos )
+  bool ExecuteStatus = true;
+  
+  ostringstream sortie;
+  sortie << " EXECUTION DE PARMELA DE l'ELEMENT " << numeroDeb << " A L'ELEMENT " << numeroFin << endl;
+    
+  string parmelaJob = workingDir + "parmela";
+  parmelaJob += string("   ");
+  parmelaJob += workingDir;
+  
+  string resultOfRun;
+  bool success = launchJob(parmelaJob,resultOfRun);
+  sortie << resultOfRun << endl;
+  if ( !success ) {
+    sortie << " launching of parmela failed " << endl;
+    ExecuteStatus = false;
+  } else {
+    sortie << " successful launching of parmela " << endl;
+    cout << " execution parmela MARCHE " << endl;
+    string::size_type nn = (resultOfRun).find("normal");
+    if ( nn == string::npos )
+      {
+	sortie << " abnormal exit of parmela " << endl;
+	ExecuteStatus = false;
+      }
+  }
+  
+  dataManager_->consoleMessage(sortie.str());
+  return ExecuteStatus;
+}
+
+bool softwareParmela::buildBeamAfterElements(unsigned int numeroDeb,unsigned int numeroFin, vector<particleBeam>& beams, string workingDir)
+{
+  bool result = true;
+  cout << "debug:: debut " << numeroDeb << ", fin " << numeroFin << endl;
+  
+  // index du premier element de parmela
+  int id= numeroDeb-offsetNumElem_;
+  
+  for(unsigned k = numeroDeb; k <= numeroFin; k++)
+    {
+      abstractElement* elem = dataManager_->getElementPointerFromNumero(k);
+      
+      // si l'element est un snapshot, recuperer la sortie precedente
+      if(elem->getNomdElement().getElementType() == snapshot) {
+	int avantDernier = beams.size() - 1;
+	string* param = elem->getParametersString();
+	string cliche = workingDir + param[2].c_str();
+	if( beamToParmela(cliche,&beams.at(avantDernier)) ) {
+	  cout<<"["<<k<<"] : ecrit sur fichier " << cliche << " le contenu de beam["<<avantDernier<<"]"<<endl;
+	}
+	continue;
+      }
+      
+      // sinon c'est un element de parmela d'index id
+      beams.push_back(particleBeam());
+      cout << " creation diagn. no " << beams.size() << " par PARMELA " << endl;
+      vector<double> centroid;
+      bareParticle refPart;
+      vector<bareParticle> particles;
+      double freq= globParamPtr_->getFrequency();
+      
+      if(!beamFromParmela(workingDir,id,freq,centroid,refPart,particles))
         {
-            sortie << " abnormal exit of parmela " << endl;
-            ExecuteStatus = false;
-        }
-    }
-    
-    dataManager_->consoleMessage(sortie.str());
-    return ExecuteStatus;
-}
-
-bool softwareParmela::buildBeamAfterElements(unsigned int numeroDeb,unsigned int numeroFin, vector<particleBeam>& beams, string workingDir)
-{
-    bool result = true;
-    cout << "debug:: debut " << numeroDeb << ", fin " << numeroFin << endl;
-    
-    // index du premier element de parmela
-    int id= numeroDeb-offsetNumElem_;
-    
-    for(unsigned k = numeroDeb; k <= numeroFin; k++)
-    {
-        abstractElement* elem = dataManager_->getElementPointerFromNumero(k);
-        
-        // si l'element est un snapshot, recuperer la sortie precedente
-        if(elem->getNomdElement().getElementType() == snapshot) {
-            int avantDernier = beams.size() - 1;
-            string* param = elem->getParametersString();
-            string cliche = workingDir + param[2].c_str();
-            if( beamToParmela(cliche,&beams.at(avantDernier)) ) {
-                cout<<"["<<k<<"] : ecrit sur fichier " << cliche << " le contenu de beam["<<avantDernier<<"]"<<endl;
-            }
-            continue;
-        }
-        
-        // sinon c'est un element de parmela d'index id
-        beams.push_back(particleBeam());
-        cout << " creation diagn. no " << beams.size() << " par PARMELA " << endl;
-        vector<double> centroid;
-        bareParticle refPart;
-        vector<bareParticle> particles;
-        double freq= globParamPtr_->getFrequency();
-        
-        if(!beamFromParmela(workingDir,id,freq,centroid,refPart,particles))
-        {
-            if(elem->is_accepted_by_software(nomDeLogiciel::parmela) == TBoolIgnore) {
-                int avantDernier = beams.size() -2;
-                beams.back() = beams.at(avantDernier);
-            } else {
-                dataManager_->consoleMessage("softwareParmela::buildBeamAfterElements : reading parmdesz failed");
-                result = false;
-                break;
-            }
-            
+	  if(elem->is_accepted_by_software(nomDeLogiciel::parmela) == TBoolIgnore) {
+	    int avantDernier = beams.size() -2;
+	    beams.back() = beams.at(avantDernier);
+	  } else {
+	    dataManager_->consoleMessage("softwareParmela::buildBeamAfterElements : reading parmdesz failed");
+	    result = false;
+	    break;
+	  }
+          
         } else {
-            beams.back().setWithParticles(centroid,refPart,particles);
-        }
-        
-        // l'element de parmela suivant
-        id++;
-    }
-    
-    return result;
+	beams.back().setWithParticles(centroid,refPart,particles);
+      }
+      
+      // l'element de parmela suivant
+      id++;
+    }
+  
+  return result;
 }
 
Index: Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc
===================================================================
--- Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc	(revision 370)
+++ Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc	(revision 371)
@@ -277,6 +277,8 @@
   choixVariableHisto_->addItem("y");
   choixVariableHisto_->addItem("z");
+  choixVariableHisto_->addItem("xp");
+  choixVariableHisto_->addItem("yp");
   choixVariableHisto_->addItem("dE/E");
-  choixVariableHisto_->setCurrentIndex(3);
+  choixVariableHisto_->setCurrentIndex(5);
 
   choixHistoDessin_ = new WComboBox();
@@ -286,5 +288,4 @@
   glayout->addWidget(button3,3,1);
   glayout->addWidget(choixHistoDessin_,3,2);
-  //  glayout->addWidget(new WText(" of "),3,3);
   glayout->addWidget(choixVariableHisto_,3,3);
   /////////////////////////////////////////////////////////////////////
@@ -600,16 +601,13 @@
   vector<string> legende;
   beam->donneesDessinEllipse(xcor,ycor,legende, indexAbs, indexOrd);
-  unsigned k;
+
   for (int k=0 ; k < legende.size(); k++) {
-  new WBreak(ellipseDialog->contents());
+    new WBreak(ellipseDialog->contents());
     new WText(legende.at(k), ellipseDialog->contents());
   }
   //  beam->donneesDessinEllipseXxp(xcor,ycor);
   //  scatterPlot1D(ellipseDialog->contents(),xcor,ycor);  
-chartPlot2vec(ellipseDialog->contents(), xcor, ycor, false,500,300);
-
-}
-
-
+  chartPlot2vec(ellipseDialog->contents(), xcor, ycor, false,500,300);
+}
 
 // void PspaApplication::scatterPlot1D(WContainerWidget* toto, vector<double>& xcor, vector<double>& ycor)
@@ -844,10 +842,8 @@
   vector<double> xcor;
   vector<int> hist;
-  int cnts;
   double out[3]= {0.0};
 
   unsigned iabs= choixVariableHisto_->currentIndex();  
-  string xname= choixVariableHisto_->currentText().toUTF8();
-  beam->histogramme(iabs,xcor,hist,cnts,out);
+  beam->histogramme(iabs,xcor,hist,out);
 
   cout<<"xcor.size()= "<<xcor.size()<<", hist.size()= "<<hist.size()<<endl;
@@ -918,28 +914,30 @@
   
   // legendes
+  string unites[2];
+  if(iabs == 0 || iabs == 1 || iabs == 2) {
+    unites[0]= " m"; unites[1]= " mm";
+  }
+  if(iabs == 3 || iabs == 4) {
+    unites[0]= unites[1]= " pi.mm.mrad";
+  }
+  if(iabs == 5) {
+    unites[0]= " MeV"; unites[1]= " KeV";
+  }
+
   new WText(" entries : "+ mixedTools::intToString((int)out[0]),w);
   new WBreak(w);
-  if(iabs < 3) {
-    new WText(" mean : "+ mixedTools::doubleToString(out[1])+" m",w);
-    new WBreak(w);
-    new WText(" sigma rms : "+ mixedTools::doubleToString(1000.0*out[2])+" mm",w);
-  } else {
-    new WText(" mean : "+ mixedTools::doubleToString(out[1])+" MeV",w);
-    new WBreak(w);
-    new WText(" sigma rms : "+ mixedTools::doubleToString(out[2])+" KeV",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);
+    
   WCartesianChart *chart = new WCartesianChart(w);
 
-  if(iabs == 0) {
-    chart->setTitle("Histogram of particle x-coordinate");
-  } else if(iabs == 1) {
-    chart->setTitle("Histogram of particle y-coordinate");
-  } else if(iabs == 2) {
-    chart->setTitle("Histogram of particle z-coordinate");
-  } else {
-    chart->setTitle("Histogram of kinetic energy");
-  }
-
+  if(iabs == 0) chart->setTitle("Histogram of x-coordinate");
+  if(iabs == 1) chart->setTitle("Histogram of y-coordinate");
+  if(iabs == 2) chart->setTitle("Histogram of z-coordinate");
+  if(iabs == 3) chart->setTitle("Histogram of xp- ??? ");
+  if(iabs == 4) chart->setTitle("Histogram of yp- ???");
+  if(iabs == 5) chart->setTitle("Histogram of kinetic energy");
+  
   chart->setModel(model);        // set the model
   chart->setXSeriesColumn(0);    // set the column that holds the categories
@@ -957,6 +955,6 @@
   axis.setGridLinesEnabled(true);
 
-  if(iabs < 3) {
-    axis.setTitle(WString(" ??? (%)"));
+  if(iabs < 5) {
+    axis.setTitle(WString(" ???"));
   } else {
     axis.setTitle(WString(" dEcin/Ecin (%)"));
Index: Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_softwarePanel.cc
===================================================================
--- Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_softwarePanel.cc	(revision 370)
+++ Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_softwarePanel.cc	(revision 371)
@@ -264,55 +264,55 @@
 bool GWt_softwarePanel::areDataCoherent()
 {
-    bool caMarche = true;
-    trivaluedBool tbResume = TBoolOk;
-    dtmanage_->initializeExecution();
-    string diagnostic;
-    
-    list<GWt_sectionToExecute*>::iterator itr;
-    for(itr = selectedSections_.begin(); itr != selectedSections_.end(); itr++)
+  bool caMarche = true;
+  trivaluedBool tbResume = TBoolOk;
+  dtmanage_->initializeExecution();
+  string diagnostic;
+    
+  list<GWt_sectionToExecute*>::iterator itr;
+  for(itr = selectedSections_.begin(); itr != selectedSections_.end(); itr++)
     {
-        string debString = (*itr)->debut->text().toUTF8();
-        string finString = (*itr)->fin->text().toUTF8();
+      string debString = (*itr)->debut->text().toUTF8();
+      string finString = (*itr)->fin->text().toUTF8();
+      
+      int debut = dtmanage_->getNumeroFromElementLabel(debString);
+      int fin = dtmanage_->getNumeroFromElementLabel(finString);
+      nomDeLogiciel prog = nomDeLogiciel ( (*itr)->selection->currentIndex() );
+      dtmanage_->addSectionToExecute(debut,fin,prog);
         
-        int debut = dtmanage_->getNumeroFromElementLabel(debString);
-        int fin = dtmanage_->getNumeroFromElementLabel(finString);
-        nomDeLogiciel prog = nomDeLogiciel ( (*itr)->selection->currentIndex() );
-        dtmanage_->addSectionToExecute(debut,fin,prog);
-        
-        // check sections
-        for (int i=debut-1; i<fin; i++) {
-            if (pspa_->getBeamLine()) {
-                if (pspa_->getBeamLine()->getAbstractElement(i)) {
-		  trivaluedBool tb = pspa_->getBeamLine()->getAbstractElement(i)->setSoftware(prog.getString());
-                    if (tb  == TBoolError ) {
-		      diagnostic += pspa_->getBeamLine()->getAbstractElement(i)->getNomdElement().getElementName() + " is not allowed with "+ prog.getString()+"\n ";
-                        caMarche = false;
-			tbResume = tb;
-		    } else if ( tb == TBoolIgnore ) {
-		      diagnostic += pspa_->getBeamLine()->getAbstractElement(i)->getNomdElement().getElementName() + " will be ignored by  "+ prog.getString()+"\n ";
-		      if ( tbResume != TBoolError ) tbResume = tb;
-                    } else {
-                        pspa_->getBeamLine()->update(i);
-                    }
-                }
-            }
-        }
-    }
-    
-    if ( tbResume == TBoolError ) {
-        GWt_dialog calculDialog("PSPA check execute : ERROR", diagnostic , GWt_dialog::Error,true,true);
-        calculDialog.exec();
-    } else if (tbResume == TBoolIgnore ) {
-        GWt_dialog calculDialog("PSPA check execute : WARNING", diagnostic , GWt_dialog::Warning,false,true);
-        calculDialog.exec();
-    }
-/*
- } else if ( essai == warning )  {
-        GWt_dialog calculDialog("PSPA check execute : warning ", diagnostic , GWt_dialog::Warning, false,true);
-        calculDialog.exec();
-*/
-    
-    
-    return caMarche;
+      // check sections
+      for (int i=debut-1; i<fin; i++) {
+	if (pspa_->getBeamLine()) {
+	  if (pspa_->getBeamLine()->getAbstractElement(i)) {
+	    trivaluedBool tb = pspa_->getBeamLine()->getAbstractElement(i)->setSoftware(prog.getString());
+	    if (tb  == TBoolError ) {
+	      diagnostic += pspa_->getBeamLine()->getAbstractElement(i)->getNomdElement().getElementName() + " is not allowed with "+ prog.getString()+"\n ";
+	      caMarche = false;
+	      tbResume = tb;
+	    } else if ( tb == TBoolIgnore ) {
+	      diagnostic += pspa_->getBeamLine()->getAbstractElement(i)->getNomdElement().getElementName() + " will be ignored by  "+ prog.getString()+"\n ";
+	      if ( tbResume != TBoolError ) tbResume = tb;
+	    } else {
+	      pspa_->getBeamLine()->update(i);
+	    }
+	  }
+	}
+      }
+    }
+
+  if ( tbResume == TBoolError ) {
+    GWt_dialog calculDialog("PSPA check execute : ERROR", diagnostic , GWt_dialog::Error,true,true);
+    calculDialog.exec();
+  } else if (tbResume == TBoolIgnore ) {
+    GWt_dialog calculDialog("PSPA check execute : WARNING", diagnostic , GWt_dialog::Warning,false,true);
+    calculDialog.exec();
+  }
+
+  /*
+    } else if ( essai == warning )  {
+    GWt_dialog calculDialog("PSPA check execute : warning ", diagnostic , GWt_dialog::Warning, false,true);
+    calculDialog.exec();
+  */
+    
+  return caMarche;
 }
 
