source: trunk/MagicSoft/Simulation/Corsika/Mmcs/tobuf.f@ 7217

Last change on this file since 7217 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.4 KB
Line 
1 SUBROUTINE TOBUF( A,IFL )
2
3C-----------------------------------------------------------------------
4C (WRITE) TO BUF(FER)
5C
6C WRITES UP TO NSUBBL DATA BLOCKS TO OUTPUT BUFFER AND PUTS THE FULL
7C BUFFER TO TAPE
8C THIS SUBROUTINE IS CALLED FROM MAIN, ELECTR, PHOTON, INPRM, OUTEND,
9C OUTPUT, OUTPT2, AND PHOTON
10C ARGUMENTS:
11C A = ARRAY TO BE WRITTEN TO TAPE
12C IFL = STARTING OF FINAL OUTPUT
13C = 0 NORMAL BLOCK
14C = 1 NORMAL BLOCK WITH END OF OUTPUT
15C = 2 ONLY END OF OUTPUT
16C-----------------------------------------------------------------------
17
18 IMPLICIT NONE
19*KEEP,BUFFS.
20 COMMON /BUFFS/ RUNH,RUNE,EVTH,EVTE,DATAB,LH
21 INTEGER MAXBUF,MAXLEN
22 PARAMETER (MAXBUF=39*7)
23 PARAMETER (MAXLEN=12)
24 REAL RUNH(MAXBUF),EVTH(MAXBUF),EVTE(MAXBUF),
25 * RUNE(MAXBUF),DATAB(MAXBUF)
26 INTEGER LH
27 CHARACTER*4 CRUNH,CRUNE,CEVTH,CEVTE
28 EQUIVALENCE (RUNH(1),CRUNH), (RUNE(1),CRUNE)
29 EQUIVALENCE (EVTH(1),CEVTH), (EVTE(1),CEVTE)
30*KEEP,RECORD.
31 COMMON /RECORD/ IRECOR
32 INTEGER IRECOR
33*KEEP,RUNPAR.
34 COMMON /RUNPAR/ FIXHEI,THICK0,HILOECM,HILOELB,
35 * STEPFC,NRRUN,NSHOW,PATAPE,MONIIN,
36 * MONIOU,MDEBUG,NUCNUC,
37 * CETAPE,
38 * SHOWNO,ISHW,NOPART,NRECS,NBLKS,MAXPRT,NDEBDL,
39 * N1STTR,MDBASE,
40 * DEBDEL,DEBUG,FDECAY,FEGS,FIRSTI,FIXINC,FIXTAR,
41 * FIX1I,FMUADD,FNKG,FPRINT,FDBASE
42 * ,GHEISH,GHESIG
43 COMMON /RUNPAC/ DSN,HOST,USER
44 DOUBLE PRECISION FIXHEI,THICK0,HILOECM,HILOELB
45 REAL STEPFC
46 INTEGER NRRUN,NSHOW,PATAPE,MONIIN,MONIOU,MDEBUG,NUCNUC,
47 * SHOWNO,ISHW,NOPART,NRECS,NBLKS,MAXPRT,NDEBDL,
48 * N1STTR,MDBASE
49 INTEGER CETAPE
50 CHARACTER*79 DSN
51 CHARACTER*20 HOST,USER
52
53 LOGICAL DEBDEL,DEBUG,FDECAY,FEGS,FIRSTI,FIXINC,FIXTAR,
54 * FIX1I,FMUADD,FNKG,FPRINT,FDBASE
55 * ,GHEISH,GHESIG
56*KEND.
57
58 INTEGER NSUBBL
59 PARAMETER (NSUBBL=21)
60 REAL A(*)
61C NSUBBL IS NUMBER OF SUBBLOCKS IN ONE OUTPUT RECORD
62C (OUTPUT RECORD LENGTH = NSUBBL * 39 * 7 * 4 BYTES <= 22932 )
63C IBLK IS COUNTER FOR SUBBLOCKS
64C OUTPUT BUFFER FOR PARTICLE OUTPUT
65 REAL OUTBUF(MAXBUF,NSUBBL)
66 INTEGER I,IBLK,IFL,K
67 SAVE OUTBUF
68 DATA IBLK / 0 /
69C-----------------------------------------------------------------------
70
71 IF ( DEBUG ) WRITE(MDEBUG,*) 'TOBUF : IFL =',IFL
72
73
74C COPY TO BUFFER
75 IF ( IFL .LE. 1 ) THEN
76 IBLK = IBLK + 1
77 DO 1 I = 1,MAXBUF
78 OUTBUF(I,IBLK) = A(I)
79 1 CONTINUE
80 ENDIF
81
82C WRITE TO TAPE IF BLOCK IS FULL OR IF IFL IS 1
83 IF ( IFL .GE. 1 .OR. IBLK .EQ. NSUBBL ) THEN
84 NRECS = NRECS + 1
85 NBLKS = NBLKS + IBLK
86c>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
87c WRITE(PATAPE) ((OUTBUF(I,K),I=1,MAXBUF),K=1,NSUBBL)
88 call jcdatsave(outbuf)
89c>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
90 IRECOR = IRECOR + MAXBUF * NSUBBL
91 IBLK = 0
92 DO 2 K = 1,NSUBBL
93 DO 2 I = 1,MAXBUF
94 OUTBUF(I,K) = 0.0
95 2 CONTINUE
96 ENDIF
97
98 RETURN
99 END
Note: See TracBrowser for help on using the repository browser.