This description of the kascade3 and kascade7 code is taken from "I.S.U.-Style Cascade Simulations: Dublin User's Manual" written by Javier Bussons Gordo, May 1997. We have made modifications bringing the description current to this version. The general logic given here also applies to kascade; the main differencies are the multiscatter routine, the method of including the atmospheric model, and the routines for heavies. I have not attempted to document these differencies here and refer you to the detailed notes at the beginning of kascade.for.

kascade: simulates all processes taking place in an atmospheric cascade between the first interaction of the primary particle with the air and the production of Cherenkov light by secondary particles traveling through the air faster than the speed of light in the same medium.

Parameters such as energy thresholds, lifetimes and masses of the intervening particles are initialized at the beginning of the program. Then, a subroutine,setatm, is called which calculates parameters needed for atmospheric calculations, assuming an atmosphere broken up into three regions and with its density an exponential function of altitude. Throughdatinthe program reads in the parameters pre-set by the user inpilot_kas.txtand opens theklogfile if wanted. The subroutinebendinitcarries out initial calculations to account for the magnetic field of the earth and its direction before the initial angles of incidence, trajectory and other shower parameters are dealt with and the standard output andklogfile are used.

The main loop over all the showers first checks the angles of incidence (see diagram): the positive x-axis is East (perpendicular to the earth's magnetic field, which follows a northern direction), thus making the positive y-axis South. The positive z axis goes vertically downwards. The shower axis points at the observatory, which is the origin of coordinates. The direction cosines set inkascade.inpare cosa, cosb (horizontal components) and cosq, respectively, where q is the zenith angle.

For instance, a vertically incident shower would have (0, 0, 1) as direction cosines; if we do not want the particle to enter vertically, we may just set the zenith angle of incidence (say cos(20) = 0.94) and leave the horizontal components as nought, that is (0, 0, 0.94). The program will automatically distribute the latter at random. The same frame of reference is used bycherenkovbefore it is rotated to a more adequate one ingrisudet.

The incident particle assumes an energy:

E = [f * Emax**q + (1 + f) * Emin**q] ** (1/q)

wheredenotes a random-number fraction in the 0 to 1 range, Emin and Emax are parameters set by the user andqis an integral spectral index with different values for gammas than for hadrons. Effectively, this computation generates a power-law distribution with the given integral spectral index.

UNICASis the main shower generation subroutine which follows particles according to their class - electrons and positrons first, then all the others. Interactions such as low-energy nucleon-delta production, Compton effect, pair production, particle decay and the drop of low-energy bremsstrahlung-created gammas are simulated and the subsequent trajectories, directions, times, and distances of travel determined.

·Electrons/positrons will either suffer bremsstrahlung or hit the ground. Changes to energy and path length due to multiple scattering and the loss of energy with optical depth are considered to be of second order in the calculation of the distance to interaction points. Standard or otherwise screened versions of bremsstrahlung are used depending on whether the electron energy is greater or smaller than that needed by the photon to be screened for pair production. If the electron stays above threshold it is propagated to its point of interaction, the height and time of which are calculated after mean free path, cross section, optical depth, etc. have been considered. If the electron hits the ground or falls below threshold, it is "dropped" off the loop.

·For gamma interactions, the total cross section resulting from the Compton effect and the pair production is needed. Once the point of interaction is found as above after either process (Compton interaction is treated as two-particle decay, a possible screening of the photon from the nucleus by atomic electrons in the pair production is catered for and any horizontal transfer of momentum is neglected), the new height and time are found and, again, the photon is dropped if it hits the ground or falls below threshold.

·Neutral pions and other very short lifetime particles are "decayed" and their products "stored".

·Muons are propagated until they decay or go below the observatory level and their products are also stored.

·Neutrinos are "dropped" straight away.

·Other particles may decay or interact: after the interaction depth is known either the delta production (3-body decay) or thetargetsubroutine is called. Target simulates all types of meson (normal, charge exchange or diffractive) and nucleon (evaporation included) interactions. Charged pions and kaons are followed until they decay or interact. A neat calculation of momentum and target size for different species of incident particles is mandatory in these hadron/air interactions.

¨stor_eandstor_gsave electrons/positrons and the rest of the particles, respectively.

¨reca_eandreca_grecall, respectively, the last electron/positron or other particle stored.

¨rbrsmeandrbrsmsare in charge of the standard and screened bremsstrahlung, respectively.

¨distexponentially normalizes the total cross-section.

¨propintandpropagatedeal with the propagation of particles to the interaction points and through to the end of a segment rather than to its midpoint.

¨rionizworks out the energy lost through ionization.

¨multscattandgeomcalculate the particle angles after multiple or single scattering and return the new direction cosines.

¨mtxmltperforms a matrix multiplication for rotation of coordinates.

¨bendcaters for the bending of the trajectory due to the magnetic field of the earth.

¨segoutwrites segments to standard output.

¨decaysearches for particle decay and the location it takes place at; low-energy (< 2.5 GeV) nucleon-delta production is treated as a three-body decay and gamma Compton interaction as a two-particle decay.

¨comptureturns the fractional energy of the secondary photon and its direction after Compton interaction.

¨sincocalculates the sine and cosine of random angles.

¨rpaimsandrpaimereturn the standard and fully-screened pair production cross-section.

¨propdecfollows the propagation of particle to decay points.

¨targetis one of the main hadron-air interaction routines: it takes care of the energy and momentum preservation in the cascade simulation.

¨daughtercalculates the direction cosines of daughter particles and saves them in storage arrays.

Diagram of flow: