Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pyreco.f
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file pyreco.f
1 
2 C***********************************************************************
3 
4 C...PYRECO
5 C...Handles the possibility of colour reconnection in W+W- events,
6 C...Based on the main scenarios of the Sjostrand and Khoze study:
7 C...I, II, II', intermediate and instantaneous; plus one model
8 C...along the lines of the Gustafson and Hakkinen: GH.
9 C...Note: also handles Z0 Z0 and W-W+ events, but notation below
10 C...is as if first resonance is W+ and second W-.
11 
12  SUBROUTINE pyreco(IW1,IW2,NSD1,NAFT1)
13 
14 C...Double precision and integer declarations.
15  IMPLICIT DOUBLE PRECISION(a-h, o-z)
16  IMPLICIT INTEGER(i-n)
17  INTEGER pyk,pychge,pycomp
18 C...Parameter value; number of points in MC integration.
19  parameter(npt=100)
20 C...Commonblocks.
21  common/pyjets/n,npad,k(4000,5),p(4000,5),v(4000,5)
22  common/pydat1/mstu(200),paru(200),mstj(200),parj(200)
23  common/pydat2/kchg(500,4),pmas(500,4),parf(2000),vckm(4,4)
24  common/pypars/mstp(200),parp(200),msti(200),pari(200)
25  common/pyint1/mint(400),vint(400)
26  SAVE /pyjets/,/pydat1/,/pydat2/,/pypars/,/pyint1/
27 C...Local arrays.
28  dimension nbeg(2),nend(2),inp(50),inm(50),beww(3),xp(3),xm(3),
29  &v1(3),v2(3),betp(50,4),dirp(50,3),betm(50,4),dirm(50,3),
30  &xd(4),xb(4),iap(npt),iam(npt),wta(npt),v1p(3),v2p(3),v1m(3),
31  &v2m(3),q(4,3),xpp(3),xmm(3),ipc(20),imc(20),tc(0:20),tpc(20),
32  &tmc(20),ijoin(100)
33 
34 C...Functions to give four-product and to do determinants.
35  four(i,j)=p(i,4)*p(j,4)-p(i,1)*p(j,1)-p(i,2)*p(j,2)-p(i,3)*p(j,3)
36  deter(i,j,l)=q(i,1)*q(j,2)*q(l,3)-q(i,1)*q(l,2)*q(j,3)+
37  &q(j,1)*q(l,2)*q(i,3)-q(j,1)*q(i,2)*q(l,3)+
38  &q(l,1)*q(i,2)*q(j,3)-q(l,1)*q(j,2)*q(i,3)
39 
40 C...Only allow fraction of recoupling for GH, intermediate and
41 C...instantaneous.
42  IF(mstp(115).EQ.5.OR.mstp(115).EQ.11.OR.mstp(115).EQ.12) THEN
43  IF(pyr(0).GT.parp(120)) RETURN
44  ENDIF
45  isub=mint(1)
46 
47 C...Common part for scenarios I, II, II', and GH.
48  IF(mstp(115).EQ.1.OR.mstp(115).EQ.2.OR.mstp(115).EQ.3.OR.
49  &mstp(115).EQ.5) THEN
50 
51 C...Read out frequently-used parameters.
52  pi=paru(1)
53  hbar=paru(3)
54  pmw=pmas(24,1)
55  IF(isub.EQ.22) pmw=pmas(23,1)
56  pgw=pmas(24,2)
57  IF(isub.EQ.22) pgw=pmas(23,2)
58  tfrag=parp(115)
59  rhad=parp(116)
60  fact=parp(117)
61  blowr=parp(118)
62  blowt=parp(119)
63 
64 C...Find range of decay products of the W's.
65 C...Background: the W's are stored in IW1 and IW2.
66 C...Their direct decay products in NSD1+1 through NSD1+4.
67 C...Products after shower (if any) in NSD1+5 through NAFT1
68 C...for first W and in NAFT1+1 through N for the second.
69  IF(naft1.GT.nsd1+4) THEN
70  nbeg(1)=nsd1+5
71  nend(1)=naft1
72  ELSE
73  nbeg(1)=nsd1+1
74  nend(1)=nsd1+2
75  ENDIF
76  IF(n.GT.naft1) THEN
77  nbeg(2)=naft1+1
78  nend(2)=n
79  ELSE
80  nbeg(2)=nsd1+3
81  nend(2)=nsd1+4
82  ENDIF
83 
84 C...Rearrange parton shower products along strings.
85  nold=n
86  CALL pyprep(nsd1+1)
87  IF(mint(51).NE.0) RETURN
88 
89 C...Find partons pointing back to W+ and W-; store them with quark
90 C...end of string first.
91  nnp=0
92  nnm=0
93  isgp=0
94  isgm=0
95  DO 120 i=nold+1,n
96  IF(k(i,1).NE.1.AND.k(i,1).NE.2) goto 120
97  IF(iabs(k(i,2)).GE.22) goto 120
98  IF(k(i,3).GE.nbeg(1).AND.k(i,3).LE.nend(1)) THEN
99  IF(isgp.EQ.0) isgp=isign(1,k(i,2))
100  nnp=nnp+1
101  IF(isgp.EQ.1) THEN
102  inp(nnp)=i
103  ELSE
104  DO 100 i1=nnp,2,-1
105  inp(i1)=inp(i1-1)
106  100 CONTINUE
107  inp(1)=i
108  ENDIF
109  IF(k(i,1).EQ.1) isgp=0
110  ELSEIF(k(i,3).GE.nbeg(2).AND.k(i,3).LE.nend(2)) THEN
111  IF(isgm.EQ.0) isgm=isign(1,k(i,2))
112  nnm=nnm+1
113  IF(isgm.EQ.1) THEN
114  inm(nnm)=i
115  ELSE
116  DO 110 i1=nnm,2,-1
117  inm(i1)=inm(i1-1)
118  110 CONTINUE
119  inm(1)=i
120  ENDIF
121  IF(k(i,1).EQ.1) isgm=0
122  ENDIF
123  120 CONTINUE
124 
125 C...Boost to W+W- rest frame (not strictly needed).
126  DO 130 j=1,3
127  beww(j)=(p(iw1,j)+p(iw2,j))/(p(iw1,4)+p(iw2,4))
128  130 CONTINUE
129  CALL pyrobo(iw1,iw1,0d0,0d0,-beww(1),-beww(2),-beww(3))
130  CALL pyrobo(iw2,iw2,0d0,0d0,-beww(1),-beww(2),-beww(3))
131  CALL pyrobo(nold+1,n,0d0,0d0,-beww(1),-beww(2),-beww(3))
132 
133 C...Select decay vertices of W+ and W-.
134  tp=hbar*(-log(pyr(0)))*p(iw1,4)/
135  & sqrt((p(iw1,5)**2-pmw**2)**2+(p(iw1,5)**2*pgw/pmw)**2)
136  tm=hbar*(-log(pyr(0)))*p(iw2,4)/
137  & sqrt((p(iw2,5)**2-pmw**2)**2+(p(iw2,5)**2*pgw/pmw)**2)
138  gtmax=max(tp,tm)
139  DO 140 j=1,3
140  xp(j)=tp*p(iw1,j)/p(iw1,4)
141  xm(j)=tm*p(iw2,j)/p(iw2,4)
142  140 CONTINUE
143 
144 C...Begin scenario I specifics.
145  IF(mstp(115).EQ.1) THEN
146 
147 C...Reconstruct velocity and direction of W+ string pieces.
148  DO 170 iip=1,nnp-1
149  IF(k(inp(iip),2).LT.0) goto 170
150  i1=inp(iip)
151  i2=inp(iip+1)
152  p1a=sqrt(p(i1,1)**2+p(i1,2)**2+p(i1,3)**2)
153  p2a=sqrt(p(i2,1)**2+p(i2,2)**2+p(i2,3)**2)
154  DO 150 j=1,3
155  v1(j)=p(i1,j)/p1a
156  v2(j)=p(i2,j)/p2a
157  betp(iip,j)=0.5d0*(v1(j)+v2(j))
158  dirp(iip,j)=v1(j)-v2(j)
159  150 CONTINUE
160  betp(iip,4)=1d0/sqrt(1d0-betp(iip,1)**2-betp(iip,2)**2-
161  & betp(iip,3)**2)
162  dirl=sqrt(dirp(iip,1)**2+dirp(iip,2)**2+dirp(iip,3)**2)
163  DO 160 j=1,3
164  dirp(iip,j)=dirp(iip,j)/dirl
165  160 CONTINUE
166  170 CONTINUE
167 
168 C...Reconstruct velocity and direction of W- string pieces.
169  DO 200 iim=1,nnm-1
170  IF(k(inm(iim),2).LT.0) goto 200
171  i1=inm(iim)
172  i2=inm(iim+1)
173  p1a=sqrt(p(i1,1)**2+p(i1,2)**2+p(i1,3)**2)
174  p2a=sqrt(p(i2,1)**2+p(i2,2)**2+p(i2,3)**2)
175  DO 180 j=1,3
176  v1(j)=p(i1,j)/p1a
177  v2(j)=p(i2,j)/p2a
178  betm(iim,j)=0.5d0*(v1(j)+v2(j))
179  dirm(iim,j)=v1(j)-v2(j)
180  180 CONTINUE
181  betm(iim,4)=1d0/sqrt(1d0-betm(iim,1)**2-betm(iim,2)**2-
182  & betm(iim,3)**2)
183  dirl=sqrt(dirm(iim,1)**2+dirm(iim,2)**2+dirm(iim,3)**2)
184  DO 190 j=1,3
185  dirm(iim,j)=dirm(iim,j)/dirl
186  190 CONTINUE
187  200 CONTINUE
188 
189 C...Loop over number of space-time points.
190  nacc=0
191  sum=0d0
192  DO 250 ipt=1,npt
193 
194 C...Pick x,y,z,t Gaussian (width RHAD and TFRAG, respectively).
195  r=sqrt(-log(pyr(0)))
196  phi=2d0*pi*pyr(0)
197  x=blowr*rhad*r*cos(phi)
198  y=blowr*rhad*r*sin(phi)
199  r=sqrt(-log(pyr(0)))
200  phi=2d0*pi*pyr(0)
201  z=blowr*rhad*r*cos(phi)
202  t=gtmax+blowt*sqrt(0.5d0)*tfrag*r*abs(sin(phi))
203 
204 C...Reject impossible points. Weight for sample distribution.
205  IF(t**2-x**2-y**2-z**2.LT.0d0) goto 250
206  wtsmp=exp(-(x**2+y**2+z**2)/(blowr*rhad)**2)*
207  & exp(-2d0*(t-gtmax)**2/(blowt*tfrag)**2)
208 
209 C...Loop over W+ string pieces and find one with largest weight.
210  imaxp=0
211  wtmaxp=1d-10
212  xd(1)=x-xp(1)
213  xd(2)=y-xp(2)
214  xd(3)=z-xp(3)
215  xd(4)=t-tp
216  DO 220 iip=1,nnp-1
217  IF(k(inp(iip),2).LT.0) goto 220
218  bed=betp(iip,1)*xd(1)+betp(iip,2)*xd(2)+betp(iip,3)*xd(3)
219  bedg=betp(iip,4)*(betp(iip,4)*bed/(1d0+betp(iip,4))-xd(4))
220  DO 210 j=1,3
221  xb(j)=xd(j)+bedg*betp(iip,j)
222  210 CONTINUE
223  xb(4)=betp(iip,4)*(xd(4)-bed)
224  sr2=xb(1)**2+xb(2)**2+xb(3)**2
225  sz2=(dirp(iip,1)*xb(1)+dirp(iip,2)*xb(2)+
226  & dirp(iip,3)*xb(3))**2
227  wtp=exp(-(sr2-sz2)/(2d0*rhad**2))*exp(-(xb(4)**2-sz2)/
228  & tfrag**2)
229  IF(xb(4)-sqrt(sr2).LT.0d0) wtp=0d0
230  IF(wtp.GT.wtmaxp) THEN
231  imaxp=iip
232  wtmaxp=wtp
233  ENDIF
234  220 CONTINUE
235 
236 C...Loop over W- string pieces and find one with largest weight.
237  imaxm=0
238  wtmaxm=1d-10
239  xd(1)=x-xm(1)
240  xd(2)=y-xm(2)
241  xd(3)=z-xm(3)
242  xd(4)=t-tm
243  DO 240 iim=1,nnm-1
244  IF(k(inm(iim),2).LT.0) goto 240
245  bed=betm(iim,1)*xd(1)+betm(iim,2)*xd(2)+betm(iim,3)*xd(3)
246  bedg=betm(iim,4)*(betm(iim,4)*bed/(1d0+betm(iim,4))-xd(4))
247  DO 230 j=1,3
248  xb(j)=xd(j)+bedg*betm(iim,j)
249  230 CONTINUE
250  xb(4)=betm(iim,4)*(xd(4)-bed)
251  sr2=xb(1)**2+xb(2)**2+xb(3)**2
252  sz2=(dirm(iim,1)*xb(1)+dirm(iim,2)*xb(2)+
253  & dirm(iim,3)*xb(3))**2
254  wtm=exp(-(sr2-sz2)/(2d0*rhad**2))*exp(-(xb(4)**2-sz2)/
255  & tfrag**2)
256  IF(xb(4)-sqrt(sr2).LT.0d0) wtm=0d0
257  IF(wtm.GT.wtmaxm) THEN
258  imaxm=iim
259  wtmaxm=wtm
260  ENDIF
261  240 CONTINUE
262 
263 C...Result of integration.
264  wt=0d0
265  IF(imaxp.NE.0.AND.imaxm.NE.0) THEN
266  wt=wtmaxp*wtmaxm/wtsmp
267  sum=sum+wt
268  nacc=nacc+1
269  iap(nacc)=imaxp
270  iam(nacc)=imaxm
271  wta(nacc)=wt
272  ENDIF
273  250 CONTINUE
274  res=blowr**3*blowt*sum/npt
275 
276 C...Decide whether to reconnect and, if so, where.
277  iacc=0
278  prec=1d0-exp(-fact*res)
279  IF(prec.GT.pyr(0)) THEN
280  rsum=pyr(0)*sum
281  DO 260 ia=1,nacc
282  iacc=ia
283  rsum=rsum-wta(ia)
284  IF(rsum.LE.0d0) goto 270
285  260 CONTINUE
286  270 iip=iap(iacc)
287  iim=iam(iacc)
288  ENDIF
289 
290 C...Begin scenario II and II' specifics.
291  ELSEIF(mstp(115).EQ.2.OR.mstp(115).EQ.3) THEN
292 
293 C...Loop through all string pieces, one from W+ and one from W-.
294  ncross=0
295  tc(0)=0d0
296  DO 340 iip=1,nnp-1
297  IF(k(inp(iip),2).LT.0) goto 340
298  i1p=inp(iip)
299  i2p=inp(iip+1)
300  DO 330 iim=1,nnm-1
301  IF(k(inm(iim),2).LT.0) goto 330
302  i1m=inm(iim)
303  i2m=inm(iim+1)
304 
305 C...Find endpoint velocity vectors.
306  DO 280 j=1,3
307  v1p(j)=p(i1p,j)/p(i1p,4)
308  v2p(j)=p(i2p,j)/p(i2p,4)
309  v1m(j)=p(i1m,j)/p(i1m,4)
310  v2m(j)=p(i2m,j)/p(i2m,4)
311  280 CONTINUE
312 
313 C...Define q matrix and find t.
314  DO 290 j=1,3
315  q(1,j)=v2p(j)-v1p(j)
316  q(2,j)=-(v2m(j)-v1m(j))
317  q(3,j)=xp(j)-xm(j)-tp*v1p(j)+tm*v1m(j)
318  q(4,j)=v1p(j)-v1m(j)
319  290 CONTINUE
320  t=-deter(1,2,3)/deter(1,2,4)
321 
322 C...Find alpha and beta; i.e. coordinates of crossing point.
323  s11=q(1,1)*(t-tp)
324  s12=q(2,1)*(t-tm)
325  s13=q(3,1)+q(4,1)*t
326  s21=q(1,2)*(t-tp)
327  s22=q(2,2)*(t-tm)
328  s23=q(3,2)+q(4,2)*t
329  den=s11*s22-s12*s21
330  alp=(s12*s23-s22*s13)/den
331  bet=(s21*s13-s11*s23)/den
332 
333 C...Check if solution acceptable.
334  iansw=1
335  IF(t.LT.gtmax) iansw=0
336  IF(alp.LT.0d0.OR.alp.GT.1d0) iansw=0
337  IF(bet.LT.0d0.OR.bet.GT.1d0) iansw=0
338 
339 C...Find point of crossing and check that not inconsistent.
340  DO 300 j=1,3
341  xpp(j)=xp(j)+(v1p(j)+alp*(v2p(j)-v1p(j)))*(t-tp)
342  xmm(j)=xm(j)+(v1m(j)+bet*(v2m(j)-v1m(j)))*(t-tm)
343  300 CONTINUE
344  d2pm=(xpp(1)-xmm(1))**2+(xpp(2)-xmm(2))**2+
345  & (xpp(3)-xmm(3))**2
346  d2p=xpp(1)**2+xpp(2)**2+xpp(3)**2
347  d2m=xmm(1)**2+xmm(2)**2+xmm(3)**2
348  IF(d2pm.GT.1d-4*(d2p+d2m)) iansw=-1
349 
350 C...Find string eigentimes at crossing.
351  IF(iansw.EQ.1) THEN
352  taup=sqrt(max(0d0,(t-tp)**2-(xpp(1)-xp(1))**2-
353  & (xpp(2)-xp(2))**2-(xpp(3)-xp(3))**2))
354  taum=sqrt(max(0d0,(t-tm)**2-(xmm(1)-xm(1))**2-
355  & (xmm(2)-xm(2))**2-(xmm(3)-xm(3))**2))
356  ELSE
357  taup=0d0
358  taum=0d0
359  ENDIF
360 
361 C...Order crossings by time. End loop over crossings.
362  IF(iansw.EQ.1.AND.ncross.LT.20) THEN
363  ncross=ncross+1
364  DO 310 i1=ncross,1,-1
365  IF(t.GT.tc(i1-1).OR.i1.EQ.1) THEN
366  ipc(i1)=iip
367  imc(i1)=iim
368  tc(i1)=t
369  tpc(i1)=taup
370  tmc(i1)=taum
371  goto 320
372  ELSE
373  ipc(i1)=ipc(i1-1)
374  imc(i1)=imc(i1-1)
375  tc(i1)=tc(i1-1)
376  tpc(i1)=tpc(i1-1)
377  tmc(i1)=tmc(i1-1)
378  ENDIF
379  310 CONTINUE
380  320 CONTINUE
381  ENDIF
382  330 CONTINUE
383  340 CONTINUE
384 
385 C...Loop over crossings; find first (if any) acceptable one.
386  iacc=0
387  IF(ncross.GE.1) THEN
388  DO 350 ic=1,ncross
389  pnfrag=exp(-(tpc(ic)**2+tmc(ic)**2)/tfrag**2)
390  IF(pnfrag.GT.pyr(0)) THEN
391 C...Scenario II: only compare with fragmentation time.
392  IF(mstp(115).EQ.2) THEN
393  iacc=ic
394  iip=ipc(iacc)
395  iim=imc(iacc)
396  goto 360
397 C...Scenario II': also require that string length decreases.
398  ELSE
399  iip=ipc(ic)
400  iim=imc(ic)
401  i1p=inp(iip)
402  i2p=inp(iip+1)
403  i1m=inm(iim)
404  i2m=inm(iim+1)
405  elold=four(i1p,i2p)*four(i1m,i2m)
406  elnew=four(i1p,i2m)*four(i1m,i2p)
407  IF(elnew.LT.elold) THEN
408  iacc=ic
409  iip=ipc(iacc)
410  iim=imc(iacc)
411  goto 360
412  ENDIF
413  ENDIF
414  ENDIF
415  350 CONTINUE
416  360 CONTINUE
417  ENDIF
418 
419 C...Begin scenario GH specifics.
420  ELSEIF(mstp(115).EQ.5) THEN
421 
422 C...Loop through all string pieces, one from W+ and one from W-.
423  iacc=0
424  elmin=1d0
425  DO 380 iip=1,nnp-1
426  IF(k(inp(iip),2).LT.0) goto 380
427  i1p=inp(iip)
428  i2p=inp(iip+1)
429  DO 370 iim=1,nnm-1
430  IF(k(inm(iim),2).LT.0) goto 370
431  i1m=inm(iim)
432  i2m=inm(iim+1)
433 
434 C...Look for largest decrease of (exponent of) Lambda measure.
435  elold=four(i1p,i2p)*four(i1m,i2m)
436  elnew=four(i1p,i2m)*four(i1m,i2p)
437  eldif=elnew/max(1d-10,elold)
438  IF(eldif.LT.elmin) THEN
439  iacc=iip+iim
440  elmin=eldif
441  ipc(1)=iip
442  imc(1)=iim
443  ENDIF
444  370 CONTINUE
445  380 CONTINUE
446  iip=ipc(1)
447  iim=imc(1)
448  ENDIF
449 
450 C...Common for scenarios I, II, II' and GH: reconnect strings.
451  IF(iacc.NE.0) THEN
452  mint(32)=1
453  njoin=0
454  DO 390 is=1,nnp+nnm
455  njoin=njoin+1
456  IF(is.LE.iip) THEN
457  i=inp(is)
458  ELSEIF(is.LE.iip+nnm-iim) THEN
459  i=inm(is-iip+iim)
460  ELSEIF(is.LE.iip+nnm) THEN
461  i=inm(is-iip-nnm+iim)
462  ELSE
463  i=inp(is-nnm)
464  ENDIF
465  ijoin(njoin)=i
466  IF(k(i,2).LT.0) THEN
467  CALL pyjoin(njoin,ijoin)
468  njoin=0
469  ENDIF
470  390 CONTINUE
471 
472 C...Restore original event record if no reconnection.
473  ELSE
474  DO 400 i=nsd1+1,nold
475  IF(k(i,1).EQ.13.OR.k(i,1).EQ.14) THEN
476  k(i,4)=mod(k(i,4),mstu(5)**2)
477  k(i,5)=mod(k(i,5),mstu(5)**2)
478  ENDIF
479  400 CONTINUE
480  DO 410 i=nold+1,n
481  k(k(i,3),1)=3
482  410 CONTINUE
483  n=nold
484  ENDIF
485 
486 C...Boost back system.
487  CALL pyrobo(iw1,iw1,0d0,0d0,beww(1),beww(2),beww(3))
488  CALL pyrobo(iw2,iw2,0d0,0d0,beww(1),beww(2),beww(3))
489  IF(n.GT.nold) CALL pyrobo(nold+1,n,0d0,0d0,
490  & beww(1),beww(2),beww(3))
491 
492 C...Common part for intermediate and instantaneous scenarios.
493  ELSEIF(mstp(115).EQ.11.OR.mstp(115).EQ.12) THEN
494  mint(32)=1
495 
496 C...Remove old shower products and reset showering ones.
497  n=nsd1+4
498  DO 420 i=nsd1+1,nsd1+4
499  k(i,1)=3
500  k(i,4)=mod(k(i,4),mstu(5)**2)
501  k(i,5)=mod(k(i,5),mstu(5)**2)
502  420 CONTINUE
503 
504 C...Identify quark-antiquark pairs.
505  iq1=nsd1+1
506  iq2=nsd1+2
507  iq3=nsd1+3
508  IF(k(iq1,2)*k(iq3,2).LT.0) iq3=nsd1+4
509  iq4=2*nsd1+7-iq3
510 
511 C...Reconnect strings.
512  ijoin(1)=iq1
513  ijoin(2)=iq4
514  CALL pyjoin(2,ijoin)
515  ijoin(1)=iq3
516  ijoin(2)=iq2
517  CALL pyjoin(2,ijoin)
518 
519 C...Do new parton showers in intermediate scenario.
520  IF(mstp(71).GE.1.AND.mstp(115).EQ.11) THEN
521  mstj50=mstj(50)
522  mstj(50)=0
523  CALL pyshow(iq1,iq2,p(iw1,5))
524  CALL pyshow(iq3,iq4,p(iw2,5))
525  mstj(50)=mstj50
526 
527 C...Do new parton showers in instantaneous scenario.
528  ELSEIF(mstp(71).GE.1.AND.mstp(115).EQ.12) THEN
529  ppm2=(p(iq1,4)+p(iq4,4))**2-(p(iq1,1)+p(iq4,1))**2-
530  & (p(iq1,2)+p(iq4,2))**2-(p(iq1,3)+p(iq4,3))**2
531  ppm=sqrt(max(0d0,ppm2))
532  CALL pyshow(iq1,iq4,ppm)
533  ppm2=(p(iq3,4)+p(iq2,4))**2-(p(iq3,1)+p(iq2,1))**2-
534  & (p(iq3,2)+p(iq2,2))**2-(p(iq3,3)+p(iq2,3))**2
535  ppm=sqrt(max(0d0,ppm2))
536  CALL pyshow(iq3,iq2,ppm)
537  ENDIF
538  ENDIF
539 
540  RETURN
541  END