1 jones 1.1 logical function check_dipole(x,y)
2 implicit none
3
4 * Original version made on 04/01/98 by G.&I.Niculescu
5 * to more accurately model the size/shape of the HMS
6 * dipole ...
7
8 include 'apertures.inc'
9 real*8 x,y
10 real*8 x_local,y_local
11 logical check1,check2,check3,check4,check5,check6
12 logical tmp_check
13
14 check_dipole=.false.
15
16 * Let us observe first the obvious symmetry of the problem
17 * This helps reduce the checks to the first quadrant only...
18
19 x_local=abs(x)
20 y_local=abs(y)
21
22 jones 1.1 * Now compare the current position and compare it with the different
23 * apertures..
24
25 check1=((x_local.le.x_d1).and.(y_local.le.y_d1))
26 check2=((x_local.le.x_d2).and.(y_local.le.y_d2))
27 check3=((x_local.le.x_d3).and.(y_local.le.y_d3))
28 check4=((x_local.le.x_d4).and.(y_local.le.y_d4))
29
30 * now, the fifth check is the rounded corner
31
32 check5=(((x_local-x_d5)**2+(y_local-y_d5)**2).le.r_d5**2)
33
34 * lastly the slanted piece
35
36 check6=((x_local.ge.x_d4).and.(x_local.le.x_d3).and.
37 > ((y_local-a_d6*x_local-b_d6).le.0.0))
38
39 * now, if we OR all the above we should get the inside of the can
40
41 tmp_check=check1.or.check2.or.check3.or.check4.or.check5.or.check6
42
43 jones 1.1 * for whatever reason mc_hms expects us to return the OUTSIDE of the can so...
44
45 check_dipole = .not.tmp_check
46
47 return
48 end
|