Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pyp.f
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file pyp.f
1 
2 C*********************************************************************
3 
4 C...PYP
5 C...Provides various real-valued event related data.
6 
7  FUNCTION pyp(I,J)
8 
9 C...Double precision and integer declarations.
10  IMPLICIT DOUBLE PRECISION(a-h, o-z)
11  IMPLICIT INTEGER(i-n)
12  INTEGER pyk,pychge,pycomp
13 C...Commonblocks.
14  common/pyjets/n,npad,k(4000,5),p(4000,5),v(4000,5)
15  common/pydat1/mstu(200),paru(200),mstj(200),parj(200)
16  common/pydat2/kchg(500,4),pmas(500,4),parf(2000),vckm(4,4)
17  SAVE /pyjets/,/pydat1/,/pydat2/
18 C...Local array.
19  dimension psum(4)
20 
21 C...Set default value. For I = 0 sum of momenta or charges,
22 C...or invariant mass of system.
23  pyp=0d0
24  IF(i.LT.0.OR.i.GT.mstu(4).OR.j.LE.0) THEN
25  ELSEIF(i.EQ.0.AND.j.LE.4) THEN
26  DO 100 i1=1,n
27  IF(k(i1,1).GT.0.AND.k(i1,1).LE.10) pyp=pyp+p(i1,j)
28  100 CONTINUE
29  ELSEIF(i.EQ.0.AND.j.EQ.5) THEN
30  DO 120 j1=1,4
31  psum(j1)=0d0
32  DO 110 i1=1,n
33  IF(k(i1,1).GT.0.AND.k(i1,1).LE.10) psum(j1)=psum(j1)+
34  & p(i1,j1)
35  110 CONTINUE
36  120 CONTINUE
37  pyp=sqrt(max(0d0,psum(4)**2-psum(1)**2-psum(2)**2-psum(3)**2))
38  ELSEIF(i.EQ.0.AND.j.EQ.6) THEN
39  DO 130 i1=1,n
40  IF(k(i1,1).GT.0.AND.k(i1,1).LE.10) pyp=pyp+pychge(k(i1,2))/3d0
41  130 CONTINUE
42  ELSEIF(i.EQ.0) THEN
43 
44 C...Direct readout of P matrix.
45  ELSEIF(j.LE.5) THEN
46  pyp=p(i,j)
47 
48 C...Charge, total momentum, transverse momentum, transverse mass.
49  ELSEIF(j.LE.12) THEN
50  IF(j.EQ.6) pyp=pychge(k(i,2))/3d0
51  IF(j.EQ.7.OR.j.EQ.8) pyp=p(i,1)**2+p(i,2)**2+p(i,3)**2
52  IF(j.EQ.9.OR.j.EQ.10) pyp=p(i,1)**2+p(i,2)**2
53  IF(j.EQ.11.OR.j.EQ.12) pyp=p(i,5)**2+p(i,1)**2+p(i,2)**2
54  IF(j.EQ.8.OR.j.EQ.10.OR.j.EQ.12) pyp=sqrt(pyp)
55 
56 C...Theta and phi angle in radians or degrees.
57  ELSEIF(j.LE.16) THEN
58  IF(j.LE.14) pyp=pyangl(p(i,3),sqrt(p(i,1)**2+p(i,2)**2))
59  IF(j.GE.15) pyp=pyangl(p(i,1),p(i,2))
60  IF(j.EQ.14.OR.j.EQ.16) pyp=pyp*180d0/paru(1)
61 
62 C...True rapidity, rapidity with pion mass, pseudorapidity.
63  ELSEIF(j.LE.19) THEN
64  pmr=0d0
65  IF(j.EQ.17) pmr=p(i,5)
66  IF(j.EQ.18) pmr=pymass(211)
67  pr=max(1d-20,pmr**2+p(i,1)**2+p(i,2)**2)
68  pyp=sign(log(min((sqrt(pr+p(i,3)**2)+abs(p(i,3)))/sqrt(pr),
69  & 1d20)),p(i,3))
70 
71 C...Energy and momentum fractions (only to be used in CM frame).
72  ELSEIF(j.LE.25) THEN
73  IF(j.EQ.20) pyp=2d0*sqrt(p(i,1)**2+p(i,2)**2+p(i,3)**2)/paru(21)
74  IF(j.EQ.21) pyp=2d0*p(i,3)/paru(21)
75  IF(j.EQ.22) pyp=2d0*sqrt(p(i,1)**2+p(i,2)**2)/paru(21)
76  IF(j.EQ.23) pyp=2d0*p(i,4)/paru(21)
77  IF(j.EQ.24) pyp=(p(i,4)+p(i,3))/paru(21)
78  IF(j.EQ.25) pyp=(p(i,4)-p(i,3))/paru(21)
79  ENDIF
80 
81  RETURN
82  END