1 #include "csoftenPiK.f" 18 #include "Zprivate2.h" 19 #include "../Zabsorb.h" 28 type(
coord):: pdir, cdir
35 integer i, j, k, m, icon
40 integer ir, ifai, l, ridx, faiidx
42 real*8 fai0, fai, sint
48 real*8 r, Eloss, rinmu, cosang
49 real*8 dedt, dedtF, rho, dist, disto, BinFai
51 real*8 wx, wy, wz, temp
60 data ptcln/
"Photons",
"Electrons",
"Muons",
"hadron"/
62 data ptcl2/
"Electrons",
"Muons",
"All"/
65 data power/1.,1.,1., 1./
69 character*96 evid(nsites)
71 real*8 cog, cog2, sumne, obstimes, Savederg(5)
72 real*8 firstcdepth, dd
75 real*8 sumEbydEdx, sumEbyDeath,sumEbyDeathNeu,sumEbyDeathNut
76 real*8 sumEbyDeathE, sumEbyDeathG, sumEbyDeathMuPiK,
77 * sumebydeathp, sumebydeatho
78 real*8 sumEcrash, sumEspace
79 real*8 sumAll, sumdEinAir, sumMissing, sumUncertain
83 real*8 pabs, rcore, sina, cs, sn, cf, mom(3), Ek8, u
87 include
"interface1.h" 126 if(inci.
p.code .eq.
kmuon)
then 130 fai0 = atan2(-angle.r(2), -angle.r(1))*todeg
131 sint = sqrt(1.0-cosz**2)
133 if(inci.
p.code .eq. 9)
then 135 elseif(inci.
p.code .eq. 1)
then 141 write(0,
'("i ", i6, i4, g13.4,3f11.7,f7.1)')
142 * eventno, inci.
p.code,
143 * inci.
p.fm.
e, -angle.r(1), -angle.r(2), -angle.r(3)
144 write(0,
'(a, 1p, 6g15.5)')
145 *
'### ', detxaxis.r(1:3), detzaxis.r(1:3)
157 derfai(ir, ifai, i) = 0.
183 * -5., 0.05, 200,
b'00000')
185 *
"Arrival time dist. of "//ptcln(j)//
" at center",
186 *
"t",
"ptcls", .
false., 0.,
"time",
"ns")
192 if(reducedtime .eq. 1)
then 193 tmin = webmin(ir, 7, i)
195 tmin = webmin(ir, ifai,i)
197 dt = 0.01*10.0**(
bin*(ir-1))*100.
198 dt = dt**0.75*1.e9/3.0e8/100.
201 if(j .eq. 4) dt=dt*10.0*ir/35.0
204 call kwhisti( tspec(j, ir, ifai, i),
205 * tmin, dt, 2000,
b'00000')
207 call kwhistai( tspec(j, ir, ifai, i),
208 *
"Arrival time of "//ptcln(j)//
" at (r,fai)",
209 *
"rt",
"ptcls", .
false., 0.,
"time",
"ns")
211 call kwhistc(tspec(j, ir, ifai, i))
224 call kwhisti(rspec(j, ifai, i),
227 *
"Lateral Dist. of "//ptcln(j)//
" at diff. azimuth",
228 *
"ar",
"ptcls", .
true., power(j),
"r",
"m.u")
230 call kwhistc( rspec(j, ifai, i) )
241 entry xobs(atrack, id)
247 obstimes = obstimes + 1.
d0 248 if(mod(obstimes, 100000.
d0) .eq. 0. )
then 250 do i = 1, min(4,stack_pos)
251 if(stack(i).
p.fm.
p(4) .ne. savederg(i))
then 252 savederg(i)=stack(i).
p.fm.
p(4)
259 write(0, *)
' obstimes=', obstimes,
' ptclE=',atrack.
p.fm.
p(4)
260 do i = 1, min(4,stack_pos)
261 write(0,*)
' stack tops=', stack(i).
p.fm.
p(4)
268 if(id .eq. 2 .and. code .le. 6 )
then 269 wz = atrack.vec.w.r(3)
272 r = sqrt( atrack.pos.
xyz.
x**2 +
273 * atrack.pos.
xyz.
y**2 )
274 molu = obssites(ldep).mu
277 ridx = (log10( rinmu/rmin )/
bin +0.5) +1
279 ek = atrack.
p.fm.
p(4) -atrack.
p.
mass 282 ng(ldep) =
ng(ldep) + atrack.
wgt 283 elseif(code .eq.
kelec)
then 284 ne(ldep) =
ne(ldep) + atrack.
wgt 285 elseif(code .eq.
kmuon)
then 287 elseif(code .le. 6)
then 288 nhad(ldep) = nhad(ldep) +atrack.
wgt 291 if(atrack.
p.
charge .ne. 0 )
then 306 if(abs(wz) .gt. 1.
d-2)
then 313 call cqelossrate(dedt,dedtf)
317 eloss =min(
real(dedtF*dist), Ek)
318 eloss = eloss*atrack.
wgt 319 sumeloss(ldep)=sumeloss(ldep) + eloss
324 if(code .ge. 4) code=4
325 if( atrack.
p.
charge .ne. 0 .or.
326 * w2hl(ldep) .gt. 0 )
then 329 aa=atan2(atrack.pos.
xyz.
y, atrack.pos.
xyz.
x)*
332 aa= mod(aa + 360.
d0, 360.
d0)
333 if(aa .gt. (360.
d0-dfai/2.0
d0)) aa= aa-360.
d0 334 faiidx=(aa+dfai/2.0
d0) /dfai + 1
335 if(ridx .ge. 1 .and. ridx .le.
nrbin)
then 336 derfai(ridx, faiidx, ldep) = derfai(ridx, faiidx, ldep)
338 elseif(ridx .le. 0)
then 339 decent(ldep) = decent(ldep) + eloss
346 if( w2hl(ldep) .gt. 0 )
then 349 call kwhist( rspec(code, faiidx, i),
355 if(reducedtime .eq. 1)
then 356 delta = r*(
cos(fai) + 1.)*sint*1.d9/
c 357 stime = stime + delta
361 call kwhist( tspec0(code, i),
363 elseif(ir .le.
nrbin)
then 364 call kwhist( tspec(code, ir, faiidx, i),
380 write(0,*)
'ev#=',eventno,
381 *
' generation phase finished. now writing data' 383 call cgetfname(basefilename, basefilename2)
385 firstcdepth = firstcdepth* 0.1
392 do i = 1, noofassites
393 if(i .gt. 1 .and. i .lt. noofassites )
then 394 dd =(asdepthlist(i+1) - asdepthlist(i-1))/2.0
395 elseif(i .eq. 1)
then 396 dd =(asdepthlist(2) - asdepthlist(1))
398 dd =(asdepthlist(noofassites) -
399 * asdepthlist(noofassites-1))
401 cog = cog + asobssites(i).esize*dd*asdepthlist(i)
402 sumne= sumne +asobssites(i).esize*dd
409 do i = 1, noofassites
410 if( asobssites(i).age .gt.
411 * (2.0-asobssites(noofassites).age))
then 412 if(i .gt. 1 .and. i .lt. noofassites )
then 413 dd =( asdepthlist(i+1) - asdepthlist(i-1))/2.0
414 elseif(i .eq. 1)
then 415 dd =(asdepthlist(2) - asdepthlist(1))
417 dd =(asdepthlist(noofassites) -
418 * asdepthlist(noofassites-1))
421 cog2 = cog2 + asobssites(i).esize*asdepthlist(i)*dd
422 sumne= sumne +asobssites(i).esize*dd
425 if(sumne .gt. 0.)
then 426 cog2 = cog2*0.1/sumne
429 cog2 = asdepthlist(noofassites)*0.1
432 filename = basefilename2(1:klena(basefilename2))//
".hyb" 433 call copenfw2(fnob, filename, 1, icon)
436 *
'("h ", i4, 3i3, 1pE11.3, 0p 3f11.7, 1pE11.3, 0p, 438 * eventno, inci.
p.code,
440 * inci.
p.fm.
e, -angle.r(1), -angle.r(2), -angle.r(3),
441 * firstcdepth, cog, cog2, vn,
' /' 456 do i = 1, noofassites
457 if(eabsorb(1) .ne. 0)
then 458 write(fnob,
'("t ", i3, 2f7.1, 2f6.3, 461 * asdepthlist(i)*0.1, asobssites(i).mu,
462 * asobssites(i).age, asdepthlist(i)*0.1/cog2,
463 *
ng(i),
ne(i),
nmu(i), nhad(i),
464 * asobssites(i).esize, sumeloss(i),
465 * debydedx(i), debydeath(i),
467 * debydeathg(i), debydeathe(i), debydeathmupik(i),
468 * debydeathp(i), debydeathnut(i), debydeatho(i)
470 if(i .le. eabsorb(2) )
then 473 sumebydedx = sumebydedx + debydedx(i)
474 sumebydeath = sumebydeath + debydeath(i)
475 sumebydeathneu = sumebydeathneu +debydeathneu(i)
476 sumebydeathnut = sumebydeathnut +debydeathnut(i)
477 sumebydeathg = sumebydeathg + debydeathg(i)
478 sumebydeathe = sumebydeathe + debydeathe(i)
479 sumebydeathmupik = sumebydeathmupik +
481 sumebydeathp = sumebydeathp +debydeathp(i)
482 sumebydeatho = sumebydeatho +debydeatho(i)
485 write(fnob,
'("t ", i3, 2f7.1, 2f6.3, 488 * asdepthlist(i)*0.1, asobssites(i).mu,
489 * asobssites(i).age, asdepthlist(i)*0.1/cog2,
490 *
ng(i),
ne(i),
nmu(i), nhad(i),
491 * asobssites(i).esize, sumeloss(i)
494 if(eabsorb(1) .ne. 0)
then 496 sumecrash = sumecrash + ecrash(i)
497 sumespace = sumespace + espace(i)
499 write(fnob,
'("b ", 1p7E11.3)') (espace(i), i=1,7)
500 write(fnob,
'("b ", 1p7E11.3, i4)') (ecrash(i), i=1,7),
503 *
'("c ",1p7E11.3)' )
504 * maxebreak, maxrelebreak, sumediff, sumabsediff,
505 * maxebreak(1)/inci.
p.fm.
p(4)
507 summissing = sumecrash + sumespace + sumebydeathneu
508 sumuncertain = sumebydeathnut
509 sumdeinair = sumebydedx + sumebydeath
510 sumall = sumdeinair + summissing + sumuncertain
512 write(fnob,
'("s ", 1p8E11.3)')
513 * sumebydedx, sumebydeath, sumdeinair,
514 * sumecrash, sumespace, sumebydeathnut,
515 * sumebydeathneu, sumall
517 write(fnob,
'("r ", 1p4E11.3)')
518 * sumdeinair/e0, sumuncertain/e0, summissing/e0, sumall/e0
520 write(fnob,
'("n ", 1p4E11.3)')
521 * sumdeinair/sumall, sumuncertain/sumall,summissing/sumall,
524 write(fnob,
'("a ", 1p5g12.3 )')
525 * sumebydeathg, sumebydeathe, sumebydeathmupik,
526 * sumebydeathp, sumebydeatho
535 *
'(i3, i5, f5.2, f5.2, 537 *
histdep(i), int( asdepthlist(j)*0.1 ),
538 * asobssites(j).age, asdepthlist(j)*0.1/cog2,
539 * asobssites(j).mu, int(cog2)
544 filename = basefilename2(1:klena(basefilename2))//
"-r.hist" 545 call copenfw2(fnol, filename, binw, icon)
549 write(dirstr,
'(a,"/d",i4, "/")')
550 * ptcln(j), int( depthlist(k)*0.1 )
551 call kseblk(dirstr,
"|", nstr)
555 call kwhists( rspec(j, l, i), 0. )
556 call kwhistev( rspec(j, l, i), eventno)
557 call kwhistid( rspec(j, l, i), evid(i))
558 call kwhistp( rspec(j, l, i), fnol)
569 filename = basefilename2(1:klena(basefilename2))//
"-t.hist" 570 call copenfw2(fnot, filename, binw, icon)
575 call kwhistev( tspec0(j,i), eventno)
576 call kwhistid( tspec0(j,i), evid(i))
579 write( dirstr,
'(a,"/d",i4, "/")')
580 * ptcln(j), int( asdepthlist(k)*0.1 )
581 call kseblk( dirstr,
"|", nstr)
583 call kwhistp( tspec0(j,i), fnot )
593 call kwhists( tspec(j,ir, ifai,i), 0.)
594 call kwhistev(tspec(j,ir, ifai,i), eventno)
595 call kwhistid( tspec(j,ir, ifai,i), evid(i))
597 write(dirstr,
'(a,"/d",i4, "/F",i2,"/")')
598 * ptcln(j), int( depthlist(k)*0.1), ifai
599 call kseblk(dirstr,
"|", nstr)
600 call kwhistdir(tspec(j,ir, ifai,i), dirstr)
601 call kwhistp( tspec(j,ir, ifai,i), fnot)
603 call kwhistd( tspec(j, ir, ifai, i) )
613 filename = basefilename2(1:klena(basefilename2))//
".nrfai" 614 call copenfw2(fnon, filename, 1, icon)
617 *
'(i4,1pE11.3, 0p,i3, f8.4, 1pE11.3,0p, 4i4, 1p,8g11.3)')
618 * eventno, e0, nn, cosz, firstcdepth,
nrbin,
nfai, ansites,
619 * noofsites, keminobs
624 write(fnon,
'("dE/dx",f7.1, 3i4)' )
625 * depthlist(i)*0.1, i, i, k
626 write(fnon,
'(1p10E11.3)')
627 * ( derfai(m,k,i), m=1,
nrbin ), decent(i)
634 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)
! 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
subroutine copenfw2(io, fnin, form, icon)
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
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)
dE dx *! Nuc Int sampling table b
*Zfirst p fm *Zfirst p Zfirst p Zfirst p *Zfirst p charge
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 c