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

Go to the source code of this file.

Functions/Subroutines

program __smashskel.f__
 
subroutine distribute (n)
 
subroutine memoforcpu (n)
 
subroutine issuemsg (n)
 
subroutine sortbyerg
 
subroutine movetrack (f, t)
 

Function/Subroutine Documentation

◆ __smashskel.f__()

program __smashskel.f__ ( )

Definition at line 37 of file smashSkel.f.

References cerrormsg(), copenf(), copenfw2(), cpupw(), distribute(), i, issuemsg(), kgetenv2(), klena(), ksplit(), maxp, memoforcpu(), movetrack(), n, sortbyerg(), and true.

37  type(child):: cc
Definition: Zprivate.h:25
Here is the call graph for this function:

◆ distribute()

subroutine distribute ( integer  n)

Definition at line 205 of file smashSkel.f.

References cerrormsg(), cpupw(), erg, idx(), idxlocal(), kqsortd(), ksortinv(), sumergi(), and sumergw().

205  implicit none
206 #include "Ztrack.h"
207  include "../../SkelFlesh/Zprivate.h"
208  include "Zprivate2.h"
209  integer i, k
210  integer n, j
211 
212  do i = 1, ncpu
213  sumergi(i)= 0.
214  sumergw(i) = 0.
215  noncpu(i) = 0
216  enddo
217  do i = 1, n
218 ! max energy ptcl for i-th cpu
219  sumergi(i) = erg(idx(i))
220  sumergw(i) = erg(idx(i)) / cpupw(i)
221  noncpu(i) = 1
222  idxlist(1, i) = idx(i)
223  idxlocal(i) = i
224  enddo
225 ! if all cpupw =1, next two not needed
226  call kqsortd(sumergw, idxlocal, n)
227  call ksortinv(idxlocal, n)
228 
229 !///////////
230 ! write(0,*) ' top E=',(sumergi(i), i=1, n)
231 ! write(0,*) ' idx=',(idx(i), i=1, n)
232 !////////
233 ! next explanation is for cpupw = 1
234 ! erg idx sumergi idxlocal nOnCpu idxlist
235 ! 1,1
236 ! 1 9 5 30 1 1 5
237 ! 2 1 3 18 2 1 3
238 ! n 3 18 7 15 3 1 7
239 ! 4 5 8
240 ! 5 30 1
241 ! 6 4 4
242 ! 7 15
243 ! 8 13
244 ! .
245 ! .
246 ! . 6
247 ! ctc . 2
248 !
249 ! after j= 4
250 ! sumergi idxlocal nOnCpu idxlist
251 ! 1 2
252 ! 30 1 1 5
253 ! 18 2 1 3
254 ! 28 3 2 7 8
255 ! after j=5
256 ! sumergi idxlocal nOnCpu idxlist
257 ! 1 2
258 ! 30 1 1 5
259 ! 27 3 2 3 1
260 ! 28 2 2 7 8
261 ! after j=6
262 ! sumergi idxlocal nOnCpu idxlist
263 ! 1 2 3
264 ! 30 1 1 5
265 ! 32 3 3 3 1 4
266 ! 28 2 2 7 8
267 !
268  do j = n+1, ctc
269  if(n .ge. 2) then
270  if( sumergw( idxlocal(n) ) .gt.
271  * sumergw( idxlocal(n-1) ) ) then
272  call kqsortd(sumergw, idxlocal, n)
273  call ksortinv(idxlocal, n)
274  endif
275  endif
276  k = idxlocal(n)
277  noncpu( k ) = noncpu( k ) + 1
278  if( noncpu( k ) .gt. maxptclpercpu ) then
279  write(msg, *)
280  * '# of ptcls on a cpu', k, ' exceeded limit=',
281  * maxptclpercpu
282  call cerrormsg(msg, 1)
283  call cerrormsg('Enlarge MaxPtclPerCpu in Zprivate2.h',0)
284  endif
285  idxlist( noncpu(k), k ) = idx(j)
286  sumergw(k) = sumergw(k) + erg(idx(j))/cpupw(k)
287  sumergi(k) = sumergi(k) + erg(idx(j))
288  enddo
289 
subroutine cerrormsg(msg, needrtn)
Definition: cerrorMsg.f:4
nodes i
averg real * sumergi(MaxCPU)
averg real MaxCPU integer idx(Maxp)
********************block data cblkHeavy ********************integer j data *HeavyG2symbol *data *HeavyG2code kiron data j
Definition: cblkHeavy.h:36
subroutine kqsortd(A, ORD, N)
Definition: kqsortd.f:23
subroutine ksortinv(idx, n)
Definition: ksortinv.f:2
averg real sumergw(MaxCPU)
averg real MaxCPU integer idxlocal(MaxCPU) integer numba(MaxCPU) integer ctc
float erg[maxp]
Definition: Zprivate.h:7
averg real cpupw(MaxCPU) integer nOnCpu(MaxCPU) integer idxlist(MaxPtclPerCpu
integer n
Definition: Zcinippxc.h:1
Here is the call graph for this function:

◆ issuemsg()

subroutine issuemsg ( integer  n)

Definition at line 319 of file smashSkel.f.

References cerrormsg(), cpupw(), and sumergi().

319  implicit none
320 #include "Ztrack.h"
321  include "../../SkelFlesh/Zprivate.h"
322  include "Zprivate2.h"
323 
324  integer n
325  integer i
326 
327  msg = ' cpu# cpuPW Sum E # of ptcls'
328 ! msg = 'cpu# Sum E # of ptcls'
329  call cerrormsg(msg, 1)
330  do i = 1, n
331  write(msg,'(i4, f7.1, g16.7, i9)')
332 ! write(msg,'(i3, g16.7, i9)')
333  * i, cpupw(i), sumergi(i), noncpu(i)
334 ! * i, sumergi(i), nOnCpu(i)
335  call cerrormsg(msg, 1)
336  enddo
subroutine cerrormsg(msg, needrtn)
Definition: cerrorMsg.f:4
nodes i
averg real * sumergi(MaxCPU)
averg real cpupw(MaxCPU) integer nOnCpu(MaxCPU) integer idxlist(MaxPtclPerCpu
integer n
Definition: Zcinippxc.h:1
Here is the call graph for this function:

◆ memoforcpu()

subroutine memoforcpu ( integer  n)

Definition at line 293 of file smashSkel.f.

293  implicit none
294 #include "Ztrack.h"
295  include "../../SkelFlesh/Zprivate.h"
296  include "Zprivate2.h"
297 
298  integer n
299 
300  integer i, j
301 
302  do i = 1, n
303  if(i .eq. 1) then
304 ! for the first skeleton, put observed ptcls
305  write(basefn+i) np
306  do j = 1, np
307  write(basefn+1) oo(j)
308  enddo
309  else
310  write(basefn+i) 0
311  endif
312  write(basefn+i) noncpu(i)
313  do j = 1, noncpu(i)
314  write(basefn+i) ct( idxlist(j, i) )
315  enddo
316  enddo
nodes i
********************block data cblkHeavy ********************integer j data *HeavyG2symbol *data *HeavyG2code kiron data j
Definition: cblkHeavy.h:36
integer n
Definition: Zcinippxc.h:1

◆ movetrack()

subroutine movetrack ( type(child f,
type(track t 
)

Definition at line 375 of file smashSkel.f.

References asflag, charge, code, colheight, cresetdirec(), depth, height, mass, p, r, radiallen, subcode, sys, wgt, and xyz.

375  implicit none
376 #include "Ztrack.h"
377 #include "Zearth.h"
378  include "../../SkelFlesh/Zprivate.h"
379  include "Zprivate2.h"
380 
381  type(child):: f
382  type(track):: t
383 
384  t.p.code = f.code
385  t.p.subcode = f.subcode
386  t.p.charge = f.charge
387  t.p.fm.p(1) = f.fm(1)
388  t.p.fm.p(2) = f.fm(2)
389  t.p.fm.p(3) = f.fm(3)
390  t.p.fm.p(4) = f.fm(4)
391  t.p.mass = f.mass
392  t.pos.xyz.r(1) = pp.posx
393  t.pos.xyz.r(2) = pp.posy
394  t.pos.xyz.r(3) = pp.posz
395 
396  t.pos.depth = pp.depth
397  t.pos.height = pp.height
398  t.pos.colheight = pp.colheight
399  t.t = pp.atime
400  t.where = pp.where
401  t.pos.radiallen =
402  * eradius + pp.height
403  t.pos.xyz.sys = 'xyz'
404  t.vec.w.sys = 'xyz'
405  t.wgt = 1.0
406  t.asflag = 0
407 
408  call cresetdirec( t )
*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
*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 colheight
Definition: ZavoidUnionMap.h:1
*Zfirst p fm *Zfirst p Zfirst p Zfirst p *Zfirst p *Zfirst pos xyz r
Definition: ZavoidUnionMap.h:1
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
Definition: Ztrack.h:44
*Zfirst p fm *Zfirst p Zfirst p Zfirst p *Zfirst p *Zfirst pos xyz Zfirst pos xyz sys
Definition: ZavoidUnionMap.h:1
subroutine cresetdirec(aTrack)
Definition: cresetDirec.f:5
********************block data cblkHeavy ********************integer j data *HeavyG2symbol p
Definition: cblkHeavy.h:7
*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 Zfirst Zfirst asflag
Definition: ZavoidUnionMap.h:1
*Zfirst p fm *Zfirst p Zfirst p code
Definition: ZavoidUnionMap.h:1
*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
*Zfirst p fm *Zfirst p Zfirst p Zfirst p *Zfirst p charge
Definition: ZavoidUnionMap.h:1
Definition: Zprivate.h:25
nodes t
*Zfirst p fm *Zfirst p mass
Definition: ZavoidUnionMap.h:1
*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
*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
*Zfirst p fm *Zfirst p Zfirst p Zfirst p *Zfirst p *Zfirst pos xyz Zfirst pos xyz *Zfirst pos radiallen
Definition: ZavoidUnionMap.h:1
Here is the call graph for this function:

◆ sortbyerg()

subroutine sortbyerg ( )

Definition at line 341 of file smashSkel.f.

References cerrormsg(), erg, idx(), kqsortd(), ksortinv(), and p.

341  implicit none
342 #include "Ztrack.h"
343  include "../../SkelFlesh/Zprivate.h"
344  include "Zprivate2.h"
345 
346  integer i
347 
348  averg = 0.
349  do i = 1, ctc
350  erg(i) = ct(i).p.fm.p(4)
351  averg = averg + erg(i)
352  enddo
353  call kqsortd(erg, idx, ctc)
354 ! high to low
355  call ksortinv(idx, ctc)
356  if(ctc .gt. 0.) then
357 ! average total energy on 1 cpu
358  averg = averg/ctc * ncpu
359  else
360  call cerrormsg('no need to flesh; no child',0)
361  endif
362  if( erg(idx(ctc) ) .gt. averg*1.1 ) then
363 ! max energy is too large. issue
364 ! warning
365  write(msg,*) 'WARGNING: max E=', erg(idx(i)),
366  * ' is > average total energy for 1 cpu=',
367  * averg
368  call cerrormsg(msg, 1)
369  endif
subroutine cerrormsg(msg, needrtn)
Definition: cerrorMsg.f:4
nodes i
averg real MaxCPU integer idx(Maxp)
********************block data cblkHeavy ********************integer j data *HeavyG2symbol p
Definition: cblkHeavy.h:7
subroutine kqsortd(A, ORD, N)
Definition: kqsortd.f:23
subroutine ksortinv(idx, n)
Definition: ksortinv.f:2
float erg[maxp]
Definition: Zprivate.h:7
Here is the call graph for this function: