Ignore:
Timestamp:
Mar 9, 2013, 5:12:55 PM (11 years ago)
Author:
lemeur
Message:

complements graphiques, legendes et unification unites

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Interface_Web/trunk/pspaWT/sources/controler/src/particleBeam.cc

    r377 r381  
    345345
    346346
    347 void particleBeam::particlesPhaseSpaceData(vector<double>& xcor, vector<double>& ycor, unsigned indexAbs, unsigned indexOrd) {
     347void particleBeam::particlesPhaseSpaceData(vector<double>& xcor, vector<double>& ycor, vector<string>& legende, string namex, string namey) {
     348
     349  unsigned indexAbs, indexOrd;
     350  indexAbs = pspaCoorIndexFromString(namex);
     351  indexOrd = pspaCoorIndexFromString(namey);
     352 
    348353  particlesPhaseSpaceComponent(xcor, indexAbs);
    349354  particlesPhaseSpaceComponent(ycor, indexOrd);
     355  legende.clear();
     356    legende.push_back( "phase space " + namex + "," + namey);
     357    legende.push_back( "particle number : " +   mixedTools::intToString(getNbParticles()));
    350358}
    351359
     
    360368  if ( index <= 2 ) {
    361369    for (unsigned i = 0; i < goodPartic_.size(); ++i) {
    362       coord.at(i) =  goodPartic_.at(i).getPosition().getComponent(index);
     370      coord.at(i) =  10.*goodPartic_.at(i).getPosition().getComponent(index);  // en mm
    363371    }
    364372    return;
     
    369377      double begamz = goodPartic_.at(i).getBetaGamma().getComponent(2);
    370378      if ( begamz != 0.0) {
    371         coord.at(i) =  1000.*goodPartic_.at(i).getBetaGamma().getComponent(index - 3)/begamz; // mimmiradians
     379        coord.at(i) =  1000.*goodPartic_.at(i).getBetaGamma().getComponent(index - 3)/begamz; // milliradians
    372380      } else {
    373381        coord.at(i) = 0.0;
     
    403411}
    404412
    405 
    406 void particleBeam::donneesDessinEllipse(vector<double>& xcor, vector<double>& ycor, vector<string>& legende, unsigned indexAbs, unsigned indexOrd) {
     413unsigned particleBeam::pspaCoorIndexFromString(string nameCoor) const {
     414  if ( nameCoor == "x" ) {
     415    return 0;
     416  } else if ( nameCoor == "y" ) {
     417    return 1;
     418  } else if ( nameCoor == "dz" ) {
     419    return 2;
     420  } else if ( nameCoor == "xp" ) {
     421    return 3;
     422  } else if ( nameCoor == "yp" ) {
     423    return 4;
     424  } else if ( nameCoor == "dE/E" ) {
     425    return 5;
     426  } else {
     427    return 99;
     428  }
     429}
     430
     431unsigned particleBeam::transportCoorIndexFromString(string nameCoor) const {
     432  if ( nameCoor == "x" ) {
     433    return 0;
     434  } else if ( nameCoor == "y" ) {
     435    return 2;
     436  } else if ( nameCoor == "dz" ) {
     437    return 4;
     438  } else if ( nameCoor == "xp" ) {
     439    return 1;
     440  } else if ( nameCoor == "yp" ) {
     441    return 3;
     442  } else if ( nameCoor == "dE/E" ) {
     443    return 5;
     444  } else {
     445    return 99;
     446  }
     447}
     448
     449//void particleBeam::donneesDessinEllipse(vector<double>& xcor, vector<double>& ycor, vector<string>& legende, unsigned indexAbs, unsigned indexOrd) {
     450
     451void particleBeam::donneesDessinEllipse(vector<double>& xcor, vector<double>& ycor, vector<string>& legende, string namex, string namey) {
    407452  int k;
    408453  double x,y;
    409   cout << " particleBeam::donneesDessinEllipse index recus x" << indexAbs << " index y " << indexOrd << endl;
    410 
    411   if ( !momentRepresentationOk_ ) return;
    412 
    413   if ( indexAbs > 5 || indexOrd > 5 ) return;
     454  if ( !momentRepresentationOk_ ) buildMomentRepresentation();
     455
     456  //  if ( !momentRepresentationOk_ ) return;
     457
     458  unsigned indexAbs, indexOrd;
     459
     460
     461  // index TRANSPORT
     462  indexAbs = transportCoorIndexFromString(namex);
     463  indexOrd = transportCoorIndexFromString(namey);
     464  cout << " namex= " << namex << " indexAbs= " << indexAbs << " namey= " << namey << " indexOrd= " << indexOrd << endl;
     465    if ( indexAbs > 5 || indexOrd > 5 ) return;
    414466
    415467  xcor.clear();
    416468  ycor.clear();
    417   // les index sont dans l'ordre x,y,z,xp,yp, de/E
    418   // on traduit en TRANSPORT
    419 
    420   indexAbs = indexFromPspaToTransport(indexAbs);
    421   indexOrd = indexFromPspaToTransport(indexOrd);
     469
    422470
    423471
     
    427475
    428476
    429   // a completer
     477
    430478  legende.clear();
    431479  //  if ( indexAbs == 0 && indexOrd == 1 ) {
Note: See TracChangeset for help on using the changeset viewer.