1 gaskelld 1.1 subroutine rotate_haxis(rotang,xp0,yp0)
2
3 C+______________________________________________________________________________
4 !
5 ! ROTATE_HAXIS- Calculate new trajectory coordinates in reference frame rotated
6 ! about horizontal axis by angle ROTANG relative to central ray.
7 !
8 ! *** Right-handed TRANSPORT coordinates are assumed! ***
9 !
10 ! ROTANG is an angle about the negative Y-axis.
11 ! For the SOS BM01 entrance, it is a negative number.
12 !
13 ! Input trajectory is: X = XS + ALPHA*(Z-ZS)
14 ! Y = YS + BETA *(Z-ZS)
15 ! Z = ZS is current point.
16 !
17 ! Output traject is: XP = XP0 + ALPHA_P*ZP
18 ! YP = YP0 + BETA_P *ZP
19 ! ZP = 0 gives intersection of track with rotated plane.
20 !
21 ! ROTANG (R*4): Rotation angle in degrees.
22 gaskelld 1.1 !
23 ! D. Potterveld, 15-Mar-1993.
24 C-______________________________________________________________________________
25
26 implicit none
27
28 include '../spectrometers.inc'
29
30 real*8 rotang,xp0,yp0,xi
31 real*8 alpha,beta,alpha_p,beta_p,sin_th,cos_th,tan_th
32 real*8 rotang_rad, raddeg
33
34 save
35
36 C ============================= Executable Code ================================
37
38 C Sep. 2008 DJG: No equivaleent to sind etc. in gfortran. Convert to radians first.
39
40
41 parameter (raddeg=0.017453292)
42
43 gaskelld 1.1 rotang_rad = rotang*raddeg
44
45 c1 tan_th = tand(rotang)
46 c sin_th = sind(rotang)
47 c cos_th = cosd(rotang)
48
49 1 tan_th = tan(rotang_rad)
50 sin_th = sin(rotang_rad)
51 cos_th = cos(rotang_rad)
52
53 alpha = dxdzs
54 beta = dydzs
55
56 alpha_p= (alpha + tan_th)/(1. - alpha*tan_th)
57 beta_p = beta/(cos_th - alpha*sin_th)
58
59 xi = xp0
60 xp0 = xi*(cos_th + alpha_p*sin_th)
61 yp0 = yp0 + xi*beta_p*sin_th
62
63 return
64 gaskelld 1.1 end
|