\subsection{Tracking efficiency measurement in Run II}\label{sec:trackEff-RunII}

The track reconstruction has been already measured (and published~\cite{TrackEffRun1}) in \runI. While the efficiency measurement is a crucial part of any \runI analysis, the precision was limited by the available data size: any selected event was required to pass an unbiased single muon software trigger. This trigger could perform only a simple track reconstruction due to time constrains. On top of this, the alignment and calibration was performed using the recorded data and the trigger bandwidth had to match the stripping bandwidth. 

This procedure was fundamentally changed for \runII. The real-time alignment and calibration together with the full reconstruction available in the high-level trigger allowed for the full track reconstruction in real time\footnote{~``\textit{Real time is defined as
	the interval between the collision in the detector and the moment
	the data are sent to permanent storage.}''~\cite{Tesla}}.
This allows for fast evaluation of data directly after it has been recorded. Hence, dedicated trigger software has been created in order to perform the tag-and-probe efficiency evaluation at the \hlt level.

\subsubsection{Trigger lines implementation}\label{sec:trackEff-trigger}

As explained in \refSec{trackMeas-tag-and-probe}, a \jpsi meson reconstructed from two muon tracks has to be found.  Therefore, the first stage of the trigger selection is searching for good-quality muon tracks. Such track fulfills the requirements of the \texttt{Hlt1TrackMuon} trigger line: the track has to have $\pt>800\mev$, fulfill the \texttt{IsMuon} requirement (see \refSec{sel-StrippingSelection}) and has to have the impact parameter significance larger than eight. The last requirement ensures the track is detached from the primary vertex to reduce the background pollution.

In order to speed up the computation process, first a \Tag track has to be find. Such track has to fulfill also additional criteria listed for each method in \refTab{trEff-tag-trig}. The tag track is reconstructed using the standard \lhcb tracking. Only when such a track is found, the dedicated track reconstruction is performed to search for \Probe tracks, accelerating the computation process significantly. Also the \Probe tracks have to fulfill additional loose  requirements, see \refTab{trEff-probe-trig}. Average decision time for each of the trigger decisions is below 1\ms, satisfying the software trigger requirements. All the requirements are optimized to have the largest possible kinematic coverage while keeping the coverage identical for the three methods. There are six trigger lines implemented: two lines per method. As the trigger has to distinguish between the \Tag and \Probe tracks, the charge of the muons is exploited. One line reconstructs the \jpsi candidates using positively charged \Tag muon track and negatively charged \Probe track, the other one uses the tracks with opposite charges.

\begin{table}
	\begin{center}
		\begin{tabular}[htbp]{c|r|r|r}
			{Variable}		&{\velo method} 	&{\Tstation method}	&{Long method}	\\ \hline 
			\dllmupi		&$>-2$				&$>-1$				&$>-2$		\\
			\ptot			&$>5\gev$			&$>7\gev$			&$>10\gev$	\\
			\pt				&$>700\mev$			&$-$				&$>1300\mev$	\\ 
	{\rm track}\;\chisqndf	&$<10$				&$<3$				&$<5$		\\ 
			IP				&$>0.5\mm$			&$>0.2\mm$			&$-$		\\ 
		\end{tabular}
	
		\captionof{table}[Tag track trigger selection criteria.]{Selection cuts applied to the \textbf{\emph{tag}} tracks by the software trigger.}	\label{tab:trEff-tag-trig}
	\end{center}
\end{table}


\begin{table}
	\begin{center}
		\begin{tabular}[htbp]{c|r|r|r}
			{Variable}		&{\velo method}	&{\Tstation method}	&{Long method}	\\ \hline 
			\ptot			&$>5\gev$		&$>5\gev$			&$>5\gev$		\\
			\pt				&$>500\mev$		&$>500\mev$			&$>500\mev$	\\ 
	{\rm track}\;\chisqndf	&$<10$			&$<5$				&$-$			\\ 
		\end{tabular}
		\captionof{table}[Probe track trigger selection criteria.]{Selection cuts applied to the \textbf{\emph{probe}} tracks by the software trigger.}
		\label{tab:trEff-probe-trig}
	\end{center}
\end{table}



Lastly, criteria listed in \refTab{trEff-jpsi-trig} are applied on the \jpsi meson. These conditions are optimized in order to reduce the combinatorial background and to make sure the two-muon vertex has a good quality. Moreover, in the case of the \velo method, the distance of closest approach (DOCA) condition is added in order to speed up the computation process. 


In order to measure the track reconstruction efficiency, the overlap fraction also has to be saved. Therefore, another trigger line is added: the selection is identical to the selection described above plus a requirement of finding a long track associated to the probe track with an overlap fraction fulfilling the criteria for each method is added. The existence of two lines allows for online tracking efficiency calculation.

\begin{table}
	\begin{center}
		\begin{tabular}[htbp]{c|r|r|r}
			{Variable}		&{\velo method}	&{\Tstation method}	&{Long method}	\\ \hline 
			$|m_{\mup\mun}-m_{\jpsi}|$	&$<200\mev$		&$<500\mev$			&$<500\mev$	\\
			\pt				&$-$			&$>500\mev$			&$>1000\mev$	\\ 
			{\rm vertex}\;\chisq	&$<5$			&$<2$				&$<2$		\\ 
			Track DOCA		&$<5\mm$		&$-$				&$-$		\\ 
			IP				&$-$			&$-$				&$<0.8\mm$	\\ 
		\end{tabular}
		\captionof{table}[Reconstructed \jpsi trigger selection criteria.]{Selection cuts applied to the \jpsiBF reconstructed from tag and probe tracks by the software trigger.}
		\label{tab:trEff-jpsi-trig}
	\end{center}
\end{table}

\subsubsection{Trigger lines online monitoring}

The full tracking efficiency estimation in real time also allows for real time monitoring of the track reconstruction efficiency. A dedicated online monitoring tool has been implemented in 2017.
For the monitoring purposes, the output of the trigger lines described in the previous section is saved in a form of three one-dimensional histograms in mass, momentum and pseudorapidity distributions. This is saved for both \Probe and \Tag muon tracks as well as the \jpsi candidates. 

In order to estimate the online efficiency, a fit to the \jpsi reconstructed mass is performed. The fit consists of Gaussian distribution for signal and exponential function for background. This fit is performed for every \emph{run} that lasted at least 45 minutes in order to have sufficiently large data sample available. A run is a set of data taken during the same detector settings that lasted maximum of one hour. The yields of these fits can be used to estimate the tracking efficiency for each method. %The yields and efficiencies are saved and send to the Online Presenter to monitor the tracking efficiency evolution for each method in real time.

\subsubsection{Stripping lines implementation}\label{sec:trackEff-strip}

While the full reconstruction allows for faster and more efficient determination of the track reconstruction efficiencies, when a trigger line fails, there is no data available for measuring the track reconstruction. Therefore, dedicated stripping lines for each method have been implemented also for \runII. This has been proven to be useful in 2017, when a part of the trigger line for the \Tstation method was overwritten by an output from a different trigger line. With available stripping lines, the \Tstation method has been successfully recovered. The price to pay is the same as in \runI: smaller amount of \jpsi candidates available and longer processing times.  However, the datasample taken in 2017 was large enough to fully recover the \Tstation method. The measured track reconstruction efficiency measurements via the recovered \Tstation method is given in \refFig{trEff-2017}.


The stripping lines perform very similar calculations as the trigger lines, however, the workflow does not allow to search for the \Tag track first, resulting in longer computation times. This is slightly improved by imposing a mass requirement on the combination of the muon candidates before the vertex fit. The cuts used in the stripping lines are identical to the cuts applied in the trigger selection and they are listed in \refTab{trEff-strip}.

\begin{table}
	\begin{center}
		\begin{tabular}[htbp]{c|r|r|r}
			{Variable}		&{\velo method} 	&{\Tstation method}	&{Long method}	\\ \hline \hline
					\multicolumn{4}{c}{\emph{Tag} selection criteria} \\ \hline
			\dllmupi		&$>-2$ 			&$>-1$				&$>-2$		\\
			\ptot			&$>5\gev$		&$>7\gev$			&$>10\gev$	\\
			\pt				&$>0.7\gev$		&$>0.0\gev$			&$>1.3\gev$	\\ 
	{\rm track}\;\chisqndf	&$<10$			&$<3$				&$<5$		\\ 
			IP				&$>0.5\mm$		&$>0.2\mm$			&$--$		\\ \hline
				\multicolumn{4}{c}{\emph{Probe} selection criteria}   \\ \hline
			\ptot			$>5\gev$		&$>5\gev$			&$>5\gev$	\\
			\pt				&$>0.5\gev$		&$>0.5\gev$			&$>0.5\gev$	\\ 
	{\rm track}\;\chisqndf	&$<10$			&$<5$				&$--$		\\ \hline
				\multicolumn{4}{c}{\jpsi candidates selection criteria}   \\ \hline
$|m_{\mup\mun}-m_{\jpsi}|^{\rm precomb}$	&$<2000\mev$	&$<1000\mev$		&$<1000\mev$	\\
$|m_{\mup\mun}-m_{\jpsi}|^{\rm postcomb}$	&$<200\mev$		&$<500\mev$			&$<500\mev$	\\
			\pt				&$--$			&$>0.5\gev$			&$>1\gev$	\\ 
	{\rm vertex}\;\chisq	&$<5$			&$<2$				&$<2$		\\ 
			Track DOCA		&$<5\mm$		&$--$				&$--$		\\ 
			IP				&$-$			&$--$				&$<0.8\mm$	\\ 
		\end{tabular}
		
		\captionof{table}[Stripping selection criteria.]{Selection cuts applied to the \Tag track, \Probe track and the reconstructed \jpsi candidate by the stripping selection. \texttt{Precomb} and \texttt{postcomb} denote cuts applied before and after the vertex fit respectively.}
		\label{tab:trEff-strip}
	\end{center}
\end{table}



\begin{figure}[hbt!]
	\centering
	\includegraphics[width=0.48\textwidth]{TrackEff/2017_strip/ETA_T.eps} 
	\includegraphics[width=0.48\textwidth]{TrackEff/2017_strip/P_T.eps} 
	\includegraphics[width=0.48\textwidth]{TrackEff/2017_strip/nPVs_T.eps} 
	\includegraphics[width=0.48\textwidth]{TrackEff/2017_strip/nSPDHits_T.eps} 
	\captionof{figure}[Track reconstruction efficiency using stripping for 2017.]{Track reconstruction efficiency using the \T method in pseudorapidity $\eta$ (top left), in momentum $p$ (top right), in the number of primary vertices $N_{PV}$ (bottom left) and in number of hits in the \spd $N_{\spd hits}$ (bottom right) for the 2017 data-taking period (25ns bunch spacing). This sample is obtained using stripping in order to recover faulty trigger selection of the \T method in 2017. Sim09h denotes the used version of the simulation software used by the \lhcb experiment. The uncertainties are statistical only. }\label{fig:trEff-2017}
\end{figure}


Moreover, the selection criteria applied in the trigger selection might not match requirements of analyses exploring the edges of the available phase-space. An example is a dedicated set of stripping lines allowing to study the track reconstruction efficiency in events with minimal detector occupancy. This has been added in 2017. This analysis is beyond the scope of this work, for the details, see~Ref.\,\cite{UPC-AnaNote}.
%
%Another advantage of the stripping lines is they can be also applied on the \runI datasample. The \runI track reconstruction efficiency has been thoroughly studied, however, the dataflow changed significantly between \runI and \runII. Small changes in the stripping selection would require a lot of effort for the analysts to obtain the track reconstruction efficiencies. Rewriting the stripping lines in \runI enables the \runI track reconstruction efficiency to be calculated using the \TrackCalib tool.





