Changeset 222 in PSPA
- Timestamp:
- Dec 20, 2012, 9:43:37 PM (12 years ago)
- Location:
- Interface_Web/trunk/pspaWT
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Interface_Web/trunk/pspaWT/include/particleBeam.h
r179 r222 77 77 78 78 const transportMoments& getTransportMoments() const; 79 double getSigmaTransportij(unsigned i, unsigned j); 80 double getUnnormalizedEmittanceX(); 79 81 double getP0Transport() const; 80 82 bool particleRepresentationOk() const; -
Interface_Web/trunk/pspaWT/src/GWt_pspaApplication.cc
r221 r222 749 749 // WContainerWidget* toto = static_cast<WContainerWidget*>(leDessin_); 750 750 // toto->clear(); 751 new WText(nameOfCase_ + " : emittance x,x' ", toto); 751 752 // new WText(nameOfCase_ + " : espace de phase x,x' "+ " nb partic. "+ mixedTools::intToString(partic.size()), toto); 753 754 755 new WText(nameOfCase_ + " : emittance x,x' " + mixedTools::doubleToString(beam->getUnnormalizedEmittanceX()) + " pi.mm.mrad" , toto); 756 new WBreak(toto); 757 new WText(" xmax = " + mixedTools::doubleToString(beam->getSigmaTransportij(1,1)) + " cm ", toto); 758 new WBreak(toto); 759 new WText(" x' max = " + mixedTools::doubleToString(beam->getSigmaTransportij(2,2)) + " mrad ", toto); 760 new WBreak(toto); 761 new WText(" corr. 12 = " + mixedTools::doubleToString(beam->getSigmaTransportij(2,1)) + " sqrt(cm.rad) ", toto); 762 752 763 vector<double> xcor; 753 764 vector<double> ycor; -
Interface_Web/trunk/pspaWT/src/particleBeam.cc
r191 r222 23 23 24 24 void particleBeam::clear() { 25 unsigned k,j;26 25 goodPartic_.clear(); 27 26 rij_.raz(); 28 // for ( k=0; k < 6; k++){29 // for ( j=0; j <= k; j++) {30 // ( rij_transportMoments_.at(k) ).at(j) = 0.0;31 // }32 // }33 27 P0Transport_ = 0.0; 34 28 particleRepresentationOk_ = false; … … 43 37 return rij_; 44 38 } 39 40 double particleBeam::getSigmaTransportij(unsigned i, unsigned j) { 41 if ( i < 1 || i > 6 || j < 1 || j > 6 ) { 42 cerr << " particleBeam::getSigmaTransportij() indices out of range " << endl; 43 return 0.0; 44 } 45 if ( !momentRepresentationOk_ ) { 46 cerr << " particleBeam::getSigmaTransportij() beam is not in moment representation " << endl; 47 return 0.0; 48 } 49 50 i--; 51 j--; 52 if ( j > i ) { 53 unsigned aux = i; 54 i = j; 55 j = aux; 56 } 57 return ( rij_.getMatrix().at(i) ).at(j); 58 } 59 60 61 double particleBeam::getUnnormalizedEmittanceX() { 62 double r = getSigmaTransportij(2,1); 63 double rac = (1 - r*r); 64 if ( rac <= 0.0 ) { 65 return 0.0; 66 } 67 rac = sqrt(1 - r*r); 68 return 10.*getSigmaTransportij(1,1) * getSigmaTransportij(2,2) * rac; // en pi.mm.mrad 69 } 70 45 71 double particleBeam::getP0Transport() const { 46 72 return P0Transport_; … … 66 92 return goodPartic_; 67 93 } 68 69 // void particleBeam::setFromBeamParameters(double x, double xp, double y, double yp, double dl, double del, double P0)70 // {71 // clear();72 // rij_ = transportMoments(x, xp, y, yp, dl, del);73 // P0Transport_ = P0;74 // momentRepresentationOk_ = true;75 // }76 94 77 95 … … 377 395 for ( j = 0; j < 6; j++) { 378 396 ( matrice.at(j) ).at(j) = sqrt(( matrice.at(j) ).at(j) * facmoy ); 379 // ( rij_transportMoments_.at(j) ).at(j) = sqrt(( rij_transportMoments_.at(j) ).at(j) * facmoy );380 397 } 381 398 382 399 for ( j = 0; j < 6; j++) { 383 400 auxj = ( matrice.at(j) ).at(j); 384 // auxj = ( rij_transportMoments_.at(j) ).at(j);385 401 for (m=0; m < j; m++) { 386 402 auxm = ( matrice.at(m) ).at(m); 387 403 ( matrice.at(j) ).at(m) *= facmoy/(auxj * auxm); 388 // auxm = ( rij_transportMoments_.at(m) ).at(m);389 // ( rij_transportMoments_.at(j) ).at(m) *= facmoy/(auxj * auxm);390 404 } 391 405 } … … 397 411 ( matrice.at(1) ).at(1) *= uniteAngle; 398 412 ( matrice.at(3) ).at(3) *= uniteAngle; 399 400 // ( rij_transportMoments_.at(1) ).at(1) *= uniteAngle;401 // ( rij_transportMoments_.at(3) ).at(3) *= uniteAngle;402 403 413 P0Transport_ = 1.0e-3*ERESTMeV*P_reference_MeV_sur_c; 404 414 … … 411 421 void particleBeam::impressionDesMoments() const { 412 422 rij_.impression(); 413 // unsigned j,m;414 // cout << " impression des moments " << endl;415 // for ( j = 0; j < 6; j++)416 // {417 // for (m=0; m <= j; m++)418 // {419 // cout << ( rij_transportMoments_.at(j) ).at(m) << " ";420 // }421 // cout << endl;422 // }423 423 } 424 424 425 425 void particleBeam::razDesMoments() { 426 426 rij_.raz(); 427 // // initialisation des moments428 // unsigned j,m;429 // for ( j = 0; j < rij_transportMoments_.size(); j++)430 // {431 // for (m=0; m <= j; m++)432 // {433 // ( rij_transportMoments_.at(j) ).at(m) = 0.0; // element r_jm434 // }435 // }436 427 } 437 428 … … 439 430 void particleBeam::readTransportMoments(ifstream& inp) { 440 431 rij_.readFromTransportOutput(inp); 441 // string bidString;442 // double bidon;443 444 // // initialisation des moments445 // razDesMoments();446 447 // inp >> bidon >> bidString >> bidon >> ( rij_transportMoments_.at(0) ).at(0) >> bidString;448 // inp >> bidon >> ( rij_transportMoments_.at(1) ).at(1) >> bidString >> ( rij_transportMoments_.at(1) ).at(0);449 // inp >> bidon >> ( rij_transportMoments_.at(2) ).at(2) >> bidString >> ( rij_transportMoments_.at(2) ).at(0) >> ( rij_transportMoments_.at(2) ).at(1);450 // inp >> bidon >> ( rij_transportMoments_.at(3) ).at(3) >> bidString >> ( rij_transportMoments_.at(3) ).at(0) >> ( rij_transportMoments_.at(3) ).at(1) >> ( rij_transportMoments_.at(3) ).at(2);451 452 // inp >> bidon >> ( rij_transportMoments_.at(4) ).at(4) >> bidString >> ( rij_transportMoments_.at(4) ).at(0) >> ( rij_transportMoments_.at(4) ).at(1) >> ( rij_transportMoments_.at(4) ).at(2) >> ( rij_transportMoments_.at(4) ).at(3);453 454 // inp >> bidon >> ( rij_transportMoments_.at(5) ).at(5) >> bidString >> ( rij_transportMoments_.at(5) ).at(0) >> ( rij_transportMoments_.at(5) ).at(1) >> ( rij_transportMoments_.at(5) ).at(2) >> ( rij_transportMoments_.at(5) ).at(3) >> ( rij_transportMoments_.at(5) ).at(4);455 456 432 } 457 433 … … 477 453 cout << " racs11= " << xm << " racs22= " << ym << " r12= " << r << endl; 478 454 479 // double xm = ( rij_transportMoments_.at(0) ).at(0);480 // double ym = ( rij_transportMoments_.at(1) ).at(1);481 // double r = ( rij_transportMoments_.at(1) ).at(0);482 455 483 456 int nbintv = 50;
Note: See TracChangeset
for help on using the changeset viewer.