COSMOS v7.655  COSMOSv7655
(AirShowerMC)
procTime0.f
Go to the documentation of this file.
1 !
2 ! read binary or ascii time histogram file and
3 ! analyse it
4 ! usage:
5 ! compile: make -f procTime.mk
6 ! see message by procTime
7 
8  implicit none
9 #include "ZprivateSub.h"
10  integer binorascii, reduced, nfraca
11  integer count, status
12  character*80 buf
13 ! get filename from command line argument
14  count = nargs()
15 
16  if(count .ne. 7) then
17  write(0,*) " ProcTime: ./procTime$ARCH",
18  * " bin reduced nfraca webonly smooth input-t.hist"
19  write(0,*) " bin=1-->input is ascii file"
20  write(0,*) " bin=2--> binary file"
21  write(0,*) " reduced=0--> histogram has non-reduced time"
22  write(0,*) " =1--> histogram has reduced time"
23  write(0,*) " if data seems not so, stop is made"
24  write(0,*) " actual number of time fraction data to be used"
25  write(0,*) " nfraca=2-->up to T5, T10% is obtained "
26  write(0,*)
27  * " nfraca=11-->up to T5,T10,...T90, T95% is obtained "
28  write(0,*) " fitting is normally done by T10% so 2 is enough"
29 
30  write(0,*)
31  * "webonly=0-->input is made from mkLDD"
32  * " (core region data exists) "
33  write(0,*)
34  * "webonly=1-->input is made from FDD rawdata"
35  * "(no core region data) "
36  write(0,*) " smooth >0 max # of smoothing"
37  write(0,*) " for LDD 100~500 may be ok"
38  write(0,*) " for FDD 3 may be ok"
39  write(0,*) " ***** avoid smooth=0**** "
40  write(0,*)
41  * " filename: path to the input -t.hist file(<256 chars)"
42  stop 132
43  endif
44  call getarg(1, buf, status)
45  read(buf,*) binorascii
46  if(binorascii .ne. 1 .and. binorascii.ne. 2) then
47  write(0,*) ' error input to binOrascii=',binorascii
48  stop 444
49  endif
50  call getarg(2, buf, status)
51  read(buf,*) reduced
52  if(reduced .ne. 0 .and. reduced .ne. 1) then
53  write(0,*) 'procTime: error input to reduced=',reduced
54  stop 444
55  endif
56 
57  call getarg(3, buf, status)
58  read(buf,*) nfraca
59  if(nfraca .lt. 1 .and. nfraca .gt. 11) then
60  write(0,*) 'procTime: error input to nfraca=',nfraca
61  stop 444
62  endif
63 
64 ! (defined in Zprivatesub) stdout
65  if(binorascii .eq. 1) then
66 ! ascii file
67  call proctimeascii(reduced, nfraca)
68  else
69 ! bin file
70  call proctimebin(reduced, nfraca)
71  endif
72  end
73 
74  subroutine proctimebin(reduced, nfraca)
75  implicit none
76 #include "ZprivateSub.h"
77 #include "../../Hist/Z90histc.h"
78 #include "../../Hist/Z90histo.h"
79 #include "../../Hist/Z90hist1.h"
80  character*80 buf
81  integer reduced ! 0-->time is not reduced time
82  ! 1--> reduced time
83  integer nfraca ! 2 --> T10% is used. (1~11)
84  type(histogram1) h10 ! 1D histogram area
85 
86  character*6 histid0 ! get histogram id here
87  integer icon
88  real normf
89  data normf/-1.0/ ! use normalization as already done
90  integer ansites
91  data ansites/1/ ! number of layers where histogram was taken
92  integer fnoT/31/ ! file number.
93  character*256 filename
94 
95  integer ir, ifai
96  integer code
97  integer nbinhisto, status, webonly
98  integer kwhistReadAscii
99  integer i
100 ! now mode must be always 2
101 
102  call getarg(4, buf, status)
103  read(buf, *) webonly
104  call getarg(5, buf, status)
105  read(buf, *) smooth
106  call getarg(6, filename, status)
107 ! write(0,*) status, filename
108 
109  open(fnot, file=filename,
110  * iostat=status, access='sequential',
111  * form='unformatted', action='read')
112  if(status .ne. 0 ) then
113  write(0,*) ' cannot open file ='
114  write(0,*) filename
115  stop
116  endif
117 
118 ! skip time data for core region
119  if(webonly .eq. 0) then
120  do i = 1, ansites
121  do code = 1, 4
122  read( fnot, end=100 ) histid0
123  if( histid0 .ne. '#hist1' ) then
124  write(0,*) ' histogram is not 1D: ',histid0
125  stop
126  endif
127  call kwhistr(h10, fnot, icon)
128  call kwhists(h10, normf)
129 ! deallocate
130  call kwhistd( h10 )
131  enddo
132  enddo
133  endif
134 ! web sector region
135  do i = 1, ansites
136  do code = 1, 4
137  do ifai= 1, nfai
138  do ir= 1, nrbin
139  read( fnot, end=100 ) histid0
140  if( histid0 .ne. '#hist1' ) then
141  write(0,*) ' histogram is not 1-D: ',histid0
142  stop
143  endif
144  call kwhistr(h10, fnot, icon)
145 ! statistical calculation
146  call kwhists(h10, normf)
147 ! time analysis: 6 is for stdout output
148  call proctime(h10, 6, nfraca, reduced,
149  * ir, ifai, code, i)
150 ! deallocate
151  call kwhistd( h10 )
152  enddo
153  enddo
154  enddo
155  enddo
156  close(fnot)
157  return
158  100 continue
159  write(0,*) ' unexpected EOF '
160  stop 2345
161 ! **********************
162  entry proctimeascii(reduced, nfraca)
163 ! **********************
164  call getarg(4, buf, status)
165  read(buf, *) webonly
166  call getarg(5, buf, status)
167  read(buf, *) smooth
168  call getarg(6, filename, status)
169 ! write(0,*) status, filename
170 
171  open(fnot, file=filename,
172  * iostat=status, access='sequential',
173  * form='formatted', action='read')
174  if(status .ne. 0 ) then
175  write(0,*) ' cannot open file ='
176  write(0,*) filename
177  stop
178  endif
179 
180  if(webonly .eq. 0 ) then
181 ! skip time data for core region
182  do i = 1, ansites
183  do code = 1, 4
184  nbinhisto=kwhistreadascii(h10, fnot)
185  if(nbinhisto .le. 0 ) then
186  write(0,*) ' ascii read failed'
187  stop
188  endif
189  call kwhists(h10, normf)
190 ! deallocate
191  call kwhistd( h10 )
192  enddo
193  enddo
194  endif
195 ! web sector region
196  do i = 1, ansites
197  do code = 1, 4
198  do ifai= 1, nfai
199  do ir= 1, nrbin
200  nbinhisto=kwhistreadascii(h10, fnot)
201  if(nbinhisto .le. 0 ) then
202  write(0,*) ' ascii read failed'
203  stop
204  endif
205 ! statistical calculation
206  call kwhists(h10, normf)
207 ! time analysis
208 ! 6: output on stdout
209  call proctime(h10, 6, nfraca, reduced,
210  * ir, ifai, code, i)
211 ! deallocate
212  call kwhistd( h10 )
213  enddo
214  enddo
215  enddo
216  enddo
217  close(fnot)
218  end
void kwhistd(struct histogram1 *h)
! timing nrbin
Definition: Zprivate2.h:12
void kwhistr(struct histogram1 *h, FILE *bfnor, int icon)
void kwhists(struct histogram1 *h, float inorm)
subroutine proctimebin
subroutine proctime(h, fnotf, nfraca, reduced, idxr, idxf, code, layer)
Definition: procTime.f:44
! timing nfai
Definition: Zprivate2.h:12