Adding macros to create Calibration objects
[u/mrichter/AliRoot.git] / HIJING / hijing1_36 / hijels.F
1 * $Id$
2 C
3 C
4 C*******************************************************************
5 CThis subroutine performs elastic scattering between two nucleons
6 C
7 C*******************************************************************
8         SUBROUTINE HIJELS(PSC1,PSC2)
9         IMPLICIT DOUBLE PRECISION(D)
10         DIMENSION PSC1(5),PSC2(5)
11 #define BLANKET_SAVE
12 #include "hiparnt.inc"
13         SAVE
14 C
15         CC=1.0-HINT1(12)/HINT1(13)
16         RR=(1.0-CC)*HINT1(13)/HINT1(12)/(1.0-HIPR1(33))-1.0
17         BB=0.5*(3.0+RR+SQRT(9.0+10.0*RR+RR**2))
18         EP=SQRT((PSC1(1)-PSC2(1))**2+(PSC1(2)-PSC2(2))**2
19      &          +(PSC1(3)-PSC2(3))**2)
20         IF(EP.LE.0.1) RETURN
21         ELS0=98.0/EP+52.0*(1.0+RR)**2
22         PCM1=PSC1(1)+PSC2(1)
23         PCM2=PSC1(2)+PSC2(2)
24         PCM3=PSC1(3)+PSC2(3)
25         ECM=PSC1(4)+PSC2(4)
26         AM1=PSC1(5)**2
27         AM2=PSC2(5)**2
28         AMM=ECM**2-PCM1**2-PCM2**2-PCM3**2
29         IF(AMM.LE.PSC1(5)+PSC2(5)) RETURN
30 C               ********elastic scattering only when approaching
31 C                               to each other
32         PMAX=(AMM**2+AM1**2+AM2**2-2.0*AMM*AM1-2.0*AMM*AM2
33      &                  -2.0*AM1*AM2)/4.0/AMM
34         PMAX=ABS(PMAX)
35 20      TT=RLU_HIJING(0)*MIN(PMAX,1.5)
36         ELS=98.0*EXP(-2.8*TT)/EP
37      &          +52.0*EXP(-9.2*TT)*(1.0+RR*EXP(-4.6*(BB-1.0)*TT))**2
38         IF(RLU_HIJING(0).GT.ELS/ELS0) GO TO 20
39         PHI=2.0*HIPR1(40)*RLU_HIJING(0)
40 C
41         DBX=PCM1/ECM
42         DBY=PCM2/ECM
43         DBZ=PCM3/ECM
44         DB=SQRT(DBX**2+DBY**2+DBZ**2)
45         IF(DB.GT.0.99999999D0) THEN 
46           DBX=DBX*(0.99999999D0/DB) 
47           DBY=DBY*(0.99999999D0/DB) 
48           DBZ=DBZ*(0.99999999D0/DB) 
49           DB=0.99999999D0   
50           WRITE(6,*) ' (HIJELS) boost vector too large' 
51 C               ********Rescale boost vector if too close to unity. 
52         ENDIF   
53         DGA=1D0/SQRT(1D0-DB**2)      
54 C
55         DP1=SQRT(TT)*SIN(PHI)
56         DP2=SQRT(TT)*COS(PHI)
57         DP3=SQRT(PMAX-TT)
58         DP4=SQRT(PMAX+AM1)
59         DBP=DBX*DP1+DBY*DP2+DBZ*DP3   
60         DGABP=DGA*(DGA*DBP/(1D0+DGA)+DP4) 
61         PSC1(1)=DP1+DGABP*DBX
62         PSC1(2)=DP2+DGABP*DBY  
63         PSC1(3)=DP3+DGABP*DBZ  
64         PSC1(4)=DGA*(DP4+DBP)    
65 C       
66         DP1=-SQRT(TT)*SIN(PHI)
67         DP2=-SQRT(TT)*COS(PHI)
68         DP3=-SQRT(PMAX-TT)
69         DP4=SQRT(PMAX+AM2)
70         DBP=DBX*DP1+DBY*DP2+DBZ*DP3   
71         DGABP=DGA*(DGA*DBP/(1D0+DGA)+DP4) 
72         PSC2(1)=DP1+DGABP*DBX
73         PSC2(2)=DP2+DGABP*DBY  
74         PSC2(3)=DP3+DGABP*DBZ  
75         PSC2(4)=DGA*(DP4+DBP)
76         RETURN
77         END