]>
Commit | Line | Data |
---|---|---|
fe4da5cc | 1 | * |
2 | * $Id$ | |
3 | * | |
4 | * $Log$ | |
5 | * Revision 1.1.1.1 1995/10/24 10:20:30 cernlib | |
6 | * Geant | |
7 | * | |
8 | * | |
9 | #include "geant321/pilot.h" | |
10 | *CMZ : 3.21/02 29/03/94 15.41.27 by S.Giani | |
11 | *-- Author : | |
12 | SUBROUTINE GKHITS (IUSET,IUDET,EPSILO) | |
13 | C. | |
14 | C. ****************************************************************** | |
15 | C. * * | |
16 | C. * Prints the hit picked (using the graphics cursor) * | |
17 | C. * from all the hits of all tracks in detector IUDET * | |
18 | C. * of set IUSET, in case that the spatial coordinates * | |
19 | C. * of the hits had been stored as the first three words * | |
20 | C. * in the argument vector of GSAHIT. * | |
21 | C. * If the character typed to pick is 'K' or 'k' then the * | |
22 | C. * kinematics of the corresponding track is also printed. * | |
23 | C. * The picking is repeated until the character typed is * | |
24 | C. * 'Q' or 'q'. * | |
25 | C. * EPSILO is the pick aperture, i.e. the first hit that * | |
26 | C. * falls into the square centered at U0,V0 (the pick point) * | |
27 | C. * with half length EPSILO is kept. * | |
28 | C. * If EPSILO is negative then its absolute value is taken * | |
29 | C. * and in addition the pick square is drawn. * | |
30 | C. * If EPSILO is zero there is no pick aperture and over all * | |
31 | C. * the hits the one nearest to the pick point is taken. * | |
32 | C. * * | |
33 | C. * ==>Called by : <USER>, <GXINT> * | |
34 | C. * Authors : R.Brun, W.Gebel, P.Zanarini ********* * | |
35 | C. * * | |
36 | C. ****************************************************************** | |
37 | C. | |
38 | #include "geant321/gcbank.inc" | |
39 | #include "geant321/gcdraw.inc" | |
40 | #include "geant321/gcunit.inc" | |
41 | DIMENSION HITS(3,10) | |
42 | DIMENSION U(10),V(10) | |
43 | DIMENSION UP(5),VP(5) | |
44 | CHARACTER*4 IUSET,IUDET,KIUSET,KIUDET | |
45 | C. | |
46 | C. ------------------------------------------------------------------ | |
47 | C. | |
48 | CALL UCTOH('OFF ',IOFF,4,4) | |
49 | C | |
50 | C Set IOBJ to HIT | |
51 | C | |
52 | IOBJ=3 | |
53 | C | |
54 | 10 CONTINUE | |
55 | C | |
56 | CALL GDCURS(U0,V0,KCHAR) | |
57 | IF (KCHAR.EQ.0) GO TO 160 | |
58 | C | |
59 | IF (JHITS.LE.0) GOTO 160 | |
60 | NSET = IQ(JSET-1) | |
61 | NS1 = 1 | |
62 | NS2 = NSET | |
63 | IF (IUSET(1:1).EQ.'*') GOTO 20 | |
64 | CALL GLOOK(IUSET,IQ(JSET+1),NSET,ISET) | |
65 | IF (ISET .LE.0) GOTO 160 | |
66 | NS1 = ISET | |
67 | NS2 = ISET | |
68 | C | |
69 | 20 CONTINUE | |
70 | C | |
71 | EPSIL=ABS(EPSILO) | |
72 | EPSU=PLTRNX*EPSIL/20. | |
73 | EPSV=PLTRNY*EPSIL/20. | |
74 | IHITNR=0 | |
75 | DISTPK=1000000. | |
76 | C | |
77 | C Draw the pick box | |
78 | C | |
79 | IF (EPSILO.LT.0) THEN | |
80 | UP(1)=U0-EPSU | |
81 | VP(1)=V0-EPSV | |
82 | UP(2)=U0+EPSU | |
83 | VP(2)=VP(1) | |
84 | UP(3)=UP(2) | |
85 | VP(3)=V0+EPSV | |
86 | UP(4)=UP(1) | |
87 | VP(4)=VP(3) | |
88 | UP(5)=UP(1) | |
89 | VP(5)=VP(1) | |
90 | CALL GDRAWV(UP,VP,5) | |
91 | ENDIF | |
92 | C | |
93 | C loop on all selected sets | |
94 | C | |
95 | DO 140 ISET=NS1,NS2 | |
96 | C | |
97 | JS = LQ(JSET-ISET) | |
98 | JH = LQ(JHITS-ISET) | |
99 | IF(JS.LE.0)GO TO 140 | |
100 | IF(JH.LE.0)GO TO 140 | |
101 | NDET = IQ(JS-1) | |
102 | ND1 = 1 | |
103 | ND2 = NDET | |
104 | IF (IUDET(1:1).EQ.'*') GOTO 30 | |
105 | CALL GLOOK(IUDET,IQ(JS+1),NDET,IDET) | |
106 | IF (IDET .EQ.0) GOTO 140 | |
107 | ND1 = IDET | |
108 | ND2 = IDET | |
109 | 30 CONTINUE | |
110 | C | |
111 | C loop on selected detectors for this set | |
112 | C | |
113 | DO 130 IDET=ND1,ND2 | |
114 | C | |
115 | JD = LQ(JS-IDET) | |
116 | JHD = LQ(JH-IDET) | |
117 | IF (JHD .LE.0) GOTO 130 | |
118 | JDH = LQ(JD-1) | |
119 | ILAST = IQ(JH+IDET) | |
120 | IF (ILAST.EQ.0) GOTO 130 | |
121 | NV = IQ(JD+2) | |
122 | NH = IQ(JD+4) | |
123 | NW = IQ(JD+1) + IQ(JD+3) + 1 | |
124 | C | |
125 | C Now loop on all hits to get their space coordinates | |
126 | C | |
127 | MH = 0 | |
128 | IHIT = 0 | |
129 | DO 120 I=1,ILAST,NW | |
130 | IHIT = IHIT + 1 | |
131 | ITRA = IQ(JHD+I) | |
132 | C | |
133 | C Is THRZ option set on (R-Z projection) | |
134 | C and the cut lateral (vertical or horizontal) ? | |
135 | C | |
136 | IF (ITHRZ.NE.IOFF) THEN | |
137 | IF (ICUT.EQ.1.OR.ICUT.EQ.2) ITR3D=-ITRA | |
138 | ELSE | |
139 | ITR3D=0 | |
140 | ENDIF | |
141 | C | |
142 | C Skip words with volume numbers | |
143 | C | |
144 | NK = 1 | |
145 | K = 1 | |
146 | IF (NV.LE.0) GOTO 50 | |
147 | DO 40 IV=1,NV | |
148 | NB = IQ(JD+2*IV+10) | |
149 | IF (NB.EQ.0) NB=32 | |
150 | K = NB + K | |
151 | IF (K.LE.33) GOTO 40 | |
152 | NK = NK + 1 | |
153 | K = NB + 1 | |
154 | 40 CONTINUE | |
155 | NK = NK + 1 | |
156 | C | |
157 | C Get unpacked (first three !) HITS. | |
158 | C Hits origin is shifted. Division by scale factor. | |
159 | C | |
160 | 50 CONTINUE | |
161 | IF (NH.LE.2) GOTO 120 | |
162 | MH = MH + 1 | |
163 | K=1 | |
164 | DO 90 IH=1,3 | |
165 | NB = IQ(JDH+4*IH-2) | |
166 | IF (NB.GT.0) GOTO 60 | |
167 | IF (K.GT.1) THEN | |
168 | NK=NK+1 | |
169 | ENDIF | |
170 | KHIT = IQ(JHD+I+NK) | |
171 | K = 1 | |
172 | NK = NK + 1 | |
173 | GOTO 80 | |
174 | 60 IF (K+NB.LE.33) GOTO 70 | |
175 | K = 1 | |
176 | NK = NK + 1 | |
177 | 70 KHIT = IBITS(IQ(JHD+I+NK),K-1,NB) | |
178 | K = K + NB | |
179 | 80 CONTINUE | |
180 | HITS(IH,MH)= FLOAT(KHIT)/Q(JDH+4*IH) - Q(JDH+4*IH-1) | |
181 | 90 CONTINUE | |
182 | C | |
183 | C Scan the hits (usually 10 at a time); | |
184 | C flush HITS vector if | |
185 | C --loop on this detector volume is to finish, | |
186 | C --loop on current track is to finish, | |
187 | C --HITS vector is full. | |
188 | C | |
189 | IF ((ILAST-I).LT.NW) GOTO 100 | |
190 | ITRN = IQ(JHD+I+NW) | |
191 | IF (ITRA.NE.ITRN) GOTO 100 | |
192 | IF (MH .NE. 10) GOTO 120 | |
193 | C | |
194 | 100 CONTINUE | |
195 | C | |
196 | CALL GDFR3D(HITS(1,1),MH,U,V) | |
197 | C | |
198 | DO 110 IP=1,MH | |
199 | C | |
200 | IF (EPSILO.NE.0) THEN | |
201 | IF (U(IP).LT.U0-EPSU) GO TO 110 | |
202 | IF (U(IP).GT.U0+EPSU) GO TO 110 | |
203 | IF (V(IP).LT.V0-EPSV) GO TO 110 | |
204 | IF (V(IP).GT.V0+EPSV) GO TO 110 | |
205 | II=IP | |
206 | IHITNR=IHIT-MH+II | |
207 | JS = LQ(JSET-ISET) | |
208 | CALL UHTOC(IQ(JSET+ISET),4,KIUSET,4) | |
209 | CALL UHTOC(IQ(JS+IDET) ,4,KIUDET,4) | |
210 | KITRA=ITRA | |
211 | GO TO 150 | |
212 | ELSE | |
213 | DIST=(U(IP)-U0)*(U(IP)-U0)+(V(IP)-V0)*(V(IP)-V0) | |
214 | IF (DIST.LT.DISTPK) THEN | |
215 | DISTPK=DIST | |
216 | II=IP | |
217 | IHITNR=IHIT-MH+II | |
218 | JS = LQ(JSET-ISET) | |
219 | CALL UHTOC(IQ(JSET+ISET),4,KIUSET,4) | |
220 | CALL UHTOC(IQ(JS+IDET) ,4,KIUDET,4) | |
221 | KITRA=ITRA | |
222 | ENDIF | |
223 | ENDIF | |
224 | C | |
225 | 110 CONTINUE | |
226 | C | |
227 | MH=0 | |
228 | C | |
229 | 120 CONTINUE | |
230 | C | |
231 | 130 CONTINUE | |
232 | C | |
233 | 140 CONTINUE | |
234 | C | |
235 | IF (EPSILO.EQ.0) GO TO 150 | |
236 | C | |
237 | C Hit not picked | |
238 | C | |
239 | WRITE (CHMAIL,1000) | |
240 | CALL GMAIL(0,0) | |
241 | C | |
242 | C Restart for another pick operation | |
243 | C | |
244 | GO TO 10 | |
245 | C | |
246 | C Hit picked | |
247 | C | |
248 | 150 CONTINUE | |
249 | C | |
250 | C Highlight the picked hit | |
251 | C | |
252 | UDELTA=0.05*PLTRNX/20. | |
253 | VDELTA=0.05*PLTRNY/20. | |
254 | UP(1)=U(II)-UDELTA | |
255 | VP(1)=V(II)-VDELTA | |
256 | UP(2)=U(II)+UDELTA | |
257 | VP(2)=VP(1) | |
258 | UP(3)=UP(2) | |
259 | VP(3)=V(II)+VDELTA | |
260 | UP(4)=UP(1) | |
261 | VP(4)=VP(3) | |
262 | UP(5)=UP(1) | |
263 | VP(5)=VP(1) | |
264 | CALL GDRAWV(UP,VP,5) | |
265 | C | |
266 | C Print parameters of the picked hit | |
267 | C | |
268 | IPKHIT=IHITNR | |
269 | IF (IPKHIT.GT.0) CALL GPHITS(KIUSET,KIUDET) | |
270 | IPKHIT=0 | |
271 | CALL GPKINE(KITRA) | |
272 | C | |
273 | C Restart for another pick operation | |
274 | C | |
275 | GO TO 10 | |
276 | C | |
277 | 160 CONTINUE | |
278 | C | |
279 | C Reset ITR3D to 'standard projection' | |
280 | C | |
281 | ITR3D=0 | |
282 | IOBJ=0 | |
283 | C | |
284 | 1000 FORMAT (' GKHITS: No hit picked') | |
285 | RETURN | |
286 | END |