Changeset 366 in PSPA
- Timestamp:
- Mar 5, 2013, 6:59:13 PM (11 years ago)
- Location:
- Interface_Web/trunk/pspaWT/sources
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Interface_Web/trunk/pspaWT/sources/controler/include/particleBeam.h
r363 r366 46 46 void remplissageDesHistogrammes(double val[2],vector<double>vshf,vector<double>&xcor,vector<int>& hist,int& cnts); 47 47 48 double getSigmaTransportij(unsigned indexI, unsigned indexJ); 49 double getUnnormalizedTranspPhaseSpaceArea(unsigned TranspIndexAbs, unsigned TranspIndexOrd); 50 51 inline double dimensionalFactorFromTransportToGraphics(unsigned index) { 52 if ( index == 0 || index == 2 || index == 4 ) return 10.; 53 else return 1.0; 54 } 55 56 inline string transportVariableName(unsigned index) { 57 switch ( index ) { 58 case 0 : return " x "; 59 case 1 : return " x' "; 60 case 2 : return " y "; 61 case 3 : return " y' "; 62 case 4 : return " l "; 63 case 5 : return "dp/p"; 64 default : { 65 cout << " particleBeam::transportVariableName : coordinate index ERROR index : "<< index << endl; 66 return ""; 67 } 68 } 69 } 70 71 inline string graphicTransportUnitName(unsigned index) { 72 switch ( index ) { 73 case 0 : return " mm "; 74 case 1 : return " mrad "; 75 case 2 : return " mm "; 76 case 3 : return " mrad "; 77 case 4 : return " mm "; 78 case 5 : return " % "; 79 default : { 80 cout << " particleBeam::transportVariableName : coordinate index ERROR index : "<< index << endl; 81 return ""; 82 } 83 } 84 } 85 48 86 public: 49 87 … … 55 93 int getNbParticles() const; 56 94 const beam2Moments& getTransportMoments() const; 57 double getSigmaTransportij(unsigned i, unsigned j);58 95 double getUnnormalizedEmittanceX(); 59 96 double getP0Transport() const; -
Interface_Web/trunk/pspaWT/sources/controler/src/particleBeam.cc
r363 r366 34 34 } 35 35 36 double particleBeam::getSigmaTransportij(unsigned i , unsigned j) {37 if ( i < 1 || i > 6 || j < 1 || j > 6) {36 double particleBeam::getSigmaTransportij(unsigned indexI, unsigned indexJ) { 37 if ( indexI > 5 || indexJ > 5 ) { 38 38 cerr << " particleBeam::getSigmaTransportij() indices out of range " << endl; 39 39 return 0.0; … … 43 43 return 0.0; 44 44 } 45 46 i--; 47 j--; 48 if ( j > i ) { 49 unsigned aux = i; 50 i = j; 51 j = aux; 52 } 53 return ( rij_.getMatrix().at(i) ).at(j); 54 } 55 56 double particleBeam::getUnnormalizedEmittanceX() 57 { 58 double r = getSigmaTransportij(2,1); 45 if ( indexI >= indexJ ) { 46 return ( rij_.getMatrix().at(indexI) ).at(indexJ); 47 } else { 48 return ( rij_.getMatrix().at(indexJ) ).at(indexI); 49 } 50 51 } 52 53 double particleBeam::getUnnormalizedEmittanceX() { 54 double r = getSigmaTransportij(1,0); 59 55 double rac = (1 - r*r); 60 56 if ( rac <= 0.0 ) { … … 62 58 } 63 59 rac = sqrt(1 - r*r); 64 return 10.*getSigmaTransportij(1,1) * getSigmaTransportij(2,2) * rac; // en pi.mm.mrad 65 } 60 return dimensionalFactorFromTransportToGraphics(0)*getSigmaTransportij(0,0) * getSigmaTransportij(1,1) * rac; // en pi.mm.mrad 61 } 62 63 double particleBeam::getUnnormalizedTranspPhaseSpaceArea(unsigned TranspIndexAbs, unsigned TranspIndexOrd) { 64 if ( TranspIndexAbs == TranspIndexOrd ) return 0.0; 65 double r = getSigmaTransportij(TranspIndexAbs,TranspIndexOrd); 66 double rac = (1 - r*r); 67 if ( rac <= 0.0 ) { 68 return 0.0; 69 } 70 rac = sqrt(1 - r*r); 71 return dimensionalFactorFromTransportToGraphics(TranspIndexAbs)*getSigmaTransportij(TranspIndexAbs,TranspIndexAbs) * 72 dimensionalFactorFromTransportToGraphics(TranspIndexOrd)*getSigmaTransportij(TranspIndexOrd,TranspIndexOrd) * rac; // en pi.mm.mrad 73 } 74 75 66 76 67 77 double particleBeam::getP0Transport() const { … … 375 385 } 376 386 } 387 377 388 unsigned particleBeam::indexFromPspaToTransport(unsigned index) const { 378 389 cout << " indexFromPspaToTransport entree : " << index << endl; 379 unsigned indexRetour;380 390 switch ( index ) { 381 case 0 : return 0; break;// x382 case 1 : return 2; break;// y383 case 2 : return 4; break;// z -> l384 case 3 : return 1; break;// xp385 case 4 : return 3; break;// yp386 case 5 : return 5; break;// de/E391 case 0 : return 0; // x 392 case 1 : return 2; // y 393 case 2 : return 4; // z -> l 394 case 3 : return 1; // xp 395 case 4 : return 3; // yp 396 case 5 : return 5; // de/E 387 397 default : { 388 398 cout << " particleBeam::indexFromPspaToTransport : coordinate index ERROR inital index : "<< index << endl; … … 391 401 } 392 402 } 403 393 404 394 405 void particleBeam::donneesDessinEllipse(vector<double>& xcor, vector<double>& ycor, vector<string>& legende, unsigned indexAbs, unsigned indexOrd) { … … 409 420 indexOrd = indexFromPspaToTransport(indexOrd); 410 421 422 423 double dimensionalFactorX, dimensionalFactorY; // to mm, if necessary 424 dimensionalFactorX = dimensionalFactorFromTransportToGraphics(indexAbs); 425 dimensionalFactorY = dimensionalFactorFromTransportToGraphics(indexOrd); 426 427 411 428 // a completer 412 429 legende.clear(); 413 if ( indexAbs == 0 && indexOrd == 1 ) { 414 string namx = " x "; 415 string namy = " xp "; 416 string emitt = mixedTools::doubleToString(getUnnormalizedEmittanceX()); 417 string xmax = "x max= "; 418 string valXmax = mixedTools::doubleToString(10.0*getSigmaTransportij(1,1)); // mm 419 string ymax = "x' max= "; 420 string valYmax = mixedTools::doubleToString(getSigmaTransportij(2,2)); // mm 430 // if ( indexAbs == 0 && indexOrd == 1 ) { 431 string namx = transportVariableName(indexAbs); 432 string namy = transportVariableName(indexOrd); 433 double em = getUnnormalizedTranspPhaseSpaceArea(indexAbs,indexOrd) ; 434 string emitt = mixedTools::doubleToString(getUnnormalizedTranspPhaseSpaceArea(indexAbs,indexOrd)); 435 string xmax = namx + "max= "; 436 string valXmax = mixedTools::doubleToString(dimensionalFactorX*getSigmaTransportij(indexAbs,indexAbs)); 437 string ymax = namy + "max= "; 438 string valYmax = mixedTools::doubleToString(dimensionalFactorY*getSigmaTransportij(indexOrd,indexOrd)); // mm 421 439 string correl = " correlation "; 422 string valCorrel = mixedTools::doubleToString(getSigmaTransportij( 2,1));423 string xunit = " mm";424 string yunit = " mrad";440 string valCorrel = mixedTools::doubleToString(getSigmaTransportij(1,0)); 441 string xunit = graphicTransportUnitName(indexAbs); 442 string yunit = graphicTransportUnitName(indexOrd); 425 443 legende.push_back( "emittance" + namx + "," + namy + ": " + emitt + " pi." + xunit + "." + yunit); 426 444 legende.push_back( xmax + valXmax + xunit); 427 445 legende.push_back( ymax + valYmax + yunit); 428 } else {429 legende.push_back(" text of legend not yet programmed ");430 }446 // } else { 447 // legende.push_back(" text of legend not yet programmed "); 448 // } 431 449 432 450 cout << " index x" << indexAbs << " index y " << indexOrd << endl; 433 434 double xm = ( rij_.getMatrix().at(indexAbs) ).at(indexAbs); 435 double ym = ( rij_.getMatrix().at(indexOrd) ).at(indexOrd); 451 double xm = dimensionalFactorX*( rij_.getMatrix().at(indexAbs) ).at(indexAbs); 452 double ym = dimensionalFactorY*( rij_.getMatrix().at(indexOrd) ).at(indexOrd); 436 453 double r; 437 454 if ( indexOrd > indexAbs ) { -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc
r363 r366 594 594 ellipseDialog->show(); 595 595 new WText(nameOfCase_, ellipseDialog->contents()); 596 // new WText(nameOfCase_ + " : emittance " + namex + " , " + namey + " : " + mixedTools::doubleToString(beam->getUnnormalizedEmittanceX()) + " pi.mm.mrad" , ellipseDialog->contents());597 // new WBreak(ellipseDialog->contents());598 // new WText(" xmax = " + mixedTools::doubleToString(beam->getSigmaTransportij(1,1)) + " cm ", ellipseDialog->contents());599 // new WBreak(ellipseDialog->contents());600 // new WText(" x' max = " + mixedTools::doubleToString(beam->getSigmaTransportij(2,2)) + " mrad ", ellipseDialog->contents());601 // new WBreak(ellipseDialog->contents());602 // new WText(" corr. 12 = " + mixedTools::doubleToString(beam->getSigmaTransportij(2,1)) + " sqrt(cm.rad) ", ellipseDialog->contents());603 596 604 597 vector<double> xcor; … … 836 829 double out[3]= {0.0}; 837 830 838 intiabs= choixVariableHisto_->currentIndex();831 unsigned iabs= choixVariableHisto_->currentIndex(); 839 832 string xname= choixVariableHisto_->currentText().toUTF8(); 840 833 beam->histogramme(iabs,xcor,hist,cnts,out);
Note: See TracChangeset
for help on using the changeset viewer.