3
c Example program for mcfio. Simple case. Read the file produced by t1
7
integer ostr_all, ostr_sel, istr_old, nopen, length
9
character *255 filename
13
parameter (MAX_NUMNTUPLE = 10)
14
integer numblocks, numNTuples, blkids(MAX_NUMNTUPLE)
15
integer i, j, numevts_real, ntu22, ntu23, nn,ll
16
integer xdr_stdhep_multi
17
external xdr_stdhep_multi
22
c Initialization phase.
25
call mcfio_SetForSaveDecoding(.False.)
26
c call mcfio_PrintDictionary()
28
c istr_old = mcfio_OpenReadDirect('testN1_l.dat')
29
istr_old = mcfio_OpenReadMapped('testN1_l.dat')
30
c filename = '/home/focus/scr1/pltmp/mcfio_mcfio/testN1_l.dat'
31
c istr_old = mcfio_OpenReadDirect(filename)
32
call mcfio_InfoStreamChar(
33
& istr_old, MCFIO_CREATIONDATE, answer, length)
34
print *, ' Creation Date ', answer(1:length)
36
call mcfio_InfoStreamInt(istr_old, MCFIO_NUMEVTS, inum)
37
print *,' Number of events ', inum
40
c Look for the Ntuple content from the file header.
42
call mcfio_InfoStreamInt(istr_old, MCFIO_NUMNTUPLES, numNTuples)
43
print *, ' Number of Ntuples for this stream ', numNTuples
45
c Inquire about identifier list for the stream.
47
if (numNTuples .gt. MAX_NUMNTUPLE) then
48
print *, ' Too many NTuple on this stream, gave up'
51
nn = mcfio_GetNTupleIds(istr_old, blkids, MAX_NUMNTUPLE)
52
if (nn .gt. MAX_NUMNTUPLE) then
53
print *, ' Too many NTuple on this stream, gave up'
57
c We are interested only in the structure with the uid 22
62
print *, ' Ntuple Sequential number ',i
63
ll = mcfio_GetNtupleCategory(blkids(i), answer)
64
print *, ' Category ', answer(1:ll)
65
ll = mcfio_GetNtupleTitle(blkids(i), answer)
66
print *, ' Title ', answer(1:ll)
67
ll = mcfio_GetNtupleName(blkids(i), answer)
68
print *, ' Template Name ', answer(1:ll)
69
if (mcfio_GetNTupleUID(blkids(i)) .eq. 22) ntu22 = blkids(i)
70
if (mcfio_GetNTupleUID(blkids(i)) .eq. 23) ntu23 = blkids(i)
73
If (ntu22 .eq. -1) then
74
print *, ' Can not find Ntuple number 22 '
77
do i = 1, numevts_real
78
if (mcfio_NextEvent(istr_old) .ne. MCFIO_RUNNING) then
79
print *,' Error reading next event '
80
call mcfio_InfoStreamInt(istr_old, MCFIO_STATUS, inum)
81
if (inum .eq. MCFIO_EOF ) then
82
print *, ' Reached EOF, Close and Stop '
83
call mcfio_Close(istr_old)
86
print *, ' Unrecognized Status, stat = ', inum
90
if (mcfio_NTupleMult(istr_old, ntu22, glob_c.version)
92
print *, 'Problem decoding Multiplicty from Ntuple glob22'
95
if (glob_c.nglob .gt. 5) then
96
if (mcfio_NTupleSubStruct(istr_old, ntu22,
99
print *, 'Problem decoding SubVariable from Ntuple glob22'
102
if (ifix(glob_c.glob_var(5).v7_now2).ne.(i*10 +5))
103
& print *, ' v7_now2 is wrong '
106
c if (mcfio_NTuple(istr_old, ntu22, glob_c.version)
108
c print *, 'Problem decoding Multiplicty from Ntuple glob22'
111
c call check_glob22(i)
112
c if (mcfio_NTuple(istr_old, ntu23, version_glo23)
114
c print *, 'Problem decoding Multiplicty from Ntuple glob23'
119
call mcfio_close(istr_old)
122
subroutine check_glob22(ievt)
125
#include "glob22.inc"
127
if (ievt .eq. 1) print *, ' Version ', glob_c.version
128
print *, ' --- Dump for evt ', ievt
129
print *, ' Nglob ', glob_c.nglob
130
print *, ' MissingEt, Something ',
131
& glob_c.Missinget, glob_c.something
132
do i = 1,glob_c.nglob
133
if (ifix(glob_c.glob_var(i).v7_now2) .ne. (ievt*10 +i))
134
& print *,'v7_now is wrong'
135
if (glob_c.glob_var(i).v7_now_last .ne. i*1.d0)
136
& print *,'v7_now_last is wrong'