61 #include "Zmanagerp.h" 71 #include "Zincidentv.h" 73 #include "Zprivate1.h" 74 #include "Zprivate2.h" 75 #include "Zprivate3.h" 76 #include "Zprivate4.h" 80 real*8 ager(maxmpisize)
81 real*8 esizer(maxmpisize)
85 integer lengnr, rank, rankc
95 #define REALLIMITg 15000 96 #define REALLIMITe 9000 97 #define REALLIMITmu 7500 98 #define REALLIMITh 7500 100 type(
track):: incident
101 type(
coord):: angleatobs
104 common /zheobs/ heobs
116 type(
coord):: tetafai
121 integer i,
j, k, icon, ir, l,
m 123 integer iij,
code, codex
124 integer i1, i2, ic, ifai, ji
126 real*8 r, eloss, rinmu, cosang
128 real*8 dedt, rho, dist, disto, dedxmu
138 integer ldep, ridx, faiidx, depidx
148 data ptcl/
"Photons",
"Electrons",
"Muons",
"hadrons"/
150 data ptcl2/
"Electrons",
"Muons",
"All"/
153 real e0, cosz, limit(4), limite(4)
154 data power/1.,1.,1.,1./
156 data power2/1.,1.,1.,1./
158 character*96 evid(nsites), plotid
159 real*8 cog, cog2, sumne, obstimes, savederg(5)
166 #include "interface2.h" 177 read(input(1:lengenv),*) limit
179 read(input(1:lengenv),*) binw
181 read(input(1:lengenv),*) ncpu
183 read(input(1:lengenv),*) mcpu
185 read(input(1:lengenv),*) margin
186 lengenv =
kgetenv2(
"SeeLowdE", input)
187 if(lengenv .le. 0)
then 188 write(0,*)
' SeeLowdE not given' 191 seelowde = input(1:lengenv) .eq.
"yes" 192 lengenv =
kgetenv2(
"KeepWeight", input)
193 keepweight = input(1:lengenv) .eq.
"yes" 196 enhance0 = enhance0/mcpu
198 limite(
i) = limit(
i) * enhance0
203 write(0,*)
' *** ncpu=',ncpu,
204 *
' mcpu=',mcpu,
' enhance factor=',enhance0
205 write(0,*)
' margin=',margin
217 if( indivdep(
i) .eq. 0)
exit 219 w2il( indivdep(
i) ) =
i 232 rminm = rmin/10.**(
bin/2.0
d0)
258 *
'("Lateral dist. of ",a," at given fai")')
261 * plotid,
"ar",
"ptcls", .
true., power(k),
279 * -5., 0.1, 200,
b'00000')
281 *
"Arrival time dist. of "//
ptcl(
j)//
" at center",
282 *
"t",
"ptcls", .
false., 0.,
"time",
"ns")
286 tmin = webmin(ir, ifai,
i)
287 dt = 0.01*10.0**(
bin*(ir-1))*100.
288 dt = dt**0.675*1.e9/3.0e8/30.
291 if(
j .eq. 4) dt=dt*10.0
294 * tmin, dt, 1000,
b'00000')
296 *
"Arrival time of "//
ptcl(
j)//
" at (r,faI)",
297 *
"rt",
"ptcls", .
false., 0.,
"time",
"ns")
334 nrfaiall(l, k,
j,
i) = 0.
336 if(seelowde) derfai2(l, k,
i) = 0.
346 nrfairec(l, k,
j,
i) = 0.
372 fai0 =
getfai( -angle.
r(1), -angle.
r(2))
382 cosrot =
cos(fai0*torad)
383 sinrot = sin(fai0*torad)
387 if(inci.
p.
code .eq. 9)
then 389 elseif(inci.
p.
code .eq. 1)
then 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=',
401 call howmuch(limite, e0, nn, cosz)
416 entry xobs(atrack, id)
422 if(fai0 .ne. 0. )
then 424 call det2web( atrack.vec.w.
r(1), atrack.vec.w.
r(2),
425 * atrack.vec.w.
r(1), atrack.vec.w.
r(2))
427 * atrack.pos.
xyz.
x, atrack.pos.
xyz.
y)
430 obstimes = obstimes + 1.
d0 431 if(mod(obstimes, 500000.
d0) .eq. 0. )
then 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)
443 write(0, *)
'rank=',
mpirank,
' obstimes=', obstimes,
444 *
' ptclE=',atrack.
p.fm.
p(4)
446 write(0, *),
' obstimes=', obstimes,
447 *
' ptclE=',atrack.
p.fm.
p(4)
449 do i = 1, min(4,stack_pos)
450 write(0,*)
' stack tops=', stack(
i).
p.fm.
p(4)
457 if(id .eq. 2 .and.
code .le. 6)
then 459 wz = atrack.vec.w.
r(3)
462 if( keepweight )
then 464 enhance= enhance0*
wgt 471 ng(ldep) =
ng(ldep) + enhance
473 ne(ldep) =
ne(ldep) + enhance
475 nmu(ldep) =
nmu(ldep) + enhance
477 nhad(ldep)=nhad(ldep) + enhance
480 r = sqrt( atrack.pos.
xyz.
x**2 +
481 * atrack.pos.
xyz.
y**2 )
483 ek = atrack.
p.fm.
p(4) -atrack.
p.
mass 486 if(atrack.
p.
charge .ne. 0 )
then 502 if(abs(wz) .gt. 1.
d-2)
then 515 call cmudedx(muni, mubr, mupr, atrack.
p.fm.
p(4),
522 call cqelossrate(dedt)
525 eloss =min( dedt*dist, dble(ek)) * enhance
527 sumeloss(ldep)=sumeloss(ldep) + eloss
534 molu = obssites(ldep).mu
537 if(rinmu .gt. rminm)
then 538 ridx= log10(rinmu/rminm)/
bin + 1
544 fai= mod(fai + 360.
d0, 360.
d0)
545 if(fai .gt. (360.
d0-dfai/2.0
d0)) fai= fai-360.
d0 546 faiidx=(fai+dfai/2.0
d0) /dfai + 1
548 if(ridx .gt. 0 .and. ridx .le.
nrbin )
then 550 nrfaiall(ridx, faiidx, codex, ldep) =
551 * nrfaiall(ridx, faiidx, codex, ldep) + enhance
554 if(ek .gt. 500.
d-6)
then 555 derfai(ridx, faiidx, ldep) =
556 * derfai(ridx, faiidx, ldep) + eloss
558 derfai2(ridx, faiidx, ldep) =
559 * derfai2(ridx, faiidx, ldep) + eloss
563 derfai(ridx, faiidx, ldep) =
564 * derfai(ridx, faiidx, ldep) + eloss
571 prob = recprob(ridx, codex, ji)
572 if(prob .gt. 1.)
then 579 if(prob .gt. 1.)
then 593 nrfairec(ridx, faiidx, codex, ji) =
594 * nrfairec(ridx, faiidx, codex, ji) + wwgt
596 if(bufc .lt. bufsize)
then 603 buf(bufc).faiidx= faiidx
604 buf(bufc).rinmu = rinmu
607 buf(bufc).
t = atrack.
t 608 buf(bufc).wx=-atrack.vec.w.
r(1)
609 buf(bufc).wy=-atrack.vec.w.
r(2)
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) ' 619 write(fnodat) bufc, buf
625 *
'(6i3, 1pE11.3, 0p,f6.1,1p2E11.3,0p,2f8.4,f10.6,1pE11.3)' 628 * atrack.
p.
charge, ridx, faiidx,
631 * -atrack.vec.w.
r(1),
632 * -atrack.vec.w.
r(2), wz, wwgt
644 call kwhist( rspec(codex,faiidx,
i), sr, enhance)
648 if( ridx .eq. 0 )
then 650 * sngl( atrack.
t ), enhance)
651 elseif(ridx .le.
nrbin)
then 652 call kwhist( tspec(codex, ridx, faiidx,
i),
653 * sngl( atrack.
t ), enhance)
665 write(fnodat) bufc, buf
673 firstz= zfirst.pos.
depth*0.1
676 write(0,*)
' rank=',
mpirank,
' closed main file' 678 write(0,*)
' elapsed time for this event = ',
680 call mpi_barrier(mpi_comm_world, icon)
681 #include "inc_gatherNrfai.f" 682 #include "inc_gatherHyb.f" 684 write(0,*)
" rank 0 is reading all data and combining now" 685 #include "inc_readAndput.f" 691 #include "inc_writeHyb.f" 692 #include "inc_writeNrfai.f" 698 #if ! defined (DOMPI) 702 *
'(i3, f7.1, f6.3, f6.3, i5, i4)')
704 * asobssites(
j).age, asdepthlist(
j)*0.1/cog,
705 * int(asobssites(
j).mu), int(cog)
712 write(dirstr,
'(a,"/d",i4, "/")')
713 *
ptcl(
j), int( depthlist(k)*0.1 )
714 call kseblk(dirstr,
"|", nstr)
736 write( dirstr,
'(a,"/d",i4, "/")')
737 *
ptcl(
j), int( asdepthlist(k)*0.1 )
738 call kseblk( dirstr,
"|", nstr)
750 write(dirstr,
'(a,"/d",i4, "/F",i2,"/")')
751 *
ptcl(
j), int( depthlist(k)*0.1), ifai
752 call kseblk(dirstr,
"|", nstr)
*Zfirst p fm *Zfirst p Zfirst p Zfirst p *Zfirst p *Zfirst pos xyz Zfirst pos xyz *Zfirst pos *Zfirst pos depth
void kwhistid(struct histogram1 *h, char *id)
subroutine howmuch(limit, E0, NN, cosz)
subroutine cqincident(incident, AngleAtObs)
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
integer function kgetenv2(envname, envresult)
*Zfirst p fm *Zfirst p Zfirst p Zfirst p *Zfirst p *Zfirst pos xyz r
! 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
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
void kwhistp(struct histogram1 *h, FILE *fno)
subroutine cmudedx(flagN, flagBr, flagPr, Emu, dEdx, dEdxF)
void kwhisti(struct histogram1 *h, float ixmin, float ibinORxmax, int inbin, int itklg)
void kwhistd(struct histogram1 *h)
max ptcl codes in the kelec
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
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
void kwhist(struct histogram1 *h, float x, float w)
void kwhistdir(struct histogram1 *h, char *dir)
********************block data cblkHeavy ********************integer j data *HeavyG2symbol p
subroutine det2web(x, y, xs, ys)
********************block data cblkHeavy ********************integer j data *HeavyG2symbol *data *HeavyG2code kiron data j
subroutine cdedxinair(aPtcl, rhoin, dedt, dedtF)
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
*Zfirst p fm *Zfirst p Zfirst p code
block data cblkEvhnp ! currently usable models data RegMdls ad *special data *Cekaon d0
*Zfirst p fm *Zfirst p Zfirst p Zfirst p *Zfirst p *Zfirst pos xyz Zfirst pos xyz *Zfirst pos *Zfirst pos Zfirst pos height
real *8 function getfai(x, y)
latitude latitude this system is used *****************************************************************! type coord sequence union map real y
dE dx *! Nuc Int sampling table d
void kwhistc(struct histogram1 *h)
real *8 function cvh2den(z)
*Zfirst p fm *Zfirst p Zfirst p Zfirst p *Zfirst p charge
block data include Zlatfit h c fitting region data data data data data d0 data data d0 data data m
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
void kwhistai(struct histogram1 *h, char *title, char *categ, char *dNunit, int logv, float pw, char *label, char *unit)
void kwhists(struct histogram1 *h, float inorm)
*Zfirst p fm *Zfirst p mass
max ptcl codes in the kmuon
*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
subroutine kseblk(text, c, lc)
subroutine cmintime2websec(obsdetxyz, ldep, depidx, awebmin)
! 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
*Zfirst p fm *Zfirst p Zfirst p Zfirst p subcode
dE dx *! Nuc Int sampling table f