Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pyxkfl.f
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file pyxkfl.f
1 
2 C*********************************************************************
3 
4 C...PYXKFL
5 C...Selects flavour for produced qqbar pair.
6 
7  SUBROUTINE pyxkfl(KFL,ECM,ECMC,KFLC)
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/pydat1/mstu(200),paru(200),mstj(200),parj(200)
15  common/pydat2/kchg(500,4),pmas(500,4),parf(2000),vckm(4,4)
16  SAVE /pydat1/,/pydat2/
17 
18 C...Calculate maximum weight in QED or QFD case.
19  IF(mstj(102).LE.1) THEN
20  rfmax=4d0/9d0
21  ELSE
22  poll=1d0-parj(131)*parj(132)
23  sff=1d0/(16d0*paru(102)*(1d0-paru(102)))
24  sfw=ecmc**4/((ecmc**2-parj(123)**2)**2+(parj(123)*parj(124))**2)
25  sfi=sfw*(1d0-(parj(123)/ecmc)**2)
26  ve=4d0*paru(102)-1d0
27  hf1i=sfi*sff*(ve*poll+parj(132)-parj(131))
28  hf1w=sfw*sff**2*((ve**2+1d0)*poll+2d0*ve*(parj(132)-parj(131)))
29  rfmax=max(4d0/9d0*poll-4d0/3d0*(1d0-8d0*paru(102)/3d0)*hf1i+
30  & ((1d0-8d0*paru(102)/3d0)**2+1d0)*hf1w,1d0/9d0*poll+2d0/3d0*
31  & (-1d0+4d0*paru(102)/3d0)*hf1i+((-1d0+4d0*paru(102)/3d0)**2+
32  & 1d0)*hf1w)
33  ENDIF
34 
35 C...Choose flavour. Gives charge and velocity.
36  ntry=0
37  100 ntry=ntry+1
38  IF(ntry.GT.100) THEN
39  CALL pyerrm(14,'(PYXKFL:) caught in an infinite loop')
40  kflc=0
41  RETURN
42  ENDIF
43  kflc=kfl
44  IF(kfl.LE.0) kflc=1+int(mstj(104)*pyr(0))
45  mstj(93)=1
46  pmq=pymass(kflc)
47  IF(ecm.LT.2d0*pmq+parj(127)) goto 100
48  qf=kchg(kflc,1)/3d0
49  vq=1d0
50  IF(mod(mstj(103),2).EQ.1) vq=sqrt(max(0d0,1d0-(2d0*pmq/ecmc)**2))
51 
52 C...Calculate weight in QED or QFD case.
53  IF(mstj(102).LE.1) THEN
54  rf=qf**2
55  rfv=0.5d0*vq*(3d0-vq**2)*qf**2
56  ELSE
57  vf=sign(1d0,qf)-4d0*qf*paru(102)
58  rf=qf**2*poll-2d0*qf*vf*hf1i+(vf**2+1d0)*hf1w
59  rfv=0.5d0*vq*(3d0-vq**2)*(qf**2*poll-2d0*qf*vf*hf1i+vf**2*hf1w)+
60  & vq**3*hf1w
61  IF(rfv.GT.0d0) parj(171)=min(1d0,vq**3*hf1w/rfv)
62  ENDIF
63 
64 C...Weighting or new event (radiative photon). Cross-section update.
65  IF(kfl.LE.0.AND.rf.LT.pyr(0)*rfmax) goto 100
66  parj(158)=parj(158)+1d0
67  IF(ecmc.LT.2d0*pmq+parj(127).OR.rfv.LT.pyr(0)*rf) kflc=0
68  IF(mstj(107).LE.0.AND.kflc.EQ.0) goto 100
69  IF(kflc.NE.0) parj(159)=parj(159)+1d0
70  parj(144)=parj(157)*parj(159)/parj(158)
71  parj(148)=parj(144)*86.8d0/ecm**2
72 
73  RETURN
74  END