Changeset 341 in PSPA for Interface_Web/trunk/pspaWT/sources/controler/src/particleBeam.cc
- Timestamp:
- Feb 22, 2013, 10:07:46 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Interface_Web/trunk/pspaWT/sources/controler/src/particleBeam.cc
r336 r341 426 426 } 427 427 428 429 430 void particleBeam::donneesDessinEllipse(vector<double>& xcor, vector<double>& ycor, unsigned indexAbs, unsigned indexOrd) { 431 int k; 432 double x,y; 433 434 if ( !momentRepresentationOk_ ) return; 435 436 if ( indexAbs > 5 || indexOrd > 5 ) return; 437 438 xcor.clear(); 439 ycor.clear(); 440 // les index sont dans l'ordre x,y,z,xp,yp, de/E 441 // on traduit en TRANSPORT 442 if ( indexAbs == 1 ) indexAbs = 2; // y 443 if ( indexAbs == 2 ) indexAbs = 4; // z -> l 444 if ( indexAbs == 3 ) indexAbs = 1; // xp 445 if ( indexAbs == 4 ) indexAbs = 3; // yp 446 447 if ( indexOrd == 1 ) indexOrd = 2; // y 448 if ( indexOrd == 2 ) indexOrd = 4; // z -> l 449 if ( indexOrd == 3 ) indexOrd = 1; // xp 450 if ( indexOrd == 4 ) indexOrd = 3; // yp 451 452 cout << " index x" << indexAbs << " index y " << indexOrd << endl; 453 454 double xm = ( rij_.getMatrix().at(indexAbs) ).at(indexAbs); 455 double ym = ( rij_.getMatrix().at(indexOrd) ).at(indexOrd); 456 double r; 457 if ( indexOrd > indexAbs ) { 458 r = ( rij_.getMatrix().at(indexOrd) ).at(indexAbs); 459 } else { 460 r = ( rij_.getMatrix().at(indexAbs) ).at(indexOrd); 461 } 462 463 cout << " racs11= " << xm << " racs22= " << ym << " r12= " << r << endl; 464 465 466 int nbintv = 50; 467 if ( xm == 0.0 ) return; 468 double pas = 2.0 * xm / nbintv; 469 470 // cout << " r= " << r << endl; 471 double rac = (1 - r*r); 472 if ( rac > 0.0 ) 473 { 474 cout << " cas rac > " << endl; 475 rac = sqrt(1 - r*r); 476 double alpha = -r / rac; 477 double beta = xm / ( ym * rac); 478 // double gamma = ym / ( xm * rac ); 479 double epsil = xm * ym * rac; 480 double fac1 = -1.0 / ( beta * beta); 481 double fac2 = epsil/beta; 482 double fac3 = -alpha/beta; 483 double aux; 484 for ( k=0; k < nbintv; k++) 485 { 486 x = -xm + k*pas; 487 aux = fac1 * x * x + fac2; 488 // cout << " aux2= " << aux << endl; 489 if ( aux <= 0.0 ) 490 { 491 aux = 0.0; 492 } 493 else aux = sqrt(aux); 494 495 // y = fac3*x; 496 y = fac3*x + aux; 497 xcor.push_back(x); 498 ycor.push_back(y); 499 } 500 501 for ( k=0; k <= nbintv; k++) 502 { 503 x = xm - k*pas; 504 aux = fac1 * x * x + fac2; 505 if ( aux <= 0.0 ) 506 { 507 aux = 0.0; 508 } 509 else aux = sqrt(aux); 510 // y = fac3*x; 511 y = fac3*x - aux; 512 xcor.push_back(x); 513 ycor.push_back(y); 514 } 515 } 516 else 517 // cas degenere 518 { 519 cout << " cas degenere " << endl; 520 double fac = ym/xm; 521 for ( k=0; k < nbintv; k++) 522 { 523 x = -xm + k*pas; 524 y = fac*x; 525 xcor.push_back(x); 526 ycor.push_back(y); 527 } 528 529 } 530 } 531 428 532 void particleBeam::histogramme(vector<double>&xcor,vector<int>& hist,int& cnts,double out[3]) 429 533 {
Note: See TracChangeset
for help on using the changeset viewer.