
\subsubsection{Efficiency estimation}\label{sec:sel-Efficiency}

The efficiency for this analysis is estimated purely using the simulation sample. There are many limitations arising from this: availability of simulation samples or mismodeling of kinematic variables in the simulation. 
%Due to a discrepancy between simulation and data, \lone trigger efficiency is studied. 
In order to obtain a signal yield estimation, the acceptance efficiency from simulation is obtained. At this level, the acceptance efficiency is approximated by the generator-level efficiency: the fraction of generated events being in the \lhcb acceptance. As the resolution of the angles \ctk, \ctl and $\phi$ is small, this is a good approximation.


\paragraph*{Generator-level efficiency}

Generator-level efficiencies are provided with the Monte Carlo simulation sample. Available values are summarized in \refTab{eff_gen}. As the efficiency is studied per Run, final values are obtained by simply averaging over the magnet polarities and years. As the point of interest is the \emph{ratio} of the efficiency of signal and reference channels, this approximation holds well enough.

\begin{table}[hbt!]
    \centering
    \begin{tabular}{cl|cccccc}
        \multicolumn{1}{l}{}   		  &      & 2011  & 2012  & 2015  & 2016  & 2017  & 2018 \\ \hline
        \multirow{2}{*}{\BuToKstmm}   & Down & --- 	 & ---	 & 16.15 & 16.10 & 16.09 & 16.05 \\
        							  & Up   & --- 	 & --- 	 & 16.08 & 16.11 & 15.95 & 16.09 \\ \hline
        \multirow{2}{*}{\BuToKstJpsi} & Down & 14.39 & 14.77 & 15.81 & 15.85 & --- 	 & --- \\
							          & Up   & 14.42 & 14.79 & 15.74 & 15.90 & --- 	 & ---
    \end{tabular}
    \captionof{table}[Generator-level efficiencies.]{Available generator-level efficiencies for signal and reference channels. The numbers represent the ratio of accepted signal events over generated signal events in [\%]. Missing values for signal channel simulation (when these samples were produced, the generator-level efficiency was not automatically saved) samples are taken from reference channel simulation, missing values for reference simulation are taken from 2016 reference channel simulation. \vspace{\baselineskip} \label{tab:eff_gen} }
	%   The value for signal channel simulation for year 2015 is taken from a production of 2015 signal simulation channel that can not be used further. However, the generator-level efficiencies are correct for this year.
    
\end{table}


\paragraph*{Full selection efficiency}

The next step is the full selection efficiency. This efficiency is the ratio of weighted truth-matched events passing the cut-based selection relative to the number of all generated events in the \lhcb acceptance. The values of this efficiency for each year used to calculate the full efficiency according to \refEq{EffEfficiency} is shown in \refFig{eff_sel}. \vspace{\baselineskip}

\begin{figure}[hbt!]
	\centering
	\includegraphics[width=0.6\textwidth]{./Data/Efficiencies/Selection/All_Run12/KplusPi0Resolved_IDTM_rndGamma_weighted_SelectionEfficiency_All_Run12.eps}
	\captionof{figure}[Selection efficiency.]{Selection efficiency from available simulation samples per year. Red points show the efficiency for the reference \BuToKstJpsi channel, black points represent the signal \BuToKstmm channel. Higher efficiency for the reference channel is caused by generally higher selection efficiency at \qsq$\sim9\gevgev$ (see \refFig{eff_sel_q2}).  } \label{fig:eff_sel}
\end{figure}

A simple cross-validation of the selection process is done using a small sample of ten thousand signal events that passed only the generator-level requirements.
%The genereted events in the given \qsq interval and in the Bmass window are scaled to replect the number of actually generated MC events. So the efficiency is full mc simmulation passing the full selection / scaled gen events in the \qsq interval.
 It is shown in \refFig{eff_sel_q2} that there is no significant kink in the efficiency in the resonance regions and hence no bias in the selection of \BuToKstmm with respect to the \BuToKstJpsi decay is introduced. The \refFig{eff_sel_q2} also explains why the reference channel \BuToKstJpsi efficiency is larger than the signal channel \BuToKstmm efficiency: the \qsq selection efficiency is large around \qsq$\sim9\gevgev$ and therefore the selection efficiency is larger in the reference channel.

\begin{figure}[hbt!]
	\centering
	\includegraphics[width=0.47\textwidth]{./Data/Efficiencies/Selection/Run1/KplusPi0Resolved_IDTM_rndGamma_weighted_SelectionEfficiency_Run1_q2_binned.eps} \hspace{10pt}
	\includegraphics[width=0.47\textwidth]{./Data/Efficiencies/Selection/Run2/KplusPi0Resolved_IDTM_rndGamma_weighted_SelectionEfficiency_Run2_q2_binned.eps}
	\captionof{figure}[Selection efficiency in \qsq dependence.]{Selection efficiency in \qsq dependence. The efficiency is estimated using ten thousand simulation events passing only generator-level requirements. The trend follows the \qsq acceptance of \lhcb with no significant kink in the resonance regions ($[8.0\gevgev,11.0\gevgev]$ and $[12.5\gevgev,15.0\gevgev]$). } \label{fig:eff_sel_q2}
\end{figure}

\paragraph*{Multilayer perceptron efficiency}

While the MLP is designed to separate between signal and background, it cannot be 100\% \emph{effective} and therefore a fraction of signal events is removed together with the background. The MLP efficiency is obtained from truth-matched simulation as the ratio of events passing MLP response cut that are purged of multiple candidates (for details of this procedure see \refSec{sel-MultipleCandidates}) over all truth-matched simulation candidates. The efficiency in dependence on MLP response is presented in \refFig{eff_MLP}. \vspace{2\baselineskip}%The removal of multiple candidates is reflected in the efficiency in order to get good estimation of signal yield in data, where the multiple candidates are also removed.

\begin{figure}[hbt!]
    \centering
    \includegraphics[width=0.44\textwidth]{./Data/Efficiencies/TMVA/KplusPi0Resolved_mumu_IDTM_rndGamma_weighted_BDT_AloneOnly_Efficiency_Run1.eps}
    \includegraphics[width=0.44\textwidth]{./Data/Efficiencies/TMVA/KplusPi0Resolved_mumu_IDTM_rndGamma_weighted_BDT_AloneOnly_Efficiency_Run2.eps}
    \includegraphics[width=0.44\textwidth]{./Data/Efficiencies/TMVA/KplusPi0Resolved_JpsiOnly_IDTM_rndGamma_weighted_BDT_AloneOnly_Efficiency_Run1.eps}
    \includegraphics[width=0.44\textwidth]{./Data/Efficiencies/TMVA/KplusPi0Resolved_JpsiOnly_IDTM_rndGamma_weighted_BDT_AloneOnly_Efficiency_Run2.eps}
    \captionof{figure}[MLP and multiple-candidates removal efficiency per Run.]{MLP and multiple-candidates removal efficiency per Run obtained from signal and reference channels simulation sample. The offset from $\varepsilon_{MLP}=1$ at MLP response equal to zero is caused by the removal of multiple candidates. } \label{fig:eff_MLP}
\end{figure}
\clearpage

%Putting together the efficiencies, the final recipe to estimate total selection efficiency becomes:
%\begin{equation}\label{eq:EffEfficiencyReal}
%\varepsilon_{tot} =\varepsilon_{acc} \times  \varepsilon_{sel+TM} \times \varepsilon_{MLP}^{Removed~multiple}\,.
%%\varepsilon_{tot} =\varepsilon_{acc} \times  \varepsilon_{sel+TM}^{weighted} \times \varepsilon_{MLP}^{Removed~multiple}\,.
%\end{equation}  



%\paragraph*{\lone trigger efficiency}
%
%\todo[inline]{Definitely move elsewhere later and add some more info}
%
%Unfortunately, a small discrepancy in \lone trigger thresholds between the simulation and data is introduced. Therefore, a study on the \lone trigger efficiency is performed. 
%
%All the efficiency plots can be also found in \refApp{L0Eff}.