This description of the cherenkf 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 v7.1 of cherenkf.c

cherenkov: generates an appropriate number of Cherenkov photons from the output of the kascade program and tracks them to the ground. It loops over all showers first and then over all segments in each shower after the core has been relocated (offset). For each segment one needs to calculate the average direction cosines and the number of photons emitted (Jelley formula and Poisson deviate). For each photon one needs to get its wavelength, find the direction of the emitted photon, randomly choose the emission point within the segment, work out the corresponding altitude and see if the photon survives the atmosphere and hits any detector. Calculations of the atmospheric density and the index of refraction are also carried out.

The code calculates the time for the photon to reach the ground relative to the time for the primary to strike the ground. Since the relative time at the start of the segment and the times for the primary to travel over the height of the segment and the time for the secondary to travel over the segment are available from kascade output, the code can determine the relative time of photon emission at randomly selected points along the segment. Subsequent timing calculations from emission point to ground includes using the index of refraction as a function of atmospheric density.

Showers are uniformly scattered in impact parameter about the area between rmin and rmax: in the case of vertical incidence, a circle if rmin=0 or an annulus if rmin>0; for oblique incidence, an ellipse with minor_axis=rmax and major_axis=rmax/cosq if rmin=0 or the area between two co-focal ellipses with minor axes equal to rmin, rmax (and major axes scaled as above) if rmin>0. These displacements of the cores are simulated here since kascade produces showers with their cores fixed through the origin.

At present the code does not include telescope arrays with telescopes outside the z=0 ground plane. This code is able to handle primaries not coming from the zenith and segments with arbitrary directions. The code includes options to apply reflectivity and PMT quantum efficiency to reduce the number of photons in the output file. We chose to apply these reductions in grisudet.c

The file, kextinct.dat, contains 51 values for each wavelength between 180 and 900 nm in steps of 5 nm which are used if the atmospheric extinction is on.

Cherenkf uses these procedures: we'll add a detailed flow chart later.

 atm_pass calculates the probabiltity of a photon surviving the atmosphere on the basis of altitude of emission, observatory altitude and photon wavelength.
 beta returns the speed of a particle relative to that of light
 dc_average averages direction cosines at the beginning and end of a shower
 det and det2 return the number of the detector hit by a photon
 energy_bin bins by particle energy
 eta_sea returns the index of refraction minus one at sea level for a given wavelength (nm)
 extract_tokens.h converts a string to a token array
 get_energy finds, for a given energy bin, the corresponding midpoint energy
 gammln performs some logarithmic calculations
 get_time.h determines a current time and date string
 gms gives the optical depth (g/cm2) as a function of altitude (m).
 help prints out the usage/help message
 initialize initializes the 2-dimensional arrays
 intersect returns the number of the detector seen as first hit by light from one segment
 mtxmlt post-multiplies matrices
 normalize is used by the AVERAGE logging function to normalize the log counts to the total number of showers
 pe applies a reflectivity cut and, possibly, the PMT quantum efficiency to determine whether a photoelectron is produced from a photon.
 photons works out the number of Cherenkov photons emitted at a given segment, using Jelley's formula and a Poissonian deviation and also returns the Cherenkov angle.
 poidev is used for the Poissonian deviation
 prtphot prints a photon-by-photon list
qe returns the quantum efficiency of Hamamatsu 1398 UV glass tubes at a given wavelength
 read_extint reads in the extinction coefficients set in kextinct.dat.
 ran3_a and ran3_b are random number generators
 rel_gamma calculates the relativistic gamma factor as a function of kinetic energy and mass
 read_array.h reads the telescope configuration file
 read_header reads and writes header information from the segment file
 rel_time calculates the relative time to ground for the photon
 rho gives the density (g/cm3) at a certain altitude
 rotate determines the new direction cosines of an emitted Cherenkov photon
 scatter artificially offsets the shower cores location as explained earlier
 type_bin classifies particles by their type
 write_header writes cherenkf header information to the photon output file
 write_log writes the log output to a file named on the command line (default is defined in LOGFILE)
 yds returns the altitude (m) at a certain depth (g/cm2)