\begin{figure}
\centering
\includegraphics[width=\textwidth]{Images/pdf/na62/pp-sl-data-flow}
\caption{L0 trigger primitive production: PP and SL firmware block diagrams \cite{1748-0221-7-02-C02046}.}\label{img:l0-pp-sl}
\end{figure}

The existing online trigger is hardware-implemented. Data are locally evaluated by each sub-detector involved. Each time a local trigger condition is satisfied, the sub-detector feeds a timestamped information into a central L0 processor. The latter matches such trigger primitives among all the detectors involved in the formation of the L0 trigger signal; it then broadcasts back a timestamped acquisition signal to the sub-detectors when the whole set of L0 requirements is satisfied. Triggered by this signal, the local front-end systems feed the corresponding data to the TDAQ PC farm.\\
%the information on the times to the sub-detectors when the whole set of L0 requirements is satisfied. Triggered by this signal, the local front-end systems feed the corresponding data to the TDAQ PC farm.\\

The TEL62 firmware is sketched in \figurename~\ref{img:l0-pp-sl}. At the online TDAQ level, the data flow is organized as follows:
\begin{enumerate}
\item Detector hits are digitized on the TDCB mezzanines.
\item The PPs receive data from TDCBs.
\item Part of the data is calibrated and analysed to generate L0 trigger primitives (this process is different for each sub-detector). Event data is stored into circular memory buffers.
\item The trigger primitives from all the PPs are collected by the SL, and merged if their time windows overlap.
\item A timestamped trigger primitive is assembled on the SL. %sent to the L0TP through a dedicated Ethernet link;
\item A number of trigger primitives is stored. When the predefined MTP size is reached, the Multi-Trigger packet is sent to the L0TP through a dedicated Ethernet link.
\item The L0TP matches the primitives from all the L0 trigger sources, and decides if a timestamped L0 trigger signal should be communicated to all the TEL62s.%, in order to read the data corresponding to that time slot.
\item Upon receiving a trigger signal, the SL commands the PPs to fetch data associated to the corresponding timestamp from the memory buffers.
\item Triggered event data are assembled on the SL until the predefined MEP size is reached.
\item A Multi-Event packet is assembled, and sent to the L1 PC farm through Ethernet links.
\end{enumerate}

%A low bias L0 trigger, based on a few simple, uncorrelated conditions, is set up in order to minimize systematic effects \cite{concept}. 
A L0 trigger based on a few simple, uncorrelated conditions is set up in order to quickly reduce data rates \cite{concept}.
The sub-detectors responsible for the L0 trigger need to provide identification of charged tracks (\textbf{CHOD} / \textbf{RICH}), and vetoing of the most important backgrounds (\textbf{LKr} calorimeter for $2 \pi$ and $3 \pi$ events, and \textbf{MUV} for muons).\\

The following conditions were therefore devised to perform a first selection of $\pi \nu \bar{\nu}$ events over background \cite{bruno}:
\begin{colbox}{F8E0E0}
\hspace{1em}
\begin{minipage}{0.95\textwidth}
\begin{itemize}
\item[\textbf{CHOD}] At least one track candidate
\item[\textbf{RICH}] Hit multiplicity: $5 \leq n \leq 32$
\item[\textbf{MUV3}] No hits (MUV3 is the most downstream muon veto)
\item[\textbf{LKr}] No more than one quadrant with energy deposit $E_{\rm LKr} \geq 5$ \si{\giga\electronvolt}
\end{itemize}
\end{minipage}
\end{colbox}

An optional additional contribution to the L0 trigger can be provided by the LAV:

\begin{colbox}{F8E0E0}
\hspace{1em}
\begin{minipage}{0.95\textwidth}
\begin{itemize}
\item[\textbf{LAV}] No photons detected
\end{itemize}
\end{minipage}
\end{colbox}

%\T Due to the fact that the LAV detectors are still being developed,
%% still in progress work on the LAV detectors, 
%only the first four conditions are currently required.\\
%
\T In the NA48 hodoscope, a primitive featuring at least one coincidence between corresponding quadrants on the vertical and horizontal planes defines a track candidate.
Charged particles may start showers in the Liquid Kripton Calorimeter: therefore, no multiple (spatially separated) energy deposit clusters are allowed on the LKr, since this would mean that more than one pion have been detected, or protons or $e^\pm$. This condition is intended to set an upper limit to the number of hadrons detected in the same event. However, the possibility of two showers clustering in the same sector of the calorimeter, within its spatial resolution, limits the $2 \pi$ and $3 \pi$ rejection level achievable in this way.\\

\tablename~\ref{tab:bg_rej_mc} reports the most recent simulation study of the rejection capability of each of the conditions listed above \cite{bruno}.\\

While the existence of a track detected by the CHOD sets the main acceptance window, the condition on the multiplicity of hits on the RICH detector effectively weakens the $3\pi$ and beam halo components (the latter is not shown in the table). Events featuring one or more $\pi^0$ are also partially rejected in this way, due to frequent photon conversion. A slight increase of $\pi^0$ rejection would be enabled by the availability of LAV sub-detectors.
The condition on the LKr cluster multiplicity helps rejecting events with photons, and the contribution of the most downstream muon veto sub-detector allows for a muon suppression to the level of percent.

\begin{table}
\centering
\begin{tabular}{c|ccccc|c}
\hline
\hline
Component & Initial & \textbf{CHOD} & \textbf{RICH} & \textbf{MUV3} & \textbf{LKr} & L0 output\T\B\\
\hline
$K^+ \rightarrow \pi^+ \pi^0$ & 2140 & 1732 & 1179 & 1089 & 539 & 25.2 \%\T\\
$K^+ \rightarrow \mu^+ \nu_\mu$ & 6585 & 4204 & 3817 & 29 & 29 & 0.4 \%\\
$K^+ \rightarrow \pi^+ \pi^+ \pi^-$ & 579 & 458 & 225 & 180 & 171 & 29.5 \%\\
$K^+ \rightarrow \pi^+ \pi^0 \pi^0$ & 182 & 156 & 98 & 89 & 18 & 9.9 \%\\
$K^+ \rightarrow \pi^0 e^+ \nu_e$ & 525 & 403 & 253 & 248 & 84 & 16 \%\\
$K^+ \rightarrow \pi^0 \mu^+ \nu_\mu$ & 347 & 272 & 194 & 17 & 14 & 4.0 \%\B\\
\hline
Total rate & & 7226 & 5765 & 1651 & 854 & 11.8 \%\T\B\\%\hline
%Total rate (\si{\kilo\hertz})& & 11585 & 9338 & 1736 & 563 & 4.9 \%\T\B\\
%$K^+ \rightarrow \pi^+ \pi^0$ & 2114 & 1752 & 1153 & 1063 & 284 & 13.4 \%\T\\
%$K^+ \rightarrow \mu^+ \nu_\mu$ & 6504 & 4182 & 3743 & 27 & 26 & 0.4 \%\\
%$K^+ \rightarrow \pi^+ \pi^+ \pi^-$ & 572 & 465 & 219 & 174 & 57 & 10.0 \%\\
%$K^+ \rightarrow \pi^+ \pi^0 \pi^0$ & 180 & 156 & 95 & 86 & 9 & 5.0 \%\\
%$K^+ \rightarrow \pi^0 e^+ \nu_e$ & 519 & 405 & 248 & 243 & 73 & 14.1 \%\\
%$K^+ \rightarrow \pi^0 \mu^+ \nu_\mu$ & 343 & 272 & 188 & 16 & 12 & 3.5 \%\B\\
%\hline
%Total rate (\si{\kilo\hertz})& & 11585 & 9338 & 1736 & 563 & 4.9 \%\T\B\\
\hline
\hline
\end{tabular}
\caption{Rate of events inside NA62 acceptance after each step of L0 trigger. All rates are expressed in \si{\kilo\hertz}. Study performed with a set of $10^5$ simulated events for each $K^+$ decay mode. The last line highlights the total event rate rescaled to the firing rate of the CHOD detector, to which the beam upstream and downstream muon halos contribute as well. Data from \cite{bruno}.}\label{tab:bg_rej_mc}
\end{table}