\hypertarget{event_8c}{
\section{event.c File Reference}
\label{event_8c}\index{event.c@{event.c}}
}
Routines that handle raw event data.  


{\tt \#include $<$LSEC\_\-p.h$>$}\par
{\tt \#include $<$LSEC/LSEC.h$>$}\par
{\tt \#include $<$LSEC/LSEC\_\-msgs.h$>$}\par
{\tt \#include $<$EDS/EBF\_\-dir.h$>$}\par
{\tt \#include $<$EDS/EBF\_\-edw.h$>$}\par
{\tt \#include $<$EDS/EBF\_\-siv.h$>$}\par
{\tt \#include $<$PBS/MBA.h$>$}\par
{\tt \#include $<$MSG/MSG\_\-pubdefs.h$>$}\par
{\tt \#include $<$string.h$>$}\par
\subsection*{Classes}
\begin{CompactItemize}
\item 
struct \hyperlink{struct__LSEC__event}{\_\-LSEC\_\-event}
\begin{CompactList}\small\item\em Structure holding raw event data. \item\end{CompactList}\end{CompactItemize}
\subsection*{Enumerations}
\begin{CompactItemize}
\item 
enum \{ \hyperlink{event_8c_dc29c2ff13d900c2f185ee95427fb06c6bfd1c3fbdf2b545a5d1bc1dd4533283}{MAX\_\-OVERHEAD\_\-PER\_\-EVENT} =  sizeof(EBF\_\-pktHdr) $\ast$ 8 $\ast$ 56
 \}
\begin{CompactList}\small\item\em Various constants. \item\end{CompactList}\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
void \hyperlink{event_8c_74c11eb498c64ea9102c02cd5e7d200e}{LSEC\_\-eventClear} (\hyperlink{struct__LSEC__event}{LSEC\_\-event} $\ast$evt)
\begin{CompactList}\small\item\em Clear the stored event data. \item\end{CompactList}\item 
\hyperlink{struct__LSEC__event}{LSEC\_\-event} $\ast$ \hyperlink{event_8c_aad0a8ea7ad8e102cb728f086c0f5b8d}{LSEC\_\-eventCreate} (int cap, long long $\ast$times)
\begin{CompactList}\small\item\em Create a new event structure. \item\end{CompactList}\item 
void \hyperlink{event_8c_a02662052945c47d0daae9d509b8dc33}{LSEC\_\-eventDelete} (\hyperlink{struct__LSEC__event}{LSEC\_\-event} $\ast$evt)
\begin{CompactList}\small\item\em Delete the previously allocated event structure. \item\end{CompactList}\item 
unsigned int $\ast$ \hyperlink{event_8c_f924b2fe44aa4bda49541974946114d1}{LSEC\_\-eventGet} (\hyperlink{struct__LSEC__event}{LSEC\_\-event} $\ast$evt)
\begin{CompactList}\small\item\em Get the address of the next stored event. \item\end{CompactList}\item 
void \hyperlink{event_8c_cd78b1641346f4ed318d68e036e5f79a}{LSEC\_\-eventPrepare} (\hyperlink{struct__LSEC__event}{LSEC\_\-event} $\ast$evt)
\begin{CompactList}\small\item\em Prepare for a new run. \item\end{CompactList}\item 
unsigned \hyperlink{event_8c_9f17c7359e0610fe8dbcb33c868192aa}{LSEC\_\-eventProcess} (\hyperlink{struct__LSEC__event}{LSEC\_\-event} $\ast$evt, unsigned int edw, EBF\_\-pkt $\ast$pkt)
\begin{CompactList}\small\item\em Process an event packet. \item\end{CompactList}\item 
void \hyperlink{event_8c_ed1d905c08fc50554e39e280dc714259}{LSEC\_\-eventProcSet} (\hyperlink{struct__LSEC__event}{LSEC\_\-event} $\ast$evt, \hyperlink{LSEC__p_8h_ceefe78efae20f2d0feec10d79684caf}{LSEC\_\-eventProcRtn} $\ast$rtn, void $\ast$parm)
\begin{CompactList}\small\item\em Set the event processing routine to use. \item\end{CompactList}\item 
unsigned int $\ast$ \hyperlink{event_8c_45ce390f5d402310dfd1c7f6325d1861}{LSEC\_\-eventPut} (\hyperlink{struct__LSEC__event}{LSEC\_\-event} $\ast$evt)
\begin{CompactList}\small\item\em Get the address of the next event to store. \item\end{CompactList}\item 
void \hyperlink{event_8c_53cc6db1d2110a772e1142add01e0877}{LSEC\_\-eventRewind} (\hyperlink{struct__LSEC__event}{LSEC\_\-event} $\ast$evt)
\begin{CompactList}\small\item\em Rewind the event store reading to the beginning. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Routines that handle raw event data. 

\begin{Desc}
\item[Author:]Owen Saxton\end{Desc}
{\bf \$Id:} \hyperlink{event_8c}{event.c},v 1.5 2011/03/27 17:47:17 saxton Exp \$ 

\subsection{Enumeration Type Documentation}
\hypertarget{event_8c_dc29c2ff13d900c2f185ee95427fb06c}{
\subsubsection[{"@4}]{\setlength{\rightskip}{0pt plus 5cm}anonymous enum}}
\label{event_8c_dc29c2ff13d900c2f185ee95427fb06c}


Various constants. 

\begin{Desc}
\item[Enumerator: ]\par
\begin{description}
\index{MAX\_\-OVERHEAD\_\-PER\_\-EVENT@{MAX\_\-OVERHEAD\_\-PER\_\-EVENT}!event.c@{event.c}}\index{event.c@{event.c}!MAX\_\-OVERHEAD\_\-PER\_\-EVENT@{MAX\_\-OVERHEAD\_\-PER\_\-EVENT}}\item[{\em 
\hypertarget{event_8c_dc29c2ff13d900c2f185ee95427fb06c6bfd1c3fbdf2b545a5d1bc1dd4533283}{
MAX\_\-OVERHEAD\_\-PER\_\-EVENT}
\label{event_8c_dc29c2ff13d900c2f185ee95427fb06c6bfd1c3fbdf2b545a5d1bc1dd4533283}
}]Maximum fragmentation gives 8 pktHdrs and 8 event descriptor words per KB,. \end{description}
\end{Desc}



\subsection{Function Documentation}
\hypertarget{event_8c_74c11eb498c64ea9102c02cd5e7d200e}{
\index{event.c@{event.c}!LSEC\_\-eventClear@{LSEC\_\-eventClear}}
\index{LSEC\_\-eventClear@{LSEC\_\-eventClear}!event.c@{event.c}}
\subsubsection[{LSEC\_\-eventClear}]{\setlength{\rightskip}{0pt plus 5cm}void LSEC\_\-eventClear ({\bf LSEC\_\-event} $\ast$ {\em evt})}}
\label{event_8c_74c11eb498c64ea9102c02cd5e7d200e}


Clear the stored event data. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em evt}]Pointer to an event structure. \end{description}
\end{Desc}


References \_\-LSEC\_\-event::dir, \_\-LSEC\_\-event::read, \_\-LSEC\_\-event::start, and \_\-LSEC\_\-event::write.

Referenced by LSEC\_\-clearEvent().\hypertarget{event_8c_aad0a8ea7ad8e102cb728f086c0f5b8d}{
\index{event.c@{event.c}!LSEC\_\-eventCreate@{LSEC\_\-eventCreate}}
\index{LSEC\_\-eventCreate@{LSEC\_\-eventCreate}!event.c@{event.c}}
\subsubsection[{LSEC\_\-eventCreate}]{\setlength{\rightskip}{0pt plus 5cm}{\bf LSEC\_\-event}$\ast$ LSEC\_\-eventCreate (int {\em cap}, \/  long long $\ast$ {\em times})}}
\label{event_8c_aad0a8ea7ad8e102cb728f086c0f5b8d}


Create a new event structure. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cap}]The maximum number of events that can be stored.\item[{\em times}]Address of the processing times array.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A pointer to the new event structure, or NULL if there is insufficient memory available. \end{Desc}


References \_\-LSEC\_\-event::blksz, \_\-LSEC\_\-event::end, LSEC\_\-eventDelete(), LSEC\_\-MAX\_\-EVENT\_\-SIZE, MAX\_\-OVERHEAD\_\-PER\_\-EVENT, \_\-LSEC\_\-event::read, \_\-LSEC\_\-event::siv, \_\-LSEC\_\-event::start, \_\-LSEC\_\-event::times, and \_\-LSEC\_\-event::write.

Referenced by LSEC\_\-initialize().\hypertarget{event_8c_a02662052945c47d0daae9d509b8dc33}{
\index{event.c@{event.c}!LSEC\_\-eventDelete@{LSEC\_\-eventDelete}}
\index{LSEC\_\-eventDelete@{LSEC\_\-eventDelete}!event.c@{event.c}}
\subsubsection[{LSEC\_\-eventDelete}]{\setlength{\rightskip}{0pt plus 5cm}void LSEC\_\-eventDelete ({\bf LSEC\_\-event} $\ast$ {\em evt})}}
\label{event_8c_a02662052945c47d0daae9d509b8dc33}


Delete the previously allocated event structure. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em evt}]Pointer to allocated, intialised event structure \end{description}
\end{Desc}


References \_\-LSEC\_\-event::start.

Referenced by LSEC\_\-eventCreate(), and LSEC\_\-terminate().\hypertarget{event_8c_f924b2fe44aa4bda49541974946114d1}{
\index{event.c@{event.c}!LSEC\_\-eventGet@{LSEC\_\-eventGet}}
\index{LSEC\_\-eventGet@{LSEC\_\-eventGet}!event.c@{event.c}}
\subsubsection[{LSEC\_\-eventGet}]{\setlength{\rightskip}{0pt plus 5cm}unsigned int$\ast$ LSEC\_\-eventGet ({\bf LSEC\_\-event} $\ast$ {\em evt})}}
\label{event_8c_f924b2fe44aa4bda49541974946114d1}


Get the address of the next stored event. 

This routine return a pointer to the next event and advances the read pointer.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em evt}]Pointer to an event structure\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Pointer to the next event, or NULL if there are no more events. \end{Desc}


References \_\-LSEC\_\-event::blksz, \_\-LSEC\_\-event::read, and \_\-LSEC\_\-event::write.\hypertarget{event_8c_cd78b1641346f4ed318d68e036e5f79a}{
\index{event.c@{event.c}!LSEC\_\-eventPrepare@{LSEC\_\-eventPrepare}}
\index{LSEC\_\-eventPrepare@{LSEC\_\-eventPrepare}!event.c@{event.c}}
\subsubsection[{LSEC\_\-eventPrepare}]{\setlength{\rightskip}{0pt plus 5cm}void LSEC\_\-eventPrepare ({\bf LSEC\_\-event} $\ast$ {\em evt})}}
\label{event_8c_cd78b1641346f4ed318d68e036e5f79a}


Prepare for a new run. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em evt}]Pointer to allocated, intialised event structure \end{description}
\end{Desc}


References \_\-LSEC\_\-event::count.

Referenced by LSEC\_\-initRun().\hypertarget{event_8c_9f17c7359e0610fe8dbcb33c868192aa}{
\index{event.c@{event.c}!LSEC\_\-eventProcess@{LSEC\_\-eventProcess}}
\index{LSEC\_\-eventProcess@{LSEC\_\-eventProcess}!event.c@{event.c}}
\subsubsection[{LSEC\_\-eventProcess}]{\setlength{\rightskip}{0pt plus 5cm}unsigned LSEC\_\-eventProcess ({\bf LSEC\_\-event} $\ast$ {\em evt}, \/  unsigned int {\em edw}, \/  EBF\_\-pkt $\ast$ {\em pkt})}}
\label{event_8c_9f17c7359e0610fe8dbcb33c868192aa}


Process an event packet. 

This routine is called whenever a new event packet arrives.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em evt}]Pointer to an event structure\item[{\em edw}]Description of the event (a thirty-two bit number that indicates, among other things, errors in the event transmission)\item[{\em pkt}]Pointer to the event packet\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The OR of zero or more of the bits:\begin{itemize}
\item \hyperlink{LSEC_8h_a80313f67e97ae160a5ae3b03292b1bd6e3d0bcd67d4cedff34e5118f663a95e}{LSEC\_\-EVT\_\-FREE} Free the packet\item \hyperlink{LSEC_8h_a80313f67e97ae160a5ae3b03292b1bdc89e347fdb8dde9f617fc63aca9e0b70}{LSEC\_\-EVT\_\-DONE} Event is complete \end{itemize}
\end{Desc}


References \_\-LSEC\_\-event::count, \_\-LSEC\_\-event::dir, LSEC\_\-EVT\_\-DONE, LSEC\_\-TIM\_\-EVT, \_\-LSEC\_\-event::procParm, \_\-LSEC\_\-event::procRtn, \_\-LSEC\_\-event::siv, and \_\-LSEC\_\-event::times.

Referenced by LSEC\_\-processEvent().\hypertarget{event_8c_ed1d905c08fc50554e39e280dc714259}{
\index{event.c@{event.c}!LSEC\_\-eventProcSet@{LSEC\_\-eventProcSet}}
\index{LSEC\_\-eventProcSet@{LSEC\_\-eventProcSet}!event.c@{event.c}}
\subsubsection[{LSEC\_\-eventProcSet}]{\setlength{\rightskip}{0pt plus 5cm}void LSEC\_\-eventProcSet ({\bf LSEC\_\-event} $\ast$ {\em evt}, \/  {\bf LSEC\_\-eventProcRtn} $\ast$ {\em rtn}, \/  void $\ast$ {\em parm})}}
\label{event_8c_ed1d905c08fc50554e39e280dc714259}


Set the event processing routine to use. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em evt}]Pointer to an event structure.\item[{\em rtn}]Pointer to the processing routine.\item[{\em parm}]Parameter to pass to the processing routine. \end{description}
\end{Desc}


References \_\-LSEC\_\-event::procParm, and \_\-LSEC\_\-event::procRtn.

Referenced by LSEC\_\-initRun().\hypertarget{event_8c_45ce390f5d402310dfd1c7f6325d1861}{
\index{event.c@{event.c}!LSEC\_\-eventPut@{LSEC\_\-eventPut}}
\index{LSEC\_\-eventPut@{LSEC\_\-eventPut}!event.c@{event.c}}
\subsubsection[{LSEC\_\-eventPut}]{\setlength{\rightskip}{0pt plus 5cm}unsigned int$\ast$ LSEC\_\-eventPut ({\bf LSEC\_\-event} $\ast$ {\em evt})}}
\label{event_8c_45ce390f5d402310dfd1c7f6325d1861}


Get the address of the next event to store. 

This routine return a pointer to the next event that can be stored and advances the write pointer.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em evt}]Pointer to an event structure\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Pointer to the next event to store, or NULL if the storage area is filled to capacity. \end{Desc}


References \_\-LSEC\_\-event::blksz, \_\-LSEC\_\-event::end, and \_\-LSEC\_\-event::write.

Referenced by LSEC\_\-consEventCal().\hypertarget{event_8c_53cc6db1d2110a772e1142add01e0877}{
\index{event.c@{event.c}!LSEC\_\-eventRewind@{LSEC\_\-eventRewind}}
\index{LSEC\_\-eventRewind@{LSEC\_\-eventRewind}!event.c@{event.c}}
\subsubsection[{LSEC\_\-eventRewind}]{\setlength{\rightskip}{0pt plus 5cm}void LSEC\_\-eventRewind ({\bf LSEC\_\-event} $\ast$ {\em evt})}}
\label{event_8c_53cc6db1d2110a772e1142add01e0877}


Rewind the event store reading to the beginning. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em evt}]Pointer to an event structure. \end{description}
\end{Desc}


References \_\-LSEC\_\-event::read, and \_\-LSEC\_\-event::start.