]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HERWIG/src/hwbspa.f
Coding rule violations corrected.
[u/mrichter/AliRoot.git] / HERWIG / src / hwbspa.f
1
2 CDECK  ID>, HWBSPA.
3
4 *CMZ :-        -26/04/91  14.26.44  by  Federico Carminati
5
6 *-- Author :    Ian Knowles
7
8 C-----------------------------------------------------------------------
9
10       SUBROUTINE HWBSPA
11
12 C-----------------------------------------------------------------------
13
14 C     Constructs time-like 4-momenta & production vertices in space-like
15
16 C     jet started by parton no.2 interference partner 1 and spin density
17
18 C     DECPAR(2). RHOPAR(2) gives the jet spin density matrix.
19
20 C     See I.G. Knowles, Comp. Phys. Comm. 58 (90) 271.
21
22 C-----------------------------------------------------------------------
23
24       INCLUDE 'HERWIG61.INC'
25
26       DOUBLE PRECISION HWR,DMIN,PT,EIKON,EISCR,EINUM,EIDEN1,EIDEN2,
27
28      & WT,SPIN,Z1,Z2,TR,PRMAX,CX,SX,CAZ,ROHEP(3),RMAT(3,3),ZERO2(2)
29
30       INTEGER JPAR,KPAR,LPAR,MPAR
31
32       LOGICAL EICOR
33
34       EXTERNAL HWR
35
36       DATA ZERO2,DMIN/ZERO,ZERO,1.D-15/
37
38       IF (IERROR.NE.0) RETURN
39
40       JPAR=2
41
42       KPAR=1
43
44       IF (NPAR.EQ.2) THEN
45
46          CALL HWVZRO(2,RHOPAR(1,2))
47
48          RETURN
49
50       ENDIF
51
52 C Generate azimuthal angle of JPAR's branching using an M-function
53
54 C     Find the daughters of JPAR, with LPAR time-like
55
56   10  LPAR=JDAPAR(1,JPAR)
57
58       IF (TMPAR(LPAR)) THEN
59
60          MPAR=LPAR+1
61
62       ELSE
63
64          MPAR=LPAR
65
66          LPAR=MPAR+1
67
68       ENDIF
69
70 C Soft correlations
71
72       CALL HWUROT(PPAR(1,JPAR), ONE,ZERO,RMAT)
73
74       CALL HWUROF(RMAT,PPAR(1,KPAR),ROHEP)
75
76       PT=MAX(SQRT(ROHEP(1)*ROHEP(1)+ROHEP(2)*ROHEP(2)),DMIN)
77
78       EIKON=1.
79
80       EICOR=AZSOFT.AND.IDPAR(LPAR).EQ.13
81
82       IF (EICOR) THEN
83
84          EISCR=1.-PPAR(5,MPAR)*PPAR(5,MPAR)/(MIN(PPAR(2,LPAR),
85
86      &   PPAR(2,MPAR))*PPAR(4,MPAR)*PPAR(4,MPAR))
87
88          EINUM=PPAR(4,KPAR)*PPAR(4,LPAR)*ABS(PPAR(2,LPAR)-PPAR(2,MPAR))
89
90          EIDEN1=PPAR(4,KPAR)*PPAR(4,LPAR)-ROHEP(3)*PPAR(3,LPAR)
91
92          EIDEN2=PT*ABS(PPAR(1,LPAR))
93
94          EIKON=MAX(EISCR+EINUM/MAX(EIDEN1-EIDEN2,DMIN),ZERO)
95
96       ENDIF
97
98 C Spin correlations
99
100       WT=0.
101
102       SPIN=1.
103
104       IF (AZSPIN.AND.IDPAR(JPAR).EQ.13) THEN
105
106          Z1=PPAR(4,JPAR)/PPAR(4,MPAR)
107
108          Z2=1.-Z1
109
110          IF (IDPAR(MPAR).EQ.13) THEN
111
112             TR=Z1/Z2+Z2/Z1+Z1*Z2
113
114          ELSEIF (IDPAR(MPAR).LT.13) THEN
115
116             TR=(Z1*Z1+Z2*Z2)/2.
117
118          ENDIF
119
120          WT=Z2/(Z1*TR)
121
122       ENDIF
123
124 C Assign the azimuthal angle
125
126       PRMAX=(1.+ABS(WT))*EIKON
127
128   50  CALL HWRAZM( ONE,CX,SX)
129
130       CALL HWUROT(PPAR(1,JPAR),CX,SX,RMAT)
131
132 C Determine the angle between the branching planes
133
134       CALL HWUROF(RMAT,PPAR(1,KPAR),ROHEP)
135
136       CAZ=ROHEP(1)/PT
137
138       PHIPAR(1,JPAR)=2.*CAZ*CAZ-1.
139
140       PHIPAR(2,JPAR)=2.*CAZ*ROHEP(2)/PT
141
142       IF (EICOR) EIKON=MAX(EISCR+EINUM/MAX(EIDEN1-EIDEN2*CAZ,DMIN),ZERO)
143
144       IF (AZSPIN) SPIN=1.+WT*(DECPAR(1,JPAR)*PHIPAR(1,JPAR)
145
146      &                       +DECPAR(2,JPAR)*PHIPAR(2,JPAR))
147
148       IF (SPIN*EIKON.LT.HWR()*PRMAX) GOTO 50
149
150 C Construct full 4-momentum of LPAR, sum P-trans of MPAR
151
152       PPAR(2,LPAR)=0.
153
154       PPAR(2,MPAR)=0.
155
156       CALL HWUROB(RMAT,PPAR(1,LPAR),PPAR(1,LPAR))
157
158       CALL HWVDIF(2,PPAR(1,2),PPAR(1,LPAR),PPAR(1,2))
159
160 C Test for end of space-like branches
161
162       IF (JDAPAR(1,MPAR).EQ.0) GOTO 60
163
164 C     Generate new Decay matrix
165
166       CALL HWBAZF(MPAR,JPAR,ZERO2,DECPAR(1,JPAR),
167
168      &            PHIPAR(1,JPAR),DECPAR(1,MPAR))
169
170 C     Advance along the space-like branch
171
172       JPAR=MPAR
173
174       KPAR=LPAR
175
176       GOTO 10
177
178 C Retreat along space-like line
179
180 C     Assign initial spin density matrix
181
182   60  CALL HWVEQU(2,ZERO2,RHOPAR(1,MPAR))
183
184       CALL HWUMAS(PPAR(1,2))
185
186       CALL HWVZRO(4,VPAR(1,MPAR))
187
188   70  CALL HWVEQU(4,VPAR(1,MPAR),VPAR(1,LPAR))
189
190       IF (MPAR.EQ.2) RETURN
191
192 C Construct spin density matrix for time-like branch
193
194       CALL HWBAZF(MPAR,JPAR,RHOPAR(1,MPAR),PHIPAR(1,JPAR),
195
196      &                      DECPAR(1,JPAR),RHOPAR(1,LPAR))
197
198 C Evolve time-like side branch
199
200       CALL HWBTIM(LPAR,MPAR)
201
202 C Construct spin density matrix for space-like branch
203
204       CALL HWBAZF(MPAR,JPAR,PHIPAR(1,JPAR),RHOPAR(1,MPAR),
205
206      &                      DECPAR(1,LPAR),RHOPAR(1,JPAR))
207
208 C Assign production vertex to J
209
210       CALL HWVDIF(4,PPAR(1,MPAR),PPAR(1,LPAR),PPAR(1,JPAR))
211
212       CALL HWUDKL(IDPAR(JPAR),PPAR(1,JPAR),VPAR(1,JPAR))
213
214       CALL HWVSUM(4,VPAR(1,MPAR),VPAR(1,JPAR),VPAR(1,JPAR))
215
216 C Find parent and partner of MPAR
217
218       MPAR=JPAR
219
220       JPAR=JMOPAR(1,MPAR)
221
222       LPAR=MPAR+1
223
224       IF (JMOPAR(1,LPAR).NE.JPAR) LPAR=MPAR-1
225
226       GOTO 70
227
228       END