\documentstyle[twoside,11pt]{article}

\newcommand{\spscrpt}[1]{\raisebox{0.8ex}{\scriptsize#1}}
\newcommand{\sbscrpt}[1]{\raisebox{-.8ex}{\scriptsize#1}}
\newcommand{\footcomma}{\raisebox{0.8ex}{\scriptsize,}}
\newcommand{\refer}[1]{\raisebox{0.8ex}{{\scriptsize #1}}}
\newcommand{\cites}[1]{\raisebox{0.8ex}{{\scriptsize\cite{#1}}}}
\newcommand{\cbg}{{\sc cbgeant}}
\newcommand{\gea}{{\sc geant}}
\newcommand{\zeb}{{\sc zebra}}
\newcommand{\unix}{{\sc unix}}
\newcommand{\cmz}{{\sc cmz}}
\newcommand{\cernvm}{{\sc cernvm}}
\newcommand{\vax}{{\sc vax}}
\newcommand{\pbar}{\overline{p}}
\newcommand{\nbar}{\overline{n}}
\newcommand{\Lambdabar}{\overline{\Lambda}}
\newcommand{\Sigmabar}{\overline{\Sigma}}
\newcommand{\Xibar}{\overline{\Xi}}
\newcommand{\Omegabar}{\overline{\Omega}}
\newcommand{\Dbar}{\overline{D^0}}

\newcommand{\British}{\def\today{\number\day\space \ifcase\month\or
January\or February\or March\or April\or May\or June\or July\or
August\or September\or October\or November\or December\fi , \space
\number\year}}

%Europe
\setlength{\unitlength}{1pt}
\textwidth=433pt
\topmargin=-21.57pt
\oddsidemargin=7.53pt
\evensidemargin=7.53pt
\footheight=36pt
\textheight=650pt
\renewcommand{\baselinestretch}{1.1}

%US
%\setlength{\unitlength}{1pt}
%\textwidth=464pt
%\topmargin=0.pt
%\oddsidemargin=0.pt
%\evensidemargin=0.pt
%\footheight=36pt
%\textheight=605pt
%\renewcommand{\baselinestretch}{1.1}

\raggedbottom

\begin{document}

\British
\pagestyle{empty}

\begin{titlepage}

\title{
\makebox[\textwidth][r]{\normalsize
CB--Note 169/Version 1.1}\\[2cm]
LEAR Crystal Barrel Experiment, PS197\\
Monte Carlo Software\\
\cbg{} 4.06/03}
\author{Roy Bossingham\\ University of California, Berkeley}
\date{12 February, 1992}
\maketitle
\begin{figure}[h]\centering
\begin{picture}(200,250)
\thicklines 

\put(  0.0,  0.0){\framebox(200,15){ }}
\multiput(  0.0,  0.0)( 15,0){13}{\line( 1,1){15}}
\multiput(200.0,  0.0)(-15,0){13}{\line(-1,1){15}}
\put(  0.0,235.0){\framebox(200,15){ }}
\multiput(  0.0,235.0)( 15,0){13}{\line( 1,1){15}}
\multiput(200.0,235.0)(-15,0){13}{\line(-1,1){15}}
\put(  0.0, 20.0){\framebox(15,210){ }}
\multiput(  0.0,20.0)(0,15){14}{\line( 1,1){15}}
\multiput( 15.0,20.0)(0,15){14}{\line(-1,1){15}}
\put(185.0, 20.0){\framebox(15,210){ }}
\multiput(185.0,20.0)(0,15){14}{\line( 1,1){15}}
\multiput(200.0,20.0)(0,15){14}{\line(-1,1){15}}

\put( 20.0, 20.0){\line(1,0){160}}
\put( 20.0,230.0){\line(1,0){160}}
\put( 20.0, 20.0){\line(0,1){ 70}}
\put(180.0, 20.0){\line(0,1){ 70}}
\put( 20.0,160.0){\line(0,1){ 70}}
\put(180.0,160.0){\line(0,1){ 70}}
\put( 20.0, 90.0){\line( 4, 3){35}}
\put( 20.0,160.0){\line( 4,-3){35}}

\put(180.0, 90.0){\line(-4, 3){35}}
\put(180.0,160.0){\line(-4,-3){35}} 

\put( 55, 80){\line(1, 0){90}}
\put( 55,170){\line(1, 0){90}}
\put( 55, 80){\line(0, 1){36.25}}
\put(145, 80){\line(0, 1){36.25}}
\put( 55,170){\line(0,-1){36.25}}
\put(145,170){\line(0,-1){36.25}}

\put( 60, 85){\framebox(80,80){}}
\put( 60,120){\framebox(80,10){}}
\put( 90,122){\framebox(20, 6){}}

\end{picture}
\end{figure}

\end{titlepage}
\clearpage

\pagestyle{plain}
\setcounter{page}{1}
\pagenumbering{roman}
\tableofcontents
\listoftables
%\listoffigures
\clearpage

\setcounter{page}{1}
\setcounter{section}{0}
\pagenumbering{arabic}

\section{Introduction}

\cbg{} is the basic event simulation package for the Crystal Barrel
detector.  It initiates an event, describes geometry, extracts data
about energy deposition in sensitive detector elements, simulates
detector response, applies experimental distortions and records output
data in a format compatible with actual events to allow later analysis
by the standard programs.  The CERN code package \gea{}, version 3.14
or 3.15 (the corresponding \cbg{} code being extracted with a version
number patch), is used to propagate the initial particles along with
their decay and/or shower products, and to apply energy loss,
scattering and the dominant electromagnetic and hadronic processes to
which they are subject.  Like the well-known {\sc egs4} Electron-Gamma
Shower code, \gea{} is a condensed history Monte Carlo.  (While some
of \gea{}'s algorithms have been borrowed from {\sc egs4}, the actual
{\sc egs4} code is not a subset of \gea{}.)

Condensed history Monte Carlos tend to be CPU intensive, and \cbg{} is
no exception.  While there are wide variations depending on beam
energy, decay channel and random statistics, an event typically
requires 11 seconds on a \mbox{{\sc sparc}station {\sc I}}, 4.5
seconds on the {\sc cbdec} {\sc decs}tations or 40 seconds on a {\sc
vax 3600}.  Since a serious Monte Carlo run usually involves upwards
of a thousand events, jobs are usually run in batch mode, often in the
background.

However, \cbg{}/\gea{} also support an interactive mode in which the
user may display various views of detector components, as well as
produce and plot event tracks superimposed on predefined views.  This
allows the user to detect coding errors and to directly visualize
detector effects, which is very useful (if not essential) for code
debugging and development.

All \cbg{} code is written in Fortran.  The machines which it
currently supports are the Zurich Alliant under \unix{}, {\sc
decs}tations under {\sc ultrix}, \cernvm{} under {\sc ibm/cms}, {\sc
sparc}stations and {\sc vax/vms}.  It is likely that the code will run
on other \unix{} machines with relatively few changes when extracted
for a similar, supported machine.  However, there are machine
dependencies in I/O handling, and extentions to ANSI-77 Fortran
occasionally appear, so one must expect to encounter {\em some}
problems when transporting the code.  Considerable effort could be
required for some machines, especially if the CERN libraries are not
supported on them.

The present \cbg{} incarnation builds on version 4.02, but contains
many major changes; most results should {\em not} be consistent
between them.  In general, user code must be recompiled due to the
redefined common blocks in \cbg{} and \gea{}.  A more detailed
comparison appears in a later section, but some of the substantive
changes to \cbg{} are:
\begin{itemize}
\item{
The geometry and materials sections have been rewritten with much
greater detail and accuracy; in many respects, the detector in version
4.02 was the proposal detector, rather than the real device.  An
incompatibility in the output data arises from the rotations of the
JDC and PWC to their approximate positions in the real detector.}
\item{
More physics processes are now implemented by default.  Default energy
thresholds for particle production and tracking have been lowered to
improve the shower simulation accuracy.  Improvements in \gea{} 3.14
have made a number of other physics improvements possible, including
the inclusion of Landau straggling and handling of nuclear
fragmentation by the {\sc nucrin} code.  The intention is for \cbg{}
to give a {\em reasonably} accurate, general-purpose detector
simulation with the default settings.}
\item{
The \cbg{} particle definitions have been improved.  Parameters were
updated to 1990 Particle Data Book values, and branching to forbidden
channels was eliminated.}
\item{
There is more flexibility in the choice of annihilation vertex
distributions, and non-uniformities in the particle distributions from
several of the test generators were fixed.  Support for additional
annihilation channels was added, and the branching ratios for unbiased
decay were improved; a larger fraction of the branching ratio was put
into intermediate states.  In addition, LD$_2$ targets are now
supported.}
\item{
Fixes for several severe \gea{} tracking bugs involving
type-`many' volumes have been provided for \gea{} 3.14.
These have been fixed in the version 3.15 release.}
\item{
Additional non-ideal detector effects are now supported, including
$dE/dx$ dependence in CsI light output, variation in crystal
calibrations and separate random levels of coherent and incoherent
noise for FERA and 2282 ADC's.  The crystal calibration and noise can
be individually set for crystals.}
\item{
Tracking parameters have been changed in many places, and non-helical
tracking is now supported in the central part of the detector.  The
sign of the magnetic field has also been corrected, and fresh tables
of JDC drift time data are provided.}
\item{
Neutrinos are no longer tracked, and other particles are not tracked
beyond the point at which their time of flight exceeds the crystal ADC
gate duration.  On the other hand, particles are no longer rejected
when they go further than \mbox{85 cm} from the $Z$ axis.}
\item{
A number of new data cards increases the flexibility of the code.
Data cards will now be read from logical unit 99 (except on
\cernvm{}), taking them from standard input if this fails.}
\item{
Exchange-mode files and tapes are now supported on \unix{} systems.}
\item{
Additional data has been put into the informational data bank,
allowing automatic setting of detector parameters in the analysis code
and verification of the production conditions for a data set.}
\item{
Numerous bugs were fixed, a few new debugging options were added and
the code is more compliant with ANSI-77 Fortran standards.}
\item{
The documentation and scripts in the {\tt \$HISTORY} patch have been
rewritten and extended.}
\end{itemize}

The primary cost of the new version is the increased CPU time per
event: with the default parameters for both codes, \cbg{} 4.06/03 runs
half as fast as version 4.02/10.  Almost all of this cost is due to
particles having lower production thresholds/cuts and being tracked
into the magnet coil and beyond; the increased complexity of the
geometry has little impact (at least on a computer with enough memory
not to page fault).  Actually, it is \gea{}, rather than \cbg{}, in
which the bulk of the CPU time is spent, since \gea{} goes through
rather painful contortions to determine geometrical regions or to do
anything else).  One cannot expect much direct gain from streamlining
the \cbg{} code, and, since the CPU time is {\em not} highly sensitive
to the particle production thresholds and cuts, one cannot expect much
improvement by fine-tuning these parameters.  Some improvement might
come from optimizing the volume searching, but many of the obvious
improvements have already been made.

The CPU time required for run initialization is also increased
(typically a minute), which can be annoying when running
interactively, but is negligible for a serious job.  The setup time
can be cut significantly by using the {\tt CCUT} data card when
reducing the setup time is more important than the execution time
(e.g., for debugging).

Additional demands are also made on memory by the new code.  In
particular, problems may arise with interactive runs at high beam
energies.  It may sometimes be necessary to increase the memory
allocation in the main routine of \cbg{}.  For interactive running,
memory is allocated by a \gea{} substitute main program {\sc gxint},
so that one may need to change {\sc gxint}.  This is done by selecting
the {\tt BIG} or {\tt BIGBIG} patch when extracting {\sc gxint}.

The code has benefited from pre-release testing on various machines by
Tony Noble, Fritz-Herbert Hensius, Curtis Meyer, Gunter Folger,
Hans-Peter Dietz and Klaus Peters.  Also, Nigel Hessey made a number
of useful suggestions.  Several people besides myself have contributed
directly to coding the present version of \cbg{}, including Joachim
Zaers (who spent some weeks coding parts of the geometry); Christoph
Strassburger (who did part of the updating of the {\sc ugpart}
subroutine and provided the LD$_2$ annihilation code); and Stephen
Spanier and Klaus Peters (who have modified the JDC signal routines
somewhat).

Users will undoubtedly find residual bugs; comments on these or other
matters can be addressed to:
\begin{itemize}
\item{
Michael Kobel (overall responsibility, 1992)
{\sc kobel@cernvm.bitnet}}
\item{
Tony Noble (responsible for crystal coding):
{\sc potato@cernvm.bitnet}}
\item{
Klaus Peters (responsible for JDC coding):
{\sc peters@vipmza.physik.uni-mainz.de}}
\item{
Roy Bossingham: (versions 4.03--4.06)
{\sc rrbossingham@lbl.gov}}
\end{itemize}

CB Note \#103 ({\it The Monte Carlo Programmer's Guide}) by Klaus
Peters may be useful to the \cbg{} user, particularly its description
of many subroutines.  However, the present version is no longer
complete or entirely accurate, as it precedes this code release by two
or three years.  Other information may be available from earlier
\cbg{} authors: Kersten Braune, Gunter Folger, Fritz-Herbert Heinsius,
Marcel Kunze, Klaus Peters and Curtis Meyer.  M.~Guckes and
B.~Lewendel are no longer with the collaboration.  (Gunter Folger is
now in the DD Division.)

\clearpage

\section{Installation}

\subsection{\gea{} Support}

The first thing to verify is that one has a current version of \gea{}.
Testing was mainly done with version 3.14/16, correction cradle
3.14/07.  Versions before 3.14 are not supported and will not work,
while results with correction cradles before 3.14/07 cannot be
guaranteed.  Some earlier versions will give fatal errors on some
machines, while others will quietly yield incorrect results.

\cbg{} attempts to support \gea{} 3.15, and some testing has been done
with prerelease versions.  These give similar results and run at
nearly the same speed as 3.14 on a {\sc sparc}station 1, but,
interestingly, ran at twice the speed of 3.14 on the Alliant vector
processor in tests by Curtis Meyer.  \gea{} 3.15 has evolved
significantly during its prerelease testing phase, and earlier
versions may not perform correctly due to changes in common blocks,
bug fixes, lack of support for type `many' volumes, etc.  At a
minimum, verify that the version is dated 10-FEB-1992 or later.  As of
this writing, one may obtain the relavant files with anonymous ftp
from {\sc cernvm}:

{\samepage
\begin{verbatim}
    $ FTP 128.141.2.4
      anonymous
    ftp> CD LIBRARY.221
    ftp> GET GEANG315.CAR 
    ftp> GET GEANH315.CAR 
    ftp> GET GEANT315.CAR 
    ftp> GET GEANX315.CAR 
    ftp> GET GEANT315.CRA
    ftp> GET GEANX315.CRA
    ftp> GET GXINT315.CRA
\end{verbatim}

}

The \gea{} code is still being repaired and updated at CERN.  New
bugs, many of them significant, are reported (and often fixed) on a
regular basis.  The user should, therefore, use an up-to-date release
of \gea{}, and avoid using the code blindly.  It can be very
enlightening to dump a few events step-by-step with the {\tt DMPSTP}
patch.  If the code's behavior does not seem to make sense, there is a
good chance that you have found another bug (or made a linking error
or \ldots).

The default memory allocations in \gea{}'s main routine for the
interactive version, {\sc gxint}, are marginal and should be increased
by selecting {\tt BIG} when producing the code or by setting ones own
values in the code.  Reasonable starting values are: {\tt
NWGEAN=500000} and {\tt NWPAW=200000}.  If these are not enough, {\sc
zebra} will crash in an inelegant and uniformative way; try increasing
them further.  Memory requirements increase for higher particle
energies, lower particle production and tracking thresholds, for more
complex geometries and with the extraction of additional data from
events.

{\samepage
The person in charge of maintaining \gea{} at CERN is:
\begin{verbatim}
Federico Carminati
CERN-CN
1211 Geneva 23
41-22-767-4959
FCA@CERNVM.BITNET or VXCERN::FCA
\end{verbatim}

}

One should obtain the \gea{} documentation from CERN, since a number
of data cards and parameters are described in it and it is needed to
understand much of \cbg{}.  As of now, the \gea{} documentation
consists of a 3.15 draft manual (rough, with mistakes, but slated for
an early 1992 release); the 1987 manual (obsolete and no longer
distributed); the {\tt HISTORY} patch of the \gea{} code; and
occasional articles in the CERN Computer Newsletter.  Problems with
\gea{} and its future development are discussed at monthly \gea{} user
meetings held at CERN.  The dates for these meetings, and discussions
related to \gea{} problems and development are available through the
electronic discussion group.  One may subscribe by sending a message
to LISTSERV@CERNVM with a single-line body:
\begin{verbatim}
SUBSCRIBE LGEANT Firstname Lastname Institute
\end{verbatim}

{\samepage
To get the most recent history patches and correction cradles, send
mail to LISTSERV@CERNVM with the single lines:
\begin{verbatim}
GET GCORR HISTORY
\end{verbatim}
\begin{flushleft}
or
\end{flushleft}
\begin{verbatim}
GET GCORR CRADLE
\end{verbatim}

}

\subsection{Loading \cbg{} into \cmz{}}

The \cbg{} code is maintained under \cmz{}, but is usually distributed
as a card file.  One should reload this into \cmz{} using a current
\cmz{} version, since versions before mid-1991 are unable to handle
the large data decks in the {\tt DFILES} patch.  (If one is forced to
use an obsolete version of \cmz{}, one can strip the {\tt DFILES}
patch from the card file before proceeding.  An editor such as {\sc
emacs}, which does not balk at large files, is recommended.)  To load
the card file named {\tt CBGEANT040601.CAR}, start \cmz{}, then:
\begin{verbatim}
    CMZ> SEL .
    CMZ> SEQ .
    CMZ> PILOT .
    CMZ> RELEASE *
    CMZ> MAKE cbgeant
    CMZ> YTOC cbgeant040601.car
\end{verbatim}

\subsection{Patch Descriptions}

The \cbg{} patches are of several types.  The informational ones are:
\begin{tabbing}
{\bf \$VERSION} \hspace{0.2cm} \= \kill
{\bf \$VERSION} \> Descriptions of recent versions of \cbg{}.\\*
{\bf \$HISTORY} \> Instruction, documentation, .kumac files and
                   \unix{} scripts\\
\end{tabbing}

Machine patches are:
\begin{tabbing}
{\bf DECS} \hspace{0.2cm} \= \kill
{\bf ALT}  \> Zurich Alliant, running \unix{}\\*
{\bf DECS} \> {\sc decs}tations, running {\sc ultrix}\\*
{\bf IBM}  \> \cernvm{}, running {\sc cms}\\*
{\bf SUN}  \> {\sc sparc}stations, running \unix{}\\*
{\bf VAX}  \> \vax{}en, running {\sc vms}\\
\end{tabbing}

The pilot patches are listed next.  Those corresponding to the above
machines are for getting the standard batch version of \cbg{},
excepting the main, dummy user and \gea{} override routines.  All of
these use {\tt FASTJDC} and {\tt *BATCH}.  The user must externally
select the version of \gea{} to get the correct common blocks,
specifying {\tt GEA314} or {\tt GEA315}.
\begin{tabbing}
{\bf *ALLIANT} \hspace{0.2cm} \= \kill
{\bf *ALLIANT} \> Zurich Alliant\\*
{\bf *DECS}    \> {\sc decs}tations (MIPS compiler)\\*
{\bf *IBM}     \> \cernvm{}\\*
{\bf *SUN}     \> {\sc sparc}stations\\*
{\bf *VAX}     \> \vax{}\\*
{\bf *CBUSER}  \> Gets main, user and override routines only\\*
{\bf *BATCHF}  \> Standard batch version with fast routines\\*
{\bf *BATCH}   \> Standard batch version\\*
{\bf *INTERF}  \> Interactive/graphics version with fast routines\\*
{\bf *INTER}   \> Interactive/graphics version\\
\end{tabbing}

The patches holding the Fortran decks are:
\begin{tabbing}
{\bf OBSOLETE} \hspace{0.2cm} \= \kill
{\bf GCDES}    \> \gea{} and {\sc zebra} common blocks\\*
{\bf COMMCB}   \> \cbg{} common blocks\\*
{\bf CBBASE}   \> Base routines of \cbg{}\\*
{\bf CBDRIF}   \> Drift chamber utility routines\\*
{\bf CBERRM}   \> Error and warning message handlers\\*
{\bf CBIO}     \> Several I/O routines for drift chamber files\\*
{\bf CBKINE}   \> Routines for initializing events\\*
{\bf CBMATE}   \> Material and tracking media definitions\\*
{\bf CBPROC}   \> Process control routines\\*
{\bf CBUSER}   \> Dummy user routines\\*
{\bf CBVIEW}   \> Interactive graphics and plot definitions\\*
{\bf BC}       \> Crystal geometry and digitisation routines\\*
{\bf GH}       \> GHT geometry and digitisation routines\\*
{\bf JD}       \> JDC geometry and digitisation routines\\*
{\bf MG}       \> Magnet and magnetic field routines\\*
{\bf PW}       \> PWC geometry and digitisation routines\\*
{\bf SF}       \> SFD geometry and digitisation routines (not implemented)\\*
{\bf VE}       \> Veto counter routines\\*
{\bf OBSOLETE} \> Code no longer needed for linking: subject to deletion\\
\end{tabbing}

There are several modes which select code for inclusion:
\begin{tabbing}
{\bf FASTXTAL} \hspace{0.2cm} \= \kill
{\bf NEVER}    \> Marks lines not to be compiled\\*
{\bf DMPSTP}   \> Dumps information in {\sc gustep} for each step\\*
{\bf DMPVOL}   \> Dumps volume search tree in {\sc gustep} for each step\\*
{\bf FASTJDC}  \> Switches to fast JDC processing\\*
{\bf FASTXTAL} \> Switches to fast crystal processing (not implemented)\\*
{\bf SUNERR}   \> Primitive Sun IEEE floating point error handler\\
\end{tabbing}

\subsection{Documentation and Auxillary Files}

Before producing the code itelf, there are a number of auxillary files
which one may wish to extract.  First, there are documentation files
in the {\tt \$HISTORY} patch.  Together, these occupy $\sim$100,000
bytes (200 \vax{} blocks).

\begin{tabbing}
{\bf material.doc} \hspace{0.2cm} \= \kill
{\bf cards.doc}    \> Data card descriptions\\*
{\bf channel.doc}  \> $\pbar{}p$ annihilation channels supported\\*
{\bf ecut.doc}     \> Discussion of particle production thresholds\\*
{\bf geantinf.doc} \> Information on \gea{}\\*
{\bf history.doc}  \> \cbg{} history\\*
{\bf instruct.doc} \> Instructions for installing and using \cbg{}\\*
{\bf material.doc} \> Explanation of many \cbg{} material definitions\\*
{\bf media.doc}    \> List of materials and tracking media used in \cbg{}\\*
{\bf particle.doc} \> List of particles defined for \gea{} and \cbg{}\\*
{\bf physics.doc}  \> Physics deficiencies in \gea{}---a partial list\\*
{\bf re\_unix.doc} \> Setup and use of \gea{} under \unix{}\\*
{\bf volumes.doc}  \> Nesting and tracking media of the declared volumes\\*
\end{tabbing}

Next, the {\tt DFILES} patch holds the current JDC drift time tables
which have been calculated for the three magnetic field settings
commonly used by the Crystal Barrel.  Each of these formatted files
occupies 450,590 bytes (890 \vax{} blocks).
\begin{tabbing}
{\bf jdc00.dat} \hspace{0.2cm} \= Zero field drift table (JDC calibration)\\*
{\bf jdc10.dat} \> 10 kilogauss drift table (crystal calibration)\\*
{\bf jdc15.dat} \> 15 kilogauss drift table (normal data taking)\\
\end{tabbing}

\begin{minipage}[h]{\textwidth}
There is a simple procedure to extract all documentation and JDC drift
time files:
\begin{verbatim}
    CMZ> FILE cbgeant -R
    CMZ> SET  datdoc.kumac -D
    CMZ> CD   $HISTORY
    CMZ> CTOT DATDOCKU
    CMZ> EXEC datdoc
    CMZ> EXIT
\end{verbatim}
\end{minipage}

\hspace{10pt}\\

\begin{minipage}[h]{\textwidth}
If disk space is scarce, one may prefer to extract individual files.
For example, to get the deck {\tt INSTRUCT}:
\begin{verbatim}
    CMZ> FILE cbgeant -R
    CMZ> SET  instruct.doc -D
    CMZ> CD   $HISTORY
    CMZ> CTOT INSTRUCT
    CMZ> EXIT
\end{verbatim}
\end{minipage}

\vspace{\parskip}

\begin{minipage}[h]{\textwidth}
Similarly, one may extract individual drift time files, such as {\tt
jdc15.dat}:
\begin{verbatim}
    CMZ> FILE cbgeant -R
    CMZ> SET  jdc15.dat -D
    CMZ> CD   DFILES
    CMZ> CTOT JDC15
    CMZ> EXIT
\end{verbatim}
\end{minipage}

\subsection{Extracting \cbg{}}

{\samepage
One may use the {\sc kumac} cradles supplied in the {\tt \$HISTORY}
patch to extract the code.  Start \cmz{}, clearing any existing
selections, sequences and pilots:
\begin{verbatim}
    CMZ> SEL .
    CMZ> SEQ .
    CMZ> PILOT .
\end{verbatim}

}

{\samepage
To get a graphics/interactive version of the code, next use the line:
\begin{verbatim}
    CMZ> SELECT INTERF
\end{verbatim}

}

{\samepage
In all cases, use:
\begin{verbatim}
    CMZ> SELECT SUN      (substitute ALT, DECS, IBM or VAX, as appropriate)
    CMZ> SELECT GEA314   (substitute GEA315, if appropriate)
    CMZ> FILE cbgeant -R
    CMZ> SET  cbgeant.kumac -D
    CMZ> CD   $HISTORY
    CMZ> CTOT -Y CBKUMAC
    CMZ> SET  cbuser.kumac -D
    CMZ> CTOT -Y USKUMAC
    CMZ> EXIT
\end{verbatim}

}

The {\tt CBGEANT.KUMAC} file should then hold a pilot line for the
chosen machine (e.g., {\tt PILOT *SUN}), a line for setting the
location of output source files (e.g., {\tt SET src/*.f -F}) and a
line to select common blocks for the correct \gea{} version (e.g. {\tt
SELECT GEA314}).  If your machine is not supported, choose the machine
closest in type and try it; this may or may not work.  You may, in
this case, have to edit the {\tt SET...-F} line.  Remember to create
the subdirectory {\tt src}, {\tt [.SRC]}, etc.  as required.  If you
want to extract all currently used Fortran (subject to the usual
selections), the {\tt FORTALL.KUMAC} file is designed for this.  (It
does not give exactly the same thing as {\tt cmz> ctof *}, because it
ignores the {\tt OBSOLETE} patch of code destined for deletion.)
\begin{verbatim}
    CMZ> SELECT SUN      (substitute ALT, DECS, IBM or VAX, as appropriate)
    CMZ> SELECT GEA314   (substitute GEA315, if appropriate)
    CMZ> FILE cbgeant -R
    CMZ> SET fortall.kumac -D
    CMZ> CD $HISTORY
    CMZ> CTOT -Y ALLKUMAC
    CMZ> EXIT
\end{verbatim}

\subsubsection{Sun and Alliant Machines}

If your machine is a Sun or an ALlianT, there is a shell script to
simplify the rest of the procedure.  (It is probably not hard to modify
the Sun script for the {\sc decs}tation.)  Extract the script with the
procedure below, then edit the installation-dependent aspects of the
{\tt cbgeant\_mak} script and run it.
\begin{verbatim}
    CMZ> FILE cbgeant -R
    CMZ> CD $HISTORY
    CMZ> SELECT SUN  (or ALT, as appropriate)
    CMZ> SET cbgeant_mak -D
    CMZ> CTOT -Y SHELL
    CMZ> EXIT
\end{verbatim}

\subsubsection{\cernvm{}, \vax{} and {\sc decs}tations}

{\samepage
For other machines, or if you do not want to use the shell script, do
the following:
\begin{verbatim}
    CMZ> EXEC CBGEANT
    CMZ> EXIT
\end{verbatim}

}

{\samepage
You will now have the current \cbg{} Fortran source code,
with the exception of the main routine, user routines and \gea{}
override routines.  Extract the remaining useful code:
\begin{verbatim}
    CMZ> EXEC CBUSER
    CMZ> EXIT
\end{verbatim}
This will place the code into {\tt cbgeant.f}, {\tt cbgeant.for}, etc. as
appropriate for your machine.  One may edit the user routines in this
file as needed.

}

\subsection{Compiling \cbg{}}

It is probably best to compile the main routine, user routines and
\gea{} override routines separate from each other and from the
remaining \cbg{} routines, which are often placed into a library.  If
one is using a machine (such as a \vax{}) on which it is convenient to
force module extraction from a library and on which the library and
file system can handle large blocks of modules, it is possible to
compile all modules together.  On \unix{} machines one will probably
want to separately compile the routines to be placed in a library.
One may need to specify compiler options:
\begin{itemize}
\item{
Bounds checking on arrays is {\em not} possible because of the
equivalencing of arrays with incompatible lengths in \gea{}, however
appealing this would be for debugging.  The root of the problem is
that memory for \zeb{} is allocated at {\em link} time, based on the
size of a common block in the main routine, while bounds checking is
established at compile time.}
\item{
One must not strip trailing blanks from the code or use a procedure
which does, since Hollerith strings may be continued across lines.
(CERN's ``fprep'' routine causes problems, for example.)  Similarly,
one should not pad the lines with blanks.}
\item{
One must not compile past column 72, since this has been used as a
comment field in some routines.}
\item{
One may need to increase the allowed number of continuation lines; the
usual 19 lines is not enough.  Set it to 40 lines, or so.}
\item{
It should {\em not} be necessary to tell the compiler to save
variables and common blocks between subroutine calls.  All common
blocks and (hopefully) all variables holding data between calls to a
subroutine have been specified to be saved.  However, excepting
possible costs in CPU time and memory, it should do no harm to save
all variables.  On machines with adequate RAM memory, this may even
increase the speed.}
\end{itemize}

One may get warning messages, depending on the compiler type and the
warning level set.  For instance, although \cbg{} variables are
initialized before use, this is sometimes done in ways not apparent to
the compiler and warnings may be printed.  There may also be warnings
about non-ANSI standard code, including Hollerith constants, character
data being assigned to non-character variables, list-directed
formatting on an internal file and incompatible common block lengths.
Usually, these warnings can be ignored.

In addition, \unix{} machines tend to suffer from Fortran compiler
bugs.  Some of these problems arise from the compiler using the
C-language library instead of an actual Fortran library.  (Fortran
support under \unix{} is often given in the same spirit and with as
much grace as a Rolls Royce dealer selling a used Volkswagen bug to a
leperous peasant).  A couple of constructions (e.g, the {\tt INQUIRE}
keyword) known to be problematic have been avoided.

\subsection{Linking \cbg{}}

Linking the code requires the forced inclusion of a main routine
(either the \cbg{} routine {\sc gcb} for the batch version or the CERN
routine {\sc gxint} for the interactive version).  Until the
distribution \gea{} version has been repaired, one must also force the
inclusion of the \gea{} override routines.  One will also often want
to force the linking of user routines in preference to the dummy ones.
Finally, link with the Crystal Barrel {\sc bctrak} library, with the
CERN \gea{}, {\sc packlib} and {\sc kernlib} libraries and with a
graphics library (often {\sc gks}).

The \gea{} library should be a recent update of version 3.14 (or, for
pioneers, 3.15).  On \unix{} machines, the \zeb{} version (probably
included in the {\sc packlib} library) should be recent enough to
support C-library data transfer---at least version 3.66, released in
February 1991---and {\sc kernlib} must include the CF package.  (Look
for the routine {\sc cfopen} if in doubt.)  For \gea{3.15}, {\sc higz}
must be at least version 1.13/09 (04-FEB-1992).

\subsection{Compile/Link Examples}

As a concrete example, the below {\sc vax/vms} command file has been
used on {\sc vsxtal}.  It assumes that {\sc cbgeant.for} holds {\sc
gcb, myinit, myevnt, mylast, gflthe, ginpco, ginpgo, ginvol, gmedia}
and {\sc gtmedi} (as it would after execution of {\sc cbgeant.kumac})
and that {\sc [.src]*.for} contains all current \cbg{} code except for
the main, user and \gea{} override routines (as it would after
execution of {\sc cbuser.kumac}).  Naturally, the definition of
various logicals and library names and locations will vary.  The
number of workable alternatives is nearly infinite, depending on the
needs of the user, and there is no attempt here to be comprehensive.
\begin{verbatim}
$! CBGEANT.BLD
$!
$ COPY [.SRC]*.FOR CBGEANT_MOST.FOR
$ FORTRAN/NOEXTEND CBGEANT_MOST
$ FORTRAN/NOEXTEND CBGEANT
$ LIBRARY/CREATE CBGEANT_MOST CBGEANT_MOST
$ DELETE CBGEANT_MOST.OBJ;*
$!
  LINK/EXE=CBGEANT -
  CBGEANT.OBJ, -
  CBGEANT_MOST/LIB, -
  [CB0.CBOFF]BCTRAK.OLB/LIB, -
  GEANT.OLB/LIB, PACKLIB.OLB/LIB/INCL=QNEXT,
  KERNLIB.OLB/LIB/INCL=(FLOARG,VMAX,VMIN), -
  GRAFGKS.OLB/LIB, GKSKERNEL.OLB/LIB, GKSDUM.OLB/LIB, GKSDRIV.OLB/LIB
$!
$ DELETE CBGEANT.OBJ;*
$ PURGE CBGEANT.EXE
$ PURGE CBGEANT_MOST.FOR
$!
$! End of file
\end{verbatim}

\clearpage

\section{Comparison: \cbg{} 4.06/03 vs. 4.02/10}

\subsection{Geometry}

There have been hundreds of changes in the detector geometry.  Most of
these do not need discussing, but some will be readily apparent:
\begin{itemize}
\item{
The liquid hydrogen target was formerly treated as a Mylar cylinder of
\mbox{4 cm} diameter and \mbox{40 cm} length.  In reality, the
hydrogen is confined to a cylinder of \mbox{1.7 cm} diameter and
\mbox{$\sim$4 cm} length, with an aluminum vacuum tube around it.
There is also a stainless steel ring at one end (with some copper
added in 1991) which can cause a significant number of $\gamma$
conversions.  Fillings of either LH$_2$ or LD$_2$ are supported,
although the correct annihilation physics must be set separately.}
\item{
The beamline was not included previously; one would expect, on the
average, that it would absorb energy from showers near the $Z$ axis,
reducing the calorimeter resolution.}
\item{
The veto counter was formerly ignored.  Because of its proximity to
the target, and the fact that is an active veto, it may cause
distortions.  It is now included, although it is up to the user to
position it with a data card.  Energy deposition in it is not yet
recorded in a data bank.}
\item{
The Rohacell/Mylar walls of the PWC were formerly defined with a
density which was an order of magnitude too high due to a mistake in
averaging the density of the two components; now fixed.}
\item{
The Mainz gaseous hydrogen target (GHT) geometry is now coded,
although there is not yet any digitization for it.}
\item{
The JDC description was formerly rather simple.  Compared to the
actual device, the old code had an inner carbon cylinder and endplates
that were too thin.  A substantial amount of structure is included on
the chamber now, such as discrete preamps, cooling plates and the
cable mass.}
\item{
The JDC is now alligned with the barrel calorimeter as it is in
reality, a rotation of 84.97$^\circ$ from the old configuration.  This
and the PWC or GHT rotation can be adjusted by the user.}
\item{
In the barrel calorimeter, the crystals themselves were represented
fairly accurately in the old code, except for some problems with type
\#13.  However, the cornets around the crystals had an average density
that was too low, exagerating the energy resolution.  Materials
radially beyond the crystals was also given an overly low density,
possibly affecting split-off events associated with particle leakage
through the crystals.}
\item{
The sign of the magnetic field is set to point against the beam direction.}
\item{
The magnet coil was formerly given an inner radius of 84.5 cm, rather
than 76.5 cm; again, this might affect split-off events.}
\item{
The mother volumes of several detectors have been changed and defined
to hold a tracking medium with higher tracking accuracy than the
crude, default air that pervades the detector.  This evades the
problem that \gea{} usually does not detect volumes with dimensions
less than the tracking precision---\mbox{1 cm} in the case of the old
default air.  As an example, particles usually failed to see the inner
wall of the PWC before.}
\item{
Runge-Kutta (non-helix) tracking is now an option for the user
interested in detailed studies of the JDC tracking.  The inhomogeneity
of the magnetic field is small, but significant for some tracks when
one is studying \mbox{100 $\mu$m} tracking accuracies.}
\end{itemize}

\subsection{Default Physics and Cuts}

Most of the \cbg{} 4.02/10 particle production energy thresholds were
simply the \gea{} defaults.  This is not a problem as long as the user
realizes that Monte Carlo defaults are usually written with the LEP
detectors in mind (where no one cares about a few MeV one way or the
other) and overrides them appropriately.  Unfortunately, the hapless
user is usually busy, wants to get results for the next meeting and
does not want to spend days trying to understand \gea{} from an
outdated manual.  The end result is that many old Monte Carlo results
are suspect.

One important change is that the \cbg{} defaults for particle
production and tracking are now much lower than the \gea{} cuts of
\mbox{1 MeV} for photons, electrons and positrons.  Charged particles
near \mbox{1 MeV} have a range of a few millimeters in CsI, allowing
them to travel out of a crystal and into the next crystal or nearby
insensitive material.  Therefore, immediately depositing their energy
without tracking them will sharpen the apparent calorimeter
resolution.  The photon cut is more worrisome because the absorption
length of 0.511 MeV annihilation photons in CsI is a few centimeters.
The cuts for most regions are listed in the table below, although they
are set somewhat higher by calls to {\sc gstpar} in regions which are
not near sensitive volumes (e.g., the magnet yoke).

\medskip

\begin{tabular}{lrc}
\multicolumn{1}{c}{Name of Cut} &
                \multicolumn{1}{c}{\gea{}} & \multicolumn{1}{c}{\cbg{}}\\
              & \multicolumn{1}{c}{(MeV)}  & \multicolumn{1}{c}{(MeV)}\\
\hline
{\tt CUTGAM, BCUTE, BCUTM} &  1.00 & 0.15\\
{\tt CUTELE}               &  1.00 & 0.20\\
{\tt DCUTE, DCUTM}         &  1.00 & 0.40\\
{\tt CUTNEU}               & 10.00 & 1.00\\
{\tt CUTHAD}               & 10.00 & 3.00\\
{\tt CUTMUO}               & 10.00 & 2.50\\
\end{tabular}

\medskip

Some of the other interesting changes in defaults include:
\begin{itemize}
\item{
Of the user-defined particle decays in subroutine {\sc ugpart},
several forbidden channels were replaced by the correct ones.  In
addition, a number of the particle parameters were updated to the 1990
Particle Data Book values (from the 1986 values).}
\item{
Cuts on muons, neutrons and charged hadrons have been lowered.}
\item{
Particles reaching $\sqrt{x^2+y^2} > 80$ cm are no longer rejected,
allowing effects due to the magnet coil, for example, to be seen.}
\item{
Compton, Rayleigh and Moliere scattering, formerly turned off by
default, are enabled.}
\item{
Muon-nuclear interactions are now included, and nuclear fragmentation
is handled by the {\sc nucrin} code.}
\item{
Neutrinos are no longer tracked (affecting only CPU time).}
\end{itemize}

A number of experimental effects are now handled in ways expected to
be more accurate and/or flexible.  These are:
\begin{itemize}
\item{
The JDC track position can now be smeared by a Landau distribution,
although this is disabled until tuning has been completed.}
\item{
Some of the other JDC signal parameters have been adjusted, including
the pulse height and the electrical length of the sense wires.  Double
and triple pulses have been disabled until they can be adjusted to the
data.}
\item{
PWC and JDC signal parameters are now accessible through data cards.}
\item{
There are new defaults for incoherent noise, and these are different
for the FERA and 2282 ADC's.  Defaults can be overridden by data card
or can be adjusted individually in a data file.}
\item{
Coherent noise is now included.  The defaults can be overridden, as
for the incoherent noise.}
\item{
Crystal calibrations now vary randomly.  The default is to use a
variance of 1\%, a value which can be overridden by data card or set
for individual crystals in a data file.}
\item{
The light produced in the CsI crystals is varied according to $dE/dx$.}
\end{itemize}

\subsection{Platform Support}

The code is now compatible with the {\sc mips} compiler used on {\sc
decs}tations.  Also, exchange format tape-writing is now supported for
{\sc unix} machines, including the {\sc decs}tations and {\sc
sparc}stations.

\subsection{Event Initialization}

The {\tt SETV} and {\tt BWID} data cards, taken together, now allow
increased flexibility by allowing the user to set both the width and
the centroid of Gaussian vertex distributions, with or without cutting
on the physical target volume.  For in-flight simulation, a uniform,
bounded distribution in $Z$ is possible.  Distributions 60--69 are
allocated for user definition in an override routine {\sc usvert}.

The {\sc bigbang ii} generator has been modified, adding intermediate
resonances to the extent that they were known and adding a number of
known decay channels that were not previously defined.  The branching
ratios were also updated significantly, which would affect any minimum
bias data produced.  Also, several of the routines provided for test
distributions have been fixed to give particle distributions uniform
in solid angle.  These are {\sc kitwob, kiuser} and {\sc kixray}.
Finally, the code now contains a particle generator for annihilation
in deuterium, {\sc kideut}.

\subsection{Common Blocks}

{\sloppy Several common blocks were changed and must be redefined in
the user code if used: {\tt CBCNAM, CCFLAG, CCSETS, CCVIEW} and {\tt
MCENER}.  In addition, several new common blocks were added, and the
user should elimininate any conflicts with his/her code: {\tt CBGATE,
CBJDDF, CBJDNS, CBJDRS, CBJDSG, CBKILL, CBPWJD, CBPWNO, CBROT, CBTTPR,
CBVEPR} and {\tt CBXTPR}.  }

Also, all common blocks in \cbg{}, including those from \gea{} and
\zeb{}, are explicitly saved.  This is because the ANSI-77 standard
does not guarantee that common blocks will be saved when leaving a
subroutine if the common block is not defined at a higher level in
this program branch.

\subsection{Error Handling and Debugging}

The new version has:
\begin{itemize}
\item{
Optional patches in the subroutine {\sc gustep}: {\tt DMPSTP} and
{\tt DMPVOL} dump information related to the current step and the
current volume search tree.}
\item{
Modified error-handling routines eliminate some problems encountered
under {\sc vax/vms}.}
\item{
A simple floating point error handler for the SUN.}
\end{itemize}

\subsection{Other}

The new version:
\begin{itemize}
\item{
Supports \gea{} 3.14 type `many' volumes through several override
routines.}
\item{
Has expanded informational banks linked to `MCIN'.}
\item{
Has expanded documentation and scripts in the {\tt \$HISTORY} patch.}
\end{itemize}

\clearpage

\section{Physics Simulation}

\subsection{Defined Particles}

\gea{} defines particle types 1--49 for the so-called stable particles.
Their values in \gea{} 3.15 are consistent with the 1990 Particle Data
Book---with the possible exception of the $\eta$ lifetime (which is
short enough not to affect the time of flight and long enough not to
appear in the resolution for the Crystal Barrel).

In addition, the \cbg{} routine {\sc ugpart} defines a group of mesons
needed to describe many of the intermediate states of $\pbar{}$
annihilations.  Some mesons are defined with multiple type numbers,
with some types restricted to decay only through certain channels.
This helps with the rapid accumulation of certain event types; the
user may, of course, make further definitions in the {\sc myinit} user
routine.

\gea{} does not support decays into more than three particles, so one
must occasionally make changes to deal with this limitation.  In
particular, the $f_2(1270)$ is generally listed as having branching
ratios into $\pi^+\pi^-\pi^0\pi^0$ and $2\pi^+2\pi^-$.  Well within
error bars, one could obtain these same states assuming intermediate
states of $\rho^+\rho^-$ and $\rho^0\rho^0$, with the former having
twice the branching ratio of the latter.  Naturally, the phase space
distribution of the pions is different between the two cases, but the
1990 Particle Data Book does not rule out the $\rho\rho$ channels, and
they would seem to be the more natural channel.

\clearpage

\begin{tabular}{|r|l|l|r|l|l|r|}
\hline
No.& Name &Mass (GeV) &Q/$e$&Lifetime (sec) & Decay                 &Percent\\
\hline
 1& $\gamma$        &0.      & 0& stable    &                       &        \\
 2& $e^+$           &0.000511& 1& stable    &                       &        \\
 3& $e^-$           &0.000511&-1& stable    &                       &        \\
 4& $\nu$           &0.      & 0& stable    &                       &        \\
 5& $\mu^+$         &0.105659& 1& 2.19703E-6&$e^+ \nu \nu$          &100.0000\\
 6& $\mu^-$         &0.105659&-1& 2.19703E-6&$e^- \nu \nu$          &100.0000\\
 7& $\pi^0$         &0.134973& 0& 8.4E-17   &$\gamma \gamma$        & 98.8020\\
  &                 &        &  &           &$e^+ e^- \gamma$       &  1.1980\\
 8& $\pi^+$         &0.139567& 1& 2.603E-8  &$\mu^+ \nu$            &100.0000\\
 9& $\pi^-$         &0.139567&-1& 2.603E-8  &$\mu^- \nu$            &100.0000\\
10& $K^0_L$         &0.49767 & 0& 5.183E-8  &$\pi^+ e^- \nu$        & 19.3500\\
  &                 &        &  &           &$\pi^- e^+ \nu$        & 19.3500\\
  &                 &        &  &           &$\pi^+ \mu^- \nu$      & 13.5500\\
  &                 &        &  &           &$\pi^- \mu^+ \nu$      & 13.5500\\
  &                 &        &  &           &$\pi^0 \pi^0 \pi^0$    & 21.5000\\
  &                 &        &  &           &$\pi^+ \pi^- \pi^0$    & 12.3900\\
11& $K^+$           &0.493646& 1& 1.2371E-8 &$\mu^+ \nu$            & 63.5000\\
  &                 &        &  &           &$\pi^+ \pi^0$          & 21.1600\\
  &                 &        &  &           &$\pi^+ \pi^+ \pi^-$    &  5.5900\\
  &                 &        &  &           &$e^+ \nu \pi^0$        &  4.8200\\
  &                 &        &  &           &$\mu^+ \nu \pi^0$      &  3.2000\\
  &                 &        &  &           &$\pi^+ \pi^0 \pi^0$    &  1.7300\\
12& $K^-$           &0.493646&-1& 1.2371E-8 &$\mu^- \nu$            & 63.5000\\
  &                 &        &  &           &$\pi^- \pi^0$          & 21.1600\\
  &                 &        &  &           &$\pi^+ \pi^- \pi^-$    &  5.5900\\
  &                 &        &  &           &$e^- \nu \pi^0$        &  4.8200\\
  &                 &        &  &           &$\mu^- \nu \pi^0$      &  3.2000\\
  &                 &        &  &           &$\pi^- \pi^0 \pi^0$    &  1.7300\\
13& $n$             &0.939566& 0& 896.      &                       &        \\
14& $p$             &0.93827 & 1& stable    &                       &        \\
15& $\pbar$         &0.93827 &-1& stable    &                       &        \\
16& $K^0_S$         &0.49767 & 0& 8.922E-11 &$\pi^+ \pi^-$          & 68.6100\\
  &                 &        &  &           &$\pi^0 \pi^0$          & 31.3900\\
17& $\eta$          &0.5488  & 0& 7.479E-19?&$\gamma \gamma$        & 39.1000\\
  &                 &        &  &           &$\pi^0 \pi^0 \pi^0$    & 31.8000\\
  &                 &        &  &           &$\pi^+ \pi^- \pi^0$    & 23.7000\\
  &                 &        &  &           &$\pi^+ \pi^- \gamma$   &  4.9100\\
  &                 &        &  &           &$e^- e^+ \gamma$       &  0.5000\\
18& $\Lambda$       &1.11563 & 0& 2.631E-10 &$p \pi^-$              & 64.2000\\
  &                 &        &  &           &$n \pi^0$              & 35.8000\\
\hline
\end{tabular}

\clearpage

\begin{table}[ht]
\begin{tabular}{|r|l|l|r|l|l|r|}
\hline
No.& Name &Mass (GeV) &Q/$e$&Lifetime (sec) & Decay                 &Percent\\
\hline
19& $\Sigma^+$      &1.18937 & 1& 8.00E-11  &$p \pi^0$              & 51.6400\\
  &                 &        &  &           &$n \pi^+$              & 48.3600\\
20& $\Sigma^0$      &1.19255 & 0& 7.40E-20  &$\Lambda \gamma$       &100.0000\\
21& $\Sigma^-$      &1.19743 &-1& 1.479E-10 &$n \pi^-$              &100.0000\\
22& $\Xi^0$         &1.31490 & 0& 2.90E-10  &$\Lambda \pi^0$        &100.0000\\
23& $\Xi^-$         &1.32132 &-1& 1.639E-10 &$\Lambda \pi^-$        &100.0000\\
24& $\Omega^-$      &1.67243 &-1& 8.22E-11  &$\Lambda K^-$          & 68.6000\\
  &                 &        &  &           &$\Xi^0 \pi^-$          & 23.4000\\
  &                 &        &  &           &$\Xi^- \pi^0$          &  8.0000\\
25& $\nbar{}$       &0.939573& 0& 898.      &                       &        \\
26& $\Lambdabar{}$  &1.11563 & 0& 2.631E-10 &$\pbar{} \pi^+$        & 64.2000\\
  &                 &        &  &           &$\nbar{} \pi^0$        & 35.8000\\
27& $\Sigmabar{}^-$ &1.18937 &-1& 8.0E-11   &$\pbar{} \pi^0$        & 51.6400\\
  &                 &        &  &           &$\nbar{} \pi^-$        & 48.3600\\
28& $\Sigmabar{}^0$ &1.19255 & 0& 7.4E-20   &$\Lambdabar{} \gamma$  &100.0000\\
29& $\Sigmabar{}^+$ &1.19743 & 1& 1.479E-10 &$\nbar{} \pi^+$        &100.0000\\
30& $\Xibar{}^0$    &1.3149  & 0& 2.9E-10   &$\Lambdabar{} \pi^0$   &100.0000\\
31& $\Xibar{}^+$    &1.32132 & 1& 1.639E-10 &$\Lambdabar{} \pi^+$   &100.0000\\
32& $\Omegabar{}^+$ &1.67243 & 1& 8.22E-11  &$\Lambdabar{} K^+$     & 68.6000\\
  &                 &        &  &           &$\Xibar{}^0 \pi^+$     & 23.4000\\
  &                 &        &  &           &$\Xibar{}^+ \pi^0$     &  8.0000\\
33& $\tau^+$        &1.7841  & 1& 3.04E-13  &                       &        \\
34& $\tau^-$        &1.7841  & 1& 3.04E-13  &                       &        \\
35& $D^+$           &1.8693  & 1& 1.062E-12 &                       &        \\
36& $D^-$           &1.8693  &-1& 1.062E-12 &                       &        \\
37& $D^0$           &1.8645  & 0& 4.28E-13  &                       &        \\
38& $\Dbar{}$       &1.8645  & 0& 4.28E-13  &                       &        \\
39& $D^+_S$ ($F^+$) &1.9693  & 1& 4.36E-13  &                       &        \\
40& $D^-_S$ ($F^-$) &1.9693  &-1& 4.36E-13  &                       &        \\
41& $\Lambda^+_C$   &2.2849  & 1& 1.79E-13  &                       &        \\
42& $W^+$           &81.0000 & 1& 9.4E-26   &                       &        \\
43& $W^-$           &81.0000 &-1& 9.4E-26   &                       &        \\
44& $Z^0$           &92.4000 & 0& 7.74E-26  &                       &        \\
45& Deuteron        &1.87561 & 1& stable    &                       &        \\
46& Triton          &2.81448 & 1& stable    &                       &        \\
47& He-4            &3.72742 & 2& stable    &                       &        \\
48& Geantino        &0.      & 0& stable    &                       &        \\
49& He-3            &2.81448 & 2& stable    &                       &        \\
\hline
\end{tabular}
\caption{Standard \gea{} particle definitions.}
\label{tablegpar}
\end{table}

\clearpage

% Comments reflect changes made to definitions for CBGEANT 4.06.
\begin{tabular}{|r|l|l|r|l|l|r|}
\hline
No.& Name &Mass (GeV) &Q/$e$&Lifetime (sec) & Decay                 &Percent\\
\hline
% Remove b_1(1235)->rho0/eta decay; 1986 PDB=``<10%''; 1990 PDB=``seen''.
50& $b^0_1(1235)$   &1.233   & 0& 4.388E-24 &$\pi^0 \omega$         &100.0000\\
51& $b^+_1(1235)$   &1.233   & 1& 4.388E-24 &$\pi^+ \omega$         &100.0000\\
52& $b^-_1(1235)$   &1.233   &-1& 4.388E-24 &$\pi^- \omega$         &100.0000\\
% Assume 4pi decays are rho/rho; while not certain, this is more-or-less
% consistent with the observed ratio of pi+pi-pi0pi0 to pi+pi-pi+pi-.
% GEANT DOES NOT SUPPORT BRANCHING TO MORE THAN 3 PARTICLES!!!
% Update other ratios slightly.
53& $f_2(1270)$     &1.274   & 0& 3.560E-24 &$\pi^+ \pi^-$          & 56.7000\\
  &                 &        &  &           &$\pi^0 \pi^0$          & 28.3500\\
  &                 &        &  &           &$\rho^+ \rho^-$        &  6.0000\\
  &                 &        &  &           &$\rho^0 \rho^0$        &  3.0000\\
  &                 &        &  &           &$K^+ K^-$              &  2.4000\\
  &                 &        &  &           &$K^0_S K^0_S$          &  1.2000\\
% Replace pi0/rho0 (C violating) with pi+/rho- and pi-/rho+.
% Replace K_L-K_S with K^+K^- and K_S-K_S (no room for K_L-K_L).
% Replace omega/pi0/pi0 (C violating) with omega/pi+/pi-.
54& $a^0_2(1320)$   &1.318   & 0& 5.984E-24 &$\pi^+ \rho^-$         & 35.0500\\
  &                 &        &  &           &$\pi^- \rho^+$         & 35.0500\\
  &                 &        &  &           &$\pi^0 \eta$           & 14.5000\\
  &                 &        &  &           &$\omega \pi^+ \pi^-$   & 10.6000\\
  &                 &        &  &           &$K^+ K^-$              &  2.4500\\
  &                 &        &  &           &$K^0_S K^0_S$          &  1.2300\\
% Split pi+/rho0 into pi+/rho0 and pi0/rho+.
% Replace K_L/K_S (Q conservation violating) with K+/K_S and K+/K_L.
55& $a^+_2(1320)$   &1.318   & 1& 5.984E-24 &$\pi^+ \rho^0$         & 35.0500\\
  &                 &        &  &           &$\pi^0 \rho^+$         & 35.0500\\
  &                 &        &  &           &$\pi^+ \eta$           & 14.5000\\
  &                 &        &  &           &$\omega \pi^+ \pi^0$   & 10.6000\\
  &                 &        &  &           &$K^+ K^0_S$            &  2.4500\\
  &                 &        &  &           &$K^+ K^0_L$            &  2.4500\\
% Split pi-/rho0 into pi-/rho0 and pi0/rho-.
% Replace K_L/K_S (Q conservation violating) with K+/K_S and K+/K_L.
56& $a^-_2(1320)$   &1.318   &-1& 5.984E-24 &$\pi^- \rho^0$         & 35.0500\\
  &                 &        &  &           &$\pi^0 \rho^-$         & 35.0500\\
  &                 &        &  &           &$\pi^- \eta$           & 14.5000\\
  &                 &        &  &           &$\omega \pi^- \pi^0$   & 10.6000\\
  &                 &        &  &           &$K^- K^0_S$            &  2.4500\\
  &                 &        &  &           &$K^- K^0_L$            &  2.4500\\
% Add pi+/pi-/gamma and eta/gamma; update numbers to 1990 Part. Data Book.
57& $\rho^0(770)$   &0.7683  & 0& 4.415E-24 &$\pi^+ \pi^-$          & 98.7640\\
  &                 &        &  &           &$\pi^+ \pi^- \gamma$   &  1.1100\\
  &                 &        &  &           &$\pi^0 \gamma$         &  0.0790\\
  &                 &        &  &           &$\eta \gamma$          &  0.0380\\
  &                 &        &  &           &$\mu^+ \mu^-$          &  0.0046\\
  &                 &        &  &           &$e^+ e^-$              &  0.0044\\
% Update to 1990 Part. Data Book (small shifts).
58& $\rho^+(770)$   &0.7683  & 1& 4.415E-24 &$\pi^+ \pi^0$          & 99.9550\\
  &                 &        &  &           &$\pi^+ \gamma$         &  0.0450\\
% Update to 1990 Part. Data Book (small shifts).
59& $\rho^-(770)$   &0.7683  &-1& 4.415E-24 &$\pi^- \pi^0$          & 99.9550\\
  &                 &        &  &           &$\pi^- \gamma$         &  0.0450\\
\hline
\end{tabular}

\clearpage

\begin{table}[h]
\begin{tabular}{|r|l|l|r|l|l|r|}
\hline
No.& Name &Mass (GeV) &Q/$e$&Lifetime (sec) & Decay                 &Percent\\
\hline
% Update to 1990 Part. Data Book (small shifts); add pi0/e+e-.
60& $\omega(783)$   &0.78195 & 0& 7.810E-23 &$\pi^+ \pi^- \pi^0$    & 88.8000\\
  &                 &        &  &           &$\pi^0 \gamma$         &  8.5000\\
  &                 &        &  &           &$\pi^+ \pi^-$          &  2.2100\\
  &                 &        &  &           &$\pi^0 e^+ e^-$        &  0.0590\\
  &                 &        &  &           &$\pi^0 \mu^+ \mu^-$    &  0.0096\\
  &                 &        &  &           &$e^+ e^-$              &  0.0071\\
61& $\eta'(958)$    &0.95757 & 0& 3.160E-21 &$\eta \pi^+ \pi^-$     & 44.2000\\
  &                 &        &  &           &$\rho^0 \gamma$        & 30.0000\\
  &                 &        &  &           &$\eta \pi^0 \pi^0$     & 20.5000\\
  &                 &        &  &           &$\omega \gamma$        &  3.0000\\
  &                 &        &  &           &$\gamma \gamma$        &  2.1600\\
  &                 &        &  &           &$\pi^0 \pi^0 \pi^0$    &  0.1500\\
62& ETA0            &0.5488  & 0& 5.530E-19 &$\gamma \gamma$        &100.0000\\
63& ETAP0           &0.95757 & 0& 3.160E-21 &$\gamma \gamma$        &100.0000\\
64& OMEGA0          &0.78195 & 0& 7.810E-23 &$\gamma \pi^0$         &100.0000\\
65& OMEGAQ          &0.78195 & 0& 7.810E-23 &$\pi^+ \pi^- \pi^0$    &100.0000\\
66& PI0GG           &0.1349734&0& 8.400E-17 &$\gamma \gamma$        &100.0000\\
67& KSQ             &0.497671& 0& 0.892E-10 &$\pi^+ \pi^-$          &100.0000\\
68& OMEGA\_0        &0.78195 & 0& 7.810E-23 &PI0GG,$\gamma$         &100.0000\\
69& OMEGA\_Q        &0.78195 & 0& 7.810E-23 &PI0GG,$\pi^+ \pi^-$    &100.0000\\
70& B0\_0           &1.233   & 0& 4.388E-24 &PI0GG,OMEGA\_Q         &100.0000\\
71& ETP9            &0.95757 & 0& 3.160E-21 &$\eta \pi^0 \pi^0$     &100.0000\\
72& $\phi(1020)$    &1.019412& 0& 1.295E-22 &$K^+ K^-$              & 49.5000\\
  &                 &        &  &           &$K^0_L K^0_S$          & 34.4000\\
  &                 &        &  &           &$\rho^+ \pi^-$         &  4.3000\\
  &                 &        &  &           &$\rho^0 \pi^0$         &  4.3000\\
  &                 &        &  &           &$\rho^- \pi^+$         &  4.3000\\
  &                 &        &  &           &$\pi^+ \pi^- \pi^0$    &  1.9000\\
\hline
\end{tabular}
\caption{\cbg{} particle definitions.}
\label{tablecpar}
\end{table}

\subsection{Defined $p \pbar{}$ Annihilation Channels}

Since many of the $\pbar$ annihilation channels are not known (this
being part of the motivation behind the PS197 experiment), it is
clearly not yet possible to entirely simulate minimum bias events.
(Even when the number and types of particles in the final states are
known, their phase space distributions are affected by the existence
of intermediate resonances, and these are usually less well known.)
In addition, the branching ratios of some of the intermediate mesons
are not well known (e.g., the $a_0$), and it is not realistic to
expect that the \cbg{} code will reflect even the current state of
knowledge.

Naturally, annihilation reactions depend on the nature of the target
and beam.  The channels and branching ratios in {\sc bigtid} are for
$\pbar{}$ at rest in LH$2$, and are largely derived from the paper
``Antiproton Nucleon Annihilation at Rest: A Data Compilation,''
P.Blum, H.Koch and G.Buche (September 12, 1989).  All previously
defined channels (1--29) are still supported; channels 30--59 have
been added.  Annihilation channels for LD$_2$ are not yet defined, and
the user must specify them for {\sc kideut}.

Thus, one must take \cbg{}'s minumum bias event generation rather
lightly.  It may be useful as a rough indication of background rates,
but one should not expect accurate numbers.  The present branching
ratios are shown below in Table~\ref{tableanni}, although one should
expect the numbers used in the code to be updated from time to time,
as better data becomes available.

However, the user will seldom be generating minimum bias events, but
will instead be interested in a specific channel, and (in presumably
separate runs) those channels likely to cause background.  For these
applications, the user will be using his/her own external values of
branching ratios.

\begin{tabular}{|r|c|l|}
\hline
ID  &Fraction:   & Channel \\
    &Unnormalized&         \\
\hline
  1 &  5.83 & $\pi^+ \pi^- \pi^0 \pi^0$ \\
  2 & 22.34 & $\pi^+ \pi^- \pi^0 \pi^0 \pi^0$ \\
  3 &  2.55 & $\pi^+ \pi^- \pi^0 \pi^0 \pi^0 \pi^0$ \\
  4 & 14.70 & $\pi^+ \pi^+ \pi^- \pi^- \pi^0 \pi^0$ \\
  5 &  4.04 & $\pi^+ \pi^+ \pi^- \pi^- \pi^0 \pi^0 \pi^0$ \\
  6 &  0.02 & $\pi^0 \pi^0$ \\
  7 &  0.10 & $K^+ K^-$ \\
  8 &  1.91 & $\pi^+ \pi^- \pi^0$ \\
  9 &  1.56 & $\rho^0(770) \pi^0$ \\
 10 &  0.24 & $f_2(1270) \pi^0$ \\
 11 &  1.46 & $\pi^+ \pi^+ \pi^- \pi^-$ \\
 12 &  1.93 & $a^+_2(1320) \pi^-$ \\
 13 &  0.90 & $\rho^0(770) f_2(1270)$ \\
 14 &  2.19 & $\rho^0(770) \pi^+ \pi^-$ \\
 15 &  0.40 & $\rho^0(770) \rho^0(770)$ \\
 16 &  0.14 & $\omega(783) \pi^+ \pi^-$ \\
 17 &  2.48 & $\omega(783) \rho^0(770)$ \\
 18 &  1.85 & $\omega(783) f_2(1270)$ \\
 19 &  4.93 & $\rho^0(770) \pi^+ \pi^- \pi^0$ \\
 20 &  0.48 & $b^+_1(1235) \pi^-$ \\
 21 &  0.00 & $\eta \pi^+ \pi^-$ \\
 22 &  0.00 & $a^+_2(1320) \pi^-$ \\
 23 &  1.95 & $\pi^+ \pi^+ \pi^+ \pi^- \pi^- \pi^-$ \\
 24 &  0.59 & $\pi^+ \pi^+ \pi^+ \pi^- \pi^- \pi^- \pi^0$ \\
 25 &  1.24 & $\omega(783) \pi^+ \pi^+ \pi^- \pi^-$ \\
 26 &  0.03 & $\eta \pi^+ \pi^+ \pi^- \pi^-$ \\
 27 &  0.04 & $\eta'(958) \pi^+ \pi^+ \pi^- \pi^-$ \\
 28 &  1.49 & $\rho^+(770) \pi^-$ \\
 29 &  3.20 & $\rho^+(770) \pi^+ \pi^- \pi^-$ \\
 30 &  3.20 & $\rho^-(770) \pi^+ \pi^+ \pi^-$ \\
 31 &  0.00 & $\pi^+ \pi^+ \pi^- \pi^- \pi^0$ \\
 32 &  0.33 & $\pi^+ \pi^-$ \\
 33 &  0.56 & $\pi^0 \pi^0 \pi^0$ \\
 34 &  1.49 & $\rho^-(770) \pi^+$ \\
 35 &  1.93 & $a^-_2(1320) \pi^+$ \\
 36 &  1.93 & $a^0_2(1320) \pi^0$ \\
 37 &  0.48 & $b^-_1(1235) \pi^+$ \\
 38 &  0.72 & $\eta \rho^0(770)$ \\
 39 &  0.65 & $\eta \pi^0 \pi^0$ \\
 40 &  0.31 & $\eta' \pi^+ \pi^-$ \\
\hline
\end{tabular}

\clearpage

\begin{table}[ht]
\centering
\begin{tabular}{|r|r|l|}
\hline
ID  &Fraction:   & Channel \\
    &Unnormalized&         \\
\hline
 41 &  0.02 & $\eta \pi^0$ \\
 42 &  0.52 & $\omega(783) \pi^0$ \\
 43 &  0.05 & $\eta' \pi^0$ \\
 44 &  0.03 & $\phi(1020) \pi^0$ \\
 45 &  0.84 & $\omega(783) \eta$ \\
 46 &  1.40 & $\omega(783) \omega(783)$ \\
 47 &  0.06 & $\omega(783) \phi$ \\
 48 &  0.05 & $\phi(1020) \pi^+ \pi^-$ \\
 49 &  0.06 & $K^0_L K^0_S$ \\
 50 &  0.07 & $K^0_S K^0_S \pi^0$ \\
 51 &  0.07 & $K^0_L K^0_L \pi^0$ \\
 52 &  0.11 & $K^0_S K^0_S \omega(783)$ \\
 53 &  0.11 & $K^0_L K^0_L \omega(783)$ \\
 54 &  0.23 & $K^+ K^- \omega(783)$ \\
 55 &  0.23 & $K^0_S K^0_S \pi^+ \pi^-$ \\
 56 &  0.27 & $K^0_S K^0_L \pi^+ \pi^-$ \\
 57 &  0.23 & $K^0_L K^0_L \pi^+ \pi^-$ \\
 58 &  0.26 & $K^0_S K^+ \pi^- \pi^0$ \\
 59 &  0.26 & $K^0_S K^- \pi^+ \pi^0$ \\
\hline
\end{tabular}
\caption[Annihilation branching ratios of $\pbar{}p$ in
LH$_2$.]{Annihilation branching ratios of $\pbar{}p$ in LH$_2$, as
used in the {\sc bigtid} routine of the ``Bigbang II'' event
generator.  (Updated in \cbg{} 4.06.)}
\label{tableanni}
\end{table}

\clearpage

\section{Hardware Simulation}

\subsection{Volume Definitions}

The data card {\tt PRIN 'VOLU'} will generate information about the
volumes, along with exact dimensions.  This supplements the below
table showing volume composition and nesting.  (The order shown is
{\em not} the search order.)  The daughter volumes of volumes marked
with an ``$\ast$'' are given in separate tables.

\begin{tabbing}
\hspace{28mm} {\tt XSC+} \hspace{2mm} \=
{\tt TUBE} \hspace{2mm} \=
Copies \hspace{2mm} \=
Media \hspace{2mm} \=
Type \hspace{2mm} \= \kill
Volumes \> Shape \> Copies \> Media \> Type \> Description \\*
\\*
{\tt CB-}                 \>{\tt BOX }\> \>80\> \>Mother volume\\*
\hspace{ 7mm}{\tt CBCO}   \>{\tt BOX }\> \>81\> \>Concrete floor\\*
\hspace{ 7mm}{\tt MGN-}   \>{\tt BOX }\> \>15\> \>Box holding magnet\\*
\hspace{14mm} {\tt MCO+}  \>{\tt TUBE}\> \>18\> \>Magnet coil\\*
\hspace{21mm}  {\tt MCSP} \>{\tt TUBE}\>5\>10\> \>Steel plates in coil\\*
\hspace{14mm} {\tt END1}  \>{\tt BOX }\>2\>20\> \>Inner, solid door\\*
\hspace{21mm}  {\tt HOL1} \>{\tt TUBE}\> \>15\> \>Hole in inner door\\* 
\hspace{14mm} {\tt MYO1}\>{\tt BOX }\>4\>10\> \>Yoke: horiz. and vert. slabs\\*
\hspace{14mm} {\tt MYO2}  \>{\tt BOX }\>4\>10\> \>Yoke: $45^\circ$ slabs\\*
\hspace{14mm} {\tt MYO3}  \>{\tt BOX }\> \>10\> \>New yoke, top and bottom\\*
\hspace{14mm} {\tt MYO4}  \>{\tt BOX }\> \>10\> \>New yoke, sides\\*
\hspace{14mm} {\tt END2}  \>{\tt BOX }\>2\>19\> \>Outer, low-density door\\*
\hspace{21mm}  {\tt HOL2} \>{\tt TUBE}\> \>15\> \>Hole in outer door\\*
\hspace{14mm} {\tt RAIL}  \>{\tt BOX }\>2\>10\> \>Steel support rails\\*
\hspace{14mm} {\tt BCM- *}\>{\tt PCON}\>2\>25\> \>BC mother vol./inner alum.\\*
\hspace{14mm} {\tt BCCA}  \>{\tt TUBE}\>2\>26\> \>BC cables at magnet exit\\*
\hspace{14mm} {\tt BCCC}  \>{\tt PCON}\>2\>11\> \>Inner cooling collars\\*
\hspace{14mm} {\tt JDC- *}\>{\tt PCON}\> \>30\> \>JDC mother volume\\*
\hspace{14mm} {\tt PWC- *}\>{\tt TUBE}\> \>60\> \>PWC mother volume\\*
\hspace{14mm} {\tt TGHP}  \>{\tt TUBE}\> \>51\> \>HP H$_2$ target mother\\*
\hspace{21mm}  {\tt THPO} \>{\tt TUBE}\> \>53\> \>Al tube\\*
\hspace{21mm}  {\tt THPE} \>{\tt TUBE}\>2\>53\> \>Al endcaps\\*
\hspace{14mm} {\tt LHT- *}\>{\tt PCON}\> \>60\> \>LH$_2$ target mother\\*
\hspace{14mm} {\tt GHT- *}\>{\tt TUBE}\> \>60\> \>GHT mother, air\\*
\hspace{14mm}  {\tt VE- } \>{\tt PCON}\> \>60\> \>Veto mother volume\\*
\hspace{21mm}  {\tt VETO} \>{\tt TUBE}\> \>90\>5\>Scintillator\\*
\hspace{21mm}  {\tt VGUI} \>{\tt TUBE}\> \>91\> \>Light guide\\*
\end{tabbing}

\begin{tabbing}
\hspace{21mm} {\tt WS11--WS13} \hspace{2mm} \=
{\tt TUBE} \hspace{2mm} \=
Copies \hspace{2mm} \=
Media \hspace{2mm} \=
Type \hspace{2mm} \= \kill
{\tt BCM-} Subvolumes \> Shape \> Copies \> Media \> Type \> Description \\*
\\*
{\tt BCDK}                       \>{\tt TUBE}\>  \>27\> 
                                   \>Al annuli (midplane faces)\\*
{\tt BCOU}                       \>{\tt PCON}\>  \>28\> 
                                   \>Outer BC support structure\\*
{\tt BCA1}                       \>{\tt PCON}\>  \>30\> 
                                   \>Air holding crystals 1--10\\*
\hspace{ 7mm}{\tt BC60}          \>          \>60\>30\> 
                                   \>Azimuthal segment of BCA1\\*
\hspace{14mm}  {\tt CO01-CO10}  \>{\tt TRAP}\>  \>22\> 
                                   \>Crystal cornets 1--10\\*
\hspace{21mm}    {\tt XT01-XT10}\>{\tt TRAP}\>  \>21\>2
                                   \>Crystals 1--10\\*
\hspace{14mm}  {\tt CE01-CE10}  \>{\tt TRAP}\>  \>23\> 
                                   \>Cornet ends 1--10\\*
\hspace{14mm}  {\tt CP01-CP10}  \>{\tt TRD1}\>  \>24\> 
                                   \>Chapeaux 1--10\\*
\hspace{21mm}    {\tt WS01-WS10}\>{\tt TRD1}\>  \>90\>3
                                   \>Wavelength shifters 1--10\\*
\hspace{21mm}    {\tt PD01-PD10}\>{\tt BOX }\>  \>92\>4
                                   \>Photodiodes 1--10\\*
{\tt BCS1}                       \>{\tt PCON}\>  \>29\> 
                                   \>Support structure for 1--10\\*
{\tt BCA2}                       \>{\tt PCON}\>  \>30\> 
                                   \>Air volume for xtals 11--13\\*
\hspace{ 7mm}{\tt BC30}          \>          \>30\>30\> 
                                   \>Azimuthal segment of BCA2\\*
\hspace{14mm}  {\tt CO11-CO12}  \>{\tt TRAP}\>  \>22\> 
                                   \>Crystal cornets 11,12\\*
\hspace{21mm}    {\tt XT11-XT12}\>{\tt TRAP}\>  \>21\>2
                                   \>Crystals 11,12\\*
\hspace{14mm}  {\tt CO13}        \>{\tt PGON}\>  \>22\> 
                                   \>Crystal cornet 13\\*
\hspace{21mm}    {\tt XT13}      \>{\tt PGON}\>  \>21\>2
                                   \>Crystal 13\\*
\hspace{14mm}  {\tt CE11-CE13}  \>{\tt TRAP}\>  \>23\> 
                                   \>Cornet ends 1-13\\*
\hspace{14mm}  {\tt CP11-CP13}  \>{\tt TRD1}\>  \>24\> 
                                   \>Chapeaux 11-13\\*
\hspace{21mm}    {\tt WS11-WS13}\>{\tt TRD1}\>  \>90\>3
                                   \>Wavelength shifters 11-13\\*
\hspace{21mm}    {\tt PD11-PD13}\>{\tt BOX }\>  \>92\>4
                                   \>Photodiodes 11-13\\*
{\tt BCS2}                       \>{\tt PCON}\>  \>29\> 
                                   \>Support structure for 11-13\\*
\end{tabbing}

\begin{tabbing}
\hspace{21mm} {\tt JW01-JW23} \hspace{2mm} \=
{\tt TUBE} \hspace{2mm} \=
Copies \hspace{2mm} \=
Media \hspace{2mm} \=
Type \hspace{2mm} \= \kill
{\tt JDC-} Subvolumes \> Shape \> Copies \> Media \> Type \> Description \\*
\\*
{\tt JCEN}                        \>{\tt TUBE}\>     \> 31 \> 
                                    \> JDC gas (insensitive)\\*
\hspace{ 7mm}{\tt JDG1}           \>{\tt TUBE}\>     \> 31 \> 
                                    \> Sensitive gas volume\\*
\hspace{14mm}  {\tt JDSE}         \>          \> 30  \> 31 \> 
                                    \> Azimuthal segment of JDG1\\*
\hspace{21mm}    {\tt JW01-JW23} \>{\tt TRAP}\>     \> 31 \>1
                                    \> Drift cell\\*
\hspace{ 7mm}{\tt JDC1}           \>{\tt TUBE}\>     \> 32 \> 
                                    \> Inner cylinder\\*
{\tt JDC2}                        \>{\tt TUBE}\>     \> 33 \> 
                                    \> Outer cylinder\\*
{\tt JSD1}                        \>{\tt TUBE}\>     \> 30 \> 
                                    \> Downstream end material\\*
\hspace{ 7mm}{\tt JDP1}           \>{\tt TUBE}\> 1/2 \> 40 \> 
                                    \> Endplate, thin part\\*
\hspace{ 7mm}{\tt JDP2}           \>{\tt TUBE}\> 1/2 \> 41 \> 
                                    \> Endplate, thick part\\*
\hspace{ 7mm}{\tt JDCI}           \>{\tt TUBE}\> 1/2 \> 37 \> 
                                    \> Inner cooling plate region\\*
\hspace{ 7mm}{\tt JDCO}           \>{\tt TUBE}\> 1/2 \> 38 \> 
                                    \> Outer cooling plate region\\*
\hspace{ 7mm}{\tt JAM1}           \>{\tt TUBE}\>   1 \> 30 \> 
                                    \> Downstream preamp region\\*
\hspace{14mm}  {\tt J130}         \>          \>  30 \> 30 \> 
                                    \> Azimuthal segment of JAM1\\*
\hspace{21mm}    {\tt JAMP}       \>{\tt BOX }\> 1/2 \> 34 \> 
                                    \> Preamp\\*
\hspace{21mm}    {\tt JTDN}       \>{\tt PCON}\>   1 \> 42 \> 
                                    \> Cables, etc.\\*
\hspace{ 7mm}{\tt JDE1}           \>{\tt PCON}\>     \> 35 \> 
                                    \> Support cables, etc.\\*
\hspace{ 7mm}{\tt JDKU}           \>{\tt TUBE}\>     \> 39 \> 
                                    \> Swivel support (``kugel'')\\*
{\tt JSD2}                        \>{\tt TUBE}\>     \> 30 \> 
                                    \> Upstream end material\\*
\hspace{ 7mm}{\tt JDP1}           \>{\tt TUBE}\> 2/2 \> 40 \> 
                                    \> Endplate, thin part\\*
\hspace{ 7mm}{\tt JDP2}           \>{\tt TUBE}\> 2/2 \> 41 \> 
                                    \> Endplate, thick part\\*
\hspace{ 7mm}{\tt JDCI}           \>{\tt TUBE}\> 2/2 \> 37 \> 
                                    \> Inner cooling plate region\\*
\hspace{ 7mm}{\tt JDCO}           \>{\tt TUBE}\> 2/2 \> 38 \> 
                                    \> Outer cooling plate region\\*
\hspace{ 7mm}{\tt JAM2}           \>{\tt TUBE}\>   1 \> 30 \> 
                                    \> Upstream preamp region\\*
\hspace{14mm}  {\tt J230}         \>          \>  30 \> 30 \> 
                                    \> Azimuthal segment of JAM2\\*
\hspace{21mm}    {\tt JAMP}       \>{\tt BOX }\> 2/2 \> 34 \> 
                                    \> Preamp\\*
\hspace{21mm}    {\tt JTUP}       \>{\tt PCON}\>   1 \> 42 \> 
                                    \> Cables, etc.\\*
{\tt JDE2}                        \>{\tt PCON}\>     \> 36 \> 
                                    \> Umbilical support cables\\*
\end{tabbing}

\begin{tabbing}
\hspace{28mm} {\tt XSC+} \hspace{2mm} \=
{\tt TUBE} \hspace{2mm} \=
Copies \hspace{2mm} \=
Media \hspace{2mm} \=
Type \hspace{2mm} \= \kill
{\tt PWC-} Subvolumes \> Shape \> Copies \> Media \> Type \> Description \\*
\\*
{\tt ROHA}                 \>{\tt TUBE}\>     \>62\> 
                              \>Rohacell\\*
\hspace{ 7mm} {\tt IPWC}   \>{\tt TUBE}\>     \>61\> 
                              \>Inner wire layer\\*
\hspace{14mm}   {\tt ICEL} \>          \>  90 \>61\>1
                              \>Azimuthal segment of IPWC\\*
\hspace{ 7mm} {\tt AGAP}   \>{\tt TUBE}\>     \>60\> 
                              \>PWC1, PWC2 air gap\\*
\hspace{ 7mm} {\tt OPWC}   \>{\tt TUBE}\>     \>61\> 
                              \>Outer wire layer\\*
\hspace{14mm}   {\tt OCEL} \>          \> 150 \>61\>1
                              \>Azimuthal segment of OPWC\\*
{\tt ENDL}                 \>{\tt TUBE}\>     \>63\> 
                              \>G10 end\\*
{\tt ENDR}                 \>{\tt TUBE}\>     \>63\> 
                              \>G10 end\\*
\end{tabbing}

\begin{tabbing}
\hspace{28mm} {\tt XSC+} \hspace{2mm} \=
{\tt TUBE} \hspace{2mm} \=
Media \hspace{2mm} \= \kill
{\tt LHT-} Subvolumes \> Shape \> Media \> Description \\*
\\*
{\tt BLIN}                  \>{\tt PCON}\> 42 
                                \> Beamline material\\*
{\tt LHAL}                  \>{\tt TUBE}\> 53 
                                \> Aluminum tube\\*
\hspace{ 7mm}{\tt LHIS}     \>{\tt TUBE}\> 55 
                                \> Mylar insulation\\*
\hspace{14mm}  {\tt LHF1}   \>{\tt TUBE}\> 56 
                                \> Iron ring part\\*
\hspace{21mm}    {\tt LHFH} \>{\tt TUBE}\> 55/52 
                                \> Hollow in iron ring (empty or LH$_2$)\\*
\hspace{21mm}    {\tt LHFC} \>{\tt TUBE}\> 57
                                \> Copper plate closing ring (1991 or later)\\*
\hspace{14mm}  {\tt LHF2}   \>{\tt TUBE}\> 56 
                                \> Iron ring part\\*
\hspace{14mm}  {\tt LHMY}   \>{\tt TUBE}\> 54 
                                \> Mylar tube\\*
\hspace{21mm}    {\tt LHLH} \>{\tt TUBE}\> 52 
                                \> Target filling (LH$_2$ or LD$_2$)\\*
\hspace{ 7mm}{\tt LHWI}     \>{\tt TUBE}\> 54 
                                \> Mylar window\\*
\end{tabbing}

\begin{tabbing}
\hspace{7mm} {\tt GHT-} Subvolumes \hspace{2mm} \=
Shape \hspace{2mm} \=
Copies \hspace{2mm} \=
Media \hspace{2mm} \=
Type \hspace{2mm} \= \kill
{\tt GHT-} Subvolumes \> Shape \> Copies \> Media \> Type \> Description \\*
\\*
               {\tt AFLA}  \>{\tt PCON}\> \>53\> \>Alum. flaring flange\\*
               {\tt BLIN}  \>{\tt TUBE}\> \>58\> \>Beamline material\\*
               {\tt ALCY}  \>{\tt TUBE}\> \>53\> \>Alum. target cylinder\\*
\hspace{7mm}    {\tt HGA1} \>{\tt TUBE}\> \>78\> \>H$_2$ gas\\*
\hspace{7mm}    {\tt HGA2} \>{\tt TUBE}\> \>78\> \>H$_2$ gas\\*
\hspace{7mm}    {\tt HGA3} \>{\tt TUBE}\> \>78\> \>H$_2$ gas\\*
               {\tt ALF2}  \>{\tt TUBE}\> \>53\> \>Alum. flange\\*
               {\tt PPA1}  \>{\tt TUBE}\> \>53\> \>Alum. PPAC flange\\*
               {\tt PPA2}  \>{\tt TUBE}\> \>70\> \>Plastic PPAC parts\\*
               {\tt ALF1}  \>{\tt TUBE}\> \>53\> \>Alum. PPAC parts\\*
               {\tt PPA3}  \>{\tt TUBE}\> \>70\> \>Plastic PPAC interior\\*
               {\tt ALRR}  \>{\tt TUBE}\> \>53\> \>Fiber retaining ring\\*
               {\tt SFI1}  \>{\tt PCON}\> \>71\> \>Fibers, flaring part\\*
\hspace{7mm}    {\tt SCE1} \>       \>126 \>71\> \>Fiber group/segment\\*
               {\tt SFI2}  \>{\tt TUBE}\> \>71\> \>Fibers, cylinder\\*
\hspace{7mm}    {\tt SCE2} \>       \>126 \>71\> \>Fiber group/segment\\*
\end{tabbing}

\clearpage

\subsection{Materials and Media}

Although one can obtain a great deal of information on the material
and tracking media definitions with the data card \mbox{\tt PRIN
'MATE' 'TMED'}, the table below is included for convenience.  Note
that these are the \cbg{} materials ({\em not} tracking media).
Materials 1--16 are standard \gea{} definitions, while all others are
defined in the {\sc materi} subroutine.

\begin{tabbing}
Material \hspace{2mm} \=
{\tt GHT FIBER LAYER} \hspace{2mm} \= \kill
Material \> Name            \> Place Used\\*
\\*
  1  \> \tt HYDROGEN        \> Target filling\\*
  2  \> \tt DEUTERIUM       \> Target filling\\*
  9  \> \tt ALUMINUM        \> Target, GHT\\*
 10  \> \tt IRON            \> Magnet yokes\\*
 11  \> \tt COPPER          \> BC cooling collars, target part\\*
 15  \> \tt AIR             \> Air inside magnet\\*
\\
 18  \> \tt AL\_COIL        \> Magnet\\*
 19  \> \tt IRON\_040       \> Magnet\\*
\\
 21  \> \tt BC\_CSI(TL)     \> BC\\*
 22  \> \tt BC\_CORNET1     \> BC\\*
 23  \> \tt BC\_CORNET2     \> BC\\*
 24  \> \tt BC\_CHAPEAU     \> BC\\*
 25  \> \tt BC\_ALU1        \> BC\\*
 26  \> \tt BC\_CABLES      \> BC\\*
 27  \> \tt BC\_ALU2        \> BC\\*
 28  \> \tt BC\_ALU3        \> BC\\*
 29  \> \tt BC\_BEYOND      \> BC\\*
\\
 31  \> \tt JDC-CO2/ISOBUT  \> JDC\\*
 32  \> \tt JDC-INNER CYL   \> JDC\\*
 33  \> \tt JDC-OUTER CYL   \> JDC\\*
 34  \> \tt JDC-PREAMPS     \> JDC\\*
 35  \> \tt JDC-EXITMASS 1  \> JDC\\*
 36  \> \tt JDC-EXITMASS 2  \> JDC\\*
 37  \> \tt JDC-IN  COOLPL  \> JDC\\*
 38  \> \tt JDC-OUT COOLPL  \> JDC\\*
 39  \> \tt JDC-KUGEL       \> JDC\\*
 40  \> \tt JDC-ENDPLATE    \> JDC\\*
 41  \> \tt JDC-ALU\_6061   \> JDC\\*
 42  \> \tt JDC-CABLES ETC  \> JDC\\*
\\
 51  \> \tt HP H2 GAS       \> Target\\*
 54  \> \tt MYLAR\_LH2      \> Target\\*
 55  \> \tt MYLAR\_INS      \> Target\\*
 56  \> \tt IRON\_100\_TARG \> Target\\*
 58  \> \tt BEAMLINE        \> Beamline\\*
 61  \> \tt ARGON/ETHANE    \> PWC\\*
 62  \> \tt ROH/KAP         \> PWC\\*
 63  \> \tt G10             \> PWC\\*
\\
 70  \> \tt PPAC INTERIOR   \> GHT\\*
 78  \> \tt GHT FIBER LAYER \> GHT\\*
 78  \> \tt GHT H2 GAS      \> GHT\\*
\\
 80  \> \tt CRUDE-CUT AIR   \> Air outside magnet\\*
 81  \> \tt CONCRETE        \> Floor\\*
\\
 90  \> \tt SCINTILLATOR    \> Veto counter\\*
 92  \> \tt SILICON         \> BC\\*
\end{tabbing}

We now list the tracking media with their names and the number of the
material of which they are composed.  Material numbers differing from
the media number are marked by an ``$\ast$''.

\begin{tabbing}
Media \hspace{2mm} \=
{\tt LH2-Target Mylar\_INS} \hspace{2mm} \=
24 \hspace{2mm} \= \kill
Media \> Name \> Material \>\\*
\\*
 10 \>  Magnet Return Yokes   \> 10 \>  \\*
 11 \>  BC Cooling Cu         \> 11 \>  \\*
 15 \>  Default Air           \> 15 \>  \\*
 18 \>  Aluminium coil        \> 18 \>  \\*
 19 \>  End2 -- 40\% Iron     \> 19 \>  \\*
 20 \>  End1 - 100\% Iron     \> 10 \>  \\*
\\
 21 \>  BC CsI crystal        \> 21 \>  \\*
 22 \>  BC Cornet1            \> 22 \>  \\*
 23 \>  BC Cornet2            \> 23 \>  \\*
 24 \>  BC Chapeau            \> 24 \>  \\*
 25 \>  BC Alum-Inner         \> 25 \>  \\*
 26 \>  BC Cables             \> 26 \>  \\*
 27 \>  BC Alum-Annuli        \> 27 \>  \\*
 28 \>  BC Alum-Outer         \> 28 \>  \\*
 29 \>  BC Beyond Chap        \> 29 \>  \\*
\\
 30 \>  JDC/BC air            \> 15 \> *\\* 
 31 \>  JDC CO2:Isobut        \> 31 \>  \\*
 32 \>  JDC inner Cyl         \> 32 \>  \\*
 33 \>  JDC outer Cyl         \> 33 \>  \\*
 34 \>  JDC preamps           \> 34 \>  \\*
 35 \>  JDC dwn exit1         \> 35 \>  \\*
 36 \>  JDC dwn exit2         \> 36 \>  \\*
 37 \>  JDC in cool pl        \> 37 \>  \\*
 38 \>  JDC outcool pl        \> 38 \>  \\*
 39 \>  JDC kugel             \> 39 \>  \\*
 40 \>  JDC thin endpl        \> 40 \>  \\*
 41 \>  JDC thickendpl        \> 41 \>  \\*
 42 \>  JDC midcool pl        \> 42 \>  \\*
\\
 51 \>  High Pressure H2      \> 51 \>  \\*
 52 \>  LH2-Target LH2 Fill   \>  1 \> *\\*
 53 \>  Target Aluminum       \>  9 \> *\\*
 54 \>  LH2-Target Mylar      \> 54 \>  \\*
 55 \>  LH2-Target Mylar\_INS \> 55 \>  \\*
 56 \>  LH2-Target Iron\_100  \> 56 \>  \\*
 57 \>  LH2-Target Copper     \> 57 \>  \\*
 58 \>  LH2-Beamline          \> 58 \>  \\*
 59 \>  LH2-Target LD2 Fill   \>  2 \> *\\*
 60 \>  PWC/LH2 mother (air)  \> 15 \> *\\*
 61 \>  PWC Ar/Ethane         \> 61 \>  \\*
 62 \>  PWC Rohacell          \> 62 \>  \\*
 63 \>  PWC G10 endplate      \> 63 \>  \\*
\\
 70 \>  GHT - PPAC INTERIOR   \> 80 \>  \\*
 71 \>  GHT - FIBER LAYER     \> 80 \>  \\*
 78 \>  GHT - 1 ATM. H2 prec  \> 80 \>  \\*
\\
 80 \>  Low-accuracy Air      \> 80 \>  \\*
 81 \>  Crude Concrete        \> 81 \>  \\*
\\
 90 \>  Scintillator          \> 90 \>  \\*
 91 \>  Light guide           \> 90 \> *\\*
 92 \>  Silicon diode         \> 92 \>  \\*
\end{tabbing}

\subsection{Detector Subcomponents}

\subsubsection{Liquid Hydrogen Target}

The liquid hydrogen target is implemented fairly accurately, excepting
details like the bulging of the Mylar windows, the smearing of the
superinsulation into a continuous medium and the omission of the
Vespel tapering from the iron ring to the Mylar cylinder.  Because the
Mylar hydrogen vessel is so thin, the tracking resolution would
normally have to be set to a rather small value.  Therefore, its
thickness was increased in the simulation, and its density reduced
accordingly.  Of course, the Sternheimer density effect changes the
energy loss calculation somewhat, but the Mylar here is so thin that
this should not matter.

There was a design change made in the target before the 1991 runs: a
2-mm thick copper disk was added to close the ``iron'' ring, allowing
it to be used for cooling.  This is supported in the Monte Carlo
through the {\tt TGLH} data card, allowing the user to specify the
year.  The same card allows the user to specify the target filling as
being either LH$_2$ or LD$_2$, although this affects only the
interactions of the annihilation products---not the annihilation
itself.

\subsubsection{PWC}

There have been three pairs of PWC's to date; only the second design
is supported in \cbg{}.  The first design had more wires in each
chamber than does the current design and they are therefore quite
distinct.  The second and third designs are more similar.

The PWC geometry is implemented straightforwardly, except that the
wires are not included in the gas, and the Rohacell, Mylar and
aluminum of the walls have been homogeneously smeared together.  The
signal cables have been included only approximately.

\subsubsection{GHT}

The GHT and PPAC geometries have been implemented, although some
dimensions may be slightly inaccurate and a number of minor features
(e.g., the Mylar window) have been ignored or simplified.  The
scintillating fibers have been smeared into a continuous media of the
correct average density.  This is done for two regions: the cylinder
around the target and the part which flares out to larger radius
before the fibers are spliced to non-scintillating fibers.  These
regions have then been divided into 126 sectors.

\subsubsection{JDC}

The JDC is geometrically complex, with its mass sufficient to cause
significant $\gamma$-ray conversion and charged particle energy loss.
The mass and composition of most regions are known and are usually
implemented accurately, to the extent possible with smearing.  An
exception would be the chamber sense and high voltage wires, which
have not been included at all, although their scattering is {\em not}
negligible compared to the gas.  Including them properly would require
some effort, since it would not be correct to simply smear them with
the gas.

One type of region which has not been entirely smeared corresponds to
the 30 preamps at either end of the chamber.  Viewed edgewise, these
are quite thick; unfortunately, the products from a converting,
high-energy $\gamma$ ray will usually traverse the full width and
lose a non-negligible amount of energy.  Azimuthally smearing the
preamps into a ring would give a lower energy loss.  Thus, each preamp
is represented by a distinct region, although the components of the
preamp are still smeared over a rectangular solid volume.

\subsubsection{Barrel Calorimeter}

The geometry of the barrel has been implemented rather accurately.  A
small exception would be the type \#11 crystals, at which there is a
transition from 30 crystals per ring to 60 crystals per ring.  Since
these crystals are not trapezoidal in cross-section, \gea{} does not
support their shape, and they have to be approximated.  At one edge,
the gap to the next crystal is too large in some places, while it
slightly overlaps the next crystal in others.  The other major
calorimeter approximations are radially beyond the crystals, such as
smearing of the crystal chapeaux and parts of the support structure,
which probably have relatively little effect.

\subsubsection{Magnet}

Physically, the magnet simulation should be reasonably accurate.  The
aluminum, epoxy and water in the coil are smeared together, but the
steel plates between the coil pancakes and the calorimeter support
rails are included separately.  The components of the yoke are all
included, except that part of the doors, where steel plates alternate
with air, is smeared into a region of reduced density.  There is even
some concrete under the magnet for the benefit of any neutrons which
may feel inclined to scatter (although shielding blocks and other
material external to the magnet have been omitted).

\subsubsection{Veto Counter}

The veto counter can be included physically, although it is the user's
responsibility to position it.  As of \cbg{} 4.06/03, however, there
is still no provision to digitize signals in it.

\subsection{Magnetic Field}

There are some uncertainties in the homogeneity of the magnetic
field; the various expressions available so far do not obey
Maxwell's equations closely.  If one chooses the \cbg{} option for
Runge-Kutta tracking in the central part of the detector, the
equations used for the field are:
\[ B_x = B_0x \left( 2c_1z + c_2 \right) \]
\[ B_y = B_0y \left( 2c_1z + c_2 \right) \]
\[ B_z = B_0 \left[1 + c_1 \left( r^2-2z^2 \right) - 2f_2z \right],
  \hspace{2.0mm} \mbox{where} \]
\[ c_1=1.016 \times 10^{-5}
 \hspace{2.0mm} \mbox{and} \hspace{2.0mm}
c_2=0.293 \times 10^{-5}. \]
$B_0$ is the field at the center of the detector (normally \mbox{1.5 Tesla}).

In any case, the magnetic field in the coil and beyond is not
accurate; it is taken as being constant and equal to the central value
in each region, which is clearly not true in the coil or magnet doors.
A small exception is the outer yoke, where the sign of the field is
taken to be opposite that of the central field.  However, one does not
expect much effect from details in the field beyond the calorimeter,
since most particles will not be deflected back into the detector.

\subsection{Detector Digitization}

\subsubsection{PWC}

The PWC digitization algorithm {\sc pwdigi} is fairly simple.  It
applies a constant efficiency (96\% for both chambers), together with
a constant probability of triggering wires adjacent to a hit and a
constant probability of there being noise hits.  One would expect
that, in reality, chamber efficiency would be greater for heavily
ionizing tracks, and for tracks with large azimuthal and/or axial
directional components.  Such tracks would presumably also have an
increased probability of triggering adjacent wires.  The parameters
affecting the PWC signal are accessible by data card.

\subsubsection{GHT}

Data from the GHT is not currently digitized.  In principle, one could
take the recorded entrance and exit locations for a particle,
determine the distance which a straight line path would take through
the five active fibers in a sector and scale the energy loss in the
continuous media accordingly.  This would be a simple algorithm to
write, and reasonably fast to execute.

\subsubsection{JDC}

There are two separate algorithms for producing signals in the JDC with
\cbg{}.  The physical Monte Carlo is somewhat slow, but simulates the
detailed physical processes that generate a signal.  The {\tt FASTJDC}
algorithm is much simpler.  It takes the entrance and exit points on a
JDC cell, finds the shortest drift time along the straightline
connection of these points and then applies various distortions.  Most
testing has been done with the {\tt FASTJDC} option so far. The
parameters affecting the {\tt FASTJDC} calculation of the JDC signal
are accessible by data card.

\subsubsection{Barrel Calorimeter}

There are a number of small corrections made to the energy deposit in
the CsI in calculating the appropriate signal.  There is compensation
for variations in $dE/dx$ which affect the light output, but this is
not done quite right: \gea{} uses a restricted energy loss, while the
correction function in the literature is for unrestricted energy loss.
Fortunately, this has only a minor effect.  The correction that exists
for the time of energy deposit relative to the ADC gate is also small,
presumably affecting mostly muon decays (neutrons do not decay in
\gea{}).  Finally, energy deposits in the wavelength shifter and
photodiode are scaled and added to the energy deposit in the CsI
(although the scaling factor for the wavelength shifter is not yet
accurately known).

The main uncertainty in the light output corrections is that the light
collection efficiency varies considerably (several per cent) along the
axis of a crystal, and the variation varies from one crystal to the
next.  The measurements of the crystal compensation were made with a
photomultiplier tube, rather than a silicon photodiode, and are not
entirely applicable.  It is likely, however, that one cannot fully
simulate the calorimeter without handling this problem in some way,
since the variation is of the same order as the resolution.  A
constant smearing is not appropriate because is fails to account for
the larger variation which higher energy electromagnetic showers and
heavy charged particles will tend to sample (crystal compensation
being worse near the chapeaux).

There are a number of data card options to impose crystal calibration
variations, incoherent noise and coherent noise.  (By default, there
is a 1\% variation in the crystal calibrations.)  These are
straightforward and the data cards are discussed elsewhere.

\subsection{Particle Production and Tracking Thresholds}

In a condensed history Monte Carlo such as \gea{}, it is critical that
the energy cuts for discrete particle production and tracking be
chosen carefully: using the code as a black box is a prescription for
disaster.  To use thresholds that are too high results in the loss of
important information, such as the leakage of energy from one crystal
into adjacent crystals in a calorimeter, or the loss of tracking
resolution in a gaseous tracking detector due to the low energy
$e^-$'s and $\gamma$'s that are produced along a track and smear it.
On the other hand, low energy electrons are expensive to track, both
because their number nearly diverges at low energy and because their
scattering and deflection in a magnetic field is large, so that step
lengths in a Monte Carlo must be small.  This is especially true for
\gea{} where the angular step in the magnetic field is a quantity on
which the user sets an upper limit.

Fortunately, CPU time is not as sensitive to these cuts as one might
expect, since, although copious, low energy particles usually do not
have to be tracked very far (excepting neutrons and neutrinos).
Decreasing most energy cuts by a factor of ten from the \gea{}
defaults costs a factor of two in CPU time.  Thus, there is not too
much point in worrying over extremely fine adjustments of these
parameters: one should set them at a reasonably safe level.

While it is not possible to choose the appropriate energy thresholds
with confidence prior to runs verifying that the measured physics is
stable with respect to moderate variations in these thresholds, a
rough rule of thumb would be that the practical range or attenuation
length of the secondary particles at the threshold should not much
exceed the resolution or smallest dimensions of the sensitive portions
of the device.  One must examine some specific cases to make sense of
this vague language.
\begin{enumerate}
\item{
Consider CsI crystals with dimensions of order 30 cm x 4.5 cm x 3 cm,
separated by 0.1 g/cm$^2$ thick titanium foil.  If one sets the
thresholds at energies below which the particles do not often reach an
adjacent crystal, this is fairly safe.  Of course, some low energy
$\delta$-rays from energy deposition near a crystal face might leak
energy into the titanium without this being simulated if the energy
loss is treated as continuous, but the fraction of secondaries
affected would be small.}
\item{
In the JDC drift chamber's 1.5 Tesla magnetic field, charged
secondaries tend to spiral along the field lines, so one would compare
the diameter of the spiral and the range to the r-$\phi$ resolution,
and also compare the range with the $Z$ resolution.  Since the
spiral's diameter is \mbox{$D < 0.44$ P cm/(MeV/c)}, an r-$\phi$
resolution of \mbox{100 $\mu$m} or \mbox{0.00002 g/cm$^2$} of CO$_2$
would correspond to a momentum of \mbox{$P=0.023$ MeV/c} or a kinetic
energy of \mbox{$T=0.0005$ MeV} for $e^{+/-}$.  A range of \mbox{100
$\mu$m}, though, corresponds to \mbox{$T=0.0025$ MeV} for $e^{+/-}$.
A $Z$ resolution of \mbox{0.75 cm} would correspond to \mbox{0.75 cm
$\times$ 0.002 g/cm$^3$} \mbox{= 0.0015 g/cm$^2$}, implying
\mbox{$P=0.155$ MeV/c} and that \mbox{$T=0.024$ MeV} for an $e^{+/-}$.
An attenuation length of \mbox{100 $\mu$m} would correspond to
\mbox{0.003 MeV} X rays.  Cuts this low, however, are probably not
 practical with \gea{}.  Thus, one does not expect to be able to use
\gea{} by itself for precise drift chamber modeling.}
\end{enumerate}

Neutron cuts are rather difficult to guess, since neutrons have a long
mean free path, even at low energies.  Since they will often deposit
their energy far away from the original PED, an energy cut should be
lower than that used to define a separate PED, and smaller than the
typical energy resolution for a crystal.  However, because they are
less copious than $e^+$/$e^-$/$\gamma$'s, and because they tend to
arise mostly from pion impacts for which there is widely varying
energy leakage from a crystal, it is probably not necessary to set the
threshold extremely low.

\clearpage

\section{Running the Code}

\subsection{Input}

\subsubsection{Data Cards}

\gea{} itself defines many data cards, and a number of others are
defined in the {\sc ugffgo} subroutine of \cbg{}.  An attempt will
first be made to read data cards from logical unit 99, except on
\cernvm{}.  If this unit is not assigned to an existing file, the cards
will be read from standard input; the actual input is done by {\sc
ffread}.

The card list below includes all of the \cbg{}-defined cards, as well
as a few of the more commonly used \gea{} cards (marked with an
``$\ast$''); see the \gea{} manual for a complete list.  The list
gives the keyword, argument types, the common block and variables
affected by each argument, and the default values and meanings for
each variable.  The convention for the argument types is that
i1,i2,i3\ldots{} are integer; r1,r2,r3\ldots{} are real;
L1,L2,L3\ldots{} are logical; c1,c2,c3\ldots{} are four-character
Hollerith variables and s(n) is a character string of length n.

\begin{tabbing}
{\tt KINE 99} \hspace{0.2cm} \=
{c1--c13} \hspace{0.2cm} \=
{\tt CBBCPR} \hspace{0.2cm} \=
{\tt 'ALFA'->QRAWD(KALFA)} \hspace{0.2cm} \=
500. \hspace{0.2cm} \= \kill
Name       \> Type \> Common    \> Variable \> Default \> Description \\*
\\*
{\tt AGHT} \> r1 \> {\tt CBTGGH} \> {\tt ANGGHT} \> 0.
                                 \> +$Y$ to GHT sector 1 center (deg)\\*
{\tt AJDC} \> r1 \> {\tt CBPWJD} \> {\tt ANGJDC} \> 0.97
                                 \> +$Y$ to JDC sector 1 center (deg)\\*
{\tt ALOR} \> r1 \> {\tt CBPWJD} \> {\tt ANGLOR} \> -7.0
                                 \> JDC Lorentz angle (deg)\\*
{\tt APWC} \> r1 \> {\tt CBPWJD} \> {\tt ANGPWC(1)} \> 0.
                                 \> +$Y$ to PWC1 wire 0 (deg)\\*
           \> r2 \>              \> {\tt ANGPWC(2)} \> 0.
                                 \> +$Y$ to PWC2 wire 0 (deg)\\*
{\tt BCCC} \> L1 \> {\tt CBBCPR} \> {\tt LBCCC}  \> ON
                                 \> ON: include BC cooling collars\\*
{\tt BWID} \> r1 \> {\tt CBTTPR} \> {\tt WIDIN(1)} \> 0.
                                 \> Vertex $\sigma_X$, SETV=90--93 \+ \\*
              r2 \>              \> {\tt WIDIN(2)} \> 0.
                                 \> Vertex $\sigma_Y$, SETV=90--93\\*
              r3 \>              \> {\tt WIDIN(3)} \> 0.
                                 \> Vertex $\sigma_Z$, SETV=90--91\\*
                        \> \> \> \> $(Z_{max}-Z_{min})/2$, SETV=92--93 \- \\
{\tt CCUT} \> L1 \> {\tt CBMCUT} \> {\tt LCECUT}  \> OFF
                                 \> ON: Particle thresholds constant\\
{\tt DEBU*}\> i1 \> {\tt GCFLAG} \> {\tt IDEMIN} \> 0 \>First event to debug\\*
           \> i2 \>              \> {\tt IDEMAX} \> 0 \>Last event to debug\\*
           \> i3 \>              \> {\tt ITEST}  \> 0
                                 \> Debug each {\tt ITEST}$^{th}$ event\\
{\tt DIGI} \> c1--c5 \> {\tt CCFLAG} \> \>
                                 \> Subdetector digitized iff .T.: \+\+\+ \\* 
                                    {\verb}'GH  '->QDIGI(1)}} \> .F. \>GHT\\*
                                    {\verb}'PW  '->QDIGI(2)}} \> .T. \>PWC\\*
                                    {\verb}'JD  '->QDIGI(3)}} \> .T. \>JDC\\*
                                    {\verb}'BC  '->QDIGI(4)}} \> .T. \>BC\\*
                                    {\verb}'VE  '->QDIGI(9)}} \> .F.
                                 \> Veto counter \-\-\- \\
{\tt GEOM} \> c1--c9 \> {\tt CCFLAG} \> \>
                                 \> Use subdetector iff .T.: \+\+\+ \\*
                                  {\verb}'GH  '->QGEOM(1)}} \> .F. \>GHT\\*
                                  {\verb}'PW  '->QGEOM(2)}} \> .T. \>PWC\\*
                                  {\verb}'JD  '->QGEOM(3)}} \> .T. \>JDC\\*
                                  {\verb}'BC  '->QGEOM(4)}} \> .T. \>BC\\*
                                  {\verb}'MG  '->QGEOM(5)}} \> .T. \>Magnet\\*
                                  {\verb}'TGLH'->QGEOM(7)}} \> .T. \>LH$_2$\\*
                                  {\verb}'TGHP'->QGEOM(8)}} \> .F. \>HP\\*
                                  {\verb}'VE  '->QGEOM(9)}} \> .T.
                                  \> Veto counter \-\-\- \\
{\tt GET} \> c1... \> {\tt CCFLAG} \+\+\+ \\*
                                    {\tt 'VERT'->QPRIN(KVERT)} \> .F.
                                  \> {\sc call gpvert} iff .T.\\*
                                    {\tt 'VERT'->QZGET(KVERT)} \> .F. \\*
                                    {\tt 'KINE'->QZGET(KKINE)} \> .F.
                                  \> Get {\tt KINE} bank iff .T.\\*
                                    {\tt 'HITS'->QZGET(KHITS)} \> .F.
                                  \> Hits read from tape iff .T.\\*
                                     {\tt 'DIGI'->QZGET(KDIGI)} \> .F.
                                  \> Digits read from tape iff .T.\\*
                                     {\tt 'SETS'->QZGET(KSETS)} \> .F. \\*
                                     {\tt 'VOLU'->QZGET(KVOLU)} \> .F. \\*
                                     {\tt 'GEOM'->QZGET(KGEOM)} \> .F. \\*
                                     {\tt 'MATE'->QZGET(KMATE)} \> .F. \\*
                                     {\tt 'TMED'->QZGET(KTMED)} \> .F. \\*
                                     {\tt 'CXYZ'->QZGET(KCXYZ)} \> .F. \\*
                                     {\tt 'JXYZ'->QZGET(KJXYZ)} \> .F. \\*
                                     {\tt 'ROTM'->QZGET(KROTM)} \> .F. \\*
                                     {\tt 'PART'->QZGET(KPART)} \> .F.\-\-\- \\
{\tt HDTG} \> i1 \>              \> {\tt IVHDTG} \> 0
                                 \> Trigger \#; not used \\
{\tt IDEN} \> L1 \> {\tt CCFLAG} \> {\tt LIDENT} \> OFF
                                 \> Routines print ID msg. iff .T.\\
{\tt IFLD} \> i1 \> {\tt CCSETS} \> {\tt IFLDPJ} \> 3
                                 \> {\tt IFIELD} for target, PWC and JDC\\
{\tt JDC}  \> s(20) \> {\tt CCJDCD} \> {\tt FILEJ} \> ' '
                                    \> JDC data file name\\
{\tt JDNS} \> r1 \>              \> {\tt RSIGJD} \> 0.1
                                 \> JDC signal fractional variation\\*
           \> r2 \>              \> {\tt RNOIJD} \> 50.0
                                 \> JDC signal noise\\
{\tt JDRS} \> r1 \> {\tt CBJDRS} \> {\tt SIGXJD} \> 0.000
                                 \> JDC Landau smearing in X (cm)\+ \\*
              r2 \>              \> {\tt SIGYJD} \> 0.000
                                 \> JDC Landau smearing in Y (cm) \\*
              r3 \>              \> {\tt ZRESJD} \> 0.70
                                 \> JDC Gaussian smearing in Z (cm) \\*
              r4 \>              \> {\tt ZMAXJD} \> 1.40
                                 \> JDC smearing limit in Z (cm)\- \\
{\tt JDSG} \> i1 \> {\tt CBJDSG} \> {\tt KTHRES} \> 100
                                 \> JDC threshold \+ \\*
              r1 \>              \> {\tt AVALA}  \> 0.15
                                 \> JDC signal height normalization\\*
              r2 \>              \> {\tt AVALS}  \> 0.2
                                 \> JDC avalanche distribution width\\*
              r3 \>              \> {\tt PDOUBL} \> 0.0
                                 \> JDC double signal fraction\\*
              r4 \>              \> {\tt PTRIPL} \> 0.0
                                 \> JDC triple signal fraction\\*
              r5 \>              \> {\tt HWLEN}  \> 20.
                                 \> JDC sense wire half length (cm)\-\\
{\tt KILL} \> i1 \> {\tt CBKILL} \> {\tt NPKILL} \> 1
                                 \> \# particle types to kill \+ \\*
              i2 \>              \> {\tt IDKILL(1)} \> 4
                                 \> First particle ID to kill\\*
              i3-i11 \>          \> {\tt IDKILL(2-10)} \> 0
                                 \> Other particle ID's to kill \- \\
{\tt KINE}   \> i1     \> {\tt GCKINE} \> {\tt IKINE} \> 3
                                       \> Particle generators \\
{\tt KINE 2} \>        \>  \> \> \> {\sc kiuser} one-particle generator \+ \\*
                r1     \>        \> {\tt PKINE(1)} \>
                                 \> Particle ID\\*
                r2     \>        \> {\tt PKINE(2)} \>
                                 \> Lower $|P|$ limit (GeV/c)\\*
                r3     \>        \> {\tt PKINE(3)} \>
                                 \> Upper $|P|$ limit (GeV/c)\\*
                r4     \>        \> {\tt PKINE(4)} \>
                                 \> $\theta$ (degrees); isotropic if $<0$\\*
                r5     \>        \> {\tt PKINE(5)} \>
                                 \> $\phi$ (degrees); isotropic if $<0$ \-\\
{\tt KINE 3} \>        \>              \>             \>
                                       \> {\sc kibiba} generator \+ \\*
                r1     \>              \> {\tt PKINE(1)} \> 1.
                                       \> 1: Hit/miss Monte Carlo\\*
                       \>        \> \> \> 0: Normal Fowl Monte Carlo\\*
                r2     \>              \> {\tt PKINE(2)} \> 0.
                                     \>$P_z$ of $\overline{p}$ beam (GeV/c)\\*
                r3     \>              \> {\tt PKINE(3)} \> -8.
                       \> $<0.$: {\sc bigtid} decay channel (1--30)\+\+\+\+\\*
                          $=0.$: Event from weighted table\\*
                          $>0.$: \# of listed particles \-\-\-\- \\*
                r4     \>        \> {\tt PKINE(4)} \>
                                 \> ID of first particle\\*
                r5--r7 \>        \> {\tt PKINE(5-7)} \>
                                 \> $|P|$, $\theta$, $\phi$ for r3=1;\\*
                       \>  \> \> \>isotropic if $\theta<0$ or $\phi<0$\\*
                r5--r9 \>        \> {\tt PKINE(5-9)} \>
                                 \> Particle types for r3$>1.$ \- \\
{\tt KINE 31}\>        \>              \>             \>
                                     \> {\sc kideut} (LD$_2$) generator \+ \\*
                r1     \>              \> {\tt PKINE(1)} \> 1.
                                       \> 1: Hit/miss Monte Carlo\\*
                       \>        \> \> \> 0: Normal Fowl Monte Carlo\\*
                r2     \>              \> {\tt PKINE(2)} \> 0.
                                     \>$P_z$ of $\overline{p}$ beam (GeV/c)\\*
                r3     \>              \> {\tt PKINE(3)} \> -8.
                                       \> $>1.$: \# of listed particles \\*
                r4     \>        \> {\tt PKINE(4)} \>
                                 \> ID of spectator particle\\*
                r5     \>        \> {\tt PKINE(5)} \>
                                 \> ID of first produced particle\\*
                r6--r10\>        \> {\tt PKINE(6-10)} \>
                                 \> Particle types \- \\
{\tt KINE 50} \>       \>  \> \> \> {\sc kirfq} isotropic $\gamma$
                                    generator \+\+\+ \\*
                                    {\tt PKINE(1)} \>
                                 \> Energy of $\gamma$'s (0-100 GeV)\\*
                                    {\tt PKINE(2)} \>
                                 \> Number of $\gamma$'s (1-1000) \-\-\- \\
{\tt KINE 99} \>       \>            \> \> \> {\sc kitwob} 2-body generator
                                            for $\overline{p}p$;\\*
              \>       \>            \> \> \> uniform for
                                         $12^\circ < \theta < 168^\circ$\+ \\*
                r3     \>            \>{\tt PKINE(3)} \>
                                     \> First particle ID\\*
                r4     \>            \> {\tt PKINE(4)} \>
                                     \> Second particle ID \- \\
{\tt MAGN} \> r1 \> {\tt CCSETS} \> {\tt FLDM} \> -15.
                                 \> B field at origin (KG)\\
{\tt PREC} \> c1--c9 \> {\tt CCFLAG} \> \>
                                     \> Precise tracking iff .T.: \+\+\+ \\*
                          {\verb}'GH  '->QPREC(1)}} \> .F. \> GHT\\*
                          {\verb}'PW  '->QPREC(2)}} \> .F. \> PWC\\*
                          {\verb}'JD  '->QPREC(3)}} \> .F. \> JDC\\*
                          {\verb}'BC  '->QPREC(4)}} \> .F.
                                 \> Barrel calorimeter\\*
                          {\verb}'MG  '->QPREC(5)}} \> .F. \> Magnet\\*
                          {\verb}'TGLH'->QPREC(7)}} \> .F. \> LH$_2$ or LD$_2$
                                                              target\\*
                          {\verb}'TGHP'->QPREC(8)}} \> .F.
                                 \> High Pressure target\\*
                          {\verb}'VE  '->QPREC(9)}} \> .F.
                                 \> Veto counter \-\-\- \\
{\tt PRIN} \> c1--c13 \> {\tt CCFLAG} \> \>
                                      \> Extra printing iff .T. \+\+\+ \\*
                          {\tt 'VERT'->QPRIN(KVERT)} \> .F.
                                   \> {\sc call gpvert}\\*
                          {\tt 'KINE'->QPRIN(KKINE)} \> .F.
                                   \> {\sc call gpkine}\\*
                          {\tt 'HITS'->QPRIN(KHITS)} \> .F.
                                   \> {\sc call gphits}\\*
                          {\tt 'DIGI'->QPRIN(KDIGI)} \> .F.
                                   \> {\sc call gpdigi}\\*
                          {\tt 'SETS'->QPRIN(KSETS)} \> .F.
                                   \> {\sc call gpsets}\\*
                          {\tt 'VOLU'->QPRIN(KVOLU)} \> .F.
                                   \> {\sc call gpvolu}\\*
                          {\tt 'GEOM'->QPRIN(KGEOM)} \> .F. \> \\*
                          {\tt 'MATE'->QPRIN(KMATE)} \> .F.
                                   \> {\sc call gpmate}\\*
                          {\tt 'TMED'->QPRIN(KTMED)} \> .F.
                                   \> {\sc call gptmed}\\*
                          {\tt 'CXYZ'->QPRIN(KCXYZ)} \> .F.
                                   \> {\sc call gpcxyz} (each step)\\*
                          {\tt 'JXYZ'->QPRIN(KJXYZ)} \> .F.
                            \> {\tt ISWIT(10)}=1: save {\tt JXYZ} data\\*
                          {\tt 'ROTM'->QPRIN(KROTM)} \> .F.
                                   \> {\sc call gprotm}\\*
                          {\tt 'PART'->QPRIN(KPART)} \> .F.
                                   \> {\sc call gppart} \-\-\- \\
{\tt PWCD} \> i1 \> {\tt CBPWJD} \> {\tt NDPWC(1)} \> 2
                                 \> PWC1 design type\\*
           \>    \>  \>  \>      \> 0: Exclude PWC1\\*
           \>    \>  \>  \>      \> 1: 1989 PWC1 (not done)\\*
           \>    \>  \>  \>      \> 2: 1990--1991 PWC1\\*
           \> i2 \>              \> {\tt NDPWC(2)} \> 2
                                 \> PWC2 design type\\*
           \>    \>  \>  \>      \> 0: Exclude PWC2\\*
           \>    \>  \>  \>      \> 1: 1989 PWC2 (not done)\\*
           \>    \>  \>  \>      \> 2: 1990--1991 PWC2\\
{\tt PW1S} \> i1 \> {\tt CBPWNO} \> {\tt NWPW1} \> 1
                                 \> Max. PWC1 hits from stat. noise \+\\*
              r1 \>              \> {\tt PWNOI1} \> 0.10
                                 \> Prob. possible noise hit occurs\\*
              r2 \>              \> {\tt PWCHE1} \> 0.96
                                 \> PWC1 chamber efficiency\\*
              r3 \>              \> {\tt PWNXT1} \> 0.20
                                 \> Prob. hit gives adjacent hit\-\\*
{\tt PW2S} \> i1 \> {\tt CBPWNO} \> {\tt NWPW2} \> 1
                                 \> Max. PWC2 hits from stat. noise \+\\*
              r1 \>              \> {\tt PWNOI2} \> 0.10
                                 \> Prob. possible noise hit occurs\\*
              r2 \>              \> {\tt PWCHE2} \> 0.96
                                 \> PWC2 chamber efficiency\\*
              r3 \>              \> {\tt PWNXT2} \> 0.20
                                 \> Prob. hit gives adjacent hit\-\\
{\tt RAWD} \> i1     \> {\tt CCRAWD} \> {\tt IORAWD} \> 20
                                     \> Unit for raw data output \+ \\*
              c1-c20 \>              \>              \>
                                     \> Banks to dump, etc. \+\+ \\*
                   {\tt 'ALL '->QRAWD(KALL )} \> .F.
                             \> Output {\tt EVHD}, {\tt RPWC}, {\tt RJDC},\\*
                         \>  \> {\tt RBCL}, {\tt RBCF}, {\tt RMCB} if .T.\\*
                   {\tt 'EVHD'->QRAWD(KEVHD)} \> .F.
                                 \> Output {\tt EVHD} if .T.\\*
                   {\tt 'RRAW'->QRAWD(KRRAW)} \> .F.
                                 \> Output {\tt RRAW} if .T.\\*
                   {\tt 'RBCF'->QRAWD(KRBCF)} \> .F.
                                 \> Output {\tt RBCF} if .T.\\*
                   {\tt 'RBCL'->QRAWD(KRBCL)} \> .F.
                                 \> Output {\tt RBCL} if .T.\\*
                   {\tt 'RGHC'->QRAWD(KRGHC)} \> .F.
                                 \> Output {\tt RGHC} if .T.\\*
                   {\tt 'RGHF'->QRAWD(KRGHF)} \> .F.
                                 \> Output {\tt RGHF} if .T.\\*
                   {\tt 'RJDC'->QRAWD(KRJDC)} \> .F.
                                 \> Output {\tt RJDC} if .T.\\*
                   {\tt 'RJDF'->QRAWD(KRJDF)} \> .F.
                                 \> Output {\tt RJDF} if .T.\\*
                   {\tt 'RPWC'->QRAWD(KRPWC)} \> .F.
                                 \> Output {\tt RPWC} if .T.\\*
                   {\tt 'RMON'->QRAWD(KRMON)} \> .F.
                                 \> Output {\tt RMON} if .T.\\*
                   {\tt 'ROTR'->QRAWD(KROTR)} \> .F.
                                 \> Output {\tt ROTR} if .T.\\*
                   {\tt 'RMCB'->QRAWD(KRMCB)} \> .F.
                                 \> Output {\tt RMCB} if .T.\\*
                   {\tt 'DISK'->QRAWD(KDISK)} \> .F.
                                 \> Write to disk if .T. (Only if data \\*
                              \> \> is {\em never} to be copied to tape.)\\*
                   {\tt 'TAPE'->QRAWD(KTAPE)} \> .T.
                                 \> Write to tape if .T. (Used if data\\*
                              \> \> might be copied to tape.)\\*
                   {\tt 'NATI'->QRAWD(KNATI)} \> .T.
                                 \> NATIve Zebra format if .T.\\*
                   {\tt 'EXCH'->QRAWD(KEXCH)} \> .F.
                                 \> EXCHange Zebra format if .T.\\*
                   {\tt 'ALFA'->QRAWD(KALFA)} \> .F.
                                 \> ALFA Zebra format iff .T. \-\-\- \\
{\tt RMAX} \> r1 \> {\tt CCTRAK} \> {\tt RMAX} \> 500.
                         \> Kill particles if $\sqrt{x^2+y^2} > ${\tt RMAX}\\
{\tt RNDM *}  \> i1 \> {\tt GCFLAG} \> {\tt NRNDM(1)} \>
                                    \> Random seed \#1\\*
              \> i2 \>              \> {\tt NRNDM(2)} \>
                                 \> Random seed \#2\\
{\tt SETS} \> c1--c5 \> {\\tt CCFLAG} \> \>
                                 \>Make regions sensitive iff .T. \+\+\+ \\*
                           {\verb}'GH  '->QSETS(1)}} \> .F. \> GHT  iff .T.\\*
                           {\verb}'PW  '->QSETS(2)}} \> .F. \> PWC  iff .T.\\*
                           {\verb}'JD  '->QSETS(3)}} \> .F. \> JDC  iff .T.\\*
                           {\verb}'BC  '->QSETS(4)}} \> .F. \> BC   iff .T.\\*
                           {\verb}'VE  '->QSETS(5)}} \> .F.
                                 \> VETO iff .T. \-\-\- \\
{\tt SETV} \> i1 \> {\tt CCVERT} \> {\tt IVERTI} \> 0
                                 \> Sets vertex type: \+\+\+\+\+ \\*
                                    0: Vertex = (0,0,0)\\*
                                    2: Asterix\\*
                                    3: Asterix, target cut\\*
                                    4: CB TGH2 (obsolete)\\*
                                    5: CB TGH2, target cut (obsolete)\\*
                                    6: CB TGHP\\*
                                    7: CB TGHP, target cut\\*
                                    8: CB TGLH\\*
                                    9: CB TGLH, target cut\\*
                                    60--69: User defined in {\sc usvert}\\*
                                    80: r1--r3 are $\sigma$'s around (0,0,0)\\*
                                    81: As for 80, with target cut\\*
                                    90: $\sigma$'s from BWID card\\*
                                    91: As for 90, with target cut\\*
                                    92: $\sigma_x$, $\sigma_y$, $\Delta Z$
                                        from {\tt BWID} card\\*
                                        Dist. is uniform in $Z$ over
                                        $\pm \Delta Z$\\*
                                    93: As for 90, with target cut \-\-\-\- \\ 
  r1 \>    \> {\tt VERTIN(1)} \> \> $\overline{x}$ for uncut vertex dist.\\*
  r2 \>    \> {\tt VERTIN(2)} \> \> $\overline{y}$ for uncut vertex dist.\\*
  r3 \>    \> {\tt VERTIN(3)} \> \> $\overline{z}$ for uncut vertex dist. \-\\*
{\tt STAT *}  \> \> \> \>               \> More \gea{} statistics banks\\
{\tt SWIT} \> i1 \> {\tt GCFLAG} \> {\tt ISWIT( 1)} \> 0
                               \> 1: Print primary vertex/kinematics \+ \\*
              i2 \>   \> {\tt ISWIT( 2)} \> 0 \\*
              i3 \>   \> {\tt ISWIT( 3)} \> 0 \\*
              i4 \>   \> {\tt ISWIT( 4)} \> 0 \\*
              i5 \>   \> {\tt ISWIT( 5)} \> 0 \\*
              i6 \>   \> {\tt ISWIT( 6)} \> 0
                                \> {\tt PRIN JXYZ} prints i6$^{th}$ track;\\*
                 \>   \>     \> \> (use i6=0 to get all tracks)\\*
              i7 \>   \> {\tt ISWIT( 7)} \> 0
                                \> {\tt PRIN JXYZ} prints i7$^{th}$ track\\*
              i8 \>   \> {\tt ISWIT( 8)} \> 0
                                \> {\tt PRIN JXYZ} prints i8$^{th}$ track\\*
              i9 \>   \> {\tt ISWIT( 9)} \> 0 \\*
              i10\>   \> {\tt ISWIT(10)} \> 0
                                \> 1: store the {\tt JXYZ} structure\\*
                 \>   \>     \> \>10: drop the {\tt JXYZ} structure\- \\
{\tt TGLH} \> c1 \> {\tt CBTTPC} \> {\tt TGFILL} \> 'LH2 '
                                 \>'LH2 ': TGLH target fill is LH$_2$\\*
           \>    \>        \> \> \>'LD2 ': TGLH target fill is LD$_2$\\*
           \> c2 \>              \> {\tt TGYEAR} \> '1990'
                                 \>'1989' or '1990': No cooling circuit\\*
           \>    \>        \> \> \>'1991' or '1992': Cooling circuit\\
{\tt TIME *} \> r1 \> {\tt GCTIME} \> {\tt TIMINT} \> System
                                 \> Time left after initialization\\*
           \> r2 \>              \> {\tt TIMEND} \> 1.
                                 \> Time required for termination\\*
           \> i1 \>              \> {\tt ITIME} \> 1
                                 \> Test every {\tt ITIME} events\\*
           \>    \>  \>    \>    \> Uses {\sc kernlib} routine {\sc timel}: \\*
           \>    \>  \>    \>    \> non-existent on {\sc sun} and others\\
{\tt VCTR} \> r1 \> {\tt CBVEPR} \> {\tt PVETO(1)} \> 200.0
                                 \>$Z$ at $\pi$ counter face (cm)\\*
           \> r2 \>              \> {\tt PVETO(2)} \> 1.E6
                                 \> Veto threshold (MeV); not used\\
{\tt XCAF} \>s(20)\> {\tt CBXTPR} \> {\tt XCFILE} \> ' '
                                  \> Crystal calibration file name\\*
{\tt XCVA} \> r1  \> {\tt CBXTPR} \> {\tt CONXVA} \> 0.01
                                  \> $\sigma$ of crystal calibration\\*
{\tt XNFE} \> r1  \> {\tt CBXTPR} \> {\tt CONXF(1)} \> 0.060
                                  \> Fera RMS coherent noise (MeV)\\*
           \>     \>         \    \> {\tt CONXF(2)} \> 0.500
                                  \> Fera RMS incoherent noise (MeV)\\
{\tt XNFF} \> s(20) \> {\tt CBXTPR} \> {\tt XFFILE} \> ' '
                                    \> Fera noise file name\\
{\tt XN22} \> r1    \> {\tt CBXTPR} \> {\tt CONX2(1)} \> 0.060
                                    \> 2282 RMS coherent noise (MeV)\\*
           \> r2    \>              \> {\tt CONX2(2)} \> 0.250
                                    \> 2282 RMS incoherent noise (MeV)\\
{\tt XN2F} \> s(20) \> {\tt CBXTPR} \> {\tt X2FILE} \> ' '
                                    \> 2282 noise file name\\
{\tt XRAY} \> i1    \> {\tt CCVERT} \> {\tt IVXRAY} \> 0
                                    \> Number of protonium X rays\\
{\tt ZTAR} \> r1    \> {\tt CBTTPR} \> {\tt ZTARG} \> 0.
                                    \> $Z$ at TGLH target center (cm)\\
\end{tabbing}

Notes:
\begin{enumerate}
\item{
Use correct letter case with \unix{} file names.}
\item{
If the {\tt DIGI}, {\tt GEOM} or {\tt SETS} cards are used, the
defaults for that card are not used.  {\em All} desired detector
elements must then be explicitly listed.}
\item{
Use of the {\tt GEOM}, {\tt PWCD}, {\tt SETS}, {\tt DIGI} and {\tt
RAWD} cards can affect the values set by the others.  {\sc ugchck}
attempts to set all of these switches to reasonable, self-consistent
values.  One should check the program's informational output to unit
{\tt LOUT} to verify that they are set to what is actually desired.}
\item{
For the {\tt GEOM} card, the {\tt GH} and {\tt PW} options are
mutually exclusive, as are the {\tt TGLH} and {\tt TGHP} options.}
\item{
For the Hollerith variables, use upper case letters and include
trailing blanks (some machines may not require this).}
\end{enumerate}

\subsubsection{Drift Chamber Files}

The drift time file associated with the {\tt JDC} data card is an
ASCII file.  To obtain meaningful JDC tracking results, this file must
have been produced for the appropriate magnetic field, gas mixture,
pressure and JDC geometry, including electrostatics.  The files
included in the {\tt DFILES} patch of 4.06 supercede previous
tables, being produced with the correct magnetic field direction, a
gas density appropriate to CERN, the final JDC geometry and the
voltages used from December 1990 through, at least, December 1991.
They differ from the files distributed with \cbg{} 4.04 and 4.05 in
that they contain additional header information.

The Lorentz angle specified with the {\tt ALOR} data card should
correspond as closely as possible to the drift line angles
corresponding to the drift time file.  These vary with magnetic field,
among other things.  An incorrect Lorentz angle will cause
inaccuracies in the drift cell boundaries with the {\tt FASTJDC}
patch, causing errors in the calculation of the minimum drift time
from a track to the sense wire when that minimum occurs near the
boundary---usually when the azimuthal component of a track dominates.

A modified version of the {\sc garfield} program was used to calculate
the drift time files---the modifications being needed to provide the
diffusion data and to put the file into the expected format.  Header
information has been added ``by hand.''  Drift values are given on an
$r,\phi$ grid which is $400 \times 25$.  The accuracy is uncertain in
the inner and outer-most cells because of the somewhat unknown and
variable electrostatic charging on nearby insulators.

\subsubsection{Barrel Calorimeter Files}

The files associated with the {\tt XCAF}, {\tt XNFF} and {\tt XN2F}
data cards are formatted and are input with a list-directed read.
Entries are ordered by a compound crystal number defined as:
$N=I_\phi+(I_\theta-1)*60$, with $I_\theta=1,2,3,\ldots,26$, where the
$I_\theta=1$ crystal ring is centered 15$^\circ$ from the +$Z$ axis.
$I_\phi=1,2,3,\ldots,60$ for $I_\theta \epsilon [4,23]$ with the
$I_\phi=1$ crystal starting at $\phi=0^\circ$;
$I_\phi=2,4,6,\ldots,60$ for $I_\theta=1,2,3,24,25,26$ with the
$I_\phi=2$ crystal starting at $\phi=6^\circ$.  There are thus $60
\times 26 = 1560$ entries in these files, of which $30 \times 6=180$
are unused.  The files begin with a three line header, with up to 79
characters per line for file identification and comments.  These are
echoed to the {\tt LOUT} unit by {\sc bcset} during \cbg{}
initialization.  (A blank is added in front of each comment line on
the output.)

\subsection{User Routines}

There are three basic \cbg{} user routines: {\sc myinit}, {\sc myevnt}
and {\sc mylast}.  These are often used for histogram definition,
event-by-event filling and output.  Dummy versions are included with
\cbg{}, and it is up to the user to override them with active
subroutines.  All three are called through \cbg{}.
\begin{description}
\item[MYINIT]
This user initialization subroutine is called by {\sc uginit} once
after the other initialization has been done, excepting calls to {\sc
uginfo} (which writes out miscellaneous, pertinent information) and
{\sc ugzrun} (which fills the lookup tables).  Typically, one would
use {\sc myinit} to book histograms, initialize user variables and/or
modify particle decays.  (Note that only decays to two or three
particles are allowed by \gea{}.)
\item[MYEVNT]
This subroutine is called once after each event.  The call is at the
beginning of {\sc guout}.  Typically, one would fill histograms and/or
extract other information about an event here.
\item[MYLAST]
This subroutine is for whatever termination functions are needed by
the user.  It is called once, by {\sc uglast}, after most other
clean-up work is done, including the termination of \gea{}.  Only the
raw data output file and the {\sc zebra} buffers have yet to be
closed.  Typically, one would save histograms and/or record other
user-calculated information here.
\end{description}
There are also two routines intended to be overridden by the user as
needed for event initialization: {\sc kiuser} and {\sc usvert}.  These
are for setting event kinematics and vertex position, respectively.

We now give a simple, but practical, example of user routines.  One
thousand 50-MeV $\gamma$'s were started isotropically from a beam spot
of finite size at the spectrometer center; the calibration uncertainty
of the crystals was set to zero.  The data cards were:
\begin{verbatim}
LIST
TRIG 1000
TGLH 'LH2 ' '1991'
PWCD 2 2
JDC 'jdc15.dat'
XCVA 0.00
SETV 91 0. 0. 0.
BWID 0.3 0.3 0.6
KINE 2 1. 0.050 0.050 -1. -1.
RAWD 20 'TAPE' 'EXCH' 'EVHD' 'RPWC' 'RJDC' 'RBCL' 'RBCF' 'RMCB'
END
\end{verbatim}
The dummy user routines in the {\tt cbuser} patch of \cbg{} include
the code in this example as a comment section.

\begin{minipage}[ht]{\textwidth}
\begin{verbatim}
      SUBROUTINE MYINIT
*
+SEQ,CCVERN.
+SEQ,GCFLAG.
*
      PARAMETER LUN17=17
      CHARACTER*11 NAME
*
* Set up output files:
      IENER = IFIX(1000.*PKINE(2))
      IF (IENER.LT.10) THEN
         WRITE (NAME,801) IENER
      ELSEIF (IENER.LT.100) THEN
         WRITE (NAME,802) IENER
      ELSEIF (IENER.LT.1000) THEN
         WRITE (NAME,803) IENER
      ELSEIF (IENER.LT.10000) THEN
         WRITE (NAME,804) IENER
      ELSE
         STOP ' ERROR: UNEXPECTEDLY HIGH GAMMA ENERGY'
      ENDIF
*
      OPEN (UNIT=LUN17, FILE=NAME, FORM='FORMATTED', STATUS='UNKNOWN')
      REWIND (LUN17)
      CALL HOUTPU(LUN17)
      CALL HERMES(LUN17)
*
* Book histograms:
      DNLIM = 0.10*1000.*PKINE(3)
      UPLIM = 1.10*1000.*PKINE(3)
      CALL HBOOK1(1,'SUM BC HIT ENERGY, ALL$', 100,DNLIM,UPLIM,0.)
      CALL HBOOK1(2,'SUM BC HIT ENERGY, HITS > 5 MEV$',
     &            100,DNLIM,UPLIM,0.)
      CALL HBOOK2(21,'TOTAL BC ENERGY VS INITIAL THETA$',
     &            60,0.,180.,50,DNLIM,UPLIM,0.)
      RETURN
 801  FORMAT ('gam000',I1,'.out')
 802  FORMAT ('gam00', I2,'.out')
 803  FORMAT ('gam0',  I3,'.out')
 804  FORMAT ('gam',   I4,'.out')
      END
\end{verbatim}
\end{minipage}

\begin{minipage}[ht]{\textwidth}
\begin{verbatim}
      SUBROUTINE MYEVNT
+SEQ,GCFLAG.
+SEQ,GCKINE.
+SEQ,MCENER.
      REAL EXTAL(1560)
*
* Clear xtal energy deposits:
      DO 5 I=1,1560
         EXTAL(I) = 0.
 5    CONTINUE
*
* Loop over all tracks and hits:
      ITRACK = 0
 10   CONTINUE
      ITRACK = ITRACK + 1
      IF (ITRACK.GT.50) GOTO 950
      NHITS = ITRKMC(ITRACK,0)
      IF (NHITS.LT.0 .OR. NHITS.GT.100) GOTO 950
*
      DO 15 IHIT=1,NHITS
         EHIT = ENTKMC(ITRACK,IHIT)
         NCOMP = ITRKMC(ITRACK,IHIT)
         IF (NCOMP.LT.1 .OR. NCOMP.GT.1560) GOTO 950
         EXTAL(NCOMP) = EXTAL(NCOMP) + EHIT
 15   CONTINUE
      GOTO 10
*
      EDEP = 0.
      EDEP5M = 0.
      DO 25 I=1,1560
         EDEP = EDEP + EXTAL(I)
         IF (EXTAL(I).GT.5.) EDEP5M=EDEP5M+EXTAL(I)
 25   CONTINUE
*
* Fill histograms:
      IF (EDEP.GT.0.)   CALL HF1(1,EDEP,  1.)
      IF (EDEP5M.GT.0.) CALL HF1(2,EDEP5M,1.)
      RETURN
*
 950  CONTINUE
      CALL ERRMSG(0,'MYEVNT: ILLEGAL PARAMETERS; REJECT EVENT')
      RETURN
      END
\end{verbatim}
\end{minipage}

\begin{minipage}[h]{\textwidth}
\begin{verbatim}
      SUBROUTINE MYLAST
+SEQ,GCKINE.
+SEQ,QUEST.
*
* Create and print histograms:
      CALL HISTDO
*
      RETURN
      END
\end{verbatim}
\end{minipage}

\subsection{Output}

By default, data is recorded in exchange tape format.  Even when one
is writing to disk, one should normally use this format, since it
allows one to later transfer the data to tape and to transport it to
another machine.  Disk format uses extremely short blocks and is not
efficient to use on tapes.  Native format prevents the transport of
the data to other machine types.

\subsubsection{Data Banks}

The data banks produced are selected with the {\tt RAWD} data card and
are usually {\tt EVHD}, {\tt RPWC}, {\tt RJDC}, {\tt RBCL}, {\tt RBCF}
and {\tt RMCB}.  The meanings of the first five are as usual (event
header, PWC, JDC, 2282 and FERA).  One should usually record all of
these banks.  {\tt RMCB} must always be selected to pass certain
parameters to the analysis code; these informational banks are
discussed in the next section.

\subsubsection{Informational Banks}

\cbg{} can produce several informational banks which make the running
conditions of the Monte Carlo an integral part of the output data.
These allow suitable settings to be chosen by the data analysis
programs, including chamber rotations, suitable drift tables, whether
or not to add further detector noise, etc.  The format of the
top-level informational bank {\tt MCIN} is described in Table
\ref{tablemcin}.  Several other banks are linked to {\tt MCIN} in the
order listed:
\begin{tabbing}
{\tt GEOM} \hspace{0.2cm} \= \kill
{\tt PHYS}\>\cbg{} physics options and cuts: see Table \ref{tablephys}\\*
{\tt KINE}\>Kinematic parameters (usually from the {\tt KINE} data card):
            see Table \ref{tablekine}\\*
{\tt VERT}\>Annihilation vertex distribution: see Table \ref{tablevert}\\*
{\tt GEOM}\>Geometry and digitization parameters: see Table \ref{tablegeom}\\*
{\tt SWIT}\>Switches (usually from the {\tt SWIT} data card):
            see Table \ref{tablegeom}\\*
{\tt DIST}\>Applied experimental distortions:
            see Table \ref{tabledist}\\
\end{tabbing}

\begin{table}[htb]
\centering
\begin{tabular}{|r|l|l|}
\hline
{\it Offset} & {\sc type} & {\it Quantity}\\
\hline
 +1 & {\sc hollerith} & Machine type for which code was extracted \\
 +2 & {\sc integer}   & Random seed \#1 \\
 +3 & {\sc integer}   & Random seed \#2 \\
 +4 & {\sc real}      & \cbg{} version number \\
 +5 & {\sc integer}   & \cbg{} update number \\
 +6 & {\sc hollerith} & JDC patch used: 4HFJDC ({\tt FASTJDC}) or
                        4HPJDC (physical)\\
 +7 & {\sc real}      & \gea{} version number\\
\hline
\end{tabular}
\caption{Data stored in the {\tt MCIN} bank}
\label{tablemcin}
\end{table}

\begin{table}[htb]
\centering
\begin{tabular}{|r|l|l|}
\hline
{\it Offset} & {\sc type} & {\it Quantity}\\
\hline
  +1 & {\sc integer} & {\tt IANNI} \\
  +2 & {\sc integer} & {\tt IBREM} \\
  +3 & {\sc integer} & {\tt ICOMP} \\
  +4 & {\sc integer} & {\tt IDRAY} \\
  +5 & {\sc integer} & {\tt IDCAY} \\
  +6 & {\sc integer} & {\tt IHADR} \\
  +7 & {\sc integer} & {\tt ILOSS} \\
  +8 & {\sc integer} & {\tt IMULS} \\
  +9 & {\sc integer} & {\tt IMUNU} \\
 +10 & {\sc integer} & {\tt IPAIR} \\
 +11 & {\sc integer} & {\tt IPFIS} \\
 +12 & {\sc integer} & {\tt IPHOT} \\
 +13 & {\sc integer} & {\tt IRAYL} \\
 +14 & {\sc real}    & {\tt CUTGAM} \\
 +15 & {\sc real}    & {\tt CUTELE} \\
 +16 & {\sc real}    & {\tt CUTNEU} \\
 +17 & {\sc real}    & {\tt CUTHAD} \\
 +18 & {\sc real}    & {\tt CUTMUO} \\
 +19 & {\sc real}    & {\tt BCUTE} \\
 +20 & {\sc real}    & {\tt BCUTM} \\
 +21 & {\sc real}    & {\tt DCUTE} \\
 +22 & {\sc real}    & {\tt DCUTM} \\
 +23 & {\sc real}    & {\tt PPCUTM} \\
 +24 & {\sc real}    & {\tt TOFMAX} \\
 +25 & {\sc real}    & {\tt GCUTS(1)} \\
 +26 & {\sc real}    & {\tt GCUTS(2)} \\
 +27 & {\sc real}    & {\tt GCUTS(3)} \\
 +28 & {\sc real}    & {\tt GCUTS(4)} \\
 +29 & {\sc real}    & {\tt GCUTS(5)} \\
 +30 & {\sc real}    & Tracking limit on $\sqrt{x^2+y^2}$\\
 +31 & {\sc integer} & 1: Fixed energy cuts \\
     &               & 0: Variable energy cuts \\
 +32 & {\sc integer}        & Number of particle types to reject \\
 +33 -- +42 & {\sc integer} & List of particle types to reject \\
 +43 & {\sc integer} & Number of vertex X rays \\
\hline
\end{tabular}
\caption{Data stored in the {\tt PHYS} bank}
\label{tablephys}
\end{table}

\begin{table}[htb]
\centering
\begin{tabular}{|r|l|l|}
\hline
{\it Offset} & {\sc type} & {\it Quantity}\\
\hline
 +1  & {\sc integer} & {\tt IKINE} (Event generator used) \\
 +2  & {\sc real}    & {\tt PKINE( 1)} \\
 +3  & {\sc real}    & {\tt PKINE( 2)} \\
 +4  & {\sc real}    & {\tt PKINE( 3)} \\
 +5  & {\sc real}    & {\tt PKINE( 4)} \\
 +6  & {\sc real}    & {\tt PKINE( 5)} \\
 +7  & {\sc real}    & {\tt PKINE( 6)} \\
 +8  & {\sc real}    & {\tt PKINE( 7)} \\
 +9  & {\sc real}    & {\tt PKINE( 8)} \\
 +10 & {\sc real}    & {\tt PKINE( 9)} \\
 +11 & {\sc real}    & {\tt PKINE(10)} \\
\hline
\end{tabular}
\caption{Data stored in the {\tt KINE} bank}
\label{tablekine}
\end{table}

\begin{table}[htb]
\centering
\begin{tabular}{|r|l|l|}
\hline
{\it Offset} & {\sc type} & {\it Quantity}\\
\hline
 +1 & {\sc integer} & Vertex distribution type \\
 +2 & {\sc real}    & $\overline{x}$ of uncut vertex dist. \\
 +3 & {\sc real}    & $\overline{y}$ of uncut vertex dist.\\
 +4 & {\sc real}    & $\overline{z}$ of uncut vertex dist.\\
 +5 & {\sc real}    & $\sigma_x$ of vertex dist. \\
 +6 & {\sc real}    & $\sigma_y$ of vertex dist.\\
 +7 & {\sc real}    & $\sigma_z$ of vertex dist.\\
 +8 & {\sc real}    & Upper limit on $\sqrt{x^2+y^2}$ of vertices\\
 +9 & {\sc real}    & Lower limit on $z$ of vertices\\
+10 & {\sc real}    & Upper limit on $z$ of vertices\\
\hline
\end{tabular}
\caption{Data stored in the {\tt VERT} bank}
\label{tablevert}
\end{table}

\begin{table}[htb]
\centering
\begin{tabular}{|r|l|l|}
\hline
{\it Offset} & {\sc type} & {\it Quantity}\\
\hline
 +1   & {\sc real}    & Magnetic field at origin (kilogauss) \\
 +2   & {\sc integer} & \gea{} tracking method in PWC/JDC region \\
 +3   & {\sc integer} & Bit mask of {\tt GEOM}, {\tt PREC}, {\tt SETS}
                        and {\tt DIGI} data \\
 +4   & {\sc integer} & Liquid target: 1 for 1989--1990, 2 for 1991-- \\
 +5   & {\sc integer} & 1=LH$_2$, 2=LD$_2$ as liquid target filling \\
 +6   & {\sc real}    & $Z$ offset of target position \\
 +7   & {\sc real}    & $Z$ position of downstream veto counter \\
 +8   & {\sc real}    & Energy cut on veto counter \\
 +9   & {\sc integer} & Design number of PWC \#1 \\
 +10  & {\sc integer} & Design number of PWC \#2 \\
 +11  & {\sc real}    & Rotation angle of PWC \#1 (\cbg{}) \\
 +12  & {\sc real}    & Rotation angle of PWC \#2 (\cbg{}) \\
 +13  & {\sc integer} & Design number of GHT \\
 +14  & {\sc real}    & Rotation angle of GHT \\
 +15  & {\sc integer} & Design number of JDC \\
 +16  & {\sc real}    & Rotation angle of JDC (\cbg{}) \\
 +17  & {\sc real}    & Lorentz angle used for JDC \\
 +18  & {\sc real}    & B-field for JDC gas file (kilogauss) \\
 +19  & {\sc real}    & Pressure for JDC gas file (Torr) \\
 +20  & {\sc integer} & JDC gas file:
       10000 $\times$ (\% CO$_2$) + 10 $\times$ (\% C$_4$H$_{10}$) \\
 +21  & {\sc integer} & Date electrostatic solution first used (DDMMYY) \\
 +22  & {\sc integer} & Version number of JDC gas file \\
 +23  & {\sc integer} & BC copper cooling collars: 1 if used, 0 otherwise \\
 +24  & {\sc integer} & Bit mask encoding the {\tt RAWD} banks stored \\
\hline
\end{tabular}
\caption{Data stored in the {\tt GEOM} bank}
\label{tablegeom}
\end{table}

\begin{table}[htb]
\centering
\begin{tabular}{|r|l|l|}
\hline
{\it Offset} & {\sc type} & {\it Quantity}\\
\hline
 +1   & {\sc integer} & Switch 1 \\
 +2   & {\sc integer} & Switch 2 \\
 +3   & {\sc integer} & Switch 3 \\
 +4   & {\sc integer} & Switch 4 \\
 +5   & {\sc integer} & Switch 5 \\
 +6   & {\sc integer} & Switch 6 \\
 +7   & {\sc integer} & Switch 7 \\
 +8   & {\sc integer} & Switch 8 \\
 +9   & {\sc integer} & Switch 9 \\
+10   & {\sc integer} & Switch 10 \\
\hline
\end{tabular}
\caption{Data stored in the {\tt SWIT} bank}
\label{tableswit}
\end{table}

\begin{table}[htb]
\centering
\begin{tabular}{|r|l|l|}
\hline
{\it Offset} & {\sc type} & {\it Quantity}\\
\hline
 +1  & {\sc real}    & PWC1: Efficiency \\
 +2  & {\sc real}    & PWC1: Probability hit gives adjacent hit\\
 +3  & {\sc real}    & PWC1: Probability allowed noise hit occurs \\
 +4  & {\sc integer} & PWC1: Allowed number of noise hits \\
 +5  & {\sc real}    & PWC2: Efficiency \\
 +6  & {\sc real}    & PWC2: Probability hit gives adjacent hit\\
 +7  & {\sc real}    & PWC2: Probability allowed noise hit occurs \\
 +8  & {\sc integer} & PWC2: Allowed number of noise hits \\
 +9  & {\sc integer} & Variation in crystal calib. constants: \\
     &               & -1: table; 0: none; +1: Gaussian \\
 +10 & {\sc integer} & FERA noise (coherent): \\
     &               & -1: table; 0: none; +1: Gaussian \\
 +11 & {\sc integer} & FERA noise (incoherent): \\
     &               & -1: table; 0: none; +1: Gaussian \\
 +12 & {\sc integer} & 2282 noise (coherent): \\
     &               & -1: table; 0: none; +1: Gaussian \\
 +13 & {\sc integer} & 2282 noise (incoherent): \\
     &               & -1: table; 0: none; +1: Gaussian \\
 +14 & {\sc real}    & 1$\sigma$ variation in crystal calibration\\
 +15 & {\sc real}    & 1$\sigma$ coherent FERA noise\\
 +16 & {\sc real}    & 1$\sigma$ incoherent FERA noise\\
 +17 & {\sc real}    & 1$\sigma$ coherent 2282 noise\\
 +18 & {\sc real}    & 1$\sigma$ incoherent 2282 noise\\
 +19 & {\sc real}    & JDC signal random variation\\
 +20 & {\sc real}    & JDC signal noise\\
 +21 & {\sc real}    & JDC signal spreading in X (cm)\\
 +22 & {\sc real}    & JDC signal spreading in Y (cm)\\
 +23 & {\sc real}    & JDC resolution in Z (cm)\\
 +24 & {\sc real}    & Limit on JDC $Z$ resolution tails (cm)\\
 +25 & {\sc integer} & JDC signal threshold\\
 +26 & {\sc real}    & Normalization of JDC signal height\\
 +27 & {\sc real}    & Width of avalanche distribution\\
 +28 & {\sc real}    & Probability of double JDC pulses\\
 +29 & {\sc real}    & Probability of triple JDC pulses\\
 +30 & {\sc real}    & JDC signal wire electrical half length\\
\hline
\end{tabular}
\caption{Data stored in the {\tt DIST} bank}
\label{tabledist}
\end{table}

\subsection{Interactive Mode}

{\samepage
The interactive mode of \gea{} is quite useful; it is documented in
the {\tt XINT} section of the \gea{} manual.  For event simulation (as
opposed to detector development) the most commonly used commands
include:
\begin{tabbing}
{\bf DUVIEW} {\it NAME TYPE CPXTYP} \hspace{0.3cm} \= \kill
{\bf HELP}                     \> Help menus\\*
{\bf TRIGGER} {\it N}          \> Start {\it N} events\\*
{\bf SWITCH} {\it ISWITCH IVAL}\> Change switch {\it ISWITCH} to {\it IVAL}\\*
{\bf DEBUG} {\it IDEB}         \> 'ON ': enable debugging;\\*
                               \> 'OFF': disable debugging\\*
{\bf DUVIEW} {\it NAME TYPE CPXTYP} \> Plot a predefined detector view\\*
{\bf DXYZ}                     \> Plot tracks ({fill \tt JXYZ} by setting
                                  switch 10)\\*
{\bf NEXT}                     \> Clear graphics display \\*
{\bf EXIT}                     \> Leave \gea{} \\
\end{tabbing}

}

The only command needing explanation is {\tt DUVIEW} since its
arguments are defined in \cbg{}, rather than \gea{}.  A number of
views are pre-defined, with the detector being shown cut on a plane at
or near the center.  (The cut plane is sometimes offset when elements
such as crystals would otherwise not be seen.)  Because tracks are
projected onto the display plane, one must sometimes examine all three
views to see what has really happened.  The defined options are:

{\samepage
\begin{tabbing}
{\tt DUVIEW} \hspace{0.3cm} \=
{\tt BC} Calorimeter \hspace{0.3cm} \=
View \hspace{0.3cm} \= \kill
             \> Detector               \> View       \> Complexity  \\*
             \>                        \>            \>             \\*
{\tt DUVIEW} \> {\tt PW} (PWC)         \> {\tt TOP}  \> {\tt FULL}
                                                        (Detailed)  \\*
             \> {\tt GH} (GHT)         \> {\tt SIDE} \> {\tt FAST}
                                                        (Simplified)\\*
             \> {\tt JD} (JDC)         \> {\tt FRON} \>             \\*
             \> {\tt BC} (Calorimeter) \>            \>             \\*
             \> {\tt CB} (Overall)     \>            \>             \\
\end{tabbing}

}

\clearpage

\section{Shortcomings}

\subsection{\gea{}}

An incomplete list of notes on physics in \gea{}:
\begin{itemize}
\item{
According to the \gea{} manual (section {\tt CON110}), radiation
lengths are calculated with the {\sc egs3} algorithm - {\em not} the
Tsai algorithm used in {\sc egs4}.  Thus, it is not particularly
accurate.}
\item{
Bremsstrahlung in the field of electrons is treated as a scaling
factor to the nuclear bremsstrahlung, even though the differential
cross section has a different shape in reality.  Further (as in {\sc
egs4}), only the average angle is assigned to the emitted $\gamma$'s
(tending to overly restrict the angular development of showers).}
\item{
Like other Monte Carlos, radiative corrections to various other
processes are usually ignored.  The error can be several per cent.
An example would be 3$\gamma$ annihilation in high $Z$ materials.}
\item{
There is no calculation of the transverse displacement of particles
during a step due to multiple scattering.}
\item{
There is little detailed treatment of atomic shell effects, or of
other effects below energies of several KeV.  This complicates the
making of detailed simulations of thin, sensitive regions such as
drift chamber cells.}
\end{itemize}

\subsection{\cbg{}}

\subsubsection{Event Initialization}

\begin{itemize}
\item{
The branching ratios in the {\sc bigbang} event generator could be
improved further, and additional channels defined, especially for
strange particles.}
\item{
Additional particles should be defined, including the $K^\ast$ group.}
\item{
Event triggers have not been implemented.}
\item{
There is no provision for user access to the data in an event until it
has completed.  In certain specialized cases, it may be that the user
will want access to information earier, so as to allow early rejection
of the event.  The obvious place for such access is in {\sc gustep}.
However, such a change should take into account that this routine is
called very frequently, and that the overhead needed to make a subroutine
call to even a dummy routine could be noticable.}
\end{itemize}

\subsubsection{Target Area}

\begin{itemize}
\item{
Although geometry is defined for a high pressure target, it is more or
less arbitrary, since no detailed design exists.  The default pressure
is also arbitrary.  A real design should be coded if someone intends
to actually use it.}
\item{
The silicon beam counters have not been included.}
\item{
While the so-called ``$\pi$'' veto counter has been included, is has
not yet been set up to either reject the event or to record the energy
deposition in a data bank.}
\end{itemize}

\subsubsection{PWC/GHT}

\begin{itemize}
\item{
Digitization for the GHT has not yet been implemented.}
\item{
Details such as beam windows are missing from the GHT description.}
\item{
The efficiency applied in the PWC digitization does not consider the
probable correlation with $dE/dx$ and other factors.}
\end{itemize}

\subsubsection{JDC}

\begin{itemize}
\item{
Some effects, such as amplifier input impedance, due to the JDC
electronics are not handled.}
\item{
There is no provision for resolution degradation due to systematic
effects such as wire positioning inaccuracy or dead wires.  The effect
of this is somewhat different than that due to random factors.}
\item{
The $Z$ resolution is fixed at 0.75 cm and does not reflect the
variation with pulseheight and position that one would expect to be
present.}
\item{
The {\tt FASTJDC} algorithm uses a straightline to connect the
entrance and exit points of a particle in a drift cell.  This
approximation begins to break down for low-momentum particles.}
\end{itemize}

\subsubsection{Barrel Calorimeter}

\begin{itemize}
\item{
The amount of light detected by the photodiode for a given energy
deposition in the wavelength shifter, compared to a crystal, is not
known accurately.  A measurement has yet to be made.}
\item{
No correction is made for variation in the light collection with
position within a crystal.  This correction is difficult, because it
varies significantly from one crystal to the next and because the
existing measurements used photomultiplier tubes, rather than
photodiodes, and these do not give compatible results.}
\item{
No pedestal-suppressed mode is yet supported.}
\item{
Treatment of certain variables related to inorganic scintillators
({\tt GHCOR*}) is somewhat uncertain.  An adequate answer from
F.Carminati has not been forthcoming.}
\end{itemize}

\subsubsection{Miscellaneous}

\begin{itemize}
\item{
\cbg{} has not yet been split so as to separate the simulation of
the physics from the simulation of detector imperfections (with
intermediate files being produced to connect the two parts).}
\item{
There is no formal support in the code for the IBM RISC/6000 or NeXT
processors, which are likely to be used by members of the
collaboration and are now formally supported by CERN.  The CDC
4600-series workstation is supported only in so far as it is
compatible with the {\sc decs}tation.}
\item{
The Fortran code is still not strictly ANSI-77 compliant, despite
improvements in that direction.}
\item{
There have not yet been detailed comparisons of Monte Carlo results
with experiment.  It is certain that various parameters will need to
be tuned, and likely that some algorithms will need to be improved.}
\item{
The magnetic field inhomogeneity implemented in the {\sc gufld}
subroutine is probably not accurate; more information is needed.}
\end{itemize}

\clearpage

\section{Analysis of \cbg{} Output}

For the next stage of the analysis (e.g., {\sc cbdisp}), {\sc locater}
has to know how to allign the JDC and PWC with the crystals.  To
analyze data from the default Monte Carlo, the JDC sector 1 sense
plane must be placed 0.79$^\circ$ past the +$Y$ axis (90.79$^\circ$
past the +$X$ axis) and the PWC1 and PWC2 wires zero must be placed on
the +$Y$ axis ($\pi$/2 radians from the +$X$ axis).  The angle
conventions are different between \gea{} and {\sc locater}; \gea{}
angles refer to the edge of a JDC sector and the plane halfway between
PWC wires, while {\sc locater} alignments are to the sense plane or
wire.

For \cbg{} 4.03--4.05, the allignment was done with data cards, but it
is now done automatically by passing the angles in the {\tt GEOM}
bank, which are then used automatically by {\sc locater}---provided
one has a version more recent than 10-FEB-1992.  In the event that you
have an older version of cbg{} or {\sc locater}, or if you failed to
select the {\tt RAWD} data card option {\tt RMCB}, the data cards to
use at analysis time are:
\begin{verbatim}
ANGL 90.79 1.0
OPWC 1.570796 1.570796
\end{verbatim}
Similarly, an obsolete version of {\sc locater} may need a JDC gain
table for the Monte Carlo.  This should show all wire half lengths to
be {\mbox 23.68 cm}, not {20.00 cm} or something else.  Because of the
change in default wire length, a different table would be needed than
the one used for \cbg{} 4.05 and earlier.  If you are uncertain about
which one you have, copy {\tt JDC\_GAIN\_MC406.TBL} from {\tt
VSXTAL::[CB.GEORGE]JDC\_GAIN\_MC406.TBL}.

\end{document}
