\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 $<$PBS/FFS.ih$>$}\par
{\tt \#include $<$PBI/Endianness.h$>$}\par
{\tt \#include $<$EMP/ASC.h$>$}\par
{\tt \#include $<$EDS/EBF\_\-cid.h$>$}\par
{\tt \#include $<$EDS/EBF\_\-gem.h$>$}\par
{\tt \#include $<$EDS/EDA\_\-acd.h$>$}\par
{\tt \#include $<$EDS/EDR\_\-acd.h$>$}\par
{\tt \#include $<$EMP/ASC\_\-pubdefs.h$>$}\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}\end{CompactItemize}
\subsection*{Defines}
\begin{CompactItemize}
\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}\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}\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 \_\-\_\-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 unsigned int $\ast$ \hyperlink{ASC_8c_afe2c826fe08b97fa107da64e990ecee}{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_c599bd40c55490659619288a7a5ec860}{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_f94e0a57c8c645e86b7d89020aa46626}{ASC\_\-accumulateU} (\hyperlink{struct__ASC__counters}{ASC\_\-counters} $\ast$counters, const struct \_\-EBF\_\-gem $\ast$gem, const struct \_\-EDR\_\-acd $\ast$acd)
\begin{CompactList}\small\item\em Accumulates the proper pattern words for each ACD hit. \item\end{CompactList}\item 
const \_\-\_\-inline struct \_\-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 unsigned int $\ast$ \hyperlink{ASC_8c_96df891ee629c2bcab58d17b384c4043}{ASC\_\-aem\_\-locate} (const unsigned int $\ast$edata, int esize)
\begin{CompactList}\small\item\em Locates AEM contribution in an 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}\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.10 2011/03/26 20:07:42 russell 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_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{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_f94e0a57c8c645e86b7d89020aa46626}{
\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 \_\-EBF\_\-gem $\ast$ {\em gem}, \/  const struct \_\-EDR\_\-acd $\ast$ {\em acd})}}
\label{ASC_8c_f94e0a57c8c645e86b7d89020aa46626}


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(), 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, \_\-ASC\_\-counters::gec, \_\-ASC\_\-cnts::lists, and \_\-ASC\_\-counters::summary.

Referenced by AscEdsProcess().\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_96df891ee629c2bcab58d17b384c4043}{
\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 \_\-\_\-inline unsigned int$\ast$ ASC\_\-aem\_\-locate (const unsigned int $\ast$ {\em edata}, \/  int {\em esize})}}
\label{ASC_8c_96df891ee629c2bcab58d17b384c4043}


Locates AEM contribution in an event. 

\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em A}]pointer to the AEM contribution. \item[{\em NULL}]is return if the AEM 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 set\_\-aem().\hypertarget{ASC_8c_c599bd40c55490659619288a7a5ec860}{
\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}void ASC\_\-clear ({\bf ASC\_\-counters} $\ast$ {\em counters})}}
\label{ASC_8c_c599bd40c55490659619288a7a5ec860}


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().

Referenced by initMsg(), and output().\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 \_\-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, and LCB\_\-EXTRACT\_\-CID.\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. 

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.

\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_afe2c826fe08b97fa107da64e990ecee}{
\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 unsigned int $\ast$ locate\_\-aem (const unsigned int $\ast$ {\em evt}, \/  int {\em elen})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{ASC_8c_afe2c826fe08b97fa107da64e990ecee}


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, 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().