source: trunk/MagicSoft/Simulation/Corsika/Mmcs/addang.f@ 9338

Last change on this file since 9338 was 286, checked in by harald, 25 years ago
This is the start point for further developments of the Magic Monte Carlo Simulation written by Jose Carlos Gonzales. Now it is under control of one CVS repository for the whole collaboration. Everyone should use this CVS repository for further developments.
File size: 3.0 KB
Line 
1 SUBROUTINE ADDANG( COST0,PHI0, COST,PHI, COST1,PHI1 )
2
3C-----------------------------------------------------------------------
4C ADD(ITION OF) ANG(LES)
5C
6C ADDITION OF ANGLES IS DONE BY SEQUENTIAL ROTATIONS :
7C 1. ROTATE VECTOR AROUND Z AXIS BY -PHI0
8C 2. ROTATE VECTOR AROUND Y AXIS BY -THETA0 NOW VECTOR IS (0,0,1)
9C
10C 3. ROTATE VECTOR AROUND Y AXIS BY THETA ANGLES TO BE ADDED
11C 4. ROTATE VECTOR AROUND Z AXIS BY PHI
12C
13C 5. ROTATE VECTOR AROUND Y AXIS BY THETA0
14C 6. ROTATE VECTOR AROUND Z AXIS BY -PHI0
15C NOW VECTOR IS (X,Y,Z) WITH COST1 = Z
16C AND TAN(PHI1) = Y/X
17C THIS SUBROUTINE IS CALLED FROM MANY ROUTINES
18C ARGUMENTS:
19C COST0 = COSINE THETA OF PARTICLE BEFORE
20C PHI0 = PHI OF PARTICLE BEFORE
21C COST = COSINE THETA OF ANGLE TO ADD
22C PHI = PHI OF ANGLE TO ADD
23C COST1 = COSINE THETA OF PARTICLE AFTER ADDITION OF ANGLES
24C PHI1 = PHI THETA OF PARTICLE AFTER ADDITION OF ANGLES
25C-----------------------------------------------------------------------
26
27 IMPLICIT NONE
28*KEEP,CONST.
29 COMMON /CONST/ PI,PI2,OB3,TB3,ENEPER
30 DOUBLE PRECISION PI,PI2,OB3,TB3,ENEPER
31*KEEP,RUNPAR.
32 COMMON /RUNPAR/ FIXHEI,THICK0,HILOECM,HILOELB,
33 * STEPFC,NRRUN,NSHOW,PATAPE,MONIIN,
34 * MONIOU,MDEBUG,NUCNUC,
35 * CETAPE,
36 * SHOWNO,ISHW,NOPART,NRECS,NBLKS,MAXPRT,NDEBDL,
37 * N1STTR,MDBASE,
38 * DEBDEL,DEBUG,FDECAY,FEGS,FIRSTI,FIXINC,FIXTAR,
39 * FIX1I,FMUADD,FNKG,FPRINT,FDBASE
40 * ,GHEISH,GHESIG
41 COMMON /RUNPAC/ DSN,HOST,USER
42 DOUBLE PRECISION FIXHEI,THICK0,HILOECM,HILOELB
43 REAL STEPFC
44 INTEGER NRRUN,NSHOW,PATAPE,MONIIN,MONIOU,MDEBUG,NUCNUC,
45 * SHOWNO,ISHW,NOPART,NRECS,NBLKS,MAXPRT,NDEBDL,
46 * N1STTR,MDBASE
47 INTEGER CETAPE
48 CHARACTER*79 DSN
49 CHARACTER*20 HOST,USER
50
51 LOGICAL DEBDEL,DEBUG,FDECAY,FEGS,FIRSTI,FIXINC,FIXTAR,
52 * FIX1I,FMUADD,FNKG,FPRINT,FDBASE
53 * ,GHEISH,GHESIG
54*KEND.
55
56 DOUBLE PRECISION A,COST,COST0,COST1,CPHI,CPHI0,PHI,PHI0,PHI1,
57 * SINT,SINT0,SPHI,SPHI0,XXX,YYY,ZZZ
58C-----------------------------------------------------------------------
59
60CC IF ( DEBUG ) WRITE(MDEBUG,*) 'ADDANG:'
61
62 SINT0 = SQRT(1.D0-COST0**2)
63 SINT = SQRT(1.D0-COST **2)
64 SPHI0 = SIN(PHI0)
65 CPHI0 = COS(PHI0)
66 SPHI = SIN(PHI)
67 CPHI = COS(PHI)
68
69 A = COST0 * CPHI * SINT + COST * SINT0
70 XXX = A * CPHI0 - SPHI0 * SINT * SPHI
71 YYY = A * SPHI0 + CPHI0 * SINT * SPHI
72 ZZZ = COST * COST0 - SINT0 * SINT * CPHI
73
74C GET NEW COSINE(THETA) AND PHI
75 COST1 = ZZZ
76 IF ( YYY .EQ. 0.D0 .AND. XXX .EQ. 0.D0 ) THEN
77 PHI1 = 0.D0
78 ELSE
79 PHI1 = ATAN2( YYY, XXX )
80 ENDIF
81
82 RETURN
83 END
Note: See TracBrowser for help on using the repository browser.