16 #include "Zprivate2.h" 17 #include "../Zabsorb.h" 26 type(
coord):: pdir, cdir
33 integer i,
j, k,
m, icon
38 integer ir, ifai, l, ridx, faiidx
40 real*8 fai0, fai, sint
46 real*8 r, eloss, rinmu, cosang
47 real*8 dedt, dedtf, rho, dist, disto, binfai
49 real*8 wx, wy, wz,
temp 58 data ptcln/
"Photons",
"Electrons",
"Muons",
"hadron"/
60 data ptcl2/
"Electrons",
"Muons",
"All"/
63 data power/1.,1.,1., 1./
67 character*96 evid(nsites)
69 real*8 cog, cog2, sumne, obstimes, savederg(5)
70 real*8 firstcdepth, dd
73 real*8 sumebydedx, sumebydeath,sumebydeathneu,sumebydeathnut
74 real*8 sumebydeathe, sumebydeathg, sumebydeathmupik,
75 * sumebydeathp, sumebydeatho
76 real*8 sumecrash, sumespace
77 real*8 sumall, sumdeinair, summissing, sumuncertain
82 include
"interface1.h" 125 fai0 = atan2(-angle.
r(2), -angle.
r(1))*todeg
126 sint = sqrt(1.0-cosz**2)
128 if(inci.
p.
code .eq. 9)
then 130 elseif(inci.
p.
code .eq. 1)
then 136 write(0,
'("i ", i6, i4, g13.4,3f11.7,f7.1)')
137 * eventno, inci.
p.
code,
138 * inci.
p.fm.
e, -angle.
r(1), -angle.
r(2), -angle.
r(3)
139 write(0,
'(a, 1p, 6g15.5)')
140 *
'### ', detxaxis.
r(1:3), detzaxis.
r(1:3)
152 derfai(ir, ifai,
i) = 0.
178 * -5., 0.05, 200,
b'00000')
180 *
"Arrival time dist. of "//ptcln(
j)//
" at center",
181 *
"t",
"ptcls", .
false., 0.,
"time",
"ns")
187 if(reducedtime .eq. 1)
then 188 tmin = webmin(ir, 7,
i)
190 tmin = webmin(ir, ifai,
i)
192 dt = 0.01*10.0**(
bin*(ir-1))*100.
193 dt = dt**0.75*1.e9/3.0e8/100.
196 if(
j .eq. 4) dt=dt*10.0*ir/35.0
200 * tmin, dt, 2000,
b'00000')
203 *
"Arrival time of "//ptcln(
j)//
" at (r,fai)",
204 *
"rt",
"ptcls", .
false., 0.,
"time",
"ns")
222 *
"Lateral Dist. of "//ptcln(
j)//
" at diff. azimuth",
223 *
"ar",
"ptcls", .
true., power(
j),
"r",
"m.u")
236 entry xobs(atrack, id)
241 obstimes = obstimes + 1.
d0 242 if(mod(obstimes, 100000.
d0) .eq. 0. )
then 244 do i = 1, min(4,stack_pos)
245 if(stack(
i).
p.fm.
p(4) .ne. savederg(
i))
then 246 savederg(
i)=stack(
i).
p.fm.
p(4)
253 write(0, *)
' obstimes=', obstimes,
' ptclE=',atrack.
p.fm.
p(4)
254 do i = 1, min(4,stack_pos)
255 write(0,*)
' stack tops=', stack(
i).
p.fm.
p(4)
262 if(id .eq. 2 .and.
code .le. 6 )
then 263 wz = atrack.vec.w.
r(3)
266 r = sqrt( atrack.pos.
xyz.
x**2 +
267 * atrack.pos.
xyz.
y**2 )
268 molu = obssites(ldep).mu
271 ridx = (log10( rinmu/rmin )/
bin +0.5) +1
273 ek = atrack.
p.fm.
p(4) -atrack.
p.
mass 276 ng(ldep) =
ng(ldep) + atrack.
wgt 278 ne(ldep) =
ne(ldep) + atrack.
wgt 281 elseif(
code .le. 6)
then 282 nhad(ldep) = nhad(ldep) +atrack.
wgt 285 if(atrack.
p.
charge .ne. 0 )
then 300 if(abs(wz) .gt. 1.
d-2)
then 307 call cqelossrate(dedt,dedtf)
311 eloss =min(
real(dedtF*dist), ek)
312 eloss = eloss*atrack.
wgt 313 sumeloss(ldep)=sumeloss(ldep) + eloss
319 if( atrack.
p.
charge .ne. 0 .or.
320 *
w2hl(ldep) .gt. 0 )
then 323 aa=atan2(atrack.pos.
xyz.
y, atrack.pos.
xyz.
x)*
326 aa= mod(aa + 360.
d0, 360.
d0)
327 if(aa .gt. (360.
d0-dfai/2.0
d0)) aa= aa-360.
d0 328 faiidx=(aa+dfai/2.0
d0) /dfai + 1
329 if(ridx .ge. 1 .and. ridx .le.
nrbin)
then 330 derfai(ridx, faiidx, ldep) = derfai(ridx, faiidx, ldep)
332 elseif(ridx .le. 0)
then 333 decent(ldep) = decent(ldep) + eloss
340 if(
w2hl(ldep) .gt. 0 )
then 349 if(reducedtime .eq. 1)
then 350 delta =
r*(
cos(fai) + 1.)*sint*1.d9/
c 351 stime = stime + delta
357 elseif(ir .le.
nrbin)
then 377 write(0,*)
'ev#=',eventno,
378 *
' generation phase finished. now writing data' 380 call cgetfname(basefilename, basefilename2)
382 firstcdepth = firstcdepth* 0.1
389 do i = 1, noofassites
390 if(
i .gt. 1 .and.
i .lt. noofassites )
then 391 dd =(asdepthlist(
i+1) - asdepthlist(
i-1))/2.0
392 elseif(
i .eq. 1)
then 393 dd =(asdepthlist(2) - asdepthlist(1))
395 dd =(asdepthlist(noofassites) -
396 * asdepthlist(noofassites-1))
398 cog = cog + asobssites(
i).esize*dd*asdepthlist(
i)
399 sumne= sumne +asobssites(
i).esize*dd
406 do i = 1, noofassites
407 if( asobssites(
i).age .gt.
408 * (2.0-asobssites(noofassites).age))
then 409 if(
i .gt. 1 .and.
i .lt. noofassites )
then 410 dd =( asdepthlist(
i+1) - asdepthlist(
i-1))/2.0
411 elseif(
i .eq. 1)
then 412 dd =(asdepthlist(2) - asdepthlist(1))
414 dd =(asdepthlist(noofassites) -
415 * asdepthlist(noofassites-1))
418 cog2 = cog2 + asobssites(
i).esize*asdepthlist(
i)*dd
419 sumne= sumne +asobssites(
i).esize*dd
422 if(sumne .gt. 0.)
then 423 cog2 = cog2*0.1/sumne
426 cog2 = asdepthlist(noofassites)*0.1
429 filename = basefilename2(1:
klena(basefilename2))//
".hyb" 430 call copenfw2(fnob, filename, 1, icon)
433 *
'("h ", i4, 3i3, 1pE11.3, 0p 3f11.7, 1pE11.3, 0p, 435 * eventno, inci.
p.
code,
437 * inci.
p.fm.
e, -angle.
r(1), -angle.
r(2), -angle.
r(3),
438 * firstcdepth, cog, cog2, vn,
' /' 453 do i = 1, noofassites
454 if(eabsorb(1) .ne. 0)
then 455 write(fnob,
'("t ", i3, 2f7.1, 2f6.3, 458 * asdepthlist(
i)*0.1, asobssites(
i).mu,
459 * asobssites(
i).age, asdepthlist(
i)*0.1/cog2,
461 * asobssites(
i).esize, sumeloss(
i),
462 * debydedx(
i), debydeath(
i),
464 * debydeathg(
i), debydeathe(
i), debydeathmupik(
i),
465 * debydeathp(
i), debydeathnut(
i), debydeatho(
i)
467 if(
i .le. eabsorb(2) )
then 470 sumebydedx = sumebydedx + debydedx(
i)
471 sumebydeath = sumebydeath + debydeath(
i)
472 sumebydeathneu = sumebydeathneu +debydeathneu(
i)
473 sumebydeathnut = sumebydeathnut +debydeathnut(
i)
474 sumebydeathg = sumebydeathg + debydeathg(
i)
475 sumebydeathe = sumebydeathe + debydeathe(
i)
476 sumebydeathmupik = sumebydeathmupik +
478 sumebydeathp = sumebydeathp +debydeathp(
i)
479 sumebydeatho = sumebydeatho +debydeatho(
i)
482 write(fnob,
'("t ", i3, 2f7.1, 2f6.3, 485 * asdepthlist(
i)*0.1, asobssites(
i).mu,
486 * asobssites(
i).age, asdepthlist(
i)*0.1/cog2,
488 * asobssites(
i).esize, sumeloss(
i)
491 if(eabsorb(1) .ne. 0)
then 493 sumecrash = sumecrash + ecrash(
i)
494 sumespace = sumespace + espace(
i)
496 write(fnob,
'("b ", 1p7E11.3)') (espace(
i),
i=1,7)
497 write(fnob,
'("b ", 1p7E11.3, i4)') (ecrash(
i),
i=1,7),
500 *
'("c ",1p7E11.3)' )
501 * maxebreak, maxrelebreak, sumediff, sumabsediff,
502 * maxebreak(1)/inci.
p.fm.
p(4)
504 summissing = sumecrash + sumespace + sumebydeathneu
505 sumuncertain = sumebydeathnut
506 sumdeinair = sumebydedx + sumebydeath
507 sumall = sumdeinair + summissing + sumuncertain
509 write(fnob,
'("s ", 1p8E11.3)')
510 * sumebydedx, sumebydeath, sumdeinair,
511 * sumecrash, sumespace, sumebydeathnut,
512 * sumebydeathneu, sumall
514 write(fnob,
'("r ", 1p4E11.3)')
515 * sumdeinair/e0, sumuncertain/e0, summissing/e0, sumall/e0
517 write(fnob,
'("n ", 1p4E11.3)')
518 * sumdeinair/sumall, sumuncertain/sumall,summissing/sumall,
521 write(fnob,
'("a ", 1p5g12.3 )')
522 * sumebydeathg, sumebydeathe, sumebydeathmupik,
523 * sumebydeathp, sumebydeatho
532 *
'(i3, i5, f5.2, f5.2, 535 * asobssites(
j).age, asdepthlist(
j)*0.1/cog2,
536 * asobssites(
j).mu, int(cog2)
541 filename = basefilename2(1:
klena(basefilename2))//
"-r.hist" 542 call copenfw2(fnol, filename, binw, icon)
546 write(dirstr,
'(a,"/d",i4, "/")')
547 * ptcln(
j), int( depthlist(k)*0.1 )
548 call kseblk(dirstr,
"|", nstr)
566 filename = basefilename2(1:
klena(basefilename2))//
"-t.hist" 567 call copenfw2(fnot, filename, binw, icon)
576 write( dirstr,
'(a,"/d",i4, "/")')
577 * ptcln(
j), int( asdepthlist(k)*0.1 )
578 call kseblk( dirstr,
"|", nstr)
594 write(dirstr,
'(a,"/d",i4, "/F",i2,"/")')
595 * ptcln(
j), int( depthlist(k)*0.1), ifai
596 call kseblk(dirstr,
"|", nstr)
610 filename = basefilename2(1:
klena(basefilename2))//
".nrfai" 611 call copenfw2(fnon, filename, 1, icon)
614 *
'(i4,1pE11.3, 0p,i3, f8.4, 1pE11.3,0p, 4i4, 1p,8g11.3)')
615 * eventno, e0, nn, cosz, firstcdepth,
nrbin,
nfai, ansites,
616 * noofsites, keminobs
621 write(fnon,
'("dE/dx",f7.1, 3i4)' )
622 * depthlist(
i)*0.1,
i,
i, k
623 write(fnon,
'(1p10E11.3)')
624 * ( derfai(
m,k,
i),
m=1,
nrbin ), decent(
i)
631 write(0,*)
'ev#=',eventno,
' finished completely' subroutine cgetfname(fnin, fn)
void kwhistid(struct histogram1 *h, char *id)
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
dE dx *! Nuc Int sampling table e
subroutine csetmuonpol(val)
*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)
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
********************block data cblkHeavy ********************integer j data *HeavyG2symbol *data *HeavyG2code kiron data j
subroutine copenfw2(io, fnin, form, icon)
real(4), dimension(:), allocatable, save temp
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
subroutine cqfirstid(depth)
block data cblkEvhnp ! currently usable models data RegMdls ad *special data *Cekaon d0
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
integer function klena(cha)
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
dE dx *! Nuc Int sampling table c