\section{collect.c File Reference}
\label{collect_8c}\index{collect.c@{collect.c}}


Routines to collect the event data.  


{\ttfamily \#include $<$lci\_\-p.h$>$}\par
{\ttfamily \#include $<$LCI/LCI\_\-msgs.h$>$}\par
{\ttfamily \#include $<$LSEC/LSEC.h$>$}\par
{\ttfamily \#include $<$LSEC/enums.h$>$}\par
{\ttfamily \#include $<$LEM/list.h$>$}\par
{\ttfamily \#include $<$LEM/defs.h$>$}\par
{\ttfamily \#include $<$MSG/MSG\_\-pubdefs.h$>$}\par
{\ttfamily \#include $<$EDS/EBF\_\-pkt.h$>$}\par
{\ttfamily \#include $<$EDS/EBF\_\-edw.h$>$}\par
{\ttfamily \#include $<$LCBD/LCBD\_\-evt.h$>$}\par
{\ttfamily \#include $<$PBS/MBA.h$>$}\par
{\ttfamily \#include $<$PBS/WCT.h$>$}\par
{\ttfamily \#include $<$string.h$>$}\par
{\ttfamily \#include $<$stdio.h$>$}\par
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{collect_8c_af3524b47dcc4c8a519c313516156d34a}{LCI\_\-collClearCounts} (\hyperlink{lci__p_8h_a698b7e7580c6a59ac46c84329fd4ab45}{LCI\_\-collection} $\ast$cll)
\begin{DoxyCompactList}\small\item\em Clear collection counters. \end{DoxyCompactList}\item 
void \hyperlink{collect_8c_a936120ec5e02377866adcd2b3436738c}{LCI\_\-collCounts} (\hyperlink{lci__p_8h_a698b7e7580c6a59ac46c84329fd4ab45}{LCI\_\-collection} $\ast$cll, unsigned int $\ast$nWait, unsigned int $\ast$nSignal, unsigned int $\ast$nTimeout)
\begin{DoxyCompactList}\small\item\em Get collection counters. \end{DoxyCompactList}\item 
\hyperlink{lci__p_8h_a698b7e7580c6a59ac46c84329fd4ab45}{LCI\_\-collection} $\ast$ \hyperlink{collect_8c_a7205d2373f87fbbf78069d56224a2b57}{LCI\_\-collCreate} (LSEC\_\-control $\ast$lsec)
\begin{DoxyCompactList}\small\item\em Allocate and initialise a collection structure. \end{DoxyCompactList}\item 
void \hyperlink{collect_8c_af14a96d6db14458bff1ef67b233f4c69}{LCI\_\-collDelete} (\hyperlink{lci__p_8h_a698b7e7580c6a59ac46c84329fd4ab45}{LCI\_\-collection} $\ast$cll)
\begin{DoxyCompactList}\small\item\em Free a structure previously allocated using LCI\_\-collCreate. \end{DoxyCompactList}\item 
unsigned \hyperlink{collect_8c_aecc869d080dd8fe86132aa8100c48722}{LCI\_\-collect} (\hyperlink{lci__p_8h_a698b7e7580c6a59ac46c84329fd4ab45}{LCI\_\-collection} $\ast$cll, unsigned nev, unsigned period)
\begin{DoxyCompactList}\small\item\em Initiate the calibration triggers and wait for each event to be collected and constructed. \end{DoxyCompactList}\item 
unsigned \hyperlink{collect_8c_a536a5b775b11cf336cea6542aeb58503}{LCI\_\-collected} (\hyperlink{lci__p_8h_a698b7e7580c6a59ac46c84329fd4ab45}{LCI\_\-collection} $\ast$cll)
\begin{DoxyCompactList}\small\item\em Get the number of events collected. \end{DoxyCompactList}\item 
void \hyperlink{collect_8c_a00c5bf78594a7786f7676fbb1e5a221f}{LCI\_\-collRunInit} (\hyperlink{lci__p_8h_a698b7e7580c6a59ac46c84329fd4ab45}{LCI\_\-collection} $\ast$cll, LCBD lcbd, LEM\_\-micr $\ast$cr)
\begin{DoxyCompactList}\small\item\em Initialize for a new calibration run. \end{DoxyCompactList}\item 
void \hyperlink{collect_8c_a92a278e277c5a37667d136c37a6782bd}{LCI\_\-collRunTerm} (\hyperlink{lci__p_8h_a698b7e7580c6a59ac46c84329fd4ab45}{LCI\_\-collection} $\ast$cll)
\begin{DoxyCompactList}\small\item\em Terminate a calibration run. \end{DoxyCompactList}\item 
void \hyperlink{collect_8c_a0234773c918ef0cbaeb3efca9f4187ff}{LCI\_\-collTime} (\hyperlink{lci__p_8h_a698b7e7580c6a59ac46c84329fd4ab45}{LCI\_\-collection} $\ast$cll, int clear, long long $\ast$ctime)
\begin{DoxyCompactList}\small\item\em Return accumulated collection time. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Routines to collect the event data. \begin{DoxyAuthor}{Author}
James Swain \& Owen Saxton
\end{DoxyAuthor}
{\bfseries \$Id:} \hyperlink{collect_8c}{collect.c},v 1.14 2011/03/29 19:32:56 saxton Exp \$ 

\subsection{Function Documentation}
\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 (
\begin{DoxyParamCaption}
\item[{{\bf LCI\_\-collection} $\ast$}]{cll}
\end{DoxyParamCaption}
)}\label{collect_8c_af3524b47dcc4c8a519c313516156d34a}


Clear collection counters. 

This routine calls through to the cue counter clear routine.


\begin{DoxyParams}{Parameters}
{\em cll} & Pointer to an allocated and initialised collection structure that has been used to collect events \\
\hline
\end{DoxyParams}


References LCI\_\-clearCueCounts().



Referenced by LCI\_\-calibrate().

\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 (
\begin{DoxyParamCaption}
\item[{{\bf LCI\_\-collection} $\ast$}]{cll, }
\item[{unsigned int $\ast$}]{nWait, }
\item[{unsigned int $\ast$}]{nSignal, }
\item[{unsigned int $\ast$}]{nTimeout}
\end{DoxyParamCaption}
)}\label{collect_8c_a936120ec5e02377866adcd2b3436738c}


Get collection counters. 

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


\begin{DoxyParams}{Parameters}
{\em cll} & Pointer to a collection structure.\\
\hline
{\em nWait} & Address of an integer to receive the number of wait calls, or NULL if not needed.\\
\hline
{\em nSignal} & Address of an integer to receive the number of signal calls, or NULL if not needed.\\
\hline
{\em nTimeout} & Address of an integer to receive the number of timeouts, or NULL if not needed. \\
\hline
\end{DoxyParams}


References LCI\_\-getCueCounts().



Referenced by LCI\_\-terminate().

\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 (
\begin{DoxyParamCaption}
\item[{LSEC\_\-control $\ast$}]{lsec}
\end{DoxyParamCaption}
)}\label{collect_8c_a7205d2373f87fbbf78069d56224a2b57}


Allocate and initialise a collection structure. 


\begin{DoxyParams}{Parameters}
{\em lsec} & LSEC access handle.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Pointer to an allocated, initialised LCI\_\-collection 
\end{DoxyReturn}


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



Referenced by LCI\_\-newController().

\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 (
\begin{DoxyParamCaption}
\item[{{\bf LCI\_\-collection} $\ast$}]{cll}
\end{DoxyParamCaption}
)}\label{collect_8c_af14a96d6db14458bff1ef67b233f4c69}


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


\begin{DoxyParams}{Parameters}
{\em cll} & Pointer to an allocated and initialised LCI\_\-collection structure \\
\hline
\end{DoxyParams}


References LCI\_\-deleteCue().



Referenced by LCI\_\-collCreate(), and LCI\_\-deleteController().

\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 (
\begin{DoxyParamCaption}
\item[{{\bf LCI\_\-collection} $\ast$}]{cll, }
\item[{unsigned}]{nev, }
\item[{unsigned}]{period}
\end{DoxyParamCaption}
)}\label{collect_8c_aecc869d080dd8fe86132aa8100c48722}


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


\begin{DoxyParams}{Parameters}
{\em cll} & Pointer to an intialised event collection structure\\
\hline
{\em nev} & Number of events to be collected\\
\hline
{\em period} & The period (in 50 ns ticks) between triggers\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em LCI\_\-SUCCESS} & If all the expected events were successfully collected \\
\hline
{\em LCI\_\-LOSTEVT} & If some of the events were not collected \\
\hline
\end{DoxyRetVals}


References LCI\_\-clearCue(), and LCI\_\-waitCue().

\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 (
\begin{DoxyParamCaption}
\item[{{\bf LCI\_\-collection} $\ast$}]{cll}
\end{DoxyParamCaption}
)}\label{collect_8c_a536a5b775b11cf336cea6542aeb58503}


Get the number of events collected. 


\begin{DoxyParams}{Parameters}
{\em cll} & Pointer to an allocated and initialised collection structure that has been used to collect events\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Number of events collected 
\end{DoxyReturn}
\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 (
\begin{DoxyParamCaption}
\item[{{\bf LCI\_\-collection} $\ast$}]{cll, }
\item[{LCBD}]{lcbd, }
\item[{LEM\_\-micr $\ast$}]{cr}
\end{DoxyParamCaption}
)}\label{collect_8c_a00c5bf78594a7786f7676fbb1e5a221f}


Initialize for a new calibration run. 

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


\begin{DoxyParams}{Parameters}
{\em cll} & Pointer to a collection structure.\\
\hline
{\em lcbd} & Pointer to the LCB control block,\\
\hline
{\em cr} & Pointer to a multi-\/item command-\/response list. \\
\hline
\end{DoxyParams}


Referenced by LCI\_\-calibrate().

\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 (
\begin{DoxyParamCaption}
\item[{{\bf LCI\_\-collection} $\ast$}]{cll}
\end{DoxyParamCaption}
)}\label{collect_8c_a92a278e277c5a37667d136c37a6782bd}


Terminate a calibration run. 

The event callback is set back to its original value.


\begin{DoxyParams}{Parameters}
{\em cll} & Pointer to a collection structure. \\
\hline
\end{DoxyParams}


Referenced by LCI\_\-terminate().

\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 (
\begin{DoxyParamCaption}
\item[{{\bf LCI\_\-collection} $\ast$}]{cll, }
\item[{int}]{clear, }
\item[{long long $\ast$}]{ctime}
\end{DoxyParamCaption}
)}\label{collect_8c_a0234773c918ef0cbaeb3efca9f4187ff}


Return accumulated collection time. 


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


Referenced by LCI\_\-calibrate().

