\hypertarget{GFC_8c}{
\section{GFC.c File Reference}
\label{GFC_8c}\index{GFC.c@{GFC.c}}
}
Gamma Filter Code. 

{\tt \#include \char`\"{}EFC/EDM.h\char`\"{}}\par
{\tt \#include \char`\"{}EFC/EFC\_\-eds\-Fw.h\char`\"{}}\par
{\tt \#include \char`\"{}EFC/EFC.h\char`\"{}}\par
{\tt \#include \char`\"{}EFC/GFC.h\char`\"{}}\par
{\tt \#include \char`\"{}EFC/GFC\_\-cfg.h\char`\"{}}\par
{\tt \#include \char`\"{}EFC/GFC\_\-status.h\char`\"{}}\par
{\tt \#include \char`\"{}EFC/TFC\_\-prj\-Find.h\char`\"{}}\par
{\tt \#include \char`\"{}EFC/TFC\_\-prj\-Def.h\char`\"{}}\par
{\tt \#include \char`\"{}EFC/TFC\_\-tolerances.h\char`\"{}}\par
{\tt \#include \char`\"{}EFC/TFC\_\-geometry.h\char`\"{}}\par
{\tt \#include \char`\"{}TFC\_\-geometry\-Def.h\char`\"{}}\par
{\tt \#include \char`\"{}GFC\_\-def.h\char`\"{}}\par
{\tt \#include \char`\"{}GFC\_\-result\-Def.h\char`\"{}}\par
{\tt \#include \char`\"{}ATF\_\-filter.h\char`\"{}}\par
{\tt \#include \char`\"{}ATF\_\-shadowed\-Towers.ih\char`\"{}}\par
{\tt \#include \char`\"{}AFC\_\-splash.h\char`\"{}}\par
{\tt \#include \char`\"{}CFC\_\-ratio.h\char`\"{}}\par
{\tt \#include \char`\"{}TFC\_\-tolerances\-Def.h\char`\"{}}\par
{\tt \#include \char`\"{}TFC\_\-trigger\-Fill.h\char`\"{}}\par
{\tt \#include \char`\"{}TFC\_\-trigger\-Form.h\char`\"{}}\par
{\tt \#include \char`\"{}TFC\_\-trigger\-Sorted\-Form.h\char`\"{}}\par
{\tt \#include \char`\"{}TFC\_\-acd.h\char`\"{}}\par
{\tt \#include \char`\"{}TFC\_\-skirt.h\char`\"{}}\par
{\tt \#include \char`\"{}EDS/EDS\_\-fw.h\char`\"{}}\par
{\tt \#include \char`\"{}EDS/EBF\_\-cid.h\char`\"{}}\par
{\tt \#include \char`\"{}EDS/EBF\_\-acd.h\char`\"{}}\par
{\tt \#include \char`\"{}EDS/EBF\_\-gem.h\char`\"{}}\par
{\tt \#include \char`\"{}EDS/EBF\_\-tkr.h\char`\"{}}\par
{\tt \#include \char`\"{}EDS/EBF\_\-dir.h\char`\"{}}\par
{\tt \#include \char`\"{}EDS/EBF\_\-cal\-Energy.h\char`\"{}}\par
{\tt \#include \char`\"{}EDS/EBF\_\-gem\-Locate.h\char`\"{}}\par
{\tt \#include \char`\"{}EDS/ECR\_\-cal.h\char`\"{}}\par
{\tt \#include \char`\"{}EDS/EDR\_\-cal.h\char`\"{}}\par
{\tt \#include \char`\"{}EDS/EDR\_\-tkr.h\char`\"{}}\par
{\tt \#include \char`\"{}EDS/EDR\_\-cal\-Unpack.h\char`\"{}}\par
{\tt \#include \char`\"{}EDS/EDR\_\-tkr\-Unpack.h\char`\"{}}\par
{\tt \#include \char`\"{}GEO\_\-DB/GEO\_\-DB\_\-schema.h\char`\"{}}\par
{\tt \#include \char`\"{}GFC\_\-DB/GFC\_\-DB\_\-schema.h\char`\"{}}\par
{\tt \#include \char`\"{}CDM/CDM\_\-pubdefs.h\char`\"{}}\par
{\tt \#include $<$string.h$>$}\par


Include dependency graph for GFC.c:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=317pt]{GFC_8c__incl}
\end{center}
\end{figure}
\subsection*{Defines}
\begin{CompactItemize}
\item 
\#define \hyperlink{GFC_8c_a0}{\_\-MOVE\_\-BIT}(\_\-w, \_\-from, \_\-to)~(((\_\-w $>$$>$ \_\-from) \& 1) $<$$<$ \_\-to)
\begin{CompactList}\small\item\em Moves a bit from one location to another. \item\end{CompactList}\item 
\#define \hyperlink{GFC_8c_a1}{MASK0\_\-4\_\-OF\_\-6}
\begin{CompactList}\small\item\em A bit mask to be ordered with the dynamic 4/6 coincidence mask. Only patterns with 4/6 layers set are selected by this mask. This is the first of 2 32-bit words, representing patterns 0-0x1f. \item\end{CompactList}\item 
\#define \hyperlink{GFC_8c_a2}{MASK1\_\-4\_\-OF\_\-6}
\begin{CompactList}\small\item\em A bit mask to be ordered with the dynamic 4/6 coincidence mask. Only patterns with 4/6 layers set are selected by this mask. This is the second of 2 32-bit words, representing patterns 0x20-0x3f. \item\end{CompactList}\end{CompactItemize}
\subsection*{Typedefs}
\begin{CompactItemize}
\item 
\hypertarget{GFC_8c_a5}{
typedef enum \hyperlink{GFC_8c_a35}{\_\-ACD\_\-SIDE\_\-TILES\_\-M} \hyperlink{GFC_8c_a5}{ACD\_\-SIDE\_\-TILES\_\-M}}
\label{GFC_8c_a5}

\begin{CompactList}\small\item\em Typedef for enum \_\-ACD\_\-SIDE\_\-TILES\_\-M. \item\end{CompactList}\end{CompactItemize}
\subsection*{Enumerations}
\begin{CompactItemize}
\item 
enum \hyperlink{GFC_8c_a35}{\_\-ACD\_\-SIDE\_\-TILES\_\-M} \{ \par
\hyperlink{GFC_8c_a35a6}{ACD\_\-SIDE\_\-TILES\_\-M\_\-ROW} =  (0x1f $<$$<$ 16) $|$ (0x1f), 
\par
\hyperlink{GFC_8c_a35a7}{ACD\_\-SIDE\_\-TILES\_\-M\_\-ROW0} =  ACD\_\-SIDE\_\-TILES\_\-M\_\-ROW$<$$<$(0$\ast$5), 
\par
\hyperlink{GFC_8c_a35a8}{ACD\_\-SIDE\_\-TILES\_\-M\_\-ROW1} =  ACD\_\-SIDE\_\-TILES\_\-M\_\-ROW$<$$<$(1$\ast$5), 
\par
\hyperlink{GFC_8c_a35a9}{ACD\_\-SIDE\_\-TILES\_\-M\_\-ROW2} =  ACD\_\-SIDE\_\-TILES\_\-M\_\-ROW$<$$<$(2$\ast$5), 
\par
\hyperlink{GFC_8c_a35a10}{ACD\_\-SIDE\_\-TILES\_\-M\_\-ROW01} =  ACD\_\-SIDE\_\-TILES\_\-M\_\-ROW0 $|$ ACD\_\-SIDE\_\-TILES\_\-M\_\-ROW1, 
\par
\hyperlink{GFC_8c_a35a11}{ACD\_\-SIDE\_\-TILES\_\-M\_\-ROW3} =  0x80008000
 \}
\begin{CompactList}\small\item\em Enumerates the bit masks used to extract the struck tiles in various rows for both the + and - ACD side tile planes. \item\end{CompactList}\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
static \_\-\_\-inline int \hyperlink{GFC_8c_a12}{is\-Vetoed} (unsigned int status, unsigned int vetoes)
\begin{CompactList}\small\item\em Checks whether any of the veto bits are up. \item\end{CompactList}\item 
static \_\-\_\-inline unsigned int \hyperlink{GFC_8c_a13}{cnt\-Bits} (unsigned int word)
\begin{CompactList}\small\item\em Counts the bits in the specified word. \item\end{CompactList}\item 
static \_\-\_\-inline int \hyperlink{GFC_8c_a14}{evaluate\-Acd} (const \hyperlink{struct__GammaCfgAcd}{Gamma\-Cfg\-Acd} $\ast$cfg, int status, int energy, unsigned int acd\_\-x, unsigned int acd\_\-y, unsigned int acd\_\-z, unsigned int acd\_\-cnt)
\begin{CompactList}\small\item\em Rejects events based on CAL energy and ACD info. \item\end{CompactList}\item 
static \_\-\_\-inline int \hyperlink{GFC_8c_a15}{evaluate\-Zbottom} (const \hyperlink{struct__GammaCfgZbottom}{Gamma\-Cfg\-Zbottom} $\ast$cfg, int energy, const EBF\_\-dir $\ast$dir)
\begin{CompactList}\small\item\em Makes a quick test to see if there is energy in the CAL without the possibility of a track pointing into it. \item\end{CompactList}\item 
static \_\-\_\-inline int \hyperlink{GFC_8c_a16}{evaluate\-Cal} (const \hyperlink{struct__GammaCfgCal}{Gamma\-Cfg\-Cal} $\ast$cfg, int energy, EBF\_\-dir $\ast$dir, EDR\_\-cal $\ast$cal, const ECR\_\-cal $\ast$cal\-Cal)
\begin{CompactList}\small\item\em Evaluates cuts that can be made solely on the basis of the CAL information. \item\end{CompactList}\item 
static \_\-\_\-inline int \hyperlink{GFC_8c_a17}{evaluate\-Atf} (const \hyperlink{struct__GammaCfgAtf}{Gamma\-Cfg\-Atf} $\ast$cfg, int energy, unsigned int acd\_\-x, unsigned int acd\_\-y, unsigned int acd\_\-z, unsigned int tmsk, const EBF\_\-dir\-Ctb\-Dsc $\ast$contributor)
\begin{CompactList}\small\item\em Evaluates whether any tower with a track trigger is in coincidence with a shadowing ACD tile. \item\end{CompactList}\item 
static \_\-\_\-inline int \hyperlink{GFC_8c_a18}{classify\-Acd} (unsigned int acd\_\-x, unsigned int acd\_\-y, unsigned int acd\_\-z)
\begin{CompactList}\small\item\em Sets status bits indicating which part of the ACD has hits. return A status mask indicating those parts of the ACD which have hits. \item\end{CompactList}\item 
static \_\-\_\-inline int \hyperlink{GFC_8c_a19}{nominate\-Towers} (const EBF\_\-dir $\ast$dir)
\begin{CompactList}\small\item\em Creates a list of towers with the potential for finding tracks in. \item\end{CompactList}\item 
static \_\-\_\-inline int \hyperlink{GFC_8c_a20}{constrain\-Energy} (int energy)
\begin{CompactList}\small\item\em Limits the absolute value of the energy to be $<$ 23 bits. \item\end{CompactList}\item 
static unsigned int \hyperlink{GFC_8c_a21}{tkr\-Filter} (const \hyperlink{struct__GammaCfgTkr}{Gamma\-Cfg\-Tkr} $\ast$cfg, int energy, unsigned int acd\_\-x, unsigned int acd\_\-y, unsigned int acd\_\-z, unsigned int vetoes, EDR\_\-tkr $\ast$tlr, \hyperlink{struct__TFC__prjs}{TFC\_\-prjs} $\ast$prjs)
\begin{CompactList}\small\item\em Performs the most computationally intensive portions of the filtering. This involves TKR pattern recognition and matching to the ACD, skirt region and CAL. \item\end{CompactList}\item 
static unsigned int \hyperlink{GFC_8c_a22}{tkr\-Find} (const \hyperlink{struct__GammaCfgTkr}{Gamma\-Cfg\-Tkr} $\ast$cfg, int energy, EBF\_\-dir $\ast$dir, EDR\_\-tkr $\ast$tlr, \hyperlink{struct__TFC__prjs}{TFC\_\-prjs} $\ast$prjs)
\begin{CompactList}\small\item\em Does the track finding. \item\end{CompactList}\item 
static \_\-\_\-inline unsigned int \hyperlink{GFC_8c_a23}{tkr\-Set\-Status} (const \hyperlink{struct__GammaCfgTkr}{Gamma\-Cfg\-Tkr} $\ast$cfg, int energy, int prj\-Cnt)
\begin{CompactList}\small\item\em Completes tracker status, by evaluating the projection count. \item\end{CompactList}\item 
static \_\-\_\-inline int \hyperlink{GFC_8c_a24}{evaluate\-Tkr} (const \hyperlink{struct__GammaCfgTkr}{Gamma\-Cfg\-Tkr} $\ast$cfg, int energy, unsigned int acd\_\-x, unsigned int acd\_\-y, unsigned int acd\_\-z, unsigned int vetoes, EBF\_\-dir $\ast$dir, EDR\_\-tkr $\ast$tkr, \hyperlink{struct__TFC__prjs}{TFC\_\-prjs} $\ast$prjs)
\begin{CompactList}\small\item\em Does the projection finding and evaluates all the cuts based on the found projections. \item\end{CompactList}\item 
static \_\-\_\-inline int \hyperlink{GFC_8c_a25}{gamma\-Filter} (\hyperlink{struct__GFC}{GFC} $\ast$gfc, unsigned int pkt\-Bytes, EBF\_\-pkt $\ast$pkt, EBF\_\-siv siv, EDS\_\-fw\-Ixb $\ast$ixb, unsigned int vetoes, \hyperlink{struct__GFC__result}{GFC\_\-result} $\ast$result)
\begin{CompactList}\small\item\em Determines the fate of 1 event. \item\end{CompactList}\item 
static int \hyperlink{GFC_8c_a26}{compile\-Cfg\-Prms} (\hyperlink{struct__GammaCfgPrms}{Gamma\-Cfg\-Prms} $\ast$cfg, const GFC\_\-DB\_\-prms $\ast$prms)
\begin{CompactList}\small\item\em Compiles/commits the set of user defined parameters into the the configuration block. \item\end{CompactList}\item 
int \hyperlink{GFC_8c_a27}{GFC\_\-sizeof} (int cnt)
\begin{CompactList}\small\item\em Sizes the gamma filtering control structure. \item\end{CompactList}\item 
int \hyperlink{GFC_8c_a28}{GFC\_\-cfg\-Sizeof} (void)
\begin{CompactList}\small\item\em Sizes the gamma filtering configuration as it is used in the actual filtering progam. \item\end{CompactList}\item 
int \hyperlink{GFC_8c_a29}{GFC\_\-result\-Sizeof} (const \hyperlink{struct__GFC}{GFC} $\ast$gfc)
\begin{CompactList}\small\item\em Returns the size, in bytes, of one result vector. \item\end{CompactList}\item 
int \hyperlink{GFC_8c_a30}{GFC\_\-cfg\-Compile} (\hyperlink{struct__GFC__cfg}{GFC\_\-cfg} $\ast$cfg, const GFC\_\-DB\_\-prms $\ast$prms)
\begin{CompactList}\small\item\em Implements the transformation of the configuration parameters as specified by the user, {\em cfg\/}, into the internal form, {\em ctl\-Cfg\/}. \item\end{CompactList}\item 
\hyperlink{struct__GFC__cfg}{GFC\_\-cfg} $\ast$ \hyperlink{GFC_8c_a31}{GFC\_\-cfg\-Set} (\hyperlink{struct__GFC}{GFC} $\ast$gfc, \hyperlink{struct__GFC__cfg}{GFC\_\-cfg} $\ast$cfg)
\begin{CompactList}\small\item\em Makes the specified internal representation of the configuration parameters the current active one. \item\end{CompactList}\item 
int \hyperlink{GFC_8c_a32}{GFC\_\-filter} (\hyperlink{struct__GFC}{GFC} $\ast$gfc, unsigned int pkt\-Bytes, EBF\_\-pkt $\ast$pkt, EBF\_\-siv siv, EDS\_\-fw\-Ixb $\ast$ixb, unsigned int vetoes, \hyperlink{struct__GFC__result}{GFC\_\-result} $\ast$result)
\begin{CompactList}\small\item\em Determines the fate of 1 event. \item\end{CompactList}\item 
unsigned int \hyperlink{GFC_8c_a33}{GFC\_\-fw\-Needs} (void)
\begin{CompactList}\small\item\em Returns a bit mask of the EDS\_\-fw needs. \item\end{CompactList}\item 
unsigned int \hyperlink{GFC_8c_a34}{GFC\_\-fw\-Objects} (void)
\begin{CompactList}\small\item\em Returns a bit mask of the EDS\_\-fw objects used by the gamma filter. \item\end{CompactList}\end{CompactItemize}
\subsection*{Variables}
\begin{CompactItemize}
\item 
\hypertarget{GFC_8c_a3}{
const \hyperlink{struct__AFC__splashMap}{AFC\_\-splash\-Map} \hyperlink{GFC_8c_a3}{AFC\_\-Splash\-Map1x1}}
\label{GFC_8c_a3}

\begin{CompactList}\small\item\em Data structure representing the Splash\-Map with only nearest neighbors considered to be 'near' tiles. \item\end{CompactList}\item 
\hypertarget{GFC_8c_a4}{
const \hyperlink{struct__ATF__shadowedTowers}{ATF\_\-shadowed\-Towers} {\bf ATF\_\-Shadowed\-Towers2x2}}
\label{GFC_8c_a4}

\end{CompactItemize}


\subsection{Detailed Description}
Gamma Filter Code. 

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


\footnotesize\begin{verbatim}   CVS $Id: GFC.c,v 1.11 2007/12/13 18:10:30 russell Exp $
\end{verbatim}
\normalsize


\subsection{Define Documentation}
\hypertarget{GFC_8c_a0}{
\index{GFC.c@{GFC.c}!_MOVE_BIT@{\_\-MOVE\_\-BIT}}
\index{_MOVE_BIT@{\_\-MOVE\_\-BIT}!GFC.c@{GFC.c}}
\subsubsection[\_\-MOVE\_\-BIT]{\setlength{\rightskip}{0pt plus 5cm}\#define \_\-MOVE\_\-BIT(\_\-w, \_\-from, \_\-to)~(((\_\-w $>$$>$ \_\-from) \& 1) $<$$<$ \_\-to)}}
\label{GFC_8c_a0}


Moves a bit from one location to another. 

\begin{Desc}
\item[Returns:]A new 32-bit word with the specified bit set to the value of the {\em \_\-from\/} bit in the original word.\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-w}]The word to move the bit from \item[{\em \_\-from}]The bit position (LSB = 0) to extract the bit from \item[{\em \_\-to}]The bit position (LSB = 0) to move the bit to\end{description}
\end{Desc}
\hypertarget{GFC_8c_a1}{
\index{GFC.c@{GFC.c}!MASK0_4_OF_6@{MASK0\_\-4\_\-OF\_\-6}}
\index{MASK0_4_OF_6@{MASK0\_\-4\_\-OF\_\-6}!GFC.c@{GFC.c}}
\subsubsection[MASK0\_\-4\_\-OF\_\-6]{\setlength{\rightskip}{0pt plus 5cm}\#define MASK0\_\-4\_\-OF\_\-6}}
\label{GFC_8c_a1}


{\bf Value:}

\footnotesize\begin{verbatim}((0 << 0x00) | (0 << 0x01) | (0 << 0x02) | (0 << 0x03) | \
  (0 << 0x04) | (0 << 0x05) | (0 << 0x06) | (0 << 0x07) | \
  (0 << 0x08) | (0 << 0x09) | (0 << 0x0a) | (0 << 0x0b) | \
  (0 << 0x0c) | (0 << 0x0d) | (0 << 0x0e) | (1 << 0x0f) | \
  (0 << 0x10) | (0 << 0x11) | (0 << 0x12) | (0 << 0x13) | \
  (0 << 0x14) | (0 << 0x15) | (0 << 0x16) | (1 << 0x17) | \
  (0 << 0x18) | (0 << 0x19) | (0 << 0x1a) | (1 << 0x1b) | \
  (0 << 0x1c) | (1 << 0x1d) | (1 << 0x1e) | (1 << 0x1f))
\end{verbatim}\normalsize 
A bit mask to be ordered with the dynamic 4/6 coincidence mask. Only patterns with 4/6 layers set are selected by this mask. This is the first of 2 32-bit words, representing patterns 0-0x1f. 

\hypertarget{GFC_8c_a2}{
\index{GFC.c@{GFC.c}!MASK1_4_OF_6@{MASK1\_\-4\_\-OF\_\-6}}
\index{MASK1_4_OF_6@{MASK1\_\-4\_\-OF\_\-6}!GFC.c@{GFC.c}}
\subsubsection[MASK1\_\-4\_\-OF\_\-6]{\setlength{\rightskip}{0pt plus 5cm}\#define MASK1\_\-4\_\-OF\_\-6}}
\label{GFC_8c_a2}


{\bf Value:}

\footnotesize\begin{verbatim}((0 << 0x00) | (0 << 0x01) | (0 << 0x02) | (0 << 0x03) | \
  (0 << 0x04) | (0 << 0x05) | (0 << 0x06) | (1 << 0x07) | \
  (0 << 0x08) | (0 << 0x09) | (0 << 0x0a) | (1 << 0x0b) | \
  (0 << 0x0c) | (1 << 0x0d) | (1 << 0x0e) | (1 << 0x0f) | \
  (0 << 0x10) | (0 << 0x11) | (0 << 0x12) | (1 << 0x13) | \
  (0 << 0x14) | (1 << 0x15) | (1 << 0x16) | (1 << 0x17) | \
  (0 << 0x18) | (1 << 0x19) | (1 << 0x1a) | (1 << 0x1b) | \
  (1 << 0x1c) | (1 << 0x1d) | (1 << 0x1e) | (1 << 0x1f))
\end{verbatim}\normalsize 
A bit mask to be ordered with the dynamic 4/6 coincidence mask. Only patterns with 4/6 layers set are selected by this mask. This is the second of 2 32-bit words, representing patterns 0x20-0x3f. 

The bits representing the last 6 layers are extracted from the X/Y layer hit masks and placed in the low 6 bits or a new word. This word can take on the values 0x00 to 0x3f (0-63).

If the value of this word is less than 32, then MASK0\_\-4\_\-OF\_\-6 is used. That is, of the low 5 bits, 4 must be set.

If the value of this word is greater than or equal to 32, then MASK1\_\-4\_\-OF\_\-6 is used. That is, of the remaining low 5 bits, 3 must be set.

\subsection{Enumeration Type Documentation}
\hypertarget{GFC_8c_a35}{
\index{GFC.c@{GFC.c}!_ACD_SIDE_TILES_M@{\_\-ACD\_\-SIDE\_\-TILES\_\-M}}
\index{_ACD_SIDE_TILES_M@{\_\-ACD\_\-SIDE\_\-TILES\_\-M}!GFC.c@{GFC.c}}
\subsubsection[\_\-ACD\_\-SIDE\_\-TILES\_\-M]{\setlength{\rightskip}{0pt plus 5cm}enum \hyperlink{GFC_8c_a35}{\_\-ACD\_\-SIDE\_\-TILES\_\-M}}}
\label{GFC_8c_a35}


Enumerates the bit masks used to extract the struck tiles in various rows for both the + and - ACD side tile planes. 

\begin{Desc}
\item[Enumerator: ]\par
\begin{description}
\index{ACD_SIDE_TILES_M_ROW@{ACD\_\-SIDE\_\-TILES\_\-M\_\-ROW}!GFC.c@{GFC.c}}\index{GFC.c@{GFC.c}!ACD_SIDE_TILES_M_ROW@{ACD\_\-SIDE\_\-TILES\_\-M\_\-ROW}}\item[{\em 
\hypertarget{GFC_8c_a35a6}{
ACD\_\-SIDE\_\-TILES\_\-M\_\-ROW}
\label{GFC_8c_a35a6}
}]Primitive bit mask for 1 5 tile row of ACD side tiles \index{ACD_SIDE_TILES_M_ROW0@{ACD\_\-SIDE\_\-TILES\_\-M\_\-ROW0}!GFC.c@{GFC.c}}\index{GFC.c@{GFC.c}!ACD_SIDE_TILES_M_ROW0@{ACD\_\-SIDE\_\-TILES\_\-M\_\-ROW0}}\item[{\em 
\hypertarget{GFC_8c_a35a7}{
ACD\_\-SIDE\_\-TILES\_\-M\_\-ROW0}
\label{GFC_8c_a35a7}
}]Row 0 ACD side tiles, bit mask \index{ACD_SIDE_TILES_M_ROW1@{ACD\_\-SIDE\_\-TILES\_\-M\_\-ROW1}!GFC.c@{GFC.c}}\index{GFC.c@{GFC.c}!ACD_SIDE_TILES_M_ROW1@{ACD\_\-SIDE\_\-TILES\_\-M\_\-ROW1}}\item[{\em 
\hypertarget{GFC_8c_a35a8}{
ACD\_\-SIDE\_\-TILES\_\-M\_\-ROW1}
\label{GFC_8c_a35a8}
}]Row 1 ACD side tiles, bit mask \index{ACD_SIDE_TILES_M_ROW2@{ACD\_\-SIDE\_\-TILES\_\-M\_\-ROW2}!GFC.c@{GFC.c}}\index{GFC.c@{GFC.c}!ACD_SIDE_TILES_M_ROW2@{ACD\_\-SIDE\_\-TILES\_\-M\_\-ROW2}}\item[{\em 
\hypertarget{GFC_8c_a35a9}{
ACD\_\-SIDE\_\-TILES\_\-M\_\-ROW2}
\label{GFC_8c_a35a9}
}]Row 2 ACD side tiles, bit mask \index{ACD_SIDE_TILES_M_ROW01@{ACD\_\-SIDE\_\-TILES\_\-M\_\-ROW01}!GFC.c@{GFC.c}}\index{GFC.c@{GFC.c}!ACD_SIDE_TILES_M_ROW01@{ACD\_\-SIDE\_\-TILES\_\-M\_\-ROW01}}\item[{\em 
\hypertarget{GFC_8c_a35a10}{
ACD\_\-SIDE\_\-TILES\_\-M\_\-ROW01}
\label{GFC_8c_a35a10}
}]Rows 0 and 1 ACD side tiles, bit mask \index{ACD_SIDE_TILES_M_ROW3@{ACD\_\-SIDE\_\-TILES\_\-M\_\-ROW3}!GFC.c@{GFC.c}}\index{GFC.c@{GFC.c}!ACD_SIDE_TILES_M_ROW3@{ACD\_\-SIDE\_\-TILES\_\-M\_\-ROW3}}\item[{\em 
\hypertarget{GFC_8c_a35a11}{
ACD\_\-SIDE\_\-TILES\_\-M\_\-ROW3}
\label{GFC_8c_a35a11}
}]Row 3 ACD side tiles, bit mask \end{description}
\end{Desc}



\subsection{Function Documentation}
\hypertarget{GFC_8c_a18}{
\index{GFC.c@{GFC.c}!classifyAcd@{classifyAcd}}
\index{classifyAcd@{classifyAcd}!GFC.c@{GFC.c}}
\subsubsection[classifyAcd]{\setlength{\rightskip}{0pt plus 5cm}static \_\-\_\-inline int classify\-Acd (unsigned int {\em acd\_\-x}, unsigned int {\em acd\_\-y}, unsigned int {\em acd\_\-z})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{GFC_8c_a18}


Sets status bits indicating which part of the ACD has hits. return A status mask indicating those parts of the ACD which have hits. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em acd\_\-x}]The struck tiles in the ACD X face. \item[{\em acd\_\-y}]The struck tiles in the ACD Y face. \item[{\em acd\_\-z}]The struck tiles in the ACD Z (top) face.\end{description}
\end{Desc}
\begin{Desc}
\item[]The ACD is considered to be 3 logical pieces. The top 25 tiles are consider one piece; all the rows of the side faces are another, and only the lower 2 rows of the side faces are the third. A bit is set for each of these three areas which have a hit. Note that these are not mutually exclusive.\end{Desc}
\hypertarget{GFC_8c_a13}{
\index{GFC.c@{GFC.c}!cntBits@{cntBits}}
\index{cntBits@{cntBits}!GFC.c@{GFC.c}}
\subsubsection[cntBits]{\setlength{\rightskip}{0pt plus 5cm}static \_\-\_\-inline unsigned int cnt\-Bits (unsigned int {\em word})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{GFC_8c_a13}


Counts the bits in the specified word. 

\begin{Desc}
\item[Returns:]The number of bits in the specified word. \end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em word}]The word to count the bits in\end{description}
\end{Desc}
\hypertarget{GFC_8c_a26}{
\index{GFC.c@{GFC.c}!compileCfgPrms@{compileCfgPrms}}
\index{compileCfgPrms@{compileCfgPrms}!GFC.c@{GFC.c}}
\subsubsection[compileCfgPrms]{\setlength{\rightskip}{0pt plus 5cm}static int compile\-Cfg\-Prms (\hyperlink{struct__GammaCfgPrms}{Gamma\-Cfg\-Prms} $\ast$ {\em cfg}, const GFC\_\-DB\_\-prms $\ast$ {\em prms})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{GFC_8c_a26}


Compiles/commits the set of user defined parameters into the the configuration block. 

\begin{Desc}
\item[Returns:]0 is success, -1 if failure\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cfg}]The destination parameter configuration block \item[{\em prms}]The set of user configuration parameters\end{description}
\end{Desc}
\hypertarget{GFC_8c_a20}{
\index{GFC.c@{GFC.c}!constrainEnergy@{constrainEnergy}}
\index{constrainEnergy@{constrainEnergy}!GFC.c@{GFC.c}}
\subsubsection[constrainEnergy]{\setlength{\rightskip}{0pt plus 5cm}static \_\-\_\-inline int constrain\-Energy (int {\em energy})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{GFC_8c_a20}


Limits the absolute value of the energy to be $<$ 23 bits. 

\begin{Desc}
\item[Returns:]The constrained energy\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em energy}]The energy to constrain\end{description}
\end{Desc}
This code is a little obscure, but it was the only way I could get the gcc compiler to generate efficient code when the energy is within range, by far the most common case.

This takes advantage of the take that if the energy is within range, the bit positions not within the range are either all 0s or all 1s. This is check in done by shifting those bits off the left end then shifting the result back down. Since the right shift drags the sign bit through, if the energy is within range, the result will be the same.

If the answer is not the same, the code merely has to check whether the energy is positive or negative. That tells one which end of the range the energy has exceeded.\hypertarget{GFC_8c_a14}{
\index{GFC.c@{GFC.c}!evaluateAcd@{evaluateAcd}}
\index{evaluateAcd@{evaluateAcd}!GFC.c@{GFC.c}}
\subsubsection[evaluateAcd]{\setlength{\rightskip}{0pt plus 5cm}static \_\-\_\-inline int evaluate\-Acd (const \hyperlink{struct__GammaCfgAcd}{Gamma\-Cfg\-Acd} $\ast$ {\em cfg}, int {\em status}, int {\em energy}, unsigned int {\em acd\_\-x}, unsigned int {\em acd\_\-y}, unsigned int {\em acd\_\-z}, unsigned int {\em acd\_\-cnt})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{GFC_8c_a14}


Rejects events based on CAL energy and ACD info. 

\begin{Desc}
\item[Returns:]The status, possibly augmented with the status indicating no energy in the CAL and a struck tile veto.\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cfg}]The configuration constants for this routine \item[{\em status}]The current status of this event. \item[{\em energy}]The total energy deposited in the CAL. \item[{\em acd\_\-x}]The ACD X side face tiles that are struck. \item[{\em acd\_\-y}]The ACD Y side face tiles that are struck. \item[{\em acd\_\-z}]The ACD Z TOP face tiles that are struck. \item[{\em acd\_\-cnt}]The count of struck ACD tiles.\end{description}
\end{Desc}
Events that have no significant energy deposited in the CAL must be completely quiet in the ACD.\hypertarget{GFC_8c_a17}{
\index{GFC.c@{GFC.c}!evaluateAtf@{evaluateAtf}}
\index{evaluateAtf@{evaluateAtf}!GFC.c@{GFC.c}}
\subsubsection[evaluateAtf]{\setlength{\rightskip}{0pt plus 5cm}static \_\-\_\-inline int evaluate\-Atf (const \hyperlink{struct__GammaCfgAtf}{Gamma\-Cfg\-Atf} $\ast$ {\em cfg}, int {\em energy}, unsigned int {\em acd\_\-x}, unsigned int {\em acd\_\-y}, unsigned int {\em acd\_\-z}, unsigned int {\em tmsk}, const EBF\_\-dir\-Ctb\-Dsc $\ast$ {\em contributor})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{GFC_8c_a17}


Evaluates whether any tower with a track trigger is in coincidence with a shadowing ACD tile. 

\begin{Desc}
\item[Returns:]Status bits\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cfg}]The configuration parameters for this routine \item[{\em energy}]The energy, in LEUs, of the event.. \item[{\em acd\_\-x}]The bit mask of struck tiles in the X+/X- side face. \item[{\em acd\_\-y}]The bit mask of struck tiles in the Y+/Y- side face. \item[{\em acd\_\-z}]The bit mask of struck tiles in the Z top face. \item[{\em tmsk}]Bit mask giving the towers with TKR hits (TWR 0 = MSB) \item[{\em contributor}]The array of tower contributors.\end{description}
\end{Desc}
\hypertarget{GFC_8c_a16}{
\index{GFC.c@{GFC.c}!evaluateCal@{evaluateCal}}
\index{evaluateCal@{evaluateCal}!GFC.c@{GFC.c}}
\subsubsection[evaluateCal]{\setlength{\rightskip}{0pt plus 5cm}static \_\-\_\-inline int evaluate\-Cal (const \hyperlink{struct__GammaCfgCal}{Gamma\-Cfg\-Cal} $\ast$ {\em cfg}, int {\em energy}, EBF\_\-dir $\ast$ {\em dir}, EDR\_\-cal $\ast$ {\em cal}, const ECR\_\-cal $\ast$ {\em cal\-Cal})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{GFC_8c_a16}


Evaluates cuts that can be made solely on the basis of the CAL information. 

\begin{Desc}
\item[Returns:]Status\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cfg}]The configuration constants for this routine \item[{\em energy}]The total energy of the event \item[{\em dir}]The event directory \item[{\em cal}]The CAL data structure \item[{\em cal\-Cal}]The CAL calibration constants\end{description}
\end{Desc}
\begin{Desc}
\item[]This routine makes a simple check based on the energy balance between its layer 0 and the total energy.\end{Desc}
\begin{Desc}
\item[]The routine depends only on the CAL being minimally unpacked, to the point that the energy in each layer is known.\end{Desc}
\begin{Desc}
\item[Note:]At one time a more complicated check on the ratio of the number of logs above a fraction of the total energy to the number total logs was made. This code was removed from active service when the increase in bandwidth allowed more events to taken. This cut was deemed to brutal on the number of gammas in comparison with its rejection power.\end{Desc}
\hypertarget{GFC_8c_a24}{
\index{GFC.c@{GFC.c}!evaluateTkr@{evaluateTkr}}
\index{evaluateTkr@{evaluateTkr}!GFC.c@{GFC.c}}
\subsubsection[evaluateTkr]{\setlength{\rightskip}{0pt plus 5cm}static \_\-\_\-inline int evaluate\-Tkr (const \hyperlink{struct__GammaCfgTkr}{Gamma\-Cfg\-Tkr} $\ast$ {\em cfg}, int {\em energy}, unsigned int {\em acd\_\-x}, unsigned int {\em acd\_\-y}, unsigned int {\em acd\_\-z}, unsigned int {\em vetoes}, EBF\_\-dir $\ast$ {\em dir}, EDR\_\-tkr $\ast$ {\em tkr}, \hyperlink{struct__TFC__prjs}{TFC\_\-prjs} $\ast$ {\em prjs})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{GFC_8c_a24}


Does the projection finding and evaluates all the cuts based on the found projections. 

\begin{Desc}
\item[Returns:]Status mask\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cfg}]The tracker cut criteria \item[{\em energy}]The energy of the event \item[{\em acd\_\-x}]The struck tiles in the planes normal to the X axis \item[{\em acd\_\-y}]The struck tiles in the planes normal to the Y axis \item[{\em acd\_\-z}]The struck tiles in the planes normal to the Z axis better known as the top plane \item[{\em vetoes}]A bit mask of the active veto conditions \item[{\em dir}]The event directory \item[{\em tkr}]The structure to hold the unpacked TKR data \item[{\em prjs}]The structure to hold the found projections\end{description}
\end{Desc}
\hypertarget{GFC_8c_a15}{
\index{GFC.c@{GFC.c}!evaluateZbottom@{evaluateZbottom}}
\index{evaluateZbottom@{evaluateZbottom}!GFC.c@{GFC.c}}
\subsubsection[evaluateZbottom]{\setlength{\rightskip}{0pt plus 5cm}static \_\-\_\-inline int evaluate\-Zbottom (const \hyperlink{struct__GammaCfgZbottom}{Gamma\-Cfg\-Zbottom} $\ast$ {\em cfg}, int {\em energy}, const EBF\_\-dir $\ast$ {\em dir})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{GFC_8c_a15}


Makes a quick test to see if there is energy in the CAL without the possibility of a track pointing into it. 

\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em 0}]If there is no energy in the calorimeter or there is a possibility of a track pointing at the energy \item[{\em GFC\_\-STATUS\_\-M\_\-ZBOTTOM}]If there is energy in the calorimeter and there is no possibility of a track pointing at it.\end{description}
\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cfg}]The configuration constants for this routine \item[{\em energy}]The energy in the calorimeter \item[{\em dir}]The directory of event contributors\end{description}
\end{Desc}
\begin{Desc}
\item[]The check is deliberately crude so that it is extremely cheap. The bit masks of the hit layers for each tower are examined to see if there is even the remotest possibility of extending a track into the calorimeter. Currently 4 or the last 6 planes must have hits in them.\end{Desc}
\hypertarget{GFC_8c_a25}{
\index{GFC.c@{GFC.c}!gammaFilter@{gammaFilter}}
\index{gammaFilter@{gammaFilter}!GFC.c@{GFC.c}}
\subsubsection[gammaFilter]{\setlength{\rightskip}{0pt plus 5cm}static \_\-\_\-inline int gamma\-Filter (\hyperlink{struct__GFC}{GFC} $\ast$ {\em gfc}, unsigned int {\em pkt\-Bytes}, EBF\_\-pkt $\ast$ {\em pkt}, EBF\_\-siv {\em siv}, EDS\_\-fw\-Ixb $\ast$ {\em ixb}, unsigned int {\em vetoes}, \hyperlink{struct__GFC__result}{GFC\_\-result} $\ast$ {\em result})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{GFC_8c_a25}


Determines the fate of 1 event. 

\begin{Desc}
\item[Returns:]Status mask, if the\begin{itemize}
\item $<$ 0, reject\item = 0, no decision\item $>$ 0, accept\end{itemize}
\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em gfc}]The gamma filter control structure \item[{\em pkt\-Bytes}]The number of bytes in {\em pkt\/}, includes the packet header \item[{\em pkt}]The event data packet \item[{\em siv}]The packet's state information vector \item[{\em ixb}]The information exchange block \item[{\em vetoes}]The list of active vetoes \item[{\em result}]The filter result vector\end{description}
\end{Desc}
\hypertarget{GFC_8c_a30}{
\index{GFC.c@{GFC.c}!GFC_cfgCompile@{GFC\_\-cfgCompile}}
\index{GFC_cfgCompile@{GFC\_\-cfgCompile}!GFC.c@{GFC.c}}
\subsubsection[GFC\_\-cfgCompile]{\setlength{\rightskip}{0pt plus 5cm}int GFC\_\-cfg\-Compile (\hyperlink{struct__GFC__cfg}{GFC\_\-cfg} $\ast$ {\em cfg}, const GFC\_\-DB\_\-prms $\ast$ {\em prms})}}
\label{GFC_8c_a30}


Implements the transformation of the configuration parameters as specified by the user, {\em cfg\/}, into the internal form, {\em ctl\-Cfg\/}. 

\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em 0}]Successful \item[{\em -1}]Unrecognized or non-backwardly compatiable user configuration version number.\end{description}
\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cfg}]Filled in with the internal form of the configuration parameters \item[{\em prms}]The user form of the configuration parameters\end{description}
\end{Desc}
\hypertarget{GFC_8c_a31}{
\index{GFC.c@{GFC.c}!GFC_cfgSet@{GFC\_\-cfgSet}}
\index{GFC_cfgSet@{GFC\_\-cfgSet}!GFC.c@{GFC.c}}
\subsubsection[GFC\_\-cfgSet]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{struct__GFC__cfg}{GFC\_\-cfg}$\ast$ GFC\_\-cfg\-Set (\hyperlink{struct__GFC}{GFC} $\ast$ {\em gfc}, \hyperlink{struct__GFC__cfg}{GFC\_\-cfg} $\ast$ {\em cfg})}}
\label{GFC_8c_a31}


Makes the specified internal representation of the configuration parameters the current active one. 

\begin{Desc}
\item[Returns:]Pointer to the current control configuration parameters\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em gfc}]The gamma filter control structure \item[{\em cfg}]The internal representation of the configuration constants\end{description}
\end{Desc}
\hypertarget{GFC_8c_a28}{
\index{GFC.c@{GFC.c}!GFC_cfgSizeof@{GFC\_\-cfgSizeof}}
\index{GFC_cfgSizeof@{GFC\_\-cfgSizeof}!GFC.c@{GFC.c}}
\subsubsection[GFC\_\-cfgSizeof]{\setlength{\rightskip}{0pt plus 5cm}int GFC\_\-cfg\-Sizeof (void)}}
\label{GFC_8c_a28}


Sizes the gamma filtering configuration as it is used in the actual filtering progam. 

\begin{Desc}
\item[Returns:]Returns the size of the gamma filtering configuration control structure\end{Desc}
\begin{Desc}
\item[]There are two different breeds of the filtering configuration structure. There are two reasons for this. The more familar is the configuration structure that the user fills in. This structure is meant to be convenient for the user, but not for the program. Some of the information in the user structure is transformed into data that the program will find more accessible.\end{Desc}
\begin{Desc}
\item[]The second reason is that by having a user configuration and an internal configuration, the two can evolve separately. If more parameters are added to the filter, they will find a home in the internal structure. At some time they may be exposed to the user. The correct course of action is to define a new version of the user configuration block. Since the version number is carried along with the configuration constants, the routine transforming the user configuration to its internal representation can evolve and can be made to handle older versions of the user configuration parameters with some degree of grace, at least giving some hope to backward compatibility.\end{Desc}
\begin{Desc}
\item[]The correct usage model is 

\footnotesize\begin{verbatim}       ctlCfg = malloc (GFC_cfgSizeof ());
       status = GFC_cfgCompile (cfg, usrPrms);
       GFC_cfgSet (gfc, cfg);
\end{verbatim}
\normalsize
\end{Desc}
\begin{Desc}
\item[Note:]Because the 'set routine just seeds a pointer to the user configuration, in the control structure. the user is free to swap it out with any other pre-prepared configuration.\end{Desc}
\hypertarget{GFC_8c_a32}{
\index{GFC.c@{GFC.c}!GFC_filter@{GFC\_\-filter}}
\index{GFC_filter@{GFC\_\-filter}!GFC.c@{GFC.c}}
\subsubsection[GFC\_\-filter]{\setlength{\rightskip}{0pt plus 5cm}int GFC\_\-filter (\hyperlink{struct__GFC}{GFC} $\ast$ {\em gfc}, unsigned int {\em pkt\-Bytes}, EBF\_\-pkt $\ast$ {\em pkt}, EBF\_\-siv {\em siv}, EDS\_\-fw\-Ixb $\ast$ {\em ixb}, unsigned int {\em vetoes}, \hyperlink{struct__GFC__result}{GFC\_\-result} $\ast$ {\em result})}}
\label{GFC_8c_a32}


Determines the fate of 1 event. 

\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em $<$}]0, rejected \item[{\em ==0,undecided}]\item[{\em $>$}]0, accepted\end{description}
\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em gfc}]The gamma filter control structure \item[{\em pkt\-Bytes}]The number of bytes in {\em pkt\/}, includes the packet header \item[{\em pkt}]The event data packet \item[{\em siv}]The packet's state information vector \item[{\em ixb}]The information exchange block \item[{\em vetoes}]The active vetoes \item[{\em result}]The filter result vector\end{description}
\end{Desc}
\begin{Desc}
\item[Overview]This acts as a wrapper of the actual filter. This is were the sampling logic is implemented by the use prescalers. A prescaler is defined by a pair of integers; one giving the current countdown value and the other giving the refresh value. When the countdown value reaches 0, the prescaler is said to expire.\end{Desc}
\begin{Desc}
\item[Types of prescaling]There are two kinds of samplings allow.\end{Desc}
\begin{enumerate}
\item Pass-thru sampling\item Individual veto sampling\end{enumerate}


\begin{Desc}
\item[Pass-Thru Sampling]Conceptually this is the easiest to understand. When the pass-thru prescaler expires, instead of using the normal veto mask, a 0 is used, effectively causing the filter to evaluate all its cuts but not allowing an cut to veto the event. While easy to understand, the event sample leaked through by this technique will be dominated by events that would normally have been rejected by the very early cuts.\end{Desc}
\begin{Desc}
\item[Individual Veto Sampling]This prescaler type allows to ignore the reject decision of each veto bit. While a bit harder to understand than the Pass-Thru Sampling, this technique allows one to tap a predetermined percentage of events failing at each cut. The hope is that one will be a statisitically meaningful sample of events that would have normally failed some of the later cuts in the filter.\end{Desc}
\hypertarget{GFC_8c_a33}{
\index{GFC.c@{GFC.c}!GFC_fwNeeds@{GFC\_\-fwNeeds}}
\index{GFC_fwNeeds@{GFC\_\-fwNeeds}!GFC.c@{GFC.c}}
\subsubsection[GFC\_\-fwNeeds]{\setlength{\rightskip}{0pt plus 5cm}unsigned int GFC\_\-fw\-Needs (void)}}
\label{GFC_8c_a33}


Returns a bit mask of the EDS\_\-fw needs. 

\begin{Desc}
\item[Returns:]A bit mask of the EDS\_\-fw needs\end{Desc}
\begin{Desc}
\item[Use]This value should be passed to EDS\_\-fw\-Register when registering the filter.\end{Desc}
\hypertarget{GFC_8c_a34}{
\index{GFC.c@{GFC.c}!GFC_fwObjects@{GFC\_\-fwObjects}}
\index{GFC_fwObjects@{GFC\_\-fwObjects}!GFC.c@{GFC.c}}
\subsubsection[GFC\_\-fwObjects]{\setlength{\rightskip}{0pt plus 5cm}unsigned int GFC\_\-fw\-Objects (void)}}
\label{GFC_8c_a34}


Returns a bit mask of the EDS\_\-fw objects used by the gamma filter. 

\begin{Desc}
\item[Returns:]A bit mask of the EDS\_\-fw needs\end{Desc}
\begin{Desc}
\item[Use]This value should be passed to EDS\_\-fw\-Register when registering the filter.\end{Desc}
\hypertarget{GFC_8c_a29}{
\index{GFC.c@{GFC.c}!GFC_resultSizeof@{GFC\_\-resultSizeof}}
\index{GFC_resultSizeof@{GFC\_\-resultSizeof}!GFC.c@{GFC.c}}
\subsubsection[GFC\_\-resultSizeof]{\setlength{\rightskip}{0pt plus 5cm}int GFC\_\-result\-Sizeof (const \hyperlink{struct__GFC}{GFC} $\ast$ {\em gfc})}}
\label{GFC_8c_a29}


Returns the size, in bytes, of one result vector. 

\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em The}]size, in bytes, of one result vector\end{description}
\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em gfc}]The configuration control structure\end{description}
\end{Desc}
\hypertarget{GFC_8c_a27}{
\index{GFC.c@{GFC.c}!GFC_sizeof@{GFC\_\-sizeof}}
\index{GFC_sizeof@{GFC\_\-sizeof}!GFC.c@{GFC.c}}
\subsubsection[GFC\_\-sizeof]{\setlength{\rightskip}{0pt plus 5cm}int GFC\_\-sizeof (int {\em cnt})}}
\label{GFC_8c_a27}


Sizes the gamma filtering control structure. 

\begin{Desc}
\item[Returns:]Returns the size of the gamma filtering control structure\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cnt}]Number of configurations to accommodate\end{description}
\end{Desc}
\hypertarget{GFC_8c_a12}{
\index{GFC.c@{GFC.c}!isVetoed@{isVetoed}}
\index{isVetoed@{isVetoed}!GFC.c@{GFC.c}}
\subsubsection[isVetoed]{\setlength{\rightskip}{0pt plus 5cm}static \_\-\_\-inline int is\-Vetoed (unsigned int {\em status}, unsigned int {\em vetoes})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{GFC_8c_a12}


Checks whether any of the veto bits are up. 

\begin{Desc}
\item[Returns:]Non-zero if the {\em status\/} bits contain any of the veto bits.\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em status}]The current set of status bits \item[{\em vetoes}]The set of veto bits\end{description}
\end{Desc}
\hypertarget{GFC_8c_a19}{
\index{GFC.c@{GFC.c}!nominateTowers@{nominateTowers}}
\index{nominateTowers@{nominateTowers}!GFC.c@{GFC.c}}
\subsubsection[nominateTowers]{\setlength{\rightskip}{0pt plus 5cm}static \_\-\_\-inline int nominate\-Towers (const EBF\_\-dir $\ast$ {\em dir})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{GFC_8c_a19}


Creates a list of towers with the potential for finding tracks in. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em dir}]The event directory \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The upper 16 bits contain a mask of the towers with at least a 6 fold coincidence, the lower 16 bits contain a mask of the towers with a 4 fold coincidence. They are exclusive, that is if the tower has a 6 fold coincidence, the 4 fold coincidence is not also set.\end{Desc}
\hypertarget{GFC_8c_a21}{
\index{GFC.c@{GFC.c}!tkrFilter@{tkrFilter}}
\index{tkrFilter@{tkrFilter}!GFC.c@{GFC.c}}
\subsubsection[tkrFilter]{\setlength{\rightskip}{0pt plus 5cm}static unsigned int tkr\-Filter (const \hyperlink{struct__GammaCfgTkr}{Gamma\-Cfg\-Tkr} $\ast$ {\em cfg}, int {\em energy}, unsigned int {\em acd\_\-x}, unsigned int {\em acd\_\-y}, unsigned int {\em acd\_\-z}, unsigned int {\em vetoes}, EDR\_\-tkr $\ast$ {\em tlr}, \hyperlink{struct__TFC__prjs}{TFC\_\-prjs} $\ast$ {\em prjs})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{GFC_8c_a21}


Performs the most computationally intensive portions of the filtering. This involves TKR pattern recognition and matching to the ACD, skirt region and CAL. 

\begin{Desc}
\item[Returns:]A summary status bit mask\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cfg}]The tracker configuration and cut criteria \item[{\em energy}]The total energy in the CAL \item[{\em acd\_\-x}]The bit pattern of struck tiles in the side X+/X- planes \item[{\em acd\_\-y}]The bit pattern of struck tiles in the side Y+/Y- planes \item[{\em acd\_\-z}]The bit pattern of struck tiles in the top Z plane \item[{\em vetoes}]The bit mask of vetoes. If, at any time in this routine a veto bit is added that matches in this word, the routine is aborted. \item[{\em tlr}]The unpacked tracker data for the entire LAT \item[{\em prjs}]Filled in with the projections for this event\end{description}
\end{Desc}
\hypertarget{GFC_8c_a22}{
\index{GFC.c@{GFC.c}!tkrFind@{tkrFind}}
\index{tkrFind@{tkrFind}!GFC.c@{GFC.c}}
\subsubsection[tkrFind]{\setlength{\rightskip}{0pt plus 5cm}static unsigned int tkr\-Find (const \hyperlink{struct__GammaCfgTkr}{Gamma\-Cfg\-Tkr} $\ast$ {\em cfg}, int {\em energy}, EBF\_\-dir $\ast$ {\em dir}, EDR\_\-tkr $\ast$ {\em tkr}, \hyperlink{struct__TFC__prjs}{TFC\_\-prjs} $\ast$ {\em prjs})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{GFC_8c_a22}


Does the track finding. 

\begin{Desc}
\item[Returns:]This routines contribution to the status mask\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cfg}]The tracker configuration constants \item[{\em energy}]The energy of the event \item[{\em dir}]The event directory \item[{\em tkr}]The structure to hold the unpacked TKR data \item[{\em prjs}]The structure to hold the found projections\end{description}
\end{Desc}
This is used when there is an early accept. Because the EPU side of the GRB processing needs the tracking done, it is done here. A better solution would be for the GRB code to do this for itself. Unfortunately that would take a fairly large effort to make the parameters of the track finding available to the GRB code and to leave enough context around so that it would know to that it must be done. Just not prepared to do it now.\hypertarget{GFC_8c_a23}{
\index{GFC.c@{GFC.c}!tkrSetStatus@{tkrSetStatus}}
\index{tkrSetStatus@{tkrSetStatus}!GFC.c@{GFC.c}}
\subsubsection[tkrSetStatus]{\setlength{\rightskip}{0pt plus 5cm}static \_\-\_\-inline unsigned int tkr\-Set\-Status (const \hyperlink{struct__GammaCfgTkr}{Gamma\-Cfg\-Tkr} $\ast$ {\em cfg}, int {\em energy}, int {\em prj\-Cnt})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{GFC_8c_a23}


Completes tracker status, by evaluating the projection count. 

\begin{Desc}
\item[Returns:]The contribution of this routine to the status mask\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cfg}]The tracker configuration and cut criteria \item[{\em energy}]The total energy in the CAL \item[{\em prj\-Cnt}]The count of projections\end{description}
\end{Desc}
