26 |
* - old routine |
* - old routine |
27 |
* |
* |
28 |
* DOTRACK2(NPOINT,ZIN,XOUT,YOUT,THXOUT,THYOUT,TLOUT,AL_P,IFAIL) |
* DOTRACK2(NPOINT,ZIN,XOUT,YOUT,THXOUT,THYOUT,TLOUT,AL_P,IFAIL) |
29 |
* - as the old one, but: |
* - as the previous one, but: |
30 |
* -- the projected angles are given as output |
* -- the projected angles are given as output |
31 |
* -- the track lengths are given as output: |
* -- the track lengths are given as output: |
32 |
* ---- for planes above the reference plane, the length until |
* ---- for planes above the reference plane, the length until |
35 |
* the higher closest plane (reference plane included) |
* the higher closest plane (reference plane included) |
36 |
* |
* |
37 |
* March 2008 --> optimized by Paolo |
* March 2008 --> optimized by Paolo |
38 |
|
* |
39 |
|
* DOTRACK3(NPOINT,ZIN,XOUT,YOUT,THXOUT,THYOUT,TLOUT,AL_P,IFAIL) |
40 |
|
* - as the previous one, but with the coordinate ZINI of the reference |
41 |
|
* plane given as input parameter |
42 |
|
* |
43 |
|
* |
44 |
************************************************************** |
************************************************************** |
45 |
|
|
46 |
|
|
47 |
SUBROUTINE |
SUBROUTINE |
48 |
$ DOTRACK2(NPOINT,ZIN,XOUT,YOUT,THXOUT,THYOUT,TLOUT,AL_P,IFAIL) |
$ DOTRACK3(NPOINT,ZIN,XOUT,YOUT,THXOUT,THYOUT,TLOUT,AL_P |
49 |
|
$ ,ZINI,IFAIL) |
50 |
|
|
51 |
IMPLICIT DOUBLE PRECISION (A-H,O-Z) |
IMPLICIT DOUBLE PRECISION (A-H,O-Z) |
52 |
|
|
64 |
DIMENSION TLOUT(NPOINT_MAX) |
DIMENSION TLOUT(NPOINT_MAX) |
65 |
DIMENSION AL_P(5) |
DIMENSION AL_P(5) |
66 |
* ----------------------------------------------- |
* ----------------------------------------------- |
67 |
DATA ZINI/23.5/ !z coordinate of the reference plane |
* DATA ZINI/23.5/ !z coordinate of the reference plane |
68 |
REAL*8 L |
REAL*8 L |
69 |
|
|
70 |
* ================================================================== |
* ================================================================== |
210 |
|
|
211 |
RETURN |
RETURN |
212 |
END |
END |
213 |
|
************************************************************************ |
214 |
|
* |
215 |
|
* |
216 |
|
* |
217 |
|
* |
218 |
|
************************************************************************ |
219 |
|
|
220 |
|
SUBROUTINE |
221 |
|
$ DOTRACK2(NPOINT,ZIN,XOUT,YOUT,THXOUT,THYOUT,TLOUT,AL_P,IFAIL) |
222 |
|
|
223 |
|
IMPLICIT DOUBLE PRECISION (A-H,O-Z) |
224 |
|
|
225 |
|
|
226 |
|
ccc DIMENSION VECT(7),VECTINI(7),VOUT(7) |
227 |
|
ccc DATA TOLL/1.d-8/ |
228 |
|
|
229 |
|
* tolerance in reaching the next plane during the tracking procedure |
230 |
|
* ----------------------------------------------- |
231 |
|
* I/O parameters |
232 |
|
PARAMETER (NPOINT_MAX=100) |
233 |
|
DIMENSION ZIN(NPOINT_MAX) |
234 |
|
DIMENSION XOUT(NPOINT_MAX),YOUT(NPOINT_MAX) |
235 |
|
DIMENSION THXOUT(NPOINT_MAX),THYOUT(NPOINT_MAX) |
236 |
|
DIMENSION TLOUT(NPOINT_MAX) |
237 |
|
DIMENSION AL_P(5) |
238 |
|
* ----------------------------------------------- |
239 |
|
DATA ZINI/23.5/ !z coordinate of the reference plane |
240 |
|
ccc REAL*8 L |
241 |
|
|
242 |
|
CALL DOTRACK3(NPOINT,ZIN,XOUT,YOUT,THXOUT,THYOUT,TLOUT,AL_P |
243 |
|
$ ,ZINI,IFAIL) |
244 |
|
|
245 |
|
ccc |
246 |
|
ccc OLD-OLD-OLD-OLD-OLD-OLD-OLD-OLD-OLD-OLD-OLD-OLD-OLD-OLD-OLD-OLD-OLD-OLD |
247 |
|
ccc |
248 |
|
|
249 |
|
c$$$* ================================================================== |
250 |
|
c$$$* divide the track in two parts: below and above the reference plane |
251 |
|
c$$$* ================================================================== |
252 |
|
c$$$ IUPDOWN=0 |
253 |
|
c$$$ DO I=1,NPOINT |
254 |
|
c$$$ IF(ZIN(I).LT.ZINI)THEN |
255 |
|
c$$$ if(i.ne.1)IUPDOWN=I |
256 |
|
c$$$ GOTO 88 |
257 |
|
c$$$ ENDIF |
258 |
|
c$$$ IUPDOWN=NPOINT+1 |
259 |
|
c$$$ ENDDO |
260 |
|
c$$$ 88 CONTINUE |
261 |
|
c$$$ |
262 |
|
c$$$* ================================================================== |
263 |
|
c$$$* track from reference plane DOWN |
264 |
|
c$$$* ================================================================== |
265 |
|
c$$$* parameters for GRKUTA |
266 |
|
c$$$ IF(AL_P(5).NE.0) CHARGE=AL_P(5)/DABS(AL_P(5)) |
267 |
|
c$$$ IF(AL_P(5).EQ.0) CHARGE=1. |
268 |
|
c$$$ VOUT(1)=AL_P(1) |
269 |
|
c$$$ VOUT(2)=AL_P(2) |
270 |
|
c$$$ VOUT(3)=ZINI |
271 |
|
c$$$ VOUT(4)=AL_P(3)*DCOS(AL_P(4)) |
272 |
|
c$$$ VOUT(5)=AL_P(3)*DSIN(AL_P(4)) |
273 |
|
c$$$ VOUT(6)=-1.*DSQRT(1.-AL_P(3)**2) |
274 |
|
c$$$ IF(AL_P(5).NE.0.) VOUT(7)=DABS(1./AL_P(5)) |
275 |
|
c$$$ IF(AL_P(5).EQ.0.) VOUT(7)=1.E8 |
276 |
|
c$$$ DO I=MAX(IUPDOWN,1),NPOINT |
277 |
|
c$$$ L = 0.0 |
278 |
|
c$$$ 10 DO J=1,7 |
279 |
|
c$$$ VECT(J)=VOUT(J) |
280 |
|
c$$$ VECTINI(J)=VOUT(J) |
281 |
|
c$$$ ENDDO |
282 |
|
c$$$ IF(VOUT(6).GE.0.) THEN |
283 |
|
c$$$ IFAIL=1 |
284 |
|
c$$$c$$$ if(TRKVERBOSE) |
285 |
|
c$$$c$$$ $ PRINT *,'dofit (grkuta): WARNING ===> backward track!!' |
286 |
|
c$$$ RETURN |
287 |
|
c$$$ ENDIF |
288 |
|
c$$$ step=(zin(i)-vect(3))/VOUT(6) |
289 |
|
c$$$ 11 continue |
290 |
|
c$$$ CALL GRKUTA(CHARGE,STEP,VECT,VOUT) |
291 |
|
c$$$ L = L + STEP |
292 |
|
c$$$ IF(VOUT(3).GT.VECT(3)) THEN |
293 |
|
c$$$ IFAIL=1 |
294 |
|
c$$$c$$$ if(TRKVERBOSE) |
295 |
|
c$$$c$$$ $ PRINT *,'dofit (grkuta): WARNING ===> backward track!!' |
296 |
|
c$$$c$$$ if(TRKVERBOSE)print*,'charge',charge |
297 |
|
c$$$c$$$ if(TRKVERBOSE)print*,'vect',vect |
298 |
|
c$$$c$$$ if(TRKVERBOSE)print*,'vout',vout |
299 |
|
c$$$c$$$ if(TRKVERBOSE)print*,'step',step |
300 |
|
c$$$c$$$ if(TRKVERBOSE)print*,'DeltaB',DELTA0,DELTA1 |
301 |
|
c$$$ RETURN |
302 |
|
c$$$ ENDIF |
303 |
|
c$$$ Z=VOUT(3) |
304 |
|
c$$$ IF(Z.LE.ZIN(I)+TOLL.AND.Z.GE.ZIN(I)-TOLL) GOTO 100 |
305 |
|
c$$$ IF(Z.GT.ZIN(I)+TOLL) GOTO 10 |
306 |
|
c$$$ IF(Z.LE.ZIN(I)-TOLL) THEN |
307 |
|
c$$$ L = L - STEP |
308 |
|
c$$$ STEP=STEP*(ZIN(I)-VECT(3))/(Z-VECT(3)) |
309 |
|
c$$$ DO J=1,7 |
310 |
|
c$$$ VECT(J)=VECTINI(J) |
311 |
|
c$$$ ENDDO |
312 |
|
c$$$ GOTO 11 |
313 |
|
c$$$ ENDIF |
314 |
|
c$$$ 100 XOUT(I)=VOUT(1) |
315 |
|
c$$$ YOUT(I)=VOUT(2) |
316 |
|
c$$$ ZIN(I)=VOUT(3) |
317 |
|
c$$$ IF(VOUT(3).ne.0)THEN |
318 |
|
c$$$ THXOUT(I)=DATAN(VOUT(4)/VOUT(6))*180./ACOS(-1.) |
319 |
|
c$$$ THYOUT(I)=DATAN(VOUT(5)/VOUT(6))*180./ACOS(-1.) |
320 |
|
c$$$ ENDIF |
321 |
|
c$$$ TLOUT(I) = L |
322 |
|
c$$$c print*,'D ',VECT(3),VOUT(3),VOUT(8),STEP |
323 |
|
c$$$ ENDDO |
324 |
|
c$$$ |
325 |
|
c$$$* ================================================================== |
326 |
|
c$$$* track from reference plane UP |
327 |
|
c$$$* ================================================================== |
328 |
|
c$$$* parameters for GRKUTA: |
329 |
|
c$$$* -opposite charge |
330 |
|
c$$$* -opposite momentum direction |
331 |
|
c$$$ IF(AL_P(5).NE.0) CHARGE=-AL_P(5)/DABS(AL_P(5)) |
332 |
|
c$$$ IF(AL_P(5).EQ.0) CHARGE=-1. |
333 |
|
c$$$ VOUT(1)=AL_P(1) |
334 |
|
c$$$ VOUT(2)=AL_P(2) |
335 |
|
c$$$ VOUT(3)=ZINI |
336 |
|
c$$$ VOUT(4)=-AL_P(3)*DCOS(AL_P(4)) |
337 |
|
c$$$ VOUT(5)=-AL_P(3)*DSIN(AL_P(4)) |
338 |
|
c$$$ VOUT(6)=1.*DSQRT(1.-AL_P(3)**2) |
339 |
|
c$$$ IF(AL_P(5).NE.0.) VOUT(7)=DABS(1./AL_P(5)) |
340 |
|
c$$$ IF(AL_P(5).EQ.0.) VOUT(7)=1.E8 |
341 |
|
c$$$ DO I=MIN((IUPDOWN-1),NPOINT),1,-1 |
342 |
|
c$$$ L = 0.0 |
343 |
|
c$$$ |
344 |
|
c$$$ 20 DO J=1,7 |
345 |
|
c$$$ VECT(J)=VOUT(J) |
346 |
|
c$$$ VECTINI(J)=VOUT(J) |
347 |
|
c$$$ ENDDO |
348 |
|
c$$$ IF(VOUT(6).LE.0.) THEN |
349 |
|
c$$$ IFAIL=1 |
350 |
|
c$$$c$$$ if(TRKVERBOSE) |
351 |
|
c$$$c$$$ $ PRINT *,'dofit (grkuta): WARNING ===> backward track!!' |
352 |
|
c$$$ RETURN |
353 |
|
c$$$ ENDIF |
354 |
|
c$$$ step=(zin(i)-vect(3))/VOUT(6) |
355 |
|
c$$$ 22 continue |
356 |
|
c$$$ CALL GRKUTA(CHARGE,STEP,VECT,VOUT) |
357 |
|
c$$$ L = L + STEP |
358 |
|
c$$$ IF(VOUT(3).LT.VECT(3)) THEN |
359 |
|
c$$$ IFAIL=1 |
360 |
|
c$$$c$$$ if(TRKVERBOSE) |
361 |
|
c$$$c$$$ $ PRINT *,'dofit (grkuta): WARNING ===> backward track!!' |
362 |
|
c$$$c$$$ if(TRKVERBOSE)print*,'charge',charge |
363 |
|
c$$$c$$$ if(TRKVERBOSE)print*,'vect',vect |
364 |
|
c$$$c$$$ if(TRKVERBOSE)print*,'vout',vout |
365 |
|
c$$$c$$$ if(TRKVERBOSE)print*,'step',step |
366 |
|
c$$$c$$$ if(TRKVERBOSE)print*,'DeltaB',DELTA0,DELTA1 |
367 |
|
c$$$ RETURN |
368 |
|
c$$$ ENDIF |
369 |
|
c$$$ Z=VOUT(3) |
370 |
|
c$$$ IF(Z.LE.ZIN(I)+TOLL.AND.Z.GE.ZIN(I)-TOLL) GOTO 200 |
371 |
|
c$$$ IF(Z.LT.ZIN(I)-TOLL) GOTO 20 |
372 |
|
c$$$ IF(Z.GE.ZIN(I)+TOLL) THEN |
373 |
|
c$$$ L = L - STEP |
374 |
|
c$$$ STEP=STEP*(ZIN(I)-VECT(3))/(Z-VECT(3)) |
375 |
|
c$$$ DO J=1,7 |
376 |
|
c$$$ VECT(J)=VECTINI(J) |
377 |
|
c$$$ ENDDO |
378 |
|
c$$$ GOTO 22 |
379 |
|
c$$$ ENDIF |
380 |
|
c$$$ 200 XOUT(I)=VOUT(1) |
381 |
|
c$$$ YOUT(I)=VOUT(2) |
382 |
|
c$$$ ZIN(I)=VOUT(3) |
383 |
|
c$$$ IF(VOUT(3).ne.0)THEN |
384 |
|
c$$$ THXOUT(I)=DATAN(VOUT(4)/VOUT(6))*180./ACOS(-1.) |
385 |
|
c$$$ THYOUT(I)=DATAN(VOUT(5)/VOUT(6))*180./ACOS(-1.) |
386 |
|
c$$$ ENDIF |
387 |
|
c$$$ TLOUT(I) = L |
388 |
|
c$$$ ENDDO |
389 |
|
c$$$ |
390 |
|
RETURN |
391 |
|
END |
392 |
|
|
393 |
************************************************************************ |
************************************************************************ |
394 |
* |
* |