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

Go to the source code of this file.

Functions/Subroutines

subroutine xbgrun
 
subroutine watchdog (h)
 
real *8 function getfai (x, y)
 
subroutine det2web (x, y, xs, ys)
 

Function/Subroutine Documentation

◆ det2web()

subroutine det2web ( real*8  x,
real*8  y,
real*8  xs,
real*8  ys 
)

Definition at line 789 of file interface.f.

Referenced by xbgrun().

789  implicit none
790 #include "Zmaxdef.h"
791 #include "Zobs.h"
792 #include "Zprivate.h"
793  real*8 x, y ! input. x,y component of the coordinate
794  ! or direction cos in the detctor system.
795  real*8 xs,ys ! ouput. values transformed to web system
796  ! where the x-axis is directed to the incident
797  ! xs,ys can be x,y
798 
799 ! Z* = Z * exp(-Fai0) = (x + iy)(cos-i sin)
800 ! = x cos + y sin + i ( y cos -x sin)
801 !
802  real*8 temp
803  temp = x*cosrot + y*sinrot
804  ys = y*cosrot - x*sinrot
805  xs = temp
! constants thru Cosmos real ! if multiplied to deg radian Torad ! light velocity m sec ! infinty ! kg m2 *Togpcm2 g cm2 ! g cm2 *Tokgpm2 kg m2 ! cm *Tom m ! m *Tocm cm ! g cm3 *Tokgpm3 kg m3 ! kg m3 *Togpcm3 g cm3 ! sec *Tonsec nsec ! Tesla m ! Avogadro *A2deninv ! mfp *n * xs
Definition: Zglobalc.h:18
real(4), dimension(:), allocatable, save temp
Definition: cNRLAtmos.f:29
latitude latitude this system is used *****************************************************************! type coord sequence union map real y
Definition: Zcoord.h:25
! 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 caller graph for this function:

◆ getfai()

real*8 function getfai ( real*8  x,
real*8  y 
)

Definition at line 782 of file interface.f.

782  implicit none
783 #include "Zglobalc.h"
784 ! get polar angle of the point (x,y) in deg.
785  real*8 x, y ! input postion or direction-cos components
786  getfai = atan2(y, x)*todeg
real *8 function getfai(x, y)
Definition: interface.f:782
latitude latitude this system is used *****************************************************************! type coord sequence union map real y
Definition: Zcoord.h:25
! 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

◆ watchdog()

subroutine watchdog ( type(histogram1 h)

Definition at line 766 of file interface.f.

766  implicit none
767 #include "Zmaxdef.h"
768 #include "Zobs.h"
769 #include "Zprivate.h"
770 #include "Zprivate2.h"
771  type(histogram1):: h
772  integer i
773  write(0,*) ' h%c%init=', h%c%init
774  write(0,*) ' h%c%title=', h%c%title
775  if( h%c%init .eq. 'initend' ) then
776  do i = 1, 20
777  write(0,*) 'i=',i, ' h%dnw(i)=',h%dnw(i)
778  enddo
779  endif
nodes i
real(4), dimension(:), allocatable, save h
Definition: cNRLAtmos.f:28

◆ xbgrun()

subroutine xbgrun ( )

Definition at line 58 of file interface.f.

References b, bin, cdedxinair(), charge, cmintime2websec(), cmudedx(), cos, cqincident(), csortstack(), d, d0, depth, det2web(), false, height, histdep(), howmuch(), kelec, kgetenv2(), kmuon, kphoton, kseblk(), kwhist(), kwhistai(), kwhistc(), kwhistd(), kwhistdir(), kwhistev(), kwhisti(), kwhistid(), kwhistp(), kwhists(), kwhistso(), mass, mpirank, ne, nfai, ng, nmu, nrbin, p, rndc(), subcode, t, tkarspec, tkrtspec, true, w2hl(), x, xyz, and y.

58  implicit none
59 #include "Zmaxdef.h"
60 #include "Zglobalc.h"
61 #include "Zmanagerp.h"
62 #include "Ztrack.h"
63 #include "Ztrackv.h"
64 #include "Ztrackp.h"
65 #include "Zcode.h"
66 #include "Zheavyp.h"
67 #include "Zobs.h"
68 #include "Zobsp.h"
69 #include "Zobsv.h"
70 #include "Zstackv.h"
71 #include "Zincidentv.h"
72 #include "Zprivate.h"
73 #include "Zprivate1.h"
74 #include "Zprivate2.h"
75 #include "Zprivate3.h"
76 #include "Zprivate4.h"
77 #if defined (DOMPI)
78 #include "mpif.h"
79 #include "Zmpi.h"
80  real*8 ager(maxmpisize)
81  real*8 esizer(maxmpisize)
82  real*8 wage, wsize
83  real*8 etime1, etime2
84  character*10 numbr
85  integer lengnr, rank, rankc
86 ! to gatter sum of the all rank data
87  real nrfaireca(nrbin, nfai, 4, nsites)
88  real nrfaialla(nrbin, nfai, 4, nsites)
89  real derfaia(nrbin, nfai, nsites)
90  real*8 nga(maxnoofassites)
91  real*8 nea(maxnoofassites)
92  real*8 nmua(maxnoofassites)
93  real*8 nhada(maxnoofassites)
94  real*8 sumelossa(maxnoofassites)
95 #define REALLIMITg 15000
96 #define REALLIMITe 9000
97 #define REALLIMITmu 7500
98 #define REALLIMITh 7500
99 #endif
100  type(track):: incident
101  type(coord):: angleatobs
102 
103  logical heobs ! if T, currently observing
104  common /zheobs/ heobs ! particle is the one obsrved at skeelton making time
105 
106 
107 
108  integer id ! input. 1 ==> aTrack is going out from
109 ! outer boundery.
110 ! 2 ==> reached at an observation level
111 ! 3 ==> reached at inner boundery.
112  type(track):: atrack
113 
114  type(track):: inci
115  type(coord):: angle
116  type(coord):: tetafai
117 
118  character*128 input
119  character*64 dirstr
120  real sr, dr
121  integer i, j, k, icon, ir, l, m
122  integer nn
123  integer iij, code, codex
124  integer i1, i2, ic, ifai, ji
125 
126  real*8 r, eloss, rinmu, cosang
127  real*8 webmin(nrbin, nfai, nsites)
128  real*8 dedt, rho, dist, disto, dedxmu
129  real*8 fai, rminm
130 
131  real*8 u
132  logical accept
133 
134  real*8 wx, wy, wz
135  real za
136  real de, ek, f, molu
137  real*8 cvh2den
138  integer ldep, ridx, faiidx, depidx
139  integer lengenv
140  integer ncpu, mcpu ! no. of smashed skeletons, and actully used skeletonsn
141  integer margin
142  real*4 wgt, wwgt
143  real*4 enhance0 ! since we use only mcpu, the result must be enhanced
144  ! by a factor of ncpu/mcpu
145  real*4 enhance ! enhance0 * wgt
146  integer binw
147  character*9 ptcl(4)
148  data ptcl/"Photons", "Electrons","Muons", "hadrons"/
149  character*9 ptcl2(3)
150  data ptcl2/"Electrons", "Muons","All"/
151  real power(4)
152  integer nstr
153  real e0, cosz, limit(4), limite(4)
154  data power/1.,1.,1.,1./
155  real power2(4)
156  data power2/1.,1.,1.,1./
157  character*128 title
158  character*96 evid(nsites), plotid
159  real*8 cog, cog2, sumne, obstimes, savederg(5)
160  real*8 firstz, dd
161  real*8 fai0
162  real*8 getfai
163  logical dosort
164  real prob, tmin, dt
165 ! ***********************
166 #include "interface2.h"
167 ! *********************
168 ! example
169 ! histdep: 2 5 6 7 10 /
170 ! depth 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000
171 ! ansites = 5
172 ! w2hl: 0 1 0 0 2 3 4 0 0 5 0 0 ...
173 
174 
175 
176  lengenv = kgetenv2("LIMIT", input)
177  read(input(1:lengenv),*) limit
178  lengenv = kgetenv2("BINW", input)
179  read(input(1:lengenv),*) binw
180  lengenv = kgetenv2("NCPU", input)
181  read(input(1:lengenv),*) ncpu
182  lengenv = kgetenv2("MCPU", input)
183  read(input(1:lengenv),*) mcpu
184  lengenv = kgetenv2("MARGIN", input)
185  read(input(1:lengenv),*) margin
186  lengenv = kgetenv2("SeeLowdE", input)
187  if(lengenv .le. 0) then
188  write(0,*) ' SeeLowdE not given'
189  stop
190  endif
191  seelowde = input(1:lengenv) .eq. "yes"
192  lengenv = kgetenv2("KeepWeight", input)
193  keepweight = input(1:lengenv) .eq. "yes"
194 
195  enhance0 = ncpu
196  enhance0 = enhance0/mcpu
197  do i = 1, 4
198  limite(i) = limit(i) * enhance0
199  ! this must be enhanced from the firs.
200  enddo
201 
202 
203  write(0,*) ' *** ncpu=',ncpu,
204  * ' mcpu=',mcpu, ' enhance factor=',enhance0
205  write(0,*) ' margin=',margin
206  do i = 1, noofsites
207  w2hl(i) = 0
208  w2il(i) = 0
209  enddo
210  do i = 1, noofsites
211  if(histdep(i) .eq. 0) exit
212  hnsites = i
213  w2hl( histdep(i)) = i
214  enddo
215 
216  do i = 1, noofsites
217  if( indivdep(i) .eq. 0) exit
218  ansites = i
219  w2il( indivdep(i) ) = i
220  enddo
221 
222 ! now hnsites is the actual number of sites where statistics
223 ! by histogram is needed.
224 ! mapping; depth index to array index; where2loc
225 !
226 
227 
228  call kwhistso( binw ) ! specify binary or ascii write of histogaram
229  ! 1--> ascii 2--> binary
230 
231 
232  rminm = rmin/10.**(bin/2.0d0)
233  r=rmin
234  dr = 10.**bin
235  rbin(1) = 0.
236  do i = 2, nrbin
237  rbin(i) = r
238  r = r* dr
239  enddo
240 
241  return
242 ! ******************
243  entry xihist
244 !
245 !
246 
247 ! histogram: instanciate
248 ! rspec (lateral):
249 !
250 
251  if(tkarspec) then
252  do i = 1, hnsites
253  do k = 1, 4
254  do j = 1, nfai
255  call kwhisti(rspec(k, j, i),
256  * rmin, bin, nrbin, b'00011' )
257  write(plotid,
258  * '("Lateral dist. of ",a," at given fai")')
259  * ptcl(k)
260  call kwhistai(rspec(k, j, i),
261  * plotid, "ar", "ptcls", .true., power(k),
262  * "r", "m.u")
263  enddo
264  enddo
265  enddo
266  endif
267 
268  if(tkrtspec) then
269  do i = 1, hnsites
270  l = histdep(i)
271  call cmintime2websec(obssites(l).pos.xyz,
272  * l, i, webmin)
273  enddo
274 
275  do i = 1, hnsites
276  do j = 1, 4
277 ! at center
278  call kwhisti( tspec0(j, i),
279  * -5., 0.1, 200, b'00000')
280  call kwhistai( tspec0(j, i),
281  * "Arrival time dist. of "//ptcl(j)//" at center",
282  * "t", "ptcls", .false., 0., "time", "ns")
283 
284  do ir=1, nrbin
285  do ifai=1, nfai
286  tmin = webmin(ir, ifai,i)
287  dt = 0.01*10.0**(bin*(ir-1))*100. ! approx core distnace m
288  dt = dt**0.675*1.e9/3.0e8/30. ! if sqrt 1m-->0.1 ns 10 m-->0.3 ns
289  ! 100m 1ns 1km 3ns 4km 6ns
290  ! dt**0.675 makes larger bin at large distance (<=x2)
291  if(j .eq. 4) dt=dt*10.0 ! for delayed hadrons
292  dt= max(dt, 0.1)
293  call kwhisti( tspec(j, ir, ifai, i),
294  * tmin, dt, 1000, b'00000')
295  call kwhistai( tspec(j, ir, ifai, i),
296  * "Arrival time of "//ptcl(j)//" at (r,faI)",
297  * "rt", "ptcls", .false., 0., "time", "ns")
298  enddo
299  enddo
300  enddo
301  enddo
302  endif
303  if(tkrtspec) then
304  do i = 1, hnsites
305  do j = 1, 4
306  call kwhistc(tspec0(j,i))
307  do ir = 1, nrbin
308  do ifai = 1, nfai
309  call kwhistc(tspec(j, ir, ifai, i))
310  enddo
311  enddo
312  enddo
313  enddo
314  endif
315 
316  if(tkarspec) then
317  do i = 1, hnsites
318  do j = 1, 4
319  do ifai = 1, nfai
320  call kwhistc(rspec(j, ifai, i))
321  enddo
322  enddo
323  enddo
324  endif
325  return
326 ! ******************
327  entry xclearnrfai
328 !
329 
330  do i = 1, noofsites
331  do j= 1, 4
332  do k = 1, nfai
333  do l = 1, nrbin
334  nrfaiall(l, k, j, i) = 0.
335  derfai(l, k, i) = 0. ! no j (for all charged ptcls) > 500 keV
336  if(seelowde) derfai2(l, k, i) = 0. ! no j (for all charged ptcls) < 500 keV
337  enddo
338  enddo
339  enddo
340  enddo
341 
342  do i = 1, ansites
343  do j= 1, 4
344  do k = 1, nfai
345  do l = 1, nrbin
346  nrfairec(l, k, j, i) = 0.
347  enddo
348  enddo
349  enddo
350  enddo
351 
352 
353  return
354 ! *********************************** hook for Beginning of 1 event
355 ! * All system-level initialization for 1 event generation has been
356 ! * eneded at this moment.
357 ! * After this is executed, event generation starts.
358 ! *
359  entry xbgevent
360 #if defined (DOMPI)
361  etime1 = mpi_wtime()
362 #endif
363 
364  call cqincident(inci, angle)
365 
366 
367 #if FNODATDEF > 0
368  bufc=0
369 #endif
370 
371  cosz = -angle.r(3)
372  fai0 = getfai( -angle.r(1), -angle.r(2)) ! in deg.
373 ! to rotate coordinate and direction cos in the
374 ! Obsplane =1 system (x is directed to magnetic east
375 ! y is to the magnetic north) to the one in the
376 ! system with the x-axis directed to the incident
377 ! direction. All outuput from this program is
378 ! measured in this system. (web data too).
379 ! Z* = Z exp(-(Fai0)) ; Z in the detector system
380 ! Z* in the web system.
381 !
382  cosrot = cos(fai0*torad)
383  sinrot = sin(fai0*torad)
384 !
385 !
386  e0 = inci.p.fm.p(4)
387  if(inci.p.code .eq. 9) then
388  nn= inci.p.subcode
389  elseif(inci.p.code .eq. 1) then
390  nn=0
391  else
392  nn=1
393  endif
394 ! next is only available for parallel job. For normal job,
395 ! fisrt col.depth is not yet fixed.
396  firstz= zfirst.pos.depth*0.1
397  write(0,'(a,1pE11.3,a,E11.3,a,E11.3,a)')
398  * ' E0=',e0, ' cosz=',cosz, ' firstz=',
399  * firstz, ' g/cm2'
400 ! here we use enhanced limit
401  call howmuch(limite, e0, nn, cosz)
402 
403 !
404  do i = 1, noofsites
405  sumeloss(i) = 0.
406  ng(i) = 0.
407  ne(i) = 0.
408  nmu(i) = 0.
409  nhad(i) = 0.
410  enddo
411 
412  obstimes = 0.
413 
414  return
415 ! ***************
416  entry xobs(atrack, id)
417 !
418 ! For id =2, you need not output the z value, because it is always
419 ! 0 (within the computational accuracy).
420 !
421 ! ------------------------------------------
422  if(fai0 .ne. 0. ) then
423 ! rotate to the web system
424  call det2web( atrack.vec.w.r(1), atrack.vec.w.r(2),
425  * atrack.vec.w.r(1), atrack.vec.w.r(2))
426  call det2web( atrack.pos.xyz.x, atrack.pos.xyz.y,
427  * atrack.pos.xyz.x, atrack.pos.xyz.y)
428  endif
429 ! ------------------------------------------
430  obstimes = obstimes + 1.d0
431  if(mod(obstimes, 500000.d0) .eq. 0. ) then
432  dosort=.false.
433  do i = 1, min(4,stack_pos)
434  if(stack(i).p.fm.p(4) .ne. savederg(i)) then
435  savederg(i)=stack(i).p.fm.p(4)
436  dosort=.true.
437  endif
438  enddo
439  if(dosort) then
440  call csortstack
441  endif
442 #if defined (DOMPI)
443  write(0, *)'rank=',mpirank,' obstimes=', obstimes,
444  * ' ptclE=',atrack.p.fm.p(4)
445 #else
446  write(0, *),' obstimes=', obstimes,
447  * ' ptclE=',atrack.p.fm.p(4)
448 #endif
449  do i = 1, min(4,stack_pos)
450  write(0,*)' stack tops=', stack(i).p.fm.p(4)
451  enddo
452  endif
453 ! ***************
454  code = atrack.p.code
455  ldep = atrack.where
456 
457  if(id .eq. 2 .and. code .le. 6) then
458  codex=min(code, 4)
459  wz = atrack.vec.w.r(3) ! downgoing < 0
460  if(wz .gt. 0) return
461  wz = -wz
462  if( keepweight ) then
463  wgt = atrack.wgt
464  enhance= enhance0*wgt
465  else
466  wgt = 1.
467  enhance= enhance0
468  endif
469 
470  if(code .eq. kphoton) then
471  ng(ldep) = ng(ldep) + enhance
472  elseif(code .eq. kelec) then
473  ne(ldep) = ne(ldep) + enhance
474  elseif(code .eq. kmuon) then
475  nmu(ldep) = nmu(ldep) + enhance
476  else
477  nhad(ldep)=nhad(ldep) + enhance
478  endif
479 
480  r = sqrt( atrack.pos.xyz.x**2 +
481  * atrack.pos.xyz.y**2 )
482 
483  ek = atrack.p.fm.p(4) -atrack.p.mass
484 
485 ! ------------- compute energy loss rate
486  if(atrack.p.charge .ne. 0 ) then
487 
488 ! -----------------
489 ! /| |
490 ! / | 1g/cm2k
491 ! /A | |
492 ! -------------------
493 ! / ptcl direction
494 ! get energy loss when aTrack goes some distance
495 ! of which vertical gramage is 1g/cm2.
496 ! Gramage the particle travel is
497 ! 1/cos where cos is the cos of angle (i.e, A if Fig)
498 ! in the detctor system.
499 ! 1g/cm^2 = 10-3kg/10-4 m^2 =10 kg/m^2.
500 ! To travel 1 g/cm^2 along shower axis, the ptcl must
501 ! run dist kg/m^2
502  if(abs(wz) .gt. 1.d-2) then
503  dist =10./wz ! in kg/m2/(g/cm2)
504  else
505 ! for safety
506  dist =1000.
507  endif
508  if( heobs ) then
509 ! the ptcls is the one obsrved at skeleton making time
510 ! we must compute dE/dt here
511  rho = cvh2den(atrack.pos.height)
512  call cdedxinair(atrack.p, rho, dedt) ! dedt; GeV/(kg/m2)
513  if(atrack.p.code .eq. kmuon ) then
514 ! dE/dx due to muon pair, brem, nuc.i
515  call cmudedx(muni, mubr, mupr, atrack.p.fm.p(4),
516  * dedxmu) ! dedxmu in GeV/(g/cm2)
517  dedxmu = dedxmu /10. ! GeV/(kg/m2)
518  dedt = dedt + dedxmu
519  endif
520  else
521 ! we can use already computed one
522  call cqelossrate(dedt) ! loss rate GeV/(kg/m^2)
523  endif
524 ! energy in 1 g/cm2 of vertical direction
525  eloss =min( dedt*dist, dble(ek)) * enhance ! GeV/(g/cm2)
526 
527  sumeloss(ldep)=sumeloss(ldep) + eloss
528  else
529  eloss=0.
530  endif
531 !
532 ! get web sector indexes (r and fai index )
533 !
534  molu = obssites(ldep).mu
535  rinmu =r/molu
536  sr = rinmu
537  if(rinmu .gt. rminm) then
538  ridx= log10(rinmu/rminm)/bin + 1
539  else
540  ridx =0
541  endif
542 ! fai is in -15 to 345 (for dfai=30.)
543  fai=getfai(atrack.pos.xyz.x, atrack.pos.xyz.y)
544  fai= mod(fai + 360.d0, 360.d0)
545  if(fai .gt. (360.d0-dfai/2.0d0)) fai= fai-360.d0
546  faiidx=(fai+dfai/2.0d0) /dfai + 1
547 !
548  if(ridx .gt. 0 .and. ridx .le. nrbin ) then
549 ! for all particles
550  nrfaiall(ridx, faiidx, codex, ldep) =
551  * nrfaiall(ridx, faiidx, codex, ldep) + enhance
552  if(seelowde) then
553 ! separate low energy contribution ; Eloss = 0 for neutral
554  if(ek .gt. 500.d-6) then
555  derfai(ridx, faiidx, ldep) =
556  * derfai(ridx, faiidx, ldep) + eloss
557  else
558  derfai2(ridx, faiidx, ldep) =
559  * derfai2(ridx, faiidx, ldep) + eloss
560  endif
561  else
562 ! don't separate low E and high E ptcls
563  derfai(ridx, faiidx, ldep) =
564  * derfai(ridx, faiidx, ldep) + eloss
565  endif
566 !
567 ! ==============
568 ! for individual particle
569  ji = w2il(ldep) ! indivdep index.
570  if(ji .gt. 0 ) then
571  prob = recprob(ridx, codex, ji)
572  if(prob .gt. 1.) then
573  wwgt = wgt
574  accept = .true.
575  else
576 ! Example: if prob=10^-3 and wgt=2x10^3,
577 ! record it with weight =2 (=prob*wgt)
578  prob = prob*wgt ! wgt =1 or wgt > 1
579  if(prob .gt. 1.) then
580  wwgt = prob
581  accept = .true.
582  else
583  call rndc(u)
584  if(u .lt. prob) then
585  accept =.true.
586  wwgt=1.
587  else
588  accept = .false.
589  endif
590  endif
591  endif ! computtion of accept end
592  if(accept) then
593  nrfairec(ridx, faiidx, codex, ji) =
594  * nrfairec(ridx, faiidx, codex, ji) + wwgt
595 #if FNODATDEF > 0
596  if(bufc .lt. bufsize) then
597  bufc = bufc + 1
598  buf(bufc).ldep=ldep
599  buf(bufc).code=code
600  buf(bufc).subcode=atrack.p.subcode
601  buf(bufc).charge = atrack.p.charge
602  buf(bufc).ridx=ridx
603  buf(bufc).faiidx= faiidx
604  buf(bufc).rinmu = rinmu
605  buf(bufc).fai= fai
606  buf(bufc).ek = ek
607  buf(bufc).t = atrack.t
608  buf(bufc).wx=-atrack.vec.w.r(1)
609  buf(bufc).wy=-atrack.vec.w.r(2)
610  buf(bufc).wz=wz
611  buf(bufc).wgt = wwgt ! not wgt
612  else
613 #if BUFSIZE > 200000
614  write(0,*) ' too many partciles --> buf'
615  write(0,*) ' you must make BUFSIZE in interface.f'
616  write(0,*) ' to the standard value (<2x10^5) '
617  stop
618 #else
619  write(fnodat) bufc, buf
620  bufc= 0
621 #endif
622  endif
623 #else
624  write(*,
625  * '(6i3, 1pE11.3, 0p,f6.1,1p2E11.3,0p,2f8.4,f10.6,1pE11.3)'
626  * )
627  * ldep, code, atrack.p.subcode,
628  * atrack.p.charge, ridx, faiidx,
629  * rinmu, fai,
630  * ek, atrack.t,
631  * -atrack.vec.w.r(1),
632  * -atrack.vec.w.r(2), wz, wwgt ! not wgt
633 #endif
634  endif ! end accepted ptcl treatment
635  endif ! end individual ptcl output treatment
636  endif ! ridx >0 ended
637 
638 
639 
640 ! ================ for histograming
641  i=w2hl(ldep)
642  if(i .gt. 0 ) then
643  if(tkarspec) then
644  call kwhist( rspec(codex,faiidx, i), sr, enhance)
645  endif
646 
647  if( tkrtspec ) then
648  if( ridx .eq. 0 ) then
649  call kwhist( tspec0(codex, i),
650  * sngl( atrack.t ), enhance)
651  elseif(ridx .le. nrbin) then
652  call kwhist( tspec(codex, ridx, faiidx, i),
653  * sngl( atrack.t ), enhance)
654  endif
655  endif
656  endif
657  endif ! code and id judge
658  return
659 ! **************
660  entry xenevent
661 ! **************
662 #if FNODATDEF > 0
663 #if BUFSIZE < 200000
664  if(bufc .gt. 0) then
665  write(fnodat) bufc, buf
666  bufc=0
667  endif
668  close(fnodat)
669 #endif
670 #endif
671 
672 
673  firstz= zfirst.pos.depth*0.1
674 
675 #if defined (DOMPI)
676  write(0,*) ' rank=',mpirank, ' closed main file'
677  etime2 = mpi_wtime()
678  write(0,*) ' elapsed time for this event = ',
679  * etime2-etime1
680  call mpi_barrier(mpi_comm_world, icon)
681 #include "inc_gatherNrfai.f"
682 #include "inc_gatherHyb.f"
683  if( mpirank .eq. 0) then
684  write(0,*) " rank 0 is reading all data and combining now"
685 #include "inc_readAndput.f"
686  endif
687 #endif
688 #if defined (DOMPI)
689  if( mpirank .eq. 0) then
690 #endif
691 #include "inc_writeHyb.f"
692 #include "inc_writeNrfai.f"
693 #if defined (DOMPI)
694  endif
695 #endif
696 
697 ! fwollowings are not supported in MPI job.
698 #if ! defined (DOMPI)
699  do i = 1, hnsites
700  j = histdep(i)
701  write( evid(i),
702  * '(i3, f7.1, f6.3, f6.3, i5, i4)')
703  * histdep(i), asdepthlist(j)*0.1,
704  * asobssites(j).age, asdepthlist(j)*0.1/cog,
705  * int(asobssites(j).mu), int(cog)
706  enddo
707 
708  if(tkarspec) then
709  do i = 1, hnsites
710  k=histdep(i)
711  do j = 1, 4
712  write(dirstr,'(a,"/d",i4, "/")')
713  * ptcl(j), int( depthlist(k)*0.1 )
714  call kseblk(dirstr, "|", nstr)
715  do l = 1, nfai
716  call kwhistdir(rspec(j, l, i), dirstr)
717  call kwhists( rspec(j, l, i), 0. )
718  call kwhistev( rspec(j, l, i), eventno)
719  call kwhistid( rspec(j, l, i), evid(i))
720  call kwhistp( rspec(j, l, i), fno)
721 ! *********** deallocate ********
722  call kwhistd( rspec(j, l, i) )
723  enddo ! code loop
724  enddo ! fai loop
725  enddo ! depth loop
726  endif
727 
728  if( tkrtspec ) then
729  do i = 1, hnsites
730  do j = 1, 4
731  call kwhists( tspec0(j,i), 0.)
732  call kwhistev( tspec0(j,i), eventno)
733  call kwhistid( tspec0(j,i), evid(i))
734  k=histdep(i)
735  dirstr = " "
736  write( dirstr,'(a,"/d",i4, "/")')
737  * ptcl(j), int( asdepthlist(k)*0.1 )
738  call kseblk( dirstr, "|", nstr)
739  call kwhistdir( tspec0(j,i), dirstr )
740  call kwhistp( tspec0(j,i), fno )
741 ! *********** deallocate ********
742  call kwhistd( tspec0(j,i) )
743 
744  do ifai= 1, nfai
745  do ir= 1, nrbin
746  call kwhists( tspec(j,ir, ifai,i), 0.)
747  call kwhistev(tspec(j,ir, ifai,i), eventno)
748  call kwhistid( tspec(j,ir, ifai,i), evid(i))
749  dirstr = " "
750  write(dirstr,'(a,"/d",i4, "/F",i2,"/")')
751  * ptcl(j), int( depthlist(k)*0.1), ifai
752  call kseblk(dirstr, "|", nstr)
753  call kwhistdir(tspec(j,ir, ifai,i), dirstr)
754  call kwhistp( tspec(j,ir, ifai,i), fno)
755 ! *********** deallocate ********
756  call kwhistd( tspec(j, ir, ifai, i) )
757  enddo
758  enddo
759  enddo ! code loop
760  enddo ! depth loop
761  endif
762 #endif
763 
*Zfirst p fm *Zfirst p Zfirst p Zfirst p *Zfirst p *Zfirst pos xyz Zfirst pos xyz *Zfirst pos *Zfirst pos depth
Definition: ZavoidUnionMap.h:1
void kwhistid(struct histogram1 *h, char *id)
subroutine howmuch(limit, E0, NN, cosz)
Definition: howmuch.f:2
subroutine cqincident(incident, AngleAtObs)
Definition: cmkIncident.f:486
integer lengid integer lengdir character *dir integer kgetenv2 character *numb character *execid character *msg logical takehist save do nsites histdep(i)=0indivdep(i)=0enddo leng
integer nsites ! max real bin
Definition: Zprivate0.h:2
integer function kgetenv2(envname, envresult)
Definition: cgetLoginN.f:77
others if is ng
Definition: cblkManager.h:9
*Zfirst p fm *Zfirst p Zfirst p Zfirst p *Zfirst p *Zfirst pos xyz r
Definition: ZavoidUnionMap.h:1
nodes i
! for length to thickness conversion or v v ! integer maxnodes real Hinf ! This is used when making table for dim simulation ! The slant length for vertical height to km is ! divided by LenStep m steps ! It can cover the slant length of about km for cos
Definition: Zatmos.h:8
const int kphoton
Definition: Zcode.h:6
latitude latitude this system is used *****************************************************************! type coord sequence union map real z z in m endmap xyz map real ! latitude in deg is to the north ! longitude in deg is to the east *h ! height in m endmap llh map real ! polar angle ! azimuthal angle *radius ! radial distance endmap sph endunion character *sys ! which system xyz
Definition: Zcoord.h:25
void kwhistp(struct histogram1 *h, FILE *fno)
Definition: Ztrack.h:44
int nmu[nl][nth]
Definition: Zprivate.h:12
subroutine cmudedx(flagN, flagBr, flagPr, Emu, dEdx, dEdxF)
Definition: cmudEdx.f:2
void kwhisti(struct histogram1 *h, float ixmin, float ibinORxmax, int inbin, int itklg)
void kwhistd(struct histogram1 *h)
max ptcl codes in the kelec
Definition: Zcode.h:2
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
void kwhistev(struct histogram1 *h, int evno)
logical KeepWeight ! see setupenv sh logical tkarspec ! get lateral histo in a web fai bin logical tkrtspec ! get time histo in each web bin logical SeeLowdE common Zprivatec2 tkrtspec
Definition: Zprivate4.h:7
void kwhist(struct histogram1 *h, float x, float w)
void kwhistdir(struct histogram1 *h, char *dir)
int ne[nl][nth]
Definition: Zprivate.h:11
subroutine rndc(u)
Definition: rnd.f:91
const int maxnoofassites
Definition: Zobs.h:12
! timing nrbin
Definition: Zprivate2.h:12
********************block data cblkHeavy ********************integer j data *HeavyG2symbol p
Definition: cblkHeavy.h:7
subroutine det2web(x, y, xs, ys)
Definition: interface.f:789
integer mpirank
Definition: Zmpibasic.h:1
********************block data cblkHeavy ********************integer j data *HeavyG2symbol *data *HeavyG2code kiron data j
Definition: cblkHeavy.h:36
void kwhistso(int binw)
subroutine cdedxinair(aPtcl, rhoin, dedt, dedtF)
Definition: cdedxInAir.f:49
logical KeepWeight ! see setupenv sh logical tkarspec ! get lateral histo in a web fai bin logical tkrtspec ! get time histo in each web bin logical SeeLowdE common Zprivatec2 tkarspec
Definition: Zprivate4.h:7
integer w2hl(nsites)
*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
*Zfirst p fm *Zfirst p Zfirst p Zfirst p *Zfirst p *Zfirst pos xyz Zfirst pos xyz *Zfirst pos *Zfirst pos Zfirst pos height
Definition: ZavoidUnionMap.h:1
real *8 function getfai(x, y)
Definition: interface.f:782
latitude latitude this system is used *****************************************************************! type coord sequence union map real y
Definition: Zcoord.h:25
dE dx *! Nuc Int sampling table d
Definition: cblkMuInt.h:130
void kwhistc(struct histogram1 *h)
real *8 function cvh2den(z)
Definition: ciniSegAtoms.f:54
*Zfirst p fm *Zfirst p Zfirst p Zfirst p *Zfirst p charge
Definition: ZavoidUnionMap.h:1
block data include Zlatfit h c fitting region data data data data data d0 data data d0 data data m
Definition: ZlatfitBD.h:35
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
subroutine csortstack
Definition: cstack.f:102
nodes t
void kwhistai(struct histogram1 *h, char *title, char *categ, char *dNunit, int logv, float pw, char *label, char *unit)
real(4), save b
Definition: cNRLAtmos.f:21
void kwhists(struct histogram1 *h, float inorm)
Definition: Zptcl.h:75
Definition: Zcoord.h:43
*Zfirst p fm *Zfirst p mass
Definition: ZavoidUnionMap.h:1
max ptcl codes in the kmuon
Definition: Zcode.h:2
*Zfirst p fm *Zfirst p Zfirst p Zfirst p *Zfirst p *Zfirst pos xyz Zfirst pos xyz *Zfirst pos *Zfirst pos Zfirst pos *Zfirst pos *Zfirst Zfirst vec w *Zfirst vec w Zfirst vec *Zfirst wgt
Definition: ZavoidUnionMap.h:1
integer, parameter fno
Definition: chook.f:43
subroutine kseblk(text, c, lc)
Definition: kseblk.f:18
subroutine cmintime2websec(obsdetxyz, ldep, depidx, awebmin)
! timing nfai
Definition: Zprivate2.h:12
! 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
*Zfirst p fm *Zfirst p Zfirst p Zfirst p subcode
Definition: ZavoidUnionMap.h:1
dE dx *! Nuc Int sampling table f
Definition: cblkMuInt.h:130
Here is the call graph for this function: