Ignore:
Timestamp:
Dec 6, 2013, 5:12:43 PM (10 years ago)
Author:
zhangj
Message:

Clean version of Tracy: SoleilVersion at the end of 2011.Use this clean version to find the correct dipole fringe field to have the correct FMAP and FMAPDP of ThomX. Modified files: tpsa_lin.cc, soleillib.cc, prtmfile.cc, rdmfile.cc, read_script.cc, physlib.cc, tracy.cc, t2lat.cc, t2elem.cc, naffutils.cc in /tracy/tracy/src folder; naffutils.h, tracy_global.h, physlib.h, tracy.h, read_script.h, solielilib.h, t2elem.h in /tracy/tracy.inc folder; soltracy.cc in tracy/tools folder

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/tracy3-3.10.1b/tracy/tracy/src/naffutils.cc

    r11 r23  
    1818
    1919/****************************************************************************/
    20 /* void Trac_Simple4DCOD(double x, double px, double y, double py, double dp,
    21                  double ctau, long nmax, double Tx[][NTURN], bool *status2)
     20/* void Trac_Simple4DCOD(double x, double px, double y, double py, double dp, long nmax,
     21                 double Tx[][NTURN], bool *status)
    2222
    2323   Purpose:
    2424       Single particle tracking around the closed orbit for NTURN turns
    25        The 6D phase trajectory is saved in a array, but the
    26        tracked dp and ctau is not about the COD.
     25       The 6D phase trajectory is saved in a array
    2726
    2827   Input:
     
    7069
    7170 
    72   if (!trace && status.codflag)
     71  if (trace && status.codflag)
    7372    printf("dp= % .5e %% xcod= % .5e mm zcod= % .5e mm \n",
    7473             dp*1e2, globval.CODvect[0]*1e3, globval.CODvect[2]*1e3);
     
    108107  } while ((lastn < nmax) && (lastpos == globval.Cell_nLoc) && (lostF == false));
    109108
    110  
    111109  if (lastpos != globval.Cell_nLoc)
    112110  { /* Particle lost: Error message section */
     
    118116}
    119117
    120 
    121 /****************************************************************************/
    122 /* void Trac_Simple4DCOD(double x, double px, double y, double py, double dp,
    123                  double ctau, long nmax, double Tx[][NTURN], bool *status2)
    124 
    125    Purpose:
    126        Single particle tracking around the closed orbit for NTURN turns
    127        The 6D phase trajectory is saved in a array, but the
    128        tracked dp and ctau is not about the COD.
    129 
    130    Input:
    131        x, px, y, py 4 transverse coordinates
    132        dp           energy offset
    133        nmax         number of turns
    134        pos          starting position for tracking
    135        aperture     global physical aperture
    136 
    137    Output:
    138       lastn         last n (should be nmax if  not lost)
    139       lastpos       last position in the ring
    140       Tx            6xNTURN matrix of phase trajectory
    141 
    142    Return:
    143        none
    144 
    145    Global variables:
    146        NTURN number of turn for tracking
    147        globval
    148 
    149    Specific functions:
    150        Cell_Pass
    151 
    152    Comments:
    153        useful for connection with NAFF
    154        19/01/03 tracking around the closed orbit
    155        
    156        11/06/2013  Modified by Jianfeng Zhang @ LAL
    157        The same feature as function 
    158        Trac_Simple4DCOD(double x, double px, double y, double py, double dp,
    159                  double ctau, long nmax, double Tx[][NTURN], bool *status2)
    160        but add the feature to extract the position of the location of
    161        the lost particle;
    162        called by function
    163        fmap(const char *FmapFile, long Nbx, long Nbz, long Nbtour, double xmax, double zmax,
    164           double energy, bool diffusion, bool loss)       
    165        in soleillib.cc.
    166        
    167 ****************************************************************************/
    168 void Trac_Simple4DCOD(double x, double px, double y, double py, double dp,
    169                  double ctau, long nmax, double Tx[][NTURN], long& lastn, long& lastpos, ss_vect<double>& x1, bool *status2)
    170 {
    171   bool             lostF = false; /* Lost particle Flag */
    172   Vector2          aperture = {1.0, 1.0};
    173 
    174    lastn = 0;
    175    lastpos = globval.Cell_nLoc;
    176   *status2 = true; /* stable */
    177    x1[0]=0,x1[1]=0,x1[2]=0,x1[3]=0,x1[4]=0,x1[5]=0;
    178  
    179   if (globval.MatMeth) Cell_Concat(dp);
    180 
    181   /* Get closed orbit */
    182 
    183   getcod(dp, lastpos);
    184 
    185  
    186   if (!trace && status.codflag)
    187     printf("dp= % .5e %% xcod= % .5e mm zcod= % .5e mm \n",
    188              dp*1e2, globval.CODvect[0]*1e3, globval.CODvect[2]*1e3);
    189 
    190   /* Tracking coordinates around the closed orbit */
    191   x1[0] =  x + globval.CODvect[0]; x1[1] = px + globval.CODvect[1];
    192   x1[2] =  y + globval.CODvect[2]; x1[3] = py + globval.CODvect[3];
    193   x1[4] = dp; x1[5] = ctau;
    194 
    195   Tx[0][lastn] = x1[0]; Tx[1][lastn] = x1[1];
    196   Tx[2][lastn] = x1[2]; Tx[3][lastn] = x1[3];
    197   Tx[4][lastn] = x1[4]; Tx[5][lastn] = x1[5];
    198   lastn++;
    199 
    200   do
    201   { /* tracking through the ring */
    202     if ((lastpos == globval.Cell_nLoc) &&
    203         (fabs(x1[0]) < aperture[0]) && (fabs(x1[2]) < aperture[1]) && status.codflag)
    204     {
    205       if (globval.MatMeth)
    206         Cell_fPass(x1, lastpos);
    207       else
    208         Cell_Pass(0, globval.Cell_nLoc, x1, lastpos);
    209       Tx[0][lastn] = x1[0]; Tx[1][lastn] = x1[1];
    210       Tx[2][lastn] = x1[2]; Tx[3][lastn] = x1[3];
    211       Tx[4][lastn] = x1[4]; Tx[5][lastn] = x1[5];
    212     }
    213     else
    214     {
    215       printf("Trac_Simple: Particle lost \n");
    216       fprintf(stdout, "%6ld plane: %1d %+10.5g %+10.5g %+10.5g %+10.5g %+10.5g %+10.5g \n",
    217          lastn, status.lossplane, x1[0], x1[1], x1[2], x1[3], x1[4], x1[5]);
    218       lostF = true;
    219       *status2 = false;
    220     }
    221     lastn++;
    222   } while ((lastn < nmax) && (lastpos == globval.Cell_nLoc) && (lostF == false));
    223 
    224  
    225   if (lastpos != globval.Cell_nLoc)
    226   { /* Particle lost: Error message section */
    227     *status2 = false;
    228     printf("Trac_Simple: Particle lost \n");
    229     fprintf(stdout, "turn=%5ld plane= %1d %+10.5g %+10.5g %+10.5g %+10.5g %+10.5g %+10.5g \n", lastn-1,
    230              status.lossplane, x1[0], x1[1], x1[2], x1[3], x1[4], x1[5]);
    231   }
    232 }
    233 
    234 
    235118/****************************************************************************/
    236119/* void Trac_Simple6DCOD(double x, double px, double y, double py, double dp, long nmax,
    237                  double Tx[][NTURN], bool *status2)
     120                 double Tx[][NTURN], bool *status)
    238121
    239122   Purpose:
Note: See TracChangeset for help on using the changeset viewer.