\subsection{Preselection}\label{sec:sel-Preselection}

The events that pass the stripping are only roughly selected and therefore further cut-based selection needs to be applied. The cuts are listed in \refTab{presel_cuts}. Visual illustration of the effect of application of the cuts is shown in \refFig{ANA-nonPrese}.

\begin{figure}[hbt!]
    \centering
    \includegraphics[width=0.49\textwidth]{Data/non_Presel/2017_Stripped.pdf}
    \includegraphics[width=0.49\textwidth]{Data/non_DTF/2017_KplusPi0Resolved_BplusMassModel_OneCB_SingleExponential_DTF_constrained_fixShape_final.pdf}
    \captionof{figure}[Mass distribution of \Bu before and after applying preselection cuts.]{Comparison of \Bu mass distribution before and after applying preselection cuts.  On the left, \Bu mass distribution after applying \emph{stripping} cuts is shown, on the right reconstructed \Bu mass after applying preselection cuts. The mean of the signal distribution is denoted $\mu(m_B)$, $\sigma(m_B)$ is the width of the peak. The signal shape is constrained to the signal shape of simulation samples. The  signal (blue) is fitted by a two-sided Crystal Ball function (see \refApp{CrystalBall}). The background (red) is described by an exponential function.} \label{fig:ANA-nonPrese}
\end{figure}

In the case of only charged particles in the decay chain, the decay is reconstructed starting from the most downstream vertex and then built upstream (in this case it would mean starting from the  \Kstar vertex, continuing to the \Bu meson). 
This means there is no propagation of information from the mother vertices to the daughter particles. In the case of neutral particles, this relation between the mother vertex and the daughter particles can contain a lot of important constraints and improve the event selection. The method exploiting these constrains, Decay Tree Fitter (DTF), was used for the first time by the \babar collaboration to reconstruct \KS\to\piz\piz decays~\cite{ANA-DTF}.

DTF constrains the mass of the neutral daughter (in our case \piz) and adds this information to the vertex of the mother particle. The decay chain is then parameterized in vertex position, decay length and particle momenta. A simultaneous fit of the decay is performed, taking into account all physical constrains (such as four-momentum conservation). In the case of the decay presented here, the \Bu mass resolution is significantly improved by using DTF. Therefore, momenta and mass variables used for the cut-based preselection are obtained using DTF. Moreover, to remove events where the DTF fit did not converge, only events with DTF status zero (meaning the DTF fit converged) and events with $\chisq_{DTF}<200$ are kept.\vspace{0.5\baselineskip}

\begin{figure}[hbt!]
    \centering
    \includegraphics[width=0.49\textwidth]{Data/non_DTF/2017_KplusPi0Resolved_BplusMassModel_OneCB_ExpGauss_constrained_fixShape_final.eps}
    \includegraphics[width=0.49\textwidth]{Data/non_DTF/2017_KplusPi0Resolved_BplusMassModel_OneCB_SingleExponential_DTF_constrained_fixShape_final.eps}
    \captionof{figure}[Fit to \Bu mass data collected during the data-taking year 2017.]
    {An example of \Bu mass fit to data collected during the 2017 data-taking year. The mean of the signal distribution is denoted $\mu(m_B)$, the width of the peak  is denoted $\sigma(m_B)$. The signal shape is fixed to the signal shape of simulated samples. 
    On the left, mass calculated without the DTF is shown, signal (blue) is fitted by a two-sided Crystal Ball function, background (red) consists of an exponential combinatorial background and a function called ExpGaus\protect\footnotemark.  The fit does not descibe the data well, the signal peak is rather wide.
    The sharp drop at 5000\mev is caused by cutting on mass obtianed by the DTF.   
    On the right, mass obtained using the DTF is shown.  Signal (blue) is fitted by a two-sided Crystal Ball function, background (red) consists only of an exponential combinatorial background. The mass resolution improved significantly. 
	} \label{fig:ANA-nonDTF}
\end{figure}
\footnotetext{This function is used for partly reconstructed background in B decays, for the definition see \refApp{ExpGaus}. }

Moreover, a DTF-like correction to the \Kstarp mass is applied. This is done by fixing the reconstructed \Bu meson mass to its known mass  5279.34\mev~\cite{PDG}. Then, the \piz momentum is adjusted according to the fixed \Bu mass. The adjusted \piz momentum is then used to estimate the \Kstarp mass. This has to be performed in order to remove the effects of the \piz momentum resolution on the reconstructed \Kstarp mass. Without this adjustment, the description of the \Kstarp mass peak by the Breit-Wigner formula fails.\vspace{0.5\baselineskip}

In order to isolate the reconstructed candidates from nearby tracks, a \emph{cone \pt asymmetry} is defined by \refEq{ANA-conePT}. The variable $\pt^\Bu$ denotes the transverse momentum of the reconstructed \Bu, while  $\pt^{cone}$ is the sum of the transverse momenta of all charged tracks \emph{near} the reconstructed \Bu. A \emph{near} track is a track in a cone $\sqrt{ (\Delta\phi)^2+(\Delta\eta)^2} \leq 1.0$, where $\Delta\phi$ is the difference between the track's momentum and the \Bu meson momentum in azimuthal angle and $\Delta\eta$ is the difference in pseudorapidity. The cone \pt asymmetry is then calculated as
%
\begin{equation}\label{eq:ANA-conePT}
    A_{\pt} = \frac{\pt^\Bu-\pt^{cone}}{\pt^\Bu+\pt^{cone}}\,.
\end{equation}

In \refSec{det_RICH}, the PID variable DLL is definied. The likelihood information from each PID subsystem (\rich, CALO,  MUON) is added linearly, forming a set of combined likelihoods. Final DLL is the likelihood of a given mass hypothesis relative to the pion mass hypothesis. This does not take into account correlations between the subsystems and it does not fully exploit the non-PID information from the subdetectors.  Therefore, another variable, \emph{ProbNN} is used. ProbNN combines the PID information from the detectors and the non-PID information in a multi-variate analysis. Therefore, in the cut-based selection, ProbNN variables are used, contrary to the DLL variables in the stripping selection. The ProbNN is calculated for each type of particle, the notation is \eg ProbNNmu for the muon ProbNN. 

In the case of photon PID, one relies only on the information from the \ecal. The variable \emph{confidence level} is constructed from the DLL values to indicate the confidence that the chosen assignment of particle ID is correct. It is calculated as the ratio of the likelihood of the chosen hypothesis and the sum of all hypotheses $X$. In the case of photon it becomes
\begin{equation}\label{eq:ANA-CL}
    CL_\gamma = \frac{DLL_{\gamma\pi}}{\sum_{X} DLL_{X\pi}}\,.
\end{equation}

\begin{table}[hbt!]
    \centering
    \begin{tabular}{c|c}
      candidate & Selection criterion\\
                \hline\hline
        \Bu     & 5.0\gev $< m_{\Bu} <$ 5.8\gev  \\
                & $\pt^\Bu>2000$\mev \\
                & Cone-$\pt$ asymmetry $>$ -0.5 \\ 
                & DIRA $>9\mrad$\\% 0.99996 \\
                & $\chisqip<12$ \\   
                & $\chisq_{FD}>121$ \\
                \hline
        \Kstarp & $792\mev< m_{K^*} <992\mev$ \\ 
                & $\pt> 1350$\mev \\
                & $\chisq_{FD}>9$ \\
                \hline
        \mumu   & Angle between muons $>$ 0.001  \\     
                & ProbNNmu $>$ 0.25  \\
                & $\chisqip>9$ \\
                & $0.1\gevgev < \qsq < 21.0 \gevgev$, $\qsq$ binned   \\ %check
                \hline
        \Kp     & ProbNNk $>0.25$ \\
                & Angle between $K^+$ and $\pi^0 >$ 0.001\\ %check 
                \hline
        \piz    & $p_T > 800$\,MeV  \\    \hline
        \g      & CL$_\gamma>0.15$   \\
                \hline     
        tracks  & $\eta > 1.6$        \\
	
        
    \end{tabular}
    \captionof{table}[Preselection cuts.]{Preselection cuts. \label{tab:presel_cuts}}
\end{table}

\subsubsection{Charmonium vetoes}\label{sec:sel-Charmonium}

The decay rate of a \bsll transition in dependence on the  dimuon mass squared \qsq shows two large excesses, as shown in \refFig{q2_theory}. They are caused by the resonant decays of \JpsiTomm and \PsiTomm coming from \BuToKstJpsi and \BuToKstPsi decays. Moreover, a small contribution of \PhiTomm from the rare decay \BuToKstPhi is expected. The contributions from these resonances are depicted in \refFig{ANA-q2_veto}. The \jpsi and \psitwos resonances are clearly dominating the event population. As discussed in \refSec{SM_bsll}, these resonances come from tree-level processes and therefore are removed from the selection. The process \BuToKstPhi is strongly influenced by QCD and therefore could potentially pollute the angular distribution and is removed.

\begin{figure}[hbt!]
    \centering
    \includegraphics[width=0.5\textwidth]{./Data/q2_dist.eps}
    \includegraphics[width=0.49\textwidth]{./Data/q2_veto_2.eps}
    \captionof{figure}[Distribution of \qsq and \qsq vs \Kp\piz\mup\mun invariant mass.]{Dimuon invariant mass squared \qsq distribution (left) and \qsq versus \Kp\piz\mup\mun invariant mass (right) from the full \runI and \runII dataset. The shaded bands represent the regions surrounding $\phi$, $\jpsi$ and $\psitwos$ resonances (from the bottom to the top) that are vetoed in the signal selection. The region surrounding $\jpsi$ is further used as a control channel for validation of the fit.} \label{fig:ANA-q2_veto}
\end{figure}


\subsubsection[\texorpdfstring{${\BuToKpmm}$}{BuToKpmm} veto]{\texorpdfstring{\BuToKpmmBF}{BuToKpmm} veto}\label{sec:sel-KplusVeto}

The decay of \BuToKpmm wrongly associated with an independent \piz meson mimics the signal. The invariant \Kp\piz\mup\mun mass of these candidates is well above the the \Bp meson mass. Therefore, this background is not contributing to the signal. This is shown in \refFig{BuToKpmm}. \vspace{\baselineskip}

However, the vetoed events account for a big part of the combinatorial background above the \Bu mass. After applying the full selection, the \BuToKpmm contribution even dominates this region. In order to suppress this background, a dedicated veto rejecting candidates with $\Kp\mup\mun$ mass close to the \Bu mass, $|m_{\Bu}-m_{\Kp\mup\mun}| < 100 \mev$, is applied. 

\begin{figure}[hbt!]
	\centering
	\includegraphics[width=0.44\textwidth]{./Data/Background/Kmumu_2018.eps}
	\includegraphics[width=0.44\textwidth]{./Data/Background/Kmumu_Bmass_2018_2.eps}
	\captionof{figure}[Invatiant mass of \Kp\mup\mun in the 2018 data sample.]{Invatiant mass of \Kp\mup\mun in the 2018 data sample after cut-based selection. On the left, the \BuToKpmm mass is shown. There is a clear peak suggesting a contribution of \BuToKpmm sample to selected data. The red band represents the region $\pm$100\mev around the \Bu mass. These events are vetoed. On the right, the mass of the vetoed \Kp\mumu candidates with the associated random \piz meson is shown. The magenta band shows the region of \Bu meson mass $\pm100\mev$. The \BuToKpmm decay does not contribute to the signal of \BuToKstmm.} \label{fig:BuToKpmm}
\end{figure}
