\hypertarget{HFC_8h}{
\section{HFC.h File Reference}
\label{HFC_8h}\index{HFC.h@{HFC.h}}
}
Heavy Ion Filter Code, Interface.  


{\tt \#include $<$EFC/EFC\_\-fate.h$>$}\par
{\tt \#include $<$EDS/EBF\_\-siv.h$>$}\par
\subsection*{Functions}
\begin{CompactItemize}
\item 
int \hyperlink{HFC_8h_4b90aceea99ed21f2343cc134f1156a7}{HFC\_\-sizeof} (int cnt)
\begin{CompactList}\small\item\em Sizes the heavy ion filtering control structure. \item\end{CompactList}\item 
int \hyperlink{HFC_8h_2a6c2bd39d3d6f3d39a5f10c90385c1b}{HFC\_\-cfgSizeof} (void)
\begin{CompactList}\small\item\em Sizes the heavy ion filtering configuration as it is used in the actual filtering progam. \item\end{CompactList}\item 
int \hyperlink{HFC_8h_e43c5d71a4b0f5f2fb1bbd237159384a}{HFC\_\-cfgCompile} (\hyperlink{struct__HFC__cfg}{HFC\_\-cfg} $\ast$cfg, const HFC\_\-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{HFC_8h_1c134bb50f5ae32847a11dd44d45aba4}{HFC\_\-cfgSchemaCompile} (\hyperlink{struct__HFC__cfg}{HFC\_\-cfg} $\ast$cfg, const HFC\_\-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 
int \hyperlink{HFC_8h_610a059315477fca9207ba12c701f09f}{HFC\_\-resultSizeof} (const \hyperlink{struct__HFC}{HFC} $\ast$hfc)
\begin{CompactList}\small\item\em Returns the size, in bytes, of one result vector. \item\end{CompactList}\item 
\hyperlink{struct__HFC__cfg}{HFC\_\-cfg} $\ast$ \hyperlink{HFC_8h_bee9a819a764c1fba248345a2a94a7f8}{HFC\_\-cfgSet} (\hyperlink{struct__HFC}{HFC} $\ast$hfc, \hyperlink{struct__HFC__cfg}{HFC\_\-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{HFC_8h_0b11ac45556deb6e2d25609840794883}{HFC\_\-filter} (\hyperlink{struct__HFC}{HFC} $\ast$hfc, unsigned int pktByte, EBF\_\-pkt $\ast$pkt, EBF\_\-siv siv, EDS\_\-fwIxb $\ast$ixb, unsigned int vetoes, \hyperlink{struct__HFC__result}{HFC\_\-result} $\ast$result)
\begin{CompactList}\small\item\em Determines the fate of 1 event. \item\end{CompactList}\item 
unsigned int \hyperlink{HFC_8h_977c35e1f2615c6aef3c7907b52fd417}{HFC\_\-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}\item 
unsigned int \hyperlink{HFC_8h_dd5b78a1083dfd782121763f4412fe72}{HFC\_\-fwNeeds} (void)
\begin{CompactList}\small\item\em Returns a bit mask of the EDS\_\-fw needs. \item\end{CompactList}\item 
\hypertarget{HFC_8h_3b5825e54de89033aac8766efc4253c0}{
const EFC\_\-services $\ast$ \textbf{HFC\_\-servicesGet} (void)}
\label{HFC_8h_3b5825e54de89033aac8766efc4253c0}

\end{CompactItemize}


\subsection{Detailed Description}
Heavy Ion Filter Code, Interface. 

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


\footnotesize\begin{verbatim}
    CVS $Id: HFC.h,v 1.3 2012/01/04 20:36:40 russell Exp $
\end{verbatim}
\normalsize
 

\subsection{Function Documentation}
\hypertarget{HFC_8h_e43c5d71a4b0f5f2fb1bbd237159384a}{
\index{HFC.h@{HFC.h}!HFC\_\-cfgCompile@{HFC\_\-cfgCompile}}
\index{HFC\_\-cfgCompile@{HFC\_\-cfgCompile}!HFC.h@{HFC.h}}
\subsubsection[{HFC\_\-cfgCompile}]{\setlength{\rightskip}{0pt plus 5cm}int HFC\_\-cfgCompile ({\bf HFC\_\-cfg} $\ast$ {\em cfg}, \/  const HFC\_\-DB\_\-prms $\ast$ {\em prms})}}
\label{HFC_8h_e43c5d71a4b0f5f2fb1bbd237159384a}


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 configuration parameters \end{description}
\end{Desc}


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

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


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 configuration schema \end{description}
\end{Desc}


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


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


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


Sizes the heavy ion 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 (HFC_cfgSizeof ());
       status = HFC_cfgCompile (cfg, usrPrms);
       HFC_cfgSet (hfc, 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{HFC_8h_0b11ac45556deb6e2d25609840794883}{
\index{HFC.h@{HFC.h}!HFC\_\-filter@{HFC\_\-filter}}
\index{HFC\_\-filter@{HFC\_\-filter}!HFC.h@{HFC.h}}
\subsubsection[{HFC\_\-filter}]{\setlength{\rightskip}{0pt plus 5cm}int HFC\_\-filter ({\bf HFC} $\ast$ {\em hfc}, \/  unsigned int {\em pktBytes}, \/  EBF\_\-pkt $\ast$ {\em pkt}, \/  EBF\_\-siv {\em siv}, \/  EDS\_\-fwIxb $\ast$ {\em ixb}, \/  unsigned int {\em vetoes}, \/  {\bf HFC\_\-result} $\ast$ {\em result})}}
\label{HFC_8h_0b11ac45556deb6e2d25609840794883}


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 hfc}]The heavy ion 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 hfcFilter().\hypertarget{HFC_8h_dd5b78a1083dfd782121763f4412fe72}{
\index{HFC.h@{HFC.h}!HFC\_\-fwNeeds@{HFC\_\-fwNeeds}}
\index{HFC\_\-fwNeeds@{HFC\_\-fwNeeds}!HFC.h@{HFC.h}}
\subsubsection[{HFC\_\-fwNeeds}]{\setlength{\rightskip}{0pt plus 5cm}unsigned int HFC\_\-fwNeeds (void)}}
\label{HFC_8h_dd5b78a1083dfd782121763f4412fe72}


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 hfc\_\-construct().\hypertarget{HFC_8h_977c35e1f2615c6aef3c7907b52fd417}{
\index{HFC.h@{HFC.h}!HFC\_\-fwObjects@{HFC\_\-fwObjects}}
\index{HFC\_\-fwObjects@{HFC\_\-fwObjects}!HFC.h@{HFC.h}}
\subsubsection[{HFC\_\-fwObjects}]{\setlength{\rightskip}{0pt plus 5cm}unsigned int HFC\_\-fwObjects (void)}}
\label{HFC_8h_977c35e1f2615c6aef3c7907b52fd417}


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 hfc\_\-construct().\hypertarget{HFC_8h_610a059315477fca9207ba12c701f09f}{
\index{HFC.h@{HFC.h}!HFC\_\-resultSizeof@{HFC\_\-resultSizeof}}
\index{HFC\_\-resultSizeof@{HFC\_\-resultSizeof}!HFC.h@{HFC.h}}
\subsubsection[{HFC\_\-resultSizeof}]{\setlength{\rightskip}{0pt plus 5cm}int HFC\_\-resultSizeof (const {\bf HFC} $\ast$ {\em hfc})}}
\label{HFC_8h_610a059315477fca9207ba12c701f09f}


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


Sizes the heavy ion 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}
