Another reason why a bank may be missing is that the process that created it did not fully support the data structure. A major example in this area is the EGS4 code. When a particle, e.g. an electron, is passed to EGS4 it is passed a starting vertex which has a special interaction code meaning an EGS4 interaction. The code tracks the electron but does not normally record every step of its progress in the data structure. Instead, each time a Cerenkov photon is created, an MCVX is lifted at the point and a track connected from the main EGS4 vertex to it. So after the code has completed the main EGS4 vertex has one outgoing track for each photon generated and for each the track directly connects to the photon creation vertex. The resulting data structure is typified by figure 11.1 which shows the processing of an electron.
In this diagram,
To illustrate use of this data structure the following code finds an EGS4 vertex and then finds the earliest photon produced from it.
include 'bank_mast.inc' include 'bank_mc.inc' include 'bank_mcvx.inc' include 'bank_mctk.inc' include 'id_interactions.inc' include 'z.inc' include 'zunit.inc' integer lmc_cur, lmcvx_cur, lmcvx_end, + lmctk_cur, lmctk_first, i double precision time_cur, time_first, get_double lmcvx_cur = 0 lmctk_first = 0 time_first = 0. ** Establish link to first MCVX. if (lmast .ne. 0) then lmc_cur = lq(lmast - kmast_mc) if (lmc_cur .ne. 0) lmcvx_cur = lq(lmc_cur - kmc_mxvx) endif ** Loop over all MCVX looking for EGS4 interaction do while (lmcvx_cur .ne. 0) if (mod( iq(lmcvx_cur + kmcvx_inc), 1000) .eq. idiegs) then ** EGS4 vertex found, loop over all outgoing tracks looking ** for earliest. lmctk_cur = lq(lmcvx_cur - kmcvx_mctk) do while (lmctk_cur .ne. 0) lmcvx_end = lq(lmctk_cur - kmctk_mcvx) time_cur = get_double( lmcvx_end + kmcvx_tim ) if ( lmctk_first .eq. 0 + .or. time_first .gt. time_cur ) then lmctk_first = lmctk_cur time_first = time_cur endif lmctk_cur = lq(lmctk_cur) enddo ** Quit after first EGS4 bank found. lmcvx_cur = 0 else ** Step on to next vertex. lmcvx_cur = lq(lmcvx_cur) endif enddo if (lmctk_first .gt. 0) then lmcvx_end = lq(lmctk_first - kmctk_mcvx) write (iqprnt,*) ' Position of first photon: ', + (rq(lmcvx_end + kmcvx_psx + i), i = 0,2) endif
As from version 2.09, data structure logging from EGS can be produced using the command:-
$egs4_ds $onNow the progress of electrons and gammas are recorded although the way that Cerenkov photons are incorporated is still slightly unusual. If one or more photons are produced in a single electron track step, then each is connected, via an electron, to the start of the step. The resulting data structure is shown in figure 11.2.