COSMOS v7.655  COSMOSv7655
(AirShowerMC)
procTime.f
Go to the documentation of this file.
1 !
2 !
3 ! Suppose that the normalzied integral (from left) time distribution
4 ! in a given web sector is like below
5 ! 1.0 ----------------------------------------*----
6 ! *
7 ! *
8 ! frac <-- *
9 ! * |
10 ! * |
11 ! * |
12 ! * |
13 ! * |
14 ! * |
15 ! * |
16 ! *
17 ! *
18 ! *
19 ! * tf
20 ! 0-------- *------------------------------------------> t
21 !
22 ! We get set of 'tf' for given set of 'frac' which are
23 ! e.g, 0.05 0.1, 0.2,... 0.9, 0.95 (see fig).
24 !
25 ! real*8 frac(nfrac)
26 ! real*8 frac/0.05d0, 0.1d0, 0.2d0, 0.3d0, 0.4d0, 0.5d0, 0.6d0,
27 ! * 0.7d0, 0.8d0, 0.9d0, 0.95d0/
28 ! real*8 tf(nfrac)
29 ! ( nfrac=11 in this case. )
30 !
31 ! We get such tf's for every web sector and store
32 ! in an array tfary0;
33 ! For a web sector with a given ir( lateral index) value
34 ! we get first nfrac tf values. Then, we get similar one
35 ! for next web sector at next it. So we get nrbin 'tf'
36 ! values for each 'frac'. These are written to the
37 ! stdout with a header of "fai code layer" index.
38 ! The last data is indicated by "0 0 0" header index.
39 !
40 !
41 !
42  subroutine proctime(h, fnotf,
43  * nfraca, reduced, idxr, idxf, code, layer)
44 ! This treats one 1-D histogram with web index (idxr, idxf)
45 !
46  implicit none
47 #include "ZtimeAna.h"
48 
49 #include "../../Hist/Z90histc.h"
50 #include "../../Hist/Z90histo.h"
51 #include "../../Hist/Z90hist1.h"
52 
53  type(histogram1):: h ! input 1 D histogram
54  integer fnotf ! input file number for tf data
55  integer nfraca ! input.
56  ! 1 to 11; upto what % data is obtained.
57  ! For final fitting, T10% is ok so use 2.
58  ! 1->T%5 2->T10% 9->T80% 10->T90% 11->T95%
59  ! 2 vs 11: 2 is 15% faster than 11.
60  integer reduced ! 0--> time is non-reduced time
61  ! 1--> reduced time
62  integer idxr ! web r bin index (1~nrbin=42)
63  integer idxf ! web fai bin index (1~nf)
64  integer code ! ptcl code
65  integer layer ! at which layer
66  integer kwhistIxy
67  integer maxsize ! max histogram size
68  integer n ! actual histogram size
69 
70  integer i, j
71  parameter(maxsize=3000)
72  real*8 x(maxsize), y(maxsize)
73  real*8 cgap
74  integer icon
75  integer idxr1, idxr2
76  integer mode
77  save
78  mode=2 ! only this can be used
79 
80 ! get (normalized) integral dist.
81  n = kwhistixy(h, x, y, maxsize)
82  if(n .gt. maxsize) then
83  write(0, *) ' too large histogram size=',n
84  stop 1111
85  endif
86  if( idxr .eq. 1 ) then
87  idxr1 = 0
88  idxr2 = 0
89  endif
90  if(reduced .eq. 1 .and. idxf .eq. 1) then
91 ! check time<0 for fai=0 deg.
92  if(n .gt. 0) then
93  if(x(1) .lt. 0. ) then
94  write(0,*)
95  * 'Although you gave reducedT="yes" in baseInfo'
96  write(0,*)
97  * 'I suspect that histgoram data has non reduced time'
98  write(0,*) 'so I stop here'
99  stop 999
100  endif
101  endif
102  endif
103 
104  if(smooth .gt. 0) then
105 ! smoothin parameter
106  cgap = 0.1/(idxr/30.)**4
107 ! smoothing.( at least one trial is done.)
108 ! at large distances (idxr>30, 10 or more
109 ! trials)
110 
111  call ksmooth(x, 1, y, 1, n, 0, smooth, cgap, icon)
112  else
113  icon = 1
114  endif
115 
116  if(icon .gt. 0 ) then
117  if(idxr1 .eq. 0) idxr1=idxr
118  idxr2=idxr
119 ! get 'tf' values corresponding to 'frac'
120  call proctimegettf(x, y, n, frac, tf, nfraca)
121  do i = 1, nfraca
122  tfary0(idxr, i) = tf(i)
123  enddo
124  endif
125  if(idxr .eq. nrbin) then
126 ! all data at given fai has been obtained.
127 ! data is between idxr1 to idxr2 for r
128 ! do fitting and save the result in tfary
129 
130  write(fnotf,'(3i4)') idxf, code, layer
131  if(mode .eq. 1) then
132  do i = idxr1, idxr2
133  write(fnotf,'(i3,1p11E11.3)')
134  * i, (tfary(i, j), j=1, nfraca)
135  enddo
136  write(fnotf,
137  * '("0 0 0 0 0 0 0 0 0 0 0 0 ")')
138  elseif(mode .eq. 2) then
139  do i = idxr1, idxr2
140  write(fnotf,'(i3, 1p11E11.3)')
141  * i, (tfary0(i, j), j=1, nfraca)
142  enddo
143  write(fnotf,
144  * '("0 0 0 0 0 0 0 0 0 0 0 0 ")')
145  elseif(mode .eq. 3) then
146  do i = idxr1, idxr2
147  write(fnotf,'(i3,1p22E11.3)')
148  * i, (tfary(i, j), j=1, nfraca),
149  * (tfary0(i,j), j=1, nfraca)
150  enddo
151  write(fnotf,
152  * '("0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0")')
153  endif
154  endif
155  end
156 
157  subroutine proctimegettf(x, y, n, frac, tf, nfrac)
158  implicit none
159  integer n
160  real*8 x(n)
161  real*8 y(n)
162  integer nfrac
163  real*8 frac(nfrac)
164  real*8 tf(nfrac)
165 
166  real*8 error
167  integer i, j
168  integer np
169  parameter(np = 3) ! use np points for interpolation
170 
171  do i = 1, nfrac
172  call kpolintpfe(y, 1, x, 1, n, np,
173  * frac(i), tf(i), error)
174  enddo
175  end
integer npitbl real *nx parameter(n=101, npitbl=46, nx=n-1) real *8 uconst
integer nfrac tf(nfrac) data frac/0.05d0
subroutine proctimegettf(x, y, n, frac, tf, nfrac)
Definition: procTime.f:158
! timing nrbin
Definition: Zprivate2.h:12
subroutine kpolintpfe(xa, xstep, ya, ystep, nt, m, x, y, error)
Definition: kpolintp.f:134
integer nfrac real * tfary0(nrbin, nfrac) real *8 tfary(nrbin
subroutine ksmooth(x, intvx, y, intvy, n, jin, repeat, cgap, icon)
Definition: ksmooth.f:3
subroutine proctime(h, fnotf, nfraca, reduced, idxr, idxf, code, layer)
Definition: procTime.f:44