source: trunk/MagicSoft/Simulation/Corsika/Mmcs/output.f@ 475

Last change on this file since 475 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: 8.2 KB
Line 
1 SUBROUTINE OUTPUT
2
3C-----------------------------------------------------------------------
4C (WRITE PARTICLE) OUTPUT
5C
6C WRITES 39 PARTICLE RECORDS PER PHYSICAL RECORD
7C TABULATES PARAMETERS OF ALL HIGH ENERGY PARTICLES WITH
8C LORENTZ FACTOR LARGER THAN ECTMAP
9C THIS SUBROUTINE IS CALLED FROM MAIN, BOX3, MUTRAC, AND AUSGAB
10C-----------------------------------------------------------------------
11
12 IMPLICIT NONE
13*KEEP,BUFFS.
14 COMMON /BUFFS/ RUNH,RUNE,EVTH,EVTE,DATAB,LH
15 INTEGER MAXBUF,MAXLEN
16 PARAMETER (MAXBUF=39*7)
17 PARAMETER (MAXLEN=12)
18 REAL RUNH(MAXBUF),EVTH(MAXBUF),EVTE(MAXBUF),
19 * RUNE(MAXBUF),DATAB(MAXBUF)
20 INTEGER LH
21 CHARACTER*4 CRUNH,CRUNE,CEVTH,CEVTE
22 EQUIVALENCE (RUNH(1),CRUNH), (RUNE(1),CRUNE)
23 EQUIVALENCE (EVTH(1),CEVTH), (EVTE(1),CEVTE)
24*KEEP,ETHMAP.
25 COMMON /ETHMAP/ ECTMAP,ELEFT
26 DOUBLE PRECISION ECTMAP,ELEFT
27*KEEP,MAGANG.
28 COMMON /MAGANG/ ARRANG,ARRANR,COSANG,SINANG
29 DOUBLE PRECISION ARRANG,ARRANR,COSANG,SINANG
30*KEEP,MULT.
31 COMMON /MULT/ EKINL,MSMM,MULTMA,MULTOT
32 DOUBLE PRECISION EKINL
33 INTEGER MSMM,MULTMA(37,13),MULTOT(37,13)
34*KEEP,MUPART.
35 COMMON /MUPART/ AMUPAR,BCUT,CMUON,FMUBRM,FMUORG
36 DOUBLE PRECISION AMUPAR(14),BCUT,CMUON(11)
37 LOGICAL FMUBRM,FMUORG
38*KEEP,NPARTI.
39 COMMON /NPARTI/ NPARTO,MUOND
40 DOUBLE PRECISION NPARTO(10,25),NPHOTO(10),NPOSIT(10),NELECT(10),
41 * NNU(10),NMUP(10),NMUM(10),NPI0(10),NPIP(10),
42 * NPIM(10),NK0L(10),NKPL(10),NKMI(10),NNEUTR(10),
43 * NPROTO(10),NPROTB(10),NK0S(10),NHYP(10),
44 * NNEUTB(10),NDEUT(10),NTRIT(10),NALPHA(10),
45 * NOTHER(10),MUOND
46 EQUIVALENCE (NPARTO(1, 1),NPHOTO(1)), (NPARTO(1, 2),NPOSIT(1)),
47 * (NPARTO(1, 3),NELECT(1)), (NPARTO(1, 4),NNU(1)) ,
48 * (NPARTO(1, 5),NMUP(1)) , (NPARTO(1, 6),NMUM(1)) ,
49 * (NPARTO(1, 7),NPI0(1)) , (NPARTO(1, 8),NPIP(1)) ,
50 * (NPARTO(1, 9),NPIM(1)) , (NPARTO(1,10),NK0L(1)) ,
51 * (NPARTO(1,11),NKPL(1)) , (NPARTO(1,12),NKMI(1)) ,
52 * (NPARTO(1,13),NNEUTR(1)), (NPARTO(1,14),NPROTO(1)),
53 * (NPARTO(1,15),NPROTB(1)), (NPARTO(1,16),NK0S(1)) ,
54 * (NPARTO(1,18),NHYP(1)) , (NPARTO(1,19),NDEUT(1)) ,
55 * (NPARTO(1,20),NTRIT(1)) , (NPARTO(1,21),NALPHA(1)),
56 * (NPARTO(1,22),NOTHER(1)), (NPARTO(1,25),NNEUTB(1))
57*KEEP,OBSPAR.
58 COMMON /OBSPAR/ OBSLEV,THCKOB,XOFF,YOFF,THETAP,PHIP,
59 * THETPR,PHIPR,NOBSLV
60 DOUBLE PRECISION OBSLEV(10),THCKOB(10),XOFF(10),YOFF(10),
61 * THETAP,THETPR(2),PHIP,PHIPR(2)
62 INTEGER NOBSLV
63*KEEP,PAM.
64 COMMON /PAM/ PAMA,SIGNUM
65 DOUBLE PRECISION PAMA(6000),SIGNUM(6000)
66*KEEP,PARPAR.
67 COMMON /PARPAR/ CURPAR,SECPAR,PRMPAR,OUTPAR,C,
68 * E00,E00PN,PTOT0,PTOT0N,THICKH,ITYPE,LEVL
69 DOUBLE PRECISION CURPAR(14),SECPAR(14),PRMPAR(14),OUTPAR(14),
70 * C(50),E00,E00PN,PTOT0,PTOT0N,THICKH
71 INTEGER ITYPE,LEVL
72*KEEP,PARPAE.
73 DOUBLE PRECISION GAMMA,COSTHE,PHI,H,T,X,Y,CHI,BETA,GCM,ECM
74 EQUIVALENCE (CURPAR(2),GAMMA), (CURPAR(3),COSTHE),
75 * (CURPAR(4), PHI ), (CURPAR(5), H ),
76 * (CURPAR(6), T ), (CURPAR(7), X ),
77 * (CURPAR(8), Y ), (CURPAR(9), CHI ),
78 * (CURPAR(10),BETA), (CURPAR(11),GCM ),
79 * (CURPAR(12),ECM )
80*KEEP,RUNPAR.
81 COMMON /RUNPAR/ FIXHEI,THICK0,HILOECM,HILOELB,
82 * STEPFC,NRRUN,NSHOW,PATAPE,MONIIN,
83 * MONIOU,MDEBUG,NUCNUC,
84 * CETAPE,
85 * SHOWNO,ISHW,NOPART,NRECS,NBLKS,MAXPRT,NDEBDL,
86 * N1STTR,MDBASE,
87 * DEBDEL,DEBUG,FDECAY,FEGS,FIRSTI,FIXINC,FIXTAR,
88 * FIX1I,FMUADD,FNKG,FPRINT,FDBASE
89 * ,GHEISH,GHESIG
90 COMMON /RUNPAC/ DSN,HOST,USER
91 DOUBLE PRECISION FIXHEI,THICK0,HILOECM,HILOELB
92 REAL STEPFC
93 INTEGER NRRUN,NSHOW,PATAPE,MONIIN,MONIOU,MDEBUG,NUCNUC,
94 * SHOWNO,ISHW,NOPART,NRECS,NBLKS,MAXPRT,NDEBDL,
95 * N1STTR,MDBASE
96 INTEGER CETAPE
97 CHARACTER*79 DSN
98 CHARACTER*20 HOST,USER
99
100 LOGICAL DEBDEL,DEBUG,FDECAY,FEGS,FIRSTI,FIXINC,FIXTAR,
101 * FIX1I,FMUADD,FNKG,FPRINT,FDBASE
102 * ,GHEISH,GHESIG
103*KEND.
104
105 DOUBLE PRECISION AUGM,ETOT,PTOT,STT,XADDMU,YADDMU
106 INTEGER I,IGG,III,NCOUNT
107 DATA NCOUNT /0/,AUGM/1.D0/
108C-----------------------------------------------------------------------
109
110 IF ( DEBUG ) WRITE(MDEBUG,444) (OUTPAR(I),I=1,9)
111 444 FORMAT(' OUTPUT: OUTPAR=',1P,9E10.3)
112
113C CORRECT X,Y COORDINATES FOR EACH LEVEL
114 OUTPAR(7) = OUTPAR(7) - XOFF(LEVL)
115 OUTPAR(8) = OUTPAR(8) - YOFF(LEVL)
116
117C PRINT OUT PARTICLE IF IT IS ABOVE THE CUT
118 IF ( FPRINT .OR. DEBUG ) THEN
119 IF ( OUTPAR(2) .GE. ECTMAP ) THEN
120 WRITE(MONIOU,3) (OUTPAR(I),I=1,10), ELEFT
121 3 FORMAT(' OUTPUT: ',1P,11E10.3)
122 IF (DEBDEL) THEN
123 NCOUNT = NCOUNT + 1
124 WRITE(MDEBUG,*)'OUTPUT: NCOUNT = ',NCOUNT
125 IF ( NCOUNT .GE. NDEBDL ) DEBUG = .TRUE.
126 ENDIF
127 ENDIF
128 ENDIF
129
130C COUNT PARTICLES, THAT ARE WRITTEN TO TAPE
131 NOPART = NOPART + 1
132C COUNT PARTICLES SPECIFIED BY THEIR PARTICLE CODE < 25
133 III = NINT(OUTPAR(1))
134 IF ( III .LT. 18 ) THEN
135 NPARTO(LEVL,III) = NPARTO(LEVL,III) + AUGM
136 ELSEIF ( (III .GE. 18 .AND. III .LE. 24) .OR.
137 * (III .GE. 26 .AND. III .LE. 32) ) THEN
138 NHYP(LEVL) = NHYP(LEVL) + AUGM
139 ELSEIF ( III .EQ. 201 ) THEN
140 NDEUT(LEVL) = NDEUT(LEVL) + AUGM
141 ELSEIF ( III .EQ. 301 ) THEN
142 NTRIT(LEVL) = NTRIT(LEVL) + AUGM
143 ELSEIF ( III .EQ. 402 ) THEN
144 NALPHA(LEVL) = NALPHA(LEVL) + AUGM
145 ELSEIF ( III .GT. 33 ) THEN
146 WRITE(MONIOU,*) 'OUTPUT: PARTICLE ON OBSLEV ',LEVL,' ID= ',III
147 NOTHER(LEVL) = NOTHER(LEVL) + AUGM
148 ELSE
149 NPARTO(LEVL,III) = NPARTO(LEVL,III) + AUGM
150 ENDIF
151
152C TREATE ADDITIONAL INFORMATION OF MUONS
153C THE COORDINATES OF MUON ORIGIN ARE STORED IN AMUPAR(.)
154 IF ( FMUADD .AND. (III .EQ. 5 .OR. III .EQ. 6) ) THEN
155 DATAB(LH+1) = (III + 70.) * 1000.
156 PTOT = PAMA(III) * SQRT( AMUPAR(2)**2 - 1.D0 )
157 STT = SQRT( 1.D0 - AMUPAR(3)**2 )
158 DATAB(LH+2) = PTOT * STT * COS( AMUPAR(4) + ARRANR )
159 DATAB(LH+3) = PTOT * STT * SIN( AMUPAR(4) + ARRANR )
160 DATAB(LH+4) = PTOT * AMUPAR(3)
161 XADDMU = AMUPAR(7) - XOFF(LEVL)
162 YADDMU = AMUPAR(8) - YOFF(LEVL)
163 DATAB(LH+5) = XADDMU * COSANG + YADDMU * SINANG
164 DATAB(LH+6) = YADDMU * COSANG - XADDMU * SINANG
165 DATAB(LH+7) = AMUPAR(5)
166 IF ( DEBUG ) WRITE(MDEBUG,445) (DATAB(LH+I),I=1,7)
167 445 FORMAT(' OUTPUT: MUADDI=',1P,8E10.3)
168 LH = LH + 7
169
170C WRITE A BLOCK OF 39 PARTICLES TO OUTPUT BUFFER AND CLEAR FIELD
171 IF ( LH .GE. MAXBUF ) THEN
172 CALL TOBUF( DATAB,0 )
173 DO 1 I = 1,MAXBUF
174 DATAB(I) = 0.
175 1 CONTINUE
176 LH = 0
177 ENDIF
178 ENDIF
179
180C COPY PARTICLE TO DATAB FIELD
181 IGG = MIN( OUTPAR(9), 99.D0 )
182 DATAB(LH+1) = III*1000 + IGG*10 + MOD(LEVL,10)
183 IF ( OUTPAR(1) .LE. 3.D0 ) THEN
184 ETOT = OUTPAR(2)
185 ELSE
186 ETOT = PAMA(III) * OUTPAR(2)
187 ENDIF
188 PTOT = SQRT( ETOT**2 - PAMA(III)**2 )
189 STT = SQRT( 1.D0 - OUTPAR(3)**2 )
190 DATAB(LH+2) = PTOT * STT * COS( OUTPAR(4) + ARRANR )
191 DATAB(LH+3) = PTOT * STT * SIN( OUTPAR(4) + ARRANR )
192 DATAB(LH+4) = PTOT * OUTPAR(3)
193 DATAB(LH+5) = OUTPAR(7) * COSANG + OUTPAR(8) * SINANG
194 DATAB(LH+6) = OUTPAR(8) * COSANG - OUTPAR(7) * SINANG
195 DATAB(LH+7) = OUTPAR(6) * 1.E9
196 LH = LH + 7
197
198C WRITE A BLOCK OF 39 PARTICLES TO OUTPUT BUFFER AND CLEAR FIELD
199 IF ( LH .GE. MAXBUF ) THEN
200 CALL TOBUF( DATAB,0 )
201 DO 2 I = 1,MAXBUF
202 DATAB(I) = 0.
203 2 CONTINUE
204 LH = 0
205 ENDIF
206
207 RETURN
208 END
Note: See TracBrowser for help on using the repository browser.