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


{\tt \#include $<$lci\_\-p.h$>$}\par
{\tt \#include $<$LCI/LCI\_\-msgs.h$>$}\par
{\tt \#include $<$LSEC/LSEC.h$>$}\par
{\tt \#include $<$LSEC/enums.h$>$}\par
{\tt \#include $<$LEM/list.h$>$}\par
{\tt \#include $<$LEM/defs.h$>$}\par
{\tt \#include $<$MSG/MSG\_\-pubdefs.h$>$}\par
{\tt \#include $<$EDS/EBF\_\-pkt.h$>$}\par
{\tt \#include $<$EDS/EBF\_\-edw.h$>$}\par
{\tt \#include $<$LCBD/LCBD\_\-evt.h$>$}\par
{\tt \#include $<$PBS/MBA.h$>$}\par
{\tt \#include $<$PBS/WCT.h$>$}\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.14 2011/03/29 19:32:56 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[{LCI\_\-collClearCounts}]{\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}


References LCI\_\-clearCueCounts().

Referenced by LCI\_\-calibrate().\hypertarget{collect_8c_936120ec5e02377866adcd2b3436738c}{
\index{collect.c@{collect.c}!LCI\_\-collCounts@{LCI\_\-collCounts}}
\index{LCI\_\-collCounts@{LCI\_\-collCounts}!collect.c@{collect.c}}
\subsubsection[{LCI\_\-collCounts}]{\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}


References LCI\_\-getCueCounts().

Referenced by LCI\_\-terminate().\hypertarget{collect_8c_7205d2373f87fbbf78069d56224a2b57}{
\index{collect.c@{collect.c}!LCI\_\-collCreate@{LCI\_\-collCreate}}
\index{LCI\_\-collCreate@{LCI\_\-collCreate}!collect.c@{collect.c}}
\subsubsection[{LCI\_\-collCreate}]{\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}


References LCI\_\-collDelete(), and LCI\_\-newCue().

Referenced by LCI\_\-newController().\hypertarget{collect_8c_f14a96d6db14458bff1ef67b233f4c69}{
\index{collect.c@{collect.c}!LCI\_\-collDelete@{LCI\_\-collDelete}}
\index{LCI\_\-collDelete@{LCI\_\-collDelete}!collect.c@{collect.c}}
\subsubsection[{LCI\_\-collDelete}]{\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}


References LCI\_\-deleteCue().

Referenced by LCI\_\-collCreate(), and LCI\_\-deleteController().\hypertarget{collect_8c_ecc869d080dd8fe86132aa8100c48722}{
\index{collect.c@{collect.c}!LCI\_\-collect@{LCI\_\-collect}}
\index{LCI\_\-collect@{LCI\_\-collect}!collect.c@{collect.c}}
\subsubsection[{LCI\_\-collect}]{\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}


References LCI\_\-clearCue(), and LCI\_\-waitCue().\hypertarget{collect_8c_536a5b775b11cf336cea6542aeb58503}{
\index{collect.c@{collect.c}!LCI\_\-collected@{LCI\_\-collected}}
\index{LCI\_\-collected@{LCI\_\-collected}!collect.c@{collect.c}}
\subsubsection[{LCI\_\-collected}]{\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[{LCI\_\-collRunInit}]{\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}


Referenced by LCI\_\-calibrate().\hypertarget{collect_8c_92a278e277c5a37667d136c37a6782bd}{
\index{collect.c@{collect.c}!LCI\_\-collRunTerm@{LCI\_\-collRunTerm}}
\index{LCI\_\-collRunTerm@{LCI\_\-collRunTerm}!collect.c@{collect.c}}
\subsubsection[{LCI\_\-collRunTerm}]{\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}


Referenced by LCI\_\-terminate().\hypertarget{collect_8c_0234773c918ef0cbaeb3efca9f4187ff}{
\index{collect.c@{collect.c}!LCI\_\-collTime@{LCI\_\-collTime}}
\index{LCI\_\-collTime@{LCI\_\-collTime}!collect.c@{collect.c}}
\subsubsection[{LCI\_\-collTime}]{\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}


Referenced by LCI\_\-calibrate().