1 | * |
---|
2 | * ******************************************************************** |
---|
3 | * * License and Disclaimer * |
---|
4 | * * * |
---|
5 | * * The Geant4 software is copyright of the Copyright Holders of * |
---|
6 | * * the Geant4 Collaboration. It is provided under the terms and * |
---|
7 | * * conditions of the Geant4 Software License, included in the file * |
---|
8 | * * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
9 | * * include a list of copyright holders. * |
---|
10 | * * * |
---|
11 | * * Neither the authors of this software system, nor their employing * |
---|
12 | * * institutes,nor the agencies providing financial support for this * |
---|
13 | * * work make any representation or warranty, express or implied, * |
---|
14 | * * regarding this software system or assume any liability for its * |
---|
15 | * * use. Please see the license in the file LICENSE and URL above * |
---|
16 | * * for the full disclaimer and the limitation of liability. * |
---|
17 | * * * |
---|
18 | * * This code implementation is the result of the scientific and * |
---|
19 | * * technical work of the GEANT4 collaboration. * |
---|
20 | * * By using, copying, modifying or distributing the software (or * |
---|
21 | * * any work based on the software) you agree to acknowledge its * |
---|
22 | * * use in resulting scientific publications, and indicate your * |
---|
23 | * * acceptance of all terms of the Geant4 Software license. * |
---|
24 | * ******************************************************************** |
---|
25 | * |
---|
26 | PROGRAM MakeGridScripts |
---|
27 | C ------------------------------ |
---|
28 | C Produces a set of GEANT4 scripts using |
---|
29 | C the "Fred" test program "shadow" feature |
---|
30 | C |
---|
31 | IMPLICIT NONE |
---|
32 | Integer Icount, idx, idy, idxy, idz |
---|
33 | Real dx, dy, dz, theta, phi |
---|
34 | C |
---|
35 | Real ddxy(0:6)/0.0, 0.1, -0.1, 0.2, -0.2, 0.4, 0.6/ |
---|
36 | C |
---|
37 | Real zddx(14)/ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.001, |
---|
38 | + -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -0.001 / |
---|
39 | Real zddy(14)/ 0.0, -0.1, -0.2, -0.4, -0.6, -1.0, -100.0, |
---|
40 | + 0.0, 0.1, 0.2, 0.4, 0.6, 1.0, 100.0 / |
---|
41 | Real zddz(4)/ 0.0, 0.1, 0.2, 0.4 / |
---|
42 | C |
---|
43 | 100 FORMAT( '/vis~/camera/viewpoint ', F13.9, ' ', F14.9 ) |
---|
44 | 101 FORMAT( '/gridGun/origin ', 3F13.8 ) |
---|
45 | 102 FORMAT( '/gridGun/direction ', 3F13.8 ) |
---|
46 | 103 FORMAT( '/run/beamOn 1' ) |
---|
47 | 104 FORMAT( '# view number ', I4 ) |
---|
48 | 105 FORMAT( '/fred/pause' ) |
---|
49 | 106 FORMAT( '/gridGun/grid1', 3F13.8 ) |
---|
50 | 107 FORMAT( '/gridGun/grid2', 3F13.8 ) |
---|
51 | C |
---|
52 | Icount = 0 |
---|
53 | C |
---|
54 | C --- Scripts where the origin is a z-plane of -2 |
---|
55 | C |
---|
56 | open(unit=10,file='grids1.script',form='FORMATTED') |
---|
57 | write(10,'(''/fred/gun GRID'')') |
---|
58 | write(10,'(''/fred/draw SHADOW'')') |
---|
59 | C |
---|
60 | write(10,106) 4.0, 0.0, 0.0 |
---|
61 | write(10,107) 0.0, 4.0, 0.0 |
---|
62 | C |
---|
63 | do idy = 0, 6 |
---|
64 | do idx = 0, 6 |
---|
65 | C |
---|
66 | dx = ddxy(idx) |
---|
67 | dy = ddxy(idy) |
---|
68 | C |
---|
69 | theta = atan( sqrt(dx**2+dy**2) )*180/3.14159265 |
---|
70 | if (idx.eq.0.and.idy.eq.0) then |
---|
71 | phi = 0.0 |
---|
72 | else |
---|
73 | phi = atan2(dy,dx)*180/3.14159265 |
---|
74 | endif |
---|
75 | C |
---|
76 | write(10,100) theta, phi |
---|
77 | write(10,101) -2.0-2.0*dx, -2.0-2.0*dy, -2.0 |
---|
78 | write(10,102) dx, dy, 1.0 |
---|
79 | write(10,103) |
---|
80 | write(10,104) icount |
---|
81 | write(10,105) |
---|
82 | icount = icount + 1 |
---|
83 | C |
---|
84 | enddo |
---|
85 | enddo |
---|
86 | close(10) |
---|
87 | C |
---|
88 | C --- Scripts where the origin is a z-plane of +2 |
---|
89 | C |
---|
90 | open(unit=10,file='grids2.script',form='FORMATTED') |
---|
91 | write(10,'(''/fred/gun GRID'')') |
---|
92 | write(10,'(''/fred/draw SHADOW'')') |
---|
93 | C |
---|
94 | write(10,106) 2.0, 0.0, 0.0 |
---|
95 | write(10,107) 0.0, 2.0, 0.0 |
---|
96 | C |
---|
97 | do idy = 0, 6 |
---|
98 | do idx = 0, 6 |
---|
99 | C |
---|
100 | dx = ddxy(idx) |
---|
101 | dy = ddxy(idy) |
---|
102 | C |
---|
103 | theta = atan( sqrt(dx**2+dy**2) )*180/3.14159265 |
---|
104 | if (idx.eq.0.and.idy.eq.0) then |
---|
105 | phi = 0.0 |
---|
106 | else |
---|
107 | phi = atan2(dy,dx)*180/3.14159265 |
---|
108 | endif |
---|
109 | C |
---|
110 | write(10,100) theta, phi |
---|
111 | write(10,101) -2.0+2.0*dx, -2.0+2.0*dy, +2.0 |
---|
112 | write(10,102) -dx, -dy, -1.0 |
---|
113 | write(10,103) |
---|
114 | write(10,104) icount |
---|
115 | write(10,105) |
---|
116 | icount = icount + 1 |
---|
117 | C |
---|
118 | enddo |
---|
119 | enddo |
---|
120 | close(10) |
---|
121 | C |
---|
122 | C --- Okay: origin is a plane parallel to z-axis |
---|
123 | C |
---|
124 | open(unit=10,file='grids3.script',form='FORMATTED') |
---|
125 | write(10,'(''/fred/gun GRID'')') |
---|
126 | write(10,'(''/fred/draw SHADOW'')') |
---|
127 | C |
---|
128 | write(10,107) 0.0, 0.0, 4.0 |
---|
129 | C |
---|
130 | do idz = 1, 4 |
---|
131 | dz = zddz(idz) |
---|
132 | do idxy = 1, 14 |
---|
133 | C |
---|
134 | dx = zddx(idxy) |
---|
135 | dy = zddy(idxy) |
---|
136 | if (abs(dx).lt.0.01) then |
---|
137 | C |
---|
138 | C --- Special case: origin is y-plane |
---|
139 | C |
---|
140 | write(10,106) 4.0, 0.0, 0.0 |
---|
141 | C |
---|
142 | theta = atan( 1.0/dz )*180/3.14159265 |
---|
143 | if (dy.lt.0) then |
---|
144 | phi = 270 |
---|
145 | else |
---|
146 | phi = 90 |
---|
147 | endif |
---|
148 | write(10,100) theta, phi |
---|
149 | write(10,101) -2.0, sign(2.0,dy), -2.0+2.0*dz |
---|
150 | write(10,102) 0.0, sign(1.0,-dy), -dz |
---|
151 | write(10,103) |
---|
152 | write(10,104) icount |
---|
153 | write(10,105) |
---|
154 | icount = icount + 1 |
---|
155 | else |
---|
156 | C |
---|
157 | write(10,106) 0.0, 4.0, 0.0 |
---|
158 | C |
---|
159 | if (dz.eq.0) then |
---|
160 | theta = 90.0 |
---|
161 | else |
---|
162 | theta = atan( sqrt(dx**2+dy**2)/dz )*180/3.14159265 |
---|
163 | endif |
---|
164 | phi = atan2(dy,dx)*180/3.14159265 |
---|
165 | C |
---|
166 | write(10,100) theta, phi |
---|
167 | write(10,101) sign(2.0,-dx), -2.0-2.0*dy, -2.0-2.0*dz |
---|
168 | write(10,102) dx, dy, dz |
---|
169 | write(10,103) |
---|
170 | write(10,104) icount |
---|
171 | write(10,105) |
---|
172 | icount = icount + 1 |
---|
173 | endif |
---|
174 | enddo |
---|
175 | enddo |
---|
176 | C |
---|
177 | close(10) |
---|
178 | STOP |
---|
179 | END |
---|