\hypertarget{ASC_8c}{
\section{ASC.c File Reference}
\label{ASC_8c}\index{ASC.c@{ASC.c}}
}
ACD Software Rate Counters, implementation file.  


{\tt \#include $<$string.h$>$}\par
{\tt \#include \char`\"{}PBS/FFS.ih\char`\"{}}\par
{\tt \#include \char`\"{}PBI/Endianness.h\char`\"{}}\par
{\tt \#include \char`\"{}ASC/ASC.h\char`\"{}}\par
\subsection*{Classes}
\begin{CompactItemize}
\item 
struct \hyperlink{struct__LCB__header}{\_\-LCB\_\-header}
\begin{CompactList}\small\item\em Layouts out the header for an LCB packet. The header is represented in terms of 32-bit quantities to avoid BIG/ LITTLE endian problems. \item\end{CompactList}\item 
struct \hyperlink{struct__EBF__gemAcd}{\_\-EBF\_\-gemAcd}
\begin{CompactList}\small\item\em Lays out the format of the ACD data block from the event builder. \item\end{CompactList}\item 
struct \hyperlink{struct__EBF__gem}{\_\-EBF\_\-gem}
\begin{CompactList}\small\item\em Lays out the format of the GEM data block from the event builder. This does not include the LCB header. \item\end{CompactList}\item 
struct \hyperlink{struct__EBF__aem}{\_\-EBF\_\-aem}
\begin{CompactList}\small\item\em Lays out the format of the ACD data block from the event builder. This does not include the LCB header. \item\end{CompactList}\item 
struct \hyperlink{struct__ASC__acd}{\_\-ASC\_\-acd}
\begin{CompactList}\small\item\em Holds the unpacked ACD information. \item\end{CompactList}\item 
struct \hyperlink{struct__ACD__remapBrd}{\_\-ACD\_\-remapBrd}
\begin{CompactList}\small\item\em Structure defining the remapping the ACD data on a single board from electronics space into the standard 4 geographically oriented lists. \item\end{CompactList}\item 
struct \hyperlink{struct__ACD__remap}{\_\-ACD\_\-remap}
\begin{CompactList}\small\item\em Defines the information necessary to remap all ACD information laid out in electronics space to a geographical space. \item\end{CompactList}\end{CompactItemize}
\subsection*{Defines}
\begin{CompactItemize}
\item 
\hypertarget{ASC_8c_9c5678a676a047033954547687084a1a}{
\#define \hyperlink{ASC_8c_9c5678a676a047033954547687084a1a}{EBF\_\-K\_\-CID\_\-GEM}~16}
\label{ASC_8c_9c5678a676a047033954547687084a1a}

\begin{CompactList}\small\item\em The id of the GEM contribution. \item\end{CompactList}\item 
\hypertarget{ASC_8c_9d7a46f5dfb524e0ca52da2d7b0b8477}{
\#define \hyperlink{ASC_8c_9d7a46f5dfb524e0ca52da2d7b0b8477}{EBF\_\-K\_\-CID\_\-ACD}~17}
\label{ASC_8c_9d7a46f5dfb524e0ca52da2d7b0b8477}

\begin{CompactList}\small\item\em The id of the ACD contribution. \item\end{CompactList}\item 
\hypertarget{ASC_8c_134212c9681344312794fd2746c9e249}{
\#define \hyperlink{ASC_8c_134212c9681344312794fd2746c9e249}{LCB\_\-M\_\-PACKET\_\-ALIGN}~0xf}
\label{ASC_8c_134212c9681344312794fd2746c9e249}

\begin{CompactList}\small\item\em The size of a contributor must be an even multiple of this number. Currently an LCB packet is 128 bits or 16 bytes. This means that the low nibble of each length contributor's field must be zero. \item\end{CompactList}\item 
\#define \hyperlink{ASC_8c_64c8951bd1ca3490c0a9db7c83037941}{LCB\_\-EXTRACT\_\-CID}(hdr\_\-clen)~(((hdr\_\-clen) $>$$>$ 17) \& 0x1f)
\begin{CompactList}\small\item\em Extracts the contributor id from the first word of the LCB header. \item\end{CompactList}\item 
\#define \hyperlink{ASC_8c_13a4eb24deb463c76b4e322df3f061eb}{LCB\_\-EXTRACT\_\-CLEN}(hdr\_\-clen)~((hdr\_\-clen) \& 0xffff)
\begin{CompactList}\small\item\em Extracts the contributor length (in bytes) from the first word of the LCB header. \item\end{CompactList}\item 
\#define \hyperlink{ASC_8c_e4aaddbffbdff7c519c660b4f57ff86c}{\_\-ADVANCE}(\_\-ptr, \_\-nbytes)~(void $\ast$)((unsigned char $\ast$)(\_\-ptr) + (\_\-nbytes))
\begin{CompactList}\small\item\em Advances {\em \_\-ptr\/} by {\em \_\-nbytes\/}. The return value is always recast to the type of {\em \_\-ptr\/}. \item\end{CompactList}\item 
\#define \hyperlink{ASC_8c_8346bdc96fd6a040f98ed7cac33a340f}{\_\-SKIP\_\-EHDR}(\_\-ptr)~(void $\ast$)((unsigned char $\ast$)(\_\-ptr)+sizeof(\hyperlink{struct__LCB__header}{LCB\_\-header}))
\begin{CompactList}\small\item\em Skips over the event header (LATp header + summary word) recast to the type of {\em \_\-ptr\/}. \item\end{CompactList}\item 
\hypertarget{ASC_8c_91742c6338c9b8ef2ee87ea392a3073b}{
\#define \hyperlink{ASC_8c_91742c6338c9b8ef2ee87ea392a3073b}{EBF\_\-K\_\-ACD\_\-NBRDS}~12}
\label{ASC_8c_91742c6338c9b8ef2ee87ea392a3073b}

\begin{CompactList}\small\item\em Number of ACD front end boards. \item\end{CompactList}\item 
\hypertarget{ASC_8c_44ab8e070880e38853840c8f83760f6a}{
\#define \hyperlink{ASC_8c_44ab8e070880e38853840c8f83760f6a}{EBF\_\-K\_\-ACD\_\-NCHNS\_\-PER\_\-BRD}~18}
\label{ASC_8c_44ab8e070880e38853840c8f83760f6a}

\begin{CompactList}\small\item\em Number of ACD front end channels serviced by one board. \item\end{CompactList}\item 
\hypertarget{ASC_8c_6e42c16aaa0d4dcb2eb62bdd855d668c}{
\#define \hyperlink{ASC_8c_6e42c16aaa0d4dcb2eb62bdd855d668c}{EBF\_\-K\_\-ACD\_\-VETOES\_\-CNT}~7}
\label{ASC_8c_6e42c16aaa0d4dcb2eb62bdd855d668c}

\begin{CompactList}\small\item\em The number of words in the ACD veto hit map array. \item\end{CompactList}\item 
\#define \hyperlink{ASC_8c_3cc1fb87b5d367923f678a4e6a8e9dfe}{EBF\_\-K\_\-ACD\_\-ACCEPTS\_\-CNT}~9
\begin{CompactList}\small\item\em The number of words in the ACD accept map array. \item\end{CompactList}\end{CompactItemize}
\subsection*{Typedefs}
\begin{CompactItemize}
\item 
\hypertarget{ASC_8c_bb73f092af90525e56fa768b0f62a31b}{
typedef struct \hyperlink{struct__LCB__header}{\_\-LCB\_\-header} \hyperlink{ASC_8c_bb73f092af90525e56fa768b0f62a31b}{LCB\_\-header}}
\label{ASC_8c_bb73f092af90525e56fa768b0f62a31b}

\begin{CompactList}\small\item\em Typedef for {\em struct\/} \hyperlink{struct__LCB__header}{\_\-LCB\_\-header}. \item\end{CompactList}\item 
typedef enum \hyperlink{ASC_8c_de3a99668f483187778a43ee062f0fa1}{\_\-EBF\_\-K\_\-gem\_\-acd\_\-veto} \hyperlink{ASC_8c_ad4fb06039d0d3564dfcb57bf7c4ff19}{EBF\_\-K\_\-gem\_\-acd\_\-veto}
\begin{CompactList}\small\item\em Typedef for enum {\bf \_\-EBF\_\-K\_\-gem\_\-acd\_\-veto}. \item\end{CompactList}\item 
\hypertarget{ASC_8c_d8dee5726b933ac8c59ade06eced1ac9}{
typedef struct \hyperlink{struct__EBF__gemAcd}{\_\-EBF\_\-gemAcd} \hyperlink{ASC_8c_d8dee5726b933ac8c59ade06eced1ac9}{EBF\_\-gemAcd}}
\label{ASC_8c_d8dee5726b933ac8c59ade06eced1ac9}

\begin{CompactList}\small\item\em Typedef for struct \hyperlink{struct__EBF__gemAcd}{\_\-EBF\_\-gemAcd}. \item\end{CompactList}\item 
\hypertarget{ASC_8c_454299cc6fbbfda2b7f105962a9a6381}{
typedef struct \hyperlink{struct__EBF__gem}{\_\-EBF\_\-gem} \hyperlink{ASC_8c_454299cc6fbbfda2b7f105962a9a6381}{EBF\_\-gem}}
\label{ASC_8c_454299cc6fbbfda2b7f105962a9a6381}

\begin{CompactList}\small\item\em Typedef for struct \hyperlink{struct__EBF__gem}{\_\-EBF\_\-gem}. \item\end{CompactList}\item 
typedef enum \hyperlink{ASC_8c_eeee2881b3f1772cefc97c5d695355e6}{\_\-EBF\_\-K\_\-acd\_\-list} \hyperlink{ASC_8c_cab859a87db452999e1bacbe38fa17be}{EBF\_\-K\_\-acd\_\-list}
\begin{CompactList}\small\item\em Typedef for enum {\bf \_\-EBF\_\-K\_\-acd\_\-list}. \item\end{CompactList}\item 
typedef enum \hyperlink{ASC_8c_89b442dc8cface4cab979faa1f83b8aa}{\_\-EBF\_\-K\_\-acd\_\-side} \hyperlink{ASC_8c_60a1c9c851501fc9f02a7f0d9eacdf4b}{EBF\_\-K\_\-acd\_\-side}
\begin{CompactList}\small\item\em Typedef for enum {\bf \_\-EBF\_\-K\_\-acd\_\-side}. \item\end{CompactList}\item 
\hypertarget{ASC_8c_8ae0e0a688f36c1aeb63289e5626cf72}{
typedef struct \hyperlink{struct__EBF__aem}{\_\-EBF\_\-aem} \hyperlink{ASC_8c_8ae0e0a688f36c1aeb63289e5626cf72}{EBF\_\-aem}}
\label{ASC_8c_8ae0e0a688f36c1aeb63289e5626cf72}

\begin{CompactList}\small\item\em Typedef for struct \hyperlink{struct__EBF__aem}{\_\-EBF\_\-aem}. \item\end{CompactList}\item 
\hypertarget{ASC_8c_3f9c6edd09b5d17151839ab882297543}{
typedef struct \hyperlink{struct__ASC__acd}{\_\-ASC\_\-acd} \hyperlink{ASC_8c_3f9c6edd09b5d17151839ab882297543}{ASC\_\-acd}}
\label{ASC_8c_3f9c6edd09b5d17151839ab882297543}

\begin{CompactList}\small\item\em typedef for struct {\em \hyperlink{struct__ASC__acd}{\_\-ASC\_\-acd}\/} \item\end{CompactList}\item 
typedef struct \hyperlink{struct__ACD__remapBrd}{\_\-ACD\_\-remapBrd} \hyperlink{ASC_8c_aa5f4f5e86791a7ce44583bb5543b363}{ACD\_\-remapBrd}
\begin{CompactList}\small\item\em Typedef for struct {\em \hyperlink{struct__ACD__remapBrd}{\_\-ACD\_\-remapBrd}\/}. \item\end{CompactList}\item 
typedef struct \hyperlink{struct__ACD__remap}{\_\-ACD\_\-remap} \hyperlink{ASC_8c_d0483bc39a65b706cfae2dd5c0c276fc}{ACD\_\-remap}
\begin{CompactList}\small\item\em Typedef for struct \hyperlink{struct__ACD__remap}{\_\-ACD\_\-remap}. \item\end{CompactList}\end{CompactItemize}
\subsection*{Enumerations}
\begin{CompactItemize}
\item 
enum \hyperlink{ASC_8c_de3a99668f483187778a43ee062f0fa1}{\_\-EBF\_\-K\_\-gem\_\-acd\_\-veto} \{ \par
\textbf{EBF\_\-K\_\-GEM\_\-ACD\_\-VETO\_\-XZ} =  0, 
\par
\textbf{EBF\_\-K\_\-GEM\_\-ACD\_\-VETO\_\-YZ} =  1, 
\par
\textbf{EBF\_\-K\_\-GEM\_\-ACD\_\-VETO\_\-XY} =  2, 
\par
\textbf{EBF\_\-K\_\-GEM\_\-ACD\_\-VETO\_\-RU} =  3, 
\par
\textbf{EBF\_\-K\_\-GEM\_\-ACD\_\-VETO\_\-CNT} =  4
 \}
\begin{CompactList}\small\item\em Enumerates the elements of the GEM's ACD veto block. \item\end{CompactList}\item 
enum \hyperlink{ASC_8c_eeee2881b3f1772cefc97c5d695355e6}{\_\-EBF\_\-K\_\-acd\_\-list} \{ \par
\hyperlink{ASC_8c_eeee2881b3f1772cefc97c5d695355e622174a3894ef300ed53475f668fe84a2}{EBF\_\-K\_\-ACD\_\-LIST\_\-XZ} =  0, 
\par
\hyperlink{ASC_8c_eeee2881b3f1772cefc97c5d695355e640e66550e039d0ba85bf33e3708f511a}{EBF\_\-K\_\-ACD\_\-LIST\_\-YZ} =  1, 
\par
\hyperlink{ASC_8c_eeee2881b3f1772cefc97c5d695355e67db5bcf9e1353b16d7b5b5cf91f7cbe3}{EBF\_\-K\_\-ACD\_\-LIST\_\-XY} =  2, 
\par
\hyperlink{ASC_8c_eeee2881b3f1772cefc97c5d695355e6c4dbaa14889b9f29fdecf3f009b38000}{EBF\_\-K\_\-ACD\_\-LIST\_\-RU} =  3, 
\par
\hyperlink{ASC_8c_eeee2881b3f1772cefc97c5d695355e6350c5e262b42dccfb6400e7478547955}{EBF\_\-K\_\-ACD\_\-LIST\_\-CNT} =  4
 \}
\begin{CompactList}\small\item\em Enumerates the bit lists. \item\end{CompactList}\item 
enum \hyperlink{ASC_8c_89b442dc8cface4cab979faa1f83b8aa}{\_\-EBF\_\-K\_\-acd\_\-side} \{ \par
\hyperlink{ASC_8c_89b442dc8cface4cab979faa1f83b8aa1e0295ecc6f175674e5f754d6902d9a6}{EBF\_\-K\_\-ACD\_\-SIDE\_\-A} =  0, 
\par
\hyperlink{ASC_8c_89b442dc8cface4cab979faa1f83b8aa57dab7575eb53565c00b039c6cbace63}{EBF\_\-K\_\-ACD\_\-SIDE\_\-B} =  1, 
\par
\hyperlink{ASC_8c_89b442dc8cface4cab979faa1f83b8aaf63f4d2202dc5c803e5f3748d96cda23}{EBF\_\-K\_\-ACD\_\-SIDE\_\-CNT} =  2
 \}
\begin{CompactList}\small\item\em Enumerates the side A and side B values. \item\end{CompactList}\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
static void \hyperlink{ASC_8c_70c5d6d3cc969dbd6cbca5b9a6921c8f}{clear} (void $\ast$ptr, int nbytes)
\begin{CompactList}\small\item\em Zeroes the specified memory. \item\end{CompactList}\item 
static void \hyperlink{ASC_8c_b8576eb88b03e83104fb360f1cd74434}{accumulate\_\-cno} (\hyperlink{struct__ASC__cno}{ASC\_\-cno} $\ast$cno, unsigned int cnoReqVec)
\begin{CompactList}\small\item\em Accumulates the number of CNO triggers from each FREE board. \item\end{CompactList}\item 
static void \hyperlink{ASC_8c_d7b6c82c10484c19e1ed5874a0ae5a34}{accumulate} (\hyperlink{struct__ASC__list}{ASC\_\-list} $\ast$list, unsigned int v, unsigned int hb, unsigned int ha, unsigned int pb, unsigned int pa)
\begin{CompactList}\small\item\em Accumulates the statistics for list (32-bits) of ACD hits. \item\end{CompactList}\item 
static int \hyperlink{ASC_8c_39e3941ba11d732be312b45af60b1f3f}{unpack} (struct \hyperlink{struct__ASC__acd}{\_\-ASC\_\-acd} $\ast$acd, const unsigned short int $\ast$data)
\begin{CompactList}\small\item\em Unpacks an ACD record from the AEM into a standard structure. \item\end{CompactList}\item 
static \_\-\_\-inline unsigned int \hyperlink{ASC_8c_a474b9f67d25dbddbb0d8bca540e38d9}{prepare} (unsigned int w)
\begin{CompactList}\small\item\em Prepares the initial word of being used in the formation of the pattern word. \item\end{CompactList}\item 
static \_\-\_\-inline const \hyperlink{struct__EBF__aem}{EBF\_\-aem} $\ast$ \hyperlink{ASC_8c_3bb2bb9daa99d613081b4c54a413c58c}{locate\_\-aem} (const unsigned int $\ast$evt, int elen)
\begin{CompactList}\small\item\em Composes the directory of the contributors. \item\end{CompactList}\item 
static \_\-\_\-inline unsigned int \hyperlink{ASC_8c_35e96a1d5b306867d508958628da79b3}{form} (unsigned int v, unsigned int hb, unsigned int ha, unsigned int pb, unsigned int pa, int left)
\begin{CompactList}\small\item\em Forms the 5 bit pattern word from the bits in column {\em left\/} {\bf and} appropriately shifts the pattern word so that it may be used directly as a byte offset into the correct statistics counters. \item\end{CompactList}\item 
void \hyperlink{ASC_8c_00dbf448ad6f0a2d9190b905888a3ee4}{ASC\_\-clear} (\hyperlink{struct__ASC__counters}{ASC\_\-counters} $\ast$counters)
\begin{CompactList}\small\item\em Clears the specified statistics counters. \item\end{CompactList}\item 
void \hyperlink{ASC_8c_7ab9d52e5ef1cf58d82d0b4fbbc70a56}{ASC\_\-accumulateU} (\hyperlink{struct__ASC__counters}{ASC\_\-counters} $\ast$counters, const struct \hyperlink{struct__EBF__gem}{\_\-EBF\_\-gem} $\ast$gem, const struct \hyperlink{struct__ASC__acd}{\_\-ASC\_\-acd} $\ast$acd)
\begin{CompactList}\small\item\em Accumulates the proper pattern words for each ACD hit. \item\end{CompactList}\item 
const \_\-\_\-inline struct \hyperlink{struct__EBF__gem}{\_\-EBF\_\-gem} $\ast$ \hyperlink{ASC_8c_2c2800c37677e68784010eaff384987a}{ASC\_\-gem\_\-locate} (const unsigned int $\ast$edata, int esize)
\begin{CompactList}\small\item\em Locates GEM contribution in an event. \item\end{CompactList}\item 
const \_\-\_\-inline struct \hyperlink{struct__EBF__aem}{\_\-EBF\_\-aem} $\ast$ \hyperlink{ASC_8c_120ba68e065b83a23b0bb2dbe6669935}{ASC\_\-aem\_\-locate} (const unsigned int $\ast$edata, int esize)
\begin{CompactList}\small\item\em Locates ACD contribution in an event. \item\end{CompactList}\item 
int \hyperlink{ASC_8c_da3b8fed561a320ef8aea3d56236f923}{ASC\_\-accumulate} (\hyperlink{struct__ASC__counters}{ASC\_\-counters} $\ast$counters, const unsigned int $\ast$edata, int esize)
\begin{CompactList}\small\item\em Accumulate the counters for the specified event. \item\end{CompactList}\item 
int \hyperlink{ASC_8c_6872723d8683ad7b36efb3582839a14b}{ASC\_\-acd\_\-sizeof} (void)
\begin{CompactList}\small\item\em Returns the size, in bytes, of the data structure needed to hold an unpacked ACD event. \item\end{CompactList}\item 
int \hyperlink{ASC_8c_830c1d4f6df149afdc1d72b443f4c442}{ASC\_\-acd\_\-unpack} (struct \hyperlink{struct__ASC__acd}{\_\-ASC\_\-acd} $\ast$acd, const struct \hyperlink{struct__EBF__aem}{\_\-EBF\_\-aem} $\ast$aem)
\begin{CompactList}\small\item\em Unpacks an ACD record from the AEM into a standard structure. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
ACD Software Rate Counters, implementation file. 

\begin{Desc}
\item[Author:]JJRussell - \href{mailto:russell@slac.stanford.edu}{\tt russell@slac.stanford.edu}\end{Desc}


\footnotesize\begin{verbatim}

    CVS $Id: ASC.c,v 1.1.1.1 2005/12/01 21:55:31 ebacho Exp $
\end{verbatim}
\normalsize


\begin{Desc}
\item[SYNOPSIS]Defines the the implementation for accumulating the ACD software rate counters \end{Desc}


\subsection{Define Documentation}
\hypertarget{ASC_8c_e4aaddbffbdff7c519c660b4f57ff86c}{
\index{ASC.c@{ASC.c}!\_\-ADVANCE@{\_\-ADVANCE}}
\index{\_\-ADVANCE@{\_\-ADVANCE}!ASC.c@{ASC.c}}
\subsubsection[{\_\-ADVANCE}]{\setlength{\rightskip}{0pt plus 5cm}\#define \_\-ADVANCE(\_\-ptr, \/  \_\-nbytes)~(void $\ast$)((unsigned char $\ast$)(\_\-ptr) + (\_\-nbytes))}}
\label{ASC_8c_e4aaddbffbdff7c519c660b4f57ff86c}


Advances {\em \_\-ptr\/} by {\em \_\-nbytes\/}. The return value is always recast to the type of {\em \_\-ptr\/}. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-ptr}]The pointer to advance \item[{\em \_\-nbytes}]The number of nbytes to advance {\em \_\-ptr\/} by. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The advanced pointer, the pointer is recast to a void $\ast$. \end{Desc}


Referenced by locate\_\-aem().\hypertarget{ASC_8c_8346bdc96fd6a040f98ed7cac33a340f}{
\index{ASC.c@{ASC.c}!\_\-SKIP\_\-EHDR@{\_\-SKIP\_\-EHDR}}
\index{\_\-SKIP\_\-EHDR@{\_\-SKIP\_\-EHDR}!ASC.c@{ASC.c}}
\subsubsection[{\_\-SKIP\_\-EHDR}]{\setlength{\rightskip}{0pt plus 5cm}\#define \_\-SKIP\_\-EHDR(\_\-ptr)~(void $\ast$)((unsigned char $\ast$)(\_\-ptr)+sizeof({\bf LCB\_\-header}))}}
\label{ASC_8c_8346bdc96fd6a040f98ed7cac33a340f}


Skips over the event header (LATp header + summary word) recast to the type of {\em \_\-ptr\/}. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-ptr}]The pointer to advance \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The advanced pointer, the pointer is recast to a void $\ast$. \end{Desc}


Referenced by ASC\_\-gem\_\-locate().\hypertarget{ASC_8c_3cc1fb87b5d367923f678a4e6a8e9dfe}{
\index{ASC.c@{ASC.c}!EBF\_\-K\_\-ACD\_\-ACCEPTS\_\-CNT@{EBF\_\-K\_\-ACD\_\-ACCEPTS\_\-CNT}}
\index{EBF\_\-K\_\-ACD\_\-ACCEPTS\_\-CNT@{EBF\_\-K\_\-ACD\_\-ACCEPTS\_\-CNT}!ASC.c@{ASC.c}}
\subsubsection[{EBF\_\-K\_\-ACD\_\-ACCEPTS\_\-CNT}]{\setlength{\rightskip}{0pt plus 5cm}\#define EBF\_\-K\_\-ACD\_\-ACCEPTS\_\-CNT~9}}
\label{ASC_8c_3cc1fb87b5d367923f678a4e6a8e9dfe}


The number of words in the ACD accept map array. 

The ACD data structure consists of the standard header word followed by 3 major blocks. The first two blocks, the {\em veto hit map\/} and the {\em accept block\/} are fixed length. The final block is a variable length block containing the ADC pulse values. The number of ADC values is determined by the count field in the {\em accept\/} block.

Header Word Event sequence number and contributor id Veto Hit Map One 18 bit vector for each of the 12 ACD FREE boards Accept Block One 24 bit vector for each of the 12 ACD FREE boards ACD ADCs The ACD ADC pulse values, variable length.

{\bf Veto Hit Map}\par
 The Veto Hit Map is packed densely into 7 32 bit words. There is one unused byte at the end. Picturally this block looks like



\footnotesize\begin{verbatim}
        11111111 11111111
        fedcba98 76543210 fedcba98 76543210                 
       +--------+--------+--------+--------+
     0 |11111111 11111100 00000000 00000000| 
     1 |33333333 33222222 22222222 22221111| 
     2 |55555544 44444444 44444444 333333331
     3 |77666666 66666666 66665555 55555555|
     4 |88888888 88888888 77777777 77777777|
     5 |AAAAAAAA AAAA9999 99999999 99999988|
     6 |-------- BBBBBBBB BBBBBBBB BBAAAAAA|
       +--------+--------+--------+--------+
  \end{verbatim}
\normalsize


Where the numbers represent the 12 ADC FREE boards. (Note that each string of numbers has 18 bits.

{\bf ADC Accept Block}\par
 The Accept block is a densely packed array of words 24 bits in length. Each 24 bit word is formatted as follows



\footnotesize\begin{verbatim}
        11111111
        76543210 fedcba98 76543210    
       +--------+--------+--------+   
       |aaaaaaaa aaaaaaaa aaCccccc|           
       +--------+--------+--------+
   \end{verbatim}
\normalsize


Where 

\footnotesize\begin{verbatim}
       c( 5 bits)
       Count of number of ADC accepted for this board. Because the
       number of ADCs from the ACD can be limited, this count must be
       less than or equal to the number of bits set in accept mask.

       C( 1 bit )
       The CNO bit for this board.

       a(18 bits)
       A bit map of the number of pulse heights over threshold on
       this board. If the number of bits exceeds the count (c) then
       only the first 'count' are present in the ADC array.
   \end{verbatim}
\normalsize


These 12 Accept vectors are packed densely into 9 32 bit words.



\footnotesize\begin{verbatim}
           11111111 11111111
           fedcba98 76543210 fedcba98 76543210                 
       +--------+--------+--------+--------+
     0 |11111111 00000000 00000000 00000000| 
     1 |22222222 22222222 11111111 11111111| 
     2 |33333333 33333333 33333333 222222221
     3 |55555555 44444444 44444444 44444444|
     4 |66666666 66666666 55555555 55555555|
     5 |77777777 77777777 77777777 66666666|
     6 |99999999 88888888 88888888 88888888|
     7 |aaaaaaaa aaaaaaaa 99999999 99999999|
     8 |bbbbbbbb bbbbbbbb bbbbbbbb aaaaaaaa|
       +--------+--------+--------+--------+
   \end{verbatim}
\normalsize


Again the numbers represent the accept words for each of the 12 ACD FREE boards.

{\bf ACD ADC Pulse Heights}\par
 Each ACD ADC pulse height is 16 bits in length. The total number of ADC values is determined by the {\em count\/} field in the accept word. The mapping is determined by {\em accept\/} map in each accept word. Only the first {\em count\/} bits of ADC values are used. That is, if there are more bits set in the accept map, there will be only {\em count\/} number of ADC pulse heights from this board. \hypertarget{ASC_8c_64c8951bd1ca3490c0a9db7c83037941}{
\index{ASC.c@{ASC.c}!LCB\_\-EXTRACT\_\-CID@{LCB\_\-EXTRACT\_\-CID}}
\index{LCB\_\-EXTRACT\_\-CID@{LCB\_\-EXTRACT\_\-CID}!ASC.c@{ASC.c}}
\subsubsection[{LCB\_\-EXTRACT\_\-CID}]{\setlength{\rightskip}{0pt plus 5cm}\#define LCB\_\-EXTRACT\_\-CID(hdr\_\-clen)~(((hdr\_\-clen) $>$$>$ 17) \& 0x1f)}}
\label{ASC_8c_64c8951bd1ca3490c0a9db7c83037941}


Extracts the contributor id from the first word of the LCB header. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em hdr\_\-clen}]The first word of the LCB header \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The contributor id \end{Desc}


Referenced by ASC\_\-gem\_\-locate(), and locate\_\-aem().\hypertarget{ASC_8c_13a4eb24deb463c76b4e322df3f061eb}{
\index{ASC.c@{ASC.c}!LCB\_\-EXTRACT\_\-CLEN@{LCB\_\-EXTRACT\_\-CLEN}}
\index{LCB\_\-EXTRACT\_\-CLEN@{LCB\_\-EXTRACT\_\-CLEN}!ASC.c@{ASC.c}}
\subsubsection[{LCB\_\-EXTRACT\_\-CLEN}]{\setlength{\rightskip}{0pt plus 5cm}\#define LCB\_\-EXTRACT\_\-CLEN(hdr\_\-clen)~((hdr\_\-clen) \& 0xffff)}}
\label{ASC_8c_13a4eb24deb463c76b4e322df3f061eb}


Extracts the contributor length (in bytes) from the first word of the LCB header. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em hdr\_\-clen}]The first word of the LCB header \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The contributor's length (in bytes) \end{Desc}


Referenced by locate\_\-aem().

\subsection{Typedef Documentation}
\hypertarget{ASC_8c_d0483bc39a65b706cfae2dd5c0c276fc}{
\index{ASC.c@{ASC.c}!ACD\_\-remap@{ACD\_\-remap}}
\index{ACD\_\-remap@{ACD\_\-remap}!ASC.c@{ASC.c}}
\subsubsection[{ACD\_\-remap}]{\setlength{\rightskip}{0pt plus 5cm}{\bf ACD\_\-remap}}}
\label{ASC_8c_d0483bc39a65b706cfae2dd5c0c276fc}


Typedef for struct \hyperlink{struct__ACD__remap}{\_\-ACD\_\-remap}. 

This is basically just an array of the remap structures {\em AFF\_\-remapBrd\/} for each of the 12 FREE boards. \hypertarget{ASC_8c_aa5f4f5e86791a7ce44583bb5543b363}{
\index{ASC.c@{ASC.c}!ACD\_\-remapBrd@{ACD\_\-remapBrd}}
\index{ACD\_\-remapBrd@{ACD\_\-remapBrd}!ASC.c@{ASC.c}}
\subsubsection[{ACD\_\-remapBrd}]{\setlength{\rightskip}{0pt plus 5cm}{\bf ACD\_\-remapBrd}}}
\label{ASC_8c_aa5f4f5e86791a7ce44583bb5543b363}


Typedef for struct {\em \hyperlink{struct__ACD__remapBrd}{\_\-ACD\_\-remapBrd}\/}. 

This is a fairly complicated structure whose layout is driven by the code. These arrays define the mapping from electronics space, {\em i.e\/}. channels on a particular FREE boards, to geometric space, {\em i.e\/}. tiles on the 5 faces, top (XY) and the 4 side planes (XZ-,XZ+,YZ-,YZ+). There are 3 remapping arrays.

The first array is a series of masks, one for each of the geometrically oriented lists. For a given list of 18 channels on a FREE board, each mask projects out only those channels of the corresponding geometrical list.

The next array is indexed by electronics channel and yields the corresponding channel within the context of its geographical list. This array may contain the same geometrical channel more than once, but, by virtue of using the first array to project out only those channels belonging to a particular geometrical list, the duplicate channels will never direct more than one electronics channel to a single geometrical channel. In fact, the first mask is just a bit list of the channels in this array belonging to a single geometrical list.

The final array remaps a PHA value in electronics space into an array indexed by geometrical index. This array is differs from the previous array only by having the geometrical list index as part of the output index. That is, the output index is in a flat space from 0 to the number of actual tiles/ribbons. The other two arrays are merely rearrangements of the information in this array. \hypertarget{ASC_8c_cab859a87db452999e1bacbe38fa17be}{
\index{ASC.c@{ASC.c}!EBF\_\-K\_\-acd\_\-list@{EBF\_\-K\_\-acd\_\-list}}
\index{EBF\_\-K\_\-acd\_\-list@{EBF\_\-K\_\-acd\_\-list}!ASC.c@{ASC.c}}
\subsubsection[{EBF\_\-K\_\-acd\_\-list}]{\setlength{\rightskip}{0pt plus 5cm}{\bf EBF\_\-K\_\-acd\_\-list}}}
\label{ASC_8c_cab859a87db452999e1bacbe38fa17be}


Typedef for enum {\bf \_\-EBF\_\-K\_\-acd\_\-list}. 

These definitions should be used to access the elements of the ACD hit and accept lists by name. \hypertarget{ASC_8c_60a1c9c851501fc9f02a7f0d9eacdf4b}{
\index{ASC.c@{ASC.c}!EBF\_\-K\_\-acd\_\-side@{EBF\_\-K\_\-acd\_\-side}}
\index{EBF\_\-K\_\-acd\_\-side@{EBF\_\-K\_\-acd\_\-side}!ASC.c@{ASC.c}}
\subsubsection[{EBF\_\-K\_\-acd\_\-side}]{\setlength{\rightskip}{0pt plus 5cm}{\bf EBF\_\-K\_\-acd\_\-side}}}
\label{ASC_8c_60a1c9c851501fc9f02a7f0d9eacdf4b}


Typedef for enum {\bf \_\-EBF\_\-K\_\-acd\_\-side}. 

These definitions should be used to access the elements of the ACD hit and accept sides by name. \hypertarget{ASC_8c_ad4fb06039d0d3564dfcb57bf7c4ff19}{
\index{ASC.c@{ASC.c}!EBF\_\-K\_\-gem\_\-acd\_\-veto@{EBF\_\-K\_\-gem\_\-acd\_\-veto}}
\index{EBF\_\-K\_\-gem\_\-acd\_\-veto@{EBF\_\-K\_\-gem\_\-acd\_\-veto}!ASC.c@{ASC.c}}
\subsubsection[{EBF\_\-K\_\-gem\_\-acd\_\-veto}]{\setlength{\rightskip}{0pt plus 5cm}{\bf EBF\_\-K\_\-gem\_\-acd\_\-veto}}}
\label{ASC_8c_ad4fb06039d0d3564dfcb57bf7c4ff19}


Typedef for enum {\bf \_\-EBF\_\-K\_\-gem\_\-acd\_\-veto}. 

These definitions should be used to access the elements of the ACD veto block by name. 

\subsection{Enumeration Type Documentation}
\hypertarget{ASC_8c_eeee2881b3f1772cefc97c5d695355e6}{
\index{ASC.c@{ASC.c}!\_\-EBF\_\-K\_\-acd\_\-list@{\_\-EBF\_\-K\_\-acd\_\-list}}
\index{\_\-EBF\_\-K\_\-acd\_\-list@{\_\-EBF\_\-K\_\-acd\_\-list}!ASC.c@{ASC.c}}
\subsubsection[{\_\-EBF\_\-K\_\-acd\_\-list}]{\setlength{\rightskip}{0pt plus 5cm}enum {\bf \_\-EBF\_\-K\_\-acd\_\-list}}}
\label{ASC_8c_eeee2881b3f1772cefc97c5d695355e6}


Enumerates the bit lists. 

\begin{Desc}
\item[Enumerator: ]\par
\begin{description}
\index{EBF\_\-K\_\-ACD\_\-LIST\_\-XZ@{EBF\_\-K\_\-ACD\_\-LIST\_\-XZ}!ASC.c@{ASC.c}}\index{ASC.c@{ASC.c}!EBF\_\-K\_\-ACD\_\-LIST\_\-XZ@{EBF\_\-K\_\-ACD\_\-LIST\_\-XZ}}\item[{\em 
\hypertarget{ASC_8c_eeee2881b3f1772cefc97c5d695355e622174a3894ef300ed53475f668fe84a2}{
EBF\_\-K\_\-ACD\_\-LIST\_\-XZ}
\label{ASC_8c_eeee2881b3f1772cefc97c5d695355e622174a3894ef300ed53475f668fe84a2}
}]Bit mask of tiles in the XZ plane \index{EBF\_\-K\_\-ACD\_\-LIST\_\-YZ@{EBF\_\-K\_\-ACD\_\-LIST\_\-YZ}!ASC.c@{ASC.c}}\index{ASC.c@{ASC.c}!EBF\_\-K\_\-ACD\_\-LIST\_\-YZ@{EBF\_\-K\_\-ACD\_\-LIST\_\-YZ}}\item[{\em 
\hypertarget{ASC_8c_eeee2881b3f1772cefc97c5d695355e640e66550e039d0ba85bf33e3708f511a}{
EBF\_\-K\_\-ACD\_\-LIST\_\-YZ}
\label{ASC_8c_eeee2881b3f1772cefc97c5d695355e640e66550e039d0ba85bf33e3708f511a}
}]Bit mask of tiles in the YZ plane \index{EBF\_\-K\_\-ACD\_\-LIST\_\-XY@{EBF\_\-K\_\-ACD\_\-LIST\_\-XY}!ASC.c@{ASC.c}}\index{ASC.c@{ASC.c}!EBF\_\-K\_\-ACD\_\-LIST\_\-XY@{EBF\_\-K\_\-ACD\_\-LIST\_\-XY}}\item[{\em 
\hypertarget{ASC_8c_eeee2881b3f1772cefc97c5d695355e67db5bcf9e1353b16d7b5b5cf91f7cbe3}{
EBF\_\-K\_\-ACD\_\-LIST\_\-XY}
\label{ASC_8c_eeee2881b3f1772cefc97c5d695355e67db5bcf9e1353b16d7b5b5cf91f7cbe3}
}]Bit mask of tiles in the XY plane \index{EBF\_\-K\_\-ACD\_\-LIST\_\-RU@{EBF\_\-K\_\-ACD\_\-LIST\_\-RU}!ASC.c@{ASC.c}}\index{ASC.c@{ASC.c}!EBF\_\-K\_\-ACD\_\-LIST\_\-RU@{EBF\_\-K\_\-ACD\_\-LIST\_\-RU}}\item[{\em 
\hypertarget{ASC_8c_eeee2881b3f1772cefc97c5d695355e6c4dbaa14889b9f29fdecf3f009b38000}{
EBF\_\-K\_\-ACD\_\-LIST\_\-RU}
\label{ASC_8c_eeee2881b3f1772cefc97c5d695355e6c4dbaa14889b9f29fdecf3f009b38000}
}]Bit mask of ribbons and unused \index{EBF\_\-K\_\-ACD\_\-LIST\_\-CNT@{EBF\_\-K\_\-ACD\_\-LIST\_\-CNT}!ASC.c@{ASC.c}}\index{ASC.c@{ASC.c}!EBF\_\-K\_\-ACD\_\-LIST\_\-CNT@{EBF\_\-K\_\-ACD\_\-LIST\_\-CNT}}\item[{\em 
\hypertarget{ASC_8c_eeee2881b3f1772cefc97c5d695355e6350c5e262b42dccfb6400e7478547955}{
EBF\_\-K\_\-ACD\_\-LIST\_\-CNT}
\label{ASC_8c_eeee2881b3f1772cefc97c5d695355e6350c5e262b42dccfb6400e7478547955}
}]Number of bit masks \end{description}
\end{Desc}

\hypertarget{ASC_8c_89b442dc8cface4cab979faa1f83b8aa}{
\index{ASC.c@{ASC.c}!\_\-EBF\_\-K\_\-acd\_\-side@{\_\-EBF\_\-K\_\-acd\_\-side}}
\index{\_\-EBF\_\-K\_\-acd\_\-side@{\_\-EBF\_\-K\_\-acd\_\-side}!ASC.c@{ASC.c}}
\subsubsection[{\_\-EBF\_\-K\_\-acd\_\-side}]{\setlength{\rightskip}{0pt plus 5cm}enum {\bf \_\-EBF\_\-K\_\-acd\_\-side}}}
\label{ASC_8c_89b442dc8cface4cab979faa1f83b8aa}


Enumerates the side A and side B values. 

\begin{Desc}
\item[Enumerator: ]\par
\begin{description}
\index{EBF\_\-K\_\-ACD\_\-SIDE\_\-A@{EBF\_\-K\_\-ACD\_\-SIDE\_\-A}!ASC.c@{ASC.c}}\index{ASC.c@{ASC.c}!EBF\_\-K\_\-ACD\_\-SIDE\_\-A@{EBF\_\-K\_\-ACD\_\-SIDE\_\-A}}\item[{\em 
\hypertarget{ASC_8c_89b442dc8cface4cab979faa1f83b8aa1e0295ecc6f175674e5f754d6902d9a6}{
EBF\_\-K\_\-ACD\_\-SIDE\_\-A}
\label{ASC_8c_89b442dc8cface4cab979faa1f83b8aa1e0295ecc6f175674e5f754d6902d9a6}
}]The side A block \index{EBF\_\-K\_\-ACD\_\-SIDE\_\-B@{EBF\_\-K\_\-ACD\_\-SIDE\_\-B}!ASC.c@{ASC.c}}\index{ASC.c@{ASC.c}!EBF\_\-K\_\-ACD\_\-SIDE\_\-B@{EBF\_\-K\_\-ACD\_\-SIDE\_\-B}}\item[{\em 
\hypertarget{ASC_8c_89b442dc8cface4cab979faa1f83b8aa57dab7575eb53565c00b039c6cbace63}{
EBF\_\-K\_\-ACD\_\-SIDE\_\-B}
\label{ASC_8c_89b442dc8cface4cab979faa1f83b8aa57dab7575eb53565c00b039c6cbace63}
}]The side B block \index{EBF\_\-K\_\-ACD\_\-SIDE\_\-CNT@{EBF\_\-K\_\-ACD\_\-SIDE\_\-CNT}!ASC.c@{ASC.c}}\index{ASC.c@{ASC.c}!EBF\_\-K\_\-ACD\_\-SIDE\_\-CNT@{EBF\_\-K\_\-ACD\_\-SIDE\_\-CNT}}\item[{\em 
\hypertarget{ASC_8c_89b442dc8cface4cab979faa1f83b8aaf63f4d2202dc5c803e5f3748d96cda23}{
EBF\_\-K\_\-ACD\_\-SIDE\_\-CNT}
\label{ASC_8c_89b442dc8cface4cab979faa1f83b8aaf63f4d2202dc5c803e5f3748d96cda23}
}]Count of the number of sides \end{description}
\end{Desc}



\subsection{Function Documentation}
\hypertarget{ASC_8c_d7b6c82c10484c19e1ed5874a0ae5a34}{
\index{ASC.c@{ASC.c}!accumulate@{accumulate}}
\index{accumulate@{accumulate}!ASC.c@{ASC.c}}
\subsubsection[{accumulate}]{\setlength{\rightskip}{0pt plus 5cm}static void accumulate ({\bf ASC\_\-list} $\ast$ {\em list}, \/  unsigned int {\em v}, \/  unsigned int {\em hb}, \/  unsigned int {\em ha}, \/  unsigned int {\em pb}, \/  unsigned int {\em pa})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{ASC_8c_d7b6c82c10484c19e1ed5874a0ae5a34}


Accumulates the statistics for list (32-bits) of ACD hits. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em list}]Pointer to the statistics for this list of ACD hits \item[{\em v}]The GEM list of veto bits \item[{\em hb}]The ACD hit bits for side {\em b\/} \item[{\em ha}]The ACD hit bits for side {\em a\/} \item[{\em pb}]The ACD pulse height accept bits for side {\em b\/} \item[{\em pa}]The ACD pulse height accept bits for side {\em a\/} \end{description}
\end{Desc}


References \_\-ASC\_\-list::chns, form(), and prepare().

Referenced by ASC\_\-accumulateU().\hypertarget{ASC_8c_b8576eb88b03e83104fb360f1cd74434}{
\index{ASC.c@{ASC.c}!accumulate\_\-cno@{accumulate\_\-cno}}
\index{accumulate\_\-cno@{accumulate\_\-cno}!ASC.c@{ASC.c}}
\subsubsection[{accumulate\_\-cno}]{\setlength{\rightskip}{0pt plus 5cm}static void accumulate\_\-cno ({\bf ASC\_\-cno} $\ast$ {\em cno}, \/  unsigned int {\em cnoReqVec})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{ASC_8c_b8576eb88b03e83104fb360f1cd74434}


Accumulates the number of CNO triggers from each FREE board. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cno}]The CNO statistics block \item[{\em cnoReqvec}]The CNO and trigger request vector. The CNO trigger information occupies the lower 12 of the upper 16 bits. \end{description}
\end{Desc}


References \_\-ASC\_\-cno::cnts.

Referenced by ASC\_\-accumulateU().\hypertarget{ASC_8c_da3b8fed561a320ef8aea3d56236f923}{
\index{ASC.c@{ASC.c}!ASC\_\-accumulate@{ASC\_\-accumulate}}
\index{ASC\_\-accumulate@{ASC\_\-accumulate}!ASC.c@{ASC.c}}
\subsubsection[{ASC\_\-accumulate}]{\setlength{\rightskip}{0pt plus 5cm}int ASC\_\-accumulate ({\bf ASC\_\-counters} $\ast$ {\em counters}, \/  const unsigned int $\ast$ {\em edata}, \/  int {\em esize})}}
\label{ASC_8c_da3b8fed561a320ef8aea3d56236f923}


Accumulate the counters for the specified event. 

\begin{Desc}
\item[Returns:]Status indicating the event was successfully processed (0) or a non-zero number indicating the event was not successfully processed.\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em counters}]Pointer to the counters to increment \item[{\em edata}]Pointer to the event data \item[{\em esize}]The event size, in units of bytes. This is used as a consistency check in the unpacking. \end{description}
\end{Desc}


References ASC\_\-accumulateU(), ASC\_\-aem\_\-locate(), ASC\_\-gem\_\-locate(), and unpack().\hypertarget{ASC_8c_7ab9d52e5ef1cf58d82d0b4fbbc70a56}{
\index{ASC.c@{ASC.c}!ASC\_\-accumulateU@{ASC\_\-accumulateU}}
\index{ASC\_\-accumulateU@{ASC\_\-accumulateU}!ASC.c@{ASC.c}}
\subsubsection[{ASC\_\-accumulateU}]{\setlength{\rightskip}{0pt plus 5cm}void ASC\_\-accumulateU ({\bf ASC\_\-counters} $\ast$ {\em counters}, \/  const struct {\bf \_\-EBF\_\-gem} $\ast$ {\em gem}, \/  const struct {\bf \_\-ASC\_\-acd} $\ast$ {\em acd})}}
\label{ASC_8c_7ab9d52e5ef1cf58d82d0b4fbbc70a56}


Accumulates the proper pattern words for each ACD hit. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em counters}]The statistics counters \item[{\em gem}]Pointer to the GEM record \item[{\em acd}]Pointer to an unpacked ACD record\end{description}
\end{Desc}
This function is called on the assumption that the GEM record has been located and the ACD data has been both located and successfully unpacked. 

References accumulate(), accumulate\_\-cno(), \_\-EBF\_\-gem::acd, ASC\_\-SUMMARY\_\-AEM\_\-ERR\_\-\_\-GEM\_\-MISS, ASC\_\-SUMMARY\_\-AEM\_\-ERR\_\-\_\-GEM\_\-OKAY, ASC\_\-SUMMARY\_\-AEM\_\-MISS\_\-GEM\_\-MISS, ASC\_\-SUMMARY\_\-AEM\_\-MISS\_\-GEM\_\-OKAY, ASC\_\-SUMMARY\_\-AEM\_\-OKAY\_\-GEM\_\-MISS, ASC\_\-SUMMARY\_\-AEM\_\-OKAY\_\-GEM\_\-OKAY, \_\-ASC\_\-counters::cno, \_\-EBF\_\-gem::condCno, EBF\_\-K\_\-ACD\_\-LIST\_\-CNT, EBF\_\-K\_\-ACD\_\-SIDE\_\-A, EBF\_\-K\_\-ACD\_\-SIDE\_\-B, \_\-ASC\_\-counters::gec, \_\-ASC\_\-acd::hits, \_\-ASC\_\-cnts::lists, \_\-ASC\_\-acd::paccepts, \_\-ASC\_\-acd::status, \_\-ASC\_\-counters::summary, and \_\-EBF\_\-gemAcd::vetoes.

Referenced by ASC\_\-accumulate().\hypertarget{ASC_8c_6872723d8683ad7b36efb3582839a14b}{
\index{ASC.c@{ASC.c}!ASC\_\-acd\_\-sizeof@{ASC\_\-acd\_\-sizeof}}
\index{ASC\_\-acd\_\-sizeof@{ASC\_\-acd\_\-sizeof}!ASC.c@{ASC.c}}
\subsubsection[{ASC\_\-acd\_\-sizeof}]{\setlength{\rightskip}{0pt plus 5cm}int ASC\_\-acd\_\-sizeof (void)}}
\label{ASC_8c_6872723d8683ad7b36efb3582839a14b}


Returns the size, in bytes, of the data structure needed to hold an unpacked ACD event. 

\begin{Desc}
\item[Returns:]The size, in bytes, of the data structure needed to hold an unpacked ACD event \end{Desc}
\hypertarget{ASC_8c_830c1d4f6df149afdc1d72b443f4c442}{
\index{ASC.c@{ASC.c}!ASC\_\-acd\_\-unpack@{ASC\_\-acd\_\-unpack}}
\index{ASC\_\-acd\_\-unpack@{ASC\_\-acd\_\-unpack}!ASC.c@{ASC.c}}
\subsubsection[{ASC\_\-acd\_\-unpack}]{\setlength{\rightskip}{0pt plus 5cm}int ASC\_\-acd\_\-unpack (struct {\bf \_\-ASC\_\-acd} $\ast$ {\em acd}, \/  const struct {\bf \_\-EBF\_\-aem} $\ast$ {\em aem})}}
\label{ASC_8c_830c1d4f6df149afdc1d72b443f4c442}


Unpacks an ACD record from the AEM into a standard structure. 

\begin{Desc}
\item[Returns:]Status. The only failure is if more than 18 PHAs are found to be present on an given FREE board.\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em acd}]Pointer to the data structure to receive the unpacked ACD data \item[{\em aem}]Pointer to the AEM ACD data \end{description}
\end{Desc}


References unpack().\hypertarget{ASC_8c_120ba68e065b83a23b0bb2dbe6669935}{
\index{ASC.c@{ASC.c}!ASC\_\-aem\_\-locate@{ASC\_\-aem\_\-locate}}
\index{ASC\_\-aem\_\-locate@{ASC\_\-aem\_\-locate}!ASC.c@{ASC.c}}
\subsubsection[{ASC\_\-aem\_\-locate}]{\setlength{\rightskip}{0pt plus 5cm}const struct {\bf \_\-EBF\_\-aem} $\ast$ ASC\_\-aem\_\-locate (const unsigned int $\ast$ {\em edata}, \/  int {\em esize})\hspace{0.3cm}{\tt  \mbox{[}read\mbox{]}}}}
\label{ASC_8c_120ba68e065b83a23b0bb2dbe6669935}


Locates ACD contribution in an event. 

\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em A}]pointer to the GEM contribution. \item[{\em NULL}]is return if the GEM contribution cannnot be found\end{description}
\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em edata}]Pointer to the event data structure \item[{\em esize}]Size, in bytes, of the event \end{description}
\end{Desc}


References locate\_\-aem().

Referenced by ASC\_\-accumulate().\hypertarget{ASC_8c_00dbf448ad6f0a2d9190b905888a3ee4}{
\index{ASC.c@{ASC.c}!ASC\_\-clear@{ASC\_\-clear}}
\index{ASC\_\-clear@{ASC\_\-clear}!ASC.c@{ASC.c}}
\subsubsection[{ASC\_\-clear}]{\setlength{\rightskip}{0pt plus 5cm}ASC\_\-clear ({\bf ASC\_\-counters} $\ast$ {\em counters})}}
\label{ASC_8c_00dbf448ad6f0a2d9190b905888a3ee4}


Clears the specified statistics counters. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em counters}]The statistics counters to be cleared\end{description}
\end{Desc}
\begin{Desc}
\item[Warning:]Currently this is a NON-interlocked operation. \end{Desc}


References clear().\hypertarget{ASC_8c_2c2800c37677e68784010eaff384987a}{
\index{ASC.c@{ASC.c}!ASC\_\-gem\_\-locate@{ASC\_\-gem\_\-locate}}
\index{ASC\_\-gem\_\-locate@{ASC\_\-gem\_\-locate}!ASC.c@{ASC.c}}
\subsubsection[{ASC\_\-gem\_\-locate}]{\setlength{\rightskip}{0pt plus 5cm}const struct {\bf \_\-EBF\_\-gem} $\ast$ ASC\_\-gem\_\-locate (const unsigned int $\ast$ {\em edata}, \/  int {\em esize})\hspace{0.3cm}{\tt  \mbox{[}read\mbox{]}}}}
\label{ASC_8c_2c2800c37677e68784010eaff384987a}


Locates GEM contribution in an event. 

\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em A}]pointer to the GEM contribution. \item[{\em NULL}]is return if the GEM contribution cannnot be found\end{description}
\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em edata}]Pointer to the event data structure \item[{\em esize}]Size, in bytes, of the event \end{description}
\end{Desc}


References \_\-SKIP\_\-EHDR, EBF\_\-K\_\-CID\_\-GEM, and LCB\_\-EXTRACT\_\-CID.

Referenced by ASC\_\-accumulate().\hypertarget{ASC_8c_70c5d6d3cc969dbd6cbca5b9a6921c8f}{
\index{ASC.c@{ASC.c}!clear@{clear}}
\index{clear@{clear}!ASC.c@{ASC.c}}
\subsubsection[{clear}]{\setlength{\rightskip}{0pt plus 5cm}void clear (void $\ast$ {\em ptr}, \/  int {\em nbytes})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{ASC_8c_70c5d6d3cc969dbd6cbca5b9a6921c8f}


Zeroes the specified memory. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ptr}]Pointer to the memory to zero \item[{\em nbytes}]The number of bytes to zero\end{description}
\end{Desc}
This provides a fast way of zeroing large chunks of memory on PPC platforms using the {\em dcbz\/} instruction. This instruction zeroes a cache line at a time. The savings in speed various by processor, but factors of 5 or more are in the ballpark. For example, on the mv2304, zeroing 32K of memory

On other platforms, the generic memset routine is used. 

Referenced by ASC\_\-clear().\hypertarget{ASC_8c_35e96a1d5b306867d508958628da79b3}{
\index{ASC.c@{ASC.c}!form@{form}}
\index{form@{form}!ASC.c@{ASC.c}}
\subsubsection[{form}]{\setlength{\rightskip}{0pt plus 5cm}unsigned int form (unsigned int {\em v}, \/  unsigned int {\em hb}, \/  unsigned int {\em ha}, \/  unsigned int {\em pb}, \/  unsigned int {\em pa}, \/  int {\em left})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{ASC_8c_35e96a1d5b306867d508958628da79b3}


Forms the 5 bit pattern word from the bits in column {\em left\/} {\bf and} appropriately shifts the pattern word so that it may be used directly as a byte offset into the correct statistics counters. 

\begin{Desc}
\item[Returns:]A word that can be used to increment the statistics pattern counter.\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em v}]The GEM list of veto bits \item[{\em hb}]The ACD hit bits for side {\em b\/} \item[{\em ha}]The ACD hit bits for side {\em a\/} \item[{\em pb}]The ACD pulse height accept bits for side {\em b\/} \item[{\em pa}]The ACD pulse height accept bits for side {\em a\/} \item[{\em left}]The bit number of the channel (counting from the left or MSB) \end{description}
\end{Desc}


Referenced by accumulate().\hypertarget{ASC_8c_3bb2bb9daa99d613081b4c54a413c58c}{
\index{ASC.c@{ASC.c}!locate\_\-aem@{locate\_\-aem}}
\index{locate\_\-aem@{locate\_\-aem}!ASC.c@{ASC.c}}
\subsubsection[{locate\_\-aem}]{\setlength{\rightskip}{0pt plus 5cm}static \_\-\_\-inline const {\bf EBF\_\-aem} $\ast$ locate\_\-aem (const unsigned int $\ast$ {\em evt}, \/  int {\em elen})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{ASC_8c_3bb2bb9daa99d613081b4c54a413c58c}


Composes the directory of the contributors. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em evt}]The source event. \item[{\em elen}]The size of the event in bytes \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Pointer to the ACD data or NULL if it cannot be located. \end{Desc}


References \_\-ADVANCE, EBF\_\-K\_\-CID\_\-ACD, LCB\_\-EXTRACT\_\-CID, and LCB\_\-EXTRACT\_\-CLEN.

Referenced by ASC\_\-aem\_\-locate().\hypertarget{ASC_8c_a474b9f67d25dbddbb0d8bca540e38d9}{
\index{ASC.c@{ASC.c}!prepare@{prepare}}
\index{prepare@{prepare}!ASC.c@{ASC.c}}
\subsubsection[{prepare}]{\setlength{\rightskip}{0pt plus 5cm}static \_\-\_\-inline unsigned int prepare (unsigned int {\em w})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{ASC_8c_a474b9f67d25dbddbb0d8bca540e38d9}


Prepares the initial word of being used in the formation of the pattern word. 

\begin{Desc}
\item[Returns:]The prepared word\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em w}]The word to prepare\end{description}
\end{Desc}
On the PowerPC, 1 instruction in the accumulation loop is saved by preshifting the intial word used in the formation of the pattern word. All other platforms do the straightforward thing of shifting and oring each bit and this routine is a NOOP. By doing defining this routine, the bulk of the code is portable across platforms. 

Referenced by accumulate().\hypertarget{ASC_8c_39e3941ba11d732be312b45af60b1f3f}{
\index{ASC.c@{ASC.c}!unpack@{unpack}}
\index{unpack@{unpack}!ASC.c@{ASC.c}}
\subsubsection[{unpack}]{\setlength{\rightskip}{0pt plus 5cm}static int unpack (struct {\bf \_\-ASC\_\-acd} $\ast$ {\em acd}, \/  const unsigned short int $\ast$ {\em data})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{ASC_8c_39e3941ba11d732be312b45af60b1f3f}


Unpacks an ACD record from the AEM into a standard structure. 

\begin{Desc}
\item[Returns:]Status. The only failure is if more than 18 PHAs are found to be present on an given FREE board.\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em acd}]Pointer to the data structure to receive the unpacked data \item[{\em data}]Pointer to the AEM data \end{description}
\end{Desc}


References \_\-ACD\_\-remap::brds, \_\-ASC\_\-acd::cables, EBF\_\-K\_\-ACD\_\-LIST\_\-RU, EBF\_\-K\_\-ACD\_\-LIST\_\-XY, EBF\_\-K\_\-ACD\_\-LIST\_\-XZ, EBF\_\-K\_\-ACD\_\-LIST\_\-YZ, EBF\_\-K\_\-ACD\_\-NCHNS\_\-PER\_\-BRD, EBF\_\-K\_\-ACD\_\-SIDE\_\-A, EBF\_\-K\_\-ACD\_\-SIDE\_\-B, \_\-ASC\_\-acd::hits, \_\-ACD\_\-remapBrd::msks, \_\-ASC\_\-acd::naccepts, \_\-ASC\_\-acd::nphas, \_\-ASC\_\-acd::paccepts, \_\-ASC\_\-acd::phas, \_\-ACD\_\-remapBrd::rma, \_\-ACD\_\-remapBrd::rmc, \_\-ASC\_\-acd::start\_\-parity, \_\-ASC\_\-acd::status, \_\-ASC\_\-acd::unmatched\_\-parity, and \_\-ASC\_\-acd::uphas.

Referenced by ASC\_\-accumulate(), and ASC\_\-acd\_\-unpack().