This commit was generated by cvs2svn to compensate for changes in r2,
[u/mrichter/AliRoot.git] / GEANT321 / gphys / gsync.F
1 *
2 * $Id$
3 *
4 * $Log$
5 * Revision 1.1.1.1  1995/10/24 10:21:34  cernlib
6 * Geant
7 *
8 *
9 #include "geant321/pilot.h"
10 *CMZ :  3.21/03 11/10/94  19.56.01  by  S.Giani
11 *-- Author :
12       SUBROUTINE GSYNC
13 C
14 C.    ******************************************************************
15 C.    *                                                                *
16 C.    *   Simulation of synchrotron radiation for e- and e+.           *
17 C.    *                                                                *
18 C.    *   ==> Called by : GTELEC                                       *
19 C.    *       Authors   : Igor Gavrilenko                              *
20 C.    *                                                                *
21 C.    ******************************************************************
22 C
23 #include "geant321/gcphys.inc"
24 #include "geant321/gctrak.inc"
25 #include "geant321/gckine.inc"
26 #include "geant321/gcking.inc"
27 #include "geant321/gctmed.inc"
28 #include "geant321/gccuts.inc"
29 C...
30       DIMENSION ETR(100),STR(100),VECTS(7),VECTN(7),FLD(3)
31 C...
32       IF(ABS(CHARGE).NE.1..OR.STEP.LE.0.) GO TO 999
33       GAMMA  = GETOT/AMASS
34       IF(GAMMA.LE.1000.                 ) GO TO 999
35       KCASE = NAMEC1(8)
36       IF (IFIELD.EQ.3) THEN
37           FLD(1) = 0.
38           FLD(2) = 0.
39           FLD(3) = FIELDM
40       ELSE
41           CALL GUFLD(VECT,FLD)
42       END IF
43       FLDS2  = FLD(1)**2+FLD(2)**2+FLD(3)**2
44       IF(FLDS2.LE.1E-10) GO TO 999
45       FLDT   = SQRT(FLDS2-
46      +  (VECT(4)*FLD(1)+VECT(5)*FLD(2)+VECT(6)*FLD(3))**2)
47 C...
48       CALL GSYNGE(GAMMA,AMASS,FLDT,STEP,NTR,ETR,STR)
49       IF(NTR.EQ.0) GO TO 999
50 C...
51       ELOSS          = 0.
52 C
53 C     When SYNC=1 the generation point of the photons is the current
54 C     particle point
55 C     When SYNC=3, the generation point of the photon is distributed
56 C     along the real trajectory of the particle (not along the step
57 C     taken) computed by GUSWIM.
58       DO 10 N = 1,NTR
59          IF (ISYNC.NE.2.AND.ETR(N).GT.CUTGAM) THEN
60             NGKINE = NGKINE+1
61             IF(NGKINE.GT.MXGKIN) GO TO 20
62             IF (ISYNC.EQ.1) THEN
63                 GKIN(1,NGKINE) = ETR(N)*VECT(4)
64                 GKIN(2,NGKINE) = ETR(N)*VECT(5)
65                 GKIN(3,NGKINE) = ETR(N)*VECT(6)
66                 GKIN(4,NGKINE) = ETR(N)
67                 GKIN(5,NGKINE) = 1.
68                 GPOS(1,NGKINE) = VECT(1)
69                 GPOS(2,NGKINE) = VECT(2)
70                 GPOS(3,NGKINE) = VECT(3)
71                 TOFD (NGKINE) = 0.
72             ELSE IF (ISYNC.EQ.3) THEN
73                 VECTS(1) = VECT(1)
74                 VECTS(2) = VECT(2)
75                 VECTS(3) = VECT(3)
76                 VECTS(4) = -VECT(4)
77                 VECTS(5) = -VECT(5)
78                 VECTS(6) = -VECT(6)
79                 VECTS(7) = VECT(7)
80                 CALL GUSWIM(1.,STR(N),VECTS,VECTN)
81                 GKIN(1,NGKINE) = -ETR(N)*VECTN(4)
82                 GKIN(2,NGKINE) = -ETR(N)*VECTN(5)
83                 GKIN(3,NGKINE) = -ETR(N)*VECTN(6)
84                 GKIN(4,NGKINE) = ETR(N)
85                 GKIN(5,NGKINE) = 1.
86                 GPOS(1,NGKINE) = VECTN(1)
87                 GPOS(2,NGKINE) = VECTN(2)
88                 GPOS(3,NGKINE) = VECTN(3)
89                 TOFD (NGKINE) = 0.
90              END IF
91          ELSE
92              DESTEP = DESTEP +ETR(N)
93          END IF
94          ELOSS = ELOSS+ETR(N)
95    10 CONTINUE
96 C
97 C..Update the energy of the primary particle
98 C
99    20 GETOT = GETOT-ELOSS
100       GEKIN = GEKIN-ELOSS
101       VECT(7) = SQRT(GEKIN*(GEKIN+2.*AMASS))
102       CALL GEKBIN
103 C...
104  999  END