COSMOS v7.655  COSMOSv7655
(AirShowerMC)
timesliceg77.f File Reference

Go to the source code of this file.

Functions/Subroutines

program __timesliceg77.f__
 
subroutine slice (mint, maxt, dt)
 
subroutine thinning (kk, i1, i2)
 
subroutine mvdata (f, j, nc)
 
subroutine mvdatai (f, j, nc)
 
subroutine mkfiles
 
subroutine mkskelfiles
 
subroutine mkafile
 
subroutine mkaskelfile
 
subroutine wtaskel (fno, xa, ya, za, code, chg, np, mulalpha)
 
subroutine code2rgb (codei, chgi, r, g, b, alpha)
 

Function/Subroutine Documentation

◆ __timesliceg77.f__()

program __timesliceg77.f__ ( )

Definition at line 4 of file timesliceg77.f.

References klena(), maxp, mkafile(), mkaskelfile(), mkfiles(), mkskelfiles(), n, slice(), and thinning().

4  character*120 tracefile
Here is the call graph for this function:

◆ code2rgb()

subroutine code2rgb ( integer*2  codei,
integer*2  chgi,
real  r,
real  g,
real  b,
real  alpha 
)

Definition at line 415 of file timesliceg77.f.

References parameter(), and true.

415  implicit none
416  integer*2 codei, chgi
417  real r, g, b, alpha
418 
419  integer ncolor, mncolor
420  parameter( mncolor = 17 )
421 ! type colortab
422  integer*2 tcode(mncolor)
423  integer*2 tchg(mncolor)
424  real tr(mncolor)
425  real tg(mncolor)
426  real tb(mncolor)
427  real talpha(mncolor)
428 ! end type colortab
429 ! type(colortab):: tab(mncolor)
430 
431  character*80 input
432  integer i
433 
434  integer first
435  data first/0/
436  save first, ncolor, tcode, tchg, tr, tg, tb, talpha
437 
438  if(first .eq. 0) then
439  input = ' '
440 
441  open(13, file='colortab')
442  i = 0
443  do while(.true.)
444  read(13,'(a)',end=10) input
445 
446  if(input(1:1) .ne. "#" .and. input .ne. ' ') then
447  i = i + 1
448  if(i .gt. mncolor) then
449  write(0,*) ' too many color spec. in colortab'
450  stop 99999
451  endif
452 
453  read(input,*)
454  * tcode(i), tchg(i),
455  * tr(i), tg(i), tb(i),
456  * talpha(i)
457  endif
458  enddo
459  10 continue
460  ncolor = i
461  first = 1
462  close(13)
463  endif
464 
465  do i = 1, ncolor
466  if(tcode(i) .eq. codei .and. tchg(i) .eq. chgi) goto 100
467  enddo
468  i = ncolor
469  100 continue
470 
471  r = tr(i)
472  g = tg(i)
473  b = tb(i)
474  alpha = talpha(i)
integer npitbl real *nx parameter(n=101, npitbl=46, nx=n-1) real *8 uconst
*Zfirst p fm *Zfirst p Zfirst p Zfirst p *Zfirst p *Zfirst pos xyz r
Definition: ZavoidUnionMap.h:1
logical, save first
Definition: cNRLAtmos.f:8
nodes i
block data cblkElemag data *AnihiE ! Eposi< 1 TeV, anihilation considered *X0/365.667/, ! radiation length of air in kg/m2 *Ecrit/81.e-3/, ! critical energy of air in GeV *MaxComptonE/1./, ! compton is considered below 1 GeV *MaxPhotoE/1.e-3/, ! above this, PhotoElectric effect neg. *MinPhotoProdE/153.e-3/, ! below 153 MeV, no gp --> hadrons ! scattering const not MeV *Knockon true
Definition: cblkElemag.h:7
dE dx *! Nuc Int sampling table g
Definition: cblkMuInt.h:130
real(4), save b
Definition: cNRLAtmos.f:21
Here is the call graph for this function:

◆ mkafile()

subroutine mkafile ( )

Definition at line 334 of file timesliceg77.f.

References idx(), x, y, and z.

334  implicit none
335  include "Zprivate2g77.f"
336 
337  integer i, j
338  character* 130 filename
339 
340  integer filec
341  integer klena
342  data filec/0/
343  save filec
344 
345  if( filec .eq. 0 ) then
346  filename = dir(1:klena(dir))//"/timesorted.dat"
347  open(20, file=filename,
348  * form='formatted')
349  filec = 1
350  endif
351 
352  do j = jmin, jmax
353  do i= 1, idx(j)
354  write(20,'(3g16.8, i3,i3)' )
355  * x(i, j), y(i,j), z(i,j), codex(i,j), chgx(i,j)
356  enddo
357  if( idx(j) .gt. 0 ) write(20,*)
358  enddo
nodes z
nodes i
averg real MaxCPU integer idx(Maxp)
********************block data cblkHeavy ********************integer j data *HeavyG2symbol *data *HeavyG2code kiron data j
Definition: cblkHeavy.h:36
latitude latitude this system is used *****************************************************************! type coord sequence union map real y
Definition: Zcoord.h:25
integer function klena(cha)
Definition: klena.f:20
! structure defining a particle at production ! Basic idea of what is to be contained in ! the particle structue is that dynamical ones should be included those derivable from the particle code ! is not included ******************************************************type fmom momentum sequence union map real e endmap map real * x
Definition: Zptcl.h:21
Here is the call graph for this function:

◆ mkaskelfile()

subroutine mkaskelfile ( )

Definition at line 361 of file timesliceg77.f.

References idx(), wtaskel(), x, y, and z.

361  implicit none
362  include "Zprivate2g77.f"
363 
364  integer i, j
365  character* 130 filename
366 
367  integer filec
368  integer klena
369  data filec/0/
370  save filec
371 
372  if( filec .eq. 0 ) then
373  filename = dir(1:klena(dir))//"/timesorted.skel"
374  open(20, file=filename,
375  * form='formatted')
376  filec = 1
377  endif
378 
379  do j = jmin, jmax
380  if(idx(j) .gt. 0) then
381  write(20,'(a)') "SKEL"
382  call wtaskel(20,
383  * x(1, j), y(1,j), z(1,j), codex(1,j), chgx(1,j), idx(j),
384  * mulalpha)
385  write(20,*)
386  endif
387  enddo
nodes z
nodes i
subroutine wtaskel(fno, xa, ya, za, code, chg, np, mulalpha)
Definition: timeslice.f:359
averg real MaxCPU integer idx(Maxp)
********************block data cblkHeavy ********************integer j data *HeavyG2symbol *data *HeavyG2code kiron data j
Definition: cblkHeavy.h:36
latitude latitude this system is used *****************************************************************! type coord sequence union map real y
Definition: Zcoord.h:25
integer function klena(cha)
Definition: klena.f:20
! structure defining a particle at production ! Basic idea of what is to be contained in ! the particle structue is that dynamical ones should be included those derivable from the particle code ! is not included ******************************************************type fmom momentum sequence union map real e endmap map real * x
Definition: Zptcl.h:21
Here is the call graph for this function:

◆ mkfiles()

subroutine mkfiles ( )

Definition at line 285 of file timesliceg77.f.

References idx(), x, y, and z.

285  implicit none
286  include "Zprivate2g77.f"
287 
288  character* 130 filename
289 
290  integer klena
291 
292  integer i, j
293 
294  do j = jmin, jmax
295  if(idx(j) .gt. 0) then
296  write(filename,'(a, a, i5.5,a)') dir(1:klena(dir)),
297  * "/ts", j+offset, ".dat"
298  open(20, file=filename, form='formatted')
299  do i= 1, idx(j)
300  write(20,'(3g16.8,i3,i3)')
301  * x(i, j), y(i,j), z(i,j), codex(i,j), chgx(i,j)
302  enddo
303  close(20)
304  endif
305  enddo
nodes z
nodes i
averg real MaxCPU integer idx(Maxp)
********************block data cblkHeavy ********************integer j data *HeavyG2symbol *data *HeavyG2code kiron data j
Definition: cblkHeavy.h:36
latitude latitude this system is used *****************************************************************! type coord sequence union map real y
Definition: Zcoord.h:25
integer function klena(cha)
Definition: klena.f:20
! structure defining a particle at production ! Basic idea of what is to be contained in ! the particle structue is that dynamical ones should be included those derivable from the particle code ! is not included ******************************************************type fmom momentum sequence union map real e endmap map real * x
Definition: Zptcl.h:21
Here is the call graph for this function:

◆ mkskelfiles()

subroutine mkskelfiles ( )

Definition at line 309 of file timesliceg77.f.

References idx(), wtaskel(), x, y, and z.

309  implicit none
310  include "Zprivate2g77.f"
311 
312  character* 130 filename
313 
314 
315  integer klena
316 
317  integer i, j
318 
319  do j = jmin, jmax
320  if(idx(j) .gt. 0) then
321  write(filename,'(a, a, i5.5, a)') dir(1:klena(dir)),
322  * "/ts", j+offset, ".skel"
323  open(20, file=filename, form='formatted')
324  write(20, '(a)') "SKEL"
325  call wtaskel(20, x(1,j), y(1,j), z(1,j),
326  * codex(1,j), chgx(1, j), idx(j), mulalpha)
327 
328  close(20)
329  endif
330  enddo
nodes z
nodes i
subroutine wtaskel(fno, xa, ya, za, code, chg, np, mulalpha)
Definition: timeslice.f:359
averg real MaxCPU integer idx(Maxp)
********************block data cblkHeavy ********************integer j data *HeavyG2symbol *data *HeavyG2code kiron data j
Definition: cblkHeavy.h:36
latitude latitude this system is used *****************************************************************! type coord sequence union map real y
Definition: Zcoord.h:25
integer function klena(cha)
Definition: klena.f:20
! structure defining a particle at production ! Basic idea of what is to be contained in ! the particle structue is that dynamical ones should be included those derivable from the particle code ! is not included ******************************************************type fmom momentum sequence union map real e endmap map real * x
Definition: Zptcl.h:21
Here is the call graph for this function:

◆ mvdata()

subroutine mvdata ( real*4, dimension(maxp, n f,
integer  j,
integer  nc 
)

Definition at line 234 of file timesliceg77.f.

References idx().

234  implicit none
235  include "Zprivate2g77.f"
236 
237  integer j
238  real*4 f(maxp, n)
239 
240  real*4 temp(maxp)
241  integer i, nc, l
242 
243  nc = 0
244 
245  do i = 1, idx(j)
246  l = si(i)
247  if(l .gt. 0 ) then
248  nc = nc + 1
249  temp(nc) = f(l, j)
250  endif
251  enddo
252 
253  do i = 1, nc
254  f(i, j) = temp(i)
255  enddo
256 
257 
nodes i
averg real MaxCPU integer idx(Maxp)
********************block data cblkHeavy ********************integer j data *HeavyG2symbol *data *HeavyG2code kiron data j
Definition: cblkHeavy.h:36
real(4), dimension(:), allocatable, save temp
Definition: cNRLAtmos.f:29
!onst int maxp
Definition: Zprivate.h:3
real cut integer nc
Definition: Zprivate.h:1
integer n
Definition: Zcinippxc.h:1
dE dx *! Nuc Int sampling table f
Definition: cblkMuInt.h:130
Here is the call graph for this function:

◆ mvdatai()

subroutine mvdatai ( integer*2, dimension(maxp, n f,
integer  j,
integer  nc 
)

Definition at line 260 of file timesliceg77.f.

References idx().

260  implicit none
261  include "Zprivate2g77.f"
262  integer j
263  integer*2 f(maxp, n)
264 
265  integer*2 temp(maxp)
266  integer i, nc, l
267  nc = 0
268 
269  do i = 1, idx(j)
270  l = si(i)
271  if(l .gt. 0 ) then
272  nc = nc + 1
273  temp(nc) = f(l, j)
274  endif
275  enddo
276 
277  do i = 1, nc
278  f(i, j) = temp(i)
279  enddo
280 
281 
nodes i
averg real MaxCPU integer idx(Maxp)
********************block data cblkHeavy ********************integer j data *HeavyG2symbol *data *HeavyG2code kiron data j
Definition: cblkHeavy.h:36
real(4), dimension(:), allocatable, save temp
Definition: cNRLAtmos.f:29
!onst int maxp
Definition: Zprivate.h:3
real cut integer nc
Definition: Zprivate.h:1
integer n
Definition: Zcinippxc.h:1
dE dx *! Nuc Int sampling table f
Definition: cblkMuInt.h:130
Here is the call graph for this function:

◆ slice()

subroutine slice ( real*4  mint,
real*4  maxt,
real*4  dt 
)

Definition at line 79 of file timesliceg77.f.

References d0, idx(), n, thinning(), true, x, y, and z.

79  implicit none
80  include "Zprivate2g77.f"
81 
82  real*4 mint, maxt, dt
83  integer i, j, kk
84  real*4 t, k
85  integer*2 code, chg
86  integer it1, it2
87  real*4 xx1, yy1, zz1, time1
88  real*4 xx2, yy2, zz2, time2
89  real*4 xxp, yyp
90 
91  character* 120 input
92  real*8 linec
93  data linec/0.0/
94  save linec
95 
96  do j = 1, n
97  idx(j) = 0
98  enddo
99 
100  do while (.true.)
101  input = ' '
102  read(11, '(a)', end=1000 ) input
103  linec = linec + 1.d0
104  if( mod(linec, 1.d7) .eq. 0 ) then
105  write(0,*)
106  * ' ------------------------------------linec=',linec
107  endif
108  if( input .ne. " " ) then
109  read(input, * ) xx1, yy1, zz1, time1, code, chg
110  do while( input .ne. " ")
111  read(11, '(a)', end =1000) input
112  linec = linec + 1.d0
113  if( mod(linec, 1.d7) .eq. 0 ) then
114  write(0,*)
115  * ' ------------------------------------linec=',
116  * linec
117  endif
118 
119  if( input .ne. " " ) then
120  read(input, * ) xx2, yy2, zz2, time2, code, chg
121  xxp = xx2*aax + yy2*aay ! aaz =0
122  yyp = xx2*bbx + yy2*bby + zz2*bbz
123  if(xxp**2 + yyp**2 .gt. rmax2) goto 900
124  it1 = (time1- mint)/dt +1
125  it2 = (time2- mint)/dt
126  if(it1 .lt. 1) goto 900
127  if(it2 .gt. n) goto 900
128  if(time2 .gt. maxt) goto 900
129  jmin = min(jmin, it1)
130  jmax = max(jmax, it2)
131  do j = it1, it2
132  t = j*dt + mint
133  if( idx(j) .ge. maxppt ) then
134  pixel = pixel0
135  write(0,*)
136  * 'ptcls at time=', t , ' > ', maxppt
137  write(0,*)
138  * 'try to thin ptcls in the same pixel'
139  kk = 0
140  call thinning(kk, j, j)
141  endif
142  do while (idx(j) .ge. maxppt)
143  pixel = pixel*pixelinc
144  write(0,*) 'ptcls > ', maxppt
145  write(0,*) 'thinning not worked'
146  write(0,*)
147  * 'brute thinning is tried by',pixelinc,
148  * 'x current pixel =', pixel
149 ! if kk == 1, don't do sort; kk may be
150 ! reset to 0 inside of thinning
151  call thinning(kk, j, j)
152  enddo
153  idx(j) = idx(j) + 1
154 ! (x2-x1)/(t2-t1) *(t-t1) +x1
155  k = (t - time1) /(time2-time1)
156  x(idx(j), j) = (xx2-xx1) * k + xx1
157  y(idx(j), j) = (yy2-yy1) * k + yy1
158  z(idx(j), j) = (zz2-zz1) * k + zz1
159  codex(idx(j), j) = code
160  chgx(idx(j), j) = chg
161  enddo
162  900 continue
163  xx1 = xx2
164  yy1 = yy2
165  zz1 = zz2
166  time1 = time2
167  endif
168  enddo
169  endif
170  enddo
171  1000 continue
nodes z
nodes i
subroutine thinning(i1, i2)
Definition: timeslice.f:141
block data cblkElemag data *AnihiE ! Eposi< 1 TeV, anihilation considered *X0/365.667/, ! radiation length of air in kg/m2 *Ecrit/81.e-3/, ! critical energy of air in GeV *MaxComptonE/1./, ! compton is considered below 1 GeV *MaxPhotoE/1.e-3/, ! above this, PhotoElectric effect neg. *MinPhotoProdE/153.e-3/, ! below 153 MeV, no gp --> hadrons ! scattering const not MeV *Knockon true
Definition: cblkElemag.h:7
averg real MaxCPU integer idx(Maxp)
********************block data cblkHeavy ********************integer j data *HeavyG2symbol *data *HeavyG2code kiron data j
Definition: cblkHeavy.h:36
*Zfirst p fm *Zfirst p Zfirst p code
Definition: ZavoidUnionMap.h:1
block data cblkEvhnp ! currently usable models data RegMdls ad *special data *Cekaon d0
Definition: cblkEvhnp.h:5
latitude latitude this system is used *****************************************************************! type coord sequence union map real y
Definition: Zcoord.h:25
nodes t
integer n
Definition: Zcinippxc.h:1
! structure defining a particle at production ! Basic idea of what is to be contained in ! the particle structue is that dynamical ones should be included those derivable from the particle code ! is not included ******************************************************type fmom momentum sequence union map real e endmap map real * x
Definition: Zptcl.h:21
Here is the call graph for this function:

◆ thinning()

subroutine thinning ( integer  kk,
integer  i1,
integer  i2 
)

Definition at line 177 of file timesliceg77.f.

References false, idx(), kqsortr(), mvdata(), mvdatai(), true, x, y, and z.

177  implicit none
178  include "Zprivate2g77.f"
179 ! culling overlapping points in a pixel
180 ! this is very rough thinning
181 ! sorr each x
182  integer kk ! in/out. if 0, sort x before thinning
183  integer i1, i2
184  integer nc, j, i, k1, k2, l, nc0
185  logical dothin
186 
187  do j = i1, i2
188  dothin = .false.
189  if( idx(j) .gt. 0) then
190  if(kk .eq. 0) then
191  call kqsortr(x(1,j), si, idx(j))
192  endif
193  do i = 1, idx(j)-1
194  k1 = si(i)
195  if(k1 .lt. 0) goto 20
196  do l = i+1, idx(j)
197  k2 = si(l)
198  if(k2 .lt. 0) goto 10
199  if(abs(x(k1, j)- x(k2,j)) .gt. pixel ) goto 20
200 ! since xx is sorted, we may safe to skip
201 ! further check
202 !
203  if(abs(y(k1, j)- y(k2,j)) .gt. pixel ) goto 10
204  if(abs(z(k1, j)- z(k2,j)) .gt. pixel ) goto 10
205 ! remove k2
206  si(l) = - k2
207  dothin = .true.
208  10 continue
209  enddo
210  20 continue
211  enddo
212  if(dothin) then
213  nc0 = idx(j)
214  call mvdata(x, j, nc)
215  call mvdata(y, j, nc)
216  call mvdata(z, j, nc)
217  call mvdatai(codex, j, nc)
218  call mvdatai(chgx, j, nc)
219  idx(j) = nc
220  write(0,*) ' thinning ', nc0, "-->", nc
221  else
222  if(i1 .eq. i2) then
223 ! sorted data remain the same; so if
224 ! thinning is tried with larger pixel
225 ! we don't need to sort again
226  kk = 1
227  endif
228  endif
229  endif
230  enddo
nodes z
nodes i
subroutine mvdata(f, j, nc)
Definition: timeslice.f:191
block data cblkElemag data *AnihiE ! Eposi< 1 TeV, anihilation considered *X0/365.667/, ! radiation length of air in kg/m2 *Ecrit/81.e-3/, ! critical energy of air in GeV *MaxComptonE/1./, ! compton is considered below 1 GeV *MaxPhotoE/1.e-3/, ! above this, PhotoElectric effect neg. *MinPhotoProdE/153.e-3/, ! below 153 MeV, no gp --> hadrons ! scattering const not MeV *Knockon true
Definition: cblkElemag.h:7
averg real MaxCPU integer idx(Maxp)
********************block data cblkHeavy ********************integer j data *HeavyG2symbol *data *HeavyG2code kiron data j
Definition: cblkHeavy.h:36
latitude latitude this system is used *****************************************************************! type coord sequence union map real y
Definition: Zcoord.h:25
block data cblkElemag data *AnihiE ! Eposi< 1 TeV, anihilation considered *X0/365.667/, ! radiation length of air in kg/m2 *Ecrit/81.e-3/, ! critical energy of air in GeV *MaxComptonE/1./, ! compton is considered below 1 GeV *MaxPhotoE/1.e-3/, ! above this, PhotoElectric effect neg. *MinPhotoProdE/153.e-3/, ! below 153 MeV, no gp --> hadrons ! scattering const not MeV *Knockon ! knockon is considered Obsolete *PhotoProd false
Definition: cblkElemag.h:7
real cut integer nc
Definition: Zprivate.h:1
subroutine mvdatai(f, j, nc)
Definition: timeslice.f:217
subroutine kqsortr(A, ORD, N)
Definition: kqsortr.f:23
! structure defining a particle at production ! Basic idea of what is to be contained in ! the particle structue is that dynamical ones should be included those derivable from the particle code ! is not included ******************************************************type fmom momentum sequence union map real e endmap map real * x
Definition: Zptcl.h:21
Here is the call graph for this function:

◆ wtaskel()

subroutine wtaskel ( integer  fno,
real*4, dimension(np)  xa,
real*4, dimension(np)  ya,
real*4, dimension(np)  za,
integer*2, dimension(np)  code,
integer*2, dimension(np)  chg,
integer  np,
real*4  mulalpha 
)

Definition at line 392 of file timesliceg77.f.

References code2rgb().

392 !
393  implicit none
394  integer fno, np
395  real*4 xa(np), ya(np), za(np)
396  real*4 mulalpha
397  integer*2 code(np), chg(np)
398 
399  real r, g, b, alpha
400  integer i
401 
402  if(np .gt. 0) then
403  write(fno, '(2i9)') np, np
404  do i = 1, np
405  write(fno, '(3g16.8)' ) xa(i), ya(i), za(i)
406  enddo
407  do i= 1, np
408  call code2rgb(code(i), chg(i), r, g, b, alpha)
409  write(fno, '("1 ", i8, 3f5.2,f6.3)')
410  * i-1, r, g, b, alpha*mulalpha
411  enddo
412  endif
*Zfirst p fm *Zfirst p Zfirst p Zfirst p *Zfirst p *Zfirst pos xyz r
Definition: ZavoidUnionMap.h:1
nodes i
*Zfirst p fm *Zfirst p Zfirst p code
Definition: ZavoidUnionMap.h:1
subroutine code2rgb(codei, chgi, r, g, b, alpha)
Definition: timeslice.f:381
dE dx *! Nuc Int sampling table g
Definition: cblkMuInt.h:130
real(4), save b
Definition: cNRLAtmos.f:21
integer, parameter fno
Definition: chook.f:43
Here is the call graph for this function: