28.11.2014 Views

THE EGS5 CODE SYSTEM

THE EGS5 CODE SYSTEM

THE EGS5 CODE SYSTEM

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

subroutine howfar<br />

implicit none<br />

include ’include/egs5_h.f’<br />

include ’include/egs5_epcont.f’<br />

include ’include/egs5_stack.f’<br />

! Main EGS "header" file<br />

! COMMONs required by <strong>EGS5</strong> code<br />

common/passit/zthick<br />

real*8 zthick<br />

real*8 deltaz<br />

integer irnxt<br />

! Local variables<br />

if (ir(np).ne.2) then<br />

idisc = 1<br />

return<br />

end if<br />

dnear(np) = dmin1(z(np),zthick-z(np))<br />

!-----------------------------------<br />

! Particle going parallel to planes<br />

!-----------------------------------<br />

if(w(np).eq.0) return<br />

!--------------------------------------------------------<br />

! Check forward plane first since shower heading that way<br />

! most of the time<br />

!--------------------------------------------------------<br />

if (w(np).gt.0.0) then<br />

deltaz=(zthick-z(np))/w(np)<br />

irnxt=3<br />

!-----------------------------------------------------------<br />

! Otherwise, particle must be heading in backward direction.<br />

!-----------------------------------------------------------<br />

else<br />

deltaz=-z(np)/w(np)<br />

irnxt=1<br />

end if<br />

if (deltaz.le.ustep) then<br />

ustep=deltaz<br />

irnew=irnxt<br />

339

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!