/[PAMELA software]/DarthVader/TrackerLevel2/src/F77/grkuta.f
ViewVC logotype

Annotation of /DarthVader/TrackerLevel2/src/F77/grkuta.f

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.9 - (hide annotations) (download)
Thu Jan 16 15:29:55 2014 UTC (10 years, 10 months ago) by mocchiut
Branch: MAIN
CVS Tags: v10RED
Changes since 1.8: +1 -1 lines
Compilation warnings using GCC4.7 fixed

1 mocchiut 1.1 **********************************************************************
2     *
3     *
4     * routine per tracciare la particella di uno STEP
5     *
6     SUBROUTINE GRKUTA (CHARGE,STEP,VECT,VOUT)
7     C.
8     C. ******************************************************************
9     C. * *
10     C. * Runge-Kutta method for tracking a particle through a magnetic *
11     C. * field. Uses Nystroem algorithm (See Handbook Nat. Bur. of *
12     C. * Standards, procedure 25.5.20) *
13     C. * *
14     C. * Input parameters *
15     C. * CHARGE Particle charge *
16     C. * STEP Step size *
17     C. * VECT Initial co-ords,direction cosines,momentum *
18     C. * Output parameters *
19     C. * VOUT Output co-ords,direction cosines,momentum *
20     C. * User routine called *
21     C. * CALL GUFLD(X,F) *
22     C. * *
23     C. * ==>Called by : <USER>, GUSWIM *
24     C. * Authors R.Brun, M.Hansroul ********* *
25     C. * V.Perevoztchikov (CUT STEP implementation) *
26     C. * *
27     C. * *
28     C. ******************************************************************
29     C.
30     IMPLICIT DOUBLE PRECISION(A-H,O-Z)
31 pam-fi 1.7 COMMON/DELTAB/DELTA0,DELTA1,DLT
32 mocchiut 1.1 *
33     REAL VVV(3),FFF(3)
34     REAL*8 CHARGE, STEP, VECT(*), VOUT(*), F(4)
35     REAL*8 XYZT(3), XYZ(3), X, Y, Z, XT, YT, ZT
36     DIMENSION SECXS(4),SECYS(4),SECZS(4),HXP(3)
37     EQUIVALENCE (X,XYZ(1)),(Y,XYZ(2)),(Z,XYZ(3)),
38     + (XT,XYZT(1)),(YT,XYZT(2)),(ZT,XYZT(3))
39     *
40     PARAMETER (MAXIT = 1992, MAXCUT = 11)
41 pam-fi 1.7 cPP PARAMETER (EC=2.9979251D-4,DLT=1D-4,DLT32=DLT/32)
42     PARAMETER (EC=2.99792458D-4)
43     cPP PARAMETER (ZERO=0, ONE=1, TWO=2, THREE=3)
44     PARAMETER (ZERO=0.D0, ONE=1.D0, TWO=2.D0, THREE=3.D0)
45 mocchiut 1.1 PARAMETER (THIRD=ONE/THREE, HALF=ONE/TWO)
46     PARAMETER (PISQUA=.986960440109D+01)
47 pam-fi 1.2 PARAMETER (IX=1,IY=2,IZ=3,IPX=4,IPY=5,IPZ=6)
48 mocchiut 1.1
49 pam-fi 1.6 REAL*8 DELTAB(3)
50 pam-fi 1.7 REAL*8 DLT32
51     DLT32=DLT/32.
52 pam-fi 1.6
53 mocchiut 1.1 *.
54     *. ------------------------------------------------------------------
55     *.
56     * This constant is for units CM,GEV/C and KGAUSS
57     *
58 pam-fi 1.6
59 mocchiut 1.1 ITER = 0
60     NCUT = 0
61     DO 10 J=1,7
62     VOUT(J)=VECT(J)
63     10 CONTINUE
64     PINV = EC * CHARGE / VECT(7)
65     TL = 0.
66     H = STEP
67     *
68     *
69     20 REST = STEP-TL
70     IF (DABS(H).GT.DABS(REST)) H = REST
71     DO I=1,3
72     VVV(I)=SNGL(VOUT(I))
73     ENDDO
74    
75     CALL GUFLD(VVV,FFF)
76     * print*,'GRKUTA Bx,By,Bz: ',(FFF(i),i=1,3)
77     DO I=1,3
78     F(I)=DBLE(FFF(I))
79     ENDDO
80 pam-fi 1.6 DELTAB(2) = -F(2)*VECT(7)*CHARGE*(DELTA0+DELTA1*VVV(2))
81     F(2) = F(2)+DELTAB(2)
82     cPP -----------------
83 mocchiut 1.1 *
84     * Start of integration
85     *
86     X = VOUT(1)
87     Y = VOUT(2)
88     Z = VOUT(3)
89     A = VOUT(4)
90     B = VOUT(5)
91     C = VOUT(6)
92     *
93     H2 = HALF * H
94     H4 = HALF * H2
95     PH = PINV * H
96     PH2 = HALF * PH
97     SECXS(1) = (B * F(3) - C * F(2)) * PH2
98     SECYS(1) = (C * F(1) - A * F(3)) * PH2
99     SECZS(1) = (A * F(2) - B * F(1)) * PH2
100     ANG2 = (SECXS(1)**2 + SECYS(1)**2 + SECZS(1)**2)
101     IF (ANG2.GT.PISQUA) GO TO 40
102     DXT = H2 * A + H4 * SECXS(1)
103     DYT = H2 * B + H4 * SECYS(1)
104     DZT = H2 * C + H4 * SECZS(1)
105     XT = X + DXT
106     YT = Y + DYT
107     ZT = Z + DZT
108     *
109     * Second intermediate point
110     *
111     EST = DABS(DXT)+DABS(DYT)+DABS(DZT)
112     IF (EST.GT.H) GO TO 30
113    
114     DO I=1,3
115     VVV(I)=SNGL(XYZT(I))
116     ENDDO
117     CALL GUFLD(VVV,FFF)
118     DO I=1,3
119     F(I)=DBLE(FFF(I))
120 pam-fi 1.6 ENDDO
121     DELTAB(2) = -F(2)*VECT(7)*CHARGE*(DELTA0+DELTA1*VVV(2))
122     F(2) = F(2)+DELTAB(2)
123     cPP -----------------
124 mocchiut 1.1 C CALL GUFLD(XYZT,F)
125     AT = A + SECXS(1)
126     BT = B + SECYS(1)
127     CT = C + SECZS(1)
128     *
129     SECXS(2) = (BT * F(3) - CT * F(2)) * PH2
130     SECYS(2) = (CT * F(1) - AT * F(3)) * PH2
131     SECZS(2) = (AT * F(2) - BT * F(1)) * PH2
132     AT = A + SECXS(2)
133     BT = B + SECYS(2)
134     CT = C + SECZS(2)
135     SECXS(3) = (BT * F(3) - CT * F(2)) * PH2
136     SECYS(3) = (CT * F(1) - AT * F(3)) * PH2
137     SECZS(3) = (AT * F(2) - BT * F(1)) * PH2
138     DXT = H * (A + SECXS(3))
139     DYT = H * (B + SECYS(3))
140     DZT = H * (C + SECZS(3))
141     XT = X + DXT
142     YT = Y + DYT
143     ZT = Z + DZT
144     AT = A + TWO*SECXS(3)
145     BT = B + TWO*SECYS(3)
146     CT = C + TWO*SECZS(3)
147     *
148     EST = ABS(DXT)+ABS(DYT)+ABS(DZT)
149     IF (EST.GT.2.*ABS(H)) GO TO 30
150    
151     DO I=1,3
152     VVV(I)=SNGL(XYZT(I))
153     ENDDO
154     CALL GUFLD(VVV,FFF)
155     DO I=1,3
156     F(I)=DBLE(FFF(I))
157     ENDDO
158 pam-fi 1.6 DELTAB(2) = -F(2)*VECT(7)*CHARGE*(DELTA0+DELTA1*VVV(2))
159     F(2) = F(2)+DELTAB(2)
160     cPP -----------------
161 mocchiut 1.1 C CALL GUFLD(XYZT,F)
162     *
163     Z = Z + (C + (SECZS(1) + SECZS(2) + SECZS(3)) * THIRD) * H
164     Y = Y + (B + (SECYS(1) + SECYS(2) + SECYS(3)) * THIRD) * H
165     X = X + (A + (SECXS(1) + SECXS(2) + SECXS(3)) * THIRD) * H
166     *
167     SECXS(4) = (BT*F(3) - CT*F(2))* PH2
168     SECYS(4) = (CT*F(1) - AT*F(3))* PH2
169     SECZS(4) = (AT*F(2) - BT*F(1))* PH2
170     A = A+(SECXS(1)+SECXS(4)+TWO * (SECXS(2)+SECXS(3))) * THIRD
171     B = B+(SECYS(1)+SECYS(4)+TWO * (SECYS(2)+SECYS(3))) * THIRD
172     C = C+(SECZS(1)+SECZS(4)+TWO * (SECZS(2)+SECZS(3))) * THIRD
173     *
174     EST = ABS(SECXS(1)+SECXS(4) - (SECXS(2)+SECXS(3)))
175     ++ ABS(SECYS(1)+SECYS(4) - (SECYS(2)+SECYS(3)))
176     ++ ABS(SECZS(1)+SECZS(4) - (SECZS(2)+SECZS(3)))
177     *
178     IF (EST.GT.DLT .AND. ABS(H).GT.1.E-4) GO TO 30
179     ITER = ITER + 1
180     NCUT = 0
181     * If too many iterations, go to HELIX
182     IF (ITER.GT.MAXIT) GO TO 40
183     *
184     TL = TL + H
185     IF (EST.LT.(DLT32)) THEN
186     H = H*TWO
187     ENDIF
188     CBA = ONE/ SQRT(A*A + B*B + C*C)
189     VOUT(1) = X
190     VOUT(2) = Y
191     VOUT(3) = Z
192     VOUT(4) = CBA*A
193     VOUT(5) = CBA*B
194     VOUT(6) = CBA*C
195     REST = STEP - TL
196     IF (STEP.LT.0.) REST = -REST
197     IF (REST .GT. 1.E-5*DABS(STEP)) GO TO 20
198     *
199     GO TO 999
200     *
201     ** CUT STEP
202     30 NCUT = NCUT + 1
203     * If too many cuts , go to HELIX
204     IF (NCUT.GT.MAXCUT) GO TO 40
205     H = H*HALF
206     GO TO 20
207     *
208     ** ANGLE TOO BIG, USE HELIX
209     40 F1 = F(1)
210     F2 = F(2)
211     F3 = F(3)
212     F4 = DSQRT(F1**2+F2**2+F3**2)
213     RHO = -F4*PINV
214     TET = RHO * STEP
215     IF(TET.NE.0.) THEN
216     HNORM = ONE/F4
217     F1 = F1*HNORM
218     F2 = F2*HNORM
219     F3 = F3*HNORM
220     *
221     HXP(1) = F2*VECT(IPZ) - F3*VECT(IPY)
222     HXP(2) = F3*VECT(IPX) - F1*VECT(IPZ)
223     HXP(3) = F1*VECT(IPY) - F2*VECT(IPX)
224    
225     HP = F1*VECT(IPX) + F2*VECT(IPY) + F3*VECT(IPZ)
226     *
227     RHO1 = ONE/RHO
228     SINT = DSIN(TET)
229     COST = TWO*DSIN(HALF*TET)**2
230     *
231     G1 = SINT*RHO1
232     G2 = COST*RHO1
233     G3 = (TET-SINT) * HP*RHO1
234     G4 = -COST
235     G5 = SINT
236     G6 = COST * HP
237    
238     VOUT(IX) = VECT(IX) + (G1*VECT(IPX) + G2*HXP(1) + G3*F1)
239     VOUT(IY) = VECT(IY) + (G1*VECT(IPY) + G2*HXP(2) + G3*F2)
240     VOUT(IZ) = VECT(IZ) + (G1*VECT(IPZ) + G2*HXP(3) + G3*F3)
241    
242     VOUT(IPX) = VECT(IPX) + (G4*VECT(IPX) + G5*HXP(1) + G6*F1)
243     VOUT(IPY) = VECT(IPY) + (G4*VECT(IPY) + G5*HXP(2) + G6*F2)
244     VOUT(IPZ) = VECT(IPZ) + (G4*VECT(IPZ) + G5*HXP(3) + G6*F3)
245     *
246     ELSE
247     VOUT(IX) = VECT(IX) + STEP*VECT(IPX)
248     VOUT(IY) = VECT(IY) + STEP*VECT(IPY)
249     VOUT(IZ) = VECT(IZ) + STEP*VECT(IPZ)
250     *
251     ENDIF
252     *
253     999 END
254     *
255     *
256    
257 pam-fi 1.8 c$$$**********************************************************************
258     c$$$*
259     c$$$*
260     c$$$* routine per tracciare la particella di uno STEP
261     c$$$* *** extended version ***
262     c$$$* it return also the track-length
263     c$$$*
264     c$$$ SUBROUTINE GRKUTA2 (CHARGE,STEP,VECT,VOUT)
265     c$$$C.
266     c$$$C. ******************************************************************
267     c$$$C. * *
268     c$$$C. * Runge-Kutta method for tracking a particle through a magnetic *
269     c$$$C. * field. Uses Nystroem algorithm (See Handbook Nat. Bur. of *
270     c$$$C. * Standards, procedure 25.5.20) *
271     c$$$C. * *
272     c$$$C. * Input parameters *
273     c$$$C. * CHARGE Particle charge *
274     c$$$C. * STEP Step size *
275     c$$$C. * VECT Initial co-ords,direction cosines,momentum *
276     c$$$C. * Output parameters *
277     c$$$C. * VOUT Output co-ords,direction cosines,momentum *
278     c$$$C. * User routine called *
279     c$$$C. * CALL GUFLD(X,F) *
280     c$$$C. * *
281     c$$$C. * ==>Called by : <USER>, GUSWIM *
282     c$$$C. * Authors R.Brun, M.Hansroul ********* *
283     c$$$C. * V.Perevoztchikov (CUT STEP implementation) *
284     c$$$C. * *
285     c$$$C. * *
286     c$$$C. ******************************************************************
287     c$$$C.
288     c$$$ IMPLICIT DOUBLE PRECISION(A-H,O-Z)
289     c$$$*
290     c$$$ REAL VVV(3),FFF(3)
291     c$$$ REAL*8 CHARGE, STEP, VECT(*), VOUT(*), F(4)
292     c$$$ REAL*8 XYZT(3), XYZ(3), X, Y, Z, XT, YT, ZT
293     c$$$ DIMENSION SECXS(4),SECYS(4),SECZS(4),HXP(3)
294     c$$$ EQUIVALENCE (X,XYZ(1)),(Y,XYZ(2)),(Z,XYZ(3)),
295     c$$$ + (XT,XYZT(1)),(YT,XYZT(2)),(ZT,XYZT(3))
296     c$$$*
297     c$$$ PARAMETER (MAXIT = 1992, MAXCUT = 11)
298     c$$$ PARAMETER (EC=2.9979251D-4,DLT=1D-4,DLT32=DLT/32)
299     c$$$ PARAMETER (ZERO=0, ONE=1, TWO=2, THREE=3)
300     c$$$ PARAMETER (THIRD=ONE/THREE, HALF=ONE/TWO)
301     c$$$ PARAMETER (PISQUA=.986960440109D+01)
302     c$$$ PARAMETER (IX=1,IY=2,IZ=3,IPX=4,IPY=5,IPZ=6)
303     c$$$
304     c$$$* track length
305     c$$$ REAL*8 DL
306     c$$$
307     c$$$*.
308     c$$$*. ------------------------------------------------------------------
309     c$$$*.
310     c$$$* This constant is for units CM,GEV/C and KGAUSS
311     c$$$*
312     c$$$ ITER = 0
313     c$$$ NCUT = 0
314     c$$$ DO 10 J=1,8
315     c$$$ VOUT(J)=VECT(J)
316     c$$$ 10 CONTINUE
317     c$$$ PINV = EC * CHARGE / VECT(7)
318     c$$$ TL = 0.
319     c$$$ H = STEP
320     c$$$
321     c$$$c print*,'===================== START GRKUTA2'
322     c$$$
323     c$$$*
324     c$$$*
325     c$$$ 20 REST = STEP-TL
326     c$$$ IF (DABS(H).GT.DABS(REST)) H = REST
327     c$$$ DO I=1,3
328     c$$$ VVV(I)=SNGL(VOUT(I))
329     c$$$ ENDDO
330     c$$$
331     c$$$ CALL GUFLD(VVV,FFF)
332     c$$$* print*,'GRKUTA Bx,By,Bz: ',(FFF(i),i=1,3)
333     c$$$ DO I=1,3
334     c$$$ F(I)=DBLE(FFF(I))
335     c$$$ ENDDO
336     c$$$*
337     c$$$* Start of integration
338     c$$$*
339     c$$$ X = VOUT(1)
340     c$$$ Y = VOUT(2)
341     c$$$ Z = VOUT(3)
342     c$$$ A = VOUT(4)
343     c$$$ B = VOUT(5)
344     c$$$ C = VOUT(6)
345     c$$$
346     c$$$ DL = VOUT(8)
347     c$$$
348     c$$$*
349     c$$$ H2 = HALF * H
350     c$$$ H4 = HALF * H2
351     c$$$ PH = PINV * H
352     c$$$ PH2 = HALF * PH
353     c$$$ SECXS(1) = (B * F(3) - C * F(2)) * PH2
354     c$$$ SECYS(1) = (C * F(1) - A * F(3)) * PH2
355     c$$$ SECZS(1) = (A * F(2) - B * F(1)) * PH2
356     c$$$ ANG2 = (SECXS(1)**2 + SECYS(1)**2 + SECZS(1)**2)
357     c$$$ IF (ANG2.GT.PISQUA) GO TO 40
358     c$$$ DXT = H2 * A + H4 * SECXS(1)
359     c$$$ DYT = H2 * B + H4 * SECYS(1)
360     c$$$ DZT = H2 * C + H4 * SECZS(1)
361     c$$$ XT = X + DXT
362     c$$$ YT = Y + DYT
363     c$$$ ZT = Z + DZT
364     c$$$*
365     c$$$* Second intermediate point
366     c$$$*
367     c$$$ EST = DABS(DXT)+DABS(DYT)+DABS(DZT)
368     c$$$ IF (EST.GT.H) GO TO 30
369     c$$$
370     c$$$ DO I=1,3
371     c$$$ VVV(I)=SNGL(XYZT(I))
372     c$$$ ENDDO
373     c$$$ CALL GUFLD(VVV,FFF)
374     c$$$ DO I=1,3
375     c$$$ F(I)=DBLE(FFF(I))
376     c$$$ ENDDO
377     c$$$C CALL GUFLD(XYZT,F)
378     c$$$ AT = A + SECXS(1)
379     c$$$ BT = B + SECYS(1)
380     c$$$ CT = C + SECZS(1)
381     c$$$*
382     c$$$ SECXS(2) = (BT * F(3) - CT * F(2)) * PH2
383     c$$$ SECYS(2) = (CT * F(1) - AT * F(3)) * PH2
384     c$$$ SECZS(2) = (AT * F(2) - BT * F(1)) * PH2
385     c$$$ AT = A + SECXS(2)
386     c$$$ BT = B + SECYS(2)
387     c$$$ CT = C + SECZS(2)
388     c$$$ SECXS(3) = (BT * F(3) - CT * F(2)) * PH2
389     c$$$ SECYS(3) = (CT * F(1) - AT * F(3)) * PH2
390     c$$$ SECZS(3) = (AT * F(2) - BT * F(1)) * PH2
391     c$$$ DXT = H * (A + SECXS(3))
392     c$$$ DYT = H * (B + SECYS(3))
393     c$$$ DZT = H * (C + SECZS(3))
394     c$$$ XT = X + DXT
395     c$$$ YT = Y + DYT
396     c$$$ ZT = Z + DZT
397     c$$$ AT = A + TWO*SECXS(3)
398     c$$$ BT = B + TWO*SECYS(3)
399     c$$$ CT = C + TWO*SECZS(3)
400     c$$$*
401     c$$$ EST = ABS(DXT)+ABS(DYT)+ABS(DZT)
402     c$$$ IF (EST.GT.2.*ABS(H)) GO TO 30
403     c$$$
404     c$$$ DO I=1,3
405     c$$$ VVV(I)=SNGL(XYZT(I))
406     c$$$ ENDDO
407     c$$$ CALL GUFLD(VVV,FFF)
408     c$$$ DO I=1,3
409     c$$$ F(I)=DBLE(FFF(I))
410     c$$$ ENDDO
411     c$$$C CALL GUFLD(XYZT,F)
412     c$$$*
413     c$$$ Z = Z + (C + (SECZS(1) + SECZS(2) + SECZS(3)) * THIRD) * H
414     c$$$ Y = Y + (B + (SECYS(1) + SECYS(2) + SECYS(3)) * THIRD) * H
415     c$$$ X = X + (A + (SECXS(1) + SECXS(2) + SECXS(3)) * THIRD) * H
416     c$$$*
417     c$$$ SECXS(4) = (BT*F(3) - CT*F(2))* PH2
418     c$$$ SECYS(4) = (CT*F(1) - AT*F(3))* PH2
419     c$$$ SECZS(4) = (AT*F(2) - BT*F(1))* PH2
420     c$$$ A = A+(SECXS(1)+SECXS(4)+TWO * (SECXS(2)+SECXS(3))) * THIRD
421     c$$$ B = B+(SECYS(1)+SECYS(4)+TWO * (SECYS(2)+SECYS(3))) * THIRD
422     c$$$ C = C+(SECZS(1)+SECZS(4)+TWO * (SECZS(2)+SECZS(3))) * THIRD
423     c$$$*
424     c$$$ EST = ABS(SECXS(1)+SECXS(4) - (SECXS(2)+SECXS(3)))
425     c$$$ ++ ABS(SECYS(1)+SECYS(4) - (SECYS(2)+SECYS(3)))
426     c$$$ ++ ABS(SECZS(1)+SECZS(4) - (SECZS(2)+SECZS(3)))
427     c$$$*
428     c$$$ IF (EST.GT.DLT .AND. ABS(H).GT.1.E-4) GO TO 30
429     c$$$
430     c$$$ ITER = ITER + 1
431     c$$$ NCUT = 0
432     c$$$* If too many iterations, go to HELIX
433     c$$$ IF (ITER.GT.MAXIT) GO TO 40
434     c$$$*
435     c$$$ DL = VOUT(8) +
436     c$$$ $ DSQRT( 0
437     c$$$ $ + (X-VOUT(1))**2
438     c$$$ $ + (Y-VOUT(2))**2
439     c$$$ $ + (Z-VOUT(3))**2
440     c$$$ $ )
441     c$$$c print*,'- ',VOUT(3),z,VOUT(1),x,VOUT(2),y,DL
442     c$$$*
443     c$$$ TL = TL + H
444     c$$$ IF (EST.LT.(DLT32)) THEN
445     c$$$ H = H*TWO
446     c$$$ ENDIF
447     c$$$ CBA = ONE/ SQRT(A*A + B*B + C*C)
448     c$$$ VOUT(1) = X
449     c$$$ VOUT(2) = Y
450     c$$$ VOUT(3) = Z
451     c$$$ VOUT(4) = CBA*A
452     c$$$ VOUT(5) = CBA*B
453     c$$$ VOUT(6) = CBA*C
454     c$$$ VOUT(8) = DL
455     c$$$ REST = STEP - TL
456     c$$$ IF (STEP.LT.0.) REST = -REST
457     c$$$ IF (REST .GT. 1.E-5*DABS(STEP)) GO TO 20
458     c$$$*
459     c$$$ GO TO 999
460     c$$$*
461     c$$$** CUT STEP
462     c$$$ 30 NCUT = NCUT + 1
463     c$$$* If too many cuts , go to HELIX
464     c$$$ IF (NCUT.GT.MAXCUT) GO TO 40
465     c$$$ H = H*HALF
466     c$$$ GO TO 20
467     c$$$*
468     c$$$** ANGLE TOO BIG, USE HELIX
469     c$$$ 40 F1 = F(1)
470     c$$$ F2 = F(2)
471     c$$$ F3 = F(3)
472     c$$$ F4 = DSQRT(F1**2+F2**2+F3**2)
473     c$$$ RHO = -F4*PINV
474     c$$$ TET = RHO * STEP
475     c$$$ IF(TET.NE.0.) THEN
476     c$$$ HNORM = ONE/F4
477     c$$$ F1 = F1*HNORM
478     c$$$ F2 = F2*HNORM
479     c$$$ F3 = F3*HNORM
480     c$$$*
481     c$$$ HXP(1) = F2*VECT(IPZ) - F3*VECT(IPY)
482     c$$$ HXP(2) = F3*VECT(IPX) - F1*VECT(IPZ)
483     c$$$ HXP(3) = F1*VECT(IPY) - F2*VECT(IPX)
484     c$$$
485     c$$$ HP = F1*VECT(IPX) + F2*VECT(IPY) + F3*VECT(IPZ)
486     c$$$*
487     c$$$ RHO1 = ONE/RHO
488     c$$$ SINT = DSIN(TET)
489     c$$$ COST = TWO*DSIN(HALF*TET)**2
490     c$$$*
491     c$$$ G1 = SINT*RHO1
492     c$$$ G2 = COST*RHO1
493     c$$$ G3 = (TET-SINT) * HP*RHO1
494     c$$$ G4 = -COST
495     c$$$ G5 = SINT
496     c$$$ G6 = COST * HP
497     c$$$
498     c$$$ VOUT(IX) = VECT(IX) + (G1*VECT(IPX) + G2*HXP(1) + G3*F1)
499     c$$$ VOUT(IY) = VECT(IY) + (G1*VECT(IPY) + G2*HXP(2) + G3*F2)
500     c$$$ VOUT(IZ) = VECT(IZ) + (G1*VECT(IPZ) + G2*HXP(3) + G3*F3)
501     c$$$
502     c$$$ VOUT(IPX) = VECT(IPX) + (G4*VECT(IPX) + G5*HXP(1) + G6*F1)
503     c$$$ VOUT(IPY) = VECT(IPY) + (G4*VECT(IPY) + G5*HXP(2) + G6*F2)
504     c$$$ VOUT(IPZ) = VECT(IPZ) + (G4*VECT(IPZ) + G5*HXP(3) + G6*F3)
505     c$$$*
506     c$$$ ELSE
507     c$$$ VOUT(IX) = VECT(IX) + STEP*VECT(IPX)
508     c$$$ VOUT(IY) = VECT(IY) + STEP*VECT(IPY)
509     c$$$ VOUT(IZ) = VECT(IZ) + STEP*VECT(IPZ)
510     c$$$*
511     c$$$ ENDIF
512     c$$$* TEMP !!! TEMP !!! TEMP !!! TEMP !!! TEMP !!! TEMP !!!
513     c$$$* devo mettere la lunghezza dell'elica!!!!!!!!!!!!!!
514     c$$$* ma non mi riesce :-(
515     c$$$ VOUT(8) = DSQRT( 0
516     c$$$ $ +(VOUT(IX)-VECT(IX))**2
517     c$$$ $ +(VOUT(IY)-VECT(IY))**2
518     c$$$ $ +(VOUT(IZ)-VECT(IZ))**2
519     c$$$ $ )
520     c$$$c print*,'WARNING: GRKUTA2 --> '
521     c$$$c $ ,'helix :-( ... length evaluated with straight line'
522     c$$$
523     c$$$*
524     c$$$ 999 END
525     c$$$*
526     c$$$*
527 mocchiut 1.1
528     **********************************************************************
529     *
530     * gives the value of the magnetic field in the tracking point
531     *
532     **********************************************************************
533    
534     subroutine gufld(v,f) !coordinates in cm, B field in kGauss
535    
536     real v(3),f(3) !coordinates in cm, B field in kGauss, error in kGauss
537    
538     real*8 vv(3),ff(3) !inter_B.f works in double precision
539    
540    
541 pam-fi 1.4 do i=1,3
542     vv(i)=v(i)/100. !inter_B.f works in meters
543     enddo
544     c inter_B: coordinates in m, B field in Tesla
545     c$$$ print*,'GUFLD: v ',v
546     call inter_B(vv(1),vv(2),vv(3),ff)
547     do i=1,3 !change back the field in kGauss
548 mocchiut 1.9 f(i)=REAL(ff(i)*10.) ! EM GCC4.7
549 pam-fi 1.4 enddo
550     c$$$ print*,'GUFLD: b ',f
551    
552 mocchiut 1.1 return
553     end
554    

  ViewVC Help
Powered by ViewVC 1.1.23