\hypertarget{ESS_8h}{
\section{ESS.h File Reference}
\label{ESS_8h}\index{ESS.h@{ESS.h}}
}
Interface to the Event Simple Selection utility.  


\subsection*{Typedefs}
\begin{CompactItemize}
\item 
\hypertarget{ESS_8h_4fabf3348f0c5ab025aaa0710c46c2d5}{
typedef struct \_\-ESS\_\-ctl \textbf{ESS\_\-ctl}}
\label{ESS_8h_4fabf3348f0c5ab025aaa0710c46c2d5}

\item 
\hypertarget{ESS_8h_6737e534e7bc893e252c216c33406ebb}{
typedef struct \hyperlink{struct__EBF__dir}{\_\-EBF\_\-dir} \textbf{EBF\_\-dir}}
\label{ESS_8h_6737e534e7bc893e252c216c33406ebb}

\item 
\hypertarget{ESS_8h_aa47a0fa6d38668bda25ac84ef5a2fe5}{
typedef struct \hyperlink{struct__EDS__fwIxb}{\_\-EDS\_\-fwIxb} \textbf{EDS\_\-fwIxb}}
\label{ESS_8h_aa47a0fa6d38668bda25ac84ef5a2fe5}

\item 
\hypertarget{ESS_8h_98cba3a8e277c49afdfbb50f08863d4c}{
typedef enum \hyperlink{ESS_8h_c4f7860638718a6208964bf6daf6d8e4}{\_\-ESS\_\-logic} \hyperlink{ESS_8h_98cba3a8e277c49afdfbb50f08863d4c}{ESS\_\-logic}}
\label{ESS_8h_98cba3a8e277c49afdfbb50f08863d4c}

\begin{CompactList}\small\item\em Typedef for enum \_\-ESS\_\-logic. \item\end{CompactList}\end{CompactItemize}
\subsection*{Enumerations}
\begin{CompactItemize}
\item 
enum \hyperlink{ESS_8h_c4f7860638718a6208964bf6daf6d8e4}{\_\-ESS\_\-logic} \{ \par
\hyperlink{ESS_8h_c4f7860638718a6208964bf6daf6d8e405fee82e6f6620672d126ae6ceb78eb5}{ESS\_\-LOGIC\_\-K\_\-OR} =  0, 
\par
\hyperlink{ESS_8h_c4f7860638718a6208964bf6daf6d8e48a8364368e9b77803d008cddf9283fc7}{ESS\_\-LOGIC\_\-K\_\-AND} =  1
 \}
\begin{CompactList}\small\item\em Identifies the logic used when using multiple selectors as either OR (the default) or AND. \item\end{CompactList}\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
int \hyperlink{ESS_8h_45aaa5af9ddf1f0fcd221583de37cfc0}{ESS\_\-sizeof} (void)
\begin{CompactList}\small\item\em Returns the size, in bytes, of the ESS control structure. \item\end{CompactList}\item 
void \hyperlink{ESS_8h_3e761f1b028458707bccbb7b9c2f5b70}{ESS\_\-construct} (ESS\_\-ctl $\ast$ess)
\begin{CompactList}\small\item\em Constructs (initializes) the ESS control structure. \item\end{CompactList}\item 
int \hyperlink{ESS_8h_f62f179dda914f9cfc78fd0ed8cfbb75}{ESS\_\-parse\_\-cond} (ESS\_\-ctl $\ast$ess, const char $\ast$s)
\begin{CompactList}\small\item\em Parses the string for the trigger condition specification. \item\end{CompactList}\item 
int \hyperlink{ESS_8h_95d8999ccfebf7f0383099e8af54a4ef}{ESS\_\-parse\_\-dgn} (ESS\_\-ctl $\ast$ess, const char $\ast$s)
\begin{CompactList}\small\item\em Parses the specified input string {\em s\/}, for a diagnostic selection. \item\end{CompactList}\item 
int \hyperlink{ESS_8h_5ae010fe2a7534677d7dd121fe55e3f8}{ESS\_\-parse\_\-err} (ESS\_\-ctl $\ast$ess, const char $\ast$s)
\begin{CompactList}\small\item\em Parses the specified input string {\em s\/}, for an error selection. \item\end{CompactList}\item 
int \hyperlink{ESS_8h_ee6b135eb35c35da881985e87397f68c}{ESS\_\-parse\_\-pkt} (ESS\_\-ctl $\ast$ess, const char $\ast$s)
\begin{CompactList}\small\item\em Parses the specified input string {\em s\/}, for a packet range. \item\end{CompactList}\item 
int \hyperlink{ESS_8h_65d01f149fdabd9c967f029ee46eb2be}{ESS\_\-parse\_\-readout} (ESS\_\-ctl $\ast$ess, const char $\ast$s)
\begin{CompactList}\small\item\em Parses the input string, extracting a readout mask. \item\end{CompactList}\item 
int \hyperlink{ESS_8h_c8e78487644b5935adc4ffacaa37da04}{ESS\_\-parse\_\-size} (ESS\_\-ctl $\ast$ess, const char $\ast$s)
\begin{CompactList}\small\item\em Parses the specified input string {\em s\/}, for a packet range. \item\end{CompactList}\item 
int \hyperlink{ESS_8h_99807c540562da91a712845d6385ea1c}{ESS\_\-set\_\-logic} (ESS\_\-ctl $\ast$ess, \hyperlink{ESS_8h_98cba3a8e277c49afdfbb50f08863d4c}{ESS\_\-logic} logic)
\begin{CompactList}\small\item\em Currently just sets the evaluation condition to the 'AND'. \item\end{CompactList}\item 
int \hyperlink{ESS_8h_1e5fb6003ab48d1a5bc7e70b3712711d}{ESS\_\-select} (ESS\_\-ctl $\ast$ess, const \hyperlink{struct__EBF__dir}{EBF\_\-dir} $\ast$dir, unsigned int npkts, unsigned int nbytes)
\begin{CompactList}\small\item\em Evaluates to the filter status. \item\end{CompactList}\end{CompactItemize}
\subsection*{Variables}
\begin{CompactItemize}
\item 
\hypertarget{ESS_8h_3ead8355a32aeb49ee12566e9f437044}{
const char \hyperlink{ESS_8h_3ead8355a32aeb49ee12566e9f437044}{ESS\_\-usage\_\-cond} \mbox{[}$\,$\mbox{]}}
\label{ESS_8h_3ead8355a32aeb49ee12566e9f437044}

\begin{CompactList}\small\item\em String for defining a GEM Pattern Condition specifier. This is meant to be used when reporting the usage of this specifier. \item\end{CompactList}\item 
\hypertarget{ESS_8h_1a2d9d7a13083f10362def4b0bf7a7f2}{
const char \hyperlink{ESS_8h_1a2d9d7a13083f10362def4b0bf7a7f2}{ESS\_\-usage\_\-range} \mbox{[}$\,$\mbox{]}}
\label{ESS_8h_1a2d9d7a13083f10362def4b0bf7a7f2}

\begin{CompactList}\small\item\em String for defining a range specifier. This is meant to be used when reporting the usage of this specifier. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Interface to the Event Simple Selection utility. 

\begin{Desc}
\item[Author:]JJRussell - \href{mailto:russell@slac.stanford.edu}{\tt russell@slac.stanford.edu}\end{Desc}


\footnotesize\begin{verbatim}

   CVS $Id: ESS.h,v 1.1 2007/02/14 01:06:38 russell Exp $
\end{verbatim}
\normalsize


This provides a utility to setup and use a simple event selector. The selection criteria are base on very simple quantities that available once an event directory has been formed. These include things like selection on

\begin{enumerate}
\item The number of packets in an event\item The size of an event\item The readout mode (single/four-range, zero/non-zero suppressed)\item The GEM trigger conditions\item The presence of diagnostic or error blocks \end{enumerate}


\subsection{Enumeration Type Documentation}
\hypertarget{ESS_8h_c4f7860638718a6208964bf6daf6d8e4}{
\index{ESS.h@{ESS.h}!\_\-ESS\_\-logic@{\_\-ESS\_\-logic}}
\index{\_\-ESS\_\-logic@{\_\-ESS\_\-logic}!ESS.h@{ESS.h}}
\subsubsection[{\_\-ESS\_\-logic}]{\setlength{\rightskip}{0pt plus 5cm}enum {\bf \_\-ESS\_\-logic}}}
\label{ESS_8h_c4f7860638718a6208964bf6daf6d8e4}


Identifies the logic used when using multiple selectors as either OR (the default) or AND. 

\begin{Desc}
\item[Enumerator: ]\par
\begin{description}
\index{ESS\_\-LOGIC\_\-K\_\-OR@{ESS\_\-LOGIC\_\-K\_\-OR}!ESS.h@{ESS.h}}\index{ESS.h@{ESS.h}!ESS\_\-LOGIC\_\-K\_\-OR@{ESS\_\-LOGIC\_\-K\_\-OR}}\item[{\em 
\hypertarget{ESS_8h_c4f7860638718a6208964bf6daf6d8e405fee82e6f6620672d126ae6ceb78eb5}{
ESS\_\-LOGIC\_\-K\_\-OR}
\label{ESS_8h_c4f7860638718a6208964bf6daf6d8e405fee82e6f6620672d126ae6ceb78eb5}
}]Use the OR of the select criteria, ie. any \index{ESS\_\-LOGIC\_\-K\_\-AND@{ESS\_\-LOGIC\_\-K\_\-AND}!ESS.h@{ESS.h}}\index{ESS.h@{ESS.h}!ESS\_\-LOGIC\_\-K\_\-AND@{ESS\_\-LOGIC\_\-K\_\-AND}}\item[{\em 
\hypertarget{ESS_8h_c4f7860638718a6208964bf6daf6d8e48a8364368e9b77803d008cddf9283fc7}{
ESS\_\-LOGIC\_\-K\_\-AND}
\label{ESS_8h_c4f7860638718a6208964bf6daf6d8e48a8364368e9b77803d008cddf9283fc7}
}]Use the AND of the select criteria, ie. all \end{description}
\end{Desc}



\subsection{Function Documentation}
\hypertarget{ESS_8h_3e761f1b028458707bccbb7b9c2f5b70}{
\index{ESS.h@{ESS.h}!ESS\_\-construct@{ESS\_\-construct}}
\index{ESS\_\-construct@{ESS\_\-construct}!ESS.h@{ESS.h}}
\subsubsection[{ESS\_\-construct}]{\setlength{\rightskip}{0pt plus 5cm}void ESS\_\-construct (ESS\_\-ctl $\ast$ {\em ess})}}
\label{ESS_8h_3e761f1b028458707bccbb7b9c2f5b70}


Constructs (initializes) the ESS control structure. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ess}]The control structure to initialize \end{description}
\end{Desc}


References ESS\_\-LOGIC\_\-K\_\-OR.\hypertarget{ESS_8h_f62f179dda914f9cfc78fd0ed8cfbb75}{
\index{ESS.h@{ESS.h}!ESS\_\-parse\_\-cond@{ESS\_\-parse\_\-cond}}
\index{ESS\_\-parse\_\-cond@{ESS\_\-parse\_\-cond}!ESS.h@{ESS.h}}
\subsubsection[{ESS\_\-parse\_\-cond}]{\setlength{\rightskip}{0pt plus 5cm}int ESS\_\-parse\_\-cond (ESS\_\-ctl $\ast$ {\em ess}, \/  const char $\ast$ {\em s})}}
\label{ESS_8h_f62f179dda914f9cfc78fd0ed8cfbb75}


Parses the string for the trigger condition specification. 

\begin{Desc}
\item[Returns:]The trigger condition filter word\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ess}]The control structure to fill \item[{\em s}]The string to parse.\end{description}
\end{Desc}
\begin{Desc}
\item[Syntax of the string ]A form of a string is $<$logic\_\-specifier$>$$<$list of trigger condition specifiers$>$\end{Desc}
\begin{Desc}
\item[List of trigger condition specifiers]The trigger condition specifiers are\begin{itemize}
\item r Region of interest (throttle tracker trigger)\item t 3-in-a-row\item l CAL lo\item h CAL hi\item c CNO\item p Periodic\item s Solicited\item e External\end{itemize}
\end{Desc}
\begin{Desc}
\item[]The specifiers may be specified in the positive (must be present) or negative (must be absent) sense. A string of positive specifiers is introduced by a {\em +\/} and a string of negative specifiers is introduced by a {\em -\/}. By default, the initial string starts as a string of positive identifiers.\end{Desc}
\begin{Desc}
\item[Logic]If the string begins with \end{Desc}
\begin{Desc}
\item[List of trigger condition specifiers]This string to parse comes in in three forms\end{Desc}
\begin{itemize}
\item {\em \/}:, True if the AND of the condition specifiers and the actual trigger conditions matches the comparison set. This effectively treats the specifiers not mentioned as don't care.\item {\em =\/}, True if the list of the specified trigger conditions and the actual trigger conditions are an exact match. In this case the default comparison set is the complete set.\item otherwise, True if the OR of the specified conditions specifiers and the actual trigger conditions is non-zero. In this case the concept of a comparison set is unnecessary\end{itemize}


\begin{Desc}
\item[Limitations]In order to keep the interface simply, arbitrary combinations cannot be specified with the syntax above.\end{Desc}
\begin{Desc}
\item[Examples]\begin{enumerate}
\item Clh\par
 Allow any event with either CAL LO or CAL HI present\end{enumerate}
\end{Desc}
\begin{enumerate}
\item Cl-h\par
 Allow any event with either CAL LO present or CAL HI absent\end{enumerate}


\begin{enumerate}
\item C:lh\par
 Allow any event with both CAL LO and CAL HI present\end{enumerate}


\begin{enumerate}
\item C=lh\par
 Allow any event with only CAL LO and CAL HI present \end{enumerate}


References OPT\_\-M\_\-COND.\hypertarget{ESS_8h_95d8999ccfebf7f0383099e8af54a4ef}{
\index{ESS.h@{ESS.h}!ESS\_\-parse\_\-dgn@{ESS\_\-parse\_\-dgn}}
\index{ESS\_\-parse\_\-dgn@{ESS\_\-parse\_\-dgn}!ESS.h@{ESS.h}}
\subsubsection[{ESS\_\-parse\_\-dgn}]{\setlength{\rightskip}{0pt plus 5cm}int ESS\_\-parse\_\-dgn (ESS\_\-ctl $\ast$ {\em ess}, \/  const char $\ast$ {\em s})}}
\label{ESS_8h_95d8999ccfebf7f0383099e8af54a4ef}


Parses the specified input string {\em s\/}, for a diagnostic selection. 

\begin{Desc}
\item[Returns:]Parsing status, 0 if succesful\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ess}]The control structure to fill \item[{\em s}]The string to parse. If NULL, the diagnostic selection defaults to any contributor \end{description}
\end{Desc}


References OPT\_\-M\_\-DGN.\hypertarget{ESS_8h_5ae010fe2a7534677d7dd121fe55e3f8}{
\index{ESS.h@{ESS.h}!ESS\_\-parse\_\-err@{ESS\_\-parse\_\-err}}
\index{ESS\_\-parse\_\-err@{ESS\_\-parse\_\-err}!ESS.h@{ESS.h}}
\subsubsection[{ESS\_\-parse\_\-err}]{\setlength{\rightskip}{0pt plus 5cm}int ESS\_\-parse\_\-err (ESS\_\-ctl $\ast$ {\em ess}, \/  const char $\ast$ {\em s})}}
\label{ESS_8h_5ae010fe2a7534677d7dd121fe55e3f8}


Parses the specified input string {\em s\/}, for an error selection. 

\begin{Desc}
\item[Returns:]Parsing status, 0 if succesful\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ess}]The control structure to fill \item[{\em s}]The string to parse. If NULL, the error selection defaults to any contributor \end{description}
\end{Desc}


References OPT\_\-M\_\-ERR.\hypertarget{ESS_8h_ee6b135eb35c35da881985e87397f68c}{
\index{ESS.h@{ESS.h}!ESS\_\-parse\_\-pkt@{ESS\_\-parse\_\-pkt}}
\index{ESS\_\-parse\_\-pkt@{ESS\_\-parse\_\-pkt}!ESS.h@{ESS.h}}
\subsubsection[{ESS\_\-parse\_\-pkt}]{\setlength{\rightskip}{0pt plus 5cm}int ESS\_\-parse\_\-pkt (ESS\_\-ctl $\ast$ {\em ess}, \/  const char $\ast$ {\em s})}}
\label{ESS_8h_ee6b135eb35c35da881985e87397f68c}


Parses the specified input string {\em s\/}, for a packet range. 

\begin{Desc}
\item[Returns:]Parsing status, 0 if succesful\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ess}]The control structure to fill, see the documentation for get\_\-range on the allowed syntax of {\em s\/}. \item[{\em s}]The string to parse \end{description}
\end{Desc}


References get\_\-range(), and OPT\_\-M\_\-PKT.\hypertarget{ESS_8h_65d01f149fdabd9c967f029ee46eb2be}{
\index{ESS.h@{ESS.h}!ESS\_\-parse\_\-readout@{ESS\_\-parse\_\-readout}}
\index{ESS\_\-parse\_\-readout@{ESS\_\-parse\_\-readout}!ESS.h@{ESS.h}}
\subsubsection[{ESS\_\-parse\_\-readout}]{\setlength{\rightskip}{0pt plus 5cm}int ESS\_\-parse\_\-readout (ESS\_\-ctl $\ast$ {\em ess}, \/  const char $\ast$ {\em s})}}
\label{ESS_8h_65d01f149fdabd9c967f029ee46eb2be}


Parses the input string, extracting a readout mask. 

\begin{Desc}
\item[Returns:]The readout mask\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ess}]The control structure to fill, see the documentation for get\_\-range on the allowed syntax of {\em s\/}. \item[{\em s}]The input string, consisting of up to 4 characters\begin{itemize}
\item z permit events with zero-suppression enabled\item n permit events with zero-suppression disabled\item 4 permit events in four range readout mode\item 1 permit events in single range readout mode\end{itemize}
\end{description}
\end{Desc}
If neither {\em z\/} or {\em n\/} are specified, it is as if both are specified If neither {\em 4\/} or {\em 1\/} are specified, it is as if both are specified 

References ALLOW\_\-M\_\-1, ALLOW\_\-M\_\-4, ALLOW\_\-M\_\-N, ALLOW\_\-M\_\-Z, OPT\_\-M\_\-READOUT, RO\_\-M\_\-ALL, RO\_\-M\_\-FOUR, RO\_\-M\_\-NS, RO\_\-M\_\-NS\_\-FOUR, RO\_\-M\_\-NS\_\-SINGLE, RO\_\-M\_\-SINGLE, RO\_\-M\_\-ZS, RO\_\-M\_\-ZS\_\-FOUR, and RO\_\-M\_\-ZS\_\-SINGLE.\hypertarget{ESS_8h_c8e78487644b5935adc4ffacaa37da04}{
\index{ESS.h@{ESS.h}!ESS\_\-parse\_\-size@{ESS\_\-parse\_\-size}}
\index{ESS\_\-parse\_\-size@{ESS\_\-parse\_\-size}!ESS.h@{ESS.h}}
\subsubsection[{ESS\_\-parse\_\-size}]{\setlength{\rightskip}{0pt plus 5cm}int ESS\_\-parse\_\-size (ESS\_\-ctl $\ast$ {\em ess}, \/  const char $\ast$ {\em s})}}
\label{ESS_8h_c8e78487644b5935adc4ffacaa37da04}


Parses the specified input string {\em s\/}, for a packet range. 

\begin{Desc}
\item[Returns:]Parsing status, 0 if succesful\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ess}]The control structure to fill, see the documentation for get\_\-range on the allowed syntax of {\em s\/}. \item[{\em s}]The string to parse \end{description}
\end{Desc}


References get\_\-range(), and OPT\_\-M\_\-SIZE.\hypertarget{ESS_8h_1e5fb6003ab48d1a5bc7e70b3712711d}{
\index{ESS.h@{ESS.h}!ESS\_\-select@{ESS\_\-select}}
\index{ESS\_\-select@{ESS\_\-select}!ESS.h@{ESS.h}}
\subsubsection[{ESS\_\-select}]{\setlength{\rightskip}{0pt plus 5cm}int ESS\_\-select (ESS\_\-ctl $\ast$ {\em ess}, \/  const {\bf EBF\_\-dir} $\ast$ {\em dir}, \/  unsigned int {\em npkts}, \/  unsigned int {\em nbytes})}}
\label{ESS_8h_1e5fb6003ab48d1a5bc7e70b3712711d}


Evaluates to the filter status. 

\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em 0,does}]not pass \item[{\em 1,passes}]\end{description}
\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ess}]The selection parameters \item[{\em dir}]The EBF directory structure \item[{\em npkts}]The number of packets in this event. This is relevant if and only if the OPT\_\-M\_\-PKT selection option is active. \item[{\em nbytes}]The number of bytes in this event. This is relevant if and only if the OPT\_\-M\_\-SIZE selection option is active. \end{description}
\end{Desc}


References \_\-EBF\_\-gem::condsumCno, \_\-EBF\_\-dirRedux::dgn\_\-ids, EBF\_\-\_\-gemLocate(), EBF\_\-GEM\_\-DEADCONDCNO\_\-EXTRACT, \_\-EBF\_\-dirRedux::err\_\-ids, ESS\_\-LOGIC\_\-K\_\-OR, \_\-EBF\_\-dir::evt, \_\-EBF\_\-dirRedux::nosup\_\-ids, OPT\_\-M\_\-COND, OPT\_\-M\_\-DGN, OPT\_\-M\_\-ERR, OPT\_\-M\_\-FILTER, OPT\_\-M\_\-PKT, OPT\_\-M\_\-READOUT, OPT\_\-M\_\-SIZE, \_\-EBF\_\-dir::redux, and \_\-EBF\_\-dirRedux::rng\_\-ids.\hypertarget{ESS_8h_99807c540562da91a712845d6385ea1c}{
\index{ESS.h@{ESS.h}!ESS\_\-set\_\-logic@{ESS\_\-set\_\-logic}}
\index{ESS\_\-set\_\-logic@{ESS\_\-set\_\-logic}!ESS.h@{ESS.h}}
\subsubsection[{ESS\_\-set\_\-logic}]{\setlength{\rightskip}{0pt plus 5cm}int ESS\_\-set\_\-logic (ESS\_\-ctl $\ast$ {\em ess}, \/  {\bf ESS\_\-logic} {\em logic})}}
\label{ESS_8h_99807c540562da91a712845d6385ea1c}


Currently just sets the evaluation condition to the 'AND'. 

\begin{Desc}
\item[Returns:]Parsing status, 0 if succesful\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ess}]The control structure to fill \item[{\em logic}]The string to parse. Currently unused, should be specified as NULL \end{description}
\end{Desc}
\hypertarget{ESS_8h_45aaa5af9ddf1f0fcd221583de37cfc0}{
\index{ESS.h@{ESS.h}!ESS\_\-sizeof@{ESS\_\-sizeof}}
\index{ESS\_\-sizeof@{ESS\_\-sizeof}!ESS.h@{ESS.h}}
\subsubsection[{ESS\_\-sizeof}]{\setlength{\rightskip}{0pt plus 5cm}int ESS\_\-sizeof (void)}}
\label{ESS_8h_45aaa5af9ddf1f0fcd221583de37cfc0}


Returns the size, in bytes, of the ESS control structure. 

\begin{Desc}
\item[Returns:]The size, in bytes, of the ESS control structure. \end{Desc}
