]> git.uio.no Git - u/mrichter/AliRoot.git/blob - GEANT321/gphys/gdeca2.F
This commit was generated by cvs2svn to compensate for changes in r2,
[u/mrichter/AliRoot.git] / GEANT321 / gphys / gdeca2.F
1 *
2 * $Id$
3 *
4 * $Log$
5 * Revision 1.1.1.1  1995/10/24 10:21:23  cernlib
6 * Geant
7 *
8 *
9 #include "geant321/pilot.h"
10 *CMZ :  3.21/02 29/03/94  15.41.21  by  S.Giani
11 *-- Author :
12       SUBROUTINE GDECA2(XM0,XM1,XM2,PCM)
13 C.
14 C.    ******************************************************************
15 C.    *                                                                *
16 C.    *  Simulates two body decay process with isotropic angular       *
17 C.    *  distribution in CMS.                                          *
18 C.    *                                                                *
19 C.    *    ==>Called by : GDECAY                                       *
20 C.    *       Author    G.Patrick  *********                           *
21 C.    *                                                                *
22 C.    ******************************************************************
23 C.
24 #include "geant321/gconsp.inc"
25       DIMENSION PCM(4,2)
26       DIMENSION RNDM(2)
27 C.
28 C.    ------------------------------------------------------------------
29 C.
30 C             Generate first decay product in CMS.
31 C
32       E1=(XM0*XM0+XM1*XM1-XM2*XM2)/(2.*XM0)
33       P1=SQRT(ABS((E1-XM1)*(E1+XM1)))
34 C
35 C             Isotropic decay angular distribution.
36 C
37       CALL GRNDM(RNDM,2)
38       COSTH=2.*RNDM(1)-1.
39       IF(ABS(COSTH).GE.1.0) THEN
40          COSTH=SIGN(1.,COSTH)
41          SINTH=0.
42       ELSE
43          SINTH=SQRT((1.-COSTH)*(1.+COSTH))
44       ENDIF
45       PHI=TWOPI*RNDM(2)
46 C
47 C             Polar co-ordinates to momentum components.
48 C
49       PCM(1,1)=P1*SINTH*COS(PHI)
50       PCM(2,1)=P1*SINTH*SIN(PHI)
51       PCM(3,1)=P1*COSTH
52       PCM(4,1)=E1
53 C
54 C             Generate second decay product.
55 C
56       PCM(1,2)=-PCM(1,1)
57       PCM(2,2)=-PCM(2,1)
58       PCM(3,2)=-PCM(3,1)
59       PCM(4,2)=SQRT(PCM(1,2)**2+PCM(2,2)**2+PCM(3,2)**2+XM2*XM2)
60 C
61       END