Merging the VirtualMC branch to the main development branch (HEAD)
[u/mrichter/AliRoot.git] / HIJING / hipyset1_35 / luxkfl_hijing.F
CommitLineData
e74335a4 1* $Id$
2
3C*********************************************************************
4
5 SUBROUTINE LUXKFL_HIJING(KFL,ECM,ECMC,KFLC)
6
7C...Purpose: to select flavour for produced qqbar pair.
8#include "ludat1_hijing.inc"
9#include "ludat2_hijing.inc"
10
11C...Calculate maximum weight in QED or QFD case.
12 IF(MSTJ(102).LE.1) THEN
13 RFMAX=4./9.
14 ELSE
15 POLL=1.-PARJ(131)*PARJ(132)
16 SFF=1./(16.*PARU(102)*(1.-PARU(102)))
17 SFW=ECMC**4/((ECMC**2-PARJ(123)**2)**2+(PARJ(123)*PARJ(124))**2)
18 SFI=SFW*(1.-(PARJ(123)/ECMC)**2)
19 VE=4.*PARU(102)-1.
20 HF1I=SFI*SFF*(VE*POLL+PARJ(132)-PARJ(131))
21 HF1W=SFW*SFF**2*((VE**2+1.)*POLL+2.*VE*(PARJ(132)-PARJ(131)))
22 RFMAX=MAX(4./9.*POLL-4./3.*(1.-8.*PARU(102)/3.)*HF1I+
23 & ((1.-8.*PARU(102)/3.)**2+1.)*HF1W,1./9.*POLL+2./3.*
24 & (-1.+4.*PARU(102)/3.)*HF1I+((-1.+4.*PARU(102)/3.)**2+1.)*HF1W)
25 ENDIF
26
27C...Choose flavour. Gives charge and velocity.
28 NTRY=0
29 100 NTRY=NTRY+1
30 IF(NTRY.GT.100) THEN
31 CALL LUERRM_HIJING(14
32 $ ,'(LUXKFL_HIJING:) caught in an infinite loop')
33 KFLC=0
34 RETURN
35 ENDIF
36 KFLC=KFL
37 IF(KFL.LE.0) KFLC=1+INT(MSTJ(104)*RLU_HIJING(0))
38 MSTJ(93)=1
39 PMQ=ULMASS_HIJING(KFLC)
40 IF(ECM.LT.2.*PMQ+PARJ(127)) GOTO 100
41 QF=KCHG(KFLC,1)/3.
42 VQ=1.
43 IF(MOD(MSTJ(103),2).EQ.1) VQ=SQRT(MAX(0.,1.-(2.*PMQ/ECMC)**2))
44
45C...Calculate weight in QED or QFD case.
46 IF(MSTJ(102).LE.1) THEN
47 RF=QF**2
48 RFV=0.5*VQ*(3.-VQ**2)*QF**2
49 ELSE
50 VF=SIGN(1.,QF)-4.*QF*PARU(102)
51 RF=QF**2*POLL-2.*QF*VF*HF1I+(VF**2+1.)*HF1W
52 RFV=0.5*VQ*(3.-VQ**2)*(QF**2*POLL-2.*QF*VF*HF1I+VF**2*HF1W)+
53 & VQ**3*HF1W
54 ENDIF
55
56C...Weighting or new event (radiative photon). Cross-section update.
57 IF(KFL.LE.0.AND.RF.LT.RLU_HIJING(0)*RFMAX) GOTO 100
58 PARJ(158)=PARJ(158)+1.
59 IF(ECMC.LT.2.*PMQ+PARJ(127).OR.RFV.LT.RLU_HIJING(0)*RF) KFLC=0
60 IF(MSTJ(107).LE.0.AND.KFLC.EQ.0) GOTO 100
61 IF(KFLC.NE.0) PARJ(159)=PARJ(159)+1.
62 PARJ(144)=PARJ(157)*PARJ(159)/PARJ(158)
63 PARJ(148)=PARJ(144)*86.8/ECM**2
64
65 RETURN
66 END