SNAKE Transport code

From HallCWiki
Jump to: navigation, search

SNAKE code

  • The snake code is stored in a git repository.
  • Changes to the snake.f code
    • Added options for Vector or Track output.
      • Vector output prints to fort.31 the event number, plane number and vea array for all endplanes for each event. The vea array is the global x,y,z position, the global cx,cy,cz , momentum (GeV), pathlength, live flag (1=live,0=stop at this endplane,-1=dead), local x,y,z position and the local cx,cy,cz. Local is the coordinate system defined for each region.
      • Track outputs to fort.41 the global x,y,z positions at each endplane until the track is stopped in an endplane.
    • Added option for a target in addition to the loop, random, or individual when creating initial tracks.
    • When random tracks are selected. Sets the "ymin" is the angle of the spectrometer relative to the beam line. Then treats the z min, max and step in the trajectory file as being along the target and randomly selects a target position and rotates it by the spectrometer angle to give the y and z starting position for the track in the snake global coordinates.
    • Add option for collimator to be "sieve" or "hexcol". For "sieve" hard coded for 9 vertical holes with first hole at colli(iep,indre,1) and spacing set by colli(iep,indre,3) and for 9 horizontal holes with first hole at colli(iep,indre,2) and spacing set by colli(iep,indre,4). For "hexcol" the vertical height is colli(iep,indre,3) and the horizontal width is colli(iep,indre,4)
  • Changes to the snake-lib.f in subroutine field
    • Eliminate the addition of 0.5 to get the bins for x,y,z in the 3 dim. 2nd order interpolation inside the cube for each component of the field.
    • Setup a tri-linear interpolation to get the field and skip the old interpolation method. Same answer as the fancy 3 dim. 2nd order interpolation inside the cube, but extra benefit that one can get an interpolation to any point inside the define field boundary. With the 3 dim. 2nd order interpolation inside the cube, one can not get the region between first and second bin since three bins are needed and there is no bin before the first.
  • Changes to snake.inc
    • Increase the array size of the number of tracks to 200,000, number of totol endplanes to 50 and max number of endplanes per region to 15

Field maps of magnets

  • The Horizontal Bender
    • The integral field needed for 3 deg bend is 1.9211 Tm for 11 GeV electrons. p (MeV) = 299.8 Int(Bdl)/theta_B
    • From map file, MSU_Bender.map, the maximum integral field along a straight path is 1.92929 Tm with B_max=2.4768 T giving L_eff= 0.7789m. So need a factor of 0.996 to scale map to get field for 3deg bend.
  • Dipole
    • The integral field needed for 18.4 deg bend is 11.783 Tm for integration along the path of the particle, L_arc. The ratio between the L_arc and the chord length, L_chord, is L_arc/L_chord = (theta_bend/2)/sin(theta_bend/2)=1.004 for theta_bend=18.4 deg. So need integral field along a straight path of 11.732Tm.
    • From map file, shmsD2008.map, B_max=4.7907 and Int(Bdl) = -13.67883 so L_eff=2.855. So need a factor of 0.8577 to scale map to get field for 18.4 deg bend.
  • Quadrupoles
    • From map file, Q1_coldiron.map,Max Bz/r= 10.791 and Int(Bz/r*dl) = 19.9049 for L_eff= 1.844 at x=20cm and z=0 . x and z are the vertical and horizontal positions.Bz is the field in the horizontal direction
    • From map file,Q23nc6.map, Max Bz/r=14.41324 and Int(Bz/r*dl) = 23.04041 for L_eff=1.5985 at x=31cm and z=0 . x and z are the vertical and horizontal positions.Bz is the field in the horizontal direction
    • Determine the scale factors for the quads to given desired 1st order optics.
  • For comparison to COSY, Dave Gaskell optimized for (xfp|xptar)=0, (yfp|yptar)=0 and D/M=-1.2
    • Q1=-2.035602 T at 25cm which at 20cm is q1 = -1.62848 using L_eff = 1.879m.
    • Q2= 4.342608 T at 35cm which at 31cm is q2 = 3.83535 using L_eff=1.64m.
    • Q3=-2.805149 T at 35cm which at 31cm is q3 = -2.54209 using L_eff=1.64m.

Determine the magnet setting for 11 GeV/c

  • Fix the map scale factor for the HB and Dipole fields at 0.996 and 0.8577 .
  • Determine the scale factors for the quads, by modifying them so that (xfp|xptar)=0, (yfp|ytar)=1.634 and (yfp|yptar)=0 in 1st order matrix. Found scale factors are -0.74338, 0.84209, -0.55918 . ( After fixing problem with field interpolation in the snake code in Oct 2012).Tm,
  • This gives the integral field for 11 GeV for HB, Q1, Q2, Q3 and dipole = 1.929 Tm, 14.797 (T/m)m, 19.4021(T/m)m, 12.884 (T/m)m and 11.732Tm.
  • 1st order Matrix from target to focal plane has D/M = -1.20:
xtar xptar ytar yptar delta
xfp -1.3637 -0.00008 0.000425 0.0425 1.623
xpfp -0.0697 -0.7338 -0.00032 0.0047 0.3188
yfp -0.0070 0.0129 -1.634 -0.00014 -0.1945
ypfp -0.0012 0.003 -0.2669 -0.6143 0.00304
  • Overall path length = 18.113m for central track.
  • Comparison to COSY fields
Code Q1 field (T) at 20cm Q2 field at 31cm Q3 field at 31cm
COSY -1.62848 3.83535 -2.54209
SNAKE -1.6043 3.7625 -2.4985
Ratio Cosy/Snake field 1.015 1.019 1.017
Ratio of COSy/Snake EFL 1.019 1.025 1.025

Study of changing the vertical offset of dipole

  • Ran SNAKE with set of random trajectories for point target with -0.060 < xptar < 0.060, -0.040 < yptar < 0.040 and 8.8 < momentum < 13.42 GeV/c.
  • Input deck to SNAKE has 38 endplanes or apertures. An endplane is a position within SHMS where the the positions and angles are recorded. If the track goes outside the SHMS good volume then a flag is set to indicate a failed track and the positions and angles at the location between the endplanes is recorded.
  • Compared an vertical offset of 20cm, 26cm and 29cm. For each offset the distance between the centerof the dipole and the focal plane center is recalculated.
  • 1D Plot of fraction of total tracks which failed for each endplane number for offset of 20cm (red), 26cm (black) and 29cm (green) offsets.. Apertures (or Endplanes) numbers 3-7 are HB, 8-13 are Q1, 14-18 are Q2, 19-24 are Q3, 25 is dipole entrance, 26-35 are dipole.
  • 2D plot of number tracks which failed for each endplane number versus xptar and yptar for offset of 20cm , 26cm and 29cm. The HB vertical size limits the xptar acceptance to about +/-47-50mr. The Q1 exit limits the horizontal acceptance. For the 20cm offset in the dipole, the dipole entrance (#25) limits the negative xptar acceptance with a delta dependence.
  • 1D Plots of target xp,yp, delta and ytar with for offset of 20cm, 26cm and 29cm. The black line is all tracks. The blue line is failed tracks. The red line is passed tracks.
  • Plot comparing the solid angle has a function of delta for 20 (red), 26cm (black) and 29cm (green) offsets. The solid angle is calculated by the ratio of passed tracks to total tracks multiplied by 0.12*0.08*1000 (the thrown solid angle in msr at each delta).
  • 2D Plots of target xp/delta, yp/delta and xp/yp for offset of 20cm, 26cm and 29cm.
  • 2D Plots of focal plane x/y, xp/yp, yp/y and xp/x for offset of 20cm, 26cm and 29cm.

Study comparing SHMS tuned to D/M = -1.1 to D = -0.8

  • Ran SNAKE with set of random trajectories for point target with -0.060 < xptar < 0.060, -0.040 < yptar < 0.040 and 8.8 < momentum < 13.42 GeV/c.
  • Dave Gaskell fitted tune in COSY for D/M=-0.8 . Scaled the magnets fields in SNAKE.
  • Plot comparing the solid angle has a function of delta for 20 (red) and 26cm (black) offsets at D/M=-1.1 and 26cm offset with D/M=-0.08 (green). The solid angle is calculated by the ratio of passed tracks to total tracks multiplied by 0.12*0.08*1000 (the thrown solid angle in msr at each delta).
  • 1D Plot of fraction of total tracks which failed for each endplane number for offset of 20cm (red) and 26cm (black) at D/M=-1.1 and 26cm offset with D/M=-0.8 (green).
  • 2D Plots of target xp/delta, yp/delta and xp/yp for offset of 26cm with D/M=-1.1 and 26cm with D/M=-0.8.

Study of changing the vertical opening of the HB

  • Drawing of the proposed change by Mike Fowler on Sept 28th.
  • Plot comparing the solid angle has a function of delta for HB vertical opening of 20.75cm(red) and 23cm (black) with dipole offset = 26cm. The solid angle is calculated by the ratio of passed tracks to total tracks multiplied by 0.12*0.08*1000 (the thrown solid angle in msr at each delta). With the increased HB acceptance, the xptar acceptance grows about 10% in negative delta region. Makes no difference in positive delta region.

SNAKE versus COSY comparison

  • Ran SNAKE for xptar = +/- 80mr , yptar = +/- 80mr , -22 < delta < 22and 20cm target at 20deg. Ran mc_shms_single for xptar = +/- 80mr , yptar = +/- 80mr , -22 < delta < 22 and 20cm target at 20deg. Collimator is in place.
  • Plot comparing solid angle acceptance versus delta for SNAKE (blue) and COSY (red).
  • Plots comparing x (vertical) and y (horizontal) positions at various locations from dipole optical entrance to the focal plane for SNAKE (blue) and COSY (red).
  • Plots comparing x (vertical) and y (horizontal) positions at various locations in horizontal bender for SNAKE (blue) and COSY (red).
  • Plots comparing x (vertical) and y (horizontal) positions at the entrance and exit of Q1, Q2, and Q3 for SNAKE (blue) and COSY (red).

Collimator study

  • Run SNAKE with target of length +/-10cm at 20deg. Use a 26cm offset in the dipole with 23cm opening in HB.
  • Plot of the vertical versus the horizontal position at collimator location. The red boxes are events which are accepted up to dipole entrance. The green boxes are events which fail at dipole entrance. The blue boxes are those events which fail inside the dipole after passing the entrance.
  • Study of different collimator sizes. All are hexagonal with the same width but the height is 12.5 , 10 and 8.5cm. Plots of the vertical versus the horizontal position at collimator with the different collimator, the fraction loss in the dipole versus delta and the solid angle versus delta for each collimator. Table of solid angle and fractional loss is percentage of events which have made it through collimator but failed at dipole entrance or inside the dipole:
Collimator vertical size (cm) Solid angle (mr) Average Frac loss in dipole
12.5 3.82 0.90383
10.0 3.42 0.94850
8.5 3.03 0.97350
  • Phase space of beam through SHMS. 2d histograms of the relative vertical ( y-axis) vs horizontal ( x-axis) positions at different locations in the Horizontal Bender,Q1, Q2, Q3, Dipole entrance,Dipole exit. The coordinates are in the coordinate system relative to the center of that magnet element. The vertical axis has positive direction is physical down. The horizontal axis has positive direction is away from beam line. The blue squares are events which make it to the focal plane. The colored squares are events which are rejected at the aperture. The critical aperatures are the HB entrance (horizontal), HB optical and physical exit (vertical), Q1 optical and physical exit (vertical and horizontal), dipole entrance (negative vertical), dipole middle and before (positive vertical), dipole exit (negative vertical).
  • Investigation of sieve slit placement. Run snake for a point target with -0.20 < delta < 0.22, abs(yptar) < 0.40 and abs(xptar) < 0.60 with sieve slit in front of Q1. 2D Plots of xptar versus delta, yptar versus delta, xptar versus yptar and x versus y at sieve position. One sees the correlation between yptar and delta to get through a fixed horizontal hole position at the Q1 sieve. A rough estimate has del(yptar)/del(delta) = 0.02 so knowledge of delta to the 5% level allows one to predict yptar to the 1mr level.