Changeset 381 in PSPA for Interface_Web/trunk/pspaWT/sources/controler/src/particleBeam.cc
- Timestamp:
- Mar 9, 2013, 5:12:55 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Interface_Web/trunk/pspaWT/sources/controler/src/particleBeam.cc
r377 r381 345 345 346 346 347 void particleBeam::particlesPhaseSpaceData(vector<double>& xcor, vector<double>& ycor, unsigned indexAbs, unsigned indexOrd) { 347 void 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 348 353 particlesPhaseSpaceComponent(xcor, indexAbs); 349 354 particlesPhaseSpaceComponent(ycor, indexOrd); 355 legende.clear(); 356 legende.push_back( "phase space " + namex + "," + namey); 357 legende.push_back( "particle number : " + mixedTools::intToString(getNbParticles())); 350 358 } 351 359 … … 360 368 if ( index <= 2 ) { 361 369 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 363 371 } 364 372 return; … … 369 377 double begamz = goodPartic_.at(i).getBetaGamma().getComponent(2); 370 378 if ( begamz != 0.0) { 371 coord.at(i) = 1000.*goodPartic_.at(i).getBetaGamma().getComponent(index - 3)/begamz; // mi mmiradians379 coord.at(i) = 1000.*goodPartic_.at(i).getBetaGamma().getComponent(index - 3)/begamz; // milliradians 372 380 } else { 373 381 coord.at(i) = 0.0; … … 403 411 } 404 412 405 406 void particleBeam::donneesDessinEllipse(vector<double>& xcor, vector<double>& ycor, vector<string>& legende, unsigned indexAbs, unsigned indexOrd) { 413 unsigned 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 431 unsigned 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 451 void particleBeam::donneesDessinEllipse(vector<double>& xcor, vector<double>& ycor, vector<string>& legende, string namex, string namey) { 407 452 int k; 408 453 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; 414 466 415 467 xcor.clear(); 416 468 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 422 470 423 471 … … 427 475 428 476 429 // a completer 477 430 478 legende.clear(); 431 479 // if ( indexAbs == 0 && indexOrd == 1 ) {
Note: See TracChangeset
for help on using the changeset viewer.