Adding macros to create Calibration objects
[u/mrichter/AliRoot.git] / HIJING / hijing1_36 / ar3jet.F
1 * $Id$
2
3
4         SUBROUTINE AR3JET(S,X1,X3,JL)
5 C     
6 #define BLANKET_SAVE
7 #include "hiparnt.inc"
8 #include "lujets_hijing.inc"
9         SAVE
10 C     
11         C=1./3.
12         IF(K(JL,2).NE.21 .AND. K(JL+1,2).NE.21) C=8./27.
13         EXP1=3
14         EXP3=3
15         IF(K(JL,2).NE.21) EXP1=2
16         IF(K(JL+1,2).NE.21) EXP3=2
17         A=0.24**2/S
18         YMA=ALOG(.5/SQRT(A)+SQRT(.25/A-1))
19         D=4.*C*YMA
20         SM1=P(JL,5)**2/S
21         SM3=P(JL+1,5)**2/S
22         XT2M=(1.-2.*SQRT(SM1)+SM1-SM3)*(1.-2.*SQRT(SM3)-SM1+SM3)
23         XT2M=MIN(.25,XT2M)
24         NTRY=0
25 1       IF(NTRY.EQ.5000) THEN
26                 X1=.5*(2.*SQRT(SM1)+1.+SM1-SM3)
27                 X3=.5*(2.*SQRT(SM3)+1.-SM1+SM3)
28                 RETURN
29         ENDIF
30         NTRY=NTRY+1
31      
32         XT2=A*(XT2M/A)**(RLU_HIJING(0)**(1./D))
33      
34         YMAX=ALOG(.5/SQRT(XT2)+SQRT(.25/XT2-1.))
35         Y=(2.*RLU_HIJING(0)-1.)*YMAX
36         X1=1.-SQRT(XT2)*EXP(Y)
37         X3=1.-SQRT(XT2)*EXP(-Y)
38         X2=2.-X1-X3
39         NEG=0
40         IF(K(JL,2).NE.21 .OR. K(JL+1,2).NE.21) THEN
41         IF((1.-X1)*(1.-X2)*(1.-X3)-X2*SM1*(1.-X1)-X2*SM3*(1.-X3).
42      &  LE.0..OR.X1.LE.2.*SQRT(SM1)-SM1+SM3.OR.X3.LE.2.*SQRT(SM3)
43      &  -SM3+SM1) NEG=1
44         X1=X1+SM1-SM3
45         X3=X3-SM1+SM3
46         ENDIF
47         IF(NEG.EQ.1) GOTO 1
48      
49         FG=2.*YMAX*C*(X1**EXP1+X3**EXP3)/D
50         XT2M=XT2
51         IF(FG.LT.RLU_HIJING(0)) GOTO 1
52      
53         RETURN
54         END