Appendix C

PEGS USER MANUAL
Hideo Hirayama and Yoshihito Namito
Radiation Science Center
Advanced Research Laboratory
High Energy Accelerator Research Organization (KEK)
1-1 Oho Tsukuba-shi Ibaraki-ken 305-0801 JAPANAlex F. Bielajew and Scott J. Wilderman
Department of Nuclear Engineering and Radiological Sciences
The University of Michigan
2355 Bonisteel Boulevard
Ann Arbor, MI 48109, USA
Walter R. Nelson
Department Associate in the Radiation Physics Group (retired)
Radiation Protection Department
Stanford Linear Accelerator Center
2575 Sand Hill Road Menlo Park, CA 94025, USA
This PEGS User Manual is Appendix C of a document called
SLAC-R-730/KEK-2005-8, which can be obtained from the SLAC and KEK web sites.

1

C.1

Introduction

PEGS (Preprocessor for EGS) is a set of FORTRAN subprograms which generate material datafor use with the EGS5 Monte Carlo shower code and which also provide utilities for researchers
studying electro-magnetic interactions. The active operations of PEGS are functionals; that is,they are operations whose arguments are functions (the functions related to physics interactions).
Included among these operations are:• Fitting of functions by means of piecewise linear ﬁts.
• Production of printed plots of selected functions.
• Evaluation of functions at selected points.
• Comparison of functions with sampled spectra.
Associated with these active functionals are other operations:• Selection of material to which the functions refer.
• Selection of energy cutoﬀs for ﬁts.
• Printing of ﬁtted data.
This manual describes the full general functionality of PEGS. Users interested only in preparing
data sets for EGS5 can proceed directly to section C.3.

C.2

Structural Organization of PEGS

Beginning with version 5 of the EGS code system, MORTRAN is no longer supported, and PEGS
is no longer a stand-alone program, but rather a subroutine to be called by EGS user code. The
main PEGS subroutine (called PEGS5), however is essentially the same as the MAIN program inprevious versions of PEGS, and EGS and PEGS are still quite distinct in EGS5.
The full PEGS5 system consists of almost 7000 of FORTRAN source code that make up over
100 subprograms, plus an additional 610 lines of FORTRAN in 40 ﬁles containing COMMON blocks
accessed by the various PEGS subprograms through include statements. New to version 5 ofPEGS, all ﬂoating point variables are declared as double precision.
Despite its size, PEGS has a simple structure. Figures C.1 and C.2 below contain a schematic
ﬂowchart of main subroutine (PEGS5) of PEGS. After the once-only initializations, an option loop2

is entered. On each pass through this loop, an option is read (option names are four charactersand are read as 4A1), numeric control parameters are read (using the FORTRAN NAMELIST I/O
extension), and then the option name is looked up in the option table. If an option name is notfound, the job is aborted. When an option name is found, the appropriate code is executed and theprogram returns to the beginning of the option loop. Normal exit from the loop is by selection of
the STOP option or detection of an End-of-File condition on the input ﬁle. Detailed descriptionsof the use of the options are contained in section C.3 of this manual.
Figures C.3 and C.4 show some of the subprogram relationships of PEGS1 . Boxed items inthe ﬁgures are subprograms, and option names (identiﬁed by “:” delimiters, as in “:CALL:”) areused to show which subprograms correspond to which options. The general structure of PEGS
is clearly evident. Subprograms which compute physical quantities are accessed directly by the
PWLF option, but when the utility options TEST, PLTN, PLTI, HPLT, or CALL are invoked,
physics routines are referenced using the function FI, the so-called “function multiplexer.” Thefunction multiplexer FI has ﬁve arguments. The ﬁrst argument (I) tells which physical function to
invoke, and the other four arguments (X1, X2, X3, X4) are used as needed as arguments for thecalled function. Calls to FI return values returned to FI by the called function speciﬁed by I. The
full list of physical functions which can be called by FI is given in Figure C.4.
It should also be noted that there are relationships between the PEGS functions shown in
Figure C.3 which are not indicated there. We show the most complicated of these in Figures C.5
and C.6 (Bremsstrahlung Related Functions) and in Figures C.7 and C.8 (Pair Production Related
Functions). One reason for the complexity of these particular subprograms is that higher level formsof the relevant cross sections must be obtained by numerical integration of the more diﬀerential
forms.
Tables C.1 and C.2 list the subroutines used in PEGS and provide brief descriptions of theirfunctions. All of the subroutines in Table C.2 are new to PEGS5 and deal with the calculation of
the Goudsmit-Saunderson multiple scattering distribution.
Tables C.3 through C.6 list the FORTRAN FUNCTIONS used in PEGS along with their mathematical symbols and deﬁnitions if appropriate. The names of most of the functions have beenchosen in a mnemonic way. The ﬁrst three or four letters suggest the process being considered.
The last letter designates the form of the cross section (Z for element, M for mixture, and R for
run-time mixture). The next to last letter describes either the particular form of the cross section(such as D for diﬀerential, T for total or R for range-integrated), or it indicates that only the secondary energy is to vary, with other data being passed through a common. The letter F is used insuch cases and the data in common is initialized using the corresponding function that has a next
to last letter of D. If the function word begins with an I through N (i.e., the FORTRAN integer
convention) the word is preﬁxed with the letter A. A few examples are given below:
1
Subprograms involving the low energy physics and the multiple scattering models new to PEGS with the releaseof EGS5 are not included in the diagrams.

3+------+| PEGS |+------+| |+-------------+
initialize | +------>| OPTION LOOP |<---++--------------++-------------+
A
|
|
|
V
V
|
+------------------------++-----------------+ ||Compute Physical &||Read Option| || Mathematical Constants ||Name (4A1)| |+------------------------+
|
&
| |
|
|
Read Control | |||Parameters| |V| (NAMELIST/INP/) | |+------------------------++-----------------+ || Read Pair Production, ||||Photoelectric, and||||Rayleigh Data from|||
! PGS5PEPR and PGS5FORM |||+------------------------+||
V|+------+
Yes+--------------+|| Stop |<------------ | End of File? ||+------++--------------+
|
|
|
| No
|
V
|
+-----------------------++---------------+|| Illegal Option---Stop |<----- | Select Option ||+-----------------------++---------------+
|
|
|
V
|
+<------------------------------------ +
|
|
|
V
|
(to next figure)(from next figure)
Figure C.1: Flowchart of the PEGS5 subprogram of PEGS, part 1.

4

(from previous figure)(to previous figure)|A|+-----------------------+|+-->:ELEM: | Set Up Element Medium | -------------------> ||+-----------------------+||+-----------------------+|+-->:MIXT: | Set Up Mixture Medium | -------------------> ||+-----------------------+||+------------------------+|+-->:COMP: | Set Up Compound Medium | ------------------> ||+------------------------+||+------------------------+|+-->:ENER: | Set Energy Cutoffs and | ------------------> ||| Compute Thresholds|||+------------------------+||+---------------------+|+-->:PLTN: | Plot Named Function | ---------------------> ||+---------------------+||+-----------------------+|+-->:PLTI: | Plot Indexed Function | -------------------> ||+-----------------------+||+-----------------------+|+-->:HPLT: | Histogram Theoretical | -------------------> ||| vs Sampled Spectrum |||+-----------------------+||+-------------------------+|+-->:CALL: | Evaluate Named Function | -----------------> ||+-------------------------+||+-----------------------------+|+-->:TEST: | Plot Functions To Be Fitted | -------------> ||+-----------------------------+||+----------------------+|+-->:PWLF: | Piecewise Linear Fit | --------------------> ||+----------------------+||+------------------------+|+-->:DECK: | Print File of Material | ------------------> +|| Dependent Data||+------------------------++-->:STOP:
Figure C.2: Flowchart of the PEGS5 subprogram of PEGS, part 2.

5

+------------+| BLOCK DATA |+------------++------+| MAIN |+------+|+ --- + - + ----- + ----- + ----- + ----- + ---- + --- +
|
|
|
|
|
|
|
|
|
|
:PWLF: :DECK: :TEST: :HPLT: :CALL: :ENER:||||:PLTN:||+------+ ||+---+ :PLTI: +-----+||PMDCON| |
|
|LAY|
|
|HPLT1||+------+ |
|
+---+
|
+-----+|||+----+||:ELEM:+---+----+|PLOT|||:MIXT:||+----+||:COMP: +-----+ +-----+|||||EBIND| |PWLF1|+-----> | <--- +|+-----+ +-----+|+ ----- + ----- +
|
|
|
|
|
+----+|+---+ +------+ +------+ |QFIT|(to next figure)|MIX| |SPINIT| |DIFFER| +----++---+ +------+ +------+|+ - + --- + --------------- +|||+-----++-----++-----+|EFUNS||GFUNS||RFUNS|+-----++-----++-----+|||+-----+----+-----+--+---+---+ |+------++-----+|||||| +---|PHOTTE||AINTP|+------+ | +------+ | +------+ | |+------++-----+|SPTOTP| | |ANIHTM| | |BHABTM| | |+------++------+ | +------+ | +------+ | +---|COMPTM|||| |+------++------+ | +------+ | +------+ | |+------+|SPTOTE|-+ |AMOLTM|-+ |BREMTM|-+ +---|PAIRTU|+------++------++------+|+------+|+------++---|COHETM|+------+
Figure C.3: Subprogram relationships in PEGS, part 1.

6

(from previous figure)||+ ---------------------- +|FI|| "Function Multiplexer" |+ ---------------------- +|+ ------------------------------------- +
|
|
|
ALIN
APRIM
COMPFM
PAIRTE||ALINI
BHABDMCOMPRM
PAIRTM||
BHABFM
COMPTM
PAIRTR||ADFMOLBHABRMCRATIOPAIRTU||ADIMOLBHABTMEBIND
PAIRTZ||ADDMOL
BREMDR
EBR1
PBR1
|
|
DLOG
BREMFR
EDEDX
PBR2
|
|
DEXP
BREMDZ
ESIG
PDEDX
|
|
AREC
BRMSDZFCOULCPHOTTZ||ALKE
BREMFZ
GBR1
PHOTTE||ALKEI
BRMSFZ
GBR2
PSIG
|
|
AMOLDM
BREMRR
GMFP
SPIONE||AMOLFM
BREMRM
PAIRDRSPIONP||AMOLRM
BREMRZPAIRFRSPTOTE||AMOLTM
BREMTM
PAIRDZSPTOTP||ANIHDM
BREMTRPAIRFZTMXB||
ANIHFM
BRMSRM
PAIRRM
TMXS||
ANIHRM
BRMSRZPAIRRR
TMXDE2||ANIHTM
BRMSTM
PAIRRZXSIF||
COHETM
EEITM||
COHETZ||COMPDM|+ ------------------------------------- +Figure C.4: Subprogram relationships in PEGS, part 2.

7

+------++------+|BREMTM|---------->|BREMRM|+------++------+|
V+------++------+ initialize+------+| QD |<------------- |BREMRZ|-------------> |BREMDZ|+------++------+
BREMFZ+------+||
V
V+------++------++------++------+|DCADRE|-->|BREMFZ|--->|BRMSFZ|<------------- |BRMSDZ|+------++------++------++------+
A
A |
|
| |
+------++---------------+| +-->|APRIM ||| |+------++------++------+
initialize| ||DCADRE|+----|BRMSRZ|---------------> + |+------++------+|+------+
BRMSFZ+-->| XSIF |A|A|+------+||||+------+|+------+|+------+| QD |<--+|BRMSRM|+-->|FCOULC|+------++------++------+A|+------++------++------+|SPTOTE|-----------> |BRMSTM|<----------- |SPTOTP|+------++------++------+||
V
V+------++------++------+|SPIONE|-----------> |SPIONB|<----------- |SPIONP|+------++------++------+
Figure C.5: Bremsstrahlung related functions—most accurate form (used to produce the total crosssections and stopping power).

8

+------+|BREMTR|+------+|
V+------+|BREMRR|+------+|
initialize V+ <---------+--------> +| BREMFR|
V
V+------++------+|BREMDR|| QD |+------++------+|||
V|+------+||DCADRE||+------+|+------+|+ ----> |BREMFR| <---- ++------+
Figure C.6: Bremsstrahlung related functions—with run-time approximations (for comparison withsampled spectra).

9

+------+|PAIRTU|+------+| |+ <------------------- + + -------------------> +||VV+------++------+|PAIRTM||PAIRTE|+------++------+||
V
V+------++------+|PAIRRM||PAIRTZ|+------++------+||
V
V+------+
initialize+------+|PAIRRZ|-------------> +|AINTP |+------+
PAIRFZ|+------+||
V
V+------++------++------+| QD ||PAIRDZ|-----+----> | XSIF |+------++------+|+------+|||+------+||+----> |FCOULC|
V
V+------++------++------+|DCADRE|----------> |PAIRFZ|+------++------+
Figure C.7: Pair production related functions—most accurate form (used to produce the total crosssections and stopping power).

10

+------+|PAIRTR|+------+|
V+------+|PAIRRR|+------+|
initialize V+ <-------- + -------> +| PAIRFR|
V
V+------++------+|PAIRDR|| QD |+------++------+|||
V|+------+||DCADRE||+------+|+------+|+ ----> |PAIRFR| <---- ++------+
Figure C.8: Pair production related functions—with run-time approximations (for comparison With
sampled spectra).

11

Name
DIFFER
EFUNS
GFUNS
HPLT1
LAY
MIX
PLOT
PMDCONPWLF1RFUNSSPINITSFUNSCFUNS3
CFUNS4EIIFUNS
MAKEK1

Table C.1: Subroutines in PEGS.
Description
Determines the various parameters needed for bremsstrahlung and pair production energy sampling.
Subprogram to compute electron functions to be ﬁt in a way that avoids
repetition.
Subprogram to compute photon functions to be ﬁt in a way that avoids
repetition.
Creates line printer plot comparisons of EGS-sampled data (UCTESTSR
User Code) and theoretical functions of PEGS.
Subprogram to produce a ﬁle of material dependent data (for subsequent
use by EGS).
Computes Z-dependent parameters that reside in COMMON/MOLVAR/.
Subprogram to plot a given function (referenced by number).
Determines the physical, mathematical, and derived constants in a verymnemonic way.
Subprogram to piecewise linearly ﬁt up to 10 functions simultaneously on
an interval (XL,XU).
Subprogram to compute Rayleigh scattering functions to be ﬁt in a way thatavoids repetition.
Initializes stopping power functions for a particular medium.
Subroutine to compute incoherent scattering functions to be ﬁt.
Subroutine to compute c.d.f. of shell-wise Compton proﬁle to be ﬁt.
Subroutine to compute shell-wise Compton proﬁle to be ﬁt.
Subroutine to compute EII/Møller ratio to be ﬁt.
Prepares tables of initial scattering strength to be ﬁt.

12

Name
INIGRDELINITDCSTABDCSSTOR
ELASTINODCSLOAD
GSDIST
GSCOEFLEGENPINTEG
GAULEGSPLINEFINDI
FITMS
WMSFIT

Table C.2: Goudsmit-Saunderson-related subroutines in PEGS.
Description
Initializes energy and scattering strength grid tables.
Reads diﬀerential elastic scattering cross section data for electrons andpositrons.
Computes tables of the molecular elastic diﬀerential cross sections for electrons and positrons.
Stores molecular elastic diﬀerential cross sections tables for multi-material
PEGS runs.
Prepares cumulative Goudsmit-Saunderson multiple scattering distributions
on problem dependent energy and scattering strength grids.
Loads molecular elastic diﬀerential cross sections tables for multi-material
PEGS runs.
Computes Goudsmit-Saunderson multiple scattering probability density
functions.
Computes Goudsmit-Saunderson transport coeﬃcients.
Computes Legendre polynomials.
Integrates cubic spline data.
Provides abscissas and weights for Gauss-Legendre quadrature.
Computes cubic splines.
Does table look-up.
Prepares special ﬁt to Goudsmit-Saunderson multiple scattering data for fastsampling in EGS.
Writes ﬁtted Goudsmit-Saunderson multiple scattering data parameters.

13

AMOLDM
BREMDR
BREMRM
BRMSTM
PAIRRRPAIRTZis the diﬀerential Møller cross section for a mixture of elements.
is the diﬀerential bremsstrahlung cross section for a run-time mixture ofelements.
is the bremsstrahlung cross section, integrated over some energy range, fora mixture of elements.
is the soft bremsstrahlung total cross section for a mixture of elements.
is the pair production cross section, integrated over some energy range, fora run-time mixture of elements.
is the total cross section for pair production for an element.

Note that this method of naming is not strictly adhered to, however. For example, SPIONE is theionization stopping power for an electron, PBR1 and PBR2 are positron branching ratios, and GMFP
is the gamma-ray mean free path.

C.3

PEGS Options and Input Specifications

C.3.1

Interrelations Between Options

Figure C.9 illustrates the logical relationship between options of PEGS. For example, in order tobe able to use the PLTN option, one of the material speciﬁcation options (ELEM, MIXT, COMP)
must have already been processed. The PWLF option requires that both the ENER option andone of the material speciﬁcation options precede it. To use the DECK option, it is suﬃcient tohave validly invoked the PWLF option. The STOP option is seen to be independent of the others.
In the following sections we give for each option its function, parameters which control it, theformat of the data lines in a PEGS input ﬁle needed to invoke it, and an explanation of the routines(if any) that are used to implement it. The data lines for a given option are named with the ﬁrst partof their name being the option name, and the last part the line number. For example, “MIXT2”is the name of the second line needed for the MIXT option. The information is summarized inTables C.7 through C.18. The single line referred to as being read by NAMELIST may in fact beseveral lines, provided that the proper convention for continuing NAMELIST lines is followed. Oncethe ﬁrst line (indicating the option) has been read in, however, the second line (i.e., NAMELIST/INP/)
must follow (see examples at the end of the next section). It should also be noted that diﬀerent
compilers may require diﬀerent formats for NAMELIST data.

C.3.2

The ELEM, MIXT, COMP Options

The purposes of the ELEMent, MIXTure, and COMPound options are to specify the materials
used by the PEGS functions. The parameters needed to specify a material are its density (RHO),
the number of diﬀerent kinds of atoms (NE), and, for each diﬀerent kind of atom, its atomic number
14

Table C.3: Functions in PEGS, part 1.
Name
AFFACT
AINTP
ALKE
ALKEI
ALIN
ALINI
ADFMOLADIMOLADDMOLAMOLDMAMOLFMAMOLRMAMOLTM
ANIHDM
ANIHFM
ANIHRM
ANIHTMAPRIM
AREC
BHABDM
BHABFM
BHABRM
BHABTM

Description
Atomic form factor (squared) for an element or mixture of elements.
Linear or log interpolation function.
Log of kinetic energy (LOG(E-RM)), used as a cumulative distribution function for ﬁts and plots.
Inverse of ALKE (=EXP(X)+RM).
Linear cumulative distribution function for plots (ALIN(X)=X).
Inverse of ALIN (=same as ALIN). Used as inverse cumulative distributionfunction in plots.
Approximate cumulative distribution function for Møller and Bhabha crosssections (ADFMOL(E)=-1/(E-RM)).
Inverse of ADFMOL.
Derivative of ADFMOL.
Møller diﬀerential cross section for a mixture of elements.
One argument form of AMOLDM.
Møller cross section, integrated over some energy range, for a mixture ofelements.
Møller total cross section for a mixture of elements.
Annihilation diﬀerential cross section for a mixture of elements.
One argument form of ANIHDM.
Annihilation cross section, integrated over some energy range, for a mixtureof elements.
Annihilation total cross section for a mixture of elements.
Empirical correction factor in bremsstrahlung cross section.
Reciprocal function (=derivative of ALOG(X)). Used as probability density
function in log plots (AREC(X)=1/X).
Bhabha diﬀerential cross section for a mixture of elements.
One argument form of BHABDM.
Bhabha cross section, integrated over some energy range, for a mixture ofelements.
Bhabha total cross section for a mixture of elements.

15

Table C.4: Functions in PEGS, part 2.
Name
BREMDR
BREMFR
BREMDZBREMFZBREMRM
BREMRR
BREMRZBREMTM
BREMTR
BRMSDZBRMSFZBRMSRM
BRMSRZBRMSTM
COHETM
COHETZCOMPDM
COMPFMCOMPRM
COMPTMCPRFILCRATIODCADRE
DCSEL
DCSN
EBIND
EBR1
EDEDX
EIITM

Description
Bremsstrahlung diﬀerential cross section for a run-time mixture of elements.
One argument form of BREMDR.
Bremsstrahlung diﬀerential cross section for an element.
One argument form of BREMDZ.
Bremsstrahlung cross section, integrated over some energy range, for a mixture of elements.
Bremsstrahlung cross section, integrated over some energy range, for a runtime mixture of elements.
Bremsstrahlung cross section, integrated over some energy range, for anelement.
Bremsstrahlung total cross section for a mixture of elements.
Bremsstrahlung total cross section for a run-time mixture of elements.
Soft bremsstrahlung diﬀerential cross section for an element.
One argument form of BRMSDZ.
Soft bremsstrahlung cross section, integrated over some energy range, for a
mixture of elements.
Soft bremsstrahlung cross section integrated over some energy range, for anelement.
Soft bremsstrahlung total cross section for a mixture of elements.
Coherent (Rayleigh) total cross section for a mixture of elements.
Coherent (Rayleigh) total cross section for an element.
Compton diﬀerential cross section for a mixture of elements.
One argument form for COMPDM.
Compton cross section, integrated over some energy range, for a mixture ofelements.
Compton total cross section for a mixture of elements.
Shell-wise Compton proﬁles.
Coherent (Rayleigh) cross section ratio.
Quadrature routine to integrate f(x) between a and b using cautious
Romberg extrapolation.
Computes diﬀerential elastic scattering cross sections from data which has
been ﬁtted by cubic splines.
Computes arbitrary Goudsmit-Saunderson elastic scattering transport coefﬁcients from cross section data which has been ﬁtted by cubic splines.
Function to get an average photo-electric binding energy.
Function to determine the electron(-) branching ratio (brem/total).
Evaluates SPTOTE with cutoﬀ energies of AE and AP.
K shell EII cross section

16

Table C.5: Functions in PEGS, part 3.
Name
ESIG
FCOULCFI
G1E
G1EDEDX
G1PDEDX
GBR1
GBR2
GMFP
K1E
IFUNT
PAIRDR
PAIRDZPAIRFRPAIRFZPAIRRM
PAIRRRPAIRRZPAIRTEPAIRTM
PAIRTRPAIRTUPAIRTZ

Description
Determines the total electron(-) interaction cross section (probability perradiation length).
Coulomb correction term in pair production and bremsstrahlung cross sections.
Function multiplexer.
Computes scatter powering for positrons and electrons from either splines ofpartial wave cross sections or analytical form of Molière cross section.
Computes product of ﬁrst elastic transport cross section and inverse stopping
power for electrons.
Computes product of ﬁrst elastic transport cross section and inverse stopping
power for positrons.
Function to determine the gamma-ray branching ratio (pair/total).
Functiontodeterminethegamma-raybranchingratio((pair+Compton)/total).
Function to determine the gamma-ray mean free path.
Computes scattering strength for electrons and positrons from spline data.
Given PEGS function name, it looks it up name in table and returns thefunction index. Used by options that specify functions by name.
Pair production diﬀerential cross section for a run-time mixture of elements.
Pair production diﬀerential cross section for an element.
One argument form of PAIRDR.
One argument form of PAIRDZ.
Pair production cross section, integrated over some energy range, for a mixture of elements.
Pair production cross section, integrated over some energy range, for a runtime mixture of elements.
Pair production cross section, integrated over some energy range, for anelement.
Empirical total pair production production cross section for a mixture(=SUM(PZ(I)*PAIRTZ(Z(I))).
Pair production total cross section for a mixture of elements, obtained bynumerical integration of diﬀerential cross section.
Pair production total cross section for a run-time mixture of elements.
Pair production total cross section actually used. Same as PAIRTE for
primary energy less than 50 MeV; otherwise, same as PAIRTM.
Computes contribution to empirical pair production total cross section for
an element assuming one atom per molecule. It is obtained by log-linear
interpolation of Storm-Israel data.

17

Table C.6: Functions in PEGS, part 4.
Name
PBR1
PBR2
PDEDX
PHOTTEPHOTTZ
PSIG
QD
QFIT
SUMGA
SPIONBSPIONESPIONPSPTOTESPTOTP
TMXB
TMXS
TMXDE2XSIF
ZTBL

Description
Function to determine the positron branching ratio (brem/total).
Function to determine the positron branching ratio ((brem+Bhabha)/total).
Evaluates SPTOTP with cutoﬀ energies of AE and AP.
Determines the proper mix of PHOTTZ’s for a mixture.
Determines the interpolated total photoelectric cross section from tabulated
data.
Determines the total positron interaction cross section (probability per radiation length).
Driver function for DCADRE, the numerical integration routine.
Utility logical function for the piecewise linear ﬁt subroutine, PWLF1. It
returns .TRUE. if a given partition gives a good ﬁt.
Integrates a function using a 20-point Gauss quadrature method with anadaptive bipartition scheme.
Does the work for SPIONE and SPIONP. One argument tells whether tocompute stopping power for electron or positron.
Calculates the stopping power due to ionization for electrons(-).
Calculates the stopping power due to ionization for positrons.
Calculates the total stopping power (ionization plus soft bremsstrahlung) for
electrons(-) for speciﬁed cutoﬀs.
Calculates the total stopping power (ionization plus soft bremsstrahlung) for
positrons for speciﬁed cutoﬀs.
Determines the maximum total step length consistent with Bethe’s criterion.
Determines the minimum of TMXB and 10 radiation lengths.
Included for possible future modiﬁcation purposes (TMXDE2 = TMXB / (E**2* BETA**4)). It might be easier to ﬁt this quantity than to ﬁt TMXB andthen apply the denominator in EGS at run-time.
Function to account for bremsstrahlung and pair production in the ﬁeld of
the atomic electrons.
Given the atomic symbol for an element, it returns the atomic number.

18

+------++------++------++------+|:ELEM:||:MIXT:||:COMP:||:ENER:|+------++------++------++------+
|
|
|
|
|
V
|
|
+ ------> OR <-------- +||V+---------------------------> AND ----+
|
|
|
V
|
|
+ -------+----+----+------- +
|
|
|
|
|
|
|
|
V
V
V
V
|
|
+------+ +------+ +------+ +------+ +------+|||:PLTN:| |:PLTI:| |:HPLT:| |:CALL:| |:TEST:|<---+|+------+ +------+ +------+ +------+ +------+
V+------+|:PWLF:|+------+|
V+------++------+|:STOP:||:DECK:|+------++------+
Figure C.9: Logical relationship between the options of PEGS.
(Z(I)), its atomic weight (WA(I)), and its proportion either by number (PZ(I)) for a compound or
by weight (RHOZ(I)) for a mixture. PEGS has tables for the atomic symbol (ASYMT(1:100)) andthe atomic weight (WATBL(1:100)) for elements I=1 through I=100, so the type of atom is speciﬁedby giving its atomic symbol (ASYM(I)). PEGS also has a table of the densities of the elements(RHOTBL(1:100)).
The ELEMent option is used if the material being used has only one type of atom. In this case
PEGS deﬁnes that NE=1, takes the density from its internal data table, sets PZ(1)=1, and deduces
Z(1) and WA(1) from ASYM(1). Thus the atomic symbol (ASYM(1)) is the only information thatthe user need supply. If either RHO or WA(I) are speciﬁed by the user, they override the table values
in PEGS. This allows the diﬀerent atoms to be non-standard isotopes and/or allows the overall
density to be adjusted to the experimental state.
The COMPound option is used when there is more than one diﬀerent kind of atom and it isdesired to give the proportions by relative number of atoms (PZ(I)). The only required data is NE,
ASYM(I), and PZ(I) (for I=1,NE). Optionally, any of the values of WA(I) taken from the default
PEGS tables can be overridden if speciﬁed by the user.

19

Table C.7: ELEM option input data lines in PEGS, part 1.
Line and format
ELEM1 (4A1)
ELEM2 NAMELIST

Variables
OPT(1:4)
RHO
WA(1)
IRAYL

IUNRST

IAPRIMISSB
EPSTFLFUDGEMSIBOUND
INCOH

ICPROF

Comments‘ELEM’. Means “select material that is an element.”
Optional. If given, this overrides the PEGS default
density (g/cm3 ) for the element.
Optional. Atomic weight of element. If given, thisoverrides the PEGS default.
Optional. Set to 1 (or 2, which requires additionaldata, see below) to model Rayleigh scattering. (default=0, ignore).
Optional. For printing stopping powers (default = 0,
restricted stopping powers, for EGS runs).
1 unrestricted collision only
2 unrestricted collision and radiative
3 unrestricted collision, restricted radiative. 4 restricted collision, unrestricted radiative
5 unrestricted radiative only
6 restricted radiative only
7 restricted collision only
Optional. For correction to bremsstrahlung cross section. Default (=1), normalizes integrated cross section to ICRU-37 radiative stopping power; set to 0
uses Motz et al.empirical; set to 2 uses no correction.
Optional. Set to 1 to use user-supplied density eﬀectparameters (see below).
Optional. Set to 1 to use user-supplied density eﬀect
corrections (see below).
Optional. Constant in Z(Z + ξM S ) which describes
the contribution of soft electron collisions to multiple
scattering (default = 1.0).
Optional. Set to 1 to use bound total Compton crosssection (default = 0, use free Compton cross section).
Optional. Set to 1 to use incoherent scattering function to model electron binding eﬀect on Compton
scattering angles (default = 0, ignore).
Optional. Set to 3,4,-3 or -4 (see below) to use shellwise Compton proﬁles to get Compton scattering energies. (default = 0, ignore).

20

Table C.8: ELEM option input data lines in PEGS, part 2.
Line and format
ELEM2 (cont) NAMELIST

Variables
IMPACTIGSDST

NLEG0

EFRACHEFRACL
ELEM3 (24A1,6X,24A1)

MEDIUM
IDSTRN

ELEM4 (24(A2,1X))

ASYM(1)

Comments
Optional. For selecting electron impact ionization
cross section (default = 0, ignore):
1 Casnati’s formula
2 Kolbenstvedt’s rev. formula
3 Kolbenstvedt’s formula
4 Jakoby’s formula
5 Gryziński’s formula
6 Gryziński’s relativistic. formula
Optional. Set to 1 to use Goudsmit-Saunderson
multiple scattering distribution (default = 0, use
Molière).
Optional. Number of Legendre coeﬃcients in computing Goudsmit-Saunderson distribution (default =1000).
Optional. Fractional energy loss over a multiple scattering step at E = UE (default = 0.05).
Optional. Fractional energy loss over a multiple scattering step at E = AE (default = 0.20).
Identiﬁer assigned to data set to be produced.
Optional.
Identiﬁer of media name of desired
Sternheimer-Seltzer-Berger density eﬀect coeﬃcientsin PEGS (see Table 2.3 of SLAC-R-730/KEK-2005-8
for a list of default media supplied with the EGS5 distribution.) If not speciﬁed, MEDIUM(1:24) is used.
Atomic symbol for element.

21

Table C.9: COMP option input data lines in PEGS.
Line and Format
COMP1 (4A1)

Variables
OPT(1:4)

COMP2 NAMELISTNE
RHO(PZ(I),I=1,NE)
GASP(WA(I),I=1,NE)

COMP3 (24A1,6X,24A1)
COMP4 (24(A2,IX))IRAYLIUNRST
IAPRIMISSB
EPSTFLFUDGEMSIBOUND
INCOH
ICPROF
IMPACTIGSDST
NELG0
EFRACHEFRACLMEDIUM
IDSTRN(ASYM(I),I=1,NE)

22

Comments‘COMP’. Means “select material that is acompound.”Number of elements in compound.
Density (g/cm3 ) of compound (at NTP forgases).
Relative numbers of atoms in compound.
Optional. Deﬁnes state of compound:zero (default) for solid or liquid, otherwise
value gives gas pressure (atm).
Optional. May be used to override default
atomic weights (e.g., to allow for special
isotopes).
Same as for ELEM, line 2.
Same as for ELEM, line 2.
Same as for ELEM, line 2.
Same as for ELEM, line 2.
Same as for ELEM, line 2.
Same as for ELEM, line 2.
Same as for ELEM, line 2.
Same as for ELEM, line 2.
Same as for ELEM, line 2.
Same as for ELEM, line 2.
Same as for ELEM, line 2.
Same as for ELEM, line 2.
Same as for ELEM, line 2.
Same as for ELEM, line 2.
Same as for ELEM, line 3.
Same as for ELEM, line 3.
Atomic symbols for the atoms in the compound. Duplicates are allowed if several
isotopes of the same element are present,
or may be required for diatomic molecules(e.g. nitrogen gas).

Table C.10: MIXT option input data lines in PEGS.
Line and Format
MIXT1 (4A1)

Variables
OPT(1:4)

MIXT2 NAMELISTNERHO(RHOZ(I),I=1,NE)
GASP(WA(I),I=1,NE)

MIXT3 (24A1,6X,24A1)
MIXT4 (24(A2,1X))IRAYL
IUNRST
IAPRIMISSB
EPSTFLFUDGEMSIBOUND
INCOH
ICPROF
IMPACTIGSDST
NELG0
EFRACHEFRACLMEDIUM
IDSTRN(ASYM(I),I=1,NE)

Comments‘MIXT’. Means “select material that is a
mixture.”Number of elements in mixture.
Density (g/cm3 ) of mixture (at NTP forgases).
Relative amount of atom in mixture (byweight).
Optional. Deﬁnes state of mixture: zero(default) for solid or liquid, otherwise
value gives gas pressure (atm).
Optional. May be used to override default
atomic weights.
Same as for ELEM, line 2.
Same as for ELEM, line 2.
Same as for ELEM, line 2.
Same as for ELEM, line 2.
Same as for ELEM, line 2.
Same as for ELEM, line 2.
Same as for ELEM, line 2.
Same as for ELEM, line 2.
Same as for ELEM, line 2.
Same as for ELEM, line 2.
Same as for ELEM, line 2.
Same as for ELEM, line 2.
Same as for ELEM, line 2.
Same as for ELEM, line 2.
Same as for ELEM, line 3.
Same as for ELEM, line 3.
Same as for COMP, line 4.

Table C.11: ENER option input data lines in PEGS. Note that if the user supplies negative values
for the energy limits above, the absolute values given will be interpreted as being given in units ofthe electron rest mass energy. Thus, AE=-1 is equivalent to AE=0.511 MeV.
Line and Format
ENER1 (4A1)
ENER2 NAMELIST

Variables
OPT(1:4)
AE
UE
AP
UP

Comments‘ENER’. Means “select energy limits.”
Lower cutoﬀ energy (total) for charged particle transport (MeV).
Upper limit energy (total) for charged particle transport (MeV).
Lower cutoﬀ energy for photon transport (MeV).
Upper limit energy for photon transport (MeV).
23

Table C.12: PWLF option input data lines in PEGS. Note: The PWLF parameters above (seesection C.3.4 for longer descriptions) are optional and may be overridden by the user. The default
values (assigned in BLOCK DATA) are indicated above, and all of the parameters are elements of both
NAMELIST/PWLFNM and NAMELIST/INP.
Line and Format
Variables
Comments
PWLF1 (4A1)
OPT(1:4)‘PWLF’. Means “perform piecewise linearﬁt.”
PWLF2 NAMELIST EPE/0.01/
Electron EP parameter.
EPG/0.01/
Gamma EP parameter.
EPR/0.01/
Rayleigh scattering EP parameter.
EPSF/0.01/
Incoherent scattering function EP parameter.
EPCP/0.03/
Compton proﬁle EP parameter.
ZTHRE(1:8)/8*0./
Electron ZTHR parameter.
ZTHRG(1:3)/0.,.1,0./ Gamma ZTHR parameter.
ZTHRS(1:40)/40*0./
Incoherent scattering function ZTHR parameter.
ZTHRR(1:40)/40*0./
Rayleigh scattering ZTHR parameter.
ZTHRC(1:200)/200*0./ Compton proﬁle ZTHR parameter.
ZEPE(1:8)/8*0./
Electron ZEP parameter.
ZEPG(1:3)/0.,.01,0./ Gamma ZEP parameter.
ZEPS(1:40)/40*0./
Incoherent scattering function ZEP parameter.
ZEPR(1:40)/40*0./
Rayleigh scattering ZEP parameter.
ZEPC(1:200)/200*0./Compton proﬁle ZEP parameter.
NIPE/20/
Electron NIP parameter.
NIPG/20/
Gamma NIP parameter.
NIPS/20/
Incoherent scattering function NIP parameter.
NIPR/20/
Rayleigh scattering NIP parameter.
NIPC/20/
Compton proﬁle NIP parameter.
NALE/150/
Electron NIMX parameter.
NALG/1000/
Gamma NIMX parameter.
NALR/100/
Rayleigh scattering NIMX parameter.
NALS/100/
Incoherent scattering function NIMX parameter.
NALC/2000/
Compton proﬁle NIMX parameter.

24

Table C.13: DECK option input data lines in PEGS.
Line and Format
DECK1 (4A1)

Variables
OPT(1:4)

DECK2

NAMELIST

Comments‘DECK’. Means “print ﬁtted data and other usefulparameters.”
No parameters, but &INP and &END tags must bepresent.

Table C.14: TEST option input data lines in PEGS.
Line and Format
TEST1 (4A1)

Variables
OPT(1:4)

TEST2 NAMELIST

NPTS

Comments‘TEST’. Means “Prepare data for plotting the ﬁtted
functions.”
Optional. Number of points to plot per function (Default=50).

Table C.15: CALL option input data lines in PEGS.
Line and Format
CALL1 (4A1)

Variables
OPT(1:4)

CALL2 NAMELISTCALL3 (6A1)

XP(1:4)
NAME(1:6)

Comments‘CALL’. Means “Call the designated function andprint value.”
Values for up to four arguments of the function.
Name of function to be evaluated.

Table C.16: PLTI option input data lines in PEGS.
Line and Format
PLTI1 (4A1)

Variables
OPT(1:4)

PLTI2 NAMELIST

IFUN
XP(1:4)
IV
VLO
VHI
NPTS
IDF

Comments’PLTI’. Means “Plot function given its index and theindex of the distribution function.”
The index of the function to be plotted.
Values for the static arguments (parameters).
Variable telling which argument is to be varied (e.g.,
IV=2 means plot function vs. its second argument).
Lower limit for argument being varied.
Upper limit for argument being varied.
Number of points to plot.
Index of distribution function used to select independent variable.

25

Table C.17: PLTN option input data lines in PEGS.
Line and Format
PLTN1 (4A1)
PLTN2 NAMELISTPLTN3 (2(6A1))

Variables
OPT(1:4)
XP(1:4), IV,
VLO, VHI, NPTS,
IDF, MP
NAME(1:6)
IDFNAM(1:6)

Comments’PLTN’. Means “Plot the named function.”
Same as PLTI2.

Name (6 characters) of function to be plotted.
Name of distribution function to be used.

Table C.18: HPLT option input data lines in PEGS.
Line and Format
HPLT1 (4A1)

Variables
OPT(1:4)

Comments’HPLT’. Means “Plot histogram to compare thesampled spectrum with the range-integrated andthe diﬀerential theoretical values.”
HPLT2 NAMELISTEITest particle total energy (MeV).
ISUB
Variable telling which function is being tested:
1=PAIR 2=COMPT 3=BREMS 4=MOLLER
5=BHABHA 6=ANNIH 7=MSCAT (not implemented).
HPLT3: FORMAT(’ TEST DATA FOR ROUTINE=’,12A1,’,#SAMPLES=’,I10,’,NBINS=’,I5)
NAMESB(1:12) Name of subroutine tested.
NTIMES
Number of samples.
NBINS
Number of histogram bins.
HPLT4: FORMAT(’ IQI=’,I2,’,RNLO,RNHI=’,2F12.8,’,IRNFLG=’,I2)
IQI
Charge of test particle.
RNLO,RNHI
Lower and upper limits to random number preceding call to test function.
IRNFLG
Non-zero means to “apply above limits to preceding random number to test for correlation.” Zerovalue means “don’t do this.”
HPLT5...etc, (9I8) NH(1:NBINS)
Sampled data (from User Code UCTESTSR).

26

The MIXTure option is similar to the COMPound option except that the relative atomic proportions are given by weight (RHOZ(I)) rather than by number. When the PZ(I) values havebeen speciﬁed, PEGS obtains values of RHOZ(I) using RHOZ(I)=PZ(I)*WA(I). Otherwise, PZ(I)values are obtained from PZ(I)=RHOZ(I)/WA(I). The absolute normalization of the PZ(I) andRHOZ(I) values is not important because of the way the quantities are used. For example, themacroscopic cross sections contain factors like PZ(I)/SUM(PZ(I)*WA(I)) where the denominatoris the molecular weight.
Users may supply values for the various parameters used in calculating the density eﬀect correction by setting the ﬂag ISSB to 1 and specifying the six parameters, AFACT, SK, X0, X1, CBAR,
and IEV) in the NAMELIST/INP input in ELEM, MIXT, or COMP. Note that if one only wants tooverride IEV, one must still input all six parameters.
Alternatively, users may request values of the density eﬀect correction taken from the NBS(now NIST) database EPSTAR, in which case collision stopping powers calculated by PEGS willcorrespond with values from the ICRU-37 standard. To invoke this option, the ﬂag EPSTFL in
NAMELIST/INP/ should be set to 1, and the appropriate data ﬁle from either the elements or thecompounds subdirectory of the density corrections directory of the EGS5 distribution dataﬁles should be copied or linked to a ﬁle called “epstar.dat” in the working user code directory. Notethat when this option is employed and multiple materials are being processed, all of the appropriate
data ﬁles from density corrections must be concatenated onto epstar.dat in the order in which
the materials are referenced in the PEGS input ﬁle.
Rayleigh (coherent) scattering data will be appended to the normal PEGS output data if the
IRAYL ﬂag is set to 1 or 2 in NAMELIST/INP/. An IRAYL value of 2 indicates that interference eﬀects
in coherent scattering are to be modeled, the user must supply pre-computed values of the coherent
scattering cross section and coherent scattering form factors for the material in question. This isdone by copying or linking the appropriate data ﬁles to ﬁles named “ics.dat” and ‘iﬀ.dat” in theworking user code directory. Sample data ﬁles in the appropriate format for several materials areincluded in the int coherent cs and int form factor directories of the EGS5 distribution data
set. As with the use of the EPSTFL ﬂag, when multiple materials are being used all of the relevantmaterial data ﬁles must be concatenated together in the proper order. Note that an option IRAYL=3
exists in which PEGS will print the Form Factors themselves, rather than cumulative distributions
for sampling in EGS runs, when the user wishes to study this data. Note that EGS will abort if it
encounters a PEGS data ﬁle prepared with IRAYL=3.
Altering the value of the NAMELIST/INP/ ﬂag IUNRST causes diﬀerent versions of the stopping
power to be computed and printed in place of the default required by EGS (i.e., the sum of therestricted collision and radiative stopping powers). This functionality is most useful in extracting
data sets from PEGS-only user codes for comparison with publish results, and should not be
invoked when preparing data ﬁles for EGS runs. The available options and their eﬀects are given
in Table C.7.
Users may specify the way in which PEGS normalizes bremsstrahlung cross sections by altering
the value of the NAMELIST/INP/ ﬂag IAPRIM, which has a default value of 1 (see Chapter 2 of27

SLAC-R-730/KEK-2005-8 for a complete discussion). Since radiative stopping powers calculated
by default in PEGS comply with ICRU standards, changing IAPRIM is not recommended except
during the development of and testing of new bremsstrahlung cross sections.
Users may input values of the empirical constant which is to be used to represent the contributionof soft electron collisions to multiple nuclear elastic scattering distributions by specifying the valueof the parameter FUDGEMS in NAMELIST/INP/. The default of FUDGEMS is 1, which corresponds toapproximating angular deﬂection due to electron scattering by replacing the Z 2 term in the nuclear
elastic cross section with Z(Z +1). See Chapter 2 of SLAC-R-730/KEK-2005-8 for a full discussion.
When the parameter IBOUND is set to 1 in NAMELIST/INP/, the eﬀect of electron binding on the
total Compton scattering cross section is taken into account, as described in Chapter 2 of SLACR-730/KEK-2005-8. In the default case (IBOUND = 0), atomic electrons are considered to be free
and at rest for the purpose of modeling Compton scattering.
The eﬀects of electron binding on the angular distribution of Compton scattered photons aremodeled when, in conjunction with setting IBOUND to 1, the user also sets the parameter INCOH to
be 1 in NAMELIST/INP/.
The eﬀects of atomic electron motion on the energy distribution of photons Compton scatteredthrough given angles (this is often referred to as “Doppler broadening”) can be explicitly treatedby specifying the value of the parameter ICPROF. Currently, ICPROF may be set to only 3 (in whichcase the user must supply values of shell-by-shell Compton proﬁles) or -3, in which case shellwise Compton proﬁle data is read from data ﬁles provided with the EGS5 distribution. When
ICPROF is set to 3, the user must copy or link the input proﬁle data to a ﬁle named “scp.dat” inthe working user code directory. If multiple materials are being processed, data for all materials
must concatenated to scp.dat in the order in which the materials are speciﬁed in the PEGS input
ﬁle. In PEGS-only user codes designed to generate physics data for examination and study, users
may request that PEGS output raw Compton proﬁle data by specifying ICPROF to be 4 (for user
supplied proﬁle data) or -4 (for PEGS generated proﬁle data). In almost all instances, users wishing
to model Compton Doppler broadening should use ICPROF=-3. Note that EGS requires that IBOUND
and INCOH be set to 1 when modeling of Doppler broadening is requested, and that EGS will not
accept PEGS data sets prepared with ICPROF values of 4 or -4.
If electron impact ionization is to be explicitly treated, the user must specify which cross section
is to be used by deﬁning a non-zero value for the parameter IMPACT in NAMELIST/INP. The list ofavailable cross sections and the values of IMPACT needed to invoke them is given in Table C.8. The
user is referred to Chapter 2 of SLAC-R-730/KEK-2005-8 for a discussion of the derivations andlimitations of the various cross sections.
If the user wishes to employ the Goudsmit-Saunderson multiple scattering distribution basedon partial-wave elastic scattering cross sections instead of the default Molière distribution, the
NAMELIST/INP parameter IGSDST must be set to 1. To some extent, the user may control the speed
and accuracy of the computation of the Goudsmit-Saunderson distribution by altering the valueof the parameter NLEG0. This is not recommended except during development. See Chapter 2 of28

SLAC-R-730/KEK-2005-8 for a discussion of instances in which use of the Goudsmit-Saundersonformalism may be appropriate.
Electron and positron multiple scattering step sizes to be taken in EGS run may be speciﬁed by
the user when the parameters EFRACH and EFRACL are deﬁned in NAMELIST/INP in a PEGS input
ﬁle. (Including these EGS-related quantities in PEGS arises from the need to compute electron
multiple scattering step sizes in terms of scattering strength for the new EGS5 transport mechanics.
The parameters EFRACH and EFRACL refer to the fractional energy loss which occurs over the stepat energies corresponding to UE and AE respectively. See Chapter 2 of SLAC-R-730/KEK-2005-8
for a detailed description of multiple scattering step-size selection.
In addition to physically specifying the material being used, a unique name must be supplied(MEDIUM(1:24)) for identiﬁcation purposes. This name is included in the output ﬁle when the
DECK option is selected. One useful feature of this implementation is that diﬀerent names canbe used for data sets created with the same materials but diﬀerent parameters. For example, one
might produce PEGS output using a particular material but diﬀerent energy limits (or ﬁt tolerances,density eﬀect parameters, etc.), with separate identiﬁcation names for each (e.g., FE1, FE2, etc.).
The quantity IDSTRN(1:24) is used to identify the Sternheimer-Seltzer-Berger density eﬀectparameters that are tabulated in BLOCK DATA (see Chapter 2 of SLAC-R-730/KEK-2005-8 for acomplete list of identiﬁer names and a general discussion of the density eﬀect). If IDSTRN(1) isblank, then IDSTRN is given the same value as MEDIUM. If this name is not identiﬁable with anyof those in BLOCK DATA, the Sternheimer density eﬀect scheme is replaced with a general formulaby Sternheimer and Peierls. Note that the options for computing stopping powers and the density
eﬀect invoked by either ISSB or EPSTFL take precedence over the speciﬁcation of IDSTRN.
After reading the input data for these options, subroutine MIX is called in order to compute theZ-related parameters that reside in COMMON/MOLVAR/, subroutine SPINIT is called to initialize thestopping power routines for this material, and subroutine DIFFER is called to compute run-timeparameters for the pair production and bremsstrahlung sampling routines.
The following are examples of sets of input data lines that can be used with the ELEM, MIXT,
and COMP options:

1. Material - Element is Iron with defaults taken.

Line
ELEM1
ELEM2
ELEM3
ELEM4

Column123456789112345678921234567893123456789412345678..etc.
ELEM&INP &END
IRON
FE
FE

2. Material - Element is Helium-3 with the density and atomic weight overridden by user.
29

Line
ELEM1
ELEM2
ELEM3
ELEM4

Column123456789112345678921234567893123456789412345678..etc.
ELEM&INP RHO=1.E-2,WA(1)=3 &END
HELIUM-3
HE
HE

3. Material - Compound is sodium iodide, and IDSTRN(1:24) defaults to MEDIUM(1:24).

Line
COMP1
COMP2
COMP3
COMP4

Column123456789112345678921234567893123456789412345678..etc.
COMP&INP NE=2,RHO=3.667,PZ(1)=1,PZ(2)=1 &END
NAI
NA I

4. Material - Compound is polystyrene scintillator (e.g., PILOT-B or NE-102A) with data taken
from: “Particle Properties Data Booklet, April 1982” (Physics Letters 111B, April 1982).
Sternheimer-Peierls default.

Line
COMP1
COMP2
COMP3
COMP4

Column123456789112345678921234567893123456789412345678..etc.
COMP&INP NE=2,RHO=1.032,PZ(1)=1,PZ(2)=1.1 &END
POLYSTYRENE SCINTILLATOR
C H

5. Material - Mixture is lead glass, consisting of ﬁve speciﬁed elements (and 1 per cent of the
trace elements unspeciﬁed). Sternheimer-Peierls default.

Line
MIXT1
MIXT2
MIXT3
MIXT4

Column123456789112345678921234567893123456789412345678..etc.
MIXT&INP NE=5,RHO=3.61,RHOZ=41.8,21.0,29.0,5.0,2.2 &END
LEAD GLASSPB SI O K NA

6. Material - Mixture is U-235, U-238, and carbon (not a real material). Sternheimer-Peierls
default.

Line
MIXT1
MIXT2
MIXT3
MIXT4

Column123456789112345678921234567893123456789412345678..etc.
MIXT&INP NE=3,RHO=16,WA=235,238,RHOZ=50,30,10 &END
JUNK
U U C
30

7. Material - Element is Iron with shell-wise Compton proﬁle.

Line
ELEM1
ELEM2
ELEM3
ELEM4

Column123456789112345678921234567893123456789412345678..etc.
ELEM&INP IBOUND=1,INCOH=1,ICPROF=-3 &END
IRON
FE
FE

8. Material - Element is Iron with EII cross section by Casnati’s formula.

Line
ELEM1
ELEM2
ELEM3
ELEM4

C.3.3

Column123456789112345678921234567893123456789412345678..etc.
ELEM&INP IMPACT=1 &END
IRON
FE
FE

The ENER Option

The ENERgy option is used to deﬁne the electron and photon energy intervals over which it isdesired to transport particles, and hence, over which ﬁts to total cross sections and branchingratios must be made. The electron energy interval is (AE,UE) and the photon interval is (AP,UP).
If any of these parameter is entered by the user with a negative value, it is multiplied by -0.511 MeV;
that is, the absolute magnitude of the input energy is assumed to be in units of the electron rest
mass energy. The quantities TE=AE-RM, TET2=2*TE, and TEM=TE/RM, as well as the bremsstrahlung
and Møller thresholds (RM+AP and AE+TM, respectively), are then computed and printed out.
The following are examples of sets of input data lines that can be used with the ENER option:
1. Electron and photon cutoﬀ energies are 1.5 MeV and 10 keV, respectively. The upper energy
limit for both is set at 100 GeV. (Note: All energies are in MeV and are total energies).

Line
ENER1
ENER2

Column123456789112345678921234567893123456789412345678..etc.
ENER&INP AE=1.5,UE=100000.,AP=0.01,UP=100000. &END

2. Same as above, except AE=3*RM.

Line
ENER1
ENER2

Column123456789112345678921234567893123456789412345678..etc.
ENER&INP AE=-3,UE=100000.,AP=0.01,UP=100000. &END
31

C.3.4

The PWLF Option

The PieceWise Linear Fit option performs a simultaneous piecewise linear ﬁt (vs. ln(E − RM ))of ten or twelve electron functions over the energy interval (AE,UE) and a simultaneous piecewise
linear ﬁt (vs. ln E) of three or four photon functions over the energy interval (AP,UP). Eachsimultaneous ﬁt over several functions is accomplished by a single call to subroutine PWLF1, once
for the electrons and once for the photons. (By simultaneous ﬁt we mean that the same energy subintervals are used for all of the functions of a set.)
The PWLF1 subroutine is an executive routine that calls the function QFIT. Function QFIT tries
to perform a ﬁt to the vector function by doing a linear ﬁt with a given number of subintervals.
It returns the value .TRUE. if the ﬁt satisﬁes all tolerances and .FALSE. otherwise. Subroutine
PWLF1 starts out doubling the number of subintervals until a successful ﬁt is found. Additional calls
to QFIT are then made to determine the minimum number of subintervals needed to give a goodﬁt. Sometimes, because of discontinuities in the functions being ﬁtted, a ﬁt satisfying the speciﬁed
tolerances cannot be obtained within the constraints of the number of subintervals allowed by thearray sizes of EGS. When this happens, PEGS prints out the warning message (for example):
NUMBER OF ALLOCATED INTERVALS(= 150) WAS INSUFFICIENTTO GET MAXIMUM RELATIVE ERROR LESS THAN
0.01
Even in this case a ﬁt is produced which is suﬃcient most of the time. Suppose NFUN is the numberof components to the vector function F(IFUN,E(J)) (where IFUN runs from 1 to NFUN) and E(J) isa sequence of points (with J from 1 to NI) covering the interval being ﬁtted. The number of points
NI must be about ten times the number of ﬁt intervals NINT so that the ﬁt will be well tested in theinteriors of the intervals. If FEXACT(IFUN,J) and FFIT(IFUN,J) are the exact and ﬁtted values of
the IFUNth component at E(J), then the ﬂow of the logical function QFIT may be shown as follows:
LOGICAL FUNCTION QFIT(NINT)(commons and declarations)
QFIT=.TRUE.
REM=0.0
NI=10*NINT
DO J=1,NI
DO IFUN=1,NFUN
AER=ABS(FEXACT(IFUN,J)-FFIT(IFUN,J))
AF=ABS(FEXACT(IFUN,J))
IF(AF.GE.ZTHR(IFUN)) THEN
IF(AF.NE.0.0) REM=AMAX1(REM,AER/AF)
ELSE
IF(AER.GT.ZEP(IFUN)) QFIT=.FALSE.
END DOEND DO
32

QFIT=QFIT.AND.REM.LE.EP
RETURN
END
Thus we see that EP is the largest allowed relative error for those points where the absolute computed
value is above ZTHR(IFUN), and ZEP(IFUN) is the largest allowed absolute error for those points
where the absolute computed value is less than ZTHR(IFUN).
Other features of the QFIT routine include provisions for aligning a subinterval boundary at a
speciﬁed point in the overall interval (in case the ﬁtted function has a discontinuous slope such asat the pair production or Møller thresholds), and computing ﬁt parameters in bins ﬂanking themain interval to guard against truncation errors in sub-interval index computations.
The net result of the ﬁt is the determination of coeﬃcients AX, BX, AF(IFUN,J), and BF(IFUN,J)
such thatFVALUE(E)=AF(IFUN,INTERV)*XFUN(E) + BF(IFUN,INTERV)
is the value of the IFUNth function, and where
INTERV=INT(AX*XFUN(E) + BX).
XFUN is called the distribution function and is ln(E − RM ) for electrons and ln(E) for photons.
Note that the coding of EGS is designed to allow a “mapped PWLF” in which we have AX, BX,
AF(IFUN,J), BF(IFUN,J), and M(I), such that when I=INT(AX*XFUN(E)+BX) and J=M(I), thenFVALUE(E)=AF(IFUN,J)*XFUN(E) + BF(IFUN,J)
for the IFUNth function. This kind of ﬁt has the advantage that it yields a better ﬁt with asmaller amount of stored data than the default ﬁt computed by PWFL1. Such a scheme has neverbeen implemented in PEGS, however, despite that more data than necessary is currently used in
describing the functions at higher energies where they vary quite smoothly.
The following is an example of the input data lines that can be used with the PWLF option:

Line
PWLF1
PWLF2

Column123456789112345678921234567893123456789412345678..etc.
PWLF&INP &END
33

C.3.5

The DECK Option

The DECK option, with the aid of subroutine LAY, prints the data needed to specify the current
material, the energy intervals speciﬁed, various computed molecular parameters (e.g., the radiation
length), the run-time parameters for pair production and bremsstrahlung, and the ﬁt data producedby the PWLF option. In other words, DECK prints anything that might be of use to EGS in
simulating showers or to users in analysis routines. Subroutines LAY (in PEGS) and HATCH (in
EGS) are a matched pair in that HATCH reads what LAY writes (PEGS “lays” and EGS “hatches”).
Thus when users alter LAY to write additional material data to PEGS output ﬁles, HATCH must be
be updated appropriately.
DECK should be invoked when either ELEM, MIXT, or COMP and ENER and PWLF havebeen run for the current material and before any of these have been executed for the next material(see Figure C.9). The following is an example of the input data lines that can be used with the
DECK option:

Line
DECK1
DECK2

Column123456789112345678921234567893123456789412345678..etc.
DECK&INP &END

C.3.6

The TEST Option

The TEST option is used as an easy way to obtain data for plots of some of the functions (notthe ﬁts) that the PWLF option ﬁts. Output is printed to a ﬁle “pgs5job.pegs5plot” in the working user code directory, and includes sequential sets of data from PEGS functions ESIG, PSIG,EDEDX, PDEDX, EBR1, PBR1, PBR2, TMXS, TMXDE2, GMFP, GBR1, GBR2 and CRATIO. Thus the
TEST option provides yet another useful PEGS tool for examining and studying raw physics data.
The following is an example of the input data lines that can be used with the TEST option:

Line
TEST1
TEST2

Column123456789112345678921234567893123456789412345678..etc.
TEST&INP NPTS=50 &END

C.3.7

The CALL Option

The CALL option is used whenever one desires to have PEGS evaluate a particular function andprint out the results. The following is an example of the input data lines that can be used with34

the CALL option in order to test for discontinuities in GMFP (Gamma Mean Free Path) near 50
MeV. (Note: In this example we have included the (necessary) ELEM option data lines for Lead).

Line
ELEM1
ELEM2
ELEM3
ELEM4
CALL1
CALL2
CALL3
CALL1
CALL2
CALL3

Column123456789112345678921234567893123456789412345678..etc.
ELEM&INP &END
PB
PB
CALL
&INP XP(1)=49.99 &END
GMFP
CALL
&INP XP(1)=50.01 &END
GMFP

The resulting output from a user code accessing PEGS would be:
OPT = CALL
Function call:
OPT = CALL
Function call:

C.3.8

1.95522= GMFPOF

49.9900

1.97485= GMFPOF

50.0100

The PLTI and PLTN Options

The PLTI and PLTN options may be used to obtain printer plots of any of the functions in the
PEGS function table. These options are somewhat analogous to the TEST option in that they callthe same PEGS output routine (subroutine PLOT) and write output data in the same format to thesame ﬁle (‘pgs5job.pegs5plot’ in the working user code directory). However, the information which
can be extracted using the TEST option is restricted to the energy-dependent default functions
over the ranges from AE to UE and AP to UP, while PLTI and PLTN can access arbitrary PEGS
functions and produce physics data over arbitrary ranges. The PLTI option is rather primitive inthat the functions involved must be speciﬁed by number, so we shall instead concentrate on the
PLTN option in which the functions are speciﬁed by name.
Consider the function BRMSRZ(Z,E,K1,K2), which is the soft bremsstrahlung cross section (for anelectron of total energy energy E and element Z) integrated over the photon energy range (K1,K2).
Suppose we would like to see a plot of BRMSRZ(2,E,0.0,1.5) for values of E from 5 to 100 MeV.
Also assume we want the data points evenly spaced in ln(E). Then (see Table C.17) the function
name we would use is BRMSRZ, the distribution function name to be speciﬁed is IDFNAM=ALOG, thestatic arguments needed are XP(1)=2., XP(3)=0.0, XP(4)=1.5, the independent variable to beaccessed is the second argument (i.e., IV=2), and its limits are VLO=5.0 and VHI=100.0. If we want
35

IDFNAM
ALIN
DLOG
ALKE
ADFMOL

Table C.19: Distribution functions available with PLTI and PLTN.
PurposeLinear plot.
Natural log plot.
Natural log of electron kinetic energy plot.
Approximation to Møller and Bhabha distributions

100 points on the data set we speciﬁc NPTS=100. The input data lines necessary to accomplish this
are:

Line
PLTN1
PLTN2
PLTN3

Column123456789112345678921234567893123456789412345678..etc.
PLTN&INP XP(1)=2.,XP(3)=0.0,XP(4)=1.5,IV=2,VLO=5.,
VHI=100.,NPTS=100 &END
BRMSRZALOG

Distribution functions that are available are listed and described in Table C.19.

C.3.9

The HPLT Option

The Histogram PLoT option is designed to be used in conjunction with UCTESTSR (User Codeto TEST Sampling Routine), which is provided with the EGS5 distribution. This option provides
a way to test the EGS methods used to sample diﬀerential distributions functions by looking
for discrepancies between actual diﬀerential physics data and histograms of sampled data during
simulations.
Suppose that a probability density function, P DF (X) (see Chapter 2 of SLAC-R-730/KEK2005-8), is to be sampled by EGS (note: P DF (X) will have other static arguments which we
ignore for this discussion). Let CDF (X) be the cumulative distribution function associated withP DF (X). If P DF (X) drops sharply with increasing X, we will not get many samples in thebins with large X unless we make the bins themselves larger in such regions. We accomplish
this by ﬁnding another p.d.f.and c.d.f., P DG(X) and CDG(X), respectively, such that P DG(X)approximates P DF (X). If we want N bins, we then pick the X(I) such that
CDG(X(I+1))-CDG(X(I))=(CDG(X(N+1))-CDG(X(I)))/N.
For all I this implies that
X(I)=CDGI((CDG(X(N+1))-CDG(X(1)))*I/(N+1) + CDG(X(1)))
36where CDGI is the inverse function of CDG. Thus, if P DG(X) is a reasonable approximation,
the histogram bins at large X should have the same order of magnitude of counts as those at lower
X. The function CDG(X) is called the “distribution function” in the context of the HPLT option.
CDG(X), CDGI(X), and P DG(X) are used by the UCTESTSR user code and HPLT1 subroutine
in PEGS. If we let SP DF (X) and SCDF (X) be the “sampled” data, and P DF (X) and CDF (X)be the theoretical data, then the routine HPLT1 can be summarized by the pseudo-code:
DO I=1,N
PLOT((SCDF(X(I+1))-SCDF(X(I)))/(CDG(X(I+1))-CDG(X(I))))
PLOT((CDF(X(I+1))-CDF(X(I)))/(CDG(X(I+1))-CDG(X(I))))
DO....X(I) at 10 points in the interval (X(I),X(I+1))
PLOT(d(SCDF)/d(CDG)=PDF(X)/PDG(X))
END DO
RETURNEND
All of the input data lines for a speciﬁed HPLT option are printed directly by UCTESTSR tostandard output. This data can then be used in a subsequent run of PEGS to produce line-printerstyle plots of the actual and sample functions . Users should refer to the listing for UCTESTSR andcomments therein for a better understanding of the HPLT option (see also Chapter 6 of SLAC-210).

C.4

Concluding Remarks

In the previous sections we have seen the various uses for PEGS. We summarize by giving theoption sequences most generally used:

1. Minimal options for a material data set creation (for later use by EGS):
1.
2.
3.
4.

ELEM (or MIXT, or COMP)
ENER
PWLF
DECK

2. Same as above, with default data dumps of functions for which the PWLF option provides
ﬁts:
1.
2.
3.
4.
5.

ELEM (or MIXT, or COMP)
ENER
TEST
PWLF
DECK
37

3. Comparison of theoretical and sampled distributions by means of the HPLT option:
1.

2.

ELEM (or MIXT, or COMP)
Note: Data lines should agree with those usedwith the UCTESTSR run that generated the HPLT input.
HPLT
Note: Output data from UCTESTSR run.

4. Selective plotting of various functions:
1.
2.
3.
4.
5.
6.

ELEM (or MIXT, or COMP) - for material 1
PLTN - for function 1
PLTN - for function 2,....etc.
ELEM (or MIXT, or COMP) - for material 2,....etc.
PLTN - for function 1
PLTN - for function 2,....etc.

38