source: trunk/MagicSoft/Simulation/Corsika/Mmcs/tstout.f@ 1830

Last change on this file since 1830 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: 5.0 KB
Line 
1 SUBROUTINE TSTOUT
2
3C-----------------------------------------------------------------------
4C T(O) ST(ACK) OUT
5C
6C MAKE REAL OUTPUT AFTER ONE INTERACTION HAS FINISHED
7C ADDS PARTICLE TO STACK AND WRITES IT TO DISK IF NECESSARY
8C THIS SUBROUTINE IS CALLED FORM MPPROP, PIGEN1, PIGEN2, AND TSTEND
9C-----------------------------------------------------------------------
10
11 IMPLICIT NONE
12*KEEP,BUFFS.
13 COMMON /BUFFS/ RUNH,RUNE,EVTH,EVTE,DATAB,LH
14 INTEGER MAXBUF,MAXLEN
15 PARAMETER (MAXBUF=39*7)
16 PARAMETER (MAXLEN=12)
17 REAL RUNH(MAXBUF),EVTH(MAXBUF),EVTE(MAXBUF),
18 * RUNE(MAXBUF),DATAB(MAXBUF)
19 INTEGER LH
20 CHARACTER*4 CRUNH,CRUNE,CEVTH,CEVTE
21 EQUIVALENCE (RUNH(1),CRUNH), (RUNE(1),CRUNE)
22 EQUIVALENCE (EVTH(1),CEVTH), (EVTE(1),CEVTE)
23*KEEP,ELABCT.
24 COMMON /ELABCT/ ELCUT
25 DOUBLE PRECISION ELCUT(4)
26*KEEP,ETHMAP.
27 COMMON /ETHMAP/ ECTMAP,ELEFT
28 DOUBLE PRECISION ECTMAP,ELEFT
29*KEEP,MUPART.
30 COMMON /MUPART/ AMUPAR,BCUT,CMUON,FMUBRM,FMUORG
31 DOUBLE PRECISION AMUPAR(14),BCUT,CMUON(11)
32 LOGICAL FMUBRM,FMUORG
33*KEEP,PAM.
34 COMMON /PAM/ PAMA,SIGNUM
35 DOUBLE PRECISION PAMA(6000),SIGNUM(6000)
36*KEEP,PARPAR.
37 COMMON /PARPAR/ CURPAR,SECPAR,PRMPAR,OUTPAR,C,
38 * E00,E00PN,PTOT0,PTOT0N,THICKH,ITYPE,LEVL
39 DOUBLE PRECISION CURPAR(14),SECPAR(14),PRMPAR(14),OUTPAR(14),
40 * C(50),E00,E00PN,PTOT0,PTOT0N,THICKH
41 INTEGER ITYPE,LEVL
42*KEEP,PARPAE.
43 DOUBLE PRECISION GAMMA,COSTHE,PHI,H,T,X,Y,CHI,BETA,GCM,ECM
44 EQUIVALENCE (CURPAR(2),GAMMA), (CURPAR(3),COSTHE),
45 * (CURPAR(4), PHI ), (CURPAR(5), H ),
46 * (CURPAR(6), T ), (CURPAR(7), X ),
47 * (CURPAR(8), Y ), (CURPAR(9), CHI ),
48 * (CURPAR(10),BETA), (CURPAR(11),GCM ),
49 * (CURPAR(12),ECM )
50*KEEP,RUNPAR.
51 COMMON /RUNPAR/ FIXHEI,THICK0,HILOECM,HILOELB,
52 * STEPFC,NRRUN,NSHOW,PATAPE,MONIIN,
53 * MONIOU,MDEBUG,NUCNUC,
54 * CETAPE,
55 * SHOWNO,ISHW,NOPART,NRECS,NBLKS,MAXPRT,NDEBDL,
56 * N1STTR,MDBASE,
57 * DEBDEL,DEBUG,FDECAY,FEGS,FIRSTI,FIXINC,FIXTAR,
58 * FIX1I,FMUADD,FNKG,FPRINT,FDBASE
59 * ,GHEISH,GHESIG
60 COMMON /RUNPAC/ DSN,HOST,USER
61 DOUBLE PRECISION FIXHEI,THICK0,HILOECM,HILOELB
62 REAL STEPFC
63 INTEGER NRRUN,NSHOW,PATAPE,MONIIN,MONIOU,MDEBUG,NUCNUC,
64 * SHOWNO,ISHW,NOPART,NRECS,NBLKS,MAXPRT,NDEBDL,
65 * N1STTR,MDBASE
66 INTEGER CETAPE
67 CHARACTER*79 DSN
68 CHARACTER*20 HOST,USER
69
70 LOGICAL DEBDEL,DEBUG,FDECAY,FEGS,FIRSTI,FIXINC,FIXTAR,
71 * FIX1I,FMUADD,FNKG,FPRINT,FDBASE
72 * ,GHEISH,GHESIG
73*KEEP,STACKF.
74 COMMON /STACKF/ STACK,STACKP,EXST,NSHIFT,NOUREC,ICOUNT,NTO,NFROM
75 INTEGER MAXSTK
76 PARAMETER (MAXSTK = 12*340*2)
77 DOUBLE PRECISION STACK(MAXSTK)
78 INTEGER STACKP,EXST,NSHIFT,NOUREC,ICOUNT,NTO,NFROM
79*KEND.
80
81 DOUBLE PRECISION GLCUT
82 INTEGER I,ISTK,J
83 DATA ISTK / MAXSTK /
84C-----------------------------------------------------------------------
85
86 IF ( DEBUG ) WRITE(MDEBUG,666) ICOUNT,(SECPAR(J),J=1,9)
87 666 FORMAT(' TSTOUT:',I7,1X,1P,9E10.3)
88
89C CALCULATE APPROPRIATE KINETIC ENERGY CUT AND APPLY IT
90 IF ( SECPAR(1) .EQ. 5.D0 .OR. SECPAR(1) .EQ. 6.D0 ) THEN
91C MUONS
92 GLCUT = ELCUT(2) / PAMA(NINT(SECPAR(1))) + 1.D0
93 ELSEIF ( SECPAR(1) .EQ. 2.D0 .OR. SECPAR(1) .EQ. 3.D0 ) THEN
94C ELECTRONS
95 GLCUT = ELCUT(3) / PAMA(NINT(SECPAR(1))) + 1.D0
96 ELSEIF ( SECPAR(1) .EQ. 1.D0 ) THEN
97C GAMMAS
98 GLCUT = ELCUT(4)
99 ELSEIF (SECPAR(1) .GE. 100.D0 ) THEN
100C NUCLEI, CUTTED IF ENERGY/NUCLEON BELOW CUT
101 GLCUT = ELCUT(1) * INT(SECPAR(1)/100 )
102 * / PAMA(NINT(SECPAR(1))) + 1.D0
103 ELSE
104C HADRONS
105 GLCUT = ELCUT(1) / PAMA(NINT(SECPAR(1))) + 1.D0
106 ENDIF
107 IF ( SECPAR(2) .LT. GLCUT ) THEN
108 IF ( SECPAR(1).EQ.5.D0 .OR. SECPAR(1).EQ.6.D0 ) FMUORG = .FALSE.
109 IF (DEBUG) WRITE(MDEBUG,*) 'TSTOUT: PARTICLE BELOW ',
110 * 'ENERGY CUT'
111 RETURN
112 ENDIF
113
114 IF ( STACKP .GE. ISTK ) THEN
115 WRITE(EXST,REC=NOUREC+1) (STACK(I),I= 1,ISTK/2)
116 WRITE(EXST,REC=NOUREC+2) (STACK(I),I=ISTK/2+1,ISTK )
117 NOUREC = NOUREC + 2
118 NSHIFT = NSHIFT + 2
119 STACKP = 0
120 ENDIF
121
122 NTO = NTO + 1
123 ICOUNT = ICOUNT + 1
124
125 DO 2 J = 1,MAXLEN
126 STACK(STACKP+J) = SECPAR(J)
127 2 CONTINUE
128 STACKP = STACKP + MAXLEN
129 IF ( SECPAR(1) .LE. 1.D0 ) THEN
130 ELEFT = ELEFT + SECPAR(2)
131 ELSE
132 ELEFT = ELEFT + SECPAR(2) * PAMA(NINT(SECPAR(1)))
133 ENDIF
134
135 RETURN
136 END
Note: See TracBrowser for help on using the repository browser.