\hypertarget{EDM_8h}{
\section{EDM.h File Reference}
\label{EDM_8h}\index{EDM.h@{EDM.h}}
}
Event Diagnostic Message services, interface + macros.  


\subsection*{Defines}
\begin{CompactItemize}
\item 
\#define \hyperlink{EDM_8h_58b926536f803ed207c77996c17edc11}{EDM\_\-PRINTF}(\_\-args)
\begin{CompactList}\small\item\em Macro to call EDM\_\-printf. \item\end{CompactList}\item 
\#define \hyperlink{EDM_8h_381903bc9836d3b19ecd68935eeb9a26}{EDM\_\-XPRINTF}(\_\-stuff)
\begin{CompactList}\small\item\em Macro to call EDM\_\-xprintf. \item\end{CompactList}\item 
\#define \hyperlink{EDM_8h_39111115b1c6fb17d3c1cc3bc5b6dd05}{EDM\_\-DEBUGPRINTF}(\_\-stuff)
\begin{CompactList}\small\item\em Macro to call EDM\_\-debugPrintf (). \item\end{CompactList}\item 
\#define \hyperlink{EDM_8h_48c3c8e4d363f23eb42aac505575e12d}{EDM\_\-INFOPRINTF}(\_\-stuff)
\begin{CompactList}\small\item\em Macro to call EDM\_\-infoPrintf (). \item\end{CompactList}\item 
\#define \hyperlink{EDM_8h_c52b05f41292c36b2f2c67a5b20b0437}{EDM\_\-WARNINGPRINTF}(\_\-stuff)
\begin{CompactList}\small\item\em Macro to call EDM\_\-warningPrintf (). \item\end{CompactList}\item 
\#define \hyperlink{EDM_8h_d54458926b898434d78f9faa516e7436}{EDM\_\-ERRORPRINTF}(\_\-stuff)
\begin{CompactList}\small\item\em Macro to call EDM\_\-errorPrintf (). \item\end{CompactList}\item 
\#define \hyperlink{EDM_8h_bd83295ce8401d903c37a3f2908329e8}{EDM\_\-FATALPRINTF}(\_\-stuff)
\begin{CompactList}\small\item\em Macro to call EDM\_\-FatalPrintf (). \item\end{CompactList}\item 
\#define \hyperlink{EDM_8h_a21c4d54ee598959af84022c37e1774c}{EDM\_\-CODE}(\_\-code)
\begin{CompactList}\small\item\em Macro to drop {\bf C} statements that are only used if and only if the Event Diagnostic Message (EDM) facility is active. \item\end{CompactList}\end{CompactItemize}
\subsection*{Typedefs}
\begin{CompactItemize}
\item 
typedef enum \hyperlink{EDM_8h_3e2255ff098bffe6e91c92c8e2d07c5e}{\_\-EDM\_\-level} \hyperlink{EDM_8h_4a3a693a33b55016c674e322d7c32e3c}{EDM\_\-level}
\begin{CompactList}\small\item\em Typedef for enum {\em \_\-EDM\_\-level\/}. \item\end{CompactList}\end{CompactItemize}
\subsection*{Enumerations}
\begin{CompactItemize}
\item 
enum \hyperlink{EDM_8h_3e2255ff098bffe6e91c92c8e2d07c5e}{\_\-EDM\_\-level} \{ \par
\hyperlink{EDM_8h_3e2255ff098bffe6e91c92c8e2d07c5e34ef21e0521a85740a35695db06249fb}{EDM\_\-K\_\-DEBUG} =  2, 
\par
\hyperlink{EDM_8h_3e2255ff098bffe6e91c92c8e2d07c5ed921e591075881a5e6956f689808cbd3}{EDM\_\-K\_\-INFO} =  3, 
\par
\hyperlink{EDM_8h_3e2255ff098bffe6e91c92c8e2d07c5e26f5c7d1258e58b928271604a915fed3}{EDM\_\-K\_\-WARNING} =  4, 
\par
\hyperlink{EDM_8h_3e2255ff098bffe6e91c92c8e2d07c5ee5cd0631703c4b90c4072c7867458863}{EDM\_\-K\_\-ERROR} =  5, 
\par
\hyperlink{EDM_8h_3e2255ff098bffe6e91c92c8e2d07c5eea368e546647e3ec237c7acda65fee38}{EDM\_\-K\_\-FATAL} =  6
 \}
\begin{CompactList}\small\item\em This sets the verbosity level. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Event Diagnostic Message services, interface + macros. 

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


\footnotesize\begin{verbatim}

    CVS $Id: EDM.h,v 1.2 2005/11/22 02:32:06 russell Exp $
\end{verbatim}
\normalsize


\begin{Desc}
\item[]The facility allows one to embed code into a source program that will be used if and only if the Event Diagnostic Message services are active. Mainly this is used to drop {\em printf\/} style statements in the program.\end{Desc}
\begin{Desc}
\item[]There are two levels of control.\end{Desc}
\begin{enumerate}
\item Is this facility used at all\item The level of verbosity.\end{enumerate}


\begin{Desc}
\item[]The preprocessor symbol {\em EDM\_\-USE\/} controls whether this service is used at all. Typically in production code it would not be used.\end{Desc}
\begin{Desc}
\item[]If this facility is used, the enumeration {\em EDM\_\-level\/} controls the level of verbosity. While there is little outward difference (what the user sees when he runs the program) between setting the EDM\_\-level very high and not using this facility at all, from a code generation point of view there is an enormous difference. When this facility is active, a lot of extra code supporting this facility is compiled into the code. Not only is there the overhead of checking the message level, just the fact that the code for this facility is there will greatly compromise the compiler's optimization. For example, many leaf routines (routines that do not call another function) will be transformed into non-leaf routines. Typically non-leaf routines must incur a much large preamble and postamble overhead to save more registers. \end{Desc}


\subsection{Define Documentation}
\hypertarget{EDM_8h_a21c4d54ee598959af84022c37e1774c}{
\index{EDM.h@{EDM.h}!EDM\_\-CODE@{EDM\_\-CODE}}
\index{EDM\_\-CODE@{EDM\_\-CODE}!EDM.h@{EDM.h}}
\subsubsection[{EDM\_\-CODE}]{\setlength{\rightskip}{0pt plus 5cm}\#define EDM\_\-CODE(\_\-code)}}
\label{EDM_8h_a21c4d54ee598959af84022c37e1774c}


Macro to drop {\bf C} statements that are only used if and only if the Event Diagnostic Message (EDM) facility is active. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-code}]The contents of this argument are just dropped if the Event Diagnostic Message (EDM) facility is active.\end{description}
\end{Desc}
\begin{Desc}
\item[]This macro just drops {\em \_\-statements\/} as is into the source code if and only if the EDM facility is active. If the EDM facility is inactive, this statement is a NOP.\end{Desc}
\begin{Desc}
\item[Example]Here is an exmple of it usage\end{Desc}


\begin{Code}\begin{verbatim}      EDM_CODE (int error_cnt = 0);
      .
      .
      ntracks = ntracks + 1;
      EDM_CODE((if (ntracks > MAX_TRACKS)
                {
                      error_cnt++;
                }
               ))
\end{verbatim}
\end{Code}



\begin{Desc}
\item[]Note that jacketing parenthesis are a good idea, again to fool the preprocessor into thinking there is only 1 argument. \end{Desc}


Referenced by findPrj().\hypertarget{EDM_8h_39111115b1c6fb17d3c1cc3bc5b6dd05}{
\index{EDM.h@{EDM.h}!EDM\_\-DEBUGPRINTF@{EDM\_\-DEBUGPRINTF}}
\index{EDM\_\-DEBUGPRINTF@{EDM\_\-DEBUGPRINTF}!EDM.h@{EDM.h}}
\subsubsection[{EDM\_\-DEBUGPRINTF}]{\setlength{\rightskip}{0pt plus 5cm}\#define EDM\_\-DEBUGPRINTF(\_\-stuff)}}
\label{EDM_8h_39111115b1c6fb17d3c1cc3bc5b6dd05}


Macro to call EDM\_\-debugPrintf (). 

\begin{Desc}
\item[Returns:]The value of the resulting printf. If the result is 0, except in very pathology situations, it means the routine was not called because the print level was above EDM\_\-K\_\-DEBUG.\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-stuff}]The print level followed by the printf arguments. Note that all these arguments must must be jacketed in surrounding parenthesis so that the collection of of arguments appears as one argument to the preprocessor.\end{description}
\end{Desc}
This is a variation of the EDM\_\-xprintf with the print level set to EDM\_\-K\_\-DEBUG.



\begin{Code}\begin{verbatim}      EDM_DEBUGPRINTF ((GblMsgLevel,
                       "Starting track finding for event #: %8x\n", enum));
\end{verbatim}
\end{Code}



If {\em EDM\_\-USE\/} is not defined, this macro is a NOP. \hypertarget{EDM_8h_d54458926b898434d78f9faa516e7436}{
\index{EDM.h@{EDM.h}!EDM\_\-ERRORPRINTF@{EDM\_\-ERRORPRINTF}}
\index{EDM\_\-ERRORPRINTF@{EDM\_\-ERRORPRINTF}!EDM.h@{EDM.h}}
\subsubsection[{EDM\_\-ERRORPRINTF}]{\setlength{\rightskip}{0pt plus 5cm}\#define EDM\_\-ERRORPRINTF(\_\-stuff)}}
\label{EDM_8h_d54458926b898434d78f9faa516e7436}


Macro to call EDM\_\-errorPrintf (). 

\begin{Desc}
\item[Returns:]The value of the resulting printf. If the result is 0, except in very pathology situations, it means the routine was not called because the print level was above EDM\_\-K\_\-ERROR.\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-stuff}]The print level followed by the printf arguments. Note that all these arguments must must be jacketed in surrounding parenthesis so that the collection of of arguments appears as one argument to the preprocessor.\end{description}
\end{Desc}
This is a variation of the EDM\_\-xprintf with the print level set to EDM\_\-K\_\-ERROR.



\begin{Code}\begin{verbatim}      EDM_ERRORPRINTF ((GblMsgLevel,
                       "Starting track finding for event #: %8x\n", enum));
\end{verbatim}
\end{Code}



If {\em EDM\_\-USE\/} is not defined, this macro is a NOP. \hypertarget{EDM_8h_bd83295ce8401d903c37a3f2908329e8}{
\index{EDM.h@{EDM.h}!EDM\_\-FATALPRINTF@{EDM\_\-FATALPRINTF}}
\index{EDM\_\-FATALPRINTF@{EDM\_\-FATALPRINTF}!EDM.h@{EDM.h}}
\subsubsection[{EDM\_\-FATALPRINTF}]{\setlength{\rightskip}{0pt plus 5cm}\#define EDM\_\-FATALPRINTF(\_\-stuff)}}
\label{EDM_8h_bd83295ce8401d903c37a3f2908329e8}


Macro to call EDM\_\-FatalPrintf (). 

\begin{Desc}
\item[Returns:]The value of the resulting printf. If the result is 0, except in very pathology situations, it means the routine was not called because the print level was above EDM\_\-K\_\-FATAL.\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-stuff}]The print level followed by the printf arguments. Note that all these arguments must must be jacketed in surrounding parenthesis so that the collection of of arguments appears as one argument to the preprocessor.\end{description}
\end{Desc}
This is a variation of the EDM\_\-xprintf with the print level set to EDM\_\-K\_\-FATAL.



\begin{Code}\begin{verbatim}      EDM_FATALPRINTF ((GblMsgLevel,
                       "Starting track finding for event #: %8x\n", enum));
\end{verbatim}
\end{Code}



If {\em EDM\_\-USE\/} is not defined, this macro is a NOP. \hypertarget{EDM_8h_48c3c8e4d363f23eb42aac505575e12d}{
\index{EDM.h@{EDM.h}!EDM\_\-INFOPRINTF@{EDM\_\-INFOPRINTF}}
\index{EDM\_\-INFOPRINTF@{EDM\_\-INFOPRINTF}!EDM.h@{EDM.h}}
\subsubsection[{EDM\_\-INFOPRINTF}]{\setlength{\rightskip}{0pt plus 5cm}\#define EDM\_\-INFOPRINTF(\_\-stuff)}}
\label{EDM_8h_48c3c8e4d363f23eb42aac505575e12d}


Macro to call EDM\_\-infoPrintf (). 

\begin{Desc}
\item[Returns:]The value of the resulting printf. If the result is 0, except in very pathology situations, it means the routine was not called because the print level was above EDM\_\-K\_\-INFO.\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-stuff}]The print level followed by the printf arguments. Note that all these arguments must must be jacketed in surrounding parenthesis so that the collection of of arguments appears as one argument to the preprocessor.\end{description}
\end{Desc}
This is a variation of the EDM\_\-xprintf with the print level set to EDM\_\-K\_\-INFO.



\begin{Code}\begin{verbatim}      EDM_INFOPRINTF ((GblMsgLevel,
                      "Starting track finding for event #: %8x\n", enum));
\end{verbatim}
\end{Code}



If {\em EDM\_\-USE\/} is not defined, this macro is a NOP. \hypertarget{EDM_8h_58b926536f803ed207c77996c17edc11}{
\index{EDM.h@{EDM.h}!EDM\_\-PRINTF@{EDM\_\-PRINTF}}
\index{EDM\_\-PRINTF@{EDM\_\-PRINTF}!EDM.h@{EDM.h}}
\subsubsection[{EDM\_\-PRINTF}]{\setlength{\rightskip}{0pt plus 5cm}\#define EDM\_\-PRINTF(\_\-args)}}
\label{EDM_8h_58b926536f803ed207c77996c17edc11}


Macro to call EDM\_\-printf. 

\begin{Desc}
\item[Returns:]The value of the resulting printf. If the result is 0, except in very pathology situations, it means the routine was not called because the message {\em \_\-level\/} inhibited the printing.\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-args}]The printf arguments. Note that if there is more than one argument, they must must be jacketed in surrounding parenthesis so that the collection of arguments appears as one argument to the preprocessor. \end{description}
\end{Desc}
\hypertarget{EDM_8h_c52b05f41292c36b2f2c67a5b20b0437}{
\index{EDM.h@{EDM.h}!EDM\_\-WARNINGPRINTF@{EDM\_\-WARNINGPRINTF}}
\index{EDM\_\-WARNINGPRINTF@{EDM\_\-WARNINGPRINTF}!EDM.h@{EDM.h}}
\subsubsection[{EDM\_\-WARNINGPRINTF}]{\setlength{\rightskip}{0pt plus 5cm}\#define EDM\_\-WARNINGPRINTF(\_\-stuff)}}
\label{EDM_8h_c52b05f41292c36b2f2c67a5b20b0437}


Macro to call EDM\_\-warningPrintf (). 

\begin{Desc}
\item[Returns:]The value of the resulting printf. If the result is 0, except in very pathology situations, it means the routine was not called because the print level was above EDM\_\-K\_\-WARNING.\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-stuff}]The print level followed by the printf arguments. Note that all these arguments must must be jacketed in surrounding parenthesis so that the collection of of arguments appears as one argument to the preprocessor.\end{description}
\end{Desc}
This is a variation of the EDM\_\-xprintf with the print level set to EDM\_\-K\_\-WARNING.



\begin{Code}\begin{verbatim}      EDM_WARNINGPRINTF ((GblMsgLevel,
                         "Starting track finding for event #: %8x\n", enum));
\end{verbatim}
\end{Code}



If {\em EDM\_\-USE\/} is not defined, this macro is a NOP. \hypertarget{EDM_8h_381903bc9836d3b19ecd68935eeb9a26}{
\index{EDM.h@{EDM.h}!EDM\_\-XPRINTF@{EDM\_\-XPRINTF}}
\index{EDM\_\-XPRINTF@{EDM\_\-XPRINTF}!EDM.h@{EDM.h}}
\subsubsection[{EDM\_\-XPRINTF}]{\setlength{\rightskip}{0pt plus 5cm}\#define EDM\_\-XPRINTF(\_\-stuff)}}
\label{EDM_8h_381903bc9836d3b19ecd68935eeb9a26}


Macro to call EDM\_\-xprintf. 

\begin{Desc}
\item[Returns:]The value of the resulting printf. If the result is 0, except in very pathology situations, it means the routine was not called because the message level is below the print level\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-stuff}]The message level and the print level followed by the printf arguments. Note that all these arguments must must be jacketed in surrounding parenthesis so that the collection of arguments appears as one argument to the preprocessor.\end{description}
\end{Desc}
This is the workhorse macro. A typical example is



\begin{Code}\begin{verbatim}      EDM_XPRINTF ((EDM_K_INFO, GblMsgLevel,
                    "Starting track finding for event #: %8x\n", enum));
\end{verbatim}
\end{Code}



The first 2 arguments, {\em EDM\_\-K\_\-INFO\/} and {\em GblMsgLevel\/} represent

\begin{enumerate}
\item message\_\-level The message level to print\item print\_\-level The threshold for this message. Only if {\em message\_\-level\/} is greater than or equal to this value will the message be printed.\end{enumerate}


The remaining two arguments represent the printf format statement and its arguments.

If {\em EDM\_\-USE\/} is not defined, this macro is a NOP. 

\subsection{Typedef Documentation}
\hypertarget{EDM_8h_4a3a693a33b55016c674e322d7c32e3c}{
\index{EDM.h@{EDM.h}!EDM\_\-level@{EDM\_\-level}}
\index{EDM\_\-level@{EDM\_\-level}!EDM.h@{EDM.h}}
\subsubsection[{EDM\_\-level}]{\setlength{\rightskip}{0pt plus 5cm}{\bf EDM\_\-level}}}
\label{EDM_8h_4a3a693a33b55016c674e322d7c32e3c}


Typedef for enum {\em \_\-EDM\_\-level\/}. 

The verbosity level is pattern after the offline definitions. It uses a descending scale (seems backwards to me, the least output I would have defined as 0, with increasing verbosity at higher numbers, oh well, there must have been a good reason. 

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


This sets the verbosity level. 

\begin{Desc}
\item[Enumerator: ]\par
\begin{description}
\index{EDM\_\-K\_\-DEBUG@{EDM\_\-K\_\-DEBUG}!EDM.h@{EDM.h}}\index{EDM.h@{EDM.h}!EDM\_\-K\_\-DEBUG@{EDM\_\-K\_\-DEBUG}}\item[{\em 
\hypertarget{EDM_8h_3e2255ff098bffe6e91c92c8e2d07c5e34ef21e0521a85740a35695db06249fb}{
EDM\_\-K\_\-DEBUG}
\label{EDM_8h_3e2255ff098bffe6e91c92c8e2d07c5e34ef21e0521a85740a35695db06249fb}
}]Debug, lots of output \index{EDM\_\-K\_\-INFO@{EDM\_\-K\_\-INFO}!EDM.h@{EDM.h}}\index{EDM.h@{EDM.h}!EDM\_\-K\_\-INFO@{EDM\_\-K\_\-INFO}}\item[{\em 
\hypertarget{EDM_8h_3e2255ff098bffe6e91c92c8e2d07c5ed921e591075881a5e6956f689808cbd3}{
EDM\_\-K\_\-INFO}
\label{EDM_8h_3e2255ff098bffe6e91c92c8e2d07c5ed921e591075881a5e6956f689808cbd3}
}]Information, one time setup information \index{EDM\_\-K\_\-WARNING@{EDM\_\-K\_\-WARNING}!EDM.h@{EDM.h}}\index{EDM.h@{EDM.h}!EDM\_\-K\_\-WARNING@{EDM\_\-K\_\-WARNING}}\item[{\em 
\hypertarget{EDM_8h_3e2255ff098bffe6e91c92c8e2d07c5e26f5c7d1258e58b928271604a915fed3}{
EDM\_\-K\_\-WARNING}
\label{EDM_8h_3e2255ff098bffe6e91c92c8e2d07c5e26f5c7d1258e58b928271604a915fed3}
}]Warning, weird but not totally unexpected \index{EDM\_\-K\_\-ERROR@{EDM\_\-K\_\-ERROR}!EDM.h@{EDM.h}}\index{EDM.h@{EDM.h}!EDM\_\-K\_\-ERROR@{EDM\_\-K\_\-ERROR}}\item[{\em 
\hypertarget{EDM_8h_3e2255ff098bffe6e91c92c8e2d07c5ee5cd0631703c4b90c4072c7867458863}{
EDM\_\-K\_\-ERROR}
\label{EDM_8h_3e2255ff098bffe6e91c92c8e2d07c5ee5cd0631703c4b90c4072c7867458863}
}]Error, internal inconsistency \index{EDM\_\-K\_\-FATAL@{EDM\_\-K\_\-FATAL}!EDM.h@{EDM.h}}\index{EDM.h@{EDM.h}!EDM\_\-K\_\-FATAL@{EDM\_\-K\_\-FATAL}}\item[{\em 
\hypertarget{EDM_8h_3e2255ff098bffe6e91c92c8e2d07c5eea368e546647e3ec237c7acda65fee38}{
EDM\_\-K\_\-FATAL}
\label{EDM_8h_3e2255ff098bffe6e91c92c8e2d07c5eea368e546647e3ec237c7acda65fee38}
}]Fatal, bad, bad things have happened \end{description}
\end{Desc}

