\hypertarget{collect_8c}{
\section{collect.c File Reference}
\label{collect_8c}\index{collect.c@{collect.c}}
}
Routines to collect the event data. 

{\tt \#include \char`\"{}lci\_\-p.h\char`\"{}}\par
{\tt \#include \char`\"{}LCI/LCI\_\-msgs.h\char`\"{}}\par
{\tt \#include \char`\"{}LSEC/LSEC.h\char`\"{}}\par
{\tt \#include \char`\"{}LSEC/enums.h\char`\"{}}\par
{\tt \#include \char`\"{}LEM/list.h\char`\"{}}\par
{\tt \#include \char`\"{}LEM/defs.h\char`\"{}}\par
{\tt \#include \char`\"{}MSG/MSG\_\-pubdefs.h\char`\"{}}\par
{\tt \#include \char`\"{}EDS/EBF\_\-pkt.h\char`\"{}}\par
{\tt \#include \char`\"{}EDS/EBF\_\-edw.h\char`\"{}}\par
{\tt \#include \char`\"{}LCBD/LCBD\_\-evt.h\char`\"{}}\par
{\tt \#include \char`\"{}PBS/MBA.h\char`\"{}}\par
{\tt \#include \char`\"{}PBS/WCT.h\char`\"{}}\par
{\tt \#include $<$string.h$>$}\par
{\tt \#include $<$stdio.h$>$}\par
\subsection*{Functions}
\begin{CompactItemize}
\item 
void \hyperlink{collect_8c_f3524b47dcc4c8a519c313516156d34a}{LCI\_\-collClearCounts} (\hyperlink{lci__p_8h_698b7e7580c6a59ac46c84329fd4ab45}{LCI\_\-collection} $\ast$cll)
\begin{CompactList}\small\item\em Clear collection counters. \item\end{CompactList}\item 
void \hyperlink{collect_8c_936120ec5e02377866adcd2b3436738c}{LCI\_\-collCounts} (\hyperlink{lci__p_8h_698b7e7580c6a59ac46c84329fd4ab45}{LCI\_\-collection} $\ast$cll, unsigned int $\ast$nWait, unsigned int $\ast$nSignal, unsigned int $\ast$nTimeout)
\begin{CompactList}\small\item\em Get collection counters. \item\end{CompactList}\item 
\hyperlink{lci__p_8h_698b7e7580c6a59ac46c84329fd4ab45}{LCI\_\-collection} $\ast$ \hyperlink{collect_8c_7205d2373f87fbbf78069d56224a2b57}{LCI\_\-collCreate} (LSEC\_\-control $\ast$lsec)
\begin{CompactList}\small\item\em Allocate and initialise a collection structure. \item\end{CompactList}\item 
void \hyperlink{collect_8c_f14a96d6db14458bff1ef67b233f4c69}{LCI\_\-collDelete} (\hyperlink{lci__p_8h_698b7e7580c6a59ac46c84329fd4ab45}{LCI\_\-collection} $\ast$cll)
\begin{CompactList}\small\item\em Free a structure previously allocated using LCI\_\-collCreate. \item\end{CompactList}\item 
unsigned \hyperlink{collect_8c_ecc869d080dd8fe86132aa8100c48722}{LCI\_\-collect} (\hyperlink{lci__p_8h_698b7e7580c6a59ac46c84329fd4ab45}{LCI\_\-collection} $\ast$cll, unsigned nev, unsigned period)
\begin{CompactList}\small\item\em Initiate the calibration triggers and wait for each event to be collected and constructed. \item\end{CompactList}\item 
unsigned \hyperlink{collect_8c_536a5b775b11cf336cea6542aeb58503}{LCI\_\-collected} (\hyperlink{lci__p_8h_698b7e7580c6a59ac46c84329fd4ab45}{LCI\_\-collection} $\ast$cll)
\begin{CompactList}\small\item\em Get the number of events collected. \item\end{CompactList}\item 
void \hyperlink{collect_8c_00c5bf78594a7786f7676fbb1e5a221f}{LCI\_\-collRunInit} (\hyperlink{lci__p_8h_698b7e7580c6a59ac46c84329fd4ab45}{LCI\_\-collection} $\ast$cll, LCBD lcbd, LEM\_\-micr $\ast$cr)
\begin{CompactList}\small\item\em Initialize for a new calibration run. \item\end{CompactList}\item 
void \hyperlink{collect_8c_92a278e277c5a37667d136c37a6782bd}{LCI\_\-collRunTerm} (\hyperlink{lci__p_8h_698b7e7580c6a59ac46c84329fd4ab45}{LCI\_\-collection} $\ast$cll)
\begin{CompactList}\small\item\em Terminate a calibration run. \item\end{CompactList}\item 
void \hyperlink{collect_8c_0234773c918ef0cbaeb3efca9f4187ff}{LCI\_\-collTime} (\hyperlink{lci__p_8h_698b7e7580c6a59ac46c84329fd4ab45}{LCI\_\-collection} $\ast$cll, int clear, long long $\ast$ctime)
\begin{CompactList}\small\item\em Return accumulated collection time. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Routines to collect the event data. 

\begin{Desc}
\item[Author:]James Swain \& Owen Saxton\end{Desc}
{\bf \$Id:} \hyperlink{collect_8c}{collect.c},v 1.13 2010/05/03 20:28:41 saxton Exp \$ 

\subsection{Function Documentation}
\hypertarget{collect_8c_f3524b47dcc4c8a519c313516156d34a}{
\index{collect.c@{collect.c}!LCI_collClearCounts@{LCI\_\-collClearCounts}}
\index{LCI_collClearCounts@{LCI\_\-collClearCounts}!collect.c@{collect.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void LCI\_\-collClearCounts ({\bf LCI\_\-collection} $\ast$ {\em cll})}}
\label{collect_8c_f3524b47dcc4c8a519c313516156d34a}


Clear collection counters. 

This routine calls through to the cue counter clear routine.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cll}]Pointer to an allocated and initialised collection structure that has been used to collect events \end{description}
\end{Desc}
\hypertarget{collect_8c_936120ec5e02377866adcd2b3436738c}{
\index{collect.c@{collect.c}!LCI_collCounts@{LCI\_\-collCounts}}
\index{LCI_collCounts@{LCI\_\-collCounts}!collect.c@{collect.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void LCI\_\-collCounts ({\bf LCI\_\-collection} $\ast$ {\em cll}, unsigned int $\ast$ {\em nWait}, unsigned int $\ast$ {\em nSignal}, unsigned int $\ast$ {\em nTimeout})}}
\label{collect_8c_936120ec5e02377866adcd2b3436738c}


Get collection counters. 

This routine calls through to the cue counters get routine, returning the counts accumulated since the last clear.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cll}]Pointer to a collection structure.\item[{\em nWait}]Address of an integer to receive the number of wait calls, or NULL if not needed.\item[{\em nSignal}]Address of an integer to receive the number of signal calls, or NULL if not needed.\item[{\em nTimeout}]Address of an integer to receive the number of timeouts, or NULL if not needed. \end{description}
\end{Desc}
\hypertarget{collect_8c_7205d2373f87fbbf78069d56224a2b57}{
\index{collect.c@{collect.c}!LCI_collCreate@{LCI\_\-collCreate}}
\index{LCI_collCreate@{LCI\_\-collCreate}!collect.c@{collect.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf LCI\_\-collection}$\ast$ LCI\_\-collCreate (LSEC\_\-control $\ast$ {\em lsec})}}
\label{collect_8c_7205d2373f87fbbf78069d56224a2b57}


Allocate and initialise a collection structure. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em lsec}]LSEC access handle.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Pointer to an allocated, initialised LCI\_\-collection \end{Desc}
\hypertarget{collect_8c_f14a96d6db14458bff1ef67b233f4c69}{
\index{collect.c@{collect.c}!LCI_collDelete@{LCI\_\-collDelete}}
\index{LCI_collDelete@{LCI\_\-collDelete}!collect.c@{collect.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void LCI\_\-collDelete ({\bf LCI\_\-collection} $\ast$ {\em cll})}}
\label{collect_8c_f14a96d6db14458bff1ef67b233f4c69}


Free a structure previously allocated using LCI\_\-collCreate. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cll}]Pointer to an allocated and initialised LCI\_\-collection structure \end{description}
\end{Desc}
\hypertarget{collect_8c_ecc869d080dd8fe86132aa8100c48722}{
\index{collect.c@{collect.c}!LCI_collect@{LCI\_\-collect}}
\index{LCI_collect@{LCI\_\-collect}!collect.c@{collect.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned LCI\_\-collect ({\bf LCI\_\-collection} $\ast$ {\em cll}, unsigned {\em nev}, unsigned {\em period})}}
\label{collect_8c_ecc869d080dd8fe86132aa8100c48722}


Initiate the calibration triggers and wait for each event to be collected and constructed. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cll}]Pointer to an intialised event collection structure\item[{\em nev}]Number of events to be collected\item[{\em period}]The period (in 50 ns ticks) between triggers\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em LCI\_\-SUCCESS}]If all the expected events were successfully collected \item[{\em LCI\_\-LOSTEVT}]If some of the events were not collected \end{description}
\end{Desc}
\hypertarget{collect_8c_536a5b775b11cf336cea6542aeb58503}{
\index{collect.c@{collect.c}!LCI_collected@{LCI\_\-collected}}
\index{LCI_collected@{LCI\_\-collected}!collect.c@{collect.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned LCI\_\-collected ({\bf LCI\_\-collection} $\ast$ {\em cll})}}
\label{collect_8c_536a5b775b11cf336cea6542aeb58503}


Get the number of events collected. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cll}]Pointer to an allocated and initialised collection structure that has been used to collect events\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Number of events collected \end{Desc}
\hypertarget{collect_8c_00c5bf78594a7786f7676fbb1e5a221f}{
\index{collect.c@{collect.c}!LCI_collRunInit@{LCI\_\-collRunInit}}
\index{LCI_collRunInit@{LCI\_\-collRunInit}!collect.c@{collect.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void LCI\_\-collRunInit ({\bf LCI\_\-collection} $\ast$ {\em cll}, LCBD {\em lcbd}, LEM\_\-micr $\ast$ {\em cr})}}
\label{collect_8c_00c5bf78594a7786f7676fbb1e5a221f}


Initialize for a new calibration run. 

This routine saves the lcbd and cr pointers and sets up the event callback routine.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cll}]Pointer to a collection structure.\item[{\em lcbd}]Pointer to the LCB control block,\item[{\em cr}]Pointer to a multi-item command-response list. \end{description}
\end{Desc}
\hypertarget{collect_8c_92a278e277c5a37667d136c37a6782bd}{
\index{collect.c@{collect.c}!LCI_collRunTerm@{LCI\_\-collRunTerm}}
\index{LCI_collRunTerm@{LCI\_\-collRunTerm}!collect.c@{collect.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void LCI\_\-collRunTerm ({\bf LCI\_\-collection} $\ast$ {\em cll})}}
\label{collect_8c_92a278e277c5a37667d136c37a6782bd}


Terminate a calibration run. 

The event callback is set back to its original value.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cll}]Pointer to a collection structure. \end{description}
\end{Desc}
\hypertarget{collect_8c_0234773c918ef0cbaeb3efca9f4187ff}{
\index{collect.c@{collect.c}!LCI_collTime@{LCI\_\-collTime}}
\index{LCI_collTime@{LCI\_\-collTime}!collect.c@{collect.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void LCI\_\-collTime ({\bf LCI\_\-collection} $\ast$ {\em cll}, int {\em clear}, long long $\ast$ {\em ctime})}}
\label{collect_8c_0234773c918ef0cbaeb3efca9f4187ff}


Return accumulated collection time. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cll}]Pointer to a collection structure.\item[{\em clear}]If TRUE, clear the time after copying it.\item[{\em ctime}]Address of a variable to receive the accumulated time taken to do collections, or NULL if no time wanted. \end{description}
\end{Desc}
