% Created 2023-02-28 Tue 17:11
% Intended LaTeX compiler: pdflatex
\documentclass[serif,professionalfont,colorlinks,aspectratio=149]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{grffile}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\usepackage{color}
\usepackage{listings}
\usepackage{pdfpages}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{xspace}
\usepackage{libertine}
\usepackage{fontawesome}
\mode<beamer>{\usetheme{Boadilla}}
\setbeamertemplate{navigation symbols}{}
\setbeamerfont{alerted text}{series=\bfseries}
\lstloadlanguages{[ISO]C++}
\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{codepurple}{rgb}{0.50,0,0.82}
\definecolor{codeorange}{rgb}{0.95,0.3,0.1}
\definecolor{backcolour}{rgb}{0.95,0.95,0.92}
\lstdefinestyle{mystyle}{
commentstyle=\color{codegreen},
keywordstyle=\color{codeorange},
numberstyle=\tiny\color{codegray},
stringstyle=\color{codepurple},
basicstyle=\footnotesize,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
keepspaces=true,
numbers=left,
numbersep=5pt,
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2
}
\lstset{style=mystyle}
\usetheme{default}
\author{Brett Viren}
\date{\today}
\title{SNEWS Input to DUNE FD Trigger}
\title[SNEWS and Trigger]{SNEWS Input to DUNE FD Trigger}
\hypersetup{
 pdfauthor={Brett Viren},
 pdftitle={SNEWS Input to DUNE FD Trigger},
 pdfkeywords={},
 pdfsubject={},
 pdfcreator={Emacs 28.1 (Org mode 9.4.6)}, 
 pdflang={English}}
\begin{document}

\maketitle

\begin{frame}[label={sec:orgda5daef}]{Topics}
\begin{itemize}
\item Reminder of nominal DUNE SNB self-trigger and readout
\item Latency for SNEWS as trigger source
\item Scenario for delayed SNB trigger candidates
\item Limitations on delayed trigger rate
\end{itemize}
\end{frame}


\begin{frame}[label={sec:org58e458a}]{Nominal DUNE DAQ SNB self-trigger and readout}
\begin{columns}
\begin{column}{0.65\columnwidth}
\begin{enumerate}
\item \textbf{Trigger}: \alert{MLT} produces \textbf{SNB TD}.
\begin{itemize}
\item Rate \(\approx 1/\mathrm{month}\) with latency \(\ll 10s\).
\item Send \textbf{SNB TD} to \textbf{Dataflow} and to \textbf{ETI}.
\end{itemize}

\item \textbf{Dataflow} receives \textbf{SNB TD} from \textbf{MLT},

\begin{itemize}
\item Initiates streaming from \textbf{Readout} to \textbf{Offline}.

\item Streaming 100 seconds of 4xHD data out to 100 Gbps requires \(>10\) hours.
\end{itemize}

\item \textbf{ETI} receives \textbf{SNB TD} from \textbf{MLT}
\begin{itemize}
\item Convert to \textbf{SNB TC}, send to other \textbf{MLT}s.
\item Convert to \textbf{SNEWS} input message, send to \textbf{SNEWS} server.
\end{itemize}
\end{enumerate}
\end{column}

\begin{column}{0.4\columnwidth}
\begin{center}
\includegraphics[width=.9\linewidth]{snb-nominal.pdf}
\end{center}
\end{column}
\end{columns}
\end{frame}

\begin{frame}[label={sec:org3dde153}]{SNEWS: SNB-to-alert latency}
\begin{center}


\begin{center}
\includegraphics[width=0.8\textwidth]{snews-latency.png}
\end{center}

\footnotesize (Matt Strait via Alec Habig)
\end{center}

SNEWS itself is fast but must wait \(>\mathcal{O}(\mathrm{minute})\) for experiments to report in.

\footnotesize

\begin{itemize}
\item The current DUNE DAQ design can not meaningfully ingest SNEWS alerts.

\item \textbf{So, what might we change?}
\end{itemize}
\end{frame}


\begin{frame}[label={sec:org48b4561}]{How may DUNE benefit from SNEWS input?}
Basic idea: 
\begin{quote}
Augment the nominal SNB self-trigger with another SNB self-trigger that is ``\textbf{lower threshold, higher rate, lower purity}'' and apply \textbf{post-hoc veto} in the \textbf{absence of subsequent SNEWS alert}.
\end{quote}

\begin{itemize}
\item Allows catching ``marginal'' SNB that SNEWS reports but that DUNE would otherwise miss.

\item Requires augmenting the design for \textbf{Trigger}, \textbf{Dataflow} and \textbf{Readout} and \textbf{Offline} to support \textbf{canceling a previously initiated SNB stream}.
\end{itemize}
\end{frame}

\begin{frame}[label={sec:org5b01230}]{New SNB Trigger elements}
ETI will send a new TC to MLTs:

\begin{description}
\item[{snb-snews}] produced on receipt of a SNEWS alert.
\end{description}

MLTs will provide these TDs:

\begin{description}
\item[{snb-high}] the nominal, self-triggered SNB TD, tuned to mean rate of 1/mo.
\item[{snb-low}] a new ``low threshold'', self-triggered SNB TD, exclusive of \textbf{snb-high}, with some faster mean rate \(>1/\mathrm{mo}\).
\item[{snb-low-confirm}] formed when \textbf{snb-snews} TC received w/in XXX minutes of raising \textbf{snb-low}.

\item[{snb-low-cancel}] formed if XXX minutes pass with not \textbf{snb-snews}.
\end{description}

All new TDs accepted by Dataflow.
\begin{itemize}
\item Only \textbf{snb-high} TD will be sent to ETI (as usual).
\end{itemize}
\end{frame}

\begin{frame}[label={sec:orgd5788fc}]{Reactions to snb-* TDs}
\begin{description}
\item[{snb-high}] \textbf{Dataflow} \alert{initiates dump and stream} with \textbf{Readout}.
\item[{snb-low}] \textbf{Dataflow} \alert{initiates dump} with \textbf{Readout}.
\item[{snb-low-confirm}] \textbf{Dataflow} \alert{initiates stream} with \textbf{Readout}.
\item[{snb-low-cancel}] \textbf{Dataflow} \alert{terminates stream} with \textbf{Readout}.
\end{description}



\begin{itemize}
\item Usual ``okay to cleanup dump'' notifications in there somehow.

\item The \textbf{stream} is between \textbf{Readout} and \textbf{Offline} in the DAQ design\footnote{Streaming was in the draft of the DAQ System Design doc.  Could simply stream to DAQ output buffer disk and then only inform Offline to pick up files if stream not intentionally terminated.}.  And so, \textbf{Offline} also requires some notice of a ``cancel'' so it may clean up.

\item \textbf{Readout} must be robust against stream termination in any case, so \textbf{Readout} should need no design changes to accommodate stream termination.
\end{itemize}
\end{frame}

\begin{frame}[label={sec:org4782b14}]{How low (threshold) do we go?}
``Probably SSD endurance sets the limit'', Alec Habig.

\begin{itemize}
\item Today SSD's have something like \(\mathcal{O}(1000\times)\) write endurance.
\begin{itemize}
\item according to random Google Search results.
\end{itemize}

\item Nominal DAQ SSD capacity allows 4 SNB dumps.
\item Assume 4000 dumps over 10 year service life.
\begin{itemize}
\item Giovanna, ``SSDs spec'ed for 3 writes per day for 5 years''.
\end{itemize}
\item \(\Rightarrow\) \textbf{snb-low rate} limited to \(\lessapprox 1\) per day.
\end{itemize}


\vfill

Some SSDs will fail due to 1/mo \textbf{snb-high} dumps.  Ongoing
replacement should be expected in any case.  Frequent \textbf{snb-low}
dumps will require higher replacement rate.
\end{frame}

\begin{frame}[label={sec:orgf390884}]{Dynamic impact on DAQ due to 1/day SNB dumps}
Essentially, every \textbf{snb-low} will be followed by an \textbf{snb-low-cancel}.
\begin{itemize}
\item But not before a full dump to SSD is complete.
\end{itemize}

Can tune ``XXX minutes'' delay before \textbf{snb-low-cancel}/\textbf{snb-low-confirm}.
\begin{itemize}
\item Unconfirmed \textbf{snb-low} dumps need never leave the SSDs.
\item Confirmed \textbf{snb-low} dumps will be \textbf{far more rare} than \textbf{snb-high}!
\end{itemize}
\end{frame}

\begin{frame}[label={sec:orgc58c8ee}]{Summary}
\begin{itemize}
\item DUNE DAQ (as-is) can not meaningfully accept SNEWS input.

\item We may exploit SNEWS with new ``low-threshold'' SNB self-trigger to
kick-off SNB dump followed by an ACK/VETO based on receiving a SNEWS
alert (or not).

\item Minor extension to DAQ design required in Trigger and Dataflow.

\item Maximum 1/day mean ``low-threshold'' SNB dump rate, driven by SSD endurance and guesses at reasonable service life.

\item Addition resource burdens are confined to the SSDs.
\end{itemize}

\vfill

TBD: threshold and rate expectations from SNB physics and background.
\end{frame}
\end{document}