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

Contents of /DarthVader/TrackerLevel2/src/F77/bdll.f

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Wed Feb 21 10:33:13 2007 UTC (17 years, 10 months ago) by pam-fi
Branch: MAIN
CVS Tags: v3r04, v3r05, v5r00, v3r03, v4r00, v6r01, v6r00, v3r06
calculate B x dL and L of the track

1
2 ***
3 * subroutine to compute the Integral(B dl) and
4 * L along the trajectory
5 ***
6
7
8 ***
9 *
10 * created by paolo papini, 11 oct 2005
11 *
12 * c$$$ max: modified by massimo bongi, 11 oct 2005 (later...)
13 *
14 ***
15
16
17 subroutine CalcBdL(Istep,BdL,L,IFAIL)
18 IMPLICIT DOUBLE PRECISION (A-H,O-Z)
19 integer Istep,IFAIL
20 real*8 BdL,L,Lstep
21 real vvv(3),fff(3)
22 real*8 f(3)
23 include 'commontracker.f' !tracker general common
24 include 'common_mini_2.f' !common for the tracking procedure
25 *
26 * set parameters for GRKUTA from ZINI to the first plane
27 *
28 c$$$ max IF(AL(5).NE.0) CHARGE=AL_P(5)/DABS(AL_P(5))
29 c$$$ max IF(AL(5).NE.0) CHARGE=AL_P(5)/DABS(AL_P(5))
30 c$$$ IF(AL(5).NE.0) CHARGE=AL(5)/DABS(AL(5))
31 IF(AL(5).NE.0) CHARGE=AL(5)/DABS(AL(5))
32 IF(AL(5).EQ.0) CHARGE=1.
33 VOUT(1)=AL(1)
34 VOUT(2)=AL(2)
35 VOUT(3)=ZINI ! DBLE(Z0)-DBLE(ZSPEC)
36 VOUT(4)=AL(3)*DCOS(AL(4))
37 VOUT(5)=AL(3)*DSIN(AL(4))
38 VOUT(6)=-1.*DSQRT(1.-AL(3)**2)
39 IF(AL(5).NE.0.) VOUT(7)=DABS(1./AL(5))
40 IF(AL(5).EQ.0.) VOUT(7)=1.E8
41 *
42 * first integrate the track from reference plane to first trk plane
43 *
44 * zout=zm(1)
45 zout=zv(1)
46 step=vout(3)-zout
47 10 DO J=1,7
48 VECT(J)=VOUT(J)
49 VECTINI(J)=VOUT(J)
50 ENDDO
51 11 continue
52 CALL GRKUTA(CHARGE,STEP,VECT,VOUT)
53 IF(VOUT(3).GT.VECT(3)) THEN
54 IFAIL=1
55 PRINT *,'BdL (grkuta): WARNING ===> backward track!!'
56 print*,'charge',charge
57 print*,'vect',vect
58 print*,'vout',vout
59 print*,'step',step
60 RETURN
61 ENDIF
62 Z=VOUT(3)
63 IF(Z.LE.Zout+TOLL.AND.Z.GE.Zout-TOLL) GOTO 100
64 IF(Z.GT.Zout+TOLL) GOTO 10
65 IF(Z.LE.Zout-TOLL) THEN
66 STEP=STEP*(Zout-VECT(3))/(Z-VECT(3))
67 DO J=1,7
68 VECT(J)=VECTINI(J)
69 ENDDO
70 GOTO 11
71 ENDIF
72 *
73 * then integrate B o dL along the track, from the first to the last plane
74 *
75 100 continue
76 BdL=0.
77 L=0.
78 * dz=(zm(1)-zm(6))/float(Istep)
79 dz = (zv(1)-zv(6))/float(Istep)
80 zout = zv(6)
81
82 do i=1,10*Istep
83 BdLstep=0.
84 Lstep=0.
85 vvv(1)=sngl(vout(1))
86 vvv(2)=sngl(vout(2))
87 vvv(3)=sngl(vout(3))
88 CALL GUFLD(VVV,FFF)
89 do j=1,3
90 f(j)=dble(fff(j))
91 enddo
92 c zout=vout(3)-dz
93 step = dz
94 20 DO J=1,7
95 VECT(J)=VOUT(J)
96 VECTINI(J)=VOUT(J)
97 ENDDO
98 21 continue
99 CALL GRKUTA(CHARGE,STEP,VECT,VOUT)
100 c$$$ BdLstep=BdLstep+
101 c$$$ $ (vout(1)-vect(1))*f(1)+
102 c$$$ $ (vout(2)-vect(2))*f(2)+
103 c$$$ $ (vout(3)-vect(3))*f(3)
104 BdLstep=BdLstep+
105 $ dsqrt(
106 $ ((vout(2)-vect(2))*f(3)-(vout(3)-vect(3))*f(2))**2+
107 $ ((vout(3)-vect(3))*f(1)-(vout(1)-vect(1))*f(3))**2+
108 $ ((vout(1)-vect(1))*f(2)-(vout(2)-vect(2))*f(1))**2)
109 Lstep=Lstep+
110 $ dsqrt(
111 $ (vout(1)-vect(1))**2+
112 $ (vout(2)-vect(2))**2+
113 $ (vout(3)-vect(3))**2)
114 IF(VOUT(3).GT.VECT(3)) THEN
115 IFAIL=1
116 PRINT *,'BdL (grkuta): WARNING ===> backward track!!'
117 print*,'charge',charge
118 print*,'vect',vect
119 print*,'vout',vout
120 print*,'step',step
121 RETURN
122 ENDIF
123 200 continue
124 BdL = BdL + (BdLstep*1.D-3) !Tesla * meters
125 L = L + (Lstep*1.D-2) !meters
126 c$$$ print*,i,' #### ',BdL,L
127
128 Z=VOUT(3)
129 IF(Z.LE.Zout+TOLL.AND.Z.GE.Zout-TOLL) GOTO 2000 !end
130 IF(Z.LE.Zout-TOLL) THEN
131 STEP=STEP*(Zout-VECT(3))/(Z-VECT(3))
132 DO J=1,7
133 VECT(J)=VECTINI(J)
134 ENDDO
135 BdL=BdL-(BdLstep*1.D-3) !Tesla * meters
136 L=L-(Lstep*1.D-2) !meters
137 BdLstep=0.
138 Lstep=0.
139 GOTO 21
140 ENDIF
141 enddo
142 2000 continue
143 c$$$ print*,' #### ',BdL
144 c$$$ print*,' #### ',L
145 c$$$ print*,' #### ',xgood
146 c$$$ print*,' #### ',ygood
147 c$$$ print*,'========================================='
148 return
149 end
150
151

  ViewVC Help
Powered by ViewVC 1.1.23