1
subroutine stdxrd(ilbl,istream,lok)
3
C...Purpose: to read a buffer or an event from the standard common block.
7
C ilbl = 1 - standard HEPEVT common block
8
C ilbl = 2 - standard HEPEVT common block and HEPEV2
9
C ilbl = 3 - stdevent struct
10
C ilbl = 4 - standard HEPEVT common block with Les Houches
11
C ilbl = 5 - standard HEPEVT common block with Les Houches
12
C and multiple collisions
13
C ilbl = 11 - HEPEUP common block
14
C ilbl = 12 - HEPRUP common block
15
C ilbl = 100 - STDHEP begin run record
16
C ilbl = 200 - STDHEP end run record
18
C lok = 0 if no problems were encountered
26
integer ilbl,lok,istream
28
integer xdr_stdhep, xdr_stdhep_multi, xdr_stdhep_cm1
29
external xdr_stdhep, xdr_stdhep_multi, xdr_stdhep_cm1
30
integer xdr_stdhep_cxx, xdr_stdhep_4, xdr_stdhep_4_multi
31
external xdr_stdhep_cxx, xdr_stdhep_4, xdr_stdhep_4_multi
32
integer xdr_hepeup, xdr_heprup
33
external xdr_hepeup, xdr_heprup
39
C...print version number if this is the first call
48
c...get the next xdr event
49
if(mcfio_NextEvent(istream) .ne. MCFIO_RUNNING)then
50
call mcfio_InfoStreamInt(istream,MCFIO_STATUS,istat)
51
if(istat .eq. MCFIO_EOF) go to 800
52
if(istat .eq. MCFIO_RUNNING) go to 700
55
c...what blocks are in this event?
56
call mcfio_InfoEventInt(istream,MCFIO_NUMBLOCKS,numblocks)
57
call mcfio_InfoEventInt(istream,MCFIO_BLOCKIDS,blkids)
59
if(blkids(i).eq.MCFIO_STDHEP)then
60
c...zero stdhep common
62
c...fill stdhep common
63
if(mcfio_block(istream,MCFIO_STDHEP,xdr_stdhep) .eq. -1)
66
call stdtcopy(2,istream,lok)
67
if(lok.eq.0) nstdrd = nstdrd + 1
68
elseif(blkids(i).eq.MCFIO_STDHEPM)then
69
c...zero stdhep common
71
c...fill stdhep common
72
if(mcfio_block(istream,MCFIO_STDHEPM,xdr_stdhep_multi)
76
elseif(blkids(i).eq.MCFIO_STDHEP4)then
77
c...zero stdhep common
79
c...fill stdhep common
80
if(mcfio_block(istream,MCFIO_STDHEP4,xdr_stdhep_4) .eq. -1)
83
call stdtcopy(2,istream,lok)
84
if(lok.eq.0) nstdrd = nstdrd + 1
85
elseif(blkids(i).eq.MCFIO_STDHEP4M)then
86
c...zero stdhep common
88
c...fill stdhep common
89
if(mcfio_block(istream,MCFIO_STDHEP4M,xdr_stdhep_4_multi)
93
elseif(blkids(i).eq.MCFIO_STDHEPCXX)then
94
c...zero stdhep common
96
c...fill stdevent struct
97
c if(mcfio_block(istream,MCFIO_STDHEPCXX,xdr_stdhep_cxx)
98
c 1 .eq. -1) go to 700
101
c...fix stdhep common from stdevent
103
c nstdrd = nstdrd + 1
104
elseif(blkids(i).eq.MCFIO_HEPEUP)then
105
c...Les Houches event - fill hepeup common
106
if(mcfio_block(istream,MCFIO_HEPEUP,xdr_hepeup)
110
elseif(blkids(i).eq.MCFIO_HEPRUP)then
111
c...Les Houches event - fill heprup common
112
if(mcfio_block(istream,MCFIO_HEPRUP,xdr_heprup)
116
elseif(blkids(i).eq.MCFIO_STDHEPBEG)then
117
c...begin run event - fill stdcm1 common
118
if(mcfio_block(istream,MCFIO_STDHEPBEG,xdr_stdhep_cm1)
121
elseif(blkids(i).eq.MCFIO_STDHEPEND)then
122
c...end run event - fill stdcm1 common
123
if(mcfio_block(istream,MCFIO_STDHEPEND,xdr_stdhep_cm1)
130
700 write (lnhout,701)
133
800 write (lnhout,801)
136
900 write (lnhout,901)
139
701 format(/5X,'STDXRD: unable to read xdr block')
140
703 format(/5X,'STDXRD: stdevent struct cannot be processed')
141
801 format(/5X,'STDXRD: end of file found')
142
901 format(/5X,'STDXRD: unrecognized status - stop')