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. Through datin the program reads in the parameters pre-set by the user in pilot_kas.txtand opens the klog file if wanted. The subroutine bendinit carries 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 and klog file 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 in kascade.inp are 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 by cherenkov before 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)

where  denotes a random-number fraction in the 0 to 1 range, Emin and Emax are parameters set by the user and q is 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.

UNICAS is 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 the target subroutine 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_e and stor_g save electrons/positrons and the rest of the particles, respectively.

¨reca_e and reca_g recall, respectively, the last electron/positron or other particle stored.

¨rbrsme and rbrsms are in charge of the standard and screened bremsstrahlung, respectively.

¨dist exponentially normalizes the total cross-section.

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

¨rioniz works out the energy lost through ionization.

¨multscatt and geom calculate the particle angles after multiple or single scattering and return the new direction cosines.

¨mtxmlt performs a matrix multiplication for rotation of coordinates.

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

¨segout writes segments to standard output.

¨decay searches 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.

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

¨sinco calculates the sine and cosine of random angles.

¨rpaims and rpaime return the standard and fully-screened pair production cross-section.

¨propdec follows the propagation of particle to decay points.

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

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

Diagram of flow: