source: trunk/MagicSoft/Simulation/Corsika/Mmcs/fstack.f@ 8266

Last change on this file since 8266 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: 4.5 KB
Line 
1 SUBROUTINE FSTACK
2
3C-----------------------------------------------------------------------
4C F(ROM) STACK
5C
6C GETS PARTICLE FROM STACK AND READS FROM DISK IF NECESSARY
7C THIS SUBROUTINE IS CALLED FORM MAIN
8C-----------------------------------------------------------------------
9
10 IMPLICIT NONE
11*KEEP,BUFFS.
12 COMMON /BUFFS/ RUNH,RUNE,EVTH,EVTE,DATAB,LH
13 INTEGER MAXBUF,MAXLEN
14 PARAMETER (MAXBUF=39*7)
15 PARAMETER (MAXLEN=12)
16 REAL RUNH(MAXBUF),EVTH(MAXBUF),EVTE(MAXBUF),
17 * RUNE(MAXBUF),DATAB(MAXBUF)
18 INTEGER LH
19 CHARACTER*4 CRUNH,CRUNE,CEVTH,CEVTE
20 EQUIVALENCE (RUNH(1),CRUNH), (RUNE(1),CRUNE)
21 EQUIVALENCE (EVTH(1),CEVTH), (EVTE(1),CEVTE)
22*KEEP,ETHMAP.
23 COMMON /ETHMAP/ ECTMAP,ELEFT
24 DOUBLE PRECISION ECTMAP,ELEFT
25*KEEP,GENER.
26 COMMON /GENER/ GEN,ALEVEL
27 DOUBLE PRECISION GEN,ALEVEL
28*KEEP,IRET.
29 COMMON /IRET/ IRET1,IRET2
30 INTEGER IRET1,IRET2
31*KEEP,PAM.
32 COMMON /PAM/ PAMA,SIGNUM
33 DOUBLE PRECISION PAMA(6000),SIGNUM(6000)
34*KEEP,PARPAR.
35 COMMON /PARPAR/ CURPAR,SECPAR,PRMPAR,OUTPAR,C,
36 * E00,E00PN,PTOT0,PTOT0N,THICKH,ITYPE,LEVL
37 DOUBLE PRECISION CURPAR(14),SECPAR(14),PRMPAR(14),OUTPAR(14),
38 * C(50),E00,E00PN,PTOT0,PTOT0N,THICKH
39 INTEGER ITYPE,LEVL
40*KEEP,PARPAE.
41 DOUBLE PRECISION GAMMA,COSTHE,PHI,H,T,X,Y,CHI,BETA,GCM,ECM
42 EQUIVALENCE (CURPAR(2),GAMMA), (CURPAR(3),COSTHE),
43 * (CURPAR(4), PHI ), (CURPAR(5), H ),
44 * (CURPAR(6), T ), (CURPAR(7), X ),
45 * (CURPAR(8), Y ), (CURPAR(9), CHI ),
46 * (CURPAR(10),BETA), (CURPAR(11),GCM ),
47 * (CURPAR(12),ECM )
48*KEEP,POLAR.
49 COMMON /POLAR/ POLART,POLARF
50 DOUBLE PRECISION POLART,POLARF
51*KEEP,RUNPAR.
52 COMMON /RUNPAR/ FIXHEI,THICK0,HILOECM,HILOELB,
53 * STEPFC,NRRUN,NSHOW,PATAPE,MONIIN,
54 * MONIOU,MDEBUG,NUCNUC,
55 * CETAPE,
56 * SHOWNO,ISHW,NOPART,NRECS,NBLKS,MAXPRT,NDEBDL,
57 * N1STTR,MDBASE,
58 * DEBDEL,DEBUG,FDECAY,FEGS,FIRSTI,FIXINC,FIXTAR,
59 * FIX1I,FMUADD,FNKG,FPRINT,FDBASE
60 * ,GHEISH,GHESIG
61 COMMON /RUNPAC/ DSN,HOST,USER
62 DOUBLE PRECISION FIXHEI,THICK0,HILOECM,HILOELB
63 REAL STEPFC
64 INTEGER NRRUN,NSHOW,PATAPE,MONIIN,MONIOU,MDEBUG,NUCNUC,
65 * SHOWNO,ISHW,NOPART,NRECS,NBLKS,MAXPRT,NDEBDL,
66 * N1STTR,MDBASE
67 INTEGER CETAPE
68 CHARACTER*79 DSN
69 CHARACTER*20 HOST,USER
70
71 LOGICAL DEBDEL,DEBUG,FDECAY,FEGS,FIRSTI,FIXINC,FIXTAR,
72 * FIX1I,FMUADD,FNKG,FPRINT,FDBASE
73 * ,GHEISH,GHESIG
74*KEEP,STACKF.
75 COMMON /STACKF/ STACK,STACKP,EXST,NSHIFT,NOUREC,ICOUNT,NTO,NFROM
76 INTEGER MAXSTK
77 PARAMETER (MAXSTK = 12*340*2)
78 DOUBLE PRECISION STACK(MAXSTK)
79 INTEGER STACKP,EXST,NSHIFT,NOUREC,ICOUNT,NTO,NFROM
80*KEND.
81
82 INTEGER I,ISTK,J
83 DATA ISTK / MAXSTK /
84C-----------------------------------------------------------------------
85
86 IF ( DEBUG ) WRITE(MDEBUG,*) 'FSTACK:'
87
88C STACK EMPTY, SOMETHING TO BE READ FROM DISK ?
89 IF ( STACKP .EQ. 0 ) THEN
90 IF ( NOUREC .EQ. 0 ) THEN
91 IF ( FPRINT .OR. DEBUG ) WRITE(MONIOU,224) NTO,NFROM
92 224 FORMAT(/' NO MORE SECONDARIES FOUND ON STACK'/
93 * ' ',I10,' PARTICLES WRITTEN TO STACK'/
94 * ' ',I10,' PARTICLES READ FROM STACK' )
95 CURPAR(1) = 0.D0
96 IRET1 = 1
97 RETURN
98 ENDIF
99C READ LAST BLOCK OF 340 PARTICLES FROM DISK
100 READ(EXST,REC=NOUREC) (STACK(I),I=1,ISTK/2)
101 NOUREC = NOUREC - 1
102 STACKP = ISTK/2
103 ENDIF
104
105 NFROM = NFROM + 1
106 ICOUNT = ICOUNT - 1
107
108C PUT PARTICLE FROM STACK INTO CURPAR
109 STACKP = STACKP - MAXLEN
110 DO 5 J = 1,8
111 CURPAR(J) = STACK(STACKP+J)
112 5 CONTINUE
113 GEN = STACK(STACKP+ 9)
114 ALEVEL = STACK(STACKP+10)
115 POLART = STACK(STACKP+11)
116 POLARF = STACK(STACKP+12)
117 IF ( PAMA(NINT(CURPAR(1))) .NE. 0.D0 ) THEN
118 ELEFT = ELEFT - CURPAR(2)*PAMA(NINT(CURPAR(1)))
119 ELSE
120 ELEFT = ELEFT - CURPAR(2)
121 ENDIF
122
123 IF ( DEBUG ) WRITE(MDEBUG,667) ICOUNT,(CURPAR(J),J=1,8)
124 667 FORMAT('+ ',I7,1X,1P,9E10.3)
125
126 RETURN
127 END
Note: See TracBrowser for help on using the repository browser.