\begin{figure}
	\centering
    \includegraphics[width=0.8\textwidth]{Images/pdf/L0algo/flange}
    \caption{\v{C}erenkov ring produced by a simulated $\pi^+$ with $15 \leq P_\pi \leq 35$ \si{\giga\electronvolt}. Each circle represents a photomultiplier.}\label{img:l0algo:flange}
\end{figure}

Let $\theta_x$ be the direction of the particle in the laboratory frame, and $\theta_x' \equiv \theta_x - \theta_{\rm rich}$ the direction of the particle in the RICH frame.
%$\frac{x}{f}$ is the tangent of the angle \textbf{with respect to the RICH axis} $\theta_x' \equiv \theta_x - \theta_{rich}$.
\begin{align}
&\tan \theta_x' = \frac{x}{f}
\end{align}
%Let 
%L'angolo della particella rispetto all'asse del s.d.r del laboratorio (e del MC) è $\theta_x$.
Therefore the following relations exist:
\begin{align}
&\theta_x = \theta_x' + \theta_{rich} = \arctan\frac{x}{f} + \theta_{\rm rich}\\
&\tan \theta_x = \frac{x'}{f} \Longrightarrow x' = f \tan \left( \arctan \frac{x}{f} + \theta_{\rm rich} \right)
\end{align}
\begin{figure}
\centering
\subfigure[]{\includegraphics[width=0.48\textwidth]{Images/pdf/L0algo/correzioneRich}}
\subfigure[]{\includegraphics[width=0.48\textwidth]{Images/pdf/L0algo/correzioneRich2}}
\end{figure}

\begin{align}
&\theta_{\rm kick} = \frac{P_{\rm kick}}{P} < 0 &P = \dfrac{\beta \, m_{\pi^+}}{\sqrt{1-\beta^2}}
\end{align}
\textbf{Measure $\theta_x$}. Assume particle is a $\pi^+$ to trace back its original direction $\theta_{x,{\rm orig}}$.%Assumo che la particella sia un pione, per risalire alla sua direzione originale.
\begin{align}
&\theta_x = \theta_{x,{\rm orig}} + \theta_{\rm kick} = \arctan \frac{x'}{f} \Longrightarrow \theta_{x,{\rm orig}} = \arctan \frac{x'}{f} - \frac{P_{\rm kick}}{P}\\
&\tan \theta_{x,{\rm orig}} \equiv \frac{x''}{f} \Longrightarrow x'' = f \tan \left( \frac{P_{\rm kick}}{P} + \arctan \frac{x'}{f} \right)
\end{align}
\begin{figure}
\centering
\includegraphics[width=0.5\textwidth]{Images/pdf/L0algo/correzioneMnp33}
\end{figure}

Downstream of the GigaTracker, the $K^+$ beam is given a kick $\theta_K$ on the $x$-$z$ plane. We measure $\theta_x$, but we want to trace back the \textbf{original decay angle} $\theta_{x,\pi}$.
%Il fascio di $K^+$ a valle del GTK ha un angolo $\theta_K$ sul piano $x-z$. Noi misuriamo $\theta_x$, ma vogliamo risalire al \textbf{vero angolo di decadimento $\theta_{x,\pi}$}.
\begin{align}
&\theta_x = \theta_{x,\pi} + \theta_K\\
&\tan \theta_x = \frac{x''}{f}\\
&\theta_{x,\pi} = \arctan \frac{x''}{f} - \theta_K\\
&\tan \theta_{x,\pi} \equiv \frac{x'''}{f} \Longrightarrow x''' = f \tan \left( \arctan\frac{x''}{f} - \theta_K \right)
\end{align}
\begin{figure}
\centering
\includegraphics[width=0.5\textwidth]{Images/pdf/L0algo/correzioneTrim5}
\end{figure}

\begin{itemize}
\item new ring center: $\left(x''',y\right)$. Radius unchanged.
\item select events with $\chi_{\rm ring}^2 < 3$. Single ring events (for now)
\item compute $\theta$, $P_{\pi^+}$ and $M_{\rm miss}^2$ for each step (debug)
\item parameters values:
\begin{itemize}
\item $\theta_{\rm rich} = +0.00175571$ rad
\item $P_{\rm kick} = -270$ MeV/c
\item $\theta_K = +0.0012$ rad
\end{itemize}
%(da: \textit{RICHGeometryParameters} ed \textit{NA62 Technical Design Document} 2010)
\end{itemize}

Next slide shows $M_{\rm miss}^2$ computed with zero, one, two and all three corrections respectively.

\begin{figure}
\centering
\subfigure{ \includegraphics[width=0.45\textwidth]{Images/pdf/L0algo/2-mm-Corr-0} }
\subfigure{ \includegraphics[width=0.45\textwidth]{Images/pdf/L0algo/2-mm-Corr-1} }\\
\subfigure{ \includegraphics[width=0.45\textwidth]{Images/pdf/L0algo/2-mm-Corr-2} }
\subfigure{ \includegraphics[width=0.45\textwidth]{Images/pdf/L0algo/2-mm-Corr-3} }
\end{figure}

	Reconstruction issue: RICH mirror reflects photons to two different spots, which mess up during the analysis.
$\longrightarrow$ divide data in two subsets ($x'''>0$ and $x'''<0$): first subset data reasonably matches expectations ($m_{\pi^0}^2 = 0.01822$~GeV$^2$).
		\begin{figure}
				\centering
				\includegraphics[width=0.7\textwidth]{Images/pdf/L0algo/3-mm-Corr-3}
		\end{figure}
%Il primo set è in ragionevole accordo con la massa mancante attesa ($m_{\pi^0}^2 = 0.01822$~GeV$^2$).

