The high rate of events and the presence of 12 sub-detectors, for a total of about 90000 readout channels, results in such a high output data rate that it is impossible to save them on disk without some type of filtering. \tablename~\ref{tab:tdaq:subdetectors} summarizes the typical payload rates for the primary sub-detectors. A \textit{trigger} system is therefore needed, which should identify the events to be saved and reject the rest.\\

%\begin{table}
%\centering\footnotesize
%\begin{tabular}{lrrrrr}
%\hline
%\hline
%\T\B\textbf{Sub-detector} & \textbf{Stations} & \textbf{Channels/station} & \textbf{Tot. channels} & \textbf{Hit rate} & \textbf{Raw data rate}\\
%\hline
%CEDAR & 1 & 240 & 240 & 50 & 0.3\T\\
%GTK & 3 & 18000 & 54000 & 2700 & 2.25\\
%LAV & 12 & 320--512 & 4992 & 11 & 0.3\\
%CHANTI & 1 & 276 & 276 & 2 & 0.04\\
%STRAW & 4 & 1792 & 7168 & 240 & 2.4\\
%RICH & 1 & 1912 & 1912 & 11 & 0.09\\
%CHOD & 1 & 128 & 128 & 12 & 0.1\\
%IRC & 1 & 20 & 20 & 4.2 & 0.04\\
%LKr & 1 & 13248 & 13248 & 40 & 22\\
%MUV & 3 & 176--256 & 432 & 30 & 0.6\\
%SAC & 1 & 4 & 4 & 2.3 & 0.02\B\\
%\hline
%\hline
%\end{tabular}
%\caption{Payload rates for the 12 sub-detectors of the NA62 experiment. These estimations date back to 2010 \cite{na62-tdr}, and some detectors have been slightly revisited since then. Hit rates are expressed in \si{\mega\hertz}, and data rates in \si{\giga\byte/\second}.}\label{tab:tdaq:subdetectors}
%\end{table}

\begin{table}
\centering\footnotesize
\begin{tabular}{lrp{2.0cm}<{\raggedleft\arraybackslash}rp{1.5cm}<{\raggedleft\arraybackslash}p{2.0cm}<{\raggedleft\arraybackslash}}
\hline
\hline
\T\textbf{Sub-detector}\B & \T\textbf{Stations}\B & \parbox[c][][c]{2.0cm}{\centering\T \textbf{Channels\\per station}\B} & \T\textbf{Tot. channels}\B & \parbox[c][][c]{1.5cm}{\centering\T \textbf{Hit rate\\(\si{\textbf{\mega\hertz}})}\B} & \parbox[c][][c]{2.0cm}{\centering\T \textbf{Raw data\\rate (\si{\textbf{\giga\byte/\second}})}\B}\\
\hline
CEDAR & 1 & 240 & 240 & 50 & 0.3\T\\
GTK & 3 & 18000 & 54000 & 2700 & 2.25\\
LAV & 12 & 320--512 & 4992 & 11 & 0.3\\
CHANTI & 1 & 276 & 276 & 2 & 0.04\\
STRAW & 4 & 1792 & 7168 & 240 & 2.4\\
RICH & 1 & 1912 & 1912 & 11 & 0.09\\
CHOD & 1 & 128 & 128 & 12 & 0.1\\
IRC & 1 & 20 & 20 & 4.2 & 0.04\\
LKr & 1 & 13248 & 13248 & 40 & 22\\
MUV & 3 & 176--256 & 432 & 30 & 0.6\\
SAC & 1 & 4 & 4 & 2.3 & 0.02\B\\
\hline
\hline
\end{tabular}
\caption{Payload rates for the 12 sub-detectors of the NA62 experiment. These estimations date back to 2010 \cite{na62-tdr}, and some detectors have been slightly revisited since then.}\label{tab:tdaq:subdetectors}
\end{table}

The NA62 experiment will feature a unified \textit{Trigger and Data Acquisition} (TDAQ) system. Trigger information will be assembled from readout-ready digitized data, simplifying the subsequent acquisition process \cite{na62-tdr}.
Each sub-detector readout system will be able to run individually, driven by a common 40 \si{\mega\hertz} clock generated by a single high-stability oscillator and distributed through optical fibres by the Timing Trigger and Control (TTC) system designed for the LHC\footnote{\url{http://ttc.web.cern.ch/TTC/intro.html}}. The building block of the TDAQ system will be a common general-purpose integrated trigger and data acquisition board developed in Pisa, nicknamed TEL62 (\textit{Trigger ELectronics for NA62}) \cite{1748-0221-7-02-C02046}.\\

The TEL62 board is an upgraded version of the TELL1 board used by the LHCb experiment at CERN \cite{Haefeli2006494}. The mechanical and electrical architecture has been maintained for compatibility, but the new board hosts more powerful FPGAs\footnote{Field Programmable Gate Arrays.} and a large amount of DDR2 memory, whose size determines the maximum latency of the trigger process. In fact, four Altera Stratix-III pre-processing FPGAs (\textit{PP}) are connected to dedicated TDC\footnote{Time to Digital Converter} boards and to 2~\si{\giga\byte} circular memory buffers, where data is stored during real-time evaluation. A central FPGA of the same type, named SyncLink (\textit{SL}), is connected to the PPs and to an output mezzanine through high-speed buses. The SL links data and trigger primitives from all the PPs, stores data in Multi-Event Packets (\textit{MEP}), and finally sends them to the output board \cite{1748-0221-7-02-C02046}.\\

Four high performance TDCs are mounted on custom TDCB boards specifically developed for this application. TDCBs (Time to Digital Converter Boards) are able to service 128 sub-detector channels with a time resolution of 100~\si{\pico\second}. Four such boards can be plugged on a TEL62, for a total of 512 channels \cite{4669263}. The output mezzanine, named Quad-GbE, is the same equipped by the original TELL1 board, and hosts four 1~\si{\giga\bit} Ethernet links that can be used to connect the TEL62 board to the central L0 Trigger Processor (\textit{L0TP}) or to each other in a daisy-chain configuration. Several trigger primitives can be packed together into Multi-Trigger Packets (\textit{MTP}), allowing a custom number of separate event primitives from the same detector to be transmitted to the L0TP at the same time, optimizing the bandwidth usage.\\
% separate trigger sources to share a single link to the L0TP, optimizing the bandwidth usage.\\

A hardware real time trigger, labelled \textit{L0}, will command sub-detectors to transfer data through TEL62 boards to a PC farm through Gigabit Ethernet links, where data will be stored upon satisfaction of various criteria organized in levels of increasing complexity and sequentially controlled. Data are stored in UDP\footnote{User Datagram Protocol} packets for all Ethernet communications, because the simple transmission model of this protocol allows to avoid data processing overhead at the network interface level. Moreover, the UDP header consists of only 8~\si{\byte} of information, and therefore allows for a large payload. 
A detailed description of the L0 trigger will be given in Section~\ref{sect:na62l0}.\\

The software-based trigger hierarchy is organized in two levels, labelled \textit{L1} and \textit{L2} respectively, performed on raw data stored on a dedicated PC farm:
\begin{itemize}
\item[\textbf{L1}] Trigger decisions are taken independently, based on each complete sub-detector system; however, it is possible to perform logical operations on the outputs of different sub-detectors.
\item[\textbf{L2}] Trigger decisions are taken on partially reconstructed events, based on pieces of information assembled from different sub-detectors.
\end{itemize}