\hypertarget{MFC_8c}{
\section{MFC.c File Reference}
\label{MFC_8c}\index{MFC.c@{MFC.c}}
}
Minimum Ionizing Particle Filter Code.  


{\tt \#include $<$XFC/MFC.h$>$}\par
{\tt \#include $<$XFC/MFC\_\-cfg.h$>$}\par
{\tt \#include $<$XFC/MFC\_\-status.h$>$}\par
{\tt \#include $<$MFC\_\-def.h$>$}\par
{\tt \#include $<$MFC\_\-resultDef.h$>$}\par
{\tt \#include $<$TOV.h$>$}\par
{\tt \#include $<$EFC/EDM.h$>$}\par
{\tt \#include $<$EFC/EFC\_\-edsFw.h$>$}\par
{\tt \#include $<$EFC/EFC.h$>$}\par
{\tt \#include $<$EFC/ATF\_\-shadowedTowers.h$>$}\par
{\tt \#include $<$EDS/EDS\_\-fw.h$>$}\par
{\tt \#include $<$EDS/EBF\_\-gem.h$>$}\par
{\tt \#include $<$EDS/EBF\_\-gemLocate.h$>$}\par
{\tt \#include $<$EDS/EBF\_\-dir.h$>$}\par
{\tt \#include $<$EDS/ECR\_\-cal.h$>$}\par
{\tt \#include $<$EDS/EDR\_\-cal.h$>$}\par
{\tt \#include $<$EDS/EDR\_\-calUnpack.h$>$}\par
{\tt \#include $<$CDM/CDM\_\-pubdefs.h$>$}\par
{\tt \#include $<$PBI/FFS.ih$>$}\par
{\tt \#include $<$stdlib.h$>$}\par
{\tt \#include $<$string.h$>$}\par
\subsection*{Defines}
\begin{CompactItemize}
\item 
\hypertarget{MFC_8c_6fb91b294ccf8965bc88949a4e33d503}{
\#define \textbf{\_\-code}~EDM\_\-CODE}
\label{MFC_8c_6fb91b294ccf8965bc88949a4e33d503}

\item 
\hypertarget{MFC_8c_d5eb6fd7f4ead21c6957592c4ab3c0de}{
\#define \textbf{\_\-info}(...)}
\label{MFC_8c_d5eb6fd7f4ead21c6957592c4ab3c0de}

\item 
\hypertarget{MFC_8c_51bd585db625919309b0488c30f8f331}{
\#define \textbf{\_\-debug}(...)}
\label{MFC_8c_51bd585db625919309b0488c30f8f331}

\item 
\hypertarget{MFC_8c_d862350585bb433a0fe0424883b3ef78}{
\#define \textbf{\_\-display\_\-title\_\-bar}()}
\label{MFC_8c_d862350585bb433a0fe0424883b3ef78}

\item 
\hypertarget{MFC_8c_f66a3ffbcc522a245ee662ad1194320d}{
\#define \textbf{\_\-display\_\-layer\_\-energy}(\_\-energy)}
\label{MFC_8c_f66a3ffbcc522a245ee662ad1194320d}

\item 
\#define \textbf{PAT}(\_\-c, \_\-d, \_\-e, \_\-f,\_\-8, \_\-9, \_\-a, \_\-b,\_\-4, \_\-5, \_\-6, \_\-7,\_\-0, \_\-1, \_\-2, \_\-3)
\item 
\#define \textbf{ROW}(\_\-0c, \_\-0d, \_\-0e, \_\-0f, \_\-1c, \_\-1d, \_\-1e, \_\-1f, \_\-2c, \_\-2d, \_\-2e, \_\-2f, \_\-3c, \_\-3d, \_\-3e, \_\-3f,\_\-08, \_\-09, \_\-0a, \_\-0b, \_\-18, \_\-19, \_\-1a, \_\-1b, \_\-28, \_\-29, \_\-2a, \_\-2b, \_\-38, \_\-39, \_\-3a, \_\-3b,\_\-04, \_\-05, \_\-06, \_\-07, \_\-14, \_\-15, \_\-16, \_\-17, \_\-24, \_\-25, \_\-26, \_\-27, \_\-34, \_\-35, \_\-36, \_\-37,\_\-00, \_\-01, \_\-02, \_\-03, \_\-10, \_\-11, \_\-12, \_\-13, \_\-20, \_\-21, \_\-22, \_\-23, \_\-30, \_\-31, \_\-32, \_\-33)
\item 
\hypertarget{MFC_8c_6c4b361d72eb3767ba424ac9a6ecf52b}{
\#define \textbf{x}~0}
\label{MFC_8c_6c4b361d72eb3767ba424ac9a6ecf52b}

\item 
\hypertarget{MFC_8c_8d3c3518d793541417a4845125da1ae1}{
\#define \textbf{a}~1}
\label{MFC_8c_8d3c3518d793541417a4845125da1ae1}

\item 
\hypertarget{MFC_8c_e4dfd7b0d66121016d6466d2ff10e8ba}{
\#define \textbf{\_\-}~0}
\label{MFC_8c_e4dfd7b0d66121016d6466d2ff10e8ba}

\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
static \_\-\_\-inline int \hyperlink{MFC_8c_41c39220eb2b5d52c8cfe57706d196d0}{isVetoed} (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 int \hyperlink{MFC_8c_d0ef3f4e304116b834849fcb11ee231a}{mfcFilter} (\hyperlink{struct__MFC}{MFC} $\ast$mfc, unsigned int pktBytes, EBF\_\-pkt $\ast$pkt, EBF\_\-siv siv, EDS\_\-fwIxb $\ast$ixb, unsigned int vetoes, \hyperlink{struct__MFC__result}{MFC\_\-result} $\ast$result)
\begin{CompactList}\small\item\em Determines the fate of 1 event. \item\end{CompactList}\item 
static int \hyperlink{MFC_8c_b23cda8c7a894a6051fb15227552acad}{compileCfgPrms} (\hyperlink{struct__MfcCfgPrms}{MfcCfgPrms} $\ast$cfg, const MFC\_\-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{MFC_8c_7f64f78bf28ed9c13679abb1d9873cb5}{MFC\_\-sizeof} (int cnt)
\begin{CompactList}\small\item\em Sizes the minimum ionizing particle filtering control structure. \item\end{CompactList}\item 
int \hyperlink{MFC_8c_363c1b6204cb67cb50573f98f3828a12}{MFC\_\-cfgSizeof} (void)
\begin{CompactList}\small\item\em Sizes the minimum filtering configuration as it is used in the actual filtering progam. \item\end{CompactList}\item 
int \hyperlink{MFC_8c_c16f4e11c85c5280c709ae554e5a6d79}{MFC\_\-resultSizeof} (const \hyperlink{struct__MFC}{MFC} $\ast$mfc)
\begin{CompactList}\small\item\em Returns the size, in bytes, of one result vector. \item\end{CompactList}\item 
int \hyperlink{MFC_8c_fae5e98ef873c16271078cf25b699960}{MFC\_\-cfgCompile} (\hyperlink{struct__MFC__cfg}{MFC\_\-cfg} $\ast$cfg, const MFC\_\-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 ctlCfg\/}. \item\end{CompactList}\item 
int \hyperlink{MFC_8c_416102f6083e81dc6bdf9c3c31c87efb}{MFC\_\-cfgSchemaCompile} (\hyperlink{struct__MFC__cfg}{MFC\_\-cfg} $\ast$cfg, const MFC\_\-DB\_\-schema $\ast$schema)
\begin{CompactList}\small\item\em Implements the transformation of the configuration parameters as specified by the user, {\em cfg\/}, into the internal form, {\em ctlCfg\/}. \item\end{CompactList}\item 
\hyperlink{struct__MFC__cfg}{MFC\_\-cfg} $\ast$ \hyperlink{MFC_8c_1566e0332104af870d25094d2ce6f1cd}{MFC\_\-cfgSet} (\hyperlink{struct__MFC}{MFC} $\ast$mfc, \hyperlink{struct__MFC__cfg}{MFC\_\-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 
static int \_\-\_\-inline \hyperlink{MFC_8c_5af8d6780857c92100a53d62829a0604}{dir\_\-check} (int status, EBF\_\-dir $\ast$dir, int dir\_\-status)
\begin{CompactList}\small\item\em Check the directory status. \item\end{CompactList}\item 
static \_\-\_\-inline int \hyperlink{MFC_8c_3df30fde55662380cadb01810bd7a89d}{acd\_\-check} (const ATF\_\-shadowedTowers $\ast$shadowed, unsigned int acd\_\-x, unsigned int acd\_\-y, unsigned int acd\_\-z, unsigned int tkrTrg)
\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{MFC_8c_1b527ae8606d250b481db6bbc68edaca}{cal\_\-check} (const \hyperlink{struct__MfcCfgCal}{MfcCfgCal} $\ast$cfg, const EDR\_\-cal $\ast$cal, int status, int vetoes, \hyperlink{struct__MFC__result}{MFC\_\-result} $\ast$result)
\begin{CompactList}\small\item\em Does the CAL based checking of the MIP filter. \item\end{CompactList}\item 
static \_\-\_\-inline int \hyperlink{MFC_8c_f82e3d3bc304ca8f953f9a2f510f286c}{tkr\_\-check} (const \hyperlink{struct__MfcCfgTkr}{MfcCfgTkr} $\ast$cfg, unsigned int tkrTrg)
\begin{CompactList}\small\item\em Does the TKR based checking of the MIP filter. \item\end{CompactList}\item 
int \hyperlink{MFC_8c_8dc8c11596cb0e7c3a380e69d280d186}{MFC\_\-filter} (\hyperlink{struct__MFC}{MFC} $\ast$mfc, unsigned int pktBytes, EBF\_\-pkt $\ast$pkt, EBF\_\-siv siv, EDS\_\-fwIxb $\ast$ixb, unsigned int vetoes, \hyperlink{struct__MFC__result}{MFC\_\-result} $\ast$result)
\begin{CompactList}\small\item\em Determines the fate of 1 event. \item\end{CompactList}\item 
unsigned int \hyperlink{MFC_8c_306895cf82d8755eaef74ceaa45b3f64}{MFC\_\-fwNeeds} (void)
\begin{CompactList}\small\item\em Returns a bit mask of the EDS\_\-fw needs. \item\end{CompactList}\item 
unsigned int \hyperlink{MFC_8c_a9e308daa0f106db33eba3d9691a10b2}{MFC\_\-fwObjects} (void)
\begin{CompactList}\small\item\em Returns a bit mask of the EDS\_\-fw objects used by the heavy ion filter. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Minimum Ionizing Particle 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: MFC.c,v 1.6 2012/11/30 18:05:30 russell Exp $
\end{verbatim}
\normalsize
 

\subsection{Define Documentation}
\hypertarget{MFC_8c_f1ea1ae156a2e2aa771aa56bab8c9b51}{
\index{MFC.c@{MFC.c}!PAT@{PAT}}
\index{PAT@{PAT}!MFC.c@{MFC.c}}
\subsubsection[{PAT}]{\setlength{\rightskip}{0pt plus 5cm}\#define PAT(\_\-c, \/  \_\-d, \/  \_\-e, \/  \_\-f, \/  \_\-8, \/  \_\-9, \/  \_\-a, \/  \_\-b, \/  \_\-4, \/  \_\-5, \/  \_\-6, \/  \_\-7, \/  \_\-0, \/  \_\-1, \/  \_\-2, \/  \_\-3)}}
\label{MFC_8c_f1ea1ae156a2e2aa771aa56bab8c9b51}


\textbf{Value:}

\begin{Code}\begin{verbatim}(_f << 0xf) | (_e << 0xe) | (_d << 0xd) | (_c << 0xc) |                \
   (_b << 0xb) | (_a << 0xa) | (_9 << 0x9) | (_8 << 0x8) |                \
   (_7 << 0x7) | (_6 << 0x6) | (_5 << 0x5) | (_4 << 0x4) |                \
   (_3 << 0x3) | (_2 << 0x2) | (_1 << 0x1) | (_0 << 0x0)
\end{verbatim}
\end{Code}
\hypertarget{MFC_8c_f1e1730a7375940257d9accac3ef1d68}{
\index{MFC.c@{MFC.c}!ROW@{ROW}}
\index{ROW@{ROW}!MFC.c@{MFC.c}}
\subsubsection[{ROW}]{\setlength{\rightskip}{0pt plus 5cm}\#define ROW(\_\-0c, \/  \_\-0d, \/  \_\-0e, \/  \_\-0f, \/  \_\-1c, \/  \_\-1d, \/  \_\-1e, \/  \_\-1f, \/  \_\-2c, \/  \_\-2d, \/  \_\-2e, \/  \_\-2f, \/  \_\-3c, \/  \_\-3d, \/  \_\-3e, \/  \_\-3f, \/  \_\-08, \/  \_\-09, \/  \_\-0a, \/  \_\-0b, \/  \_\-18, \/  \_\-19, \/  \_\-1a, \/  \_\-1b, \/  \_\-28, \/  \_\-29, \/  \_\-2a, \/  \_\-2b, \/  \_\-38, \/  \_\-39, \/  \_\-3a, \/  \_\-3b, \/  \_\-04, \/  \_\-05, \/  \_\-06, \/  \_\-07, \/  \_\-14, \/  \_\-15, \/  \_\-16, \/  \_\-17, \/  \_\-24, \/  \_\-25, \/  \_\-26, \/  \_\-27, \/  \_\-34, \/  \_\-35, \/  \_\-36, \/  \_\-37, \/  \_\-00, \/  \_\-01, \/  \_\-02, \/  \_\-03, \/  \_\-10, \/  \_\-11, \/  \_\-12, \/  \_\-13, \/  \_\-20, \/  \_\-21, \/  \_\-22, \/  \_\-23, \/  \_\-30, \/  \_\-31, \/  \_\-32, \/  \_\-33)}}
\label{MFC_8c_f1e1730a7375940257d9accac3ef1d68}


\textbf{Value:}

\begin{Code}\begin{verbatim}\
  PAT(_3c,_3d,_3e,_3f,  _38,_39,_3a,_3b, _34,_35,_36,_37, _30,_31,_32,_33),\
  PAT(_2c,_2d,_2e,_2f,  _28,_29,_2a,_2b, _24,_25,_26,_27, _20,_21,_22,_23),\
  PAT(_1c,_1d,_1e,_1f,  _18,_19,_1a,_1b, _14,_15,_16,_17, _10,_11,_12,_13),\
  PAT(_0c,_0d,_0e,_0f,  _08,_09,_0a,_0b, _04,_05,_06,_07, _00,_01,_02,_03) \
\end{verbatim}
\end{Code}


\subsection{Function Documentation}
\hypertarget{MFC_8c_3df30fde55662380cadb01810bd7a89d}{
\index{MFC.c@{MFC.c}!acd\_\-check@{acd\_\-check}}
\index{acd\_\-check@{acd\_\-check}!MFC.c@{MFC.c}}
\subsubsection[{acd\_\-check}]{\setlength{\rightskip}{0pt plus 5cm}int acd\_\-check (const ATF\_\-shadowedTowers $\ast$ {\em shadowed}, \/  unsigned int {\em acd\_\-x}, \/  unsigned int {\em acd\_\-y}, \/  unsigned int {\em acd\_\-z}, \/  unsigned int {\em tkrTrg})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{MFC_8c_3df30fde55662380cadb01810bd7a89d}


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 shadowed}]The structure defining which towers are shadowed by which ACD tiles. \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 tkrTrg}]Bit mask of towers with a 3-in-a-row. Unfortunately this is specified in little endian order. \end{description}
\end{Desc}


References MFC\_\-STATUS\_\-M\_\-NO\_\-ACD\_\-TKR.

Referenced by mfcFilter().\hypertarget{MFC_8c_1b527ae8606d250b481db6bbc68edaca}{
\index{MFC.c@{MFC.c}!cal\_\-check@{cal\_\-check}}
\index{cal\_\-check@{cal\_\-check}!MFC.c@{MFC.c}}
\subsubsection[{cal\_\-check}]{\setlength{\rightskip}{0pt plus 5cm}static \_\-\_\-inline int cal\_\-check (const {\bf MfcCfgCal} $\ast$ {\em cfg}, \/  const EDR\_\-cal $\ast$ {\em cal}, \/  int {\em status}, \/  int {\em vetoes}, \/  {\bf MFC\_\-result} $\ast$ {\em result})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{MFC_8c_1b527ae8606d250b481db6bbc68edaca}


Does the CAL based checking of the MIP filter. 

\begin{Desc}
\item[Returns:]The updated status value\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cfg}]The MIP CAL configuration cuts \item[{\em cal}]The unpacked CAL data \item[{\em status}]The status of the MIP filter to this point \item[{\em vetoes}]The bit mask of active vetoes \item[{\em result}]The result vector to fill out \end{description}
\end{Desc}


References \_\-MfcCfgCal::ehi, \_\-MfcCfgCal::elo, ievt\_\-store, isVetoed(), MFC\_\-STATUS\_\-M\_\-LYR\_\-COUNTS, MFC\_\-STATUS\_\-M\_\-STAGE\_\-XCAL, MFC\_\-STATUS\_\-M\_\-VETOED, and \_\-MFC\_\-result::mlayers.

Referenced by mfcFilter().\hypertarget{MFC_8c_b23cda8c7a894a6051fb15227552acad}{
\index{MFC.c@{MFC.c}!compileCfgPrms@{compileCfgPrms}}
\index{compileCfgPrms@{compileCfgPrms}!MFC.c@{MFC.c}}
\subsubsection[{compileCfgPrms}]{\setlength{\rightskip}{0pt plus 5cm}static int compileCfgPrms ({\bf MfcCfgPrms} $\ast$ {\em cfg}, \/  const MFC\_\-DB\_\-prms $\ast$ {\em prms})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{MFC_8c_b23cda8c7a894a6051fb15227552acad}


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}


References \_\-MfcCfgPrms::cal, \_\-MfcCfgCal::ehi, \_\-MfcCfgCal::elo, \_\-MfcCfgCal::nlayers, \_\-MfcCfgTkr::placeholder, and \_\-MfcCfgPrms::tkr.

Referenced by MFC\_\-cfgCompile().\hypertarget{MFC_8c_5af8d6780857c92100a53d62829a0604}{
\index{MFC.c@{MFC.c}!dir\_\-check@{dir\_\-check}}
\index{dir\_\-check@{dir\_\-check}!MFC.c@{MFC.c}}
\subsubsection[{dir\_\-check}]{\setlength{\rightskip}{0pt plus 5cm}static int \_\-\_\-inline dir\_\-check (int {\em status}, \/  EBF\_\-dir $\ast$ {\em dir}, \/  int {\em dir\_\-status})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{MFC_8c_5af8d6780857c92100a53d62829a0604}


Check the directory status. 

\begin{Desc}
\item[Returns:]Updated status\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em status}]The status \item[{\em dir}]The directory \item[{\em dir\_\-status}]The directory status \end{description}
\end{Desc}


References MFC\_\-STATUS\_\-M\_\-ERR\_\-CTB, MFC\_\-STATUS\_\-M\_\-ERR\_\-DIR, MFC\_\-STATUS\_\-M\_\-VETOED, and not\_\-only\_\-tkr\_\-fifo\_\-overflow().

Referenced by mfcFilter().\hypertarget{MFC_8c_41c39220eb2b5d52c8cfe57706d196d0}{
\index{MFC.c@{MFC.c}!isVetoed@{isVetoed}}
\index{isVetoed@{isVetoed}!MFC.c@{MFC.c}}
\subsubsection[{isVetoed}]{\setlength{\rightskip}{0pt plus 5cm}static \_\-\_\-inline int isVetoed (unsigned int {\em status}, \/  unsigned int {\em vetoes})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{MFC_8c_41c39220eb2b5d52c8cfe57706d196d0}


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}


Referenced by cal\_\-check(), and mfcFilter().\hypertarget{MFC_8c_fae5e98ef873c16271078cf25b699960}{
\index{MFC.c@{MFC.c}!MFC\_\-cfgCompile@{MFC\_\-cfgCompile}}
\index{MFC\_\-cfgCompile@{MFC\_\-cfgCompile}!MFC.c@{MFC.c}}
\subsubsection[{MFC\_\-cfgCompile}]{\setlength{\rightskip}{0pt plus 5cm}int MFC\_\-cfgCompile ({\bf MFC\_\-cfg} $\ast$ {\em cfg}, \/  const MFC\_\-DB\_\-prms $\ast$ {\em prms})}}
\label{MFC_8c_fae5e98ef873c16271078cf25b699960}


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

\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}


References compileCfgPrms(), and \_\-MFC\_\-cfg::prms.

Referenced by MFC\_\-cfgSchemaCompile().\hypertarget{MFC_8c_416102f6083e81dc6bdf9c3c31c87efb}{
\index{MFC.c@{MFC.c}!MFC\_\-cfgSchemaCompile@{MFC\_\-cfgSchemaCompile}}
\index{MFC\_\-cfgSchemaCompile@{MFC\_\-cfgSchemaCompile}!MFC.c@{MFC.c}}
\subsubsection[{MFC\_\-cfgSchemaCompile}]{\setlength{\rightskip}{0pt plus 5cm}int MFC\_\-cfgSchemaCompile ({\bf MFC\_\-cfg} $\ast$ {\em cfg}, \/  const MFC\_\-DB\_\-schema $\ast$ {\em schema})}}
\label{MFC_8c_416102f6083e81dc6bdf9c3c31c87efb}


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

\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 schema}]The user form of the configuration schema \end{description}
\end{Desc}


References MFC\_\-cfgCompile(), and \_\-MFC\_\-cfg::prms.\hypertarget{MFC_8c_1566e0332104af870d25094d2ce6f1cd}{
\index{MFC.c@{MFC.c}!MFC\_\-cfgSet@{MFC\_\-cfgSet}}
\index{MFC\_\-cfgSet@{MFC\_\-cfgSet}!MFC.c@{MFC.c}}
\subsubsection[{MFC\_\-cfgSet}]{\setlength{\rightskip}{0pt plus 5cm}const {\bf MFC\_\-cfg} $\ast$ MFC\_\-cfgSet ({\bf MFC} $\ast$ {\em mfc}, \/  {\bf MFC\_\-cfg} $\ast$ {\em cfg})}}
\label{MFC_8c_1566e0332104af870d25094d2ce6f1cd}


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 mfc}]The minimum ionizing particle filter control structure \item[{\em cfg}]The internal representation of the configuration constants \end{description}
\end{Desc}


References \_\-MFC::cfg.\hypertarget{MFC_8c_363c1b6204cb67cb50573f98f3828a12}{
\index{MFC.c@{MFC.c}!MFC\_\-cfgSizeof@{MFC\_\-cfgSizeof}}
\index{MFC\_\-cfgSizeof@{MFC\_\-cfgSizeof}!MFC.c@{MFC.c}}
\subsubsection[{MFC\_\-cfgSizeof}]{\setlength{\rightskip}{0pt plus 5cm}int MFC\_\-cfgSizeof (void)}}
\label{MFC_8c_363c1b6204cb67cb50573f98f3828a12}


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

\begin{Desc}
\item[Returns:]Returns the size of the heavy ion 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 

\begin{Code}\begin{verbatim}       ctlCfg = malloc (MFC_cfgSizeof ());
       status = MFC_cfgCompile (cfg, usrPrms);
       MFC_cfgSet (mfc, cfg);
\end{verbatim}
\end{Code}

\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{MFC_8c_8dc8c11596cb0e7c3a380e69d280d186}{
\index{MFC.c@{MFC.c}!MFC\_\-filter@{MFC\_\-filter}}
\index{MFC\_\-filter@{MFC\_\-filter}!MFC.c@{MFC.c}}
\subsubsection[{MFC\_\-filter}]{\setlength{\rightskip}{0pt plus 5cm}int MFC\_\-filter ({\bf MFC} $\ast$ {\em mfc}, \/  unsigned int {\em pktBytes}, \/  EBF\_\-pkt $\ast$ {\em pkt}, \/  EBF\_\-siv {\em siv}, \/  EDS\_\-fwIxb $\ast$ {\em ixb}, \/  unsigned int {\em vetoes}, \/  {\bf MFC\_\-result} $\ast$ {\em result})}}
\label{MFC_8c_8dc8c11596cb0e7c3a380e69d280d186}


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 mfc}]The minimum ionizing particle filter control structure \item[{\em pktBytes}]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}


References mfcFilter().\hypertarget{MFC_8c_306895cf82d8755eaef74ceaa45b3f64}{
\index{MFC.c@{MFC.c}!MFC\_\-fwNeeds@{MFC\_\-fwNeeds}}
\index{MFC\_\-fwNeeds@{MFC\_\-fwNeeds}!MFC.c@{MFC.c}}
\subsubsection[{MFC\_\-fwNeeds}]{\setlength{\rightskip}{0pt plus 5cm}unsigned int MFC\_\-fwNeeds (void)}}
\label{MFC_8c_306895cf82d8755eaef74ceaa45b3f64}


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\_\-fwRegister when registering the filter. \end{Desc}


Referenced by mfc\_\-construct().\hypertarget{MFC_8c_a9e308daa0f106db33eba3d9691a10b2}{
\index{MFC.c@{MFC.c}!MFC\_\-fwObjects@{MFC\_\-fwObjects}}
\index{MFC\_\-fwObjects@{MFC\_\-fwObjects}!MFC.c@{MFC.c}}
\subsubsection[{MFC\_\-fwObjects}]{\setlength{\rightskip}{0pt plus 5cm}unsigned int MFC\_\-fwObjects (void)}}
\label{MFC_8c_a9e308daa0f106db33eba3d9691a10b2}


Returns a bit mask of the EDS\_\-fw objects used by the heavy ion 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\_\-fwRegister when registering the filter. \end{Desc}


Referenced by mfc\_\-construct().\hypertarget{MFC_8c_c16f4e11c85c5280c709ae554e5a6d79}{
\index{MFC.c@{MFC.c}!MFC\_\-resultSizeof@{MFC\_\-resultSizeof}}
\index{MFC\_\-resultSizeof@{MFC\_\-resultSizeof}!MFC.c@{MFC.c}}
\subsubsection[{MFC\_\-resultSizeof}]{\setlength{\rightskip}{0pt plus 5cm}int MFC\_\-resultSizeof (const {\bf MFC} $\ast$ {\em mfc})}}
\label{MFC_8c_c16f4e11c85c5280c709ae554e5a6d79}


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 mfc}]The configuration control structure \end{description}
\end{Desc}
\hypertarget{MFC_8c_7f64f78bf28ed9c13679abb1d9873cb5}{
\index{MFC.c@{MFC.c}!MFC\_\-sizeof@{MFC\_\-sizeof}}
\index{MFC\_\-sizeof@{MFC\_\-sizeof}!MFC.c@{MFC.c}}
\subsubsection[{MFC\_\-sizeof}]{\setlength{\rightskip}{0pt plus 5cm}int MFC\_\-sizeof (int {\em cnt})}}
\label{MFC_8c_7f64f78bf28ed9c13679abb1d9873cb5}


Sizes the minimum ionizing particle filtering control structure. 

\begin{Desc}
\item[Returns:]Returns the size of the heavy ion filtering control structure\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cnt}]Number of configurations to accommodate \end{description}
\end{Desc}
\hypertarget{MFC_8c_d0ef3f4e304116b834849fcb11ee231a}{
\index{MFC.c@{MFC.c}!mfcFilter@{mfcFilter}}
\index{mfcFilter@{mfcFilter}!MFC.c@{MFC.c}}
\subsubsection[{mfcFilter}]{\setlength{\rightskip}{0pt plus 5cm}static \_\-\_\-inline int mfcFilter ({\bf MFC} $\ast$ {\em mfc}, \/  unsigned int {\em pktBytes}, \/  EBF\_\-pkt $\ast$ {\em pkt}, \/  EBF\_\-siv {\em siv}, \/  EDS\_\-fwIxb $\ast$ {\em ixb}, \/  unsigned int {\em vetoes}, \/  {\bf MFC\_\-result} $\ast$ {\em result})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{MFC_8c_d0ef3f4e304116b834849fcb11ee231a}


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 mfc}]The minimum ionizing particle filter control structure \item[{\em pktBytes}]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}


References acd\_\-check(), \_\-MFC\_\-result::beg, \_\-MfcCfgPrms::cal, \_\-MFC\_\-result::cal, cal\_\-check(), \_\-MFC::cfg, \_\-MFC\_\-result::dir, dir\_\-check(), \_\-MFC\_\-result::evtNum, \_\-MFC\_\-result::gem, ievt\_\-store, isVetoed(), MFC\_\-STATUS\_\-M\_\-ERR\_\-CAL, MFC\_\-STATUS\_\-M\_\-GEM\_\-CNO, MFC\_\-STATUS\_\-M\_\-GEM\_\-NOTKR, MFC\_\-STATUS\_\-M\_\-MULTI\_\-PKT, MFC\_\-STATUS\_\-M\_\-STAGE\_\-CAL, MFC\_\-STATUS\_\-M\_\-STAGE\_\-DIR, MFC\_\-STATUS\_\-M\_\-STAGE\_\-GEM, MFC\_\-STATUS\_\-M\_\-VETOED, \_\-MFC\_\-cfg::prms, \_\-MFC\_\-result::status, \_\-MfcCfgPrms::tkr, tkr\_\-check(), tmr\_\-store, and \_\-MFC\_\-result::xcal.

Referenced by MFC\_\-filter().\hypertarget{MFC_8c_f82e3d3bc304ca8f953f9a2f510f286c}{
\index{MFC.c@{MFC.c}!tkr\_\-check@{tkr\_\-check}}
\index{tkr\_\-check@{tkr\_\-check}!MFC.c@{MFC.c}}
\subsubsection[{tkr\_\-check}]{\setlength{\rightskip}{0pt plus 5cm}static \_\-\_\-inline int tkr\_\-check (const {\bf MfcCfgTkr} $\ast$ {\em cfg}, \/  unsigned int {\em tkrTrg})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{MFC_8c_f82e3d3bc304ca8f953f9a2f510f286c}


Does the TKR based checking of the MIP filter. 

\begin{Desc}
\item[Returns:]Status bits\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cfg}]The TKR configuration \item[{\em tkrTrg}]The 3-in-a-row GEM bit mask (lower 16 bits, LSB = Tower 0) \end{description}
\end{Desc}


References MFC\_\-STATUS\_\-M\_\-NO\_\-TKR\_\-ADJ.

Referenced by mfcFilter().