COSMOS v7.655  COSMOSv7655
(AirShowerMC)
procLat0.f
Go to the documentation of this file.
1 !
2 ! read binary or ascii lateral histogram file and
3 ! analyse it
4 ! usage:
5 ! compile: make -f procLat.mk
6 ! see message by procLat
7 
8  implicit none
9  integer binorascii, reduced, nfraca
10  integer count, status
11  character*80 buf
12 ! get filename from command line argument
13  count = nargs()
14 
15  if(count .ne. 3) then
16  write(0,*) " ProcLat: ./procLat$ARCH",
17  * " bin input-r.hist"
18  write(0,*) " bin=1-->input is ascii file"
19  write(0,*) " bin=2--> binary file"
20  write(0,*)
21  * " filename: path to the input -r.hist file(<256 chars)"
22  stop 132
23  endif
24  call getarg(1, buf, status)
25  read(buf,*) binorascii
26  if(binorascii .ne. 1 .and. binorascii.ne. 2) then
27  write(0,*) ' error input to binOrascii=',binorascii
28  stop 444
29  endif
30 
31  if(binorascii .eq. 1) then
32 ! ascii file
33  call proclatascii
34  else
35 ! bin file
36  call proclatbin
37  endif
38  end
39 
40  subroutine proclatbin
41  implicit none
42 #include "../ZprivateSub.h"
43 #include "../../../Hist/Z90histc.h"
44 #include "../../../Hist/Z90histo.h"
45 #include "../../../Hist/Z90hist1.h"
46  character*80 buf
47  type(histogram1) h10 ! 1D histogram area
48 
49  character*6 histid0 ! get histogram id here
50  integer icon
51  real normf
52  data normf/-1.0/ ! use normalization as already done
53  integer ansites
54  data ansites/1/ ! number of layers where histogram was taken
55  integer fnoT/31/ ! file number.
56  character*256 filename
57 
58  integer ir, ifai
59  integer code
60  integer nbinhisto, status
61  integer kwhistReadAscii
62  integer i
63  integer klena
64  external klena
65  save
66 
67  call getarg(2, filename, status)
68 ! write(0,*) ' status=',status
69 ! write(0,*) 'file=',filename(1:klena(filename))
70 
71  open(fnot, file=filename,
72  * iostat=status, access='sequential',
73  * form='unformatted', action='read')
74  if(status .ne. 0 ) then
75  write(0,*) ' cannot open file ='
76  write(0,*) filename
77  stop 123
78  else
79 ! write(0,*) filename(1:klena(filename)),
80 ! * ' opened'
81  endif
82 
83 ! web sector region
84  do i = 1, ansites
85  do code = 1, 4
86  do ifai= 1, nfai
87  read( fnot, end=100 ) histid0
88  if( histid0 .ne. '#hist1' ) then
89  write(0,*) ' histogram is not 1-D: ',histid0
90  stop 111
91  endif
92  call kwhistr(h10, fnot, icon)
93 ! statistical calculation
94  call kwhists(h10, normf)
95 ! lat analysis
96  call proclat(h10, ifai, code, i)
97 ! deallocate
98  call kwhistd( h10 )
99  enddo
100  enddo
101  enddo
102  close(fnot)
103  return
104  100 continue
105  write(0,*) ' unexpected EOF '
106  stop 2345
107 ! **********************
108  entry proclatascii
109 ! **********************
110  call getarg(2, filename, status)
111 ! write(0,*) ' status=',status
112 ! write(0,*) 'file=',filename(1:klena(filename))
113 
114  open(fnot, file=filename,
115  * iostat=status, access='sequential',
116  * form='formatted', action='read')
117  if(status .ne. 0 ) then
118  write(0,*) ' cannot open file ='
119  write(0,*) filename
120  stop 222
121  else
122 ! write(0,*) filename(1:klena(filename)),
123 ! * ' opened '
124  endif
125 
126 
127  do i = 1, ansites
128  do code = 1, 4
129  do ifai= 1, nfai
130  nbinhisto=kwhistreadascii(h10, fnot)
131  if(nbinhisto .le. 0 ) then
132  write(0,*) ' ascii read failed'
133  stop 333
134  else
135 ! write(0,*) ' hist data =',nbinhisto
136  endif
137 ! call kwhistr(h10, fnoT, icon)
138 ! statistical calculation
139  call kwhists(h10, normf)
140 ! lat analysis
141  call proclat(h10, ifai, code, i)
142 ! deallocate
143  call kwhistd( h10 )
144  enddo
145  enddo
146  enddo
147  close(fnot)
148  end
void kwhistd(struct histogram1 *h)
subroutine proclat(h, idxf, code, layer)
Definition: procLat.f:4
subroutine proclatbin
Definition: procLat0.f:41
void kwhistr(struct histogram1 *h, FILE *bfnor, int icon)
void kwhists(struct histogram1 *h, float inorm)
! timing nfai
Definition: Zprivate2.h:12