Changeset 222 in PSPA


Ignore:
Timestamp:
Dec 20, 2012, 9:43:37 PM (12 years ago)
Author:
lemeur
Message:

bricoles

Location:
Interface_Web/trunk/pspaWT
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • Interface_Web/trunk/pspaWT/include/particleBeam.h

    r179 r222  
    7777
    7878  const transportMoments&  getTransportMoments() const;
     79  double getSigmaTransportij(unsigned i, unsigned j);
     80  double getUnnormalizedEmittanceX();
    7981  double getP0Transport() const;
    8082  bool particleRepresentationOk() const;
  • Interface_Web/trunk/pspaWT/src/GWt_pspaApplication.cc

    r221 r222  
    749749  //  WContainerWidget* toto = static_cast<WContainerWidget*>(leDessin_);
    750750  //  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 
    752763  vector<double> xcor;
    753764  vector<double> ycor;
  • Interface_Web/trunk/pspaWT/src/particleBeam.cc

    r191 r222  
    2323
    2424void particleBeam::clear() {
    25   unsigned k,j;
    2625  goodPartic_.clear();
    2726  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   // }
    3327  P0Transport_ = 0.0;
    3428  particleRepresentationOk_ = false;
     
    4337    return rij_;
    4438}
     39
     40double 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
     61double 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
    4571double particleBeam::getP0Transport() const {
    4672  return P0Transport_;
     
    6692  return goodPartic_;
    6793}
    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   // }
    7694
    7795
     
    377395  for ( j = 0; j < 6; j++) {
    378396        ( 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 );
    380397  }
    381398
    382399  for ( j = 0; j < 6; j++) {
    383400    auxj =  ( matrice.at(j) ).at(j);
    384     //    auxj =  ( rij_transportMoments_.at(j) ).at(j);
    385401    for (m=0; m < j; m++) {
    386402      auxm = ( matrice.at(m) ).at(m);
    387403      (  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);
    390404    }
    391405  }
     
    397411  ( matrice.at(1) ).at(1)  *= uniteAngle;
    398412  ( matrice.at(3) ).at(3)  *= uniteAngle;
    399 
    400   // ( rij_transportMoments_.at(1) ).at(1)  *= uniteAngle;
    401   // ( rij_transportMoments_.at(3) ).at(3)  *= uniteAngle;
    402    
    403413  P0Transport_ = 1.0e-3*ERESTMeV*P_reference_MeV_sur_c;
    404414
     
    411421void particleBeam::impressionDesMoments() const {
    412422  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   //   }
    423423}
    424424
    425425void particleBeam::razDesMoments() {
    426426  rij_.raz();
    427   // // initialisation des moments
    428   // 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_jm
    434   //    }
    435   //   }
    436427}
    437428
     
    439430void particleBeam::readTransportMoments(ifstream& inp) {
    440431rij_.readFromTransportOutput(inp);
    441   // string  bidString;
    442   // double bidon;
    443 
    444   // // initialisation des moments
    445   // 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 
    456432}
    457433
     
    477453  cout <<  " racs11= " << xm << " racs22= " << ym << " r12= " << r << endl;
    478454
    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);
    482455
    483456  int nbintv = 50;
Note: See TracChangeset for help on using the changeset viewer.