\documentstyle{article}

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

\begin{document}
\pagestyle{empty}
\section{Structure of SC\_DATA and of the Slow Control Data Banks}
Length and name of the arrays in the SC\_DATA data module and their
names in the corresponding slow control data bank:
\begin{table}[h]\centering
  \begin{tabular}[h]{l l l l}
    ZEBRA BANK & struc. in SC\_DATA & Length (short int) & comment \\
    \hline
    \vspace{0.2cm}
    SCBM & beam     & \makebox[2em][r]{20} & sum of silicium counters\\
    SCTG & target   & \makebox[2em][r]{20} & target level\\
    SCPC & pwc      & \makebox[2em][r]{20} &\\
    SCXD & xdc      & \makebox[2em][r]{20} & not in use\\
    SCJV & jdc\_hv  & \makebox[2em][r]{150} & JDC HV and currents\\
    SCJG & jdc\_gas & \makebox[2em][r]{20} & JDC gas rig\\
    SCXT & xtal\_temp & \makebox[2em][r]{200} & all temperature sensors\\
    SCXP & xtal\_ps   & \makebox[2em][r]{ 10} & crystal power supplies\\
    SCMG & magnet     & \makebox[2em][r]{ 20} & magnet current\\
    SCHD & hdc        & \makebox[2em][r]{ 20} & test drift chamber\\
    SCHT & hut        & \makebox[2em][r]{ 20} & crate control in electronic hut\
  \end{tabular}
\end{table}

\subsection{General Remarks}
All array words are 2-bit integers (short int).
The first word of each array is reserved for the length of the array,
the second for the status of the subcomponent.
Status = -1 indicates OK, 0 indicates that the subcomponent is
'not being supervised'.
A defined integer range is reserved for each subcomponent status
to specify error codes:

\begin{table}[h]\centering
\begin{tabular}[h]{r@{ -- }l@{\hspace{1cm}}l}
  1 & 10  & beam counter \\
 11 & 20  & target level \\
 21 & 30  & pwc          \\
 31 & 50  & spare        \\
 51 & 90  & jdc          \\
 91 & 100 & spare        \\
101 & 150 & temperatures \\
151 & 160 & barrel       \\
161 & 170 & magnet       \\
171 & 180 & test dc      \\
181 & 200 & crates       \\
\end{tabular}
\end{table}

Please note that the numbering of the words depends on the program
language. Fortran numbering goes from 1 to n, C numbering from
0 to n-1, where n is the array length. As all the slow control programs
are written in C we will take word number 0 always as the first word.

\subsection{Contents of the Arrays}
\vspace{1cm}
\begin{tabular}[h]{|r@{\hspace{2.5mm}}|@{\hspace{2.5mm}}l|rcl|}
  \hline
  beam[0]    &  array length      & 20 & & \\
  \hline
  \   [1]    &  status word       & -1 &=& OK   \\
             &                    &  1 &=& no q from adc      \\
             &                    &  2 &=& beam low           \\
  \hline
  \   [2]    &  raw adc value     &    & &                    \\
  \hline
\end{tabular}
\vspace{1cm}  \\
\begin{tabular}[h]{|r@{\hspace{2.5mm}}|@{\hspace{2.5mm}}l|rcl|}
  \hline
  target[0]  &  array length      & 20 & & \\
  \hline
  \     [1]  &  status word       & -1 &=& OK   \\
             &                    & 11 &=& no q from adc       \\
             &                    & 12 &=& target 'empty'      \\
  \hline
  \      [2] &  raw adc value     &    & & \\
  \hline
\end{tabular}
\vspace{1cm}  \\
\begin{tabular}[h]{|r@{\hspace{2.5mm}}|@{\hspace{2.5mm}}l|rcl|}
  \hline
  pwc[0]     &  array length       & 20 & & \\
  \hline
  \  [1]     &  status word, PWC \#1 &  -1 &=& OK     \\
             &                     &  21 &=& no q from ADCx1    \\
             &                     &  22 &=& HV too high        \\
             &                     &  23 &=& HV too low         \\
             &                     &  24 &=& no q from ADCx100  \\
             &                     &  25 &=& current high, beam on  \\
             &                     &  26 &=& current high, beam off \\
  \hline
  \     [2]  & status word, PWC \#2 &\multicolumn{3}{l|}{same code }  \\
  \hline
  \     [3]  &\multicolumn{4}{l|}{HV adc value, PWC \#1 }       \\
  \     [4]  &\multicolumn{4}{l|}{HV adc value, PWC \#2 }        \\
  \hline
  \     [5]  &\multicolumn{4}{l|}{Current adc value, PWC \#1 }   \\
  \     [6]  &\multicolumn{4}{l|}{Current adc value, PWC \#2 }   \\
  \hline
\end{tabular}
\vspace{1cm}  \\
\begin{tabular}[h]{|r@{\hspace{2.5mm}}|@{\hspace{2.5mm}}l|rcl|}
  \hline
  xdc[0]     & array length        & 20 & & \\
  \hline
  \  [1]     & status word         &\multicolumn{3}{l|}{not in use! } \\
  \hline
\end{tabular}
\vspace{1cm}  \\
\begin{tabular}[h]{|r@{\hspace{2.5mm}}|@{\hspace{2.5mm}}l|rcl|}
  \hline

  jdc\_hv[0] & array length        & 150 & & \\
  \hline
  \     [1] & status, HV channel \#1-16 & -1 &=& OK  \\
            &                     & 51 &=& no q or lam in checkstat() \\
            &                     & 52 &=& HV-supply off
                                              or at local mode \\
            &                     & 53 &=& data error in checkstat()  \\
            &                     & 54 &=& channel failure \\
            &                     & 55 &=& no q or lam for set volts \\
            &                     & 56 &=& data error for set volts  \\
            &                     & 57 &=& no q or lam for true volts \\
            &                     & 58 &=& data error true volts \\
            &                     & 60 &=& true volts wrong \\
  \hline
  \      [2] & status, HV channel \#17-32 & -1 &=& OK \\
             &      &\multicolumn{3}{l|}{same error code as in [1] } \\
  \hline
  \ [3]-[18] &\multicolumn{4}{l|}{set volts, channel \#1-16 }  \\
 \ [19]-[34] &\multicolumn{4}{l|}{set volts, channel \#17-32 } \\
 \ [35]-[50] &\multicolumn{4}{l|}{true volts, channel \#1-16 } \\
 \ [51]-[66] &\multicolumn{4}{l|}{true volts, channel \#17-32 } \\
  \hline
  \    [110] & status, cdi-modules & -1 &=& OK  \\
             &                     &  n &=& module n not readable \\
  \hline
    \  [111] & current warning     & -1 &=& OK  \\
             &            &  n &=& max current, if $>$ 500 nA \\
    \hline
 \ [118]-[149] &\multicolumn{4}{l|}{current of channel
                                       \#1-32, unit nA } \\
    \hline
\end{tabular}
\vspace{1cm}  \\
\begin{tabular}[h]{|r@{\hspace{2.5mm}}|@{\hspace{2.5mm}}l|rcl|}
  \hline
  \ jdc\_gas[0] & array length    & 20 & & \\
  \hline
  \         [1] & status word     &  -1 &=& OK \\
                &                 &  81 &=& no entry in ADC channel \\
  \hline
  \         [2] &\multicolumn{4}{l|}{raw ADC value of Isobutane flow} \\
  \         [3] &\multicolumn{4}{l|}{raw ADC value of CO$_2$ flow} \\
  \         [4] &\multicolumn{4}{l|}{raw ADC value of 'mixed' flow} \\
  \         [5] &\multicolumn{4}{l|}{spare for 4th flowmeter}  \\
  \hline
  \ [6] &\multicolumn{4}{l|}{raw ADC value of pressure absolute} \\
  \ [7] &\multicolumn{4}{l|}{raw ADC value of pressure differential} \\
  \hline
\end{tabular}
\vspace{1cm}  \\
\begin{tabular}[h]{|r@{\hspace{2.5mm}}|@{\hspace{2.5mm}}l|rcl|}
  \hline
  xtal\_temp[0] & length of array   & 200 & & \\
  \hline
  \         [1] & status word       & -1 &=& OK    \\
   &   &\multicolumn{3}{l|}{else regard bits of (xtal\_temp[1]-100)}\\
  \hline
       &\multicolumn{2}{r}{ XXXX XXX1}&=&
           \multicolumn{1}{p{5cm}|}{ADC not in differential mode} \\
       &\multicolumn{2}{r}{ XXXX XX1X}&=&
           \multicolumn{1}{p{5cm}|}{ADC not converting} \\
       &\multicolumn{2}{r}{ XXXX X1XX}&=&
           \multicolumn{1}{p{5cm}|}{one ore more sensors temp too high}\\
       &\multicolumn{2}{r}{ XXXX 1XXX}&=&
           \multicolumn{1}{p{5cm}|}{one ore more sensors temp too low}\\
       &\multicolumn{2}{r}{ XXX1 XXXX}&=&
           \multicolumn{1}{p{5cm}|}{one ore more sensors too noisy} \\
       &\multicolumn{2}{r}{ XX1X XXXX}&=&
           \multicolumn{1}{p{5cm}|}{one ore more sensors disconnected} \\
  \hline
  \  [2]-[n+1]  &\multicolumn{4}{l|}{ADC value of sensors \#1-n
  (see special table)}    \\
  \hline
  \ [n+2]-[100] &\multicolumn{4}{l|}{spare for more sensors}  \\
  \hline
  \     [100+i] & status of sensor \#i & -1 &=& OK  \\
                &                     &  0 &=& temp too low \\
                &                     &  1 &=& temp too high \\
                &                     &  2 &=& noisy reading \\
                &                     &  3 &=& disconnected  \\
  \hline
\end{tabular}
\vspace{1cm}  \\
\begin{tabular}[h]{|r@{\hspace{2.5mm}}|@{\hspace{2.5mm}}l|rcl|}
  \hline
  xtal\_ps[0] & array length   & 10 & & \\
  \hline
  \       [1] & status word    & -1 &=& OK \\
              &                & 151 &=& no listeners on bus \\
              &                & 152 &=& SRQ set after bus reset \\
              &                & 153 &=& fail on serial poll \\
              &                & 154 &=& fail on power supply \\
  \hline
  \      [2]  & power supply status &
   \multicolumn{3}{l|}{set if failure occurs} \\
              &                     & 0x4a &=& overcurrent \\
              &                     & 0x45 &=& overvoltage \\
  \hline
  \      [3]  & GPIB bus status &\multicolumn{3}{p{5cm}|}{set if failure
                  occurs on polling. It gives an 8 bit pattern
                  showing the status of the 5 bus management lines
                  and the 3 handshake lines.} \\
  \hline
\end{tabular}
\vspace{1cm}  \\
\begin{tabular}[h]{|r@{\hspace{2.5mm}}|@{\hspace{2.5mm}}l|rcl|}
  \hline
  magnet[0]   & array length  & 20 & & \\
  \hline
  \     [1]   & status word  & -1 &=& OK \\
              &              & 161 &=& no q from ADC \\
              &              & 162 &=& current out of limits \\
  \hline
  \     [2]   &\multicolumn{4}{l|}{raw adc value of magnet current} \\
  \hline
\end{tabular}
\vspace{1cm}  \\
\begin{tabular}[h]{|r@{\hspace{2.5mm}}|@{\hspace{2.5mm}}l|rcl|}
  \hline
  hdc[0] & array length & 20 & & \\
  \hline
  \   [1] & status word & -1 &=& OK \\
          &             &  1 &=& no entry in 1st TDC channel \\
          &             &  2 &=& no entry in 2nd TDC channel \\
          &             &  3 &=& no entry in both TDC channels \\
          &             &  4 &=& no q from ADC1  \\
          &             &  5 &=& no q from ADC2  \\
          &             &  6 &=& no q from Hytech-ADC \\
          &             &  8 &=& crate not there \\
  \hline
  \  [2]  &\multicolumn{4}{l|}{potential voltage}  \\
  \  [3]  &\multicolumn{4}{l|}{'Gitter' voltage}  \\
  \  [4]  &\multicolumn{4}{l|}{drift voltage}   \\
  \  [5]  &\multicolumn{4}{l|}{temperature 1 (gas in)}  \\
  \  [6]  &\multicolumn{4}{l|}{temperature 2 (gas out)} \\
  \  [7]  &\multicolumn{4}{l|}{temperature 3 (chamber shell)}  \\
  \  [8]  &\multicolumn{4}{l|}{pressure}  \\
  \  [9]  &\multicolumn{4}{l|}{amplitude of ADC1} \\
  \  [10] &\multicolumn{4}{l|}{amplitude of ADC2} \\
  \  [11] &\multicolumn{4}{l|}{first drifttime}  \\
\ [12] &\multicolumn{4}{l|}{$\sigma$ of first drifttime ($\sigma_1$)} \\
  \  [13] &\multicolumn{4}{l|}{second drifttime} \\
\ [14] &\multicolumn{4}{l|}{$\sigma$ of second drifttime ($\sigma_2$)} \\
  \  [15] &\multicolumn{4}{l|}{second - first drifttime} \\
  \  [16] &\multicolumn{4}{l|}{$\sigma_2 - \sigma_1$}\\
  \hline
\end{tabular}
\vspace{1cm}  \\
\begin{tabular}[h]{|r@{\hspace{2.5mm}}|@{\hspace{2.5mm}}l|rcl|}
  \hline
  hut[0] & array length & 50 & & \\
  \hline
  \  [1] & status word  & -1 &=& OK \\
         &              & 181 &=& one ore more crates off  \\
  \hline
 \ [2] & crate \#1-16 &\multicolumn{3}{l|}{bit pattern, bit set = OK} \\
 \ [3] & crate \#17-32 &\multicolumn{3}{l|}{bit pattern, bit set = OK}\\
  \hline
\end{tabular}
\end{document}

