\documentstyle[twoside]{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{\jdc}{{\sc jdc}}
\newcommand{\pwc}{{\sc pwc}}
\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}}
\setlength{\unitlength}{1pt}
\textwidth=433pt
\topmargin=-21.57pt
\oddsidemargin=7.53pt
\evensidemargin=7.53pt
\footheight=36pt
\textheight=650pt
\renewcommand{\baselinestretch}{1.1}
\begin{document}
\British
\pagestyle{empty}
\begin{titlepage}
\title{ \makebox[\textwidth][r]{\normalsize CB--Note 93/Revised}\\[2cm]
LEAR Crystal Barrel Experiment, PS197 \\
Chamber Reconstruction Software \\
Locater Version 2.00}
\author{Curtis A. Meyer \\ Carnegie Mellon University}
\date{20 July, 1994}
\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}
\pagestyle{plain}
\setcounter{page}{1}
\pagenumbering{roman}
\tableofcontents
\listoftables
\listoffigures
\clearpage
\section*{Updates to the Code}
\subsection*{Version 1.30 to 1.44}
\begin{itemize}
\item The {\sc /rjprms/} common block has changed to allow different time
offsets in each FADC crate. The variables {\sc itffrj} and {\sc itfgrj}
have been replaced with {\sc itfcrj(16)}.
\item Variables which are no longer used have been dropped from the
{\sc /rjdata/} common block.
\item The cards {\bf ITFF} and {\bf ITFG} have been removed. They have
been replaced by the {\bf ITFC} data card. To use this card, it is
necessary to have 17=1 as part of the input.
\item The {\bf RJDC} bank has been modified to include a self describing
header. Also, the units in which time is stored have been changed from
1ns per channel to 200ps per channel.
\item The RJTFIT routine has been removed. It is now included inline in
the RJPULS subroutine.
\item The TJZPOS and TJTIME routines have been merged into one subroutine,
TJTIME. Since they were always called in pairs, this should cut down on
overhead.
\item The time fitting algorithem for raw pulses has been changed from
a {\em bin of maximum difference} to a {\em first electron} method.
\item The double pulse separation algorithem in TJDCGT has been modified
to allow separation down to much smaller levels when the pulses are well
separated in charge division.
\item The {\em User service routine} TCRHIT has an additional call
argument. It now returns the address of each hit in the {\bf TCHT}
bank in addition to the previous information.
\item The addition of two new {\em User service routines}, TCHLDD and
TCHLDS. These will return the three momentum and covariance matrix of
a track in the {\bf TCTR} data bank in either double or single precision.
\item The addition of a calibration routine for performing a kinematic
fit to the constraints of three--momentum balance, CJKFIT. The input
is of the form generated by the TCHLDS subroutine.
\item The value $\sigma_{dE/dx}$ in the {\bf TJDC} bank has been replaced
with a term $\sigma_{\phi}$ near the edge of the cell.
\item The value $\sigma_{dE/dx}$ in the {\bf TCHT} bank has been replaced
with a term $\sigma_{\phi}$ near the edge of the cell.
\item The subroutine TCVERS now will return the version number, and
optionally print out the version information. This code is now section
on {\em User Service Routines}.
\item Inclusion of a new calibration data bank, {\bf TJT0}. This contains
time offsets for every wire in the \jdc{}.
\item The polynomials parameterizing the drift--time distance relation
ship are now Hermite instead of Taylor polynomials. This allowed me to
decrease the order by one and retain the same accuracy. It also makes
the covraiance matrix more diagonal.
\item The code has been put in the {\sc cmz} code manager for ease
of updating. All {\sc patchy} commands still work.
\item Expanded the number of PATCHes in the code to facilitate
updates.
\item Modified version of the helix fit routines to remove a singularity
at $90^{\circ}$.
\item Included Laguerre Polynomials in the allowed types for the drift
time to distance relationship. These are better than the Hermite.
\item Included Slow Control monitoring code. This is both in the
calibration phase, and the auto--updating of calibration constants
based on changing conditions in the chamber.
\item Included the subroutine BCLDD to load crystal data for the
TCKFT4 and TCKFT3 routines.
\item Modified the form of the {\bf TCVP} data bank to accommodate a
three by three covariance matrix for the vertex momenta.
\end{itemize}
\subsection*{version 1.44 to Version 1.45}
\subsection*{Version 1.45 to Version 1.46}
\begin{itemize}
\item The slow control information is now used to correct the $r$--$\phi$
look--up table.
\item The {\bf TCHT} data bank has been changed. It now has three additional
words of information.
\end{itemize}
\subsection*{Version 1.46 to Version 1.50}
\begin{itemize}
\item A new filtering scheme for outlyers has been implemented into the
software. This causes about 20 percent of the data to be thrown away.
\item New $r$--$\phi$ calibrations tables have been created based on
input from Garfield.
\item The handling of online data processing has been implemented, and
steering cards {\sc rjdd} and {\sc rjdf} have been added to control
this.
\item Error logging is now handled by the {\sc errlog} subroutine. The
slow control software will no longer produce hundreds of pages of useless
output.
\item \pwc{} software has been implemented, and \pwc{} hits are now
included in the helix and vertex fits. Note that the inclusion of
the \pwc{} hits does not happen until after all circle fits are
done. This means that they have no effect on the pattern recognition.
\item The code has been modified to recognize and handle \jdc{} data
which has been processed online. There have also been cards introduced
to allow the user to steer between the various types of raw data.
\item The patches in the locater {\sc cmz} file have been reorganized.
It is necessary to pick up a fresh card file at this release.
\end{itemize}
\clearpage
\pagestyle{myheadings}
\markboth{Chamber Reconstruction Software}{Chamber Reconstruction Software}
\setcounter{page}{1}
\setcounter{section}{0}
\pagenumbering{arabic}
\section{Generation of Code}
\subsection{Building the LOCATER code}
The Locater code is distributed as a PAM file, LOCATER.PAM, and a
default cradle file, LOCATER.CRA. In order to generate the most
basic version of the code, one need only issue the command:
\begin{verbatim}
YPATCHY LOCATER.PAM LOCATER LOCATER.CRA .GO
\end{verbatim}
However, other options have been installed in the PAM file which allow
the user to:
\begin{itemize}
\item Install the chamber calibration software.
\item Install debug print print lines, at many different levels.
\item Select only {\em standard} Fortran--77.
\end{itemize}
In the most basic of installations, the user needs to have LOCATER.PAM,
CBOFF.PAM, (the main code), and the following lines in LOCATER.CRA.
\begin{verbatim}
+USE,machine flag.
+USE,COMMCB,TCCOMMON.
+USE,TC_MAIN,TC_GAIN,TC_RAWS,TC_PATT,TC_CIRC.
+USE,TC_HELX,TC_VERT,TC_SERVC,TC_UTIL.
+EXE.
+PAM,12,T=ATTACH. LOCATER.PAM
+PAM,11,R=COMMCB,T=ATTACH. CBOFF.PAM
+QUIT.
\end{verbatim}
Machine flags supported by {\sc locater} are as follows.
\begin{itemize}
\item{ALT} Alliant FX/8 for the Alliant fortran compiler.
\item{DECS} For DecStations, using f77 fortran compiler.
\item{IBM} For IBM-CMS and IBM-MVS computers.
\item{NXT} For NeXT stations using the f77 fortran compiler.
\item{SUN} For the SUN Work stations, f77 fortran compiler.
\item{UNIX} Generic unix flag.
\item{VAX} For VAX/VMS computers.
\end{itemize}
For installation of the calibration code in its most basic form, the
cradle should be.
\begin{verbatim}
+USE,machine flag.
+USE,COMMCB,TCCOMMON.
+USE,TC_MAIN,TC_GAIN,TC_RAWS,TC_PATT,TC_CIRC.
+USE,TC_HELX,TC_VERT,TC_SERVC,TC_UTIL.
+USE,TC_CALIBRATE.
+EXE.
+PAM,12,T=ATTACH. LOCATER.PAM
+PAM,11,R=COMMCB,T=ATTACH. CBOFF.PAM
+QUIT.
\end{verbatim}
To install debug lines, the following patches and flags are used.
\begin{itemize}
\item {\bf TCDEBUG} is the patch containing all debug print statements.
It also installs a minimum amount of event logging to let the user
know which sections of the code were called for each event.
\item {\bf TCPRINT} installs statements which cause the results of
each level of the code to be printed out. All of these statements
are installed in the TCTRAK and CJCALB routines.
\item {\bf DEBUGRAW} installs debug print lines in the routines which
process the data in the {\bf RJDF} data bank.
\item {\bf DEBUGPAT} installs debug print lines in the pattern recognition
section of the code.
\item {\bf DEBUGFIT} installs debug print lines in the circle fitting
section of the code.
\item {\bf DEBHELIX} installs debug print lines in the helix fitting
section of the code.
\item {\bf DEBVERTX} installs debug print lines in the vertex fitting
section of the code.
\item {\bf DEBUGCAL} installs debug print lines in the calibration
code.
\item {\bf DDDDEBUG} installs print lines that produce a lot of mostly
useless output.
\item {\bf DEBFALSE} causes the default value of {\sc debgtc}, the
parameter which turns on and off printing to default to {\sc .false.}.
\end{itemize}
As an example, the following would create code which included calibration,
and debug print lines in the pattern recognition and circle fitting sections,
and a general event monitor.
\begin{verbatim}
+USE,machine flag.
+USE,COMMCB,TCCOMMON.
+USE,TC_DEBUG.
+USE,TCPRINT,DEBUGPAT,DEBUGFIT.
+USE,TC_CALIBRATE.
+USE,TC_MAIN,TC_GAIN,TC_RAWS,TC_PATT,TC_CIRC.
+USE,TC_HELX,TC_VERT,TC_SERVC,TC_UTIL.
+EXE.
+PAM,12,T=ATTACH. LOCATER.PAM
+PAM,11,R=COMMCB,T=ATTACH. CBOFF.PAM
+QUIT.
\end{verbatim}
The user will find that several pilot cradles have been installed in the
LOCATER code itself. The following is a list of what is available.
\begin{itemize}
\item {\bf *LOCATE} Installs the basic code with no calibration and no
debug print lines.
\item {\bf *DEBUG} installs the basic code with all debug options on.
\item {\bf *CALIB} installs the calibration code with no debug lines.
\item {\bf *DEBUGC} installs the calibration code with all debug
options on.
\end{itemize}
Finally, because of both help in debugging the code, and readability of output,
the LOCATER code is not written in absolutely standard Fortran--77. Such
extensions as IMPLICIT NONE and print statements containing lower case
characters have been used throughout the code. However, it is possible to
remove these in the normal, (no calibration, no debug print lines) version
of the code by inclusion of the {\sc patchy} flag, {\bf +USE,F77.}
However, unless the user's computer forbids these extensions, it is recommended
that the above flag {\em not} be used.
Since version 1.42, {\sc locater} has only been supported within the {\sc cmz}
program, (Code Manager under Zebra). The released Locater card file can
be taken into {\sc cmz} using the following commands.
\begin{verbatim}
cmz
cmz[0] make locater
locater[1] ytoc locater.car
locater[2] exit
\end{verbatim}
The same pilots used for {\sc patchy} are also used for {\sc cmz}. To
generate the standard program, (source code only), do the following:
\begin{verbatim}
cmz
CMZ[0] file locater -R
locater[1] set locater.for -F
locater[2] pilot *LOCATE
locater[3] sel machine_flag, (i.e. ALT,DECS,IBM,SUN or VAX)
locater[4] set calibration_set (i.e. dec_89_1, jun_90_1, jul_90_1)
locater[5] seq commcb
locater[6] ctof -P
locater[7] exit
\end{verbatim}
\subsection{The USER code}
As discussed in the {\bf Offline Reconstruction Software} Manual,
the user is able to provide several specific routines to the entire
software framework. These routines are usually provided in the
framework of a {\sc patchy} cradle file, {\sc user.cra}. In order to
have access to all the common blocks used routinely throughout the
rest of the software, the following {\sc patchy} commands can be used
in the beginning of the uses's cradle.
\begin{verbatim}
+USE,machine flag.
+USE,COMMCB.
+USE,TCCOMMON.
+USE,P=CBPHYS,D=CBMAIN.
+USE,USERCODE.
+EXE.
+PAM,11,R=COMMCB,CBPHYS,T=ATTACH. CBOFF.PAM
+PAM,12,R=TCCOMMON,T=ATTACH. LOCATER.PAM
+PATCH,USERCODE.
+DECK, ...
+QUIT.
\end{verbatim}
This of course assumes that the user already has the {\sc pam} files
for {\sc cboff} and {\sc locater}. In the next sections are described
several {\em standardizations} which are used throughout the offline
software, and can/should also be used throughout the user's own code.
\subsection{The value of $\pi$}
The value of $\pi$, $\pi/2$ and $2\pi$ in both single and double precision
forms are obtained with the {\sc patchy} statement {\sc +cde,pi2pi}. This
call will include the following piece of code.
\begin{verbatim}
*
REAL PI,PI2,PIHLF
PARAMETER (PI = 3.141592653589793)
PARAMETER (PI2 = 6.283185397179866)
PARAMETER (PIHLF = 1.570796326794896)
*
DOUBLE PRECISION DPI,DPI2,DPIHLF
PARAMETER (DPI = 3.141592653589793D0)
PARAMETER (DPI2 = 6.283185307179866D0)
PARAMETER (DPIHLF = 1.570796326794896D0)
*
\end{verbatim}
\subsection{Access to Track Bank Sizes}
Many of the data banks used to contain tracking information have been
organized in a table format. For each entity in the bank, there are a
fixed number of attributes. As an example, the {\bf TJDC} data bank
contains hits, and for each hit there are 16 attributes. So, if one
wants to have access to the n'th hit in the bank at {\sc ltjdc}, then
one computes {\sc itjdc} as \mbox{{\sc ltjdc} $+16\cdot (n - 1)$}. It is
possible at some future date that it will become necessary to add more
information on each of these hits. In order to simplify that transition,
the length of each block in these data banks has been specified as a
parameter which can be obtained using the {\sc patchy} command
{\sc +CDE,TRKPRM}. This will then include the following information.
It is recommended that the user use these where ever possible to avoid
possible confusions in later versions of the program.
\begin{verbatim}
INTEGER LENTJ,LENHT,LENTK,LENTR,LENHP,LENVX,LENVP,LENPW,LENCL
PARAMETER (LENTJ=16,LENHT=20,LENTK=30,LENTR=32,LENHP=6)
PARAMETER (LENVX=14,LENVP=13,LENPW=10,LENCL=12)
\end{verbatim}
\begin{itemize}
\item {\sc lentj} is the length of the repeating block in the {\bf TJDC} bank.
\item {\sc lenht} is the length of the repeating block in the {\bf TCHT} bank.
\item {\sc lentk} is the number of data words found in a {\bf TCTK} bank.
\item {\sc lentr} is the number of data words found in a {\bf TCTR} bank.
\item {\sc lenhp} is the length of the repeating block in the {\bf TCHX} bank.
\item {\sc lenvx} is the number of data words found in a {\bf TCVT} bank.
\item {\sc lenvp} is the length of the repeating block in the {\bf TCVP} bank.
\item {\sc lenpw} is the length of the repeating block in the {\bf TPWC} bank.
\item {\sc lencl} is the length of the repeating block in the cluster banks.
\end{itemize}
\subsection{Input and Output}
Throughout this code, a standardized set of {\em io} parameters has
been used. These are obtained using the {\sc patchy} command
{\sc +cde,cbunit.}. This then includes a set of integers whose values
are shown in table~\ref{tab:io}.
\begin{table}[htbp]\centering
\begin{tabular}{|c|c|l|}\hline
{\sl Unit} & {\sl Name} & {\sl Description} \\ \hline
\multicolumn{3}{|c|}{ {\sl In the {\sc /cbunit/} common. }} \\ \hline
4 & {\sc llog} & {\sl Log file for the program} \\
4 & {\sc lprnt} & {\sl Alternate log file if needed} \\
6 & {\sc lterm} & {\sl Terminal for interactive jobs} \\
7 & {\sc ldbg} & {\sl Debug print file.} \\
8 & {\sc lerr} & {\sl Error file for the program} \\
9 & {\sc lnorm} & {\sl Short term unit. This unit is used in setup routines}\\
& & {\sl for reading in files. All files using this unit} \\
& & {\sl should be one--pass routines which {\sc open} and} \\
& & {\sl {\sc close} the file before returning .} \\
10& {\sc lhst} & {\sl {\sc hbook} histogram file} \\
10& {\sc lhst} & {\sl This is also used by the {\sc grafiks} routines}\\
& & {\sl for printing of {\em meta} files.} \\
17& & {\sl Unit from which the data base file is read.}\\
20& {\sc ldst} & {\sl Unit for output of processed data} \\
21& {\sc lrdt} & {\sl Unit from which the data is read into the program} \\
30& {\sc ltime} & {\sl Unit to read the fera look--up--table.} \\
31& {\sc ltiml} & {\sl Unit to read the 2282 look--up--table.} \\
70& {\sc ljtout} & {\sl write out large calibration files.}\\
72& {\sc ljgout} & {\sl write out the corrected gain file.}\\
81& {\sc ljcal} & {\sl read in the \jdc{} calibration card file.}\\
82& {\sc ljgain} & {\sl read in the \jdc{} gain file.} \\ \hline
\multicolumn{3}{|c|}{ {\sl In the {\sc /zunit/} common.}} \\ \hline
& {\sc iqread} & \\
& {\sc iqprnt} & \\
& {\sc iqpr2} & \\
& {\sc iqlog} & \\
& {\sc iqpnch} & \\
& {\sc iqttin} & \\
& {\sc iqtype} & \\ \hline
\end{tabular}
\caption[I.O. Units used.]{{\sf A list of all {\em io} units presently
defined. The first two sections of the table are accessed through a
{\sc +cde,cbunit} command, while the third section is obtained through
a {\sc +cde,zunit} command. The third section seems to be an internal
{\sc zebra} common, and is used in the graphics sections of the code.}}
\label{tab:io}
\end{table}
\clearpage
\section{Data Banks for CB Chambers}
\subsection{Description of the Chamber Data Banks}
In this section are described all data banks used in processing
the chamber information from the Crystal Barrel. There are three
types of banks so far: [1] those containing raw or unprocessed
data, [2] those containing the results of pattern recognition
and track reconstruction, and [3] scratch or temporary banks used
through out the analysis. In figure~\ref{fig:banks} is
shown the general structure of master and subbanks used throughout
the chamber reconstruction. Because of the large amount of overhead
required in setting up data banks\footnote{A minimum of 10 data words
per bank are required.}, it is desirable to store many hits in the
chamber in the same data bank. There are two natural divisions in the
{\sc jdc}, by sector, (30) and by layer (23). Both of these divisions
have been utilized in storing chamber hit information. A top level,
or master bank is set up, and then a series of subbanks for either
each sector or each layer containing data. The link area in the master
bank then contains pointers to all the subbanks which are addressed
via their sector or layer number, and the data area of the master
bank contains the number of hits stored in each subbank.
As a convention, all data banks which exist on the raw data tape have
the letter {\em R} as the first letter in their names. For example, the
data banks containing the results of the {\em Qt} analysis in the \jdc{}
are called {\bf RJDC}. Banks that are either used in tracking, or contain
tracking have {\em T} as the first letter in their names, while the
second letter denotes the detector from which the data came, ({\em J} for
the \jdc{}, {\em P} for the \pwc{} and {\em C}
for the chambers in general). Beyond this, banks whose first letter
is a {\em C} are used for calibration purposes, while banks whose first
letter is {\em K} result from kinematic fits.
\begin{figure}[htbp]\centering
\begin{picture}(400,100)
\multiput(10,10)(90,0){4}{\line(1,0){40}}
\multiput(10,30)(90,0){4}{\line(1,0){40}}
\multiput(10,10)(90,0){4}{\line(0,1){20}}
\multiput(50,10)(90,0){4}{\line(1,1){20}}
\multiput(50,30)(90,0){4}{\line(1,-1){10}}
\multiput(15,30)(90,0){4}{\line(0,1){5}}
\multiput(15,35)(90,0){4}{\line(1,0){40}}
\multiput(55,35)(90,0){4}{\line(1,-1){10}}
\multiput(65,25)(90,0){4}{\line(-1,-1){5}}
\multiput(20,35)(90,0){4}{\line(0,1){5}}
\multiput(20,40)(90,0){4}{\line(1,0){40}}
\multiput(60,40)(90,0){4}{\line(1,-1){10}}
\multiput(70,30)(90,0){4}{\line(-1,-1){5}}
\put(30,60){\makebox(0,0){{\tiny MASTER}}}
\multiput(30,20)(90,0){4}{\makebox(0,0){{\tiny SUBBANK}}}
\put(10,50){\line(1,0){40}}
\put(10,70){\line(1,0){40}}
\put(10,50){\line(0,1){20}}
\put(50,50){\line(1,1){10}}
\put(50,70){\line(1,-1){10}}
\multiput(60,20)(90,0){4}{\vector(1,0){40}}
\put(60,60){\vector(1,0){305}}
\multiput(130,60)(90,0){3}{\vector(0,-1){20}}
\put(30,50){\vector(0,-1){10}}
\end{picture}
\caption[Data bank layout.]{{\sf Layout of master and subbank structure used
in chamber reconstruction. The master bank contains a down link to each
array of subbanks in the link area, and the number of events stored in
each subbank in the data area. The subbanks contain the actual event
data, repeated for each event in the bank.}}
\label{fig:banks}
\end{figure}
\clearpage
\subsubsection{RJDC}
The {\bf RJDC} data bank contains the processed raw \jdc{} data. This
bank can either be produced by LOCATER from the {\bf RJDF} bank, or
be produced online by the FEP's. All data stored in this bank are integers,
however the data is packed to try to optimize storage space. The bank
format can also change from time to time, so a large header has been
provided to identfy what the data format is. The data as shown in
in table~\ref{tab:RJDC} is the standard format.
\begin{table}[htbp]\centering
\begin{tabular}{|c|c|cc|}\hline
{\sl offset} & {\sc type} & \multicolumn{2}{c|}{{\sl Quantity}} \\
& & {\sl bits 17--32} & {\sl bits 1--16} \\ \hline
$+1$ & {\sc byte} & {\sl N I*2} & {\sl Header} \\
$+2$ & {\sc byte} & {\sl Length} & {\sl Time Conv.} \\
$+3$ & {\sc byte} & {\sl $t_{0}$ Subtracted} & {\sl Dynamic Ped.} \\
$+4$ & & \multicolumn{2}{c|}{{\sl unused}} \\
$+5$ & {\sc byte} & {\sl Format} & {\sl n I*2} \\ \hline
$+6$ & {\sc byte} & {\sl sector/layer} & {\sl Drift time} \\
$+7$ & {\sc byte} & {\sl A Left} & {\sl A Right} \\
$\vdots$ & $\vdots$ & \multicolumn{2}{c|}
{{\sl repeat $+6$ and $+7$ for all hits}} \\ \hline
\end{tabular}
\caption[Data in the RJDC data bank.]{{\sf The data format in the {\bf RJDC}
data bank.}}
\label{tab:RJDC}
\end{table}
\begin{itemize}
\item {\sl Header} is a header word set to {\bf FFFD} hex.
\item {\sl N I*2} is the number of {\sc integer*2} words in the data bank.
\item {\sl Length} is the length of the subunit in words which contain
data. In the default bank this is 2, corresponding to words $+6$ and $+7$.
\item {\sl Time Conv.} is the conversion between time units in the {\bf RJDC}
bank, and nanoseconds. The normal storage time is 200ps per count, in which
case the conversion constant is 5.
\item {\sl Dynamic Ped}estal indicates if the pedestals have been taken
as given in the {\bf RJDF} bank, or computed dynamically. A value of
zero means they are taken from the {\bf RJDF} bank, while a value of
one means they have been dynamically computed.
\item {\sl $t_{0}$ subtracted} indicates if the time offset from the
FADC crate has been subtracted from the data. If the value is zero, then
this has been subtracted, if it is one, then it has not been subtracted.
\item {\sl Format} is a format word set to {\bf FFFD} hex.
\item {\sl n I*2} is the number of number of remaining {\sc integer*2}
words in the bank, (excluding itself, but including the {\sl Format}
word.
\item {\sl Sector/Layer} contains the sector number (high order byte) and
layer number, (low order byte) of the hit.
\item {\sl Drift Time} is the drift time in units of 200ps. Note that it
is possible this may change, so to convert to nanoseconds, one should
always use the provided {\sl Time Conv}ersion word.
\item {\sl A Left} is the amplitude from the {\em left} or $+z$ preamplifier.
\item {\sl A Right} is the amplitude from the {\em right} or $-z$
preamplifier.
\end{itemize}
\subsubsection{RJDF}
This bank contains the unprocessed pulse information from the \jdc{}.
This is the full pulse information for the chamber and tends to be very
large in volume. This bank will only be available on the raw data tapes,
at all later levels, this bank will have been replaced with the {\bf RJDF}
data bank. The bank contents are shown in table~\ref{tab:RJDF}.
\begin{table}[htbp]\centering
\begin{tabular}{|c|c|cc|}\hline
{\sl offset} & {\sc type} & \multicolumn{2}{c|}{{\sl Quantity}} \\
& & {\sl bits 17--32} & {\sl bits 1--16} \\ \hline
$+1$ & {\sc byte} & {\sl Format} & {\sl N(I*4)} \\
$+2$ & {\sc byte} & {\sl n(I*2)} & {\sl Sector/layer} \\
$+3$ & {\sc byte} & {\sl Not used} & {\sl Time Offset} \\
$+4$ & {\sc byte} & {\sl Ped. Right}& {\sl Ped. Left} \\
$+5$ & {\sc byte} & {\sl Chan\sbscrpt{1} L/R} & {\sl Chan\sbscrpt{2} L/R} \\
$\vdots$ & $\vdots$ & $\vdots$ & $\vdots$ \\
$+4+(n(I*2)+1)/2$ & {\sc byte} & {\sl n(I*2)} & {\sl Sector/layer} \\
$\vdots$ & $\vdots$ & $\vdots$ & $\vdots$ \\ \hline
\end{tabular}
\caption[Data in the RJDF bank]{{\sf The data format in the {\bf RJDF}
data bank.}}
\label{tab:RJDF}
\end{table}
\begin{itemize}
\item {\sl Format} is a format word for the bank, {\bf FFFB} hex.
\item {\sl N(I*4)} is the number of {\sc integer*4} words in this bank.
\item {\sl n(I*2)} is the number of {\sc integer*2} words in this hit.
Note, if this is odd, then the {\sc integer*4} word containing the last
data word is padded out so that the next hit information has exactly the
same structure.
\item {\sl Sector/Layer} contains the sector number, (high order byte)
and the layer number, (low order byte) of this hit.
\item {\sl Time Offset} is the time offset in {\bf FADC} channels,
(10 ns) to the start of the recorded information.
\item {\sl Ped. Right} is the {\em right} or $-z$ pedestal.
\item {\sl Ped. Left} is the {\em left} or $+z$ pedestal.
\item {\sl Chan\sbscrpt{i} L/R} is the packed pulse data from the
flash ADC's. The high order eight bits contain the non--linear data
from the left end, and the low order eight bits contain that from the
right end.
\end{itemize}
\subsubsection{RPWC}
The data stored in the {\bf RPWC} bank contains a list of all wires
which fired in both {\sc pwc}'s. The bank is filled in the TPWCGT
routine, and then used in the TPWPOS routine for obtaining physical
positions. The data format is shown in table~\ref{tab:rpwc}.
The wire numbers run continuously from 0 to 319. Wires 0--119 are
in the inner chamber, while wires 129--308 are wires 128--309 in the
outer chamber. Wires 120--127 and 310--319 are not physically
connected to anything. The wire data is stored as two wires per
integer word. Bits 17 to 32 contain the first wire, while bits 1
to 16 contain the second wire.
\begin{table}[htbp]\centering
\begin{tabular}{|c|c|cc|} \hline
{\sl Offset} & {\sc type} & \multicolumn{2}{c|}{{\sl Quantity}} \\
& & {\sl bits 17--32} & {\sl bits 1--16} \\ \hline
-1 & {\sc integer} & \multicolumn{2}{c|}{{\sl Number of data words}} \\ \hline
+1 & {\sc integer} & \multicolumn{2}{c|}{{\sl Number of wires +2}} \\
+2 & {\sc byte} & {\sl } & {\sl wire 1} \\
+3 & {\sc byte} & {\sl wire 2} & {\sl wire 3} \\
$\vdots$ & $\vdots$ & $\vdots$ & $\vdots$ \\ \hline
\end{tabular}
\caption[Data in the RPWC data bank.]{{\sf The data stored in the
{\bf RPWC} data bank.}}
\label{tab:rpwc}
\end{table}
\subsubsection{TJDC}
The {\bf TJDC} bank is a bank structure whose top
level bank is the {\bf TJDC} bank. Under this bank, there are up
to 30 {\bf TJDS} subbanks, (one for each {\sc jdc} sector containing data).
The information stored here is the result of the $Qt$ analysis on
the {\sc jdc} {\sc fadc} information. As well as semi--processed hit
information.
The chamber information is stored in the {\bf TJDS} subbanks.
The structure of the {\bf TJDC} bank contains 30 pointers and
30 data words. The pointers point to the subbanks for each sector
in the {\sc jdc}, while the data words contain the number of fired
wires in each sector. The structure of the {\bf TJDS} subbanks
contains 4 data words for each fired wire in the sector. The {\bf TJDC}
bank is filled in TJDCGT routine, and then used throughout the pattern
recognition section of the code, (TCSGMT, TCRAW1 and TCRAW2). After the
level of pattern recognition, this bank is no longer needed.
Table~\ref{tab:TJDC} shows the structure of the {\bf TJDC} data bank,
where each of the contained quantities is described in detail as
follows.
\begin{table}[htbp]\centering
\begin{tabular}{|c|c|l|} \hline
{\sl Offset} & {\sc type} & {\sl Quantity} \\ \hline
+1 & {\sc integer} & {\sl Layer number} \\
+2 & {\sc integer} & {\sl Resolution code} \\
+3 & {\sc integer} & {\sl Segment number} \\
+4 & {\sc integer} & {\sl Hit number in {\bf TCHT}} \\
+5 & {\sc real} & $t_{D}$ \\
+6 & {\sc real} & $A_{+}$ \\
+7 & {\sc real} & $A_{-}$ \\
+8 & {\sc real} & $x_{l}$ [cm] {\sl in Sector coordinates} \\
+9 & {\sc real} & $y_{l}$ [cm] {\sl in sector coordinates} \\
+10 & {\sc real} & $x_{r}$ [cm] {\sl in sector coordinates} \\
+11 & {\sc real} & $y_{r}$ [cm] {\sl in sector coordinates} \\
+12 & {\sc real} & $z$ [cm] {\sl in CB coordinates} \\
+13 & {\sc real} & $\sigma_{z}$ [cm] \\
+14 & {\sc real} & $dE/dx$ [MeV] \\
+15 & {\sc real} & $\sigma_{\phi}$ (Edge)[radians] \\
+16 & {\sc real} & $\tan\lambda$ {\sl in CB coordinates} \\
$\vdots$ & $\vdots$ & {\sl repeated for every hit in this sector} \\ \hline
\end{tabular}
\caption[Data in the TJDC data bank.]{{\sf The data stored in the
subbanks of the {\bf TJDC} bank, ({\bf TJDS}). This structure is
repeated for each hit in the bank.}}
\label{tab:TJDC}
\end{table}
\begin{itemize}
\item {\sl Layer} is the layer in the {\sc jdc} in which this hit was
found.
\item {\sl Resolution} is a code indicating if the left--right ambiguity
has been resolved for this point. A value of 0 indicates it has not been
resolved, a value of 1 indicates left and a value of 2 indicates right.
\item {\sl Seg. No.} A number identifying with which segment this hit
has been identified in the $\tan\lambda$ association, (see TCSGMT routine).
\item {\sl Hit no.} is the number of the hit in the {\sc TCHT} data bank
where this point has been stored.
\item $t_{D}$ Drift time for this hit, [$\mu$s].
\item $A_{+}$ Amplitude from $+z$ or the left end of the \jdc{}.
\item $A_{-}$ Amplitude from $-z$ or the right end of the \jdc{}.
\item $x_{l}$ and $y_{l}$ are the $x$ and $y$ coordinates of the hit
under the assumption that it came from the left side of the cell. These
points are in what I define as a {\sf Sector--coordinate System}. In this
system, the sector is assumed to have the x--axis running down it's middle,
an the y--axis points up, (see TJTIME routine).
\item $x_{r}$ and $y_{r}$ are the same as above, except assuming that
the hit came from the right side of the cell.
\item $z$ and $\sigma_{z}$ are the z--coordinate and the error in
z--coordinate for the hit.
\item $dE/dx$ is the energy loss at this point.
\item $\sigma_{\phi}$ is the error in $\phi$ due to edge effects. This
error term is zero unless the hit is within {\sc ycuttj} of the cell
edge, (see the {\sc /tjprms/} common block.
\item $\tan\lambda$ is the tangent of the opening angle of this hit under
the assumption that the interaction was at the center of the target.
We have that $\tan\lambda=\frac{z}{r}$ where $z$ is obtained from charge
division, and $r$ is the radius of the hit wire.
\end{itemize}
\subsubsection{TCHT}
The {\bf TCHT} bank structure contains reconstructed hit information
on each hit in the {\sc jdc}.
The {\bf TCHT} data bank is a top level data bank that contains one subbank
for each layer containing hits in the chamber, {\bf TCLY}. The
{\bf TCHT} bank has 23 pointers, and 23 data words. Each pointer points
to one of the {\bf TCLY} banks, and the data word contains the number
of hit wires in that layer. The stored information on each hit is given
in table~\ref{tab:TCHT}. The {\bf TCHT} banks are lifted and filled in
TCRAW1 and TCRAW2. At this point, a warning should be made about the
addressing of this bank. Because many hits are stored in the same physical
data bank, the convention of the first data word being at one added to
the bank pointer has not been strictly followed. In some of the code,
the computed pointer actually points to the first data word, while in
other routines it points to the word immediately before the first data
word. Eventually this inconsistency will be removed, but until then,
most of the patter recognition uses the latter scheme, while the fitting
sections tend to use the former scheme.
\begin{table}[htbp]\centering
\begin{tabular}{|c|c|l|} \hline
{\sl Offset} & {\sc type} & {\sl Quantity} \\ \hline
+1 & {\sc integer} & {\sl Track number} \\
+2 & {\sc integer} & {\sl Resolution code} \\
+3 & {\sc integer} & {\sl Forward pointer for layer} \\
+4 & {\sc integer} & {\sl Forward pointer for hit} \\
+5 & {\sc integer} & {\sl Backward pointer for layer} \\
+6 & {\sc integer} & {\sl Backward pointer for hit} \\
+7 & {\sc integer} & {\sl Sector number} \\
+8 & {\sc integer} & {\sl Hit number in {\bf TJDC}} \\
+9 & {\sc real} & $x_{l}$ [cm] {\sl in CB coordinates} \\
+10& {\sc real} & $y_{l}$ [cm] {\sl in CB coordinates} \\
+11& {\sc real} & $x_{r}$ [cm] {\sl in CB coordinates} \\
+12& {\sc real} & $y_{r}$ [cm] {\sl in CB coordinates} \\
+13& {\sc real} & $z$ [cm] {\sl in CB coordinates} \\
+14& {\sc real} & $\sigma_{z}$ [cm] \\
+15& {\sc real} & $dE/dx$ [MeV] \\
+16& {\sc real} & $\sigma_{\phi}$ {\sl (Edge)} [rad] \\
+17& {\sc real} & $r$ [cm] {\sl in CB coordinates} \\
+18& {\sc real} & $\phi$ [rad] {\sl in CB coordinates} \\
+19& {\sc real} & $\sigma_{r}$ [cm] \\
+20& {\sc real} & $\sigma_{\phi}$ [rad] \\
+21& {\sc real} & {\sl Drift Time $\mu$s} \\
+22& {\sc real} & {\sl Left Amplitude} \\
+23& {\sc real} & {\sl Right Amplitude} \\
$\vdots$ & $\vdots$& {\sl repeated for every hit in this layer} \\ \hline
\end{tabular}
\caption[Data in the TCHT data bank.]{{\sf The data stored in the subbanks
of the {\bf TCHT} bank, ({\bf TCLY}). The subbanks are arranged by layer,
and the structure is repeated for each hit in the layer.}}
\label{tab:TCHT}
\end{table}
\begin{itemize}
\item {\sl Track number} identifies if the point has been incorporated
into a segment, and if so what the number of the track in {\bf TCTK} is. A
0 indicates no connection has been made.
\item {\sl Resolution code} identifies if the point has been resolved or not.
It is defined the same as in the {\bf TJDC} bank.
\item {\sl Forward pointer for layer} is the layer number of the next
hit in this segment.
\item {\sl Forward pointer for hit} is the hit number of the next point
in this segment in the {\bf TCHT} bank.
\item {\sl Backward pointer for layer} is the layer number of the previous
hit in this segment.
\item {\sl Backward pointer for hit} is the hit number of the previous
hit in this segment in the {\bf TCHT} bank.
\item {\sl Sector} is the sector in which this hit was found.
\item {\sl Hit No.} is the hit number in the sector. These last two entries
are used to refer back to the {\bf TJDC} bank.
\item $x_{l}$ and $y_{l}$ are the x and y coordinates of the hit assuming
that it was on the left side of the cell. These coordinates are in the
CB system, ($z$ along the direction of the incoming antiproton, $y$ pointing
up, and $x$ such that the system is right handed).
\item $x_{r}$ and $y_{r}$ are the x and y coordinates of the hit assuming
that it was on the right side of the cell.
\item $z$ and $\sigma_{z}$ are the z--coordinate and its error for the
hit.
\item $dE/dx$ is the energy loss for the hit.
\item $\sigma_{\phi}$ (Edge) is the error in $\phi$ due to effects at
the edge of the drift cell.
\item $r$ and $\phi$ are said coordinates for the hit. If the hit has
not been resolved, then they are not set.
\item $\sigma_{r}$ and $\sigma_{\phi}$ are the $1\sigma$ errors in
$r$ and $\phi$, (see the TCRESL routine for calculations of these
quantities).
\item {\sl Drift Time}
\item {\sl Left Amplitude}
\item {\sl Right Amplitude}
\end{itemize}
\subsubsection{TCTK}
The {\bf TCTK} bank structure contains the results of the first level
reconstruction for each track found in the {\sc jdc}.
The {\bf TCTK} is a master bank over the {\bf TCSG} data banks. {\bf TCTK}
contains 50 pointers and one data word. The data word is the number
of tracks found, and the pointers then point to the {\bf TCSG} bank for each
found track. The data stored in each {\bf TCSG} bank is shown in
table~\ref{tab:TCSG}. The {\bf TCTK} banks are lifted in the TCRAW1 and TCRAW2
routines, but filled mostly in the {\em circle fitting} section of the code,
(TCLOAD). Additional information is coded into the header word of each
sub--bank. If bit 1 is set to 1, then isochron corrections have already
been performed. The TCIFIX routine checks this to make sure it does
not apply isochron corrections twice. If bit 2 is set to 1, then
the track crosses sector boundaries in the \jdc{}.
The circle fit parametrization is given by the formula:
\[ \kappa\cdot r_{i} + c^{2}/r_{i} + \sin (\phi_{i} - \psi_{0}) = 0 \]
In this form, if the center of the circle is at the point $(a,b)$, and
it has a radius of $\rho$, then:
\begin{eqnarray*}
\kappa &=& \frac{1}{2\cdot\sqrt{a^{2}+b^{2}} } \\
c^{2} &=& (\frac{1}{2\cdot\kappa})^{2} - \rho^{2}
\end{eqnarray*}
\begin{table}[htbp]\centering
\begin{tabular}{|c|c|l|}\hline
{\sl Offset} & {\sc type} & {\sl Quantity} \\ \hline
+1 & {\sc integer} & {\sl Number of Hits} \\
+2 & {\sc integer} & {\sl Layer of Hit 1 } \\
+3 & {\sc integer} & {\sl Hit number of hit 1} \\
+4 & {\sc integer} & {\sl Layer of Hit n} \\
+5 & {\sc integer} & {\sl Hit number of hit n} \\
+6 & {\sc integer} & {\sl Number of $dE/dx$ hits} \\
+7 & {\sc integer} & {\sl Error code from fit} \\
+8 & {\sc real} & {\sl Charge} \\
+9 & {\sc real} & {\sl Mass} $[MeV]$\\
+10& {\sc real} & $dE/dx$ $[MeV/cm]$\\
+11& {\sc real} & $\sigma_{dE/dx}$ $[MeV/cm]$\\
+12& {\sc real} & $p_{\perp}$ $[MeV/c]$\\
+13& {\sc real} & $\psi_{0}$ $[$radians$]$\\
+14& {\sc real} & $p_{L}$ $[MeV/c]$\\
+15& {\sc real} & $\delta p_{\perp}$ $[MeV/c]$\\
+16& {\sc real} & $\delta \psi_{0}$ $[$radian$]$\\
+17& {\sc real} & $s\cdot\kappa$ $[cm^{-1}]$\\
+18& {\sc real} & $c^{2}$ $[cm^{2}]$\\
+19& {\sc real} & $\tan\lambda_{0}$\\
+20& {\sc real} & $a$ $[cm]$\\
+21& {\sc real} & $C_{r\phi}$ \\
$\vdots$ & $\vdots$ & $\vdots$ \\
+27& {\sc real} & $C_{\lambda}(1,1)$\\
+28& {\sc real} & $C_{\lambda}(2,1)$\\
+29& {\sc real} & $C_{\lambda}(2,2)$\\
+30& {\sc real} & $\chi^{2}$ \\ \hline
\end{tabular}
\caption[Data in the TCTK data bank.]{{\sf The data stored in the
subbanks of the {\bf TCTK} bank, ({\bf TCSG}). There is one {\bf TCSG}
data bank for each track found in the chambers.}}
\label{tab:TCSG}
\end{table}
\begin{itemize}
\item {\sl Number of Hits} is the number of hits incorporated into
this track.
\item {\sl Layer of hit 1} is the layer number of the first hit in this
track.
\item {\sl Hit number of hit 1} is the number in {\bf TCHT} of hit 1.
\item {\sl Layer of hit n} is the layer number of the last hit in this
track.
\item {\sl Hit number of hit n} is the number in {\bf TCHT} of hit n.
\item {\sl Number of $dE/dx$ hits} is the number of hits used for
$dE/dx$ calculations.
\item {\sl Error code} is initially set in the TCRAWS routine to either
0 or 1. A value of 1 indicates that the track crosses sector boundaries,
while a value of 2 indicates that the track is contained in one \jdc{}
sector. The routines TCFITR and TCTHET later change the value of the
error code to have the following meanings:
\begin{itemize}
\item[0] The fit converged normally, and exited because the
$\chi^{2}$ became small enough.
\item[1] The initial guess was good enough, and no iteration
was performed.
\item[2] The fit converged to a value which was too large, but the
TCSPLT routine could find nothing wrong with the track.
\item[3] The fit converged to a $\chi^{2}$ larger than the value
of the cutoff.
\item[4] The value of $\chi^{2}$ began to diverge after the third
iteration in the fit.
\item[5] The fit failed to converge in {\sc nitrtc} iterations.
\item[6] There were not enough points to fit a track, fewer than three.
\item[7] The fit did not converge because the program tried to
invert a singular matrix. Do not trust the results, particularly the
covariance matrix.
\item[8] The TCTHET routine reconstructed a $\lambda$ of
$90^{\circ}$.
\item[9] The TCTHET routine got lost in stepping through the track.
\end{itemize}
\item {\sl Charge} is the electric charge of this track, $\pm 1$.
\item {\sl Mass} is the mass in $MeV/c$ of this particle.
\item $dE/dx$ is the average $dE/dx$ of this particle.
\item $\sigma_{dE/dx}$ is the error in the $dE/dx$ measurement.
\item $p_{\perp}$ is the momentum perpendicular to the beam direction,
[MeVc].
\item $\psi_{0}$ is the direction of the particle in the x--y plane
at the point of closest approach to the origin.
\item $p_{L}$ is the longitudinal component of the particle's momentum,
[MeV/c].
\item $\delta p_{\perp}$ is the error in the fit momentum.
\item $\delta\psi_{0}$ is the error in the fit $\phi$.
\item $\kappa$ comes from the $r-\phi$ circle fit. It is $1/2R$
where $R$ is the distance from the center of the fit circle from the
origin, (If the circle center is at $(a,b)$, then $R=\sqrt{a^{2}+b^{2}}$).
\item $c^{2}$ is a parameter from the circle fit which is related to
the distance of closest approach to the origin. The radius of curvature
of the particle is given as \[ \rho = \sqrt{R^{2}-c^{2}} \] and the
distance of closest approach is then $\mid\rho - R\mid$.
\item $\tan\lambda$ is the tangent of the opening angle obtained from
the r--z fit.
\item $C_{r\phi}$ is the 3 by 3 covariance matrix obtained from the
fit to a circle in $r - \phi$ The matrix is symmetric, and stored as
follows.
\begin{eqnarray*}
\left( \begin{array}{ccc}
+21 & * & * \\ +22 & +24 & * \\ +23 & +25 & +26
\end{array} \right) &=&
\left( \begin{array}{ccc}
\sigma_{RKRK} & \sigma_{RK\psi} & \sigma_{RKc^{2}} \\
\sigma_{RK\psi} & \sigma_{\psi\psi} & \sigma_{\psi c^{2}} \\
\sigma_{Rkc^{2}}& \sigma_{\psi c^{2}}& \sigma_{c^{2}c^{2}}
\end{array} \right)
\end{eqnarray*}
\item $C_{\lambda}(1,1) = \sigma_{\tan\lambda\tan\lambda}$.
\item $C_{\lambda}(2,1) = \sigma_{\tan\lambda a}$.
\item $C_{\lambda}(2,2) = \sigma_{aa}$.
\item $\chi^{2}$ is the $\chi^{2}$ of the circle fit performed in the
TCFITR routine. It has units of cm\spscrpt{2}.
\end{itemize}
\subsubsection{TCTR}
The {\bf TCTR} bank structure contains all the tracking results for
each track located in the chambers. This bank is a master bank over
the {\bf TCTX} data banks, (one {\bf TCTX} for each track). The data
stored in each {\bf TCTX} bank is shown in table~\ref{tab:helix}.
The {\bf TCTR} banks are lifted and filled in the helix fitting section
of the code. These banks are generically referred to as the {\bf TCTR}
data banks. The header word, {\sc iq(itctr)} also contains some coded
information about the tracks. If bit 2 is set to 1, then the track
crossed at least one sector boundary, whereas if it is set to 0, then
the track is contained in one sector.
\begin{table}[htbp]\centering
\begin{tabular}{|c|c|l|}\hline
{\em offset} & {\sc type} & {\em Quantity} \\ \hline
+1 & {\sc integer} & {\sl Nhits} \\
+2 & {\sc integer} & {\sl NPED} \\
+3 & {\sc integer} & {\sl Vertex} \\
+4 & {\sc integer} & {\sl Layer$_{1}$} \\
+5 & {\sc integer} & {\sl Layer$_{N}$} \\
+6 & {\sc integer} & {\sl Error code} \\
+7 & {\sc real} & {\sl Charge} \\
+8 & {\sc integer} & {\sl N}{\sc pwc} \\
+9 & {\sc real} & $dE/dx$ \\
+10& {\sc real} & $\sigma_{dE/dx}$ \\
+11& {\sc real} & $r_{0}$ \\
+12& {\sc real} & $z_{0}$ \\
+13& {\sc real} & $\alpha$ \\
+14& {\sc real} & $\tan\lambda$ \\
+15& {\sc real} & $\psi_{0}$ \\
+16& {\sc real} & $s$ \\
+17& {\sc real} & $\chi^{2}$ \\
+18& {\sc real} & $C_{\xi}[1,1]$\\
$\vdots$ & $\vdots$ & $\vdots$ \\
+32& {\sc real} & $C_{\xi}[5,5]$ \\ \hline
\end{tabular}
\caption[Data in the TCTR data bank.]{{\sf The data stored in the subbanks of
the {\bf TCTR} bank, ({\bf TCTX}). There is one {\bf TCTX} data bank for
each track found in the chambers.}}
\label{tab:helix}
\end{table}
\begin{itemize}
\item {\sl Nhits} is the number of hits incorporated into this track,
(\jdc{}).
\item {\sl NPED} is the number of the PED to which this track connects.
This word is filled during global tracking, and is not available until
that has been performed.
\item {\sl Vertex} is the number of the vertex from which this track
originated.
\item {\sl Layer$_{1}$} is the layer number of the first hit in this
track.
\item {\sl Layer$_{N}$} is the layer number of the last hit in this
track.
\item {\sl Error code} Is a combination of the fit error in the TCTK bank,
and the error returned from the TCHELX routine. It's value is the
TCTK error code plus the following:
\begin{itemize}
\item[0] Completely normal convergence in the TCHELX routine.
\item[10] The TCHELX routine was not implemented as there were only
3 points found in the track.
\item[30] The $\chi^{2}$ in the TCHELX routine converged to a value
larger than the allowed cutoff.
\item[40] The $\chi^{2}$ in the TCHELX routine began to diverge.
\item[50] The maximum number of iterations was exceeded.
\item[70] An attempt was made to invert a singular matrix.
\end{itemize}
\item {\sl Charge} is the electric charge of this particle, $\pm 1$.
\item {\sl N}{\sc pwc} is the number of {\sc pwc} hits attached to this
track. They are stored as the first entries of the {\bf TCHX} bank for
the track.
\item {\sl dE/dx} is the average energy loss per centimeter of track length.
\item $\sigma_{dE/dx}$ is the error in the above dE/dx.
\item $r_{0}$ is the distance of closest approach of the helix to the
z--axis. It is possible for this number to be negative.
\item $z_{0}$ is the z--coordinate at the radius $r_0$.
\item $\alpha $ is the curvature of the track. This number is positive.
\item $\tan\lambda$ is the tangent of the opening angle of the track.
\item $\psi_{0}$ is direction angle from the circle fit.
\item $s$ is a sign parameter of the track. It is determined by looking
at the angle $\beta_{0}$, the angle as measured from the center of
the circle describing the track to the point of closest approach,
$(r_{0},z_{0})$. $\beta_{0} = \psi_{0} + s\cdot\frac{\pi}{2}$.
\item $\chi^{2}$ is the returned the $\chi^{2}$ of the helix fit with
$3\cdot${\sl Nhits}$-5$ degrees of freedom.
\item $C_{\xi}$ is the covariance matrix for the above six parameters.
This is a 5 by 5 symmetric matrix which is stored as follows.
\begin{eqnarray*}
\left( \begin{array}{ccccc}
+18&*&*&*&*\\
+19&+20&*&*&*\\
+21&+22&+23&*&*\\
+24&+25&+26&+27&*\\
+28&+29&+30&+31&+32
\end{array} \right) &=& \left( \begin{array}{ccccc}
\sigma_{rr} & \sigma_{rz} & \sigma_{r\alpha} &
\sigma_{r\lambda} & \sigma_{r\psi} \\
\sigma_{rz} & \sigma_{zz} & \sigma_{z\alpha} &
\sigma_{z\lambda} & \sigma_{z\psi} \\
\sigma_{r\alpha} & \sigma_{z\alpha} &
\sigma_{\alpha\alpha} & \sigma_{\alpha\lambda} & \sigma_{\alpha\psi} \\
\sigma_{r\lambda} & \sigma_{z\lambda} &
\sigma_{\alpha\lambda} & \sigma_{\lambda\lambda} &
\sigma_{\lambda\psi} \\
\sigma_{r\psi} & \sigma_{z\psi} & \sigma_{\alpha\psi} &
\sigma_{\lambda\psi} & \sigma_{\psi\psi}
\end{array} \right)
\end{eqnarray*}
\end{itemize}
\subsubsection{TCHX}
The {\bf TCHX} data bank contains the coordinates of the hits used in the
helix fits. The bank structure is one {\bf TCHX} bank to which is
attached one {\bf TCHP} subbank for every track. The data stored in this
bank are the improved coordinates from the helix fit. Because of this,
one should not perform the helix fit twice. After the second iteration,
the errors will be nonsense. To prevent this from happening, the
routine TCHXLD sets the lowest order bit of the status word,
IQ(LTCHP), to 1. The routine will not refit tracks with this bit set.
The contents of the
{\bf TCHP} bank follows, where $N$ is the number of hits in the track, which
is taken from the corresponding {\bf TCTR} data bank. These banks are
generically referred to as the {\bf TCHX} banks.
\begin{table}[htbp]\centering
\begin{tabular}{|c|c|l|}\hline
{\sl Offset} & {\sc type} & {\sl Quantity} \\ \hline
$+1$ & {\sc real} & $x_{1}$ \\
$+2$ & {\sc real} & $y_{1}$ \\
$+3$ & {\sc real} & $z_{1}$ \\
$+4$ & {\sc real} & $\sigma_{x1}^{2}$ \\
$+5$ & {\sc real} & $\sigma_{y1}^{2}$ \\
$+6$ & {\sc real} & $\sigma_{z1}^{2}$ \\
$\vdots$ & $\vdots$ & $\vdots$ \\
$+6n-5$& {\sc real} & $x_{n}$ \\
$+6n-4$& {\sc real} & $y_{n}$ \\
$+6n-3$& {\sc real} & $z_{n}$ \\
$+6n-2$& {\sc real} & $\sigma_{xn}^{2}$ \\
$+6n-1$& {\sc real} & $\sigma_{yn}^{2}$ \\
$+6n-0$& {\sc real} & $\sigma_{zn}^{2}$ \\ \hline
\end{tabular}
\caption[Data in the TCHX data bank.]{{\sf The data stored in the
{\bf TCHX} data banks. All hits for one track are stored in their
own bank.}}
\label{tab:TCHX}
\end{table}
\begin{itemize}
\item $(x,z,y)$ are the coordinates of the points used in this track.
These points have been improved by the helix fit. They will not refer
to exactly the same point as in the {\bf TCHT} data banks.
\item $(\sigma_{x},\sigma_{y},\sigma_{z})$ are the errors is the used
coordinates. These are not the input errors, but the errors coming from the
helix fit.
\end{itemize}
\subsubsection{TCVX}
The {\bf TCVX} data bank is a {\em steering} bank to all found vertices
in the event. It contains one data word, which is the number of found
vertices, and then one pointer to the {\bf TCVT} bank for each vertex.
Access to the vertex information is shown in figure~\ref{fig:vrtx}.
\begin{figure}[htbp]\centering
\begin{picture}(400,200)
\put(15,185){\framebox(70,15){{\sf LQ(LTCVX-N)}}}
\put(15,170){\framebox(70,15){{\sf LQ(LTCVX-1)}}}
\put(15,155){\framebox(70,15){{\sf IQ(LTCVX+1)}}}
\put( 85,177.5){\line(1,0){165}}
\put(250,177.5){\line(0,-1){55}}
\put(250,122.5){\vector(-1,0){15}}
\put(165,130){\framebox(70,15){{\sf LQ(ITCVT-1)}}}
\put(165,115){\framebox(70,15){{\sf IQ(ITCVT)}}}
\put(165, 85){\framebox(70,30){{\sf Data}}}
\put(165,137.5){\line(-1,0){15}}
\put(150,137.5){\line(0,-1){80}}
\put(150, 57.5){\vector(1,0){15}}
\put(165, 50){\framebox(70,15){{\sf IQ(ITCVP)}}}
\put(165, 20){\framebox(70,30){{\sf Data}}}
\put( 85,187.5){\line(1,0){315}}
\put(400,187.5){\line(0,-1){65}}
\put(400,122.5){\vector(-1,0){15}}
\put(315,130){\framebox(70,15){{\sf LQ(ITCVT-1)}}}
\put(315,115){\framebox(70,15){{\sf IQ(ITCVT)}}}
\put(315, 85){\framebox(70,30){{\sf Data}}}
\put(315,137.5){\line(-1,0){15}}
\put(300,137.5){\line(0,-1){80}}
\put(300, 57.5){\vector(1,0){15}}
\put(315, 50){\framebox(70,15){{\sf IQ(ITCVP)}}}
\put(315, 20){\framebox(70,30){{\sf Data}}}
\end{picture}
\caption[Access to the vertex information.]{{\sf Layout of the bank structure
containing all found vertices.}}
\label{fig:vrtx}
\end{figure}
\subsubsection{TCVT}
The {\bf TCVT} data banks are subbanks to the {\bf TCVX} data bank, and
contain information regarding the found vertices. The data are shown
in table~\ref{tab:TCVT}.
\begin{table}[htbp]\centering
\begin{tabular}{|c|c|l|}\hline
{\sl Offset} & {\sc type} & {\sl Quantity} \\ \hline
$+1$ & {\sc integer} & {\sl Ntrks} \\
$+2$ & {\sc integer} & {\sl Nneutral} \\
$+3$ & {\sc integer} & {\sl Error code} \\
$+4$ & {\sc integer} & $N_{DF}$ \\ \hline
$+5$ & {\sc real} & $x [cm]$ \\
$+6$ & {\sc real} & $y [cm]$ \\
$+7$ & {\sc real} & $z [cm]$ \\
$+8$ & {\sc real} & $C_{x}$ \\
\vdots & \vdots & \vdots \\
$+14$ & {\sc real} & $\chi^{2}$ \\ \hline
\end{tabular}
\caption[Data in the TCVT data bank.]{{\sf The data stored in the
{\bf TCVT} data bank. There is one bank for every vertex.}}
\label{tab:TCVT}
\end{table}
\begin{itemize}
\item {\sl Ntrks} is the number of tracks fit to this vertex. The set of
pointers to each of these tracks in the {\bf TCTR} bank is in the pointer
section of this bank.
\item {\sl Nneutral} is the number of neutral tracks assigned to this
vertex. At present, there is no list available as to which tracks these
are.
\item {\sl Ierr} is an error code returned from the TCVRTX routine for this
vertex. It has the following meanings:
\begin{itemize}
\item[0] Normal convergence occurred.
\item[100] Only one track fit to this vertex.
\item[300] The iterative routine converged with a too large $\chi^{2}$.
\item[400] The $\chi^{2}$ started to diverge for this track.
\item[500] The routine did not converge in the allowed number of
iterations.
\item[600] The number of tracks to fit was out of range.
\item[700] The routine tried to invert a singular matrix.
\end{itemize}
\item $N_{DF}$ is the number of degrees of freedom from the fit.
\item $x$ is the $x$ coordinate of the fit vertex, [cm].
\item $y$ is the $y$ coordinate of the fit vertex, [cm].
\item $z$ is the $z$ coordinate of the fit vertex, [cm].
\item $C_{x}$ contains the 6 unique elements of the 3 by 3
symmetric covariance matrix for $\vec{x}$. They are stored
as follows:
\begin{eqnarray*}
\left( \begin{array}{ccc}
+6 & * & * \\ +7 & +8 & * \\ +9 & +10 & +11
\end{array} \right) &=& \left( \begin{array}{ccc}
\sigma_{xx} & \sigma_{xy} & \sigma_{xz} \\
\sigma_{xy} & \sigma_{yy} & \sigma_{yz} \\
\sigma_{xz} & \sigma_{yz} & \sigma_{zz} \end{array}\right)
\end{eqnarray*}
\item $\chi^{2}$ is the resulting $\chi^{2}$ of the fit with $N_{DF}$
degrees of freedom.
\end{itemize}
\subsubsection{TCVP}
The {\bf TCVP} data bank contains fit momentum information for all tracks
coming from the corresponding vertex. The {\bf TCVP} bank is a subbank under
the {\bf TCVT} data bank describing the vertex. It contains the following
information for every track. The length of each block is given by the
parameter {\sc lenvp} obtained using {\sc +cde,trkprm.}.
\begin{table}[htbp]\centering
\begin{tabular}{|c|c|l|}\hline
{\sl Offset} & {\sc type} & {\sl Quantity} \\ \hline
$+1$ & {\sc integer} & {\sl Track Number in} {\bf TCTR} \\
$+2$ & {\sc integer} & {\sl Quality Word} \\
$+3$ & {\sc real} & Charge of particle. \\
$+4$ & {\sc real} & $p_{x}$ {\sl [MeV/c]} \\
$+5$ & {\sc real} & $p_{y}$ {\sl [MeV/c]} \\
$+6$ & {\sc real} & $p_{z}$ {\sl [MeV/c]}\\
$+7$ & {\sc real} & $E$ {\sl [MeV]} \\
$+8$ & {\sc real} & $\sigma^{2}[p{x}]$ {\sl [Mev/c]$^{2}$} \\
$+9$ & {\sc real} & $\sigma [p_{xy}]$ {\sl [Mev/c]$^{2}$} \\
$+10$& {\sc real} & $\sigma^{2}[p_{y}]$ {\sl [Mev/c]$^{2}$} \\
$+11$& {\sc real} & $\sigma [p_{xz}]$ {\sl [Mev/c]$^{2}$} \\
$+12$& {\sc real} & $\sigma [p_{yz}]$ {\sl [Mev/c]$^{2}$} \\
$+13$& {\sc real} & $\sigma^{2}[p_{z}]$ {\sl [Mev/c]$^{2}$} \\
$\vdots$ & $\vdots$ & $\vdots$ \\ \hline
\end{tabular}
\caption[Data in the TCVP data bank.]{{\sf The data stored in the subbank
of the {\bf TCVT} data bank, (the {\bf TCVP} bank). The above information
is repeated for every track.}}
\label{tab:tcvp}
\end{table}
\begin{itemize}
\item {\sl Track number} is the track number from the {\bf TCTR} data bank.
\item {\sl Quality word} is the track length in hits plus one hundred times
the first layer of the track plus ten thousand times the error code from the
helix fit.
\item {\sl Charge} is the electric charge of this particle. It is possible
for this to be different from the charge in the {\bf TCTR} bank, as the
vertex fit is allowed to change the charge of a track.
\item $p_{x}$ is the improved x--component of momentum.
\item $p_{y}$ is the improved y--component of momentum.
\item $p_{z}$ is the improved z--component of momentum.
\item $E$ is the energy under the assumption the particle is a pion.
\item The remaining six terms are the unique elements of the three
by three covariance matrix for the momentum.
\begin{eqnarray*}
\left( \begin{array}{ccc}
+8 & * & * \\ +9 & +10 & * \\ +11 & +12 & +13
\end{array} \right) &=& \left( \begin{array}{ccc}
\sigma_{xx} & \sigma_{xy} & \sigma_{xz} \\
\sigma_{xy} & \sigma_{yy} & \sigma_{yz} \\
\sigma_{xz} & \sigma_{yz} & \sigma_{zz} \end{array}\right)
\end{eqnarray*}
\end{itemize}
\subsection{The TPWC Data Bank}
The {\bf TPWC} data bank contains the position information from each
hit in the {\sc pwc}'s, and from each cluster in the {\sc pwc}. The
hit information is stored in two {\bf TPCH} subbanks under the {\bf TPWC} bank.
These banks are attached at the -1 and -2 downlinks. The format of this information
is given in table~\ref{tab:tpwc}.
\begin{table}[htbp]\centering
\begin{tabular}{|c|c|l|}\hline
{\sl Offset} & {\sc type} & {\sl Quantity} \\ \hline
$+1$ & {\sc integer} & {\sl Track number} \\
$+2$ & {\sc integer} & {\sl Wire number} \\
$+3$ & {\sc real} & $x_{i}$ [cm] \\
$+4$ & {\sc real} & $y_{i}$ [cm] \\
$+5$ & {\sc real} & $z_{i}$ [cm] \\
$+6$ & {\sc real} & $r_{i}$ [cm] \\
$+7$ & {\sc real} & $\phi_{i}$ [radians] \\
$+8$ & {\sc real} & $\sigma_{x}$ [cm] \\
$+9$ & {\sc real} & $\sigma_{y}$ [cm] \\
$+10$& {\sc real} & $\sigma_{\phi}$ [radians] \\ \hline
\end{tabular}
\caption[Data in the TPWC data bank.]{{\sf The data stored in the two
subbanks of the {\bf TPWC} data bank, ({\bf TPCH}). This format is
repeated for every cluster each chamber.}}
\label{tab:tpwc}
\end{table}
\begin{itemize}
\item {\sl Track number} refers to the track to which this hit is
connected.
\item {\sl Wire number} is the number of the fired wire.
\item The $x$ coordinate as determined from the wire number.
\item The $y$ coordinate as determined from the wire number.
\item The $z$ coordinate as projected by the \jdc{}.
\item $r$ is the radius of the wire.
\item The $\phi$ position of the wire.
\item $\sigma_{x}$ is the error in the $x$ position.
\item $\sigma_{y}$ is the error in the $y$ position.
\item $\sigma_{\phi}$ is the error in the $\phi$ angle.
\end{itemize}
To obtain the number of hits found in each \pwc{}, and then extract
the hit data, use the following code. (Note that the parameter LENPW
is obtained using the +CDE,TRKPRM.)
\begin{verbatim}
IF(LTPWC .GT. 0) THEN
NHIT1 = IQ(LTPWC+1)
NHIT2 = IQ(LTPWC+2)
IF(NHIT1 .GT. 0) THEN
ITPWC = LQ(LTPWC-1)
DO 1000 IHIT = 1,NHIT1
XHIT = Q(ITPWC+3)
YHIT = Q(ITPWC+4)
ZHIT = Q(ITPWC+5)
...
ITPWC = ITPWC + LENPW
1000 CONTINUE
ENDIF
*
* Repeat the above for the outer chamber if desired.
*
ENDIF
\end{verbatim}
The cluster information is contained in two {\bf TPCL} banks attached to
the -3 and -4 down links of the {\bf TPWC} bank. The format of these
cluster banks are given in table~\ref{tab:tpcl}. It is important to
note that the cluster information is linked to the {\sc jdc}, and not
the hit information.
\begin{table}[htbp]\centering
\begin{tabular}{|c|c|l|}\hline
{\sl Offset} & {\sc type} & {\sl Quantity} \\ \hline
$+1$ & {\sc integer} & {\sl Track number} \\
$+2$ & {\sc integer} & {\sl Wire 1} \\
$+3$ & {\sc integer} & {\sl Cluster Size} \\
$+4$ & {\sc real} & {\sl Central Wire Number} \\
$+5$ & {\sc real} & $x_{i}$ [cm] \\
$+6$ & {\sc real} & $y_{i}$ [cm] \\
$+7$ & {\sc real} & $z_{i}$ [cm] \\
$+8$ & {\sc real} & $r_{i}$ [cm] \\
$+9$ & {\sc real} & $\phi_{i}$ [radians] \\
$+10$& {\sc real} & $\sigma_{x}$ [cm] \\
$+11$& {\sc real} & $\sigma_{y}$ [cm] \\
$+12$& {\sc real} & $\sigma_{\phi}$ [radians] \\ \hline
\end{tabular}
\caption[Data in the TPWC data bank.]{{\sf The data stored in the two
subbanks of the {\bf TPWC} data bank, ({\bf TPCL}). This format is
repeated for every cluster each chamber.}}
\label{tab:tpcl}
\end{table}
\begin{itemize}
\item {\sl Track number} refers to the track to which this hit is
connected.
\item {\sl Wire 1} is the first wire in the cluster.
\item {\sl Cluster Size} is the number of wires in the cluster.
\item {\sl Central Wire Number} is the {\em pseudo} wire at the
center of the cluster.
\item The $x$ coordinate as determined from the wire number.
\item The $y$ coordinate as determined from the wire number.
\item The $z$ coordinate as projected by the \jdc{}.
\item $r$ is the radius of the wire.
\item The $\phi$ position of the wire.
\item $\sigma_{x}$ is the error in the $x$ position.
\item $\sigma_{y}$ is the error in the $y$ position.
\item $\sigma_{\phi}$ is the error in the $\phi$ angle.
\end{itemize}
To obtain the number of clusters found in each \pwc{}, and then extract
the cluster data, use the following code. (Note that the parameter LENCL
is obtained using the +CDE,TRKPRM.)
\begin{verbatim}
IF(LTPWC .GT. 0) THEN
NCL1 = IQ(LTPWC+3)
NCL2 = IQ(LTPWC+4)
IF(NCL1 .GT. 0) THEN
ITPWC = LQ(LTPWC-3)
DO 1000 IHIT = 1,NCL11
XHIT = Q(ITPWC+5)
YHIT = Q(ITPWC+6)
ZHIT = Q(ITPWC+7)
...
ITPWC = ITPWC + LENCL
1000 CONTINUE
ENDIF
*
* Repeat the above for the outer chamber if desired.
*
ENDIF
\end{verbatim}
\subsection{Calibration Data Banks}
In this section are described the data banks which contain \jdc{}
calibration constants. These are the constants used for adjusting
the gains of all preamplifiers, and for defining the drift region
in the \jdc{}. They are used in the following formula, where $P_{i}$
are polynomials of order $i$.
\begin{eqnarray}
z^{i} &=& z_{0}^{i} + z_{l}^{i}\cdot
\left[ \frac{{\textstyle A_{+} - \alpha^{i}\cdot A_{-}}}
{{\textstyle A_{+} + \alpha^{i}\cdot A_{-}}} \right ] \\
\frac{dE}{dx} &=& c^{i}_{E}\cdot \left[ A_{+} + \alpha^{i}
\cdot A_{-} \right] \\
y_{l}^{i} &=& s^{i} + a_{0}^{i}(1-e^{-a_{5}^{i}\sqrt{t_{D}}})
+ a_{1}^{i}\cdot P_{0}(t_{D}) + a_{2}^{i}\cdot P_{1}(t_{D}) +
a_{3}\cdot P_{2}(t_{D}) + a_{4}^{i}\cdot P_{3}(t_{D}) \\
x_{l}^{i} &=& r^{i} + b_{0}^{i}\cdot P_{0}(y_{l}^{i} - s^{i}) + b_{1}\cdot
P_{1}(y_{l}^{i} - s^{i}) + b_{2}\cdot P_{2}(y_{l}^{i} - s^{i}) \\
y_{r}^{i} &=& s^{i} + a_{6}^{i}(1-e^{-a_{11}^{i}\sqrt{t_{D}}})
+ a_{7}^{i}\cdot P_{0}(t_{D}) + a_{8}^{i}\cdot P_{1}(t_{D}) +
a_{9}\cdot P_{2}(t_{D}) + a_{10}^{i}\cdot P_{3}(t_{D}) \\
x_{r}^{i} &=& r^{i} + b_{3}^{i}\cdot P_{0}(y_{r}^{i} - s^{i}) + b_{4}\cdot
P_{1}(y_{r}^{i} - s^{i}) + b_{5}\cdot P_{2}(y_{r}^{i} - s^{i})
\end{eqnarray}
At present, the allowed polynomials are Taylor, Hermite and Laguerre. These
are selected by the flag word in the {\bf TJCP} data bank. The forms of
these polynomials are given by:
\[ \begin{array}{lll}
T_{0}(t) = t & H_{0}(t) = 1 & L_{0}(t) = 1 \\
T_{1}(t) = t\cdot T_{0}(t) & H_{1}(t) = t & L_{1}(t) = t-1 \\
T_{2}(t) = t\cdot T_{1}(t) & H_{2}(t) = 2\cdot (t\cdot H_{1}(t) - H_{0}(t)) &
L_{2}(t) = \frac{1}{2}((t-3)L_{1}(t)-1 )\\
T_{3}(t) = t\cdot T_{2}(t) & H_{3}(t) = 2\cdot (t\cdot H_{2}(t)
- 2\cdot H_{1}(t)) & L_{3}(t) = \frac{1}{3}((t-5)L_{2}(t)-2L_{1}(t))
\end{array} \]
Where $T_{i}$ are Taylor polynomials, $H_{i}$ are Hermite polynomials and
$L_{i}$ are Laguerre polynomials. Note that in the case of Taylor polynomials,
no constant term is used. Also, the scale factor is absorbed into the
fit constant for these terms. The various constants in the above equations
are stored in the following data banks.
\subsubsection{TJCE}
The {\bf TJCE} bank contains the 690 $c^{i}_{E}$ constants used to
convert the modified amplitude sums to an energy. There is one constant for
every wire in the jdc, and the are addressed in the bank as:
\[c_{i}^{E} = (s-1)\cdot 23 + l \] where $s$ is the sector number, (1--30),
and $l$ is the layer number, (1--23).
\subsubsection{TJCP}
The {\bf TJCP} data bank contains a set of parameters for generating the
look--up table in the {\bf TJCT} data bank. These are the $a_{k}^{i}$ and
$b_{k}^{i}$ values in the last four equations. The data bank contains
20 words per layer, with words 1 through 10 containing $a_{0}$ to $a_{5}$,
$b_{0}$ to $b_{2}$ and a radius parameter. Words 11 to 20 then contain
$a_{6}$ to $a_{11}$, $b_{3}$ to $b_{5}$ and a second radius parameter.
The word {\sc iq(ltjcp)} contains information about what these parameters
mean. Bits 1,2 and 3 are set according to the following code scheme:
\begin{itemize}
\item[000] Use Taylor polynomials for the expansion.
\item[001] Use Hermite polynomials for the expansion.
\item[010] Use Laguerre polynomials for the expansion.
\item[011] Use Garfield tables.
\end{itemize}
\subsubsection{TJCZ}
The {\bf TJCZ} bank contains the 690 $\alpha^{i}$ constants used to compute
the $z$ position on each wire. They are a measure of the relative gain between
the two ends of the chamber, and are addressed in the same way as the
constants in the {\bf TJCE} bank.
\subsubsection{TJCT}
The {\bf TJCT} bank contains a look--up table used to convert drift time
to position in the \jdc{}. The positions are stored in sector coordinates,
(see the description of the TJTIME routine), and are computed every 25ns
of drift time. For each drift time, there are two possible positions in the
chamber, so four data words are stored for each word. This bank is generated
from the data in the {\bf TJCP} data bank in the TJTIMI routine.
The {\bf TJCT} data is actually a top level bank which contains 23 sub--banks,
one for each layer in the \jdc{}. The data in the TJCT bank is shown in
table~\ref{tab:TJCT}.
\begin{table}[htbp]\centering
\begin{tabular}{|c|c|l|} \hline
{\sc lq(--23)} & {\sc integer} & {\sl Pointer for layer 23} \\
$\vdots$ & $\vdots$ & $\vdots$ \\
{\sc lq(--1)} & {\sc integer} & {\sl Pointer for layer 1} \\ \hline
{\sc iq(+1) } & {\sc integer} & {\sl Number of entries for layer 1} \\
$\vdots$ & $\vdots$ & $\vdots$ \\
{\sc iq(+23)} & {\sc integer} & {\sl Number of entries for layer 23} \\ \hline
\end{tabular}
\caption[Data in the TJCT data bank.]{{\sf The pointers and data words in
the {\bf TJCT} data bank.}}
\label{tab:TJCT}
\end{table}
Once the pointer, $L$ and the number of entries, $N_{e}$ has been obtained
from the {\bf TJCT} bank, the data in the table can be accessed. The
storage locations of the data for each of the four quantities is shown in
table~\ref{tab:loca}.
\begin{table}[htbp]\centering
\begin{tabular}{|c|lr|} \hline
{\sl Quantity} & {\sl From} & {\sl To} \\ \hline
$x_{l}$ & $L+1$ & $L+N_{e}$ \\
$y_{l}$ & $L+N_{e}+1$ & $L+2N_{e}$ \\
$x_{r}$ & $L+2N_{e}+1$ & $L+3N_{e}$ \\
$y_{r}$ & $L+3N_{e}+1$ & $L+4N_{e}$ \\ \hline
\end{tabular}
\caption[The look--up table]{{\sf Storage of data in the Look--up table.}}
\label{tab:loca}
\end{table}
\subsubsection{TJRF}
This data bank contains reference conditions in the \jdc{}. The bank
is created at the same time the $r\phi$ calibration is performed.
The bank is filled with the averages and standard deviations of various
slow control data. The bank has 200 entries, of which the following
entries are filled.
\begin{tabbing}
\={\sl Offset} \= {\sc type} \= {\sl Quantity} \\
\> $+001$ \> {\sc integer} \> {\sl Calibration Date.} \\
\> $+002$ \> {\sc integer} \> {\sl Calibration Time.} \\
\> $+003$ \> {\sc real} \> {\sl JDC Set Voltage Chan. 1.} \\
\> $\vdots$ \\
\> $+034$ \> {\sc real} \> {\sl JDC Set Voltage Chan. 32.} \\
\> $+035$ \> {\sc real} \> {\sl Standard Deviation of Voltage 1.} \\
\> $\vdots$ \\
\> $+066$ \> {\sc real} \> {\sl Standard Deviation of Voltage 32.} \\
\> $+067$ \> {\sc real} \> {\sl JDC True Voltage Chan. 1.} \\
\> $\vdots$ \\
\> $+098$ \> {\sc real} \> {\sl JDC True Voltage Chan. 32.} \\
\> $+099$ \> {\sc real} \> {\sl Standard Deviation of Voltage 1.} \\
\> $\vdots$ \\
\> $+130$ \> {\sc real} \> {\sl Standard Deviation of Voltage 32.} \\
\> $+132$ \> {\sc real} \> {\sl JDC Isobutane Flow.} \\
\> $+133$ \> {\sc real} \> {\sl JDC CO2 Flow.} \\
\> $+134$ \> {\sc real} \> {\sl JDC Mixed Flow.} \\
\> $+137$ \> {\sc real} \> {\sl Standard Deviation of JDC Isobutane Flow.} \\
\> $+138$ \> {\sc real} \> {\sl Standard Deviation of JDC CO2 Flow.} \\
\> $+139$ \> {\sc real} \> {\sl Standard Deviation of JDC Mixed Flow.} \\
\> $+140$ \> {\sc real} \> {\sl HDC Potential Voltage.} \\
\> $+141$ \> {\sc real} \> {\sl HDC Grid Voltage.} \\
\> $+142$ \> {\sc real} \> {\sl HDC Drift Voltage.} \\
\> $+145$ \> {\sc real} \> {\sl Standard deviation of Potential Voltage.} \\
\> $+146$ \> {\sc real} \> {\sl Standard deviation of Grid Voltage.} \\
\> $+147$ \> {\sc real} \> {\sl Standard deviation of Drift Voltage.} \\
\> $+150$ \> {\sc real} \> {\sl HDC Drift Time 1.} \\
\> $+151$ \> {\sc real} \> {\sl HDC Drift Time 1 Sigma.} \\
\> $+152$ \> {\sc real} \> {\sl HDC Drift Time 2.} \\
\> $+153$ \> {\sc real} \> {\sl HDC Drift Time 2 Sigma.} \\
\> $+154$ \> {\sc real} \> {\sl HDC Drift Time Difference.} \\
\> $+155$ \> {\sc real} \> {\sl HDC Drift Time Difference Sigma.} \\
\> $+160$ \> {\sc real} \> {\sl Standard Deviation of Time 1.} \\
\> $+161$ \> {\sc real} \> {\sl Standard Deviation Time 1 Sigma.} \\
\> $+162$ \> {\sc real} \> {\sl Standard Deviation Time 2.} \\
\> $+163$ \> {\sc real} \> {\sl Standard Deviation Time 2 Sigma.} \\
\> $+164$ \> {\sc real} \> {\sl Standard Deviation Time Difference.} \\
\> $+165$ \> {\sc real} \> {\sl Standard Deviation Time Difference Sigma.} \\
\> $+170$ \> {\sc real} \> {\sl JDC Absolute Pressure.} \\
\> $+171$ \> {\sc real} \> {\sl JDC Differential Pressure.} \\
\> $+172$ \> {\sc real} \> {\sl Gas mixture as fraction Isobutane.} \\
\> $+175$ \> {\sc real} \> {\sl Standard Deviation JDC Pressure.} \\
\> $+176$ \> {\sc real} \> {\sl Standard Deviation JDC Diff. Pres.} \\
\> $+177$ \> {\sc real} \> {\sl Standard Deviation of mixture.} \\
\> $+180$ \> {\sc real} \> {\sl JDC Temperature 1 in Kelvins.} \\
\> $+181$ \> {\sc real} \> {\sl JDC Temperature 2 in Kelvins.} \\
\> $+182$ \> {\sc real} \> {\sl JDC Temperature 3 in Kelvins.} \\
\> $+183$ \> {\sc real} \> {\sl JDC Temperature 4 in Kelvins.} \\
\> $+184$ \> {\sc real} \> {\sl JDC Temperature in Kelvins.} \\
\> $+185$ \> {\sc real} \> {\sl Sigma in Temperature 1.} \\
\> $+186$ \> {\sc real} \> {\sl Sigma in Temperature 2.} \\
\> $+187$ \> {\sc real} \> {\sl Sigma in Temperature 3.} \\
\> $+188$ \> {\sc real} \> {\sl Sigma in Temperature 4.} \\
\> $+189$ \> {\sc real} \> {\sl Sigma in Temperature. } \\
\end{tabbing}
\subsubsection{TJST}
This data bank contains the stagger in centimeters of every wire in the
\jdc{}, $s^{i}$. It allows for the possibility that the position of some wires are
not within tolerance. The data is addressed in the same manner as the
{\bf TJCE} data bank.
\subsubsection{TJT0}
This bank contains the time offset to be used for every wire in the
\jdc{}. At present, the data is read in from unit 81 with the rest of
the gain information. If the information is not found in the file, then
the program takes the crate--wise values in the {\sc itfcrj} array
found in the {\sc /rjprms/} common block. These values can be forced
by using the {\bf ITFC} control card. If {\sc 17=1} is used on this
card, then the values from the common block are always used.
\subsubsection{TJWR}
This bank contains a coded list of wires which are found to have poor
z--resolution. The bank contains 23 unsigned integer words, one for each
layer in the \jdc{}. In each word, a bit corresponds to a sector in
the \jdc{}, (i.e. bit one to sector 1 and bit 30 to sector 30). If
a particular bit is set to one, then that wire should not be used.
At the start of analysis, this bank is unpacked into the {\sc /tjwire/}
common block, which is then used by the TJDCGT subroutine. During
normal analysis, the z--coordinate for these wires is assigned to
be zero, and the error in $z$ is set to 20 cm.
\subsubsection{TJZL}
This bank contains the length of each wire in the \jdc{}, $z_{l}^{i}$.
These are not necessarily the same for every wire as the position of the
electrical connection between the wire and crimp pins can vary by several
millimeters at both ends of the chamber. This data is addressed in the same
manner as in the previous bank.
\subsubsection{TJZ0}
This bank contains the z--position at the center of each sense wire,
($z_{l}/2$). This can also be different from zero for the same reasons as
with the previous data bank. As with the last bank, the addressing is as in
the {\bf TJCE} data bank.
\subsection{Monte Carlo data banks}
\subsubsection{RMCB}
The {\bf RMCB} data bank contains event information from GEANT.
This bank contains the GEANT {\bf JVERTEX} bank and the {\bf JKINE}
banks, which have been shunted to {\sc lq(l-1)} and {\sc lq(l-2)}
resectively. See the {\bf GEANT 3} manual for a better description.
\clearpage
\section{User Callable Routines}
\subsection{User Service Routines}
The following routines have been provided to allow the user easier access
to the data stored in the tracking data banks. It is of course possible,
and usually faster to explicitly access the data, however often the user
is interested in getting a hold of the data without actually knowing where
it is stored. For this reason, the following routines have been written.
The consist of two classes of routines; one which prints tracking data
to a specified logical unit, and one which returns fit information to the
user. Except in special cases, ( debug versions and calibration versions),
these routines are not actually called by any of the tracking software.
However, there use in USER routines is recommended to avoid errors in
addressing the bank structures. All of these routines are found in the
{\sc tc\_servc} patch in the {\sc locater} card file.
\subsubsection{SUBROUTINE BCLDD}
\begin{flushleft}
{\bf Author:} Brigitt Schmid \\
{\bf Creation Date:} May, 1990 \\
{\bf References:} \\
{\bf Call Arguments:} (NPED, *DY, *DCOVR, *IERR). \\
{\bf Common Blocks Used:} {\sc cbbank} and {\sc cblink}.\\
{\bf Subroutines Referenced:} None. \\
\end{flushleft}
This routine will extract the double precision 3--momentum, $(p_{x},
p_{y},p_{z})$, and the 3 by 3 covariance matrix for ped number
{\sc nped}. The momentum is returned in the vector {\sc dy}, and
the covariance matrix is returned in the 3 by 3 array {\sc dcovr}.
The value of {\sc ierr} is returned as zero upon successful completion.
For single precision values, consult the BCLDS subroutine. It is
important to observe that the 3 by 3 covariance matrix is not
diagonal in the these coordinates. In order for the TCKFT3 and TCKFT4
routines to work, it is necessary to load the photons using this
routine.
\subsubsection{SUBROUTINE BCLDS}
\begin{flushleft}
{\bf Author:} Brigitt Schmid \\
{\bf Creation Date:} May, 1990 \\
{\bf References:} \\
{\bf Call Arguments:} (NPED, *SY, *SCOVR, *IERR). \\
{\bf Common Blocks Used:} {\sc cbbank} and {\sc cblink}.\\
{\bf Subroutines Referenced:} None. \\
\end{flushleft}
This is just a single precision entry point to the BCLDD routine.
Consult the BCLDD routine for a description.
\subsubsection{SUBROUTINE CJOORD}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 15 January, 1989 \\
{\bf References:} \\
{\bf Call Arguments:} (ITRK, *NPTS, *ISEC, *ILYR, *ISID, *TIME, *XTJ,
*YTJ, *XTC, *YTC). \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink} and {\sc tcprms}. \\
{\bf Subroutines Referenced:} None. \\
\end{flushleft}
This routine will return the sector number, layer number, resolution
code, drift time, $x$ and $y$ coordinates from the {\bf TJDC} bank,
and $x$ and $y$ coordinates from the {\bf TCHT} data bank for the
{\sc npts} points in track number {\sc itrk}.
\subsubsection{SUBROUTINE RJRJDC}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 15 January, 1989 \\
{\bf References:} \\
{\bf Call Arguments:} (LUN). \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink}. \\
{\bf Subroutines Referenced:} None. \\
\end{flushleft}
Print the contents of the {\bf RJDC} data bank on unit {\sc lun}.
\subsubsection{SUBROUTINE RJRJDF}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 20 May, 1989 \\
{\bf References:} \\
{\bf Call Arguments:} (LUN). \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink}. \\
{\bf Subroutines Referenced:} None. \\
\end{flushleft}
Print the contents of the {\bf RJDF} data bank on unit {\sc lun}.
\subsubsection{SUBROUTINE RPRPWC}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 15 January, 1989 \\
{\bf References:} \\
{\bf Call Arguments:} (LUN). \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink}. \\
{\bf Subroutines Referenced:} None. \\
\end{flushleft}
Print the contents of the {\bf RPWC} data bank on unit {\sc lun}.
\subsubsection{SUBROUTINE RJTJDC}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 25 May, 1989 \\
{\bf References:} \\
{\bf Call Arguments:} (LUN). \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink}. \\
{\bf Subroutines Referenced:} None. \\
\end{flushleft}
This routine will print only the information found in the {\bf RJDC}
data bank, but the information will be taken from the {\bf TJDC} data
bank, rather than the {\bf RJDC} bank. This has the advantage that the
information will be sorted by sector and layer number. All information
will be printed to logical unit {\sc lun}.
\subsubsection{SUBROUTINE TCBARL}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 26 April, 1989 \\
{\bf References:} \\
{\bf Call Arguments:} (*NTRKS, *IFLAG, *XTRK, *YTRK, *ZTRK). \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink}. \\
{\bf Subroutines Referenced:} None. \\
\end{flushleft}
This routine will return the intersection point, ($x$,$y$,$z$) of every
track in the {\bf TCTR} bank. {\sc ntrks} is the number of tracks, and
the three vectors contain the coordinates of each of the {\sc ntrks}
tracks. The returned value of IFLAG indicates if it is safe to use this
projection. A value of zero means it is good, and any other value is
at the users own risk.
\subsubsection{SUBROUTINE TCBARX}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 15 March, 1990 \\
{\bf References:} \\
{\bf Call Arguments:} (*NTRKS, *IFLAG, *XTRK, *YTRK, *ZTRK, *DXTRK,
*DYTRK, *DZTRK). \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink}. \\
{\bf Subroutines Referenced:} None. \\
\end{flushleft}
This routine will return the intersection point, ($x$,$y$,$z$) of every
track in the {\bf TCTR} bank with the barrel. It also returns a direction
vector at the intersection point, ($dx/dr$,$dy/dr$,$dz/dr$). {\sc ntrks} is
the number of tracks in the helix bank, and the three vectors contain the
coordinates of each of the {\sc ntrks} tracks. The returned value of IFLAG
indicates if it is safe to use this projection. A value of zero means it is
good, and any other value is at the users own risk.
\subsubsection{SUBROUTINE TCHLDD}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 21 April, 1990 \\
{\bf References:} \\
{\bf Call Arguments:} (ITRK, *PMOM, *COVR, *IERR). \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink} and {\sc tcprms}. \\
{\bf Subroutines Referenced:} None. \\
\end{flushleft}
This subroutine will compute the momentum vector, {\sc pmom} as
$(p_{x},p_{y},p_{z})$ and the three by three covariance matrix for
the momentum, {\sc covr} for track number {\sc itrk} as stored in the
{\bf TCTR} data bank. If the routine is unable to compute these, then
the value of {\sc ierr} is returned as one; successful completion has
{\sc ierr} of zero. The returned values of {\sc pmom} and {\sc covr}
are double precision. For single precision values, see the TCHLDS
subroutine.
\subsubsection{SUBROUTINE TCHLDS}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 21 April, 1990 \\
{\bf References:} \\
{\bf Call Arguments:} (ITRK, *PMOM, *COVR, *IERR). \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink} and {\sc tcprms}.\\
{\bf Subroutines Referenced:} None. \\
\end{flushleft}
This subroutine will compute the momentum vector, {\sc pmom} as
$(p_{x},p_{y},p_{z})$ and the three by three covariance matrix for
the momentum, {\sc covr} for track number {\sc itrk} as stored in the
{\bf TCTR} data bank. If the routine is unable to compute these, then
the value of {\sc ierr} is returned as one; successful completion has
{\sc ierr} of zero. The returned values of {\sc pmom} and {\sc covr}
are single precison. For double precision values, see the TCHLDD
subroutine. (Note, this is not a separate subroutine, but rather an
entry point to the TCHLDD subroutine.)
\subsubsection{SUBROUTINE TCKFT3}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer \\
{\bf Creation Date:} 20 April, 1990.\\
{\bf References:} \\
{\bf Call Arguments:} (NPART, PMOM, COVR, *CHISQ, *CHI, *IERR).\\
{\bf Common Blocks Used:} None. \\
{\bf Subroutines Referenced:} {\sc cernlib}: {\sc matin2}. \\
\end{flushleft}
This subroutine will perform a kinematic fit to the constraints of
three-momentum balance for the {\sc npart} particles whose three
momentum, $(p_{x},p_{y},p_{z})$ are passed in the {\sc pmom} array,
and whose three by three covariance matricies are passed in the
{\sc covr} array. Internally, {\sc pmom} and {\sc covr} are dimensioned
as:
\begin{verbatim}
REAL PMOM(3,NPART),COVR(3,3,NPART),CHI(NPART)
\end{verbatim}
The routine will return the improved values of momentum in the
{\sc pmom} variable, the $\chi^{2}$ for three degrees of freedom
in the variable {\sc chisq}, the contribution to {\sc chisq} from
each of the {\sc npart} particles in the {\sc chi} array, and an
error code {\sc ierr}. If {\sc ierr} is not reurned as zero, then
the fit has failed.
The routine uses the following three equations of constraint:
\begin{eqnarray*}
0 &=& \sum_{i=1}^{n} p_{x_{i}} \\
0 &=& \sum_{i=1}^{n} p_{y_{i}} \\
0 &=& \sum_{i=1}^{n} p_{z_{i}} \\
\end{eqnarray*}
and does a kinematic fit to the momentum using the passed covariance
matricies. The passed variables are all single precision, but internally,
the routine works in double precision. Note that because this problem
is linear, only one iteration is performed.
\subsubsection{SUBROUTINE TCKFT4}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer \\
{\bf Creation Date:} 20 April, 1990.\\
{\bf References:} \\
{\bf Call Arguments:} (NPART, PMOM, COVR, MASS, *CHISQ, *CHI, *IERR).\\
{\bf Common Blocks Used:} None. \\
{\bf Subroutines Referenced:} {\sc cernlib}: {\sc dinv}. \\
\end{flushleft}
This subroutine will perform a kinematic fit to the constraints of
three-momentum and energy balance for the {\sc npart} particles whose three
momentum, $(p_{x},p_{y},p_{z})$ are passed in the {\sc pmom} array,
whose three by three covariance matricies are passed in the
{\sc covr} array and whose masses are passed in the {\sc mass} array,
(dimensions of MeV/c$^{2}$).
Internally, the passed variables are dimensioned as:
\begin{verbatim}
REAL PMOM(3,NPART),COVR(3,3,NPART),MASS(NPART),CHI(NPART)
\end{verbatim}
The routine will return the improved values of momentum in the
{\sc pmom} variable, the $\chi^{2}$ for four degrees of freedom
in the variable {\sc chisq}, the contribution to {\sc chisq} from
each of the {\sc npart} particles in the {\sc chi} array, and an
error code {\sc ierr}. If {\sc ierr} is not reurned as zero, then
the fit has failed. The value of {\sc ierr} then indicates the
reason for failure as follows.
\begin{itemize}
\item {\sc ierr=--1} Loading problem, (more than twenty tracks).
\item {\sc ierr=0} Successful completion.
\item {\sc ierr=3} Iterative procedure diverged.
\item {\sc ierr=5} Iteration limit, (10) exceeded.
\item {\sc ierr=7} Attempted to invert a singular matrix.
\end{itemize}
The routine uses the follwoing three equations of constraint:
\begin{eqnarray*}
0 &=& \sum_{i=1}^{n} p_{x_{i}} \\
0 &=& \sum_{i=1}^{n} p_{y_{i}} \\
0 &=& \sum_{i=1}^{n} p_{z_{i}} \\
0 &=& -2\cdot m_{p} + \sum_{i=1}^{n}\sqrt{p_{x_{i}}^{2} +
p_{y_{i}}^{2} + p_{z_{i}}^{2} + m_{i}^{2}} \\
\end{eqnarray*}
and does a kinematic fit to the momentum using the passed covariance
matricies. The passed variables are all single precision, but internally
all computations are done in double precision.
An example for loading the data for a four prong event at vertex number
1, and two photons from {\sc ped} numbers 7 and 8 is as follows. For
two prong data, or if you want to take the helix bank momentum rather
than the vertex bank, replace the call to TCVLDS with one to
TCVHLS.
\begin{verbatim}
*
INTEGER NTRK,ICODE(20),IERR
REAL CHRG(20),PMOM(3,20),COVR(3,3,20),MASS(20),CHI(20),CHISQ
*
REAL MPI
PARAMETER (MPI=139.5673)
*
* Load the particles at the vertex using TCVLDS, then make sure
* that the vertex and tracks are ok.
*
CALL TCVLDS(1,NTRK,ICODE,CHRG,PMOM,COVR,IERR)
IF(IERR .NE. 0 .OR. NTRK .NE. 4) GOTO 5000
MASS(1) = MPI
MASS(2) = MPI
MASS(3) = MPI
MASS(4) = MPI
NTRK = NTRK + 1
*
* Load the two PEDs using the BCLDS routine. Then make sure
* that they are correctly loaded.
*
CALL BCLDS(7,PMOM(1,NTRK),COVR(1,1,NTRK),IERR)
IF(IERR .NE. 0) GOTO 5000
MASS(NTRK) = 0.0
NTRK = NTRK + 1
CALL BCLDS(8,PMOM(1,NTRK),COVR(1,1,NTRK),IERR)
IF(IERR .NE. 0) GOTO 5000
MASS(NTRK) = 0.0
*
* Perform the kinematic fit using the loaded data.
*
CALL TCKFT4(NTRK,PMOM,COVR,MASS,CHISQ,CHI,IERR)
*
\end{verbatim}
\subsubsection{SUBROUTINE TCOORD}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 19 December, 1988 \\
{\bf References:} \\
{\bf Call Arguments:} (ICODE, ITRK, *NPTS, *X1, *X2, *X3). \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink}, {\sc tcprms},
and {\sc tcangl}. \\
{\bf Subroutines Referenced:} None. \\
\end{flushleft}
This routine will return the $(x,y,z)$ coordinates of all hits in the
specified track, or all found vertices. The call argument {\sc icode}
determines what is returned as described below, while the argument
{\sc itrk} specifies which track to examine. The returned information
consists of the number of returned data points, {\sc npts}, and three
coordinates for each point given in {\sc x1}, {\sc x2} and {\sc x3}.
The returned values are specified as follows by {\sc icode}.
\begin{itemize}
\item {\sc icode}=0 The routine returns the coordinates $(x_{l},y_{l}.z)$
for all points along the track. Where $x_{l}$ and $y_{l}$ are the left
side resolution of every point on the track. These points are returned
in CB--coordinates with units of [cm], however these are not necessarily
the points chosen.
\item {\sc icode}=1 The routine returns the coordinates $(x_{r},y_{r}.z)$
for all points along the track. Where $x_{r}$ and $y_{r}$ are the right
side resolution of every point on the track. These points are returned
in CB--coordinates with units of [cm], however these are not necessarily
the points chosen.
\item {\sc icode}=2 The routine returns the chosen coordinates $(x,y,z)$
along the track in CB--coordinates as taken from the {\bf TCHT} data bank.
\item {\sc icode}=3 The routine returns the chosen coordinates $(r,\phi,z)$
along the track in CB--coordinates as taken from the {\bf TCHT} data bank.
\item {\sc icode}=4 The routine returns the chosen coordinates $(x,y,z)$
along the track in CB--coordinates as taken from the {\bf TCTR} data bank.
\item {\sc icode}=5 The routine returns the coordinates of all found
vertices as $(x,z,y)$. These data are taken from the {\bf TCVX} bank.
\end{itemize}
\subsubsection{SUBROUTINE TCPRNT}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 30 June, 1988 \\
{\bf References:} \\
{\bf Call Arguments:} (LUN, IOPT). \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink}, {\sc cbhead} and
{\sc tcprms}.\\
{\bf Subroutines Referenced:} None. \\
\end{flushleft}
This routine prints out tracking results to logical unit {\sc lun},
(the log file). The printing is controlled through the passed variable
{\sc iopt}, and is given as follows.
\begin{itemize}
\item {\sc iopt}=0 Print the Monte Carlo data if available.
\item {\sc iopt}=1 The results of TCFITR and TCTHET as stored in the
{\bf TCTK} data bank are printed out.
\item {\sc iopt}=2 The results of TCHELX as stored in the
{\bf TCTR} data bank are printed.
\item {\sc iopt}=3 The results of TCVERT as stored in the {\bf TCVX}
data bank are printed.
\end{itemize}
\subsubsection{SUBROUTINE TCRHIT}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 3 March, 1989 \\
{\bf References:} \\
{\bf Call Arguments:} (ITRK, *NPTS, *ISEC, *ILYR, *IRES, *TIME, *ALFT,
*ARGT, *DEDX, *NTCHT). \\
{\bf Common Blocks Used:} {\sc cbbank} and {\sc cblink}. \\
{\bf Subroutines Referenced:} None. \\
\end{flushleft}
This routine will return the raw hit information on track {\sc itrk}.
The returned variables have the following meanings.
\begin{itemize}
\item {\sc npts} is the number of hits in the track.
\item {\sc isec(50)} is the sector number of each hit.
\item {\sc ilyr(50)} is the layer number of each hit.
\item {\sc ires(50)} is the resolution code of each hit, (left/right).
\item {\sc time(50)} is the drift time of each hit.
\item {\sc alft(50)} is the $+z$ amplitude of each hit.
\item {\sc argt(50)} is the $-z$ amplitude of each hit.
\item {\sc dedx(50)} is the $dE/dx$ of each hit.
\item {\sc ntcht(50)} is the address in the {\bf TCHT} bank for each
hit.
\end{itemize}
\subsubsection{SUBROUTINE TCRSLT}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 21 March, 1989 \\
{\bf References:} \\
{\bf Call Arguments:} (ICODE, ITRK, *CHRG, *XVEC, *PVEC, *COVR, *SIGP, *IERR).\\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink} and {\sc tcprms}. \\
{\bf Subroutines Referenced:} None. \\
\end{flushleft}
This routine will return information about fit tracks. The passed variable
{\sc icode} identifies if {\em circle} or {\em helix} fit results are
desired. The variable {\sc itrk} specifies the number of the fit track.
If {\sc icode} is zero, then track data from the {\bf TCTK} data banks
are returned, while for {\sc icode} of one, data from the {\bf TCTR} banks
are returned. The returned variables are as follows.
\begin{description}
\item[{\sc chrg}] is returned as the charge of the particle.
\item[{\sc xvec}] is a vector containing five entries. The have the following
meanings. See bank descriptions for {\bf TCTK} and {\bf TCTR} for clarification
of the variables.
\begin{itemize}
\item[{\sc xvec(1)}] {\sc icode=0}, $q\cdot R$ ; {\sc icode=1} $r_{0}$.
\item[{\sc xvec(2)}] {\sc icode=0}, $\psi_{0}$ ; {\sc icode=1} $z_{0}$.
\item[{\sc xvec(3)}] {\sc icode=0}, $c^{2}$ ; {\sc icode=1} $\alpha$.
\item[{\sc xvec(4)}] {\sc icode=0}, $\tan\lambda$ ; {\sc icode=1} $\tan\lambda$.
\item[{\sc xvec(5)}] {\sc icode=0}, $a_{0}$ ; {\sc icode=1} $\psi_{0}$.
\end{itemize}
\item[{\sc pvec}] is a vector containing three entries. They have the
following values:
\begin{itemize}
\item[{\sc pvec(1)}] $p_{\perp}$, the transverse momentum, [MeV/c].
\item[{\sc pvec(2)}] $\psi_{0}$, the direction angle in the $r-\phi$ plane.
\item[{\sc pvec(3)}] $p_{\parallel}$, the longitudinal momentum, [MeV/c].
\end{itemize}
\item[{\sc covr}] is a five by five array which contains the covariance matrix
for {\sc xvec}.
\item[{\sc sigp}] is a vector of length three containing the $1\sigma$ errors
for {\sc pvec}.
\item[{\sc ierr}] is the error code associated with the track fit.
\end{description}
\subsubsection{SUBROUTINE TCTCHT}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 15 January, 1989 \\
{\bf References:} \\
{\bf Call Arguments:} (LUN). \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink}. \\
{\bf Subroutines Referenced:} None. \\
\end{flushleft}
Print the contents of the {\bf TCHT} data bank on unit {\sc lun}.
\subsubsection{SUBROUTINE TCVERS}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 21 March, 1989 \\
{\bf References:} \\
{\bf Call Arguments:} (LUN, *IVERS). \\
{\bf Common Blocks Used:} None. \\
{\bf Subroutines Referenced:} None. \\
\end{flushleft}
This subroutine identified the present version number of locater. If
the value of {\sc lun} is given as a positive number, then the version
information will be printed on logical unit {\sc lun}. In all cases
the returned value of IVERS is the integer form of the version number.
For {\sc locater} version {\sl 1.44/01}, the returned version number is
{\sl 14401}. This number is stored in the {\bf HTJD} bank during tracking.
In order to determine under which version data was track, use the
following code.
\begin{verbatim}
*
IVERS = IQ(LHTJD+1)
IDATE = IQ(LHTJD+2)
ITIME = IQ(LHTJD+3)
*
\end{verbatim}
\subsubsection{SUBROUTINE TCVHLD}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 19 September, 1990 \\
{\bf References:} \\
{\bf Call Arguments:} (IVRT, *NTRK, *ICODE, *CHRG, *PMOM, *COVR, *IERR,
LONGT). \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink} and {\sc tcprms}. \\
{\bf Subroutines Referenced:} TCHLDS. \\
\end{flushleft}
This subroutine will compute the momentum vector, {\sc pmom} as
$(p_{x},p_{y},p_{z})$ and the three by three covariance matrix for
the momentum, {\sc covr} for all tracks connected to vertex {\sc ivrt}.
The number of tracks is returned as {\sc ntrk}, the vertex quality word
is returned as {\sc icode}, and the charge is returned as {\sc chrg}.
The data is taken from the {\bf TCTR} data bank using the only the
tracks connected to the vertex.. If the routine is unable
to compute these, then the value of {\sc ierr} is returned as -1; otherwise
the error code is set bitwise with the following meanings:
\begin{itemize}
\item[Bit 0] Set if the charge sum is not zero.
\item[Bit 1] Set if all tracks are not long.
\item[Bit 2] Set if a track error codes is not good.
\item[Bit 3] Set if a track starts outside layer 5.
\item[Bit 4] Set if the vertex fit is poor.
\end{itemize}
The returned values of {\sc pmom} and {\sc covr} are double precison.
The user can specify the minimum track length as {\sc longt}.
For single precision values, see the TCVLDS subroutine.
\subsubsection{SUBROUTINE TCVHLS}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 18 September, 1990 \\
{\bf References:} \\
{\bf Call Arguments:} (IVRT, *ICODE, *NTRK, *CHRG, *PMON, *COVR, *IERR,
LONGT). \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink} and {\sc tcprms}.\\
{\bf Subroutines Referenced:} TCHLDS. \\
\end{flushleft}
This routine is identical to TCVHLD, except that it returns single precision
arguments. See the TCVHLD routine for a description.
\subsubsection{SUBROUTINE TCVLDD}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 21 April, 1990 \\
{\bf References:} \\
{\bf Call Arguments:} (IVRT, *NTRK, *ICODE, *CHRG, *PMOM, *COVR, *IERR,
LONGT). \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink} and {\sc tcprms}. \\
{\bf Subroutines Referenced:} None. \\
\end{flushleft}
This subroutine will compute the momentum vector, {\sc pmom} as
$(p_{x},p_{y},p_{z})$ and the three by three covariance matrix for
the momentum, {\sc covr} for all tracks connected to vertex {\sc ivrt}.
The number of tracks is returned as {\sc ntrk}, the vertex quality word
is returned as {\sc icode}, and the charge is returned as {\sc chrg}.
The data is taken from the {\bf TCVT} data bank. If the routine is unable
to compute these, then the value of {\sc ierr} is returned as -1; otherwise
the error code is set bitwise with the following meanings:
\begin{itemize}
\item[Bit 0] Set if the charge sum is not zero.
\item[Bit 1] Set if all tracks are not long.
\item[Bit 2] Set if a track error codes is not good.
\item[Bit 3] Set if a track starts outside layer 5.
\item[Bit 4] Set if the vertex fit is poor.
\end{itemize}
The returned values of {\sc pmom} and {\sc covr} are double precison.
The user can specify the minimum track length as {\sc longt}.
For single precision values, see the TCVLDS subroutine.
\subsubsection{SUBROUTINE TCVLDS}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 21 April, 1990 \\
{\bf References:} \\
{\bf Call Arguments:} (IVRT, *ICODE, *NTRK, *CHRG, *PMON, *COVR, *IERR,
LONGT). \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink} and {\sc tcprms}.\\
{\bf Subroutines Referenced:} None. \\
\end{flushleft}
This routine is identical to TCVLDD, except that it returns single precision
arguments. See the TCVLDD routine for a description.
\subsubsection{SUBROUTINE TJTJDC}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 15 January, 1989 \\
{\bf References:} \\
{\bf Call Arguments:} (LUN). \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink}. \\
{\bf Subroutines Referenced:} None. \\
\end{flushleft}
Print the contents of the {\bf TJDC} data bank to unit {\sc lun}.
\subsubsection{SUBROUTINE TPTPWC}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 15 January, 1989 \\
{\bf References:} \\
{\bf Call Arguments:} (LUN). \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink}. \\
{\bf Subroutines Referenced:} None. \\
\end{flushleft}
Print the contents of the {\bf TPWC} data bank on unit {\sc lun}.
\subsection{Utility Routines}
All of these routines are found in the {\sc tc\_util} patch in the
{\sc locater} card file. Most of these routines are called directly
by {\sc locater}. However, they could also be useful to users of the
code.
\subsubsection{FUNCTION KRATE}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 12 April, 1990. \\
{\bf References:} \\
{\bf Call Arguments:} ( ISEC, ILYR). \\
{\bf Common Blocks Used:} None.\\
{\bf Called by:} {\sc rjproc}.\\
{\bf Subroutines Referenced:} None.\\
\end{flushleft}
Given a wire described by sector {\sc isec} and layer {\sc ilyr}, this
function will compute the FADC crate number in which the wire's data
is processed. The allowed numbers are 1 to 16. A value of 0 is returned
for nonsensical layer or sector numbers.
\subsubsection{SUBROUTINE SM353}
\begin{flushleft}
{\bf Author:} \\
{\bf Creation Date:} \\
{\bf References:} \\
{\bf Call Arguments:} (Y, Z, N). \\
{\bf Common Blocks Used:} None.\\
{\bf Called by:} \\
{\bf Subroutines Referenced:} None.\\
\end{flushleft}
This routine will smooth data using the 3G53CQH method. The data are
passed as an array {\sc y} containing {\sc n} points. The smoothed data
is returned in the array {\sc z}. {\sc y} and {\sc z} can be the same array.
\subsubsection{SUBROUTINE SORTIL}
\begin{flushleft}
{\bf Author:} \\
{\bf Creation Date:} \\
{\bf References:} \\
{\bf Call Arguments:} (A, IDX, N). \\
{\bf Common Blocks Used:} None.\\
{\bf Called by:} {\sc tjdcgt}. \\
{\bf Subroutines Referenced:} None.\\
\end{flushleft}
This subroutine will sort a list of integer from smallest to
largest. The numbers are given in {\sc a},
and a set of indices given in {\sc idx}. There are {\sc n} elements
in the list. If the value of {\sc n} is negative, then the routine
creates the index list.
\subsubsection{SUBROUTINE SORTFL}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} . \\
{\bf References:} \\
{\bf Call Arguments:} (A, IDX, N) \\
{\bf Common Blocks Used:} None.\\
{\bf Called by:} \\
{\bf Subroutines Referenced:} None.\\
\end{flushleft}
This routine is identical to SORTIL, except that it sorts a list of real
numbers, rather than integers.
\subsubsection{SUBROUTINE SRTREE}
\begin{flushleft}
{\bf Author:} Brigitt Schmid and Curtis A. Meyer\\
{\bf Creation Date:} 01 Jun2, 1990. \\
{\bf References:} \\
{\bf Call Arguments:} (DIST, LIST, N, *NRED, *INDX) \\
{\bf Common Blocks Used:} None.\\
{\bf Called by:} \\
{\bf Subroutines Referenced:} None.\\
\end{flushleft}
Given a list of {\sc n} pairs of numbers, {\sc list(2,n)}, and a distance
{\sc dist(n)} corresponding to each pair, this routine will find the
minimum spanning set over all the data. The value of {\sc nred} will
be returned as the number of reduced pairs, and the array {\sc indx}
will contain a pointer to the original two lists for each pair
chosen.
As an example, consider the problem of making $\pi^{0}$'s and
$\eta$'s from a list of photons. To be specific, consider a system
containing four photons. From these four photons, there are six
ways to form $\pi^{0}$'s and six ways to form $\eta$'s. The problem is
then what is the most likely combination. If we then compute the
probability $P_{i}$ for each of these 12 combinations, and then define the
distance as $D_{i} = 1-P_{i}$, the routine SRTREE will return INDX
pointing to the two combinations that should be taken to maximize
the probability. In using this routine, it is most important to get the
errors on the invariant massed correct. A suggested error for
a $\pi^{0}$ invariant mass is:
\[ {\scriptstyle error = min\left(4\sigma \left[ \pi^{0} width \right] ,
max\left( 1\sigma \left[ \pi^{0} width \right] ,
\sigma_{m_{\gamma\gamma}}\right) \right) } \]
\clearpage
\section{Chamber Reconstruction Software}
This chapter describes the software normally used to analyze the
chamber data in the experiment. This chapter is divided into several
subsections, each dealing with a particular section of the code. The
first is an overview of all the common blocks used in this code, and
a description of their contents. The remaining sections describe the
various sections of the code, and contain a {\em flow diagram} of the
calling sequence in that particular section. The code itself has been
broken into the following sections: General Routines, Raw Data Processing,
Pattern Recognition, Circle Fitting and Helix/Vertex Fitting.
The descriptions found here are essentially those found in the
header blocks of each program. In all of the subroutines described
here, an asterisk, (*) in front of a call argument's name means that
its value is returned by the subroutine. Also, all variable types
conform to fortran defaults unless specifically mentioned.
\subsection{Description of the Chamber Reconstruction Common Blocks}
Here is contained a description of the common blocks used in the tracking
program. In order to include one of these is a subroutine, use the
{\sc patchy} command {\sc +cde,}{\em name}. Where {\em name} is the
six character name of the common block.
\subsubsection{LGHOLD}
The variables in this common block are set to {\sc .true.} if the
user wants to prevent the data base from overwriting input
constants.
\begin{verbatim}
LOGICAL ANGLLG,BMAGLG,IAMPLG,ITFCLG,OPWCLG
LOGICAL ZOFFLG,WIRELG
COMMON /LGHOLD/ ANGLLG,BMAGLG,IAMPLG,ITFCLG,OPWCLG
& ,ZOFFLG,WIRELG
SAVE /LGHOLD/
\end{verbatim}
\begin{itemize}
\item {\sc angllg}
\item {\sc bmaglg}
\item {\sc iamplg}
\item {\sc itfclg}
\item {\sc opwclg}
\item {\sc zofflg}
\item {\sc wirelg}
\end{itemize}
\subsubsection{RJDATA}
The {\sc /rjdata/} common block is used to convert the {\bf RJDF}
hit information into {\bf RJDC} format. It is used in the RJPROC,
RJPULS, and RJAFIT routines, and is not meaningful outside of those
routines. At most four hits per pulse are
allowed. Hit number zero and hit number five are only used for bookkeeping;
hit zero refers to the start of the pulse, and hit five refers to the end
of the pulse.
\begin{verbatim}
INTEGER NCHARJ,ITOFRJ,INTGRJ,ILPDRJ,IRPDRJ
INTEGER MINPRJ(0:5,2),MAXPRJ(0:5,2)
INTEGER IENDRJ(0:5,2),IDTIRJ(0:5,2)
COMMON /RJDATA/ NCHARJ,ITOFRJ,INTGRJ,ILPDRJ,IRPDRJ,
& MINPRJ,MAXPRJ,IENDRJ,IDTIRJ
\end{verbatim}
\begin{itemize}
\item {\sc ncharj} is the number of FADC channels in the pulse.
\item {\sc itofrj} is the time offset to the beginning of the pulse, (in
FADC channels).
\item {\sc intgrj} is the integration time in FADC channels.
\item {\sc ilpdrj} is the left pedestal, (linearized and times ten).
\item {\sc irpdrj} is the right pedestal, (linearized and times ten).
\item {\sc minprj} is the start position of all hits found in the pulse.
\item {\sc maxprj} is the end position of all hits found in the pulse.
\item {\sc iendrj} is the bin at the end of each hit.
\item {\sc idtirj} is the fit drift time of each hit.
{\sc ipulrj}.
\end{itemize}
\subsubsection{RJPRMS}
The {\sc /rjprms/} common block contains parameters used in the routines
which process the {\bf RJDF} data banks, (RJPROC, RJPULS, RJTFIT and
RJAFIT). All the parameters in this bank can be changed during calibration
with a card in the CJINIT routine, (see CJINIT).
\begin{verbatim}
LOGICAL LGT0RJ,LGPDRJ,LGRJDD,LGRJDF
INTEGER NPULRJ,ITMIRJ,ITIMRJ,MXPLRJ,ITFCRJ(16)
COMMON /RJPRMS/ LGT0RJ,LGPDRJ,LGRJDD,LGRJDF
& ,NPULRJ,ITMIRJ,ITIMRJ,MXPLRJ,ITFCRJ
\end{verbatim}
\begin{itemize}
\item {\sc lgt0rj} Identify if $t_{0}$ subtraction is done in RJPROC.
\item {\sc lgpdrj} Identify if dynamic pedestal calculation is done in
RJPROC.
\item {\sc lgrjdd} Take online processed data if it exists.
\item {\sc lgrjdf} Perform Qt-analysis on the raw \jdc{} pulses. Ignore
any existing online processed data.
\item {\sc npulrj} Minimum pulse height above the height at the pulse
start for a pulse in the {\bf RJDF} bank. It
has a default value of 5, but can be changed using the {\bf NPUL} card.
\item {\sc itmirj} Minimum time separation between two pulses in RJPULS. It has
a default value of 100ns, but can be changed using the {\bf ITMI} card.
\item {\sc itimrj} Integration time in the RJAFIT routine. It has a default
value of 40 FADC channels, but can be changed using the {\bf INTG} card.
\item {\sc mxplrj} The maximum time difference between the left and right
channel in order to accept the two pulses as one. It has a default value
of 25ns, but can be changed using the {\bf MXPL} card.
\item {\sc itfcrj} Is a $t_{0}$ offset subtracted from the fit pulse time
in the RJPROC routine. It has a nominal value set for the December, 1989
data set, but can be changed with the {\bf ITFC} card. It is given
in units of 200ps. This time offset is a function of the FADC crate
number, (0-16).
\end{itemize}
\subsubsection{TCANGL}
The {\sc /tcangl/} common block contains the double precision sines
and cosines of all hits incorporated into tracks. These are stored
in order to reduce computation time in the circle fit, (routine
TCITER).
\begin{verbatim}
DOUBLE PRECISION SINTTC(50),COSTTC(50),RDEVTC(50),CHISTC(50)
COMMON /TCANGL/ SINTTC,COSTTC,RDEVTC,CHISTC
SAVE /TCANGL/
\end{verbatim}
\begin{itemize}
\item {\sc sinttc} contains $\sin\phi_{i}$ for each of up to 50 points
in the present track. Its values are loaded in the TCLOAD routine.
\item {\sc costtc} contains $\cos\phi_{i}$ for each of up to 50 points
in the present track. Its values are loaded in the TCLOAD routine.
\item {\sc rdevtc} contains the deviation of the measured points from
the circle fit, (units of cm) for the fit track. Its values are set
in the TCITER routine.
\item {\sc chistc} is the contribution to $\chi^{2}$ of each point
along the track. This is filled in the TCITER routine.
\end{itemize}
\subsubsection{TCCUTS}
The {\sc /tccuts/} common block contains all the cuts used throughout
the charged tracking code. They are all initialized in
the TCINIT routine.
\begin{verbatim}
INTEGER NITRTC,NHLXTC,NVTXTC,LYVXTC
REAL CXSQTC,CLMBTC,XSQRTC,DXSQTC
REAL TIMETC(23),RSLVTC,CHCTTC
REAL VPRBTC,VFRCTC,ZVTXTC
DOUBLE PRECISION CCUTTC,CHDSTC,CHLXTC,CVXCTC
COMMON /TCCUTS/ CCUTTC,CHDSTC,CHLXTC,CVXCTC,
& CXSQTC,CLMBTC,XSQRTC,DXSQTC,TIMETC,CHCTTC,
& NITRTC,NHLXTC,NVTXTC,LYVXTC,RSLVTC,
& VPRBTC,VFRCTC,ZVTXTC
SAVE /TCCUTS/
\end{verbatim}
\begin{itemize}
\item {\sc cxsqtc} is a chisquare cut used in the TCSGMT routine
a a measure of track closeness in $dy/dr$. It has a default value
of 1.75, and can be altered using the {\bf CXSQ} card.
\item {\sc clmbtc} is chisquare cut for associating tracks in
$\tan\lambda$. It is used in the TCSGMT routine for putting
the segments together, and in the TCROSS routine for associating
tracks in different sectors. Its nominal value is 1.70 which can
be changed using the {\bf CLMB} card.
\item {\sc xsqrtc} is a $\chi^{2}$ cut for connecting points in the
{\sc jdc}. It is used in the TCFSRC and TCRSRC routines. Its nominal
value is $0.050 [cm^{2}]$, it can be changed using the {\bf XSQR} card.
\item {\sc dxsqtc} is a cut used in the TCFSRC and TCRSRC subroutines to
determine if a track has crossed the wire plane. It is the difference
between the left and right $\chi^{2}$, and has a nominal value
of 0.01. It can be changed during calibration using the {\bf DXSQ} card.
\item {\sc timetc} is an array containing the minimum time in each
{\sc jdc} layer a hit can have, and still be matched with a hit in
the adjacent sector. This cut is used in the TCROSS routine.
\item {\sc nitrtc} is the maximum number of iterations in TCITER.
Its nominal value is 10, which can be altered with the {\bf NITR} card.
\item {\sc ccuttc} is used to decide if a track is well fit in the
TCITER routine. If the track has converged, and the last variation in
the first fit parameter is larger than 0.10, then the value of $\chi^{2}$
must be smaller than {\sc ccuttc} times the number of points in the track.
This has a nominal value of 6.0, but can be changed using the
{\bf CCUT} card.
\item {\sc chdstc} is the convergence criteria in the TCITER and CJITER
routines. If the computed $\chi^{2}$ varies by less than the value of
{\sc chdstc} between any two iterations, then the routine stops iterating.
Also, if the value of $\chi^{2}$ falls below the value of {\sc chdstc},
the routine also stops iterating. This has a nominal value of 0.100, but
can be changed using the {\bf CHDS} card.
\item {\sc chcttc} is a closeness parameter, ($\chi^{2}$) used to
determine if two different track segments belong to the same track
and is used in the TCASSC routine. Its nominal value is 4.50, but it
can be modified by use of the {\bf CHCT} card.
\item {\sc nhlxtc} is the maximum number of iterations in the TCHELX
routine. Its nominal value is 5 which cna be changed with the
{\bf NHLX} card.
\item {\sc chlxtc} is a convergence criteria in the TCHELX routine.
Its nominal value is 1.0 which can be modified with the {\bf CHLX} card.
\item {\sc nvtxtc} is the maximum number of iterations in the TCVRTX
routine. Its nominal value is 10, but it can be changed using the
{\bf NVTX} card.
\item {\sc lyvxtc} is the outermost inner layer a track can have and
be considered for the primary vertex. It has a default value of six,
but this can be changed using the {\bf LYVX} card.
\item {\sc cvxctc} is a $\chi^{2}$ cut for convergence in the TCVRTX
routine. Its nominal value is $1.0 [cm^{2}]$, but it can be changed using
the {\bf CVXC} card.
\item {\sc rslvtc} is a parameter used to decide if a point can be
added to an existing fit track. Its value can be set using the {\bf RSLV}
card, (See routine TCRSLV).
\item {\sc vprbtc} is a probaility cut used in the vertex fit to decide
if tracks should be dropped from the vertex. It has a default value of
0.001, but can be changed using the {\bf VPRB} data card.
\item {\sc vfrctc} is a cut to decide if tracks should be dropped from the
vertex. If the probability is smaller than {\sc vprbtc} and one track
contributes {\sc vfrctc} of the total $\chi^{2}$, then that track is
not used in the vertex fit. The default value is 0.900, but can be changed
using the {\bf VFRC} data card.
\item {\sc zvtxtc} is a criteria in the vertex fit to decide if a track
belongs to the primary vertex. The track must have $z_{0}$ within
{\sc zvtxtc} of the nominal $z$--vertex to be used. This has a default
value of 10cm, but can be changed using the {\bf ZVTX} data card.
\end{itemize}
\subsubsection{TCFLAG}
The {\sc tcflag} common contains flags which control which parts of
the track reconstruction code are executed. The nominal value of all
these cards is {\sc .true.}, but they can be varied via the {\bf CHAM}
card in the main code.
\begin{verbatim}
LOGICAL GPWCTC
LOGICAL TRAKTC,RAWSTC,PATTTC,CIRCTC,HELXTC,VERTTC
COMMON /TCFLAG/ GPWCTC,
& TRAKTC,RAWSTC,PATTTC,CIRCTC,HELXTC,VERTTC
\end{verbatim}
\begin{itemize}
\item {\sc gpwctc} identifies if the {\sc pwc} was used.
\item {\sc traktc} controls whether CBPHYS calls TCTRAK.
\item {\sc rawstc} controls whether the routine process raw data.
\item {\sc patttc} controls whether pattern recognition is done.
\item {\sc circtc} controls whether circle fitting is done.
\item {\sc helxtc} controls whether helix fits are performed.
\item {\sc verttc} controls whether vertex fitting is performed.
\end{itemize}
\subsubsection{TCHITS}
The {\sc tchits} common block is filled by the TCLOAD routine, and
identifies which points in a track have not been resolved, (left/right).
This is then later used by the TCRSLV routine to resolve those points.
\begin{verbatim}
LOGICAL LGUNTC,LGCNTC(50),LGNEAR(50)
INTEGER NTOTTC,NPTSTC,IPNTTC(50)
COMMON /TCHITS/ LGUNTC,LGCNTC,LGNEAR,NTOTTC,NPTSTC,IPNTTC
\end{verbatim}
\begin{itemize}
\item {\sc lguntc} is a logical flag that is set .TRUE. if the track contains
any unresolved points.
\item {\sc lgcntc} is an array of logicals. Each entry corresponds to a
hit in the track, and if the value is {\sc .true.}, then the hit has been
resolved.
\item {\sc lgnear} is set {\sc .true.} if the hit is within 1.5mm of a
sense wire. TCFITR is then allowed to switch the resolution on this
point if it would improve the track fit.
\item {\sc ntottc} is the total number of hits in the track.
\item {\sc nptstc} is the number of resolved hits in the track.
\item {\sc ipnttc} is an array of pointers to the {\bf TCHT} data bank for
every hit in the track.
\end{itemize}
\subsubsection{TCLIFT}
The {\sc /tclift/} common block contains bank information used in Lifting
all data banks used in locater. All this information is filled in the
ZBFORM routine. This means that all bank formats can be changed in the
same place. The common block contains the following information. For
a detailed description, consult the data bank information.
\begin{verbatim}
INTEGER MRJDC(5),MTJDC(5),MTJDS(5),MTCHT(5),MTCLY(5)
INTEGER MTCTK(5),MTCSG(5),MTCTR(5),MTCTX(5)
INTEGER MTCHX(5),MTCHP(5),MTCVX(5),MTCVT(5),MTCVP(5)
INTEGER MTPWC(5),MTPCH(5),MHTJD(5)
INTEGER MTJCT(5),MTJXX(5),MTJCP(5),MTJRF(5),MTJST(5)
INTEGER MTJCZ(5),MTJCE(5),MTJZ0(5),MTJZL(5),MTJWR(5)
COMMON /TCLIFT/ MRJDC,MTJDC,MTJDS,MTCHT,MTCLY
& ,MTCTK,MTCSG,MTCTR,MTCTX
& ,MTCHX,MTCHP,MTCVX,MTCVT,MTCVP
& ,MTPWC,MTPCH,MHTJD
& ,MTJCT,MTJXX,MTJCP,MTJRF,MTJST
& ,MTJCZ,MTJCE,MTJZ0,MTJZL,MTJWR
SAVE /TCLIFT/
\end{verbatim}
\subsubsection{TCPRMS}
The {\sc /tcprms/} common block contains parameters used in the reconstruction
of tracks. All of these parameters are initialized in the TCINIT routine.
\begin{verbatim}
INTEGER NLYRTC,LJDCTC
REAL PHSETC,PHOFTC,ZOFFTC
REAL SINETC(30),COSETC(30),ANGSTC(30)
REAL RLYRTC(23),RINVTC(23),STAGTC(23)
REAL ANGLTC,BMAGTC,BINVTC,BMGCTC,BSGNTC,DELZTC(23)
COMMON /TCPRMS/ NLYRTC,LJDCTC,PHSETC,PHOFTC,ZOFFTC,
& SINETC,COSETC,ANGSTC,RLYRTC,RINVTC,STAGTC,
& ANGLTC,BMAGTC,BINVTC,BSGNTC,BMGCTC,DELZTC
\end{verbatim}
\begin{itemize}
\item {\sc nlyrtc} is the total number of chamber layers, {\sc xdc/pwc}
and {\sc jdc}.
\item {\sc ljdctc} is the number of {\sc jdc} layers, nominally 23.
\item {\sc phsetc} is the angle in radians spanned by one {\sc jdc}
sector.
\item {\sc phoftc} is the offset angle in radians to the center of
{\sc jdc} sector 1.
\item {\sc zofftc} is the offset of the interaction plane in the target
from the center of the \jdc{}. This parameter is used in the TJZPOS
routine for computing quantities for the TCSGMT routine. It can be set
with the {\bf ZOFF} card.
\item {\sc sinetc} contains the sines of the rotation angle to the center
of each {\sc jdc} sector.
\item {\sc cosetc} contains the cosines of the rotation angle to the
center of each {\sc jdc} sector.
\item {\sc angstc} contains $\phi$ angle at the center of each {\sc jdc}
sector in radians.
\item {\sc rlyrtc} contains the radius of each layer in the {\sc jdc}
in units of {\em cm}.
\item {\sc rinvtc} contains $1/r$ for each layer in the \jdc{}.
\item {\sc stagtc} contains the wire stagger, (in cm) for each layer in the
\jdc{}.
\item {\sc angltc} is an offset angle for the first sector of the {\sc jdc}.
It specifies how many radians away from 0 it is, and can be set with the
{\bf ANGL} card.
\item {\sc bmagtc} is the magnitude of the magnetic field along the z--axis
in units of KG. It can be changed with the {\bf BMAG} card.
\item {\sc binvtc} is $\frac{1}{eB}$ in the units above. It is calculated
in the TCINIT subroutine.
\item {\sc bmgctc} is $eB$ in units of $\frac{MeV/c}{cm}$. The value of
$e$ is \[ e = 0.299792458 \frac{{\textstyle MeV/c}}{{\textstyle KG\cdot cm}}\]
Its value is computed in the TCINIT subroutine from {\sc bmagtc}.
\item {\sc bsgntc} is the sign of the magnetic field. +1 is along the
$+z$ axis, while --1 is along the $-z$ axis. It is computed from the
value of {\sc bmagtc}.
\item {\sc delztc} is the nominal error in the measured $z$ coordinate
for each wire in the \jdc{}. It has a nominal value of 0.8cm, but can be
changed using the {\bf DELZ} card.
\end{itemize}
\subsubsection{TCSCAT}
The {\sc tcscat} common block contains the data used to compute the
multiple scattering contribution to the covariance matricies. This
data is initially loaded in the TCINIT routine. The initial data
depends on whether the {\sc xdc} or {\sc pwc} is inside the {\sc jdc}.
A description of how the multiple scattering contribution is computed
can be found in the section of the TCMCST subroutine.
\begin{verbatim}
REAL GASXTC,R0XTTC,R1XTTC,R2XTTC
COMMON /TCSCAT/ GASXTC,R0XTTC,R1XTTC,R2XTTC
\end{verbatim}
\begin{itemize}
\item {\sc gasxtc} is the inverse radiation length of the gas in the
{\sc jdc}. It is is units of cm\spscrpt{-1}.
\item {\sc r0xttc} is a sum over all discrete scatterers between the
interaction point and the first hit in the {\sc jdc}. The sum is of the
quantity $t_{i}/x_{i}$ where $t_{i}$ is the thickness of the scatterer
and $x_{i}$ is its radiation length.
\item {\sc r1xttc} is a sum over all discrete scatterers of the quantity:
$t_{i}\cdot r_{i}/x_{i}$ where $r_{i}$ is the radius of the scatterer. The
dimensions of this quantity are cm.
\item {\sc r2xttc} is a sum over all discrete scatterers of the quantity:
$t_{i}\cdot r_{i}^{2} / x_{i}$. It has units of cm\spscrpt{2}.
\end{itemize}
\subsubsection{TCSEGS}
The {\sc tcsegs} common block contains information on the track segments
found in the {\sc jdc}. It is essentially an organization of the points
in each sector according to $\tan\lambda$ where $\lambda$ is the track
opening angle. The routine TCSGMT is called to fill the data in this
common block, and then the TCRAW1 and TCRAW2 routines use this information
in building tracks in the chamber.
\begin{verbatim}
LOGICAL GCNCTC(10,30)
INTEGER NSEGTC(30),NSGPTC(2,10,30),JSECTC(4,10,30)
REAL LMBDTC(4,10,30)
COMMON /TCSEGS/ GCNCTC,NSEGTC,NSGPTC,JSECTC,LMBDTC
\end{verbatim}
\begin{itemize}
\item {\sc gcnctc} is a logical array identifying which segments have
been processed. TCSGMT sets this value to .FALSE. for all segments, then
as TCRAW1 and TCRAW2 use the data, they change the value to .TRUE. .
\item {\sc nsegtc} is an array containing the number of segments found
in each sector of the \jdc{}.
\item {\sc nsgptc} contains the number of points found in each segment,
and the number of points incorporated into tracks. There is storage space
for up to 10 tracks per sector.
\item {\sc jsectc} contains information on the beginning and end of each
found segment.
\begin{description}
\item[JSECTC(1,i,j)] layer number of the innermost hit
in segment $i$ of sector $j$.
\item[JSECTC(2,i,j)] layer number of the outermost hit
in segment $i$ of sector $j$.
\item[JSECTC(3,i,j)] hit number of the innermost hit
in segment $i$ of sector $j$.
\item[JSECTC(4,i,j)] hit number of the outermost hit
in segment $i$ of sector $j$.
\end{description}
\item {\sc lmbdtc} contains the cuts on $\tan\lambda$ for each found
segment in each sector.
\begin{description}
\item[LMBDTC(1,i,j)] $\tan\lambda$ for the outermost hit in segment
$i$ in sector $j$.
\item[LMBDTC(2,i,j)] contains $\sum\tan\lambda$ for all points in
segment $i$ in sector $j$.
\item[LMBDTC(3,i,j)] contains the average of $\tan\lambda$ for all
hits in segment $i$ in sector $j$.
\item[LMBDTC(4,i,j)] $1.0/\sigma_{\tan\lambda}^{2}$ for segment
$i$ in sector $j$. $\sigma^{2}_{\tan\lambda} = 0.260(1.0 + \tan^{2}\lambda)$.
\end{description}
\end{itemize}
\subsubsection{TCSTAT}
The {\sc /tcstat/} common block is used to keep track of run statistics
throughout the LOCATER code. For a precise description of each variable,
one should consult the TCCOMMON Patch in the LOACTER PAM file. Information
from this common is printed during a call to TCDONE.
\begin{verbatim}
INTEGER ISTATC(20),ISTKTC(50)
COMMON /TCSTAT/ ISTATC,ISTKTC
\end{verbatim}
\begin{itemize}
\item {\sc istatc} contains global statistics.
\item {\sc istktc} contains statistics from the circle fitting code.
\end{itemize}
\subsubsection{TJCONV}
The {\sc /tjconv/} common block contains variables which are passed to
the TJTIME, TJZPOS and TCRESL routines. This allows these routines to
have no call arguments.
\begin{verbatim}
INTEGER IRESTJ,ISECTJ,ITJDTJ,ITCHTJ
COMMON /TJCONV/ IRESTJ,ISECTJ,ITJDTJ,ITCHTJ
\end{verbatim}
\begin{itemize}
\item {\sc irestj} is the resolution code for the point, (0,1,2).
\item {\sc isectj} is the sector number in the \jdc{}.
\item {\sc itjdtj} is a pointer to the {\bf TJDC} data bank for this hit.
\item {\sc itchtj} is a pointer to the {\bf TCHT} data bank for this hit.
\end{itemize}
\subsubsection{TJCUTS}
The {\sc tjcuts} common block contains cuts applied only to the {\sc jdc}.
Its values are initialized in the TCINIT routine.
\begin{verbatim}
INTEGER IAMPTJ,IGAPTJ,JGAPTJ,ITDFTJ,ITMXTJ(23)
REAL TCRSTJ(23),TMINTJ,YMAXTJ(23),YCUTTJ
REAL DMINTJ,DMAXTJ
COMMON /TJCUTS/ IAMPTJ,IGAPTJ,JGAPTJ,ITDFTJ,ITMXTJ,TCRSTJ,
& TMINTJ,YMAXTJ,YCUTTJ,DMINTJ,DMAXTJ
SAVE /TJCUTS/
\end{verbatim}
\begin{itemize}
\item {\sc iamptj} is the minimum accepted amplitude in the TJDCGT routine.
It has a nominal value of 45 FADC channels, but can be changed with the
{\bf IAMP} card.
\item {\sc igaptj} is the largest gap in layers allowed within a segment
in the TCSGMT routine. It has a default value of 4, but can be changed
using the {\bf IGAP} card.
\item {\sc jgaptj} is the largest gap in layers allowed in the
TCRSRC and TCFSRC routines. It has a default value of 2, but can
be changed using the {\bf JGAP} card.
\item {\sc itmxtj} is the minimum drift time distance in ns as used
in the TJDCGT routine. It has a value of 250ns, but can be set using
the {\bf ITDF} card.
\item {\sc itmxtj} is the maximum drift time allowed on each layer
of the \jdc{}, (ns). The values can be changed using the {\bf itmx}
card.
\item {\sc tcrstj} is a time cut used in the TCFSRC and TCRSRC
subroutines when trying to resolve a second point in a track. The cut
says that if we know the resolution of one point along the track, a
second point can have that same resolution only if it is within
{\sc tcrstj} $\mu$s of the first point. The nominal value is $0.7\mu s$.
\item {\sc tmintj} is the minimum time a hit can have and still be
resolved with the $(t_{1}+t_{3})/2 - t_{2}$ method. It is nominally set
at \mbox{90 ns}, but can be changed with the {\bf TMIN} card.
This cut is used in the TCRAWS routine.
\item {\sc ymaxtj} contains the maximum allowed value of $y$ for each
layer in the \jdc{}.
\item {\sc ycuttj} is used in the TJTIME routine to decide when a point
is physically outside of a sector. If the point reconstructs outside
the sector, but not more than the value in {\sc ymaxtj}, then it is
assigned the coordinates of the sector boundary. Otherwise it is assigned
an unphysically large position. The default value is 1mm, but it can be
changed using the {\bf YCUT} card.
\item {\sc dmintj} is the minimum value of $(t_{1}+t_{3})/2 - t_{2}$
with which one can identify the left or right side of the wire. This
has a default value of $0.025\mu s$, but can be changed using the
{\bf DMIN} card. Note that the program will naturally decrease the
value of this parameter if no track can be extracted.
\item {\sc dmaxtj} is the maximum value of $(t_{1}+t_{3})/2 - t_{2}$
which can be used to decide left and right in the chamber. It has a
default value of $0.130 \mu s$, but can be modified using the
{\bf DMAX} card. Note that the program will naturally increase this
cut if no tracks can be extracted.
\end{itemize}
\subsubsection{TJPRMS}
The {\sc /tjprms/} common block contains data for computing the position
error to be associated with every hit in the \jdc{}. See the TCRESL routine
for a description of the error calculation.
\begin{verbatim}
LOGICAL LGT2TJ
REAL DELYTJ,DLY2TJ,DELTTJ,RISOTJ(23,2)
REAL SY02TJ,SYDFTJ,SYDQTJ,SXDQTJ
COMMON /TJPRMS/ LGT2TJ,DELYTJ,DLY2TJ,DELTTJ,RISOTJ,
& SY02TJ,SYDFTJ,SYDQTJ,SXDQTJ
SAVE /TJPRMS/
\end{verbatim}
\begin{itemize}
\item {\sc lgt2tj} is a flag to control if we use a complicated form normally
used in chamber calibration. Its value is set with the {\bf LGT2} card.
\item {\sc delytj} The linear term in the computation. It has a nominal value
of 0.0250 [cm], but can be changed using the {\bf DELY} card.
\item {\sc dly2tj} is used in calibrating the \jdc{}. It has the function
of {\sc delytj} in normal running. It has a default value of 0.025 [cm], and
can be changed by using the {\bf DLY2} card.
\item {\sc delttj} the quadratic term, only applied if the flag is true.
It has a nominal value of 0.0250 [cm], but can be changed using the
{\bf DELT} card.
\item {\sc risotj} is the maximum isochron radius on each side of each wire.
\item {\sc sy02tj} is the flat term in the chamber resolution, it has a
nominal value of 90 microns, but can be changed using the {\bf SY02} card.
\item {\sc sydftj} is the diffusion term which is proportional to the
square root of the drift distance. It has a nominal value of 100 micorns,
but can be changed using the {\bf SYDF} card.
\item {\sc sydqtj} is nominally zero, and must be changed using the
{\bf SYDQ} card. It is used during calibration to allow for an error
in the drift distance proportional to the drift distance.
\item {\sc sxdqtj} is nominally zero, and must be changed using the
{\bf SXDQ} card. It is used during calibration to allow for an error
in the $x$ coordinate proportional to the drift length, essentially
a Lorentz angle.
\end{itemize}
\subsubsection{TJSLCN}
The {\sc /tjslcn/} common block is used to monitor the \jdc{} slow
control events.
\begin{verbatim}
LOGICAL LCLRTJ
INTEGER NTMPTJ,NMIXTJ,NPRSTJ
REAL STMPTJ,SMIXTJ,SPRSTJ
COMMON /TJSLCN/ STMPTJ,SMIXTJ,SPRSTJ
& ,NTMPTJ,NMIXTJ,NPRSTJ
& ,LCLRTJ
\end{verbatim}
\subsubsection{TJWIRE}
The {\sc /tjwire/} common block identifies which wires can and cannot be
used in analysis. It is used in the TJDCGT routine.
\begin{verbatim}
LOGICAL LGWIRE(23,30)
COMMON /TJWIRE/ LGWIRE
\end{verbatim}
If an entry, (layer,sector) in the {\sc lgwire} array is {\sc .true.},
then the wire should not be used in analysis.
\subsubsection{TPPRMS}
The {\sc /tpprms/} common block contains parameters which describe the
{\sc PWC}.
\begin{verbatim}
REAL RPWCTP(2),APWCTP(2),OPWCTP(2)
REAL XPWCTP(0:319),YPWCTP(0:319)
COMMON /TPPRMS/ RPWCTP,APWCTP,OPWCTP,XPWCTP,YPWCTP
\end{verbatim}
\begin{itemize}
\item {\sc rpwctp} contains the radius in centimeters of the two layers in
the {\sc pwc}.
\item {\sc apwctp} contains the angular spacing between wires in the {\sc pwc}
for the two layers. The units are in radians.
\item {\sc opwctp} contains the angular offset for wire number zero in
both layers of the {\sc pwc}, the units are radians, and this can be
set using the {\bf OPWC} card.
\item {\sc xpwctp} contains the $x$ coordinate of every wire as a function
of the wire number in the {\bf RPWC} data bank.
\item {\sc ypwctp} contains the $y$ coordinate of every wire as a function
of the wire number in the {\bf RPWC} data bank.
\end{itemize}
\subsection{Description of the General and Steering Software}
The following subroutines are found in the {\sc tc\_main} patch in the
{\sc locater} card file.
\subsubsection{SUBROUTINE TCDONE}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 27 July, 1988 \\
{\bf References:} \\
{\bf Call Arguments:} (ICODE)\\
{\bf Common Blocks Used:} {\sc cjflag}.\\
{\bf Subroutines Referenced:} {\sc cjtavg}, {\sc cjtimo},\\
{\sc cern library}, {\sc datimh}.\\
\end{flushleft}
This routine is called once at the end of a run to write out the
status of the tracking code. If calibrations are done, this routine
calls the routines to update the look up table, and to write out the
new table.
\subsubsection{SUBROUTINE TCINIT}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 12 February, 1988 \\
{\bf References:} \\
{\bf Call Arguments:} (*IERR). \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink}, {\sc tclift},
{\sc zbdivs}, {\sc tcprms}, {\sc tccuts}, {\sc tcscat} and {\sc cjgain}. \\
{\bf Subroutines Referenced:} {\sc tcvers}, {\sc tjtimi} and {\sc cjinit}.\\
\end{flushleft}
This routine is called once, at the beginning of each run. It's
purpose is to set up the constants used throughout the tracking
section. The returned value {\sc ierr} is zero for no problems,
and set equal to one if {\em io} problems were encountered. In this
case the calling program should terminate as the drift chamber
calibration tables will be incorrect.
\subsubsection{SUBROUTINE TCTRAK}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 12 February, 1988 \\
{\bf References:} \\
{\bf Call Arguments:} None. \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink}, {\sc tclift},
{\sc zbdivs}, {\sc tctest} and {\sc smtest}.\\
{\bf Subroutines Referenced:} {\sc tjdcgt}, {\sc tpwcgt}, {\sc tcpatt}
{\sc tccirc}, {\sc tcdedx}, {\sc tcpcnt}, {\sc tchelx},
{\sc tcmsct}, {\sc tcvert} and {\sc usevnt}.\\
{\sc zebra library} {\sc mzlift}.\\
\end{flushleft}
This subroutine controls the flow of the tracking programs for normal
data analysis. It's only job is to call other subroutines. The value
of {\sc ievnt} is the event number, {\sc lgfin} is a logical that
identifies if the end of data was encountered, and {\sc ierr} is an
error code from the routine. If {\sc ierr} is returned not equal to
zero, the run should be ended.
The subroutine USEVNT is called throughout this routine to enable the
user to abort event processing. To do so, the user need only set the
variable {\sc accecb} in the {\sc /cbcntl/} common block to {\sc .false.}.
The following entries are made to USEVNT.
\begin{itemize}
\item[20] After unpacking of the \pwc{} data, (TPWCGT).
\item[21] After unpacking of the \jdc{} data, (TJDCGT).
\item[22] After pattern recognition, (TCPATT).
\item[23] After circle fitting, (TCCIRC).
\item[26] After helix fitting, (TCHELX).
\item[27] After vertex fitting, (TCVERT).
\item[29] After calibration, (CJCALB).
\end{itemize}
\subsubsection{SUBROUTINE TJGAIN}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer \\
{\bf Creation Date:} 1 March, 1989. \\
{\bf References:} \\
{\bf Call Arguments:} ( *IERR) \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink} and {\sc tclift}. \\
{\bf Subroutines Referenced:} ({\sc zebra library}:) {\sc mzlift}. \\
\end{flushleft}
This routine will first lift the {\bf TJCE} and {\bf TJCZ} data banks
in the constant division. It will then read in the \jdc{} energy and $z$
calibrations from logical unit {\sc ljgain} and store them in the banks.
The returned value of {\sc ierr} is set to zero if the routine is
successful.
\subsubsection{SUBROUTINE TJGAOT}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer \\
{\bf Creation Date:} 1 March, 1989.\\
{\bf References:} \\
{\bf Call Arguments:} None. \\
{\bf Common Blocks Used:} {\sc cbbank} and {\sc cblink}. \\
{\bf Subroutines Referenced:} None. \\
\end{flushleft}
This routine will write the contents of the {\bf TJCE} and {\bf TJCZ}
banks out to the file {\sc jdcgain.new} through the logical unit
{\sc lnorm}. This routine is only used during calibration.
\subsubsection{SUBROUTINE TJSLOW}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 21 August, 1990\\
{\bf References:} \\
{\bf Call Arguments:} (*IERR). \\
{\bf Common Blocks Used:} {\sc sclink}, {\sc cblink}, {\sc cbbank}
and {\sc tclift}. \\
{\bf Subroutines Referenced:} ({\sc zebra}): {\sc mzlift} \\
\end{flushleft}
This routine will monitor the slow control data from the \jdc{}, and
print out warnings when it deviates by two much from the reference
data as stored in the {\bf TJRF} data bank. The routine is also
supposed to correct the $r\phi$ calibrations based on temperature,
pressure and gas mixture as seen in the \jdc{}. This is not yet
implemented.
\subsubsection{SUBROUTINE TJTIMI}
\begin{flushleft}
{\bf Author:} Klaus Peters\\
{\bf Creation Date:} 9 September, 1988\\
{\bf References:} \\
{\bf Call Arguments:} (*IERR,MKxxxx). \\
{\bf Common Blocks Used:} {\sc cblink}, {\sc cbbank} and {\sc tclift}. \\
{\bf Subroutines Referenced:} ({\sc zebra}): {\sc mzlift} \\
\end{flushleft}
This subroutine will read in the lookup table to convert drift time
into position in the {\sc jdc}. If an {\em io} error occurs, then the
value of {\sc ierr} is returned as one. Otherwise it is returned as
zero. The data is stored in the {\bf TJCT} data bank, which is lifted
in this routine. The function {\sc MKxxxx} is used to tell TJTIMI
from where the input should come. The possible functions included
in {\sc locater} are:
\begin{itemize}
\item {\sc mkdumy} A do--nothing routine used when data is taken from the
data base.
\item {\sc mkreal} is the generic name for calibration sets for real
data. The correct sets are chosen using {\sc cmz} select flags.
\item {\sc mkgean} is the calibration table for {\sc geant} output.
\item {\sc mkdfpl} is a starting table for $r\phi$ calibrations if
the field is positive.
\item {\sc mkdfmn} is a starting table for $r\phi$ calibrations if
the field is negative.
\end{itemize}
\clearpage
\begin{figure}[p]
\begin{picture}(425,490)(50,110)\centering
\thicklines
\put(100,560){\framebox(50,25){{\small CBMAIN}}}
\put(125,560){\line(0,-1){450}}
\put(125,110){\circle*{5}}
\put(125,532){\vector(1,0){50}}
\put(175,520){\framebox(50,25){{\small CBINIT}}}
\put(200,520){\line(0,-1){280}}
\put(200,240){\circle*{5}}
\put(200,492){\vector(1,0){50}}
\put(250,480){\framebox(50,25){{\small CBFFGO}}}
\put(200,452){\vector(1,0){50}}
\put(250,440){\framebox(50,25){{\small ZBINIT}}}
\put(200,412){\vector(1,0){50}}
\put(250,400){\framebox(50,25){{\small BCINIT}}}
\put(200,372){\vector(1,0){50}}
\put(250,360){\framebox(50,25){{\small TCINIT}}}
\put(300,372){\vector(1,0){25}}
\put(325,360){\framebox(50,25){{\small TCVERS}}}
\put(200,332){\vector(1,0){50}}
\put(250,320){\framebox(50,25){{\small ZBFORM}}}
\put(200,292){\vector(1,0){50}}
\put(250,280){\framebox(50,25){{\small TJTIMI}}}
\put(200,252){\vector(1,0){50}}
\put(250,240){\framebox(50,25){{\small TJGAIN}}}
\put(125,212){\vector(1,0){50}}
\put(175,200){\framebox(50,25){{\small USINIT}}}
\put(125,172){\vector(1,0){50}}
\put(175,160){\framebox(50,25){{\small CBLOOP}}}
\put(225,172){\vector(1,0){25}}
\put(250,160){\framebox(50,25){{\small CBPHYS}}}
\put(300,172){\vector(1,0){25}}
\put(325,160){\framebox(50,25){{\small TCTRAK}}}
\put(125,132){\vector(1,0){50}}
\put(175,120){\framebox(50,25){{\small ZEND}}}
\put(225,132){\vector(1,0){25}}
\put(250,120){\framebox(50,25){{\small TCDONE}}}
\end{picture}
\caption[General Offline Flow Diagram]
{{\sf The calling sequence for the offline analysis code.}}
\label{fig:callseq}
\end{figure}
\clearpage
\subsection{Description of the Raw Data Processing Software}
The following subroutines are found in the {\sc tc\_raws} patch of the
{\sc locater} card file.
\subsubsection{SUBROUTINE RJAFIT}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 8 May, 1989 \\
{\bf References:} Online routine {\bf AMP1} by H. von der Schmitt. \\
{\bf Call Arguments:} (*LHIT1, *LHIT2, *LGHIT, *IERR, *IAMPR, *IAMPL,
NPULS, MXPLD, IBEGL, IBEGR, IAOFL, IAOFR) \\
{\bf Common Blocks Used:} {\sc rjdata}. \\
{\bf Subroutines Referenced:} RJPULS.\\
\end{flushleft}
This subroutine computes the amplitude of a pulse by integrating the FADC
contents for a fixed time, ({\sc itimrj} in the {\sc /rjprms/} common).
Integration is performed simultaneously on both the left and right
channels, with the resulting amplitudes being returned in the
{\sc iampl} and {\sc iampr} variables. Integration is started at channel
number {\sc ibegl} on the left, and {\sc ibegr} on the right. The routine
also looks for the appearance of a second pulse during integration
by identifying if either pulse starts falling, and then starts rising again.
If this happens, the RJPULS routine is called, and if it finds a pulse,
the {\sc lhit} variables are set true. If a second pulse is found, then
the integration of the first pulse is stopped early, and its total amplitude
is corrected for the fraction of time remaining. This correction is
also returned in the {\sc iaofl} and {\sc iaofr} variables for subtraction
from the second pulse. The returned amplitudes are linearized.
The criteria for a second pulse is given as the following:
\begin{itemize}
\item The maximum of the present pulse has been reached.
\item The channel {\sc iseprj} channels away from the present channel
is over for non--linear bins higher than the present channel.
\item The RJPULS routine says that it is a second pulse.
\end{itemize}
\subsubsection{SUBROUTINE RJPROC}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 8 May, 1989 \\
{\bf References:} \\
{\bf Call Arguments:} (*IERR). \\
{\bf Common Blocks Used:} {\sc rjdata}, {\sc cbbank}, {\sc cblink}, and
{\sc cbunit}. \\
{\bf Called by:} {\sc tjdcgt}
{\bf Subroutines Referenced:} {\sc rjpuls} and {\sc rjafit}.\\
{\sc zebra library:} {\sc mzlift} and {\sc mzpush}. \\
\end{flushleft}
This routine is the top level routine in the section to convert \jdc{}
data from the {\bf RJDF} format into the {\bf RJDC} format. The routine
is called from the TJDCGT routine when no {\bf RJDC} bank exists, but an
{\bf RJDF} bank does exist. The output from this routine is an {\bf RJDC}
data bank.
The routine loops over all pulses found in the {\bf RJDF} bank, and processes
them in exactly the same manner as the online system. The pulses are extracted
from the bank, linearized using the formula:
\[ l = (64\cdot i)/(64 - 0.7539\cdot i) \]
and stored in two working arrays, one for the left side and one for the right
side of the pulse. The routine then calls the RJPULS for both the left and
right pulse, which returns the number of found hits, the start position
of each hit, the position of the maximum for each hit, and the fit time
for each hit, ( the times are in units of 200ps). (The returned variables
are passed through the {\sc /rjdata/} common block.)
The routine then looks simultaneously at the hits on the left and right
side. Two hits which are within {\sc mxplrj} time units of each other are
assumed to the two sides of the same hit. The drift time for these is
taken as the average of the left and right time. Two hits which are
farther apart then {\sc mxplrj}, but closer than 100ns are assumed to
be the same hit, but the drift time is taken as only the earlier time.
Otherwise hits are assumed to be separate.
When both sides of a hit have been identified, the routine defines an
integration length. This is taken as the shortest of either {\sc itimrj}
channels, or the difference between the start time of the present hit and
the next hit in the pulse. This is done for both the left and right side,
and the final integration time is taken as the minimum of the two. The
routine RJAFIT is then called to simultaneously integrate the two hits
over the given integration length.
The resulting drift time, and amplitudes are then stored in the RJDC
data bank.
The returned value of {\sc ierr} is used to flag the routine exit status.
\begin{itemize}
\item[{\sc ierr}$=0$] is normal completion with no errors.
\item[{\sc ierr}$=1$] tags a header problem. The routine was unable to
unpack the {\bf RJDF} bank and has exited.
\end{itemize}
\subsubsection{SUBROUTINE RJPULS}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 8 May, 1989 \\
{\bf References:} Online routine {\bf PULSDF} by G. Eckerlin.\\
{\bf Call Arguments:} (ISIDE, *NPULS, IPULS).\\
{\bf Common Blocks Used:} {\sc rjdata} and {\sc rjprms}.\\
{\bf Called by:} {\sc rjproc}. \\
{\bf Subroutines Referenced:} {\sc krate}.\\
\end{flushleft}
This routine looks at the pulse stored in the {\sc ipuls} array to
find the starts, maximums and drift times of all hits. The search
looks for one rising bin followed by a bin which does not fall. This
is defined as a hit start. The hit maximum is then defined as the
bin just before the first falling bin. Hits must be separated by at
least {\sc itmirj} bins. If a hit is found, then the drift time is
fit using a first electron method. A line is fit to the rising
edge of the pulse, and the intersection with the pedestal is defined
as the drift time, (time units are 200ps). The information on the
starting bin, maximum bin, and drift time are returned to the calling
routine through the {\sc /rjdata/} common block. The number of hits
found is returned as {\sc npuls}. The following conditions must be
met in order for a hit to be accepted as a hit, (all values are found
in the {\sc /rjprms/} common block):
\begin{itemize}
\item The pulse height as defined as the maximum minus the minimum
must be larger than {\sc npulrj}, ( Default value of 30, but can be changed
using the {\bf NPUL} card.
\item The number of bins between the start of the present hit and that
of the previous, (for more than one hit), must be at least {\sc ntmirj},
(Default value of 10, but can be changed using the {\bf NTMI} card).
\item There can be no more than four hits in a passed pulse.
\item A second hit must be at least 80\% as high as the previous hit.
\end{itemize}
\subsubsection{SUBROUTINE TJDCGT}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer \\
{\bf Creation Date:} 1 February, 1989. \\
{\bf References:} \\
{\bf Call Arguments:} (IERR). \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink}, {\sc tclift},
{\sc zbdivs} and {\sc mjdata}. \\
{\bf Called by:} {\sc tctrak}. \\
{\bf Subroutines Referenced:} {\sc rjproc} and {\sc sortil},\\
({\sc zebra library}:) {\sc mzlift} and {\sc mzwork}. \\
\end{flushleft}
This routine is called once per event. It will take the \jdc{}
data out of the magnetic tape format, and load it into the {\bf TJDC}
data banks. The format of the raw data can be either the {\bf RJDC} or
{\bf RJDF} bank format. If the {\bf RJDC} format exists, it is used by
default. However, if the {\bf RJDC} does not exist, and the {\bf RJDF}
does exist, the the RJPROC routine is called to create an {\bf RJDC}
data bank.
This routine then examines all hits in the {\bf RJDC} bank, and moves those
that pass the following cuts into the {\bf TJDC} data banks. All accepted
hits must satisfy the following:
\begin{itemize}
\item The total amplitude of the hit is larger than the {\sc iamptj}
cutoff in the {\sc /tjcuts/} common block.
\item The drift time of the hit must be smaller than the value of
{\sc tmaxtj(layer)} in the {\sc /tjcuts/} common block.
\item If more than one hit is found on any wire, the minimum time
separation between the hits must be larger than {\sc tdiftj} in the
{\sc /tjcuts/} common block. If they are closer than this, they are
assumed to be the same hit, and are merged.
\end{itemize}
Finally, if more than one hit remain on any wires, the SORTIL routine
is called to arrange those hits in order of drift times, smallest to
largest.
\subsubsection{SUBROUTINE TJTIME}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer \\
{\bf Creation Date:} 8 July, 1989. \\
{\bf References:} \\
{\bf Call Arguments:} None.\\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink},
{\sc tjconv}, {\sc tjcuts} and {\sc tcprms}.\\
{\bf Called by:} {\sc tjdcgt}.\\
{\bf Subroutines Referenced:} None. \\
\end{flushleft}
This subroutine will take the time and amplitude information given in the
{\bf TJDC} data bank through the pointer {\sc itjttj} and compute the $(x,y)$
position in the \jdc{} for both the left and right possibilities, the
$z$ coordinate through charge division, and the $dE/dx$ at the point.
The results are stored in the {\bf TJDC} data bank using the pointer
{\sc itjttj}. The $x$ and $y$ positions are obtained by interpolating
in a look up table stored in the {\bf TJCT} data bank which relates
measured drift time to position for every wire in the chamber. The positions
are computed in sector coordinates, as shown in Figure~\ref{fig:sector}.
A standard sector is defined with the $x$--axis along the wire plane, and the
$y$--axis vertical. The origin is defined as the center of the \jdc{}.
Note that all pointers are passed in the {\sc /tjconv/} common block.
The $z$ coordinate is computed through charge division, using
constants stored in the {\bf TJCZ}, {\bf TJZL} and {\bf TJZ0} data banks.
The $dE/dx$ at the hit is computed using data stored in the {\bf TJCE}
data banks. For more information on how conversions are performed for
these coordinates, see the subsection of {\sl Calibration Data Banks}.
\begin{figure}[htb]\centering
\begin{picture}(400,150)(-50,-75)
% origin:
\put(-10,0){\line(1,0){20}}
\put(0,-10){\line(0,1){20}}
\put(0,-20){\makebox(0,0){(0,0)}}
\put(0,-40){\line(1,0){303.75}}
\put(0,-42){\line(0,1){4}}
\put(0,-55){\makebox(0,0){0mm}}
\put(73.75,-42){\line(0,1){4}}
\put(73.75,-55){\makebox(0,0){59mm}}
\put(303.75,-42){\line(0,1){4}}
\put(303.75,-55){\makebox(0,0){243mm}}
% inner face of sector
\multiput(73.75,-7.751)(0,7.751){3}{\makebox(0,0){$\cdot$}}
% outerface of sector
\multiput(303.75,-31.875)(0,6.375){11}{\makebox(0,0){$\cdot$}}
% side faces of sector
\multiput(73.75, 7.751)(5.00, 0.524){47}{\makebox(0,0){$\cdot$}}
\multiput(73.75,-7.751)(5.00,-0.524){47}{\makebox(0,0){$\cdot$}}
% coordinate directions
\put(315,0){\vector(1,0){15}}
\put(340,0){\makebox(0,0){$+x$}}
\put(335, 30){\makebox(0,0){{\tiny Left}}}
\put(335,-30){\makebox(0,0){{\tiny Right}}}
\put(0,25){\vector(0,1){15}}
\put(0,50){\makebox(0,0){$+y$}}
% sense wires.
\multiput(78.75,0)(10,0){23}{\makebox(0,0){$\cdot$}}
% guard wires.
\multiput(83.75,0)(10,0){22}{\makebox(0,0){$\cdot$}}
\end{picture}
\caption[Sector coordinates in the \jdc{}.]
{{\sf Sector coordinates for the \jdc{}, all interpolation for
position from drift times is done in a cell of the above form.}}
\label{fig:sector}
\end{figure}
\subsubsection{SUBROUTINE TPWPOS}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 13 January, 1989.\\
{\bf References:} \\
{\bf Call Arguments:} None.\\
{\bf Common Blocks Used:} {\sc tpprms}, {\sc cbbank}, {\sc cblink},
{\sc tclift} and {\sc zbdivs}.\\
{\bf Subroutines Referenced:} {\sc (zebra library) mzlift }. \\
\end{flushleft}
This routine takes the information in the {\bf RPWC} data bank, converts
the hits into position, and stores the resulting information in the
{\bf TPWC} data bank.
\clearpage
\begin{figure}[p]
\begin{picture}(425,610)(50,-10)\centering
\thicklines
\put( 50,572){\vector(1,0){50}}
\put(100,560){\framebox(50,25){{\small TCTRAK}}}
\put(125,560){\line(0,-1){100}}
\put(125,460){\circle*{5}}
\put(125,532){\vector(1,0){50}}
\put(175,520){\framebox(50,25){{\small TPWPOS}}}
\put(125,492){\vector(1,0){50}}
\put(175,480){\framebox(50,25){{\small TJDCGT}}}
\put(200,480){\line(0,-1){200}}
\put(200,280){\circle*{5}}
\put(200,452){\vector(1,0){50}}
\put(250,440){\framebox(50,25){{\small RJPROC}}}
\put(275,440){\line(0,-1){80}}
\put(275,360){\circle*{5}}
\put(275,412){\vector(1,0){50}}
\put(325,400){\framebox(50,25){{\small RJPULS}}}
\put(275,372){\vector(1,0){50}}
\put(325,360){\framebox(50,25){{\small RJAFIT}}}
\put(200,332){\vector(1,0){50}}
\put(250,320){\framebox(50,25){{\small SORTIL}}}
\put(200,292){\vector(1,0){50}}
\put(250,280){\framebox(50,25){{\small TJTIME}}}
\end{picture}
\caption[Raw Data Processing Software Flow]
{{\sf The flow diagram for the processing of Raw data in the \jdc{}.}}
\label{fig:rawdat}
\end{figure}
\clearpage
\subsection{Description of the Pattern Recognition Software}
The following subroutines are found in the {\sc tc\_patt} patch of the
{\sc locater} card file.
\subsubsection{SUBROUTINE TCFSRC}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 1 February, 1988 \\
{\bf References:} \\
{\bf Call Arguments:}(I, ISECT, IRES, ITJDC, ITCHT,
IOPT, ITRK, *CHX, *NCHX). \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink},{\sc tcsegs}
and {\sc tccuts}. \\
{\bf Subroutines Referenced:} {\sc tcresl}. \\
\end{flushleft}
This subroutine starts at the point {\sc i} in sector {\sc isect} which
has been resolved as specified by {\sc ires}, (1=left, 2=right)
and searches forward through the sector to resolve as many additional
points as possible. The procedure uses two points of known resolution
to predict the third point, and then compare this with the two possible
choices. The routine stops searching if all the data is used up, or
if a gap larger than 3 layers is found. {\sc itjdc} and
{\sc itcht} point to the hit in the {\bf TJDC} and {\bf
TCHT} data banks respectively. {\sc iopt} can take the values 0 or
1. When it is zero, TCFSRC assumes that only the point given
is known on the track. It then has to figure out a second point on
the track before proceeding. If {\sc iopt} is 1, then TCFSRC
uses the forward pointer of this hit to get the next hit, and then
starts its search. Finally, {\sc itrk} is the track number assigned
to the track.
The basic algorithm in this routine, (as well as the TCRSRC routine)
is to use two points of known resolution, $(x_{1},y_{1})$ and $(x_{2},
y_{2})$ to predict a third point $(x_{3},y_{3})$ using a linear projection.
This third point is taken as the next point in the present sector, and
the distance squared between the left and right choices to the line are computed.
If exactly one of these is smaller than the value of {\sc xsqrtc} in the
{\sc /tccuts/} common block, then that choice is taken. If both are smaller
than the cutoff, and the absolute difference between the two is less
than {\sc dxsqtc} in the {\sc /tccuts/} common block, then the routine
needs to figure out if the track is very close to, or actually crossing
the sense wire plane. This is done by stepping ahead in this sector, and
identifying three adjacent points whose drift times are longer than
{\sc tcrstj} in the {\sc /tccuts/} common block. These points are then
resolved using the quantity $\Delta = (t_{1}+t_{3})/2 - t_{2}$, as described
in the TCRAW2 routine. This routine is not restricted to only points
identified as in the same segment, (see TCSGMT), as the first point, but
examines all points in the sector, and chooses the best match in $r/phi$.
The returned value of {\sc chx} is the sum of the deviations squared of every
added point, while {\sc nchx} is the number of added points.
\subsubsection{SUBROUTINE TCPATT}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 15 November, 1989 \\
{\bf References:} \\
{\bf Call Arguments:} None. \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink}, {\sc tclift},
{\sc zbdivs}, {\sc tcprms}, {\sc tccuts} and {\sc tcsegs}. \\
{\bf Called By:} {\sc tctrak} .\\
{\bf Subroutines Referenced:} {\sc tcross} .\\
\end{flushleft}
This is the steering routine for pattern recognition. It first calls the
TCSGMT to build loose roads through the data. Then it sets a minimum
road length of 10 hits, and calls the TCRAW2 routine to search through
the chamber, and try to resolve those roads with more than 10 hits.
Next, the TCRAW1 routine is called to try to connect tracks which have
crossed sector boundaries. Finally, the TCRAW2 routine is called again
with the minimum length set to three to try and sweep up left over track
pieces.
After the above search, the routine then copies all unused data in the
{\bf TJDC} bank into the {\bf TCHT} bank as unresolved and not connected.
Presently, if more than 10 tracks are found in this routine, the event
is aborted by calling MZWIPE on the tracking division.
\subsubsection{SUBROUTINE TCRAW1}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 15 January, 1988 \\
{\bf References:} \\
{\bf Call Arguments:} None. \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink}, {\sc tclift},
{\sc zbdivs}, {\sc tcprms}, {\sc tccuts} and {\sc tcsegs}. \\
{\bf Subroutines Referenced:} {\sc tcross} .\\
\end{flushleft}
This routine looks through all the segments located in the {\sc tcsgmt}
routine, and locates all places where segments in two adjacent sectors
can be connected into a track. If such a connection can be made, it has
the advantage of unambiguously resolving from which side of the sense wire
the hits came. This search is done by forming a loop over the 30
sectors in the \jdc{}, and then a loop over every segment in the sectors.
Given a segment either starts on some layer other than layer 1, or ends
on some layer other than layer 23, a search is made over all the segments
in the adjacent two sectors. One wants to find a segment which matches the
$\tan\lambda$ of the first segment and can sensibly be connected to the
segment in terms of layers. If such a segment is found, the TCROSS
routine is called to connect. The TCROSS routine will itself call the
TCRESL routine to resolve the hits, and the TCRSRC and TCFSRF routines
to connect more points to the given track start.
The above search is performed as two loops over the chamber. The first
forces the starting segment to have at least 6 hits in it. The second then
picks up everything which is left over.
\subsubsection{SUBROUTINE TCRAW2}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:}\\
{\bf References:} \\
{\bf Call Arguments:} {\sc nmin}. \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink}, {\sc tclift},
{\sc zbdivs}, {\sc tcprms}, {\sc tccuts} and {\sc tcsegs}. \\
{\bf Subroutines Referenced:} {\sc tcresl}, {\sc tcfsrc}, {\sc tcrsrc},
{\sc tccnct}, \\
{\sc (zebra library)}: {\sc mzlift}.\\
\end{flushleft}
This routine looks through all sectors in the \jdc{} and examines those
roads, (TCSGMT) which contain at least {\sc nmin} hits. The time
difference algorithem, $\Delta = (t_{1}+t_{3})/2 - t_{2}$ is used to
resolve the left--right ambiguity in the chamber. This algorithem
requires that three adjacent wires have signals, and the drift time
of these signals is larger than {\sc tmintj}. If this is true, then
$\Delta$ is formed. If $\Delta$ is larger than {\sc dmintj} and smaller
than {\sc dmaxtj}, then this routine can identify which side of the
wire plane we are on. ( All the above cut are in the {\sc /tjcuts/} common
block.)
This routine searches through all the hits until three adjacent hits
satisfy the above requirements. These three hits are then resolved, and
the TCFSRC and TCRSRC routines are used to connect other points into the
track. If both of these routines fail to add points to the track, and the
road length is at least 10, then the routine has made an error, and the
track start is dropped. The routine then continues looking through the
data until it finds three more adjacent hits to use.
If after searching through a sector, no tracks are found, then the values
of {\sc tmintj} and {\sc dmintj} are lowered and {\sc dmaxtj} increased
in steps to the values of $0.025\mu s$, $0.020\mu s$ and $0.300\mu s$
respectively, and the search is repeated. This allows the
routine to find high momentum tracks which skim along a wire plane.
Finally, every track found in this routine has a 1 stored in the {\bf TCTK}
data bank at position IQ(ITCTK+7) to indicate that it did not cross a
sector boundary.
\subsubsection{SUBROUTINE TCRESL}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 25 February, 1988 \\
{\bf References:} \\
{\bf Call Arguments:} None.\\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc tjconv}, {\sc tjprms} and
{\sc tcprms}. \\
{\bf Subroutines Referenced:} None. \\
\end{flushleft}
This subroutine uses the value of {\sc irestj}, (0=unresolved, 1=left, 2=right)
and then converts the point referenced by {\sc itjttj} from
sector coordinates into CB--coordinates, and stores the results
in the {\bf TCHT} data bank using {\sc itchtj} as a pointer.
(For a definition of sector coordinates, see Figure~\ref{fig:sector}.)
The conversion involves simply rotating the {\em standard} sector by
the angular offset of the sector, and in order to facilitate this
rotation, the sines and cosines of the angle to every sector have been
precalculated and stored in the {\sc /tcprms/} common block. All pointers to
this routine are passed through the {\sc /tjconv/} common block.
The routine also computes an error for every measurement and stores that
in the data bank as well. Given that the $r$ and $\phi$ coordinates
of every hit are, the nominal error calculation is given by:
\[ r = \sqrt{x^{2} + y^{2}}\]
\[\phi = \tan^{-1}(y/x) \]
the errors can be given as:
\[ \sigma_{r} = \mid\frac{y}{r}\mid\cdot\sigma_{y} \]
\[ \sigma_{\phi} = \mid\frac{x}{r^{2}}\mid\cdot\sigma_{y} \]
where $\sigma_{y}$ is the measurement error of the position, and
is given by {\sc delytj} in the {\sc /tjprms/} common block.
If the code has been compiled using the calibration flags, then the value
of $\sigma_{y}$ can be modified. This is done by setting the
{\sc lgt2tj} flag in the {\sc /tjprms/} common block to {\sc .true.},
(use the {\bf LGT2} card in CJINIT. If this is done, the value of
$\sigma_{y}$ is given as:
\[ \sigma_{y} = \sigma_{y0}^{2} + t_{D}\cdot\sigma_{t} \]
where $\sigma_{y0}$ is {\sc tly2tj}, $t_{D}$ is the drift time in
microseconds, and $\sigma_{t}$ is given as {\sc dlyttj} in the
{\sc /tjprms/} common block. During calibration, they can be set using
the {\bf TLY2} and {\sc DELT} cards in the CJINIT routine.
\subsubsection{SUBROUTINE TCROSS}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 25 January, 1988 \\
{\bf References:} \\
{\bf Call Arguments:} (ISECT, KSECT, I, K, *IRES, *KRES, *LGFND) \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink}, {\sc tclift},
{\sc zbdivs}, {\sc tcsegs} and {\sc tccuts}.\\
{\bf Subroutines Referenced:} {\sc tcresl}, {\sc tcfsrc} and {\sc tcrsrc}, \\
{\sc zebra library} {\sc mzdrop}. \\
\end{flushleft}
This subroutine looks for sector crossings between sectors {\sc isect}
and {\sc ksect}. By definition, {\sc isect} is the sector containing
the innermost layer. A sector crossing can occur only if the times
in the layers are larger than a minimum time given in the {\sc timetc}
array. If a crossing can be found, then the TCRESL routine is
used to resolve the two adjacent points, and then the routines
TCFSRC and TCRSRC are used to extend the resolved regions
of the tracks as far as possible. {\sc i} and {\sc k} refer to the
segment number of the hits in sectors {\sc isect} and {\sc ksect} respectively.
{\sc ires} and {\sc kres} are the left--right resolution for the two hits,
and if they can be resolved, the {\sc lgfnd} is returned as {\sc .true.}.
\subsubsection{SUBROUTINE TCRSRC}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 1 February, 1988 \\
{\bf References:} \\
{\bf Call Arguments:}(I, ISECT, IRES, ITJDC, ITCHT,
IOPT, ITRK, *CHX, *NCHX). \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink},{\sc tcsegs}
and {\sc tccuts}. \\
{\bf Subroutines Referenced:} {\sc tcresl}. \\
\end{flushleft}
This subroutine starts at the point {\sc i} in {\sc isect} which
has been resolved as specified by {\sc ires}, (1=left, 2=right)
and searches backwards through the sector to resolve as many additional
points as possible. The procedure is to use to points of known resolution
to predict the third point, and then compare this with the two possible
positions. The routine stops searching if all the data is used up, or
if a gap larger than 3 layers is found. {\sc itjdc} and
{\sc itcht} point to the hit in the {\bf TJDC}, and {\bf
TCHT} data banks respectively. {\sc iopt} can take the values 0 or
1. When it is zero, TCRSRC assumes that only the point given
is known on the track. It then has to figure out a second point on
the track before proceeding. If {\sc iopt} is 1, then TCRSRC
uses the backward pointer of this hit to get the next hit, and then
starts its search. Finally, {\sc itrk} is the track number assigned
to the track. See the TCFSRC routine for a more detailed description.
\subsubsection{SUBROUTINE TCSGMT}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 27 January, 1989 \\
{\bf References:} \\
{\bf Call Arguments:} (*LGHIT). \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink},{\sc tcsegs},
{\sc tjconv} and {\sc tccuts}. \\
{\bf Subroutines Referenced:} {\sc tjtime} and {\sc tjzpos} \\
{\sc (zebra library)}: {\sc mzlift}.\\
\end{flushleft}
This routine builds roads through the data in the {\bf TJDC} data bank.
The roads are built using two criteria. The first is that the value
of $\tan\lambda$ for every point in a road be close to the average
value for the entire road, and the second is that the value of
$dy/dr$ not change suddenly from point to point in the road. The
opening angle of every point $\lambda$ is computed as
\[ \tan\lambda = z/r ,\] where $r$ is the radius of the hit wire, and
$z$ is computed through charge division. Every point included must
satisfy the condition:
\[ \chi^{2} = \frac{{\textstyle (\overline{\tan\lambda} - \tan\lambda_{i})^{2}}}
{\textstyle {\sigma_{\tan\lambda}^{2}}} < \lambda_{cut} ,\]
where the cutoff is given by {\sc clmbtc} in the {\sc /tccuts/} common block.
It is also necessary that the quantity $dy/dr = (\Delta y_{l}/\Delta r$
not change by more than about 0.3 unless the hits are close to a wire.
The routine looks at every hit in each layer, and compares them to every
existing segment, (road) found so far. It then chooses the combination
of connections which minimizes the overall $\chi^{2}$ of the problem.
This is done by forming a matrix of $\chi^{2}$ for every combination,
and choosing the route that gives the minimum. At present, the routine
has trouble if there are more than two tracks close in $\tan\lambda$
in the same sector in the \jdc{}. If this turns out to occur quite often,
a minor fix will need to be implemented. At present, if this occurs, a
waring message is printed to the logical unit {\sc lerr}.
\subsubsection{SUBROUTINE TJDROP}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 01 December, 1989 \\
{\bf References:} \\
{\bf Call Arguments:} (ITRK). \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink}. \\
{\bf Called by:} TCRAW2, TCROSS. \\
{\bf Subroutines Referenced:} {\sc zbera} {\sc mzdrop}. \\
\end{flushleft}
This routine will drop a track at the pattern recognition level. The
dropped track is assumed to be the last track lifted, and if this is
not the case, severe errors can occur, (this is checked for in the
routine). Dropping at the pattern recognition level implies disconnecting
the hits in the {\bf TJDC} bank, and removing the hits from the {\bf TCHT}
banks. The user should not try to use this routine.
\clearpage
\begin{figure}[p]
\begin{picture}(425,610)(50,-10)\centering
\thicklines
\put( 50,572){\vector(1,0){50}}
\put(100,560){\framebox(50,25){{\small TCPATT}}}
\put(125,560){\line(0,-1){520}}
\put(125, 40){\circle*{5}}
\put(125,532){\vector(1,0){50}}
\put(175,520){\framebox(50,25){{\small TCSGMT}}}
\put(125,492){\vector(1,0){50}}
\put(175,480){\framebox(50,25){{\small TCRAW1}}}
\put(225,452){\vector(1,0){25}}
\put(250,440){\framebox(50,25){{\small TCROSS}}}
\put(275,440){\line(0,-1){120}}
\put(275,320){\circle*{5}}
\put(275,412){\vector(1,0){50}}
\put(325,400){\framebox(50,25){{\small TCRESL}}}
\put(275,372){\vector(1,0){50}}
\put(325,360){\framebox(50,25){{\small TCFSRC}}}
\put(275,332){\vector(1,0){50}}
\put(325,320){\framebox(50,25){{\small TCRSRC}}}
\put(375,372){\vector(1,0){25}}
\put(400,360){\framebox(50,25){{\small TCRESL}}}
\put(375,332){\vector(1,0){25}}
\put(400,320){\framebox(50,25){{\small TCRESL}}}
\put(125,292){\vector(1,0){50}}
\put(175,280){\framebox(50,25){{\small TCRAW2}}}
\put(200,280){\line(0,-1){120}}
\put(200,160){\circle*{5}}
\put(200,252){\vector(1,0){50}}
\put(250,240){\framebox(50,25){{\small TCRESL}}}
\put(200,212){\vector(1,0){50}}
\put(250,200){\framebox(50,25){{\small TCFSRC}}}
\put(200,172){\vector(1,0){50}}
\put(250,160){\framebox(50,25){{\small TCRSRC}}}
\put(300,212){\vector(1,0){25}}
\put(325,200){\framebox(50,25){{\small TCRESL}}}
\put(300,172){\vector(1,0){25}}
\put(325,160){\framebox(50,25){{\small TCRESL}}}
\put(125,132){\vector(1,0){50}}
\put(175,120){\framebox(50,25){{\small TCRAW1}}}
\put(225,132){\vector(1,0){25}}
\put(250,120){\framebox(50,25){{\ldots}}}
\put(125, 92){\vector(1,0){50}}
\put(175, 80){\framebox(50,25){{\small TCRAW2}}}
\put(225, 92){\vector(1,0){25}}
\put(250, 80){\framebox(50,25){{\ldots}}}
\end{picture}
\caption[Pattern Recognition Software Flow]
{{\sf Flow of chamber software, pattern recognition section.}}
\label{fig:pattre}
\end{figure}
\clearpage
\subsection{The Circle Fitting Software}
The following subroutines are found in the {\sc tc\_circ} patch of the
{\sc locater} card file.
\subsubsection{SUBROUTINE TCADD}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 16 November, 1989 \\
{\bf References:} \\
{\bf Call Arguments:} (ITRK, IRSL, ITCHT). \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink} and {\sc tjprms}.\\
{\bf Called by:} TCSWEP. \\
{\bf Subroutines Referenced:} None. \\
\end{flushleft}
This routine will add the point at {\bf itcht} to the track {\sc itrk}
with resolution {\sc irsl}. This routine can only be called by
TCSWEP, and should not be generally used.
\subsubsection{SUBROUTINE TCAHIT}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 16 November, 1989 \\
{\bf References:} \\
{\bf Call Arguments:} (LYR, X, XERR, *KTCHT, *IMIN, *IRSL, *LGADD, IS, IDS) \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink} and {\sc tccuts}. \\
{\bf Called by:} TCSWEP. \\
{\bf Subroutines Referenced:} TCHECK. \\
\end{flushleft}
This subroutine will loop over all hits in layer {\sc lyr}, and see which
ones which are unresolved and finds the point {\sc ktcht} and the
resolution {\sc irsl} which minimizes the distance to the track specified
by the circle fit parameters {\sc x} and {\sc xerr}. The parameters {\sc is}
and {\sc ids} specify the sector number of the previous hit, and the
allowed variation in sector numbers of the added hit. {\sc imin} is
returned as the hit number of the matched hit.
\subsubsection{SUBROUTINE TCASSC}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 18 November, 1987 \\
{\bf References:} \\
{\bf Call Arguments:} None. \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink}, {\sc tclift},
{\sc tcprms}, {\sc tccuts} and {\sc tcangl}.
{\bf Subroutines Referenced:} {\sc tcload}, {\sc tccnct}, {\sc tciter},
and {\sc tcplow}. \\
\end{flushleft}
This routine is designed to examine all tracks found in the pattern
recognition section, and use the fit parameters as obtained from the
TCFITR routine to determine if any of the tracks are really the same
track.
In the first part, all tracks containing fewer than three points
are dropped using the TCCNCT routine. Then the remaining tracks are
ordered by the layer number of the innermost hit in each, smallest
layer number to largest, and stored in a track list..
In the second section, a search is made through all tracks in the track
list. Each track is examined to see if it could be sensibly have one of
the later tracks added to the end of it. If so, then a comparison is made
with all tracks occurring after the first track in the track list to
see if they are close to each other. This closeness is computed through
the quantity:
\[ \chi^{2} = \Delta p_{\perp}^{2}/\sigma_{p_{\perp}}^{2} +
\Delta\psi_{0}^{2}/\sigma_{\psi}^{2} \]
where \[ \sigma^{2}_{p_{\perp}} = \sigma^{2}_{p1} +
\sigma^{2}_{p2} \] and
\[ \sigma^{2}_{\psi} = \sigma^{2}_{\psi 1} + \sigma^{2}_{\psi 2} .\]
If this $\chi^{2}$ is smaller than a cutoff, {\sc chcttc} in the
{\sc /tccuts/} common block for any pair of tracks, then the routine
uses the TCLOAD routine to put both tracks into a temporary track, and
then calls TCITER to see if the track can be fit. If TCITER returns
with no error, the the TCCNCT routine is used to connect the two tracks.
If the fit is not good, then no connection is made. For the cases where
one or both of these tracks have fewer than six points, or an error code
from TCFITR larger than 3, the above $\chi^{2}$ is defined as
\[ \chi^{2} = 2\cdot({\textstyle min}(\Delta\psi_{0}^{2}/\sigma_{\psi}^{2},
\Delta p_{\perp}^{2}/\sigma_{p_{\perp}}^{2})) . \]
This redefinition is used because even in a very poor fit, one of the
two quantities is usually correct within errors.
During the above search, a list is compiled of all tracks with $p_{\perp}$
smaller than \mbox{100 MeV/c}, or that are short and disconnected, {\em ie},
which start in the middle layers of the \jdc{}. This list is passed to the
TCPLOW routine, which then tries to associate these tracks in a method which
is better suited for low momentum tracks.
\subsubsection{SUBROUTINE TCCIRC}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 15 November, 1989 \\
{\bf References:} \\
{\bf Call Arguments:} \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink} and {\sc tcangl}.\\
{\bf Called by:} TCTRAK. \\
{\bf Subroutines Referenced:} {sc tcfitr}, {\sc tcassc}, {\sc tcswep},
{\sc tcthet} and {\sc tcifix}. \\
\end{flushleft}
This routine is the steering routine for circle fitting in the \jdc{}.
It first calls the TCFITR routine to fit all tracks found in pattern
recognition. It then uses the TCASSC routine to try and put these
tracks together into larger tracks. Then the pointers to all the
tracks are loaded into a work area, and the TCSWEP routine is used
to try to add additional points to the tracks. The TCTHET routine is
then called to fit the track in $z$ and $\phi$, and then the TCIFIX
routine is called to correct the coordinates based on their crossing
angle through the chamber. Finally, the tracks are stored back into
the appropriate data banks.
\subsubsection{SUBROUTINE TCCNCT}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 22 April, 1988 \\
{\bf References:} \\
{\bf Call Arguments:} (ITRK1, ITRK2, I, ITCTK, JTCTK). \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink} and {\sc tcangl}.\\
{\bf Subroutines Referenced:} {\sc zebra} {\sc mzdrop} and {\sc zshunt}. \\
\end{flushleft}
This routine attaches track 2 whose number is {\sc itrk2} to the end
of track 1, ({\sc itrk1}). {\sc i} is the number of hits in track 1,
{\sc itctk} is the address of track 1 in the {\bf TCTK} data bank
and {\sc jtctk} is the address of track 2 in the {\bf TCTK} data bank.
The connection consists of setting the
forward and backward pointers in the {\bf TCHT} data bank to connect
the two tracks, adjusting the total number of hits in track 1, and
finally dropping the track 2 data bank. After calling this subroutine
the total number of found tracks is decreased by one. This routine
does not set the track number of all the hits in track 2 to be {\sc itrk1}.
If {\sc itrk1} and {\sc itrk2} are the same track, then this routine
drops the {\bf TCTK} data bank for track {\sc itrk1}.
\subsubsection{SUBROUTINE TCDEDX}
\begin{flushleft}
{\bf Author:} Klaus Peters and C. Strassburger\\
{\bf Creation Date:} 20 December, 1989. \\
{\bf References:} \\
{\bf Call Arguments:} \\
{\bf Common Blocks Used:} {\sc /cbbank/}, {\sc /cblink/} and {\sc /cjexft/}.\\
{\bf Called by:} {\sc tctrak} .\\
{\bf Subroutines Referenced:} {\sc tcrhit} and {\sc tcoord},\\
{\sc cernlib}: {\sc flpsor}. \\
\end{flushleft}
No documentation available.
\subsubsection{SUBROUTINE TCDISC}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 30 October, 1989 \\
{\bf References:} \\
{\bf Call Arguments:} (ITRK) \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink} and {\sc tcangl}.\\
{\bf Subroutines Referenced:} {\sc tccnct}. \\
\end{flushleft}
This routine will completely disconnect all hits of track {\sc itrk} in the
{\bf TCHT} data banks, and then use the TCCNCT routine to drop the track.
\subsubsection{SUBROUTINE TCDROP}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 26 May, 1988 \\
{\bf References:} \\
{\bf Call Arguments:} (ITRK, IPNT, *IERR). \\
{\bf Common Blocks Used:} {\sc cbbank} and {\sc cblink}.\\
{\bf Subroutines Referenced:} None. \\
\end{flushleft}
This routine will remove the point {\sc ipnt} from the track {\sc itrk}.
The removal consists of connecting the two adjacent hits in the {\bf TCHT}
bank over this hit, and decreasing the total number of hits in this track
by 1. The returned value of {\sc ierr} is 0 for normal completion
and 1 when an error is encountered.
\subsubsection{SUBROUTINE TCFITR}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 14 September, 1987 \\
{\bf References:} \\
{\bf Call Arguments:} None. \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink}, {\sc tclift},
{\sc tcprms}, {\sc tccuts} and {\sc tcangl}. \\
{\bf Subroutines Referenced:} {\sc tcload}, {\sc tcsplt} {\sc tcrslv}
and {\sc tciter}. \\
\end{flushleft}
This subroutine loops through all the found tracks in the TCRAWS
routine and uses the TCLOAD routine to put the hit information into
a working area and to make a guess for the circle which passes through
three of the points. It then passes this information to the TCITER
routine. If the resulting fit from TCITER is considered poor, then
the TCSPLT routine is called to either drop points out of the track,
or split the track up. The final fit results are then stored in the
{\bf TCTK} data banks.
The call to TCITER will usually improve upon the guess from TCLOAD.
However, sometimes problems do occur. The TCITER returns an error
code, {\sc ierr} as well as its improved results. TCFITR then processes
the error code as follows:
\begin{itemize}
\item {\sc ierr=0,1} means that the fit was good. The results are simply
stored in the {\bf TCTK} data bank using the TCLOAD routine.
\item {\sc ierr=3} means that the resulting $\chi^{2}$ of the TCITER
fit is too large. TCFITR then calls the TCSPLT routine to try and either
remove points, or break the track into several pieces. If TCSPLT returns
an {\sc icode=0}, (see TCSPLT for descriptions of {\sc icode} values),
then {\sc ierr} is set to 2, and the track is stored. If {\sc icode=1,2},
then the track is refit using TCITER, and if {\sc icode=3}, the track
is simply stored with {\sc ierr=3}.
\item {\sc ierr=4,5,7} means convergence was not reached in TCITER.
The TCSPLT routine is called and if {\sc icode=1,2} the track is refit.
If {\sc icode=0,3}, the track is simply stored using TCLOAD. There is
one special case in which {\sc ierr=7} and {\sc icode=0,3}. {\sc ierr=7}
means the error matrix was singular, and could not be inverted to yield
the covariance matrix. In this case, the covariance matrix is assigned
rather large values.
\end{itemize}
\subsubsection{SUBROUTINE TCHECK}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 27 April, 1989 \\
{\bf References:} \\
{\bf Call Arguments:} (ITCHT, X, RIN, XERR, *CHL, *CHR, *CHCUT). \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink} and {\sc tccuts}. \\
{\bf Subroutines Referenced:} None. \\
\end{flushleft}
This routine will examine the hit in the {\bf TCHT} data bank pointed to
by the {\sc itcht} pointer, and determine if it can fit on the circle
described by the circle parameters {\sc x} whose errors are given
in {\sc xerr}, ($\vec{x} = (\kappa,\psi0,c^{2})$).
{\sc rin} is passed as $1/2\cdot x(1)$, and the routine returns {\sc chl}
and {\sc chr}, as the distance in centimeters from the left and right
hand solution to the circle respectively.
The distance from a point, ($x$,$y$) and a circle of radius $\rho$,
centered at the point ($a$,$b$) is given by the formula:
\begin{eqnarray*}
d &=& \sqrt{ (x-a)^{2} + (y-b)^{2} } - \rho.
\end{eqnarray*}
In our circle parametrization, the values of $a$, $b$ and $\rho$ are
given as:
\begin{eqnarray*}
\rho &=& \sqrt{ (\frac{1}{2\cdot\kappa})^{2} - c^{2} } \\
a &=& \frac{\sin\psi_{0}}{2\cdot s\cdot\kappa} \\
b &=&-\frac{\cos\psi_{0}}{2\cdot s\cdot\kappa} \\
\end{eqnarray*}
The routine also computes the error in the distance based on the erros
in the circle parameters, {\sc xerr},
( $\vec{x}_{e} = (\sigma^{2}\kappa, \sigma^{2}\psi_{0},\sigma^{2}c^{2})$).
The error in the distance is given as:
\begin{eqnarray*}
\sigma_{d} &=& \sqrt{
\frac{{\textstyle (a\cdot\sigma_{a})^{2}+(b\cdot\sigma_{b})^{2} }}
{{\textstyle \sqrt{ (x-a)^{2} + (y-b)^{2} }}} + \sigma_{\rho}^{2} }
\end{eqnarray*}
where the errors in $a$, $b$ and $\rho$ are:
\begin{eqnarray*}
\sigma_{a}^{2} &=& (b\cdot\sigma_{\psi0})^{2} +
(a\cdot\frac{\sigma_{\kappa}}{\kappa} )^{2} \\
\sigma_{b}^{2} &=& (a\cdot\sigma_{\psi0})^{2} +
(b\cdot\frac{\sigma_{\kappa}}{\kappa} )^{2} \\
\sigma_{\rho}^{2} &=& (\frac{1}{2\cdot\rho})^{2} \cdot
( 1 + (\frac{\sigma_{\kappa}}{2\cdot\kappa^{3}})^{2} ). \\
\end{eqnarray*}
\subsubsection{SUBROUTINE TCIFIX}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 8 July, 1989 \\
{\bf References:} \\
{\bf Call Arguments:} None. \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink}, {\sc tclift},
{\sc cbunit}, {\sc tcprms}, {\sc tccuts}, {\sc tjprms} and {\sc tcdebg}. \\
{\bf Subroutines Referenced:} {\sc tcheck}. \\
\end{flushleft}
This routine will perform a crossing angle dependent correction to the
fit hit positions in the \jdc{}. During pattern recognition, and the
circle fits to the tracks, it is assumed that all tracks cross through
the jet cells in a direction parallel to the wire planes. For tracks
which have momentum less than infinity, this is rarely true. Instead, they
cross through the cell at some angle, ($\alpha$) away from the assumed
direction. In order to correct the positions in the chamber based on
the crossing angle, it has been assumed that the isochronus curves can
be well described as arcs of circles. The true position in the chamber
can then be computed as the point on the isochron--circle where the
slope of the track and the slope of the circle are the same. It is this
correction which is performed by this routine.
In order to correct the hit positions along a track, we start with the
fit circle for the track, (TCFITR routine),
\[ \frac{r_{i}}{2qR} + \frac{c^{2}}{2qRr_{i}} + \sin (\phi_{i}-\psi_{0}) = 0\]
where $R$, $c^{2}$ and $\psi_{0}$ are the three fit parameters. We note
that as long as one rotates both $\phi$ and $\psi_{0}$ by the same amount,
this equation is rotationally invariant. As such, it is simply expressed
in {\em sector coordinates}, (see TCRESL routine). In sector coordinates,
the angle at which a track crossed a jet cell is
\[ \tan\alpha = \frac{dy}{dx}\]
and defining $\Phi_{i} = \phi_{i} - s_{i}$, where $s_{i}$ is the angle at
the center of the \jdc{} sector, then
\begin{eqnarray*}
\frac{dy}{dx} &=&
\frac{ {\textstyle \sin\Phi + \cos\Phi\cdot r\cdot\frac{d\Phi}{dr}} }
{ {\textstyle \cos\Phi - \sin\Phi\cdot r\cdot\frac{d\Phi}{dr}} }
\end{eqnarray*}
Given $\alpha$, the center of the isochron circle ($a$,$b$) and the
circle radius, $r$, the position in the chamber is given as
\[ x = a - r\sin\alpha\] and \[y = b + r\cos\alpha.\]
The isochron parameters, $a$, $b$ and $r$ are obtained from the nominal
fit position in sector coordinates by the following transformations.
$x_{s}$ and $y_{s}$ are the x--y position in sector coordinates, and
$s_{i}$ is the stagger of the wire.
\[ a = x_{s} \]
\[ y_{f} = y_{s} - s_{i} \]
\[ r = {\textstyle min}(y_{f},r_{max}) \]
\[ b = y - r \]
The isochron correction then {\em pushes} the $y$ coordinate out to a
larger value to compensate for the crossing angle.
\[ y_{c} = y + r\cdot (\sec\alpha - 1) \]
In addition, there is an error term associated with this correction
which is estimated at 7.5\% of the correction term.
Once the positions have been computed, the errors in the $r$ and $\phi$
coordinates are computed from two parameters, $\sigma_{y0}$ and
$\sigma_{d}$. These two parameters describe the resolution of the chamber
as a function of drift time via the relation:
\[\sigma_{y}^{2} = \sigma_{y0}^{2} + t_{d}\cdot\sigma_{d}^{2} +
\left( 0.075\cdot r\cdot(\sec\alpha -1) \right)^{2} \]
The errors in $r$ and $\phi$ are:
\[\sigma_{r} = y_{s}\cdot\sigma_{y}/r \]
\[\sigma_{\phi} = x_{s}\cdot\sigma_{y}/r^{2} \]
The parameters $\sigma_{y0}^{2}$ and $\sigma_{d}^{2}$ are {\sc sy02tj}
and {\sc sydftj} in the {\sc /tjprms/} common block. During calibration,
they can be set using the {\bf SY02} and {\bf SYDF} cards in CJINIT.
\subsubsection{SUBROUTINE TCITER}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 14 September, 1987 \\
{\bf References:} {\bf Datenanalyse} by Siegmund Brandt, p.271. \\
{\bf Call Arguments:} (ITRK, Y, GYINV, *X, *COVR, *CHISQ, *IERR). \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink},
{\sc tcprms}, {\sc tccuts} and {\sc tcangl}.
{\bf Subroutines Referenced:} None. \\
\end{flushleft}
This routine fits the track data as $(r,\phi)$ pairs with known errors
to the equation of a circle
\[ \kappa\cdot r_{i} + \frac{\kappa\cdot c^{2}}{r_{i}\cdot q\cdot R}
+ \sin (\phi_{i} - \psi_{0}) = 0 \]
where the fit parameters are $\kappa$, $\psi_{0}$ and $c^{2}$. $\kappa$
is defined to be $\frac{q\cdot B_{s}}{2\cdot R}$ where $q$ is the
charge of the particle, $B_{s}$ is the direction of the magnetic field,
and $R$ is the distance to the center of the circle from the origin.
$\psi_{0}$ is the direction of the track at the point of closest
approach to the origin, and $c^{2}$ is defined as $c^{2}=R^{2}-\rho^{2}$
where $\rho$ is the radius of the circle. Note that $c^{2}$ can be negative.
An initial
guess for these parameters is passed in the double precision array
{\sc x(3)}, and the final values are returned in the same array. The
covariance matrix from the fit is returned in the double precision
array {\sc covr(3,3)}. The track coordinates are passed as
$(r,\phi)$ pairs in the double precision array {\sc y(n2)}, while their
errors are passed in the double precision array {\sc gyinv(n2)}. The
routine also returns the $\chi^{2}$ of the fit in the single precision
variable {\sc chisq} and an error code {\sc ierr}. The error code
identifies how well the iteration converged, and is given the meanings as
follows.
\begin{itemize}
\item {\sc ierr=0} Normal convergence, no problems.
\item {\sc ierr=1} Initial guess was very good, no iterations done.
\item {\sc ierr=2} Not set in this routine.
\item {\sc ierr=3} The $\chi^{2}$ was too large for this track.
\item {\sc ierr=4} The value of $\xi^{2}$ started to diverge after
3 iterations.
\item {\sc ierr=5} The track failed to converge in {\sc nitrtc} iterations.
\item {\sc ierr=6} There were too few points to fit ($n<3$).
\item {\sc ierr=7} Matrix inversion of a singular matrix, don't
trust the results of the covariance matrix.
\end{itemize}
The fit is done by first writing the $(r,\phi)$ data pairs in a
vector $\vec{Y}$ as:
\[
\vec{Y} = \left ( \begin{array}{c}
r_{1} \\ \phi_{1} \\ r_{2} \\ \phi_{2} \\ \vdots \\ r_{n} \\ \phi_{n}
\end{array} \right ) . \]
The errors of these points are in a {\sc 2npts} by {\sc 2npts}
matrix ${\cal G}_{y}^{-1}$ given as:
\[
{\cal G}_{y}^{-1} = \left ( \begin{array}{ccccc}
\delta r_{1}^{2} & & & & \\
& \delta \phi_{1}^{2} & & & \\
& & \ddots & & \\
& & & \delta r_{n}^{2} & \\
& & & & \delta \phi_{n}^{2} \end{array} \right )
\]
We then express the three fit parameters as a vector $\vec{X}$,
\[
\vec{X} = \left ( \begin{array}{c}
q\cdot B_{s}/R \\ \psi_{0} \\ c^{2} \end{array} \right ) .\]
With these, we form {\sc npts} equations of constraint using the above
equation for a circle.
\[ f_{i} = X_{1}\cdot Y_{2i-1} + \frac{X_{1}\cdot X_{3}}{Y_{2i-1}} +
\sin (Y_{2i} - X_{2}) .\]
The {\sc npts} by 3 matrix ${\cal A} = \partial f / \partial X$ is defined as:
\begin{eqnarray*}
{\cal A} &=& \left ( \begin{array}{ccc}
\frac{\partial f_{1}}{\partial X_{1}} & \frac{\partial f_{1}}{\partial X_{2}}
& \frac{\partial f_{1}}{\partial X_{3}} \\
\vdots & \vdots & \vdots \\
\frac{\partial f_{n}}{\partial X_{1}} & \frac{\partial f_{n}}{\partial X_{2}}
& \frac{\partial f_{n}}{\partial X_{3}}
\end{array} \right ) \end{eqnarray*}
The {\sc npts} by {\sc 2npts} matrix ${\cal B}= \partial f / \partial Y$ is
defined as:
\[
{\cal B} = \left ( \begin{array}{ccc}
\frac{\partial f_{1}}{\partial Y_{1}} & \cdots & \frac{\partial f_{1}}
{\partial Y_{2n}} \\
\vdots & & \vdots \\
\frac{\partial f_{n}}{\partial Y_{1}} & \cdots & \frac{\partial f_{n}}
{\partial Y_{2n}} \end{array} \right ) \]
and the {\sc npts} elements of the vector $\vec{C}$ are given as the
values of $f_{i}$.
We now define the matrix
\[ {\cal G}_{B} = ({\cal B}{\cal G}_{y}^{-1}{\cal B}^{T})^{-1} \]
and with this, we form the iterative sequence:
\[ \vec{X}_{i+1} = \vec{X}_{i} - ({\cal A}^{T}{\cal G}_{B}{\cal A})^{-1}
({\cal A}^{T}{\cal G}_{B}\vec{C}) \]
and the covariance matrix for these values of $\vec{X}$ is given as:
\[ {\cal C}_{X} = ({\cal A}^{T}{\cal G}_{B}{\cal A})^{-1}. \]
\subsubsection{SUBROUTINE TCLOAD}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 19 April, 1988 \\
{\bf References:} \\
{\bf Call Arguments:} (ITRK, IOPT, ITCTK, *X, COVR, *CHRG, *Y, *GYINV,
CHISQ). \\
{\bf Common Blocks Used:} {\sc /cbbank/}, {\sc /cblink/},
{\sc /tcprms/}, {\sc /tccuts/} {\sc /tchits/}and {\sc /tcangl/}.
{\bf Subroutines Referenced:} None. \\
\end{flushleft}
This subroutine loads and stores all the hit coordinates, $r$ and $\phi$, for track
number {\sc itrk} into the {\sc y} vector, and their errors into the
vector {\sc gyinv}. It also loads the sines and cosines of each point into
the {\sc /tcangl/} common block and makes sure that every hit in the track
has been assigned the track number {\sc itrk}. Finally, the routine makes
a guess for the circle parameters, and places that in the vector {\sc x}.
It also guesses what the charge is, places that in {\sc chrg}.
The passed value of {\sc iopt} determines which information is loaded
according to the following rules.
\begin{itemize}
\item[0] Load the $(r,\phi)$ information and $(\sigma_{r},\sigma_{\phi})$
information from the TCHT data bank, then make a guess for the track
parameters.
\item[1] Load the $(r,\phi)$ and $(\sigma_{r},\sigma_{\phi})$ information,
but do not make a guess.
\item[2] Load the $(r,\phi)$ and $(\sigma_{r},\sigma_{\phi})$ information
from this track to the end of the track already loaded. Do not make
a guess.
\item[3] Only make a guess using the previously loaded information
\item[4] Store the fit information for {\sc x} and its covariance matrix,
{\sc covr} in the {\bf TCTK} data bank.
\item[5] Store the information for {\sc x} in the {\bf TCTK} data bank,
and the fit information in {\sc y} and {\sc gyinv} in the {\bf TCHT}
data banks.
\end{itemize}
The initial guess for the circle parameters are made by fitting three
points on the track to a circle of the form
\[ (x-a)^{2} + (y-b)^{2} = r^{2} .\] The points chosen are the first
hit, ($x_{1},y_{1}$), the last hit, ($x_{3},y_{3}$) and a hit in the
middle of the track, ($x_{2},y_{2}$). The parameters are then given as:
\begin{eqnarray*}
b &=& \frac{{\textstyle \frac{x_{2}^{2}+y_{2}^{2}-x_{1}^{2}-y_{1}^{2}}
{2(x_{2}-x_{1})} - \frac{x_{3}^{2}+y_{3}^{2}-x_{1}^{2}-y_{1}^{2}}
{2(x_{3}-x_{1})} }}
{{\textstyle \frac{y_{1}-y_{2}}{x_{1}-x_{2}} -
\frac{y_{1}-y_{3}}{x_{1}-x_{3}}}} \\
a &=& \frac{{\textstyle x_{2}^{2}-y_{2}^{2}-x_{1}^{2}-y_{1}^{2}}}
{{\textstyle 2(x_{2} - x_{1})}} - b\cdot\frac{{\textstyle y_{2}-y_{1}}}
{{\textstyle x_{2}-x_{1}}} \\
r^{2} &=& (x_{1}-a)^{2} + (y_{1}-b)^{2}
\end{eqnarray*}
The circle parameters, $X = (R,\psi_{0},c^{2})$ are then obtained as
follows:
\begin{eqnarray*}
R &=& q\cdot B_{s} /\sqrt{a^{2} + b^{2}} \\
\psi_{0} &=& \tan^{-1}(-b/-a) - s\cdot \frac{\pi}{2} \\
c^{2} &=& R^{2} - r^{2} \\
q &=& s\cdot b_{s}
\end{eqnarray*}
where $q$ is the charge of the particle, and $b_{s}$ is the direction
of the magnetic field, ($+1$ along the z--axis and $-1$ against the
z--axis). The value $s$ is determined from
the formula \[ \psi_{0} = \beta_{0} - s\cdot\frac{\pi}{2} .\] The
angle $\beta_{0}$ is defined as the angle relative to the center of the
circle to the point of closest approach of the track, it can be obtained
from the formula: $ \beta_{0} = atan2(-b,-a) $. The angle $\psi_{0}$
measures the direction of the track at that point.
forming the two values of $\psi_{0}$, ($\pm\frac{\pi}{2}$) and
determining which one is closer to the $\phi$ angle of the first hit in the
track. If the $+$ case is closer, the charge is positive while if the
$-$ case is closer, the charge is negative. The routine then returns
{\sc x} and {\sc chrg} containing the 3 fit parameters and the charge
respectively. If {\sc guess} is {\sc .false.}, then nothing is done
to the passed values of {\sc x} and {\sc chrg}.
In storing the values of {\sc x}, {\sc covr} and {\sc chisq}
into the {\bf TCTK} data bank for track {\sc itrk}. {\sc x} is
double precision and contains the three fit parameters, $(R,\psi_{0},c^{2})$,
while {\sc covr} is the double precision covariance matrix for these values,
and the single precision variable {\sc chisq} is the chi--square of
the circle fit. This routine
also computes the transverse momentum, and its error and puts it
in the {\bf TCTK} data bank.
\[ p_{\perp} = e\cdot B\cdot r\]
where
\[ r = \sqrt{R^{2}-c^{2}}. \]
\[ \sigma_{p} = \frac{e\cdot B}{r}\cdot\sqrt{\sigma_{RR} +
\frac{1}{4}\sigma_{cc}}. \]
\subsubsection{SUBROUTINE TCRSLV}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 10 November, 1988 \\
{\bf References:} \\
{\bf Call Arguments:}(ITRK, X, COVR, *N). \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink}, {\sc tchits}
{\sc tjconv} and {\sc tccuts}.\\
{\bf Subroutines Referenced:} {\sc tcheck}, {\sc tcresl} and
{\sc tcdrop}. \\
\end{flushleft}
This routine is called after the circle fit to a track has been
made. It tries to resolve points for which the left--right ambiguity
was unresolvable during pattern recognition. The routine takes the circle
fit information for track {\sc itrk} given as the double precision
variables {\sc x} and {\sc covr}, (see TCFITR for a description), and
checks each point which has been unresolved, (identified in the {\sc
/tchits/} common block) to see if one of the two solutions could be
sensibly added to this track. The check is made using the TCHECK
routine, and if the point can be added, the TCRESL routine is called
to resolve it. If the point can not be added, then the TCDROP routine
is used to discard the point from the track.
The TCHECK routine returns three parameters to this routine, a $\chi_{l}$
$\chi_{r}$ and $\chi_{cut}$. The routine then uses the {\sc rslvtc}
parameter in the {\sc /tccuts/} common block to set a cut level by simply
multiplying it by the returned cut off.
\subsubsection{SUBROUTINE TCSPLT}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 6 May, 1988 \\
{\bf References:} \\
{\bf Call Arguments:} (ITRK, IOPT, DEVI, CHLIM, *ICODE). \\
{\bf Common Blocks Used:} {\sc tcangl} and {\sc tccuts}. \\
{\bf Called by:} {\sc tcfitr} and {\sc tcswep}. \\
{\bf Subroutines Referenced:} {\sc sm353}. \\
\end{flushleft}
This routine is called by TCFITR and TCSWEP to try and remove outlyers
in the $r$--$\phi$ plane from track {\sc itrk} in the {\bf TCTK} data
bank. The definition of an outlyer is controlled
by the passed arguments {\sc devi} and {\sc chlim}. Where {\sc devi}
is the outlyer distance in centimeters, and {\sc chlim} is the contribution
which the hit must make to the total $\chi^{2}$ to be considered an
outlyer. The control argument {\sc iopt} identifies if the outlyer is
dropped, ({\sc iopt}=0), or the error in $\phi$ is blown up, ({\sc iopt}=1).
The returned value of {\sc icode} indicates how many points were either
dropped or tagged.
The routine works by using data in the {\sc /tchits/} common block
which are filled by the TCITER routine. As such this routine should
only be called immediately after TCITER has been called.
TCSPLT uses the SM353 smoothing algorithem to establish a baseline
deviation of all points from their measured values. It then looks
at how far every point was moved from its baseline value. Those points
were moved more than {\sc devi}, and contribute more than {\sc chlim}
to the total $\chi^{2}$ are then tagged for either dropping or
error explosion.
The appropriate action is then taken on all bad points. However, if more
than 4 points are tagged for dropping, no action is taken.
\begin{figure}[htbp]\centering
\begin{picture}(400,100)
\multiput( 50, 0)(10,10){5}{\circle*{2}}
\put(110,50){\circle*{2}}
\multiput(110,60)(10,10){5}{\circle*{2}}
\put(100,20){\makebox(0,0){a}}
\multiput(250, 0)(10,10){5}{\circle*{2}}
\multiput(300,50)(17,10){5}{\circle*{2}}
\put(300,20){\makebox(0,0){b}}
\end{picture}
\caption[Bad tracks.]{{\sf Two causes of bad track fits. (a) shows a track
with one bad point, and (b) shows a track that will be split into two
tracks.}}
\label{fig:badtr}
\end{figure}
\subsubsection{SUBROUTINE TCSWEP}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 6 May, 1988 \\
{\bf References:} \\
{\bf Call Arguments:} (*IERR). \\
{\bf Common Blocks Used:} {\sc tcangl} and {\sc tccuts}. \\
{\bf Called by:} TCCIRC. \\
{\bf Subroutines Referenced:} {\sc tcahit}, {\sc tcadd}. \\
\end{flushleft}
This routine looks through all fit tracks, and tries to add unused
hits to them. It begins by looking for gaps in the existing track,
and then tries to extend the track back to layer 1 in the JDC. Finally,
an outward projection is made to either layer 23, or until a gap of
five layers is found.
\subsubsection{SUBROUTINE TCTHET}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 26 October, 1987 \\
{\bf References:} \\
{\bf Call Arguments:} None. \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink}, {\sc tclift},
{\sc tcprms}, {\sc tccuts} and {\sc tcangl}.
{\bf Subroutines Referenced:} None. \\
\end{flushleft}
This routine fits the tracks which have passed through TCASSC
for opening angle, $\lambda$ and $z$ traceback. In doing this fit,
at least 3 points are required, and at most 15 are used. The data
are fitted to a line form:
\[ z_{i} = a + b\cdot r_{i}, \]
using a weighted least squares method. From this fit, the tangent of
the opening angle is given as:
\[ \tan\lambda = b, \]
The values of $a$ and $b$ are obtained from a least squares fit, and are:
\begin{eqnarray*}
a & = & \frac{1}{\Delta}\cdot\left( \sum\frac{z_{i}}{\sigma_{i}^{2}}\cdot
\sum\frac{r_{i}^{2}}{\sigma_{i}^{2}} - \sum\frac{r_{i}}{\sigma_{i}^{2}}
\cdot \sum\frac{r_{i}\cdot z_{i}}{\sigma_{i}^{2}} \right) \\
b & = & \frac{1}{\Delta}\cdot\left( \sum\frac{1}{\sigma_{i}^{2}}\cdot
\sum\frac{z_{i}\cdot r_{i}}{\sigma_{i}^{2}} - \sum\frac{z_{i}}{\sigma_{i}^{2}}
\cdot\sum\frac{r_{i}}{\sigma_{i}^{2}} \right) \\
\Delta &=& \sum\frac{1}{\sigma_{i}^{2}} \cdot \sum\frac{r_{i}^{2}}
{\sigma_{i}^{2}} - \left ( \sum \frac{r_{i}}{\sigma_{i}^{2}} \right )^{2}\\
s^{2} &=& \frac{1}{N-2}\cdot\sum (z_{i} - a b\cdot r_{i})^{2}
\end{eqnarray*}
and the errors in the fit quantities $a$ and $b$ are given as:
\begin{eqnarray*}
\sigma_{a}^{2} &=& \frac{1}{\Delta}\cdot s^{2}\cdot\sum
\frac{r_{i}}{\sigma_{i}^{2}} \\
\sigma_{b}^{2} &=& \frac{1}{\Delta}\cdot s^{2}\cdot N.
\end{eqnarray*}
This can then be expressed as a covariance matrix between $\tan\lambda$
and $a$ as:
\begin{eqnarray*}
\left( \begin{array}{cc}
\sigma_{\lambda\lambda} & \sigma_{\lambda a} \\
\sigma_{\lambda a} & \sigma_{aa} \end{array} \right) & = &
\left( \begin{array}{cc}
\sigma_{b}^{2} & 0 \\
0 & \sigma_{a}^{2} \end{array} \right)
\end{eqnarray*}
If somehow the value of $\lambda$ were $\pm90^{\circ}$, the value of
the error code in the {\bf TCTK} data bank would be set to 8, and
and a value of $\tan\lambda = \pm 10^{8}$ would be returned. If the
routine becomes lost in stepping through the track, the error code
is set to a value of 9.
\clearpage
\begin{figure}[p]
\begin{picture}(425,605)(50,-5)\centering
\thicklines
\put( 50,572){\vector(1,0){50}}
\put(100,560){\framebox(50,25){{\small TCTRAK}}}
\put(150,572){\vector(1,0){25}}
\put(175,560){\framebox(50,25){{\small TCCIRC}}}
\put(200,560){\line(0,-1){500}}
\put(200,55){\circle{10}}
\put(200,55){\makebox(0,0){{\tiny A}}}
\put(200,552){\vector(1,0){50}}
\put(250,540){\framebox(50,25){{\small TCFITR}}}
\put(275,540){\line(0,-1){160}}
\put(275,380){\circle*{5}}
\put(275,512){\vector(1,0){50}}
\put(325,500){\framebox(50,25){{\small TCLOAD}}}
\put(275,472){\vector(1,0){50}}
\put(325,460){\framebox(50,25){{\small TCITER}}}
\put(275,432){\vector(1,0){50}}
\put(325,420){\framebox(50,25){{\small TCSPLT}}}
\put(275,392){\vector(1,0){50}}
\put(325,380){\framebox(50,25){{\small TCRSLV}}}
\put(350,380){\line(0,-1){ 80}}
\put(350,300){\circle*{5}}
\put(350,352){\vector(1,0){50}}
\put(400,340){\framebox(50,25){{\small TCHECK}}}
\put(350,312){\vector(1,0){50}}
\put(400,300){\framebox(50,25){{\small TCRESL}}}
\put(200,232){\vector(1,0){50}}
\put(250,220){\framebox(50,25){{\small TCASSC}}}
\put(275,220){\line(0,-1){160}}
\put(275, 60){\circle*{5}}
\put(275,192){\vector(1,0){50}}
\put(325,180){\framebox(50,25){{\small TCCNCT}}}
\put(275,152){\vector(1,0){50}}
\put(325,140){\framebox(50,25){{\small TCLOAD}}}
\put(275,112){\vector(1,0){50}}
\put(325,100){\framebox(50,25){{\small TCITER}}}
\end{picture}
\caption[Circle Fit Software Flow I.]
{{\sf Flow of the chamber software, circle fitting section.}}
\label{fig:flow2}
\end{figure}
\clearpage
\begin{figure}[p]\centering
\begin{picture}(425,605)(50,-5)\centering
\put(200,565){\circle{10}}
\put(200,565){\makebox(0,0){{\tiny A}}}
\put(200,560){\line(0,-1){260}}
\put(200,300){\circle*{5}}
\put(200,552){\vector(1,0){50}}
\put(250,540){\framebox(50,25){{\small TCSWEP}}}
\put(275,540){\line(0,-1){ 80}}
\put(275,460){\circle*{5}}
\put(275,512){\vector(1,0){50}}
\put(325,500){\framebox(50,25){{\small TCAHIT}}}
\put(275,472){\vector(1,0){50}}
\put(325,460){\framebox(50,25){{\small TCADD }}}
\put(200,432){\vector(1,0){50}}
\put(250,420){\framebox(50,25){{\small TCTHET}}}
\put(200,392){\vector(1,0){50}}
\put(250,380){\framebox(50,25){{\small TCIFIX}}}
\put(200,352){\vector(1,0){50}}
\put(250,340){\framebox(50,25){{\small TCDEDX}}}
\end{picture}
\caption[Circle Fit Software Flow II.]
{{\sf Flow of the chamber software, circle fitting section.}}
\label{fig:flow3}
\end{figure}
\clearpage
\subsection{Helix Fitting Software}
The following subroutines are found in the {\sc tc\_helx} patch of the
{\sc locater} card file.
\subsubsection{SUBROUTINE TCHELX}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 27 May, 1988 \\
{\bf References:} {\bf Datenanalyse} by Siegmund Brandt, p.271. \\
{\bf CERN Program Library}, routine F101, ({\sc matin2}).\\
{\bf Call Arguments:} (IOPT, NTRK). \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink}, {\sc tclift},
{\sc tcprms}, {\sc tccuts} and {\sc tcangl}.\\
{\bf Subroutines Referenced:} {\sc tchxld},\\
{\sc (cern library) dinv}.\\
\end{flushleft}
This routine loops over the {\sc ntrk} tracks found, and fits the points
in track {\sc itrk} with a helix of the form:
\begin{eqnarray}
x_{i} &=& r_{0}\cdot\sin\psi_{0} +
\frac{1}{\alpha}\cdot (\cos\beta_{i} + s\cdot\sin\psi_{0} ) \\
y_{i} &=&-r_{0}\cdot\cos\psi_{0} + \frac{1}{\alpha}\cdot (\sin\beta_{i} -
s\cdot\cos\psi_{0} ) \\
z_{i} &=& z_{0} - \frac{s\cdot\tan\lambda}{\alpha}\cdot (\beta_{i} -
\psi_{0} - s\cdot\frac{\pi}{2})
\end{eqnarray}
where the angle $\beta_{i}$ is the azimuthal angle of the line from the
center of the helix to the point $(x_{i},y_{i})$. The value of {\sc iopt}
is used to tell the TCHXLD routine from which bank the coordinates are to be
taken, and if they should be updated during the iteration.
\begin{itemize}
\item {\sc iopt=0} The routine assumes that the {\bf TCTR} banks do not
exist, and creates them. It then takes the data from the {\bf TCTK}
bank and stores it in the TCTR bank. Also, the ($x$,$y$,$z$) coordinates
are improved at each iteration, and the improved values are stored in the
{\bf TCTR} bank.
\item {\sc iopt=1} This is the same as option 0, except the improved
coordinates are not stored at the end of the iteration.
\item {\sc iopt=2} The routines assumes that the {\bf TCTR} bank does
exist, and takes the track data from it. The improved coordinates are then
stored in the bank upon completion.
\item {\sc iopt=3} This is the same as 2, except the improved coordinates
are not stored upon completion.
\end{itemize}
The five parameters that describe the helix are
$\vec{\xi} = (r_{0},z_{0},\alpha,\tan\lambda,\psi_{0};s)$.
$r_{0}$ is the distance of closest approach to the z--axis, and can
be negative. The sign is chosen to make the helix fit stable when the
charge of the particle is changed by the fit. $z_{0}$ is the value of $z$
at the radius $\mid r_{0}\mid $, $\alpha$ is the inverse of the radius
of curvature of the helix, $\lambda$ is the opening angle of the helix,
$\psi_{0}$ is the angle from the circle fit and $s$ is a sign parameter
which is related to the particle charge through the direction of the
magnetic field.
In order to fit these equations to
the measured points $(x,y,z)_{i}$ with measurement errors $(\sigma_{x},
\sigma_{y},\sigma_{z})_{i}$, we solve for the parameter $\beta_{i}$ by
rewriting the first two equations as:
\begin{eqnarray}
\cos\beta_{i} &=& \alpha\cdot x_{i} - \sin\psi_{0}\left(\alpha\cdot
r_{0}+s\right) \\
\sin\beta_{i} &=& \alpha\cdot y_{i} + \cos\psi_{0}\left(\alpha\cdot
r_{0}+s\right) \\
\end{eqnarray}
These can be solved to yield $\beta_{i}$:
\begin{eqnarray}
\beta_{i} &=& \tan^{-1}(\sin\beta_{i}/\cos\beta_{i}) \\
\end{eqnarray}
We now have two equations of constraint for every point $i$ on the track:
\begin{eqnarray}
f_{1i} &=& \frac{1}{\alpha}\left( \cos^{2}\beta_{i} + \sin^{2}\beta_{i}
-1 \right) \\
f_{2i} &=& z_{0} - z_{i} - \frac{s\cdot\tan\lambda}{\alpha} \left(\beta_{i}
- \psi_{0} -s\cdot\frac{\pi}{2}\right)
\end{eqnarray}
The first equation can also be written as:
\begin{eqnarray*}
f_{1i} &=& \alpha\left( x_{i}^{2} + y_{i}^{2} + r_{0}^{2}\right)
+ 2\cdot s\cdot r_{0}
+ 2\cdot\left( \alpha\cdot r_{0} + s\right) \left( y_{i}\cos\psi_{0}
-x_{i}\sin\psi_{0}\right) \\
\end{eqnarray*}
In order to make an iterative fit to the unknown helix parameters,
$\vec{\xi} = (r_{0},z_{0},\alpha,\tan\lambda,\beta_{0})$, (see the
description of the TC2HLX routine), we form a vector out of
all the measured quantities,
\[ \vec{\eta} = (x_{1},y_{1},z_{1},x_{2},y_{2},\cdots,z_{n}),\]
and define a $3N$ by $3N$ diagonal error matrix, ${\cal G}_{\eta}$ as:
\[
{\cal G}_{\eta}^{-1} = \left( \begin{array}{ccccccc}
\delta x_{1}^{2} & & & & & & \\
& \delta y_{1}^{2} & & & & & \\
& & \delta z_{i}^{2} & & & & \\
& & & \delta x_{2}^{2} & & & \\
& & & & \delta y_{2}^{2} & & \\
& & & & & \ddots & \\
& & & & & & \delta z_{N}^{2} \end{array} \right) \]
Now the $2N$ by $5$ matrix $\cal{A}$ is formed such that:
\[ {\cal A} = \left( \begin{array}{ccc}
\frac{\partial f_{1}}{\partial\xi_{1}} & \cdots & \frac{\partial f_{1}}
{\partial\xi_{5}} \\
\vdots & & \vdots \\
\frac{\partial f_{2N}}{\partial\xi_{1}} & \cdots & \frac{\partial f_{2N}}
{\partial\xi_{5}} \end{array} \right) , \]
the $2N$ by $3N$ matrix $\cal{B}$ is defined to be:
\[ \cal{B} = \left( \begin{array}{ccc}
\frac{\partial f_{1}}{\partial\eta_{1}} & \cdots & \frac{\partial f_{1}}
{\partial\eta_{3N}} \\
\vdots & & \vdots \\
\frac{\partial f_{2N}}{\partial\eta_{1}} & \cdots & \frac{\partial f_{2N}}
{\partial\eta_{3N}} \end{array} \right) \]
and the $2N$ long vector {\bf C} as $C_{i} = f_{i}$.
If we now define that $2N$ by $2N$ matrix $\cal{G}_{B}$ as:
\[ {\cal G}_{B} = ({\cal B}{\cal G}_{\eta}^{-1}{\cal B}^{T})^{-1} \]
and then form the iterative sequence for $\vec{\xi}$:
\[ \vec{\xi}_{[i+1]} = \vec{\xi}_{[i]} - ({\cal A}^{T}{\cal G}_{B}{\cal A})^{-1}
({\cal A}^{T}{\cal G}_{B}\vec{C}). \] The measurements, $\vec{\eta}$ are
improved using the formula
\[ \delta\vec{\eta} = {\cal G}_{\eta}^{-1}{\cal B}^{T}{\cal G}_{B}
(\vec{C} - {\cal A}\delta\vec{\xi}) .\] On each step of the iteration, the
quantity, $\vec{\epsilon} = \vec{\eta}_{0} - \vec{\eta}_{i}$,
\[ \chi^{2} = ({\cal B}\vec{\epsilon})^{T}{\cal G}_{B}
({\cal B}\vec{\epsilon}) \]
is computed. If $\chi^{2}$ falls below the cutoff, {\sc chlxtc} in
the {\sc /tccuts/} common block, or the variation in $\chi^{2}$ between
iterations becomes smaller than {\sc chlxtc}, then the routine stops
iterating. The routine also stops if the number of
iterations exceeds {\sc nhlxtc} in the {\sc /tccuts/} common block, or the
value of $\chi^{2}$ begins to increase. If the iteration does successfully
converge, the covariance matrix for the 5 fit parameters is given as:
\[ {\cal C}_{\xi} = ({\cal A}^{T}{\cal G}_{B}{\cal A})^{-1}, \]
while the fit errors of the measurements are computed as
\[ {\cal G}_{\eta,\mbox{final}}^{-1} = {\cal G}_{\eta}^{-1} -
{\cal G}_{\eta}^{-1}
{\cal B}^{T}{\cal G}_{B}{\cal B}{\cal G}_{\eta}^{-1} + {\cal G}_{\eta}^{-1}
{\cal B}^{T}{\cal G}_{B}{\cal A}{\cal C}_{\xi}{\cal A}^{T}
{\cal G}_{B}{\cal B}{\cal G}_{\eta}^{-1}. \] (Actually, only the diagonal
elements of this matrix are computed, as the correlations are not needed.)
This routine uses an initial guess for $\vec{\xi}$ derived from the results
of the separate $r-\phi$ and $r-z$ fits, (see TCHXLD and TC2HLX
routines). In most cases, this initial guess should be good enough that
no improvement on the fit values will be made. In that case, only the
covariance matrix will be determined by this routine. It is important
that this covariance matrix be correct in order to do a proper vertex
fit at later levels of the analysis.
This routine assigns an error code to each track fit. The meanings of these
codes are as follows:
\begin{itemize}
\item {\bf 0} means that the code converged normally.
\item {\bf 10} means that the routine was not implemented for this track.
This can happen if there are exactly three points in the track, or
if the opening angle $\lambda$ is close to 0.
\item {\bf 30} means the code converged with a value of $\chi^{2}$
which was too large.
\item {\bf 40} means the $\chi^{2}$ started to diverge during iteration.
\item {\bf 50} means the iteration limit was exceeded.
\item {\bf 60} means that there were fewer than 3 points in this track.
\item {\bf 70} means that an attempt was made to invert a singular
matrix.
\end{itemize}
The value of this code is added to the code from the TCFITR and TCTHET
routines (that code is between 0 and 9), to form an error code for the
fit track. If the error code from this routine is 0, then the results
of the fit are stored in the {\bf TCTR} data bank using the TCHXLD
routine. For all other values of the error code, the guess to the
parameters made in TCHXLD by combining the TCFITR and TCTHET fits
is retained, but the error code is updated.
\subsubsection{SUBROUTINE TCHXLD}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 27 May, 1987 \\
{\bf References:} \\
{\bf Call Arguments:} (ITRK, ICODE, *NPTS, *X, *Y, *GYINV, *SIGN,
*COVR, *IERR). \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink}, {\sc tclift},
and {\sc zbdivs}.\\
{\bf Subroutines Referenced:} {\sc tc2hlx},\\
{\sc (zebra library) mzlift}. \\
\end{flushleft}
This routine transfers data between the {\bf TCTR} data banks, and the
working double--precision arrays {\sc x}, {\sc y}, {\sc gyinv},
{\sc sign} and {\sc covr}. The direction of the transfer depends on the
value of the passed parameter {\sc icode}.
In the case of {\sc icode=0}, the routine first lifts a {\bf TCHX} subbank
for track {\sc itrk}. Then the results from TCFITR and TCTHET
are converted into helix coordinates using the TC2HLX subroutine,
and stored in both the {\bf TCHX} data bank. The TC2HLX routine
has already stored the helix coordinates in {\sc x} and {\sc covr}.
Next, the routine goes into the {\bf TCHT} data bank for this track, and
loads the $(x,y,z)$ and $(\sigma_{x}^{2},\sigma_{y}^{2},\sigma_{z}^{2})$
values into the {\bf TCTR} data bank. It also loads them into the {\sc y}
and {\sc gyinv} arrays. The error code from the {\bf TCTK} bank is
also copied into the {\bf TCTR} data bank. If the number of points is
less than 3, then this routine returns with {\sc ierr=60}, and if the
number of points is exactly 3, then the routine returns with
{\sc ierr=10}. Since version 1.50, the routine also looks through the
{\bf TPWC} cluster banks, and loads any \pwc{} information which has
been connected to the track.
In the case of {\sc icode=1}, the routine assumes that the {\bf TCHX}
data bank for track {\sc itrk} exists, and copies the information out
of that bank into the {\sc x}, {\sc y}, {\sc gyinv} and {\sc covr}
arrays.
In the case of {\sc icode=2}, the routine stores the values
in {\sc x}, {\sc y}, {\sc gyinv} and {\sc covr} in the {\bf TCHX}
data bank for track {\sc itrk}.
In the case of {\sc icode=3}, the routine stores the values contained
in {\sc x} and {\sc covr} in the {\bf TCHX} data bank for track {\sc itrk}.
In the case of {\sc icode=4}, the routine updates the error code
in the {\bf TCTR} bank using the value of {\sc ierr}, but does not
store the passed data.
\subsubsection{SUBROUTINE TCMSCT}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 31 August, 1988 \\
{\bf References:} R.L. Gluckstern, {\bf NIM 24} 381, (1963).\\
{\bf Call Arguments:} None. \\
{\bf Common Blocks Used:} {\sc tcscat}, {\sc tcprms}, {\sc cbbank}
and {\sc cblink}.\\
{\bf Subroutines Referenced:}None.\\
\end{flushleft}
This routine corrects the covariance matrices obtained in the helix
fit for multiple scattering in both the {\sc jdc} itself, and all the
material from the interaction point to the {\sc jdc}. Within the
{\sc jdc}, the multiple scattering only from the chamber gas has
been included. Multiple scattering off the sense and guard wires has
not been included at this point, but could be roughly added by changing
the radiation length of the chamber gas in the {\sc /tcscat/} common
block.
This routine loops over all the tracks in the {\bf TCTR} data bank,
and computes the multiple scattering contributions as follows. For the
scattering in the {\sc jdc} gas, the following formula's from
Gluckstern are employed.
\begin{eqnarray*}
\sigma_{\alpha\alpha} & = & \Lambda^{2}\cdot \frac{C_{n}}{L}
\cdot\sec^{4}\lambda \\
\sigma_{\alpha\beta} & = & \Lambda^{2}\cdot D_{n}\cdot\sec^{3}\lambda \\
\sigma_{\tan\lambda\tan\lambda} & = & \Lambda^{2}\cdot F_{n}\cdot L\cdot
\sec^{4}\lambda \\
\sigma_{\beta\beta} & = & \Lambda^{2}\cdot E_{n}\cdot L\cdot\sec^{2}\lambda
\end{eqnarray*}
where
\[ \Lambda^{2} = \left( \frac{{\textstyle 14.1 MeV/c}}
{{\textstyle p\cdot v/c}}\right )^{2}\cdot \frac{{\textstyle 1}}
{{\textstyle x_{r}}}\]
and the constants are given as:
\[ C_{n} = 1.43, D_{n} = 0.21, E_{n} = 0.23, F_{n} = 0.20 .\]
and $x_{r}$ is the radiation length of the gas in the {\sc jdc}.
For multiple scattering in the material traversed by the particle before
entering the {\sc jdc}, the following apply:
\begin{eqnarray*}
\sigma_{rr} & = & \Gamma^{2}\cdot\sec^{2}\lambda \cdot\sum
\frac{t_{i}\cdot r_{i}^{2}}{x_{i}} \\
\sigma_{zz} & = & \Gamma^{2}\cdot\sec^{4}\lambda \cdot\sum
\frac{t_{i}\cdot r_{i}^{2}}{x_{i}} \\
\sigma_{\tan\lambda\tan\lambda} & = & \Gamma^{2}\cdot\sec^{4}\lambda
\sum\frac{t_{i}}{x_{i}} \\
\sigma_{\beta\beta} & = & \Gamma^{2}\cdot\sec^{4}\lambda\sum
\frac{t_{i}}{x_{i}} \\
\sigma_{\tan\lambda z} & = & -\Gamma^{2}\cdot\sec^{4}\lambda
\sum\frac{t_{i}\cdot r_{i}}{x_{i}} \\
\sigma_{r\beta} & = & \Gamma^{2}\cdot\sec^{2}\lambda\cdot\sum
\frac{t_{i}\cdot r_{i}}{x_{i}} \\
\end{eqnarray*}
where
\[ \Gamma^{2} = \left( \frac{{\textstyle 14.1 MeV/c}}{{\textstyle p\cdot v/c}}
\right)^{2} \]
and the sums run over discrete scatterers of thickness $t_{i}$ at
radius $r_{i}$ with radiation length $x_{i}$.
All of the above corrections are added directly to the covariance matricies
as stored in the {\bf TCTR} data banks.
\subsubsection{SUBROUTINE TC2HLX}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 16 June, 1988. \\
{\bf References:} \\
{\bf Call Arguments:} (ITRK, *XHLX, *CVHLX). \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink}. \\
{\bf Subroutines Referenced:} None. \\
\end{flushleft}
This routine takes the output from the TCFITR and TCTHET
routines, and transforms it into helix coordinates. The initial data
is given as:
\begin{eqnarray*}
\vec{\xi}_{circ}&=&(1/2R,\psi_{0},c^{2};s) \\
\vec{\xi}_{rz}& = & (\tan\lambda, a_{0}) \\
\vec{x} &=& (1/2R,\psi_{0},c^{2},\tan\lambda ,a_{0};s) \\
s &=& {\textstyle sign}(1,1/2R)
\end{eqnarray*}
along with a 3 by 3 and a 2 by 2 covariance matrices, which can be combined
into a 5 by 5 matrix, $C_{x}$. The parameter $s$ measures the direction of
the track, and is related to the charge $q$ and the magnetic field
direction, $b_{s}$. The helix coordinates are defined as:
\[ \vec{\xi}_{helix} = (r_{0},z_{0},\alpha,\tan\lambda,\psi_{0};s) \]
The transformation is given by defining the radius of the fit circle as
\[ \rho = \sqrt{R^{2}-c^{2}} \]
Then we obtain that:
\begin{eqnarray*}
r_{0} &=& s\cdot\rho - R \\
z_{0} &=& a \\
\alpha &=& \frac{1}{\rho} \\
\tan\lambda &=& \tan\lambda \\
\psi_{0} &=& \psi_{0} \\
q &=& +s\cdot b_{s} \\
\end{eqnarray*}
One should note that it is possible for $r_{0}$ to be less than
zero. The helix parameters are chosen in such a way that if the
charge of the particle changes, then the parameter $\alpha$ will
simply change signs. All other parameters will be unaffected. This
makes it possible for the helix fit to correct wrong charge
assignments performed in previous routines, and for the vertex
fit to later correct the charges found in the helix fits.
\subsubsection{SUBROUTINE TPCNCT}
\begin{flushleft}
{\bf Author:} Bruce Barnett\\
{\bf Creation Date:} July 1991. \\
{\bf References:} \\
{\bf Call Arguments:} \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink} and {\sc tcprms}.\\
{\bf Called by:} {\sc tctrak} .\\
{\bf Subroutines Referenced:} None.\\
\end{flushleft}
This routine takes as input the {\bf TPWC} hit banks, (at down links
-1 and -2). It then performs a cluster search, and creates the {\bf TPWC}
cluster banks at down links -3 and -4. A loop is then made over all
tracks in the {\bf TCTK} banks, and connections are attempted to
all clusters in both \pwc{}'s. The best connections are then identified
by stamping the {\bf TCTK} track number into word +1 of the cluster
banks. These clusters are not physically used in the circle fit, but
are picked up by the helix fit before the fit is made.
It is possible to call this routine from an external {\sc user} routine
without ill effects. This may be useful in the case of all neutral
data where the cluster banks are useful.
\subsection{Vertex Fitting Software}
The following subroutines are found in the {\sc tc\_vert} patch of the
{\sc locater} card file.
\subsubsection{SUBROUTINE TCVERT}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 22 July, 1988 \\
{\bf References:} \\
{\bf Call Arguments:} None. \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink} and {\sc tclift}.\\
{\bf Subroutines Referenced:}{\sc tcvrtx}. \\
{\sc (zebra library)} {\sc mzlift}.\\
\end{flushleft}
This routine looks through all the tracks from the helix fit, and divides
them into two classes. The first is all tracks whose first {\sc jdc} layer
is less than {\sc lyvxtc} in the {\sc /tccuts/} common block, (the default
value is 6, but this can be changed using the {\bf LYVX} card) and which
have a nominal $z$--traceback withing {\sc zvtxtc} of {\sc zofftc} in
the {\sc /tccuts/} and {\sc /tcprms/} common blocks. These tracks are then
passed to the TCVRTX routine where they are fit to a common vertex.
\subsubsection{SUBROUTINE TCVRTX}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 2 February, 1990 \\
{\bf References:} \\
{\bf Call Arguments:} (NTRKS, NTRAK, IVRTX, *NDROP, *IDROP, *IERR, XGUES). \\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink} and {\sc tccuts}.\\
{\bf Subroutines Referenced:} {\sc cernlib}: {\sc dinv}. \\
\end{flushleft}
This routine looks at the {\sc ntrks} tracks whose track numbers are in the
{\sc ntrak} array and tries to fit them to a common vertex. The returned
value of {\sc x} is the $(x,y,z)$ coordinates of this vertex, {\sc covr}
is a 3 by 3 covariance matrix for the vertex, {\sc chsqr} is the
$\chi^{2}$ of the fit, and {\sc ierr} is an error code from the fit.
{\sc gues} is a guess made by the user to the vertex.
The meanings of {\sc ierr} are given as follows.
\begin{itemize}
\item[000] No error, normal convergence o a good vertex.
\item[100] Only one track was fit to this vertex.
\item[200]
\item[300] The routine converged with a $\chi^{2}$ which was too large.
\item[400] The routine began to diverge.
\item[500] The iteration limit was exceeded before convergence.
\item[600]
\item[700] Inversion of a singular matrix was attempted.
\end{itemize}
The philosophy behind this routine is to attempt to get an rough vertex
position which can be passed to the Crystal routines. The routine does
not try to correlate particles with one another, ({\em i.e.} $\pi^{+}$ and
$\pi^{-}$ into a $K_{s}$), it instead assumes that there is exactly one
vertex in the given volume, and fits to it. As one may later want to
assume that there was more than one vertex in the volume, the routine
does not vary the helix parameters nor their covariance matricies. It
only looks for the best vertex given the constraints of the fit parameters.
The fit then works as follows.
Given $n$ tracks from the helix fit with fit parameters $\vec{x}_{i}$ and
covariance matricies $C_{x}^{i}$, one forms a vector $\vec{\eta}$ such that
\[ \vec{\eta} = (\vec{x}_{1},\cdots,\vec{x}_{n}) ,\] with
\[ \vec{x}_{i} = (r_{i},z_{i},\alpha_{i},\tan\lambda_{i},\psi_{0_{i}};
s_{i} ) \] and a 5 by 5 covariance matrix $C_{\eta}$, such that:
\begin{eqnarray*}
C_{\eta} &=& \left( \begin{array}{ccc}
C_{x}^{1} & \cdots & 0 \\
\vdots & \ddots & \vdots \\
0 & \cdots & C_{x}^{n} \end{array} \right)
\end{eqnarray*}
The routine uses this information to obtain the vertex,
\[ \vec{\xi} = (x_{v},y_{v},z_{v}) \] and its 3 by 3 covariance matrix
$C_{\xi}$.
The mathematics begin with the $3\cdot n$ helix equations for each track.
\begin{eqnarray*}
f_{[i,1]} &=& x_{v} - r_{i}\cdot\cos\psi_{0_{i}} - \frac{1}
{\alpha_{i}}\cdot (\cos\beta_{i} - \cos\psi_{0_{i}}) \\
f_{[i,2]} &=& y_{v} + r_{i}\cdot\sin\psi_{0_{i}} - \frac{1}
{\alpha_{i}}\cdot (\sin\beta_{i} - \sin\psi_{0_{i}}) \\
f_{[i,3]} &=& z_{i} - z_{v} - \frac{s_{i}\cdot\tan\lambda_{i}}{\alpha_{i}}\cdot
\left( \beta_{i} - \psi_{0_{i}} - s_{i}\cdot\frac{\pi}{2} \right)
\end{eqnarray*}
where the index $i$ runs over the $n$ tracks. The first two of
these equations are then solved to yield two new equations.
\begin{eqnarray*}
\cos\beta_{i} &=& \alpha_{i}\cdot x_{v} - \sin\psi_{0_{i}}
\left( \alpha_{i}\cdot r_{i}+s_{i}\right) \\
\sin\beta_{i} &=& \alpha_{i}\cdot y_{v} + \cos\psi_{0_{i}}
\left( \alpha_{i}\cdot r_{i}+s_{i}\right) \\
\end{eqnarray*}
These can then be combined to yield an expression for $\beta_{i}$, and
an equation of constraint:
\begin{eqnarray*}
\beta_{i} &=& {\scriptstyle ATAN2}(\sin\beta_{i},\cos\beta_{i}) \\
\frac{1}{\alpha} &=& \frac{1}{\alpha}\left(\sin^{2}\beta_{i}
+ \cos^{2}\beta_{i} \right)
\end{eqnarray*}
This will then yield $2\cdot n$ equations of constraint given as:
\begin{eqnarray*}
f_{[1,i]} &=& \frac{1}{\alpha_{i}}\left( \cos^{2}\beta_{i} +
\sin^{2}\beta_{i} - 1 \right) \\
f_{[2,i]} &=& z_{i} - z_{v} - \frac{s_{i}\cdot\tan\lambda_{i}}{\alpha_{i}}
\cdot (\beta_{i} - \psi_{0_{i}} - s_{i}\cdot\frac{\pi}{2} )
\end{eqnarray*}
An alternate form for the first equation is given as:
\begin{eqnarray*}
f_{[1,i]} &=& \alpha_{i} \left( x_{v}^{2} + y_{v}^{2} + r_{i}^{2} \right)
+ 2\cdot s_{i}r_{i}
+ 2\cdot (\alpha_{i}\cdot r_{i} + s_{i})\cdot
(y_{v}\cdot\cos\psi_{0_{i}} - x_{v}\cdot\sin\psi_{0_{i}})
\end{eqnarray*}
A vector $\vec{C}$ is then defined as the $2n$ $f_{i}$'s.
As has been done in the TCITER and TCHELX routines, matricies
${\cal A}$ and ${\cal B}$ are defined via:
\begin{eqnarray*}
A_{ij} & = & \frac{{\textstyle \partial f_{i}}}{{\textstyle \partial\xi_{j}}} \\
B_{ij} & = & \frac{{\textstyle \partial f_{i}}}{{\textstyle \partial\eta_{j}}}
\end{eqnarray*}
and a matrix $\cal{G}_{B}$ is now defined as:
\[ {\cal G}_{B} = ({\cal B}{\cal C}_{\eta}{\cal B}^{T})^{-1}. \]
With this, an iterative sequence for $\vec{\xi}$ is formed,
\[ \vec{\xi}_{i+1} = \vec{\xi}_{i} - ({\cal A}^{T}{\cal G}_{B}{\cal A})^{-1}
({\cal A}^{T}{\cal G}_{B}\vec{C}) \]
with the covariance matrix at each iteration given as
\[ {\cal C}_{\xi} = ({\cal A}^{T}{\cal G}_{B}{\cal A})^{-1} \]
and
$\vec{\epsilon} = \vec{\eta}_{i} - \vec{\eta}_{0} $
\[ \chi^{2} = ({\cal B}\vec{\epsilon})^{T}
{\cal G}_{B}({\cal B}\vec{\epsilon}) \]
\begin{figure}[htbp]\centering
\begin{picture}(400,200)
\put(200,100){\circle*{2}}
\put(200,100){\circle{6}}
\put(190,100){\line(1,0){20}}
\put(200, 90){\line(0,1){20}}
\put(240, 60){\oval(60,60)[tl]}
\put(240, 90){\vector(1,0){6}}
\put(160,140){\oval(60,60)[br]}
\put(190,140){\vector(0,1){6}}
\put(200,100){\vector(1,-1){10}}
\put(200,100){\vector(-1,1){10}}
\put(200,100){\vector(-1,-1){40}}
\put(159, 50){\makebox(0,0){{\bf B}}}
\put(159, 40){\makebox(0,0){${\scriptstyle (b_{s}=+1)}$}}
\put(230, 70){\makebox(0,0){${\scriptstyle q=+1}$}}
\put(170,130){\makebox(0,0){${\scriptstyle q=-1}$}}
\put(230, 60){\makebox(0,0){${\scriptstyle r_{0}<0}$}}
\put(170,120){\makebox(0,0){${\scriptstyle r_{0}<0}$}}
\put(230, 80){\makebox(0,0){${\scriptstyle s=+1}$}}
\put(170,140){\makebox(0,0){${\scriptstyle s=-1}$}}
\end{picture}
\caption[Closest Approach]{{\sf The distance of closest approach to the
origin of a fit circle. If $r_{0}<0$, then the track's point of closest
approach is between the center of the circle and the origin.}}
\label{fig:r0}
\end{figure}
The covariance matrix, ${\cal C}_{\xi}$ can be obtained from the Jacobian of the
above transformation, ${\cal T}_{ij} = \partial \xi_{i} / \partial x_{j}$.
\[ {\cal C}_{\xi} = {\cal T}{\cal C}_{x}{\cal T}^{T} .\]
The matrix ${\cal T}$ can be explicitly expressed as:
\[ {\cal T} = \left( \begin{array}{ccccc}
-\alpha\cdot r_{0} & 0 & -\alpha & 0 & 0 \\
\mid \alpha\cdot r_{0}\mid \cdot\tan\lambda & 0 & \alpha\cdot\tan\lambda &
\mid r_{0} \mid & 1 \\
-R\cdot\alpha^{3} & 0 & \frac{1}{2}\alpha^{3} & 0 & 0 \\
0 & 0 & 0 & 1 & 0 \\
0 & 1 & 0 & 0 & 0 \end{array} \right) \]
\clearpage
\begin{figure}[hp]\centering
\begin{picture}(425,220)(50,380)\centering
\thicklines
\put( 50,572){\vector(1,0){50}}
\put(100,560){\framebox(50,25){{\small TCTRAK}}}
\put(125,560){\line(0,-1){120}}
\put(125,440){\circle*{5}}
\put(125,532){\vector(1,0){50}}
\put(175,520){\framebox(50,25){{\small TPCNCT}}}
\put(125,492){\vector(1,0){50}}
\put(175,480){\framebox(50,25){{\small TCHELX}}}
\put(225,492){\vector(1,0){25}}
\put(250,480){\framebox(50,25){{\small TCHXLD}}}
\put(300,492){\vector(1,0){25}}
\put(325,480){\framebox(50,25){{\small TC2HLX}}}
\put(125,452){\vector(1,0){50}}
\put(175,440){\framebox(50,25){{\small TCMSCT}}}
\put(125,412){\vector(1,0){50}}
\put(175,400){\framebox(50,25){{\small TCVERT}}}
\put(225,412){\vector(1,0){25}}
\put(250,400){\framebox(50,25){{\small TCVRTX}}}
\end{picture}
\caption[Helix and Vertex Fit Software Flow.]
{{\sf Flow of the chamber software; helix and vertex fitting}}
\label{fig:flow5}
\end{figure}
\clearpage
\section{Chamber Calibration Software}
Calibration of the \jdc{} involves several different procedures, all
of which need to be iterated to yield a final set of calibration
constants. These can be divided into two classed of calibration, the
first to determine the physical position of the \jdc{} and \pwc{}
relative to the target and crystals, and the second to determine
actual calibration constants of the \jdc{}. With regard to these constants,
there are essentially three types. Conversion of drift time into $r-\phi$
position in the \jdc{}, conversion of amplitude difference into $z$
position, and conversion of amplitude sums into $dE/dx$. This section
details the software available for performing these procedures.
During the calibration, it is necessary to have direct access
to most of the tracking cuts defined in chapter 2. To avoid having to
recompile and relink the code for every change, a special calibration
card file which is read in on logical unit {\sc ljcal} in the
{\sc /cbunit/} common block needs to be provided. This file uses the
FFREAD program to input new values for most of the tracking parameters
and cutoffs, (see the CJINIT routine for a description of all available
cards). Included in this are two cards for steering the calibration
of the chamber. The first allows the user to turn on and off calibration,
(the {\bf JDCL} card), and the second identifies the calibration procedure
to be performed, (the {\bf ICAL} card).
The purpose of the {\bf JDCL}
card is two--fold. First one may want to check analysis results after
a calibration step has been performed, which then means one does not
have to recompile and relink the code. The second is for debugging of the
code. In this light, two additional cards, (the {\bf DEBG} nd {\bf NDBG}
cards) are provided for turning on and off debug output. If the user
has built the locater code using both the debug patches and the
calibration patches, then the {\bf DEBG} flag will turn on and off
the debugging of events. Secondly, if debug output is desired for
only one event, then that event can be specified with the {\bf NDBG} card.
The parameters steered by these cards are available in the {\sc /tcdebg/}
common block as described in the next section.
\subsection{Description of the Chamber Calibration Common Blocks}
\subsubsection{CJCUTS}
The {\sc /cjcuts/} common block contains cuts applied to the calibration
code. All values in this common block can be changed using the CJINIT
subroutine.
\begin{verbatim}
DOUBLE PRECISION CXGZCJ
LOGICAL LSECCJ(30)
INTEGER MHITCJ,MTRKCJ,MCIRCJ
REAL CSMXCJ,DYMXCJ
REAL ZCUTCJ,ZPOSCJ,ZRINCJ,ZROTCJ,ZAMPCJ,ZPRBCJ
REAL ZCTTCJ,ZXYRCJ,ZMOVCJ,CFRACJ,CLIMCJ
COMMON /CJCUTS/ CXGZCJ,LSECCJ,MHITCJ,MTRKCJ,MCIRCJ,
& CSMXCJ,DYMXCJ,
& ZCUTCJ,ZPOSCJ,ZRINCJ,ZROTCJ,ZAMPCJ,ZPRBCJ,
& ZCTTCJ,ZXYRCJ,ZMOVCJ,CFRACJ,CLIMCJ
\end{verbatim}
\begin{itemize}
\item {\sc cxgzcj} is the convergence criteria used in the CJGZFT routine.
It has a default value of 0.01, but can be changed using the {\bf CXGZ} card.
\item {\sc lseccj} is a logical array identifying which sectors are to
be calibrated in the CJGZFT subroutine. Its default is all sectors
on, however this can be changed using the {\bf CJGZ} card.
\item {\sc mhitcj} is the minimum number of hits per track to use the track
in the CJGZFT and CJZFIT routines. It has a nominal value of 5, but can be
modified with the {\bf MHIT} card.
\item {\sc mtrkcj} is the minimum number of tracks per event in the CJGZFT
routine. It is set to 2, but can be changed using the {\bf MTRK} card.
\item {\sc mcircj} is the minimum number of points per track to fit
a track using the CJITER routine. It has a default value of 15, but
can be changed using the {\bf MCIR} card.
\item {\sc csmxcj} is the minimum value of $\cos\alpha$ to write
out a hit in CJUPDT. This has a default value of $\cos (25)$, but
can be changed using the {\bf CSMX} card.
\item {\sc dymxcj} is the maximum deviation of a hit to be written
out by the CJUPDT routine. This has a default value of $0.05$cm, but
can be changed using the {\bf DYMX} card.
\item {\sc zcutcj} is an acceptance window around {\sc zofftc} in the
$z$ calibration of the \jdc{}. Events that do not trace back to this window
will not be accepted. Its value can be set using the {\bf ZCUT} card.
This has a default value of \mbox{10 cm}.
\item {\sc zposcj} is used in the $z$ calibration of the \jdc{}. It defines
the maximum range in $z$ position on the sense wires to be used in the
calibration. Its value can be set using the {\bf ZPOS} card. This has a
default value of \mbox{19 cm}.
\item {\sc zrincj} is used in the $z$ calibration of the \jdc{} by CJGZFT.
It defines the minimum radius in $x$ and $y$ an event can have to be used.
The default value is 0.00 cm, but can be changed using the {\bf ZRIN} card.
\item {\sc zrotcj} is used in the $z$ calibration of the \jdc{} by CJGZFT.
It defines the maximum radius in $x$ and $y$ an event can have to be used.
The default value is 5.00 cm, but can be changed using the {\bf ZROT} card.
\item {\sc zampcj} is used in $z$ calibration of the \jdc{} by CJGZFT to
decide if data on a particular wire should be written to the calibration
file. In order for a hit to be written out, the amplitudes on both the left
and right end of the wire must be larger than {\sc zampcj}, which has a
default value of 200. This can be changed using the {\bf ZAMP} card.
\item {\sc zprbcj} is used in $z$ calibration of the \jdc{} by CJGZFT to
decide if a fit event should be accepted. The probability of the event
must be larger than {\sc zprbcj}, which has a default value of $0.00$.
This can be changed using the {\bf ZPRB} card.
\item {\sc zcttcj} is used in $z$ calibration of the \jdc{} by CJGZFT to
decide if a fit event should be accepted. The fit $z$ vertex of the event
must be within {\sc zcttcj} cm of {\sc zofftc}, where the nominal value
is $5.00$ cm. This can be changed using the {\bf ZCTT} card.
\item {\sc zxyrcj} is used in $z$ calibration of the \jdc{} by CJGZFT to
decide if an event should be kept. All tracks in the event must be closer
than {\sc zxyrcj} cm from the fit vertex in $x$ and $y$. The nominal value
is $0.50$cm, but can be changed using the {\bf ZXYR} card.
\item {\sc zmovcj} is the amount a point can be shifted in the CJGZFT
routine, and still be used for calibration. This has a default value of
4 cm, but can be changed using the {\bf ZMOV} card.
\item {\sc cfracj} is used by CJFITR to discard outliers from tracks. If
a track whose chisquare is larger than {\sc climcj} has a point which
contributes {\sc cfracj} of chisquare, then that point will be dropped
before fitting. This has a default value of 0.900, but can be changed
using the {\bf CFRA} data card.
\item {\sc climcj} See the previous entry for the description. The default
value is 150., and can be changed using the {\bf CLIM} card.
\end{itemize}
\subsubsection{CJEXFT}
The {\sc /cjexft/} common block is used in dE/dx calibrations. No further
documentation is available.
\begin{verbatim}
REAL ENERCJ(30,23),EMINCJ,TNERCJ(30,23)
INTEGER NENRCJ(30,23),NMINCJ
COMMON /CJEXFT/ ENERCJ,TNERCJ,NENRCJ,NMINCJ,EMINCJ
\end{verbatim}
\begin{itemize}
\item {\sc enercj}
\item {\sc emincj}
\item {\sc tnercj}
\item {\sc nenrcj}
\item {\sc nmincj}
\end{itemize}
\subsubsection{CJFLAG}
The {\sc /cjflag/} common block contains flags a control switches for
steering the calibration of the \jdc{}. The values of these parameters
can be controlled using the CJINIT routine.
\begin{verbatim}
LOGICAL JDCLCJ,LREFCJ
INTEGER ICALCJ
COMMON /CJFLAG/ JDCLCJ,LREFCJ,ICALCJ
\end{verbatim}
\begin{itemize}
\item {\sc jdclcj} This logical flag controls if calibration of the \jdc{}
is performed. If the calibration code has been selected using PATCHY, then
this value defaults to {\sc .true.}. The existence of this parameter allows
one to turn off the calibration code if it has been included, which can
be done using the {\bf JDCL} card.
\item {\sc lrefcj} Inhibits the updating of constants when slow control
values change.
\item {\sc icalcj} This parameter identifies the type of calibration to
be performed. It defaults to a value of 0, but can be set to other values
using the {\bf ICAL} card.
\begin{itemize}
\item[0] Calibration of the \jdc{} using pion tracks which cross sector
boundaries in the \jdc{}.
\item[1] Calibration of the \jdc{} using events $p\overline{p}\rightarrow
\pi^{+}\pi^{-}$ and $p\overline{p}\rightarrow K^{+}K^{-}$.
\item[2] $z$--fit on a track--by--track basis for the gains of the preamps.
\item[3] Energy gains in the \jdc{}.
\item[4] Global $z$--fit for relative gains of the preamps.
\end{itemize}
\end{itemize}
\subsubsection{CJGAIN}
The {\sc /cjgain/} common block is used as a storage area when calibrating
the gains of the preamps on the \jdc{}.
\begin{verbatim}
INTEGER IFITCJ(690)
REAL ZFITCJ(690),EFITCJ(690),SMSQCJ(690)
REAL TIMXCJ(23,2)
COMMON /CJGAIN/ IFITCJ,ZFITCJ,EFITCJ,SMSQCJ,TIMXCJ
\end{verbatim}
\subsubsection{CJGLOZ}
The {\sc /cjgloz/} common block is used by the CJGZFT routine to pass
information back to the USER routine. It contains information on the
hits which were fit. Not all of the possible information will be
available in all applications. It is necessary to consult the code
to determine what information is available.
\begin{verbatim}
INTEGER NTRKCJ,ITRKCJ(10),NPTSCJ(10)
INTEGER JTCHCJ(50,10),JLYRCJ(50,10),JSECCJ(50,10),JRESCJ(50,10)
REAL XPFTCJ(50,10),DXFTCJ(50,10),SXFTCJ(50,10),GXFTCJ(50,10)
REAL YPFTCJ(50,10),DYFTCJ(50,10),SYFTCJ(50,10),GYFTCJ(50,10)
REAL ZPFTCJ(50,10),DZFTCJ(50,10),SZFTCJ(50,10),GZFTCJ(50,10)
REAL TDRFCJ(50,10),ALFTCJ(50,10),ARGTCJ(50,10)
COMMON /CJGLOZ/ NTRKCJ,ITRKCJ,NPTSCJ
& ,JTCHCJ,JLYRCJ,JSECCJ,JRESCJ
& ,XPFTCJ,DXFTCJ,SXFTCJ,GXFTCJ
& ,YPFTCJ,DYFTCJ,SYFTCJ,GYFTCJ
& ,ZPFTCJ,DZFTCJ,SZFTCJ,GZFTCJ
& ,TDRFCJ,ALFTCJ,ARGTCJ
\end{verbatim}
\begin{itemize}
\item {\sc ntrkcj} is the number of tracks used in the global fit.
\item {\sc itrkcj} is a list of the tracks stored in this common.
\item {\sc nptscj} is the number of points in each of up to 10 tracks.
\item {\sc jtchcj} is an array of pointers to the TCHT banks for the hits.
\item {\sc jlyrcj} is the layer number of the hits.
\item {\sc jseccj} is the sector number of the hits.
\item {\sc jrescj} is the left--right resolution of each hit.
\item {\sc xpftcj} is the fit $x$ or $r$ position in centimeters for each hit.
The value depends on which calibration routines are used.
\item {\sc dxftcj} is the difference between the fit and computed $x$ position
in centimeters.
\item {\sc sxftcj} is the fit error in the x position, $\sigma_{x}^{2}$.
\item {\sc gxftcj} is the origional error in the x--position, $\sigma_{x}^{2}$.
\item {\sc ypftcj} is the fit $y$ or $\phi$ position, for each hit.
\item {\sc dyftcj} is the difference between the fit and computed $y$ position.
\item {\sc syftcj} is the fit error in the y position, $\sigma_{y}^{2}$.
\item {\sc gyftcj} is the origional error in the y--position, $\sigma_{y}^{2}$.
\item {\sc zpftcj} is the fit $z$ position, in centimeters for each hit.
\item {\sc dzftcj} is the difference between the fit and computed $z$ position
in centimeters.
\item {\sc szftcj} is the fit error in the z position, $\sigma_{z}^{2}$.
\item {\sc gzftcj} is the origional error in the z--position, $\sigma_{z}^{2}$.
\item {\sc tdrfcj} is the drift time of every hit.
\item {\sc alftcj} is the left or $+z$ amplitude of every hit.
\item {\sc argtcj} is the right or $-z$ amplitude of each hit.
\end{itemize}
\subsubsection{CJPCAL}
The common block is filled by the CJ4PRG subroutine. The data is
from four--prong events that are passed through a 4--C kinematic
fit.
\begin{verbatim}
REAL PINICJ(3,4),PFITCJ(3,4),DELPCJ(3,4),CHSQCJ(4)
REAL CVINCJ(3,3,4),CVFTCJ(3,3,4),CHRGCJ(4),MASSCJ(4)
COMMON /CJPCAL/ PINICJ,PFITCJ,DELPCJ,CHSQCJ,CVINCJ,CVFTCJ,
& CHRGCJ,MASSCJ
SAVE /CJPCAL/
\end{verbatim}
\begin{itemize}
\item {\sc pinicj} contains the initial values of $p_{x}$, $p_{y}$ and $p_{z}$
for each of the four tracks.
\item {\sc pfitcj} contains the fit values of $p_{x}$, $p_{y}$ and $p_{z}$
for each of the four tracks.
\item {\sc delpcj} contains the change in $p_{x}$, $p_{y}$ and $p_{z}$.
\item {\sc chsqcj} contains the contribution to $\chi^{2}$ from each track.
\item {\sc cvincj} contains the initial 3 by 3 covariance matrix for each
track.
\item {\sc cvftcj} contains the fit 3 by 3 covariance matrix for each track.
\item {\sc chrgcj} contains the charge of each track.
\item {\sc masscj} contains the mass of each particle.
\end{itemize}
\subsubsection{CJSTAT}
\begin{verbatim}
INTEGER ISTACJ(100),IESTCJ(100),IUPDCJ(23,2)
COMMON /CJSTAT/ ISTACJ,IESTCJ,IUPDCJ
\end{verbatim}
\subsubsection{RJSTAT}
The {\sc /rjstat/} common block is included in the routines for processing
the {\bf RJDF} data when the calibration code is installed. It is filled
on an event by event basis, and is then available to the user for monitoring
the raw pulse information in the \jdc{}.
\begin{verbatim}
INTEGER NHITRJ,ILENRJ(200),IMAXRJ(200,2)
COMMON /RJSTAT/ NHITRJ,ILENRJ,IMAXRJ
\end{verbatim}
\begin{itemize}
\item {\sc nhitrj} is the number of hits stored in the {\bf RJDF} bank
for the present event.
\item {\sc ilenrj} is the number of FADC channels needed for each hit.
\item {\sc imaxrj} contains the maximum pulse height on the left and
right side for each hit in the {\bf RJDF} bank.
\end{itemize}
\subsubsection{TCDEBG}
The {\sc /tcdebg/} common block is used to steer the debug print lines
when they have been installed.
\begin{verbatim}
LOGICAL DBGGTC(10),DEBGTC
INTEGER NDBGTC
COMMON /TCDEBG/ DBGGTC,DEBGTC,NDBGTC
\end{verbatim}
\begin{itemize}
\item {\sc dbggtc} identifies which section of the code should be debugged.
The meaning of each of the ten elments is given below.
\begin{itemize}
\item Overall debug switch for the program. Must be {\sc .true.} to print
out any debug lines.
\item[1] Print debug lines during processing of raw data.
\item[2] Print debug lines during pattern recognition.
\item[3] Print debug lines during circle fitting.
\item[4] Print debug lines during helix fitting.
\item[5] Print debug lines during vertex fitting.
\item[6] Print debug lines during calibration.
\item[7] Not yet used.
\item[8] Not yet used.
\item[9] Not yet used.
\item[10] Print debug lines during slow control processing.
\end{itemize}
\item {\sc debgtc} When set to {\sc .true.}, then all installed debug
print lines are enabled. The value of this variable is steered in the
TCTRAK routine depending on the values of {\sc dbggtc}.
\item {\sc ndbgtc} When given a non--zero value, the TCTRAK routine
will set {\sc debgtc} {\sc .true.} only for event number {\sc ndbgtc}.
For all other events, it will print a one--line message that the event
has been processed, but the value if {\sc debgtc} will be set to false.
\end{itemize}
\subsection{Description of the Chamber Calibration Software}
The following subroutines are found in the {\sc jdcalibr} patch in
the {\sc locater} card file.
\subsubsection{SUBROUTINE CJCALB}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 20 September, 1988. \\
{\bf References:} \\
{\bf Call Arguments:} None.\\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink}, {\sc tclift} and
{\sc cjflag}. \\
{\bf Subroutines Referenced:} {\sc tcpatt}, {\sc tccirc},
{\sc tchelx}, {\sc cjfitr}, {\sc cjzfit}, {\sc cjgzft}, {\sc cj4prg}
and {\sc cjdedx} \\
{\sc zebra library:} {\sc mzlift} \\
\end{flushleft}
This routine has the same function as the TCTRAK routine does for
normal tracking. It is called by TCTRAK to control the program flow when
calibrating the \jdc{}. The type of calibration performed is controlled by
the value of {\sc icalcj} in the {\sc /cjflag/} common block. The present
options are as follows.
\begin{itemize}
\item[-1] Calibration check using CJFITR and all tracks.
\item[0] Calibrate the \jdc{} using tracks which cross sector boundaries
in the \jdc{}.
\item[1] Calibrate the \jdc{} using CJ4PRG, 4C--Kinematic fit.
\item[2] Calibrate the \jdc{} $z$ constants using the CJZFIT routine.
\item[3] Calibrate the \jdc{} $dE/dx$ using CJDEDX.
\item[4] Calibrate the \jdc{} $z$ constants using the CJGZFT routine.
\end{itemize}
\subsubsection{SUBROUTINE CJDCAL}
\begin{flushleft}
{\bf Author:} Klaus Peters \\
{\bf Creation Date:} 27 November, 1989. \\
{\bf References:} \\
{\bf Call Arguments:} None.\\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink}, {\sc cbstop} and
{\sc cjexft}. \\
{\bf Called by:} {\sc cjdedx} .\\
{\bf Subroutines Referenced:} None. \\
\end{flushleft}
No documentation available.
\subsubsection{SUBROUTINE CJDEDX}
\begin{flushleft}
{\bf Author:} Klaus Peters\\
{\bf Creation Date:} 20 December, 1989 \\
{\bf References:} \\
{\bf Call Arguments:} None. \\
{\bf Common Blocks Used:} {\sc /cblink/} and {\sc /cjexft/}.\\
{\bf Called by:} {\sc cjcalb}.\\
{\bf Subroutines Referenced:} {\sc tcoord}, {\sc tcrhit} and {\sc cjdcal}. \\
{\sc cernlib}: {\sc flpsor}. \\
\end{flushleft}
No documentation available.
\subsubsection{SUBROUTINE CJFITR}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 20 September, 1988.\\
{\bf References:} \\
{\bf Call Arguments:} None.\\
{\bf Common Blocks Used:}{\sc cblink}, {\sc cbbank}, {\sc cbunit},
{\sc tchits} and {\sc cjstat}.\\
{\bf Subroutines Referenced:}{\sc tcload}, {\sc cjiter}, {\sc cjupdt},
{\sc tcifix} and {\sc tccnct}.\\
\end{flushleft}
This routine functions in the same manner that TCFITR does for the normal
reconstruction. It takes all the tracks located in the pattern recognition
section, and selects those containing at least 15 points and which cross
between sector boundaries in the \jdc{}. Those that do not satisfy these
conditions have their {\bf TCTK} data banks dropped using the TCCNCT routine.
Other wise the tracks are fit in a first pass using the CJITER routine.
After all tracks have been fit, the TCIFIX routine is called to correct the
positions of the hits based on the crossing angle through the jet cells,
and then the tracks are re--fit using the CJITER routine. The resulting
coordinates of these hits are then passed to the CJUPDT routine for output.
\subsubsection{SUBROUTINE CJGZFT}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 26 July, 1989. \\
{\bf References:} \\
{\bf Call Arguments:} (IOPT).\\
{\bf Common Blocks Used:} {\sc cblink}, {\sc cbbank}, {\sc tclift},
{\sc tcprms}, {\sc cjcuts}, {\sc cjgzft}, {\sc cbunit} and {\sc tcdebg}.\\
{\bf Called by:} {\sc cjcalb}. \\
{\bf Subroutines Referenced:} {\sc cjzchk}, \\
({\sc cernlib:} {\sc matin2} \\
({\sc zebra}): {\sc mzwork} and {\sc mzlift}. \\
\end{flushleft}
his routine will perform a global straight line fit to all tracks in
the \jdc{} to a common vertex. The routine is called via calibration option
4 in the CJCALB routine. If the passed value of {\sc iopt} is zero, the
routine will write out the fit data. Otherwise no data will be written.
In order for this routine to work, there must
be at least {\sc mtrkcj} tracks in the \jdc{} which contain no fewer than
{\sc mhitcj} hits each. The flow of the code is divided into three sections,
each of which are detailed below.
In the first section, a search is made through the \jdc{} for all tracks
which have more than 5 hits, and reside in a sector which has not been
turned off in the {\sc lseccj} array in the {\sc /cjcuts/} common block.
Up to 10 of these tracks are allowed, and when one is found the number of
hits in the track, the pointer to the {\bf TCHT} bank for every hit,
the layer number of every hit and the sector number of every hit are
stored in the {\sc /cjgzft/} common block. Also, the ($r$,$z$)
coordinate of every hit is stored in the {\bf Y} vector as per the
CJHXLD routine, and the errors , ($\sigma_{r}^{2}$,$\sigma_{z}^{2}$)
are stored in the {\bf GYINV} vector. At the same time this loading is
done, the straight line fits:
\begin{eqnarray*}
z &=& \tan(\lambda)\cdot r + z_{0} \\
\cos(\psi)\cdot y &=& \sin(\psi)\cdot x + \beta
\end{eqnarray*}
are made for each track. The fit values of $\sin(\psi)$, $\cos(\psi)$ and
$\beta$ for each track are then used to determine the point
($x_{0}$,$y_{0}$) which minimizes the sum of the squares of the distances
to each line. This quantity is:
\[ \chi^{2} = \sum_{i=1}^{n} \left[ \cos(\psi_{i})\cdot y_{0} -
\sin(\psi_{i})\cdot x_{0} - \beta_{i} \right]^{2} .\]
This is solved by inverting the matrix equation:
\begin{eqnarray*}
\left( \begin{array}{cc}
\sum\cos^{2}(\psi_{i}) & -\sum\cos(\psi_{i})\cdot\sin(\psi_{i}) \\
-\sum\cos(\psi_{i})\cdot\sin(\psi_{i}) & \sum\sin^{2}(\psi_{i})
\end{array} \right) \cdot \left( \begin{array}{c}
x_{0} \\ y_{0} \end{array} \right) &=& \left( \begin{array}{c}
-\sum\sin(\psi_{i})\cdot\beta_{i} \\ \sum\cos(\psi_{i})\cdot\beta_{i}
\end{array} \right)
\end{eqnarray*}
If after loading all tracks, there are still at least two tracks, and
the radius of the ($x$,$y$) vertex is smaller than \mbox{5.0 cm}, then
the routine passes into the fitting section.
In the next section, the $N$ tracks located in the first section are
assumed to satisfy the following linear equations:
\begin{eqnarray*}
x_{j;k} &=& X_{0} + \cos\lambda_{k}\cdot\cos\psi_{k}\cdot\alpha_{j;k} \\
y_{j;k} &=& Y_{0} + \cos\lambda_{k}\cdot\sin\psi_{k}\cdot\alpha_{j;k} \\
z_{j;k} &=& Z_{0} + \sin\lambda_{k}\cdot\alpha_{j;k}
\end{eqnarray*}
where the index $k$ runs over the $N$ tracks, and the index $j$ runs over
the $n_{k}$ points in track $k$. The first two of these equations are
solved to yield $\alpha$ as:
\begin{eqnarray*}
\lefteqn{ \alpha_{j;k} =} \\ & &\sec(\lambda_{k})\cdot \left[
-(x_{0}\!\cdot\!\cos(\psi_{k})\! + \!y_{0}\!\cdot\!\sin(\psi_{k})) +
\sqrt{{\textstyle (x_{0}\!\cdot\!\cos(\psi_{k})\! + \!
y_{0}\!\cdot\!\sin(\psi_{k}))^{2}
+ r_{i}^{2} - x_{0}^2 -y_{0}^{2} }} \; \right]
\end{eqnarray*}
The remaining equations in $z$ can then be written as $\sum_{k=1}^{N}(n_{k})$
equations of constraint. However, before continuing, it is also necessary
to define the set of measured coordinates, $Y_{j;k}$, such that
$Y_{2j-1;k} = r_{j;k}$ and $Y_{2j;k} =z_{j;k}$.
We also define the fit vector $X_{l}$ such that $X_{k}=\tan(\lambda_{k})$,
and $X_{N+1}=Z_{0}$, The equations of constraint are then:
\begin{eqnarray*}
f_{j;k} & = & X_{N+1} - Y_{2j;k} - X_{K}\times \\ & &
\left[
-(x_{0}\!\cdot\!\cos(\psi_{k})\! + \!y_{0}\!\cdot\!\sin(\psi_{k})) +
\sqrt{{\textstyle (x_{0}\!\cdot\!\cos(\psi_{k})\! + \!
y_{0}\!\cdot\!\sin(\psi_{k}))^{2}
+ Y_{2j-1;k}^{2} - x_{0}^2 -y_{0}^{2} }} \; \right]
\end{eqnarray*}
We now have a system of $2\cdot\sum_{k=1}^{N}(n_{k})$ measurements,
$\sum_{k=1}^{N}(n_{k})$ constraints and $N+1$ unknowns to solve.
The solution is obtained using the same iterative procedure as used in
all other fitting routines. The matricies ${\cal A}$ and ${\cal B}$, and
the vector {\bf C} are defined such that:
\begin{eqnarray*}
{\cal A}_{ij} &=& \frac{\partial f_{i}}{\partial X_{j}} \\
{\cal B}_{ij} &=& \frac{\partial f_{i}}{\partial Y_{j}} \\
{\bf C}_{i} &=& f_{i}
\end{eqnarray*}
The matrix ${\cal G}_{B} = ({\cal B}^{T}{\cal G}_{Y}^{-1}{\cal B})^{-1}$
is then computed, (where ${\cal G}_{Y}^{-1}$ is the covariance matrix for
the measured quantities, $Y$.) This matrix turns out to be diagonal, and
can be written simply as:
\[ {\cal G}_{B}^{j;k} = \frac{{\textstyle 1}}{{\textstyle
\delta^{2}Y_{2j;k} + b_{j;k}\cdot\delta^{2}Y_{2j-1;k}}} \]
where the quantity $b_{j;k}$ is defined to be:
\[ b_{j;k} = \frac{{\textstyle X_{k}\cdot Y_{2j-1;k}}}
{{\textstyle \sqrt{(x_{0}\cdot\cos(\psi_{k}) + y_{0}\cdot\sin(\psi_{k})^{2}
+ Y_{2j-1;k}^{2} - x_{0}^2 -y_{0}^{2} }}} .\]
Using the above matricies, the corrections to $X$ and $Y$ can be computed
as,
\begin{eqnarray*}
{\bf X}_{i+1} &=& {\bf X}_{i} - ({\cal A}^{T}{\cal G}_{B}{\cal A})^{-1}
{\cal A}^{T}{\cal G}_{B}{\bf C} \\
{\bf Y}_{i+1} &=& {\bf Y}_{i} - {\cal G}_{Y}^{-1}{\cal B}^{T}{\cal B}_{B}
({\bf C} - {\cal A}({\cal A}^{T}{\cal G}_{B}{\cal A})^{-1}{\cal A}^{T}
{\cal G}_{B}{\bf C})
\end{eqnarray*}
Upon completion of the iteration, the covariance matrix for {\bf X}
is given as \[ {\cal C}_{X} = ({\cal A}^{T}{\cal G}_{B}{\cal A})^{-1} .\]
The quantity $\chi^{2}$ is now computed as:
\[ \chi^{2} = ( {\cal B}\vec{\epsilon})^{T}{\cal G}_{B}
( {\cal B}\vec{\epsilon}) \]
with $\vec{\epsilon} = \vec{y}_{0} - \vec{y}_{i}$, the difference between
the initial value of $\vec{y}$ and its value at iteration $i$.
The iteration is then continued until one of the following conditions is
met.
\begin{itemize}
\item The number of iterations exceeds 10. If this occurs, then the routine
adds one to {\sc istacj(36)} in the {\sc /cjstat/} common block, and exits.
\item The value of $\chi^{2}$ increases by more than 5\% on an iteration.
If this happens, one is added to {\sc istacj(37)}, and the routine exits.
\item The value of $\chi^{2}$ falls below {\sc cxgzcj} in the {\sc /cjcuts/}
common block. If this occurs, the routine passes into the final section.
\item The value of $\chi^{2}$ changes by less than {\sc cxgzcj} in one
iteration. If this happens, the routine passes into the final section.
\end{itemize}
In the final section of this routine, the fit $z$ coordinates along the
tracks, as well as the left and right amplitude of each hit are used
to compute what the z--calibration constant for each wire should be.
\[ g_{j;k} = (a_{r}^{j;k}/a_{l}^{j;k})\cdot (z_{j;k} - 20)/(z_{j;k}+20)\]
These values are then added into the arrays in the {\sc /cjgain/} common
block. The fit values of $z$ are also stored in the {\bf TCHT} and {\bf
TJDC} data banks, and the fit values of $\tan(\lambda_{k})$ along with
their errors are stored in the {\bf TCTK} data banks. Next a {\bf TCVX}
bank is created for the fit vertex. Finally, the fit errors in $z$ are
computed as the $(2j,2j)$ diagonal elements of the fit covariance matrix for
the measurements:
\[ {\cal C}_{Y} = {\cal G}_{Y}^{-1} - {\cal G}_{Y}^{-1}{\cal B}^{T}
{\cal G}_{B}{\cal B}{\cal G}_{Y}^{-1} + {\cal G}_{Y}^{-1}{\cal B}^{T}
{\cal G}_{B}{\cal A}({\cal A}^{T}{\cal G}_{B}{\cal A})^{-1}{\cal A}^{T}
{\cal G}_{B}{\cal B}{\cal G}_{Y}^{-1} .\]
These fit values of $z$, as well as the raw amplitudes are also written to
the file {\bf CALGLOBZ.DAT}. This data is then read in by a more complicated
fitting procedure to allow more parameters per wire. This data is all
packed into two integer words per hit. The first word contains the fit
z coordinate as $iz=25000 + 1000\cdot z_{fit}$ packed into bits 1 through
22, and the wire number as $w=(s-1)\cdot 23 + l$ packed into bits 23 to
32. The second word contains the right or $-z$ amplitude packed into
bits 1 to 16, and the left or $+z$ amplitude packed into bits 17 to 32.
At this point, the common block {\sc /cjgloz/} is loaded with the following
data. The fit values of $z$ are copied into the {\sc zpftcj} array, the
difference between the initial and fit values of $z$ are placed in the
{\sc dzftcj} array, and the computed errors in $z$ are stored in the
{\sc szftcj} array. These values are thereby made available to the USER
routines. The routine will also fill the {\bf TCTK} data bank as shown
in table~\ref{tab:TXSG}. Note, this is only done for those tracks used
in the fit. As such, it is necessary to use the {\sc /cjgloz/} common
in conjunction with the {\bf TCTK} banks. Also, the {\em user service
routines} are unable to process the fit data from these banks; it is
necessary that the user unpack them by hand.
\begin{table}[htbp]\centering
\begin{tabular}{|c|c|l|}\hline
{\sl Offset} & {\sc type} & {\sl Quantity} \\ \hline
+1 & {\sc integer} & {\sl Number of Hits} \\
+2 & {\sc integer} & {\sl Layer of Hit 1 } \\
+3 & {\sc integer} & {\sl Hit number of hit 1} \\
+4 & {\sc integer} & {\sl Layer of Hit n} \\
+5 & {\sc integer} & {\sl Hit number of hit n} \\
+6 & {\sc integer} & {\sl Number of $dE/dx$ hits} \\
+7 & {\sc integer} & {\sl Error code from fit} \\
+8 & {\sc real} & {\sl Charge} \\
+9 & {\sc real} & {\sl Mass} $[MeV]$\\
+10& {\sc real} & $dE/dx$ $[MeV/cm]$\\
+11& {\sc real} & $\sigma_{dE/dx}$ $[MeV/cm]$\\
+12& {\sc real} & $0.0$ \\
+13& {\sc real} & $\psi_{0}$ $[$radians$]$\\
+14& {\sc real} & $\cos\psi_{0}$ \\
+15& {\sc real} & $\sin\psi_{0}$ \\
+16& {\sc real} & $x_{0}$ {\sl vertex point.} \\
+17& {\sc real} & $y_{0}$ {\sl vertex point.} \\
+18& {\sc real} & $0.0$ \\
+19& {\sc real} & $\tan\lambda_{0}$\\
+20& {\sc real} & $z_{0}$ {\sl vertex point.} \\
+21& {\sc real} & $0.0$ \\
$\vdots$ & $\vdots$ & $\vdots$ \\
+27& {\sc real} & $\sigma^{2}_{\tan\lambda} $\\
+28& {\sc real} & $0.0$\\
+29& {\sc real} & $\sigma^{2}_{z_{0}} $\\
+30& {\sc real} & $\chi^{2}$ \\ \hline
\end{tabular}
\caption[Data in the TCTK data bank.]{{\sf The data stored in the
subbanks of the {\bf TCTK} bank, ({\bf TCSG}). There is one {\bf TCSG}
data bank for each track found in the chambers.}}
\label{tab:TXSG}
\end{table}
\subsubsection{SUBROUTINE CJINIT}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 5 September, 1988.\\
{\bf References:} FFREAD long write up.\\
{\bf Call Arguments:} None.\\
{\bf Common Blocks Used:} {\sc tccuts}, {\sc tcprms},
{\sc cjcuts} and {\sc cjflag}.\\
{\bf Subroutines Referenced:}{\sc cjwipe}.\\
({\sc ffread}:) {\sc ffinit}, {\sc ffkey}, {\sc ffset} and {\sc ffgo}.
\end{flushleft}
This routine is called by the TCINIT routine to initialize the calibration
part of the code. The main purpose of this routine is to allow the user to
change some of the fit parameters used in calibration. The routine uses
the FFREAD package to read in a card file from unit {\sc ljcrd}. The
allowed cards are as follows:
\begin{description}
\item[ANGL] sets the value of {\sc angltc}, the rotation, in degrees, from
the angle $\phi = 0^{\circ}$ to the center of \jdc{} sector one.
{\bf When using this card, there needs to be a second real number which is
non--zero.}
\item[BMAG] sets the value of {\sc bmagtc}, the magnetic field strength
in the \jdc{}. If this value is changed, then the other parameters dependent
upon this are also changed.
{\bf When using this card, there needs to be a second real number which is
non--zero.}
\item[CCUT] sets the value of {\sc ccuttc}, the cutoff parameter used in
TCITER and CJITER to define when convergence has been reached.
\item[CFRA] sets the value of {\sc cfracj} in the {\sc /cjcuts/} common
block. The default value is 0.900.
\item[CHCU] sets the value of {\sc chcttc}, a parameter for associating
track segments in the TCASSC subroutine.
\item[CHDS] sets the value of {\sc chdstc}, a cutoff parameter for defining
the error code in the CJITER and TCITER routines.
\item[CHLX] sets the value of {\sc chlxtc}, the convergence cutoff in the
TCHELX routine.
\item[CLIM] sets the value of {\sc climcj} in the {\sc /cjcuts/} common
block. The default value is 150.
\item[CLMB] sets the value of {\sc clmbtc}, the $\chi^{2}$ for associating
tracks in $\tan\lambda$ in the TCSGMT subroutine.
\item[CSMX] sets the value of {\sc csmxcj} in the {\sc /cjcuts/} common
block. This is the minimum value of $\cos\alpha$ to be written out by
CJUPDT. To use this card, enter the value of $\alpha$ in radians.
\item[CXGZ] sets the value of {\sc cxgzcj} in the {\sc /cjcuts/} common
block. This is a convergence criteria in the CJGZFT routine.
\item[CXSQ] sets the value of {\sc cxsqtc}, a parameter for associating
hits in the TCSGMT subroutine.
\item[DEBG] sets the value of the {\sc debgtc} flag in the {\sc /tcdebg/}
common block. Assuming that the code has been linked with the debug print
lines, {\sc debgtc} allows the user to turn them off. The default value
is {\sc .true.}, unless the PATCHY flag {\sc debfalse} was used in
building the code, in that option the default will be {\sc .false.}.
\item[DELT] sets the value of {\sc delttj}, the quadratic term in the
error calculation.
\item[DELY] sets the value of {\sc delytj}, the linear term in the error
calculation.
\item[DELZ] sets the value of {\sc delytc} in the {\sc /tcprms/} common
block. This is the error in the $z$ position as assigned by the TJZPOS
routine. If one uses this card, be sure to enter 23 values.
\item[DMAX] sets the value of {\sc dmaxtj} in the {\sc /tjcuts/} common
block. The default value is 0.130.
\item[DMIN] sets the value of {\sc dmintj} in the {\sc /tjcuts/} common
block. This value is used in the pattern recognition routines. The
default value is 0.028 .
\item[DXSQ] sets the value of {\sc dxsqtc} in the {\sc /tccuts/} common
block. This value is used in the TCRSRC and TCFSRC routines.
\item[DYMX] sets the value of {\sc dymxcj} in the {\sc /cjcuts/} common
block. This is the maximum shift in centimeters a point can have, and
be written out by the CJUPDT routine.
\item[IAMP] sets the value of {\sc iamptj} in the {\sc /tjcuts/} common
block. This is used in the TJDCGT routine to discard noise hits.
{\bf When using this card, there needs to be a second number which is
non--zero.}
\item[ICAL] sets the value of {\sc icalcj}, the \jdc{} calibration steering
parameter. This defaults to a value of 0, (see the CJCALB routine for a
description).
\item[IGAP] sets the value of {\sc igaptj} in the {\sc /tjcuts/}common
block. This is used in the TCSGMT routine do determine how large a gap
a segment can have. It has a default value of 5.
\item[INTG] sets the value of {\sc itimrj} in the {\sc /rjprms/}
common block. It is the integration time used in the RJAFIT routine,
and has a nominal value of 15 FADC channels.
\item[ISEP] sets the value of {\sc iseprj} in the {\sc /rjprms/} common
block. It is the minimum separation between double pulses in RJAFIT.
\item[ITFC] sets the value of {\sc itfcrj} in the {\sc /rjprms/} common
block. It is a $t_{0}$ offset for the fit pulses in RJPROC coming from
the DL307 Flash ADC's. There are 16 values in the {\sc itfcrj} array.
{\bf When using this card, the user should have 17=1 to cause the program
to accept these values.}
\item[ITMI] sets the value of {\sc itmirj} in the {\sc /rjprms/}
common block. It is the minimum pulse separation allowed in the RJPULS
routine. It has a default value of 2.
\item[IMAX] sets the 23 integer values of {\sc itmxtj}, the maximum drift time
allowed in each layer of the \jdc{}.
\item[JDCL] sets the value of {\sc jdclcj}, the \jdc{} calibration flag in
the {\sc /cjflag/} common block. It defaults to .TRUE..
\item[JGAP] sets the value of {\sc jgaptj} in the {\sc /tccuts/} common
block. This is the maximum layer gap allowed in TCFSRC and TCRSRC, and
has a default value of 2.
\item[LGPD] sets the value of {\sc lgpdrj} in the {\sc /rjprms/} common
block. This tells the RJPROC routine if it should compute the pedestals
dynamically from the presample. The normal value is {\sc .false.} which
means pedestals are computed dynamically.
\item[LGT0] sets the value of {\sc lgt0rj} in the {\sc /rjprms/} common
block. This tells the RJPROC routine if $t_{0}$'s should be subtracted
from the times it stores in the {\bf RJDC} data bank. The normal value
is {\sc .false.}, which means that $t_{0}$ subtraction is not performed.
\item[LGT2] sets the value of {\sc lgt2tj}, a logical to control how errors
in the \jdc{} are computed.
\item[LGWR] is entered with a non--zero value to prevent the TJTIMI
routine from overwriting the dead wire list. This is necessary during
z calibrations.
\item[LSEC] is a card used to turn off sectors in the CJGZFT subroutine.
The card can have up to 30 integer entries, which are the sector numbers
to be turned off. If this card is not used, then all sectors are assumed on.
\item[MCIR] sets the value of {\sc mcircj} in the {\sc /cjcuts/} common
block. This is the minimum number of hits per track in the CJITER routine.
\item[MHIT] sets the value of {\sc mhitcj} in the {\sc /cjcuts/} common
block. This is the minimum number of hits per track in CJGZFT and CJZFIT.
\item[MTRK] sets the value of {\sc mtrkcj} in the {\sc /cjcuts/} common
block. This is the minimum number of tracks per event in the CJGZFT
routine.
\item[MXPL] sets the value of {\sc mxplrj} in the {\sc /rjprms/}
common block. It is the maximum time separation between the left and
right FADC pulses to be considered the same pulse.
\item[NDBG] sets the value of {\sc ndbgtc}, which, if it is not set to
zero, turns on the debug print lines for event number {\sc ndbgtc}, and
prints a simple message for every event processed. (Note: the code
must have been installed with the debug print lines for this to work,
otherwise it has no effect on the code.)
\item[NHLX] sets the value of {\sc nhlxtc}, the maximum number of
iterations in the TCHELX subroutine.
\item[NITR] sets the value of {\sc nitrtc}, the maximum allowed number of
iterations in both the TCITER and CJITER routines. The default value is 10.
\item[NPUL] sets the value of {\sc npulrj} in the {\sc /rjprms/} common
block. It is the minimum pulse height required in the RJPULS routine
to accept a hit in the {\bf RJDF} data bank. It has a default value of 6.
\item[OPWC] sets the values of {\sc opwctp(1)} and {\sc opwctp(2)}, the
angle, in {\bf radians}, from $\phi =0$ to wire number zero of \pwc{} one and
\pwc{} 2.
{\bf When using this card, there needs to be a third number which is
non--zero.}
\item[RJDD] sets the value of the {\sc lgrjdd} parameter in the
{\sc /rjprms/} common block to {\sc .true.}. This forces the program
to use online processed data.
\item[RJDF] sets the value of the {\sc lgrjdf} parameter in the
{\sc /rjprms/} common block to {\sc .true.}. This forces the program
to perform Qt-analysis on the data, even if online processed
data exist.
\item[RSLV] sets the value of the {\sc rslvtc} parameter in the
{\sc /tccuts/} common block.
\item[SXDQ] sets the value of {\sc sxdqtj} in the {\sc /tjprms/} common
block. The default value of this term is zero.
\item[SY02] sets the value of {\sc sy02tj} in the {\sc /tjprms/} common
block.
\item[SYDF] sets the value of {\sc sydftj} in the {\sc /tjprms/} common
block.
\item[SYDQ] sets the value of {\sc sydqtj} in the {\sc /tjprms/} common
block. The default value of this term is zero.
\item[TDIF] sets the value of the {\sc tdiftj} parameter in the
{\sc /tjcuts/} common block. This is used for merging hits in the
TJDCGT routine.
\item[TMIN] sets the value of {\sc tmintj}, the minimum time a hit can
have, and still be resolved using $(t_{1}+t_{3})/2 - t_{2}$. The default
value is 0.080 .
\item[VFRC] sets the value of {\sc vfrctc} in the {\sc /tccuts/} common block.
\item[VPRB] sets the value of {\sc vprbtc} in the {\sc /tccuts/} common block.
\item[XSQR] sets the value of {\sc xsqrtc}, a pattern recognition cutoff,
(see the TCRAW1 subroutine).
\item[YCUT] sets the value of {\sc ycuttj} in the {\sc /tjcuts/} common
block. This is used in computing the hit position in the TJTIME routine.
\item[ZAMP] sets the value of {\sc zampcj} in the {\sc /cjcuts/} common.
This is the minimum amplitude both left and right must have for the hit
to be written to the calibration file. It has a default value of 200.
\item[ZCTT] sets the value of {\sc zcttcj} in the {\sc /cjcuts/} common.
This is the global $z$--vertex cut, and has a default value of 5 cm.
\item[ZCUT] sets the value of {\sc zcutcj} in the {\sc /cjcuts/} common.
This defines a window around {\sc zofftc} along the $z$--axis, into which
tracks must project if they are to be used in $z$--calibrations.
\item[ZMOV] sets the value of {\sc zmovcj} in the {\sc /cjcuts/} common.
This is the amount a point can be shifted in the CJGZFT routine, and still
be used for calibration. It has a default value of 4 cm.
\item[ZOFF] sets the value of {\sc zofftc} in the {\sc /tcprms/} common.
This is used in computing $\tan\lambda$ in the TJZPOS routine.
\item[ZPOS] sets the value of {\sc zposcj} in the {\sc /cjcuts/} common.
This sets the allowed range in $z$ on all wires to be used in $z$--calibration.
\item[ZPRB] sets the value of {\sc zprbcj} in the {\sc /cjcuts/} common.
This is a probability cut in CJGZFT and has a default of 0.00.
\item[ZRIN] sets the value of {\sc zrincj} in the {\sc /cjcuts/} common.
This is an $xy$ vertex inner cut, and defaults to 0.00 cm.
\item[ZROT] sets the value of {\sc zrotcj} in the {\sc /cjcuts/} common.
This is an $xy$ vertex outer cut, and defaults to 5.00 cm.
\item[ZVTX] sets the value of {\sc zvtxtc} in the {\sc /tccuts/} common block.
\item[ZXYR] sets the value of {\sc zxyrcj} in the {\sc /cjcuts/} common.
This is the minimum distance in the $xy$ plane all tracks must come to the
$xy$ vertex in order to accept the event. It defaults to 0.50 cm.
\end{description}
HH
Finally, this routine will open the output files used by the various
calibration routines for printing calibration data. The name of the
opened file is dependent upon the value of {\sc icalcj} in the {\sc /cjflag/}
common block. For a value of zero, the file {\bf CALCIRCLE.DAT} is
opened; for the case of two, the file {\bf CALZFIT.DAT} is opened; and for the
case of four, the file {\bf CALGLOBZ.DAT} is opened. (Note: these files
are only opened if the {\sc vax} or {\sc alt} switch is used in the
{\sc patchy} cradle.)
\subsubsection{SUBROUTINE CJITER}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 19 September, 1988.\\
{\bf References:} Datenanalyse by Siegmund Brandt, p. 271.\\
{\bf Call Arguments:} (ITRK, *Y, *GYINV, *X, *COVR, *CHISQ,*IERR).\\
{\bf Common Blocks Used:} {\sc cbbank}, {\sc cblink}, {\sc cjstat},
{\sc tccuts}, {\sc tchits}, {\sc cbunit} and {\sc tcangl}.\\
{\bf Subroutines Referenced:} {\sc zebra library:} {\sc mzwork}.\\
\end{flushleft}
This routine accepts as input the track number, {\sc itrk}, the measured
quantities, {\sc y} and their errors, {\sc gyinv}, and a guess to the fit
parameters, {\sc x}. The routine then iterates the equations as in the
TCITER routine, but unlike the TCITER routine, it also updates the measured
coordinates along the tracks. As in TCITER, the convergence criteria is
controlled by the {\sc ccuttc} parameter in the {\sc /tccuts/} common block,
and the returned error code is set using the {\sc chdstc} parameter in the
{\sc /tccuts/} common block. The values of these variables can be set using
the {\bf CCUT} and {\bf CHDS} cards of the CJINIT routine.
Once convergence has been reached as in TCITER, the routine returns the fit
parameters, {\sc x}, their covariance matrix, {\sc covr}, the chisquare of
the fit, {\sc chisq}, an error code from the fit as per TCITER, {\sc ierr}
and the new values for both the measured quantities, {\sc y} and their errors,
{\sc gyinv}. Also available is the {\sc rdevtc} array in the {\sc /tcangl/}
common block. This contains the deviation of every point from the fit track.
\subsubsection{SUBROUTINE CJSLOW}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer \\
{\bf Creation Date:} 22 August, 1990.\\
{\bf References:} \\
{\bf Call Arguments:} None. \\
{\bf Common Blocks Used:} {\sc sclink}, {\sc cblink}, {\sc cbbank},
{\sc cjslcn}. \\
{\bf Called by:} TJSLOW \\
{\bf Subroutines Referenced:} \\
\end{flushleft}
This routine averages the slow control data measured during a run
and writes it to an external file that is later included in the
$r\phi$ calibration work.
\subsubsection{SUBROUTINE CJUPDT}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer \\
{\bf Creation Date:} 19 September, 1988.\\
{\bf Revised:} 19 July, 1989.\\
{\bf References:} \\
{\bf Call Arguments:} (ITRK, ICODE, NPTS, Y).\\
{\bf Common Blocks Used:} {\sc cblink}, {\sc cbbank}, {\sc cbunit},
{\sc cjstat}, {\sc tjprms}, {\sc cjgain} and {\sc tcprms}.\\
{\bf Subroutines Referenced:} TCRHIT. \\
\end{flushleft}
This routine will take a vector {\sc y} of {\sc npts} fitted coordinates
and write information to a claibration file for use in \jdc{} calibrations.
The passed argument, {\sc itrk} is the track number in either the {\bf TCTK}
or {\bf TCTR} bank, and the value of {\sc icode} identifies if the data
in {\sc y} is from a circle fit or a helix fit.
For {\sc icode} equal to zero, the data is assumed to be from a circle
fit. Here the values in y are {\sc npts} ($r$,$\phi$) pairs. For {\sc icode}
equal to one, the data is assumed to be from a helix fit. Here the data
in {\sc y} is {\sc npts} ($x$,$y$,$z$) triplets.
This routine will write the the file assigned to logical unit {\sc ljtout}
which is usually opend as CALCIRCLE.DAT. There are two packed integer words
per hit. In the first word, bit 1 identifies left or right, (0 is left and
1 is right), bits 2 to 8 contain the layer number, bits 9 to 16 contain
the sector number, and bits 17 to 32 contain the drift time in units of
0.5 ns. In the second word, bits 1 to 15 contain the absolute value of
$x$, bit 16 is the sign bit for $x$, bits 17 to 31 contain the absolute
value of $y$ and bit 32 is the sign bit for $y$.
\subsubsection{SUBROUTINE CJWIPE}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 19 September, 1988. \\
{\bf References:} \\
{\bf Call Arguments:} None. \\
{\bf Common Blocks Used:} {\sc cbunit}, {\sc cjflag}, {\sc cjstat}
and {\sc cjgain}.\\
{\bf Subroutines Referenced:} None. \\
\end{flushleft}
This routine performs zeroing and initialization necessary before the
start of a calibration run.
\subsubsection{SUBROUTINE CJZCHK}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 06 October, 1989. \\
{\bf References:} \\
{\bf Call Arguments:} (ITRK, Y, GYINV, TGL, B).\\
{\bf Common Blocks Used:} {\sc cjgloz}. \\
{\bf Called By:} {\sc cjgzft}
{\bf Subroutines Referenced:} {\sc sm353}. \\
\end{flushleft}
This routine will examine the straight line track, {\sc itrk}
defined by the points in the double precision variable {\sc y},
and the errors in those points in the double precision variable
{\sc gyinv}, and determine if any of these points are too far away
from the line given by {\sc tgl(itrk)} and {\sc b}. This is determined
by computing the deviation of each point from the fit line, and then
smoothing these deviations using the SM353 routine. Those points that
were shifted by more than 1.5 sigma in $z$ are then dropped from the
track. The track is then refit and returned to the calling routine.
\subsubsection{SUBROUTINE CJZFIT}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 2 March, 1989. \\
{\bf References:} \\
{\bf Call Arguments:} None. \\
{\bf Common Blocks Used:} {\sc cjgloz}, {\sc cjgain}, {\sc cbbank},
{\sc tclift} and {\sc cblink}.\\
{\bf Subroutines Referenced:} ({\sc zebra}) {\sc mzlift}.\\
\end{flushleft}
This routine calibrates the $c_{i}^{z}$ constants for the \jdc{}. These
constants are used to determine the $z$ position on every wire, and
contain the ratio of gains between the $+z$ end and $-z$ end preamplifiers.
The calibration is performed by fitting a line to all tracks found in the
r--z plane, and then computing the deviation in $z$ from the fit track.
With this deviation, ($\Delta z$), one can extract what the gain constant
should be as:
\begin{eqnarray*}
c_{i}^{z} &=& \left [ \frac{{\textstyle A_{+}\cdot (20. + \Delta z)}}
{{\textstyle A_{-} (20. - \Delta z)}} \right ]
\end{eqnarray*}
These constants are tallied in the {\sc zfitcj} array of the {\sc /cjgain/}
common block, and new values are computed in the CJUPDT routine.
Information on an event by event basis is available in the {\sc /cjgloz/}
common block. Also, a vertex bank is created for every track, which contains
the projection to $r=0$. A track must have more than {\sc mhitcj} hits to
be used by this routine.
\subsubsection{SUBROUTINE CJ4PRG}
\begin{flushleft}
{\bf Author:} Curtis A. Meyer\\
{\bf Creation Date:} 22 April, 1990. \\
{\bf References:} \\
{\bf Call Arguments:} (*PROB3, *PROB4, LGHLX, LONG, LYR0, LYRN, LG3C). \\
{\bf Common Blocks Used:} {\sc cblink}, {\sc cbbank}, {\sc cjpcal}
{\sc trkprm} and {\sc cbunit}.\\
{\bf Called by:} {\sc cjcalb}. \\
{\bf Subroutines Referenced:} {\sc tckft3}, {\sc tckft4}, {\sc tchlds},\\
{\sc cernlib:} {\sc prob}. \\
\end{flushleft}
This is a filter routine used to select events of the type
\[ \overline{p}p\rightarrow \pi^{+}\pi^{-}\pi^{+}\pi^{-} \] and
\[ \overline{p}p\rightarrow K^{+}K^{-}\pi^{+}\pi^{-}.\]
The routine first requires that there be a vertex which has exactly
four tracks. Then each of these tracks is required to have at least
{\sc long} hits. Each track is also required to start no later than
{\sc lyr0} and end no earlier than {\sc lyrn}.
Then the routine requires that the charge at the
vertex sum to zero. If the value of {\sc lghlx} is {\sc .true.}, the
data is taken from the {\bf TCTR} bank through the pointers in the
{\bf TCVP} bank. If {\sc lghlx} is {\sc .false.}, then the data is
simply taken from the {\bf TCVP} data bank. The initial values of
4--momentum are then loaded into the {\sc /cjpcal/} common block, and
then a 3--C kinematic fit is performed, (see TCKFT3). The probability
of this is then assigned to the variable {\sc prob3}. If the value of
{\sc lg3c} is set {\sc .true.}, then these 3--C values are returned.
If not, then a 4--C kinematic fit is performed, and the resulting momentum
and covariance matricies are stored in the {\sc /cjpcal/} common
block. Then the probability of this fit is assigned to the variable
{\sc prob4}.
When the variable {\sc lghlx} is given as {\sc .true.}, then the
TCHLDS routine is used to obtain the 3--momentum, and the full
3 by 3 covariance matrix for each track. This routine doubles all
errors associated with the helix parameter $\psi_{0}$ because no
vertex constraint has been placed on the event. When {\sc lghlx}
is {\sc .false.}, then the covariance matrix is simply diagonal, and
taken from the {\bf TCVP} data bank. This routine then doubles the
errors of all momenta, (quadruples the diagonal of the covariance matrix).
\clearpage
\begin{figure}[p]
\begin{picture}(425,600)(50,0)\centering
\thicklines
\put(100,560){\framebox(50,25){{\small CBMAIN}}}
\put(125,560){\line(0,-1){360}}
\put(125,200){\circle*{5}}
\put(125,532){\vector(1,0){50}}
\put(175,520){\framebox(50,25){{\small CBINIT}}}
\put(225,532){\vector(1,0){50}}
\put(275,520){\framebox(50,25){{\small $\cdots$}}}
\put(125,492){\vector(1,0){50}}
\put(175,480){\framebox(50,25){{\small CBLOOP}}}
\put(225,492){\vector(1,0){25}}
\put(250,480){\framebox(50,25){{\small CBPHYS}}}
\put(300,492){\vector(1,0){25}}
\put(325,480){\framebox(50,25){{\small TCTRAK}}}
\put(350,480){\line(0,-1){120}}
\put(350,360){\circle*{5}}
\put(350,452){\vector(1,0){50}}
\put(400,440){\framebox(50,25){{\small TJDCGT}}}
\put(350,412){\vector(1,0){50}}
\put(400,400){\framebox(50,25){{\small TPWPOS}}}
\put(350,372){\vector(1,0){50}}
\put(400,360){\framebox(50,25){{\small CJCALB}}}
\put(425,360){\line(0,-1){25}}
\put(425,330){\circle{10}}
\put(425,330){\makebox(0,0){{\tiny A}}}
\put(125,212){\vector(1,0){50}}
\put(175,200){\framebox(50,25){{\small ZEND}}}
\put(225,212){\vector(1,0){25}}
\put(250,200){\framebox(50,25){{\small TCDONE}}}
\put(300,212){\vector(1,0){25}}
\put(325,200){\framebox(50,25){{\small CJDONE}}}
\end{picture}
\caption[General Calibration Flow Diagram]
{{\sf The calling sequence for the calibration code.}}
\label{fig:calbseq}
\end{figure}
\clearpage
\begin{figure}[p]
\begin{picture}(425,600)\centering
\thicklines
\put(125,560){\circle{10}}
\put(125,560){\makebox(0,0){{\tiny A}}}
\put(125,555){\line(0,-1){490}}
\put(125, 65){\circle*{5}}
\put(125,532){\vector(1,0){50}}
\put(175,520){\framebox(50,25){{\small TCPATT}}}
\put(225,532){\vector(1,0){25}}
\put(250,520){\framebox(50,25){{\small $\cdots$}}}
\put(50,480){\makebox(0,0){{\small ICAL=--1}}}
\put(125,492){\vector(1,0){50}}
\put(175,480){\framebox(50,25){{\small TCCIRC}}}
\put(225,492){\vector(1,0){25}}
\put(250,480){\framebox(50,25){{\small $\cdots$}}}
\put(125,452){\vector(1,0){50}}
\put(175,440){\framebox(50,25){{\small CJFITR}}}
\put(225,452){\vector(1,0){25}}
\put(250,440){\framebox(50,25){{\small $\cdots$}}}
\put(50,400){\makebox(0,0){{\small ICAL=0}}}
\put(125,412){\vector(1,0){50}}
\put(175,400){\framebox(50,25){{\small TCCIRC}}}
\put(225,412){\vector(1,0){25}}
\put(250,400){\framebox(50,25){{\small $\cdots$}}}
\put(125,372){\vector(1,0){50}}
\put(175,360){\framebox(50,25){{\small CJFITR}}}
\put(225,372){\vector(1,0){25}}
\put(250,360){\framebox(50,25){{\small $\cdots$}}}
\put(50,320){\makebox(0,0){{\small ICAL=+2}}}
\put(125,332){\vector(1,0){50}}
\put(175,320){\framebox(50,25){{\small CJZFIT}}}
\put(225,332){\vector(1,0){25}}
\put(250,320){\framebox(50,25){{\small $\cdots$}}}
\put(50,280){\makebox(0,0){{\small ICAL=+3}}}
\put(125,292){\vector(1,0){50}}
\put(175,280){\framebox(50,25){{\small TCCIRC}}}
\put(225,292){\vector(1,0){25}}
\put(250,280){\framebox(50,25){{\small $\cdots$}}}
\put(125,252){\vector(1,0){50}}
\put(175,240){\framebox(50,25){{\small CJDEDX}}}
\put(225,252){\vector(1,0){25}}
\put(250,240){\framebox(50,25){{\small $\cdots$}}}
\put(50,200){\makebox(0,0){{\small ICAL=+4}}}
\put(125,212){\vector(1,0){50}}
\put(175,200){\framebox(50,25){{\small CJGZFT}}}
\put(225,212){\vector(1,0){25}}
\put(250,200){\framebox(50,25){{\small $\cdots$}}}
\end{picture}
\caption[Calibration flow I.]{{\sf Flow of chamber calibration software.}}
\label{fig:calb1}
\end{figure}
\clearpage
\section*{References and further Information}
\begin{itemize}
\item S. Brandt, {\bf Datenanalyse} .
\item R.L. Gluckstern, {\bf NIM 24}, 381, (1963).
\item CERN Program Library F101, ({\sc matin2}).
\item R. Brun, {\em et. al.}, {\bf FFREAD Users Guide}. CERN
Program Library I302, (1987).
\item J. Zoll, {\bf Zebra Reference Manual, MZ}. CERN Program
Library Q100, (1987).
\item J. Zoll, {\bf Zebra Reference Manual, FZ}. CERN Program
Library Q100, (1987).
\item J. Zoll, {\bf Zebra Reference Manual, Dia}. CERN Program
Library Q100, (1987).
\item R. Brun and D. Lienart, {\bf HBOOK User Guide, Version 4}.
CERN Program Library Y250, (1987).
\item G.J. VanDalen, {\bf Track fitting methods for the TPC Detector},
\newline TPC--UCR--79--3, (1979).
\item A. Weinstein, {\bf More SLCFND documentation, and status of
tracking},
\newline MARKII/SLC NOTE \# 127, (1986).
\item A. Weinstein, {\bf Yet more SLCFND documentation},
\newline MARKII/SLC NOTE \# 132, (1986).
\item A. Weinstein, {\bf Technical note on tracking resolution
for small angle tracks},
\newline MARKII/SLC NOTE \# 133, (1986).
\item J. Olsson, {\em et. al.}, {\bf NIM 176}, 403, (1980).
\end{itemize}
\end{document}