\section{Experimental setup}\label{sec:detector}

In this section, the experiment used for the analysis presented here is described. The detector is placed in an accelerator facility, which is briefly introduced. The \lhcb subdetectors used in the analysis are presented, as well as the data-acquisition procedure.

\subsection{The Large Hadron Collider}\label{sec:det_LHC}

The story of the Large Hadron Collider (\lhc)~\cite{LHCdesign} reaches all the way back to 1976, when the particle physics community started to think about building the \lep (Large Electron Positron) collider. \lep was a 27 kilometer circular collider, placed in a tunnel at \cern (Conseil europ\'{e}en pour la recherche nucl\'{e}aire) near Geneva, Switzerland. CERN is the largest physics laboratory in the world. Its main purpose it to provide \emph{a unique range of particle accelerator facilities that enable research at the forefront of human knowledge}, \emph{perform world-class research in fundamental physics} and \emph{unite people from all over the world to push the frontiers of science and technology, for the benefit of all}~\cite{CERNmission}.

\lep started its full operation in 1989 and was functioning until 2001, when the dismantling started, making room for the LHC~\cite{LEPstory} to be placed in the same tunnel. 


The first discussions about replacing the \en-\ep collider by a hadron collider started as early as 1984. The construction of \lhc was approved 20 years later, in December 1994~\cite{LHChistory}. The construction began in 1998 and the first collisions were delivered in 2008. However, during the initial testing, one of the  superconducting magnets quenched\footnote{Quenching is when a part of the superconducting coil returns to its conducting state.}. As a result, 53 magnets were damaged, postponing the data taking to 2009.

%\todoblue[inline]{They found Gallo-Roman ruins at CMS dig site in 1998, leading to a half-year delay. First beam happened on September 10 2008 }

The \lhc with its circumference of 27\km is up to this day the largest and most powerful particle collider in the world. The \lhc sits on the top of the \cern's accelerator complex, a succession of machines that accelerate the beam of particles to higher and higher energies, as illustrated in \refFig{CERNaccelerator}. The accelerated particles are in the \lhc's main operation mode protons, however there are periods where other heavier ions are accelerated. The  \lhc itself consists of two circular storage rings where protons are injected with an energy of 450\gev and they are accelerated to energies up to 7\tev. The accelerated protons are collided at four main interactions points each surrounded by a large detector: \alice, \atlas, \cms and \lhcb.

So far, the \lhc has operated in two longer periods, called \runI (2010-2012) and \runII (2015-2018). In \runI, the maximal nominal energy was 3.5\tev with increase to 4\tev in 2012. \runI was followed by a maintenance period, long shut-down one (LS1), where the dipoles of the  \lhc were improved, resulting in a maximal nominal energy of 6.5\tev in \runII. At the moment, the \lhc is in the second long shut-down period (LS2), where \alice and \lhcb are undergoing major upgrades. This will be followed by \runIII with a maximal nominal energy of 7\tev~\cite{LHCschedule}. The duration of \runIII is foreseen to be three years and the expected performance can be found in~Ref.\,\cite{RunIIIperformance}. 

\begin{figure}[hbt!]
    \centering
    \includegraphics[width=0.99\textwidth]{./Detector/CERNacceleratorComplex.jpg}
    \captionof{figure}[\cern's accelerator complex.]{\cern's accelerator complex. The protons are initially accelerated by \textcolor{col_LINAC2}{\textbf{LINAC\,2}} and brought to \textcolor{col_BOOSTER}{\textbf{BOOSTER}}. They continue to \textcolor{col_PS}{\textbf{PS}}, \textcolor{col_SPS}{\textbf{SPS}} and from there they are finally steered into \textcolor{col_LHC}{\textbf{\lhc}}. Heavier ions follow a similar path, they are initally accelerated in \textcolor{col_LINAC3}{\textbf{LINAC\,3}}, they continue to \textcolor{col_LEIR}{\textbf{LEIR}}. From there they are step by step brought to \textcolor{col_PS}{\textbf{PS}}, \textcolor{col_SPS}{\textbf{SPS}} and \textcolor{col_LHC}{\textbf{\lhc}}. Taken from~Ref.\,\cite{CERNaccelerator}.} \label{fig:CERNaccelerator}
\end{figure}

\clearpage

\subsection{The LHCb experiment}\label{sec:det_LHCb}

The \lhcb detector~\cite{LHCb-TDR-OG,LHCb-TDR-NEW,LHCb-LHC} is a single arm forward spectrometer located at Point~8 (alongside the Geneva airport runway) at the \lhc ring. The detector was mainly designed for precision measurements of CP violation and to study rare decays in the B and D meson systems~\cite{LHCb-TDR-OG}.%\footnote{The technical proposal also mentions studies of rare \tauon decay. However, with the current LHCb design, the measurement is not possible due to \todo[inline]{Ask why we can't measure taons}.}. 

\begin{wrapfigure}[19]{r}{0.5\textwidth} \vspace{-20pt}
    \centering
    \includegraphics[width=0.48\textwidth]{./Detector/bb_acc_scheme_14TeV.pdf}
    \captionof{figure}[The production angle of the \bbbar pair at  $\sqs=14\tev$.]{The production angle of the \bbbar pair at the center-of-mass energy of $14\tev$. Red color represents the \lhcb acceptance. 27\% of all produced \bquark or \bquarkbar quarks are produced in the LHCb acceptance. In a standard general-purpose detector (asusming the acceptance along the beam as $-180 - 180$\mrad% $|\eta|<2.4$
    ), 49\% of \bquark or \bquarkbar quarks are produced in its acceptance. Taken from\,\cite{bbangles}.} \label{fig:lhc_bb_acc}
\end{wrapfigure}


The full \lhcb design is described in \refFig{LHCb-layout}. The LHCb coordinate system originates at the nominal interaction point. The $z$-axis is defined along the center of the beam, its positive part pointing from the interaction point into the detector and negative part pointing from the interaction point away from the detector. The $y$-axis is defined upwards in vertical direction from the interaction point, the $x$-axis similarly in horizontal direction. In order for the coordinate system to be right-handed, the positive $x$-axis is defined pointing to the left side, viewing in the positive direction of the $z$-axis. This allows for the definition of azimuthal angle $\phi$, spherical angle $\theta$ and pseudorapidity\footnote{ Pseudorapidity $\eta$ is defined as $\eta=\ln\left(\tan\sfrac{\theta}{2}\right)$, where the spherical angle $\theta$ is the angle between the beam-pipe and particle's trajectory.}. For readers convenience, terms \emph{downstream} (in the direction of beam into the \lhcb acceptance, \ie beam direction towards the \atlas experiment) and \emph{upstream} (beam direction towards the \cms experiment) are defined~\cite{LHCb-beamMon}.

Since heavy quarks are mainly produced in the forward direction~\cite{QQproduction}, the \lhcb is designed to cover the very forward region as illustrated in \refFig{lhc_bb_acc}. The \lhcb geometrical acceptance is $10-300$\mrad in the $x-z$ plane and $10-250$\mrad in the $y-z$ plane.% The acceptance along the beam is $15-327$\mrad. 

\begin{figure}[hbt!]
	\centering
	\includegraphics[width=0.99\textwidth]{./Detector/LHCbDetector2.png}
	\captionof{figure}[The \lhcb detector.]{The \lhcb detector. Taken from\,\cite{LHCb-layout}.} \label{fig:LHCb-layout}
\end{figure}

In order to fulfill the design goals, the \lhcb detector has to have very high track reconstruction efficiency, good \pion-\kaon separation over a large energy range and excellent decay-time resolution. This is realized by several subsystems described in the following sections. Thanks to this universal detector design \lhcb does not only excel in precision measurements of B and D mesons, but also studies many new exotic states and particles~\cite{Xi2_states, Pentaquark, Pentaquark2, Tetraquark}, and performs precision measurements of gauge boson properties~\cite{Wev, WandZ, Ztobb}. Recent developments also allow for studies of heavy-ion collisions, for example excited \bbbar resonance states $\Upsilonres(nS)$ are observed to be suppressed in proton-lead collisions compared to proton-proton collision suppression, more so with larger $n$ (corresponding to higher excited states)~\cite{IFT-bottomium}. Moreover, \lhcb is the only experiment at the \lhc that is able to operate also in a fixed target mode. In the fixed target mode the proton beam collides with a gas target in the beam pipe. This was initially intended as a luminosity measurement~\cite{SMOG}. Exploiting this program, \eg a measurement of the antiproton production cross-section in proton-helium collisions was carried out, impacting the interpretation of results on antiproton cosmic rays from space-borne experiments~\cite{IFT-Antiproton}. 

 
\subsubsection{Tracking system and vertex reconstruction}\label{sec:det_tracking_vertexing}

%Vertex and track reconstruction are the core of \lhcb measurements.
Precise vertex reconstruction is crucial for precision measurements of \bquark hadron decays as displaced secondary vertices are typical for them.
\lhcb also has to have high event reconstruction efficiencies while maintaining high-speed online (trigger) selection (for more details see \refSec{det_trig}) in order to fully exploit its physics potential. Furthermore, since the main limitation for the momentum resolution is multiple scattering, the amount of material in the detector has to be minimal. 

\clearpage

The vertex reconstruction is realized by the \velo (VErtex LOcator) detector  surrounding the interaction point~\cite{LHCb-TDR-VELO}. The \velo is consisting of two retractable halves placed along the beam direction, each consisting of 21 silicon micro-strip stations. The strips are arranged in the $r-\phi$ plane~\cite{LHCb-Performance}. An illustration of the strips arrangement is shown in \refFig{LHCb-VELO}. This arrangement has the natural advantage of having the smallest segments closest to the beam. The retractable halves are open during beam setup. Once the beam in the \lhc is stable, the detectors halves close around the beam, placing the closest sensors only 8\mm away from the beam itself. 
 

\begin{figure}[hbt!]
	\centering
	\includegraphics[width=0.418\textwidth]{./Detector/VELO_right.png}% 	\hspace{1cm}
	\includegraphics[width=0.418\textwidth]{./Detector/VELO_left.png} 
	\captionof{figure}[The \velo silicon sensor sketch.]{The \velo silicon sensor sketch 		
		with $R$ sensors in blue and $\phi$ sensors in red. Taken
		from \,\cite{LHCb-LHC}.} \label{fig:LHCb-VELO}
\end{figure}


For the physics program of \lhcb it is important to reconstruct the vertex position, displaced tracks and vertices, impact parameter and decay time with high resolution and precision. The impact parameter (for the definition see \refSec{sel-StrippingSelection}) resolution in \mum of the  \velo in the $x$ and $y$ direction is (16+24/$\pt[\text{GeV}]$)\mum, the vertex resolution goes down to 10\mum in the $x$ and $y$ direction and 50\mum in the $z$-direction~\cite{LHCb-Run2Performance}. The decay time resolution for \B meson decays is around 40\fs~\cite{LHCb-Run2Performance}. Despite operating in an environment with very high radiation, the \velo detector's performance is stable throughout the years.




The momentum information for charged tracks is obtained by combining information from the \velo and three subdetectors downstream of the \velo: \ttracker (trigger tracker), \intr (Inner Tracker) and \ot (Outer Tracker). The \velo can measure particle tracks and decay vertices, however, there is no momentum information. For this, a large magnet upstream of the \velo is used. The magnet has bending power of 4\,Tm. This field is strong enough to allow the tracking system to perform momentum measurements with a good precision of tracks with momenta up to 200\gev~\cite{LHCb-TDR-MAG}. The magnetic field has two configurations, \emph{down}, when the dipole field is along the positive $y$-axis, and \emph{up}, when the dipole field is along the negative $y$-axis. The $x-z$ plane is then referred to as \emph{bending plane}  and $y-z$ as the \emph{non-bending plane}.  The polarity of the magnetic field is periodically changed in order to control the detection asymmetries. The detection asymmetries need to be as small as possible for CP violation studies~\cite{Polarity}. 

The \ttracker detector is placed upstream of the magnet and consists of four silicon microstrip planes~\cite{LHCb-TDR-TT}. The \ttracker is especially important for fast trigger selection, as explained later in \refSec{det_trig}. 

The Inner Tracker~\cite{LHCb-TDR-IT}, and the Outer Tracker~\cite{LHCb-TDR-OT} are located upstream of the magnet. The Inner Tracker is made of three silicon microstrip stations surrounding the beam pipe. The hit resolution of the \intr is 50\mum. The \ot surrounds the \intr. It consists of straw tubes and has a hit resolution 170 \mum. As mentioned previously, the limiting factor in the momentum resolution is multiple scattering and not the spatial resolution of the tracking detectors. The hits from these events are matched to  the hits in the \velo and the \ttracker, allowing for momentum measurement. The overall relative momentum resolution ranges from 0.4\% (tracks with momentum $\sim$ 5\gev) to 0.6\% (tracks with momentum $\sim$ 100\gev).


\subsubsection{RICH detectors}\label{sec:det_RICH}
As mentioned in the beginning of this section, for precision measurement of rare \bquark  and \cquark decays as well as CP violation measurements, it is crucial to distinguish charged pions from charged kaons. The particle identification (PID) is achieved using two ring-imaging Cherenkov (\rich) detectors~\cite{LHCb-TDR-RICH}. One is placed upstream the magnet, one is placed downstream the magnet, as shown in \refFig{LHCb-layout}. This placement allows for PID of tracks with momentum ranging from 1\,\gev to 150\gev while covering the whole \lhcb geometrical acceptance. The efficiency and fake rate of the \rich discrimination between pions and kaons is displayed in \refFig{LHCb-PID_Kpi}. In the figure, two configurations are shown, $\Delta LL(\kaon-\pion) > 0$ and $\Delta LL(\kaon-\pion) > 5$\footnote{In the analysis, $\Delta LL(\kaon-\pion)$ is typically denoted as \dllkpi.}, where  $\Delta LL(\kaon-\pion)$ is the difference in logarithmic likelihood obtained by combining  information from all PID detectors between the kaon and pion hypotheses: $\log\mathcal{L}_{\kaon}-\log\mathcal{L}_{\pion}$. The reader can imagine $\Delta LL(\kaon-\pion)$ as a measure of the probability that hypothetic kaon is not a pion.


The \rich detector does not only discriminate between pions and kaons, but also deuterons and protons. The PID of electrons, muons, and photons is obtained using the muon system and the calorimeters. 

\begin{figure}[hbt!]
	\centering
	\includegraphics[width=0.48\textwidth]{./Detector/RICHPerf2012MagDown.pdf}
	\includegraphics[width=0.48\textwidth]{./Detector/RICHPerf2016MagDown.pdf}
	\captionof{figure}[Efficiency and fake rate of the \rich identification.]{Efficiency (open points) and fake rate (full points) of the \rich identification for the 2012 (left) and the 2016 (right) data as a function of on momentum. Two settings are shown, $\Delta LL(\kaon-\pion) > 0$ and $\Delta LL(\kaon-\pion) > 5$ (see the full text for the definition). There is a small improvement in \runII for particles below 15\gev. Modified from\,\cite{LHCb-Performance}.} \label{fig:LHCb-PID_Kpi}    
\end{figure}



\subsubsection{Calorimeter system}\label{sec:det_CALO}


The \lhcb calorimeter system consists of four calorimeters: \spd (Scintillating Pad Detector), \presh (Preshower), \ecal (electromagnetic calorimeter) and \hcal (hadronic calorimeter). The main goal of the system is fast identification and energy measurement of electrons, photons and hadrons~\cite{LHCb-TDR-CALO}. A sketch of the calorimeter system is in \refFig{LHCb-CALO-sys}.

\begin{wrapfigure}[17]{r}{0.5\textwidth} 
	\centering
	\includegraphics[width=0.45\textwidth]{./Detector/LHCbCALO2.png}
	\captionof{figure}[\lhcb calorimeter system.]{\lhcb calorimeter system. Electrons and hadrons are registered in \spd. \spd readout is limited to 0 (no hit) and 1 (hit). Electrons and photons are stopped in a lead wall ($X_0$ denotes the radiation lenght), creating a shower registered by \presh and stopped in \ecal. Hadrons leave signal in all the detectors in the calorimeter system.} \label{fig:LHCb-CALO-sys}    
\end{wrapfigure}

The Scintillating pad detector is located upstream of a lead wall that creates electron and photon showers, while the  \presh is located downstream of the wall. They allow for clear separation between electron and photon showers, as photons do not leave a signal in the \spd~\cite{LHCb-TDR-CALO}. 


The electromagnetic calorimeter  is made of 66 layers of 4\mm thick scintillator layers between 2\mm thick lead, corresponding to 25 radiation lengths. The \emph{shashlik} design is budget-wise, reliable and allows for fast response time (25\ns corresponding to a 40\mhz read-out), as the \ecal is crucial for the trigger selection. This design also has good radiation resistance~\cite{LHCb-TDR-CALO}. 

In order to separate signal from background in \bquark decays with \piz mesons and photons or to study lepton-flavor-universality, the photon and electron reconstruction has to be accurate: spatial and energy resolution has to be very good. The \ecal energy resolution is $\sfrac{\sigma}{E} = \sfrac{0.1}{\sqrt{E[\text{GeV}]}} + 0.01$, which satisfies this requirement. The \ecal transverse granularity varies as particle flux increases towards the beam in the $x-y$ plane in order to minimize pile-up of hits in the detector, ensuring good signal-background separation~\cite{LHCb-TDR-CALO}. 


The main purpose of the \hcal is to provide very fast response while having minimal detector dead-time. It measures the energy deposited by hadrons, contributing significantly to the first stage of the trigger selection of events, where the selection of high-energy events is performed.


\subsubsection{Muon system}\label{sec:det_MUON}

The most downstream \lhcb subdetector is the muon system. It consists of five rectangular stations M1-M5: M1 is equipped with triple gas-electron-multipliers, M2-M5 are equipped with multi-wire-proportional chambers and interleaved with iron absorbers to stop very-high-energy hadrons that reach the muon station and to select penetrating muons~\cite{LHCb-TDR-MUON}. 

The main purpose of this system is the  trigger selection and the PID of muons. Muons detected in the muon system have minimal momentum of 3\gev, as they have to pass the other \lhcb subdetectors. Muons are reconstructed with an efficiency of 97\%, while the pion misidentification probability varies with momentum between one and three percent~\cite{LHCb-TDR-MUON}.


\subsubsection{Trigger system and data flow}\label{sec:det_trig}

At \lhcb, the proton bunches collide at a rate of 40\mhz. With every bunch crossing, one or two inelastic proton-proton collisions occur. In 2.5\textperthousand\xspace of the collisions a \bbbar pair is produced. In about 15\% of such events at least one B meson is produced with all its decay products in the \lhcb acceptance~\cite{LHCb-LHC}. Moreover, the typical branching ratios of B mesons used in CP violation studies are less than $10^{-3}$ and in the case of rare \bquark decays the branching ratios are less than $10^{-6}$. %Totalling at 3.75\times 10^{-10}
Therefore, a fast and efficient online selection of events is essential to fully exploit the data while keeping the data flow level manageable~\cite{LHCb-TDR-TRIG}. The rate of events saved for physics analysis is 2-5\khz in \runI and 12.5\khz in \runII~\cite{LHCb-Performance,LHCb-Run2Performance}.

The \lhcb online selection, commonly called \emph{trigger}, is composed of a set of algorithms that classify (a part of) events as interesting for further analysis  called \emph{lines}~\cite{LHCb-Run2Performance}. The lines are applied in two stages: Hardware level-0 trigger and software high-level trigger. 
 
The Level-0 (\lone) trigger's purpose is to achieve a readout rate of 1.1\mhz with a fixed latency of 4\mus~\cite{LHCb-TDR-DAQ}. \lone trigger lines use information about the deposited energy from the calorimeters and muon stations, selecting events with high \pt or \et signatures~\cite{LHCb-TDR-ONLINE}. 


The High-level trigger (\hlt) was significantly improved during LS1 as the computing resources doubled~\cite{TriggerResources}. In \runI, the \hlt was divided into two levels:  \hltone and \hlttwo. In \hltone, partial reconstruction of the event was performed, reducing the event rate to about 80\khz. In \hlttwo the full event reconstruction was executed. Where possible, \hlt used offline-like algorithms with some simplifications due to time constraints~\cite{LHCb-Performance}. \hltone and \hlttwo were processed independently in \runI. In \runII however, the events passing \hltone were buffered into disk, online alignment and calibration of the detector were performed and \hlttwo then performed a \emph{full offline-like event reconstruction}. This allowed for better exploitation of \emph{exclusive} lines (lines selecting a specific final state)\footnote{\emph{Inclusive} lines select events with typologies typical for a given decay, looking for signatures such as displaced vertex or dimuons.}. As the reconstruction is performed online in a timely manner, large quantities of data can be processed fast, leading to more efficient data taking and faster publication of early measurement results, \eg~Ref.\,\cite{EM-jpsi,EM-charm}. The \runI and \runII trigger schemes are shown in \refFig{LHCb-trig}.


\begin{figure}[hbt!]
	\centering
	\includegraphics[width=0.4\textwidth]{./Detector/LHCb_Trigger_RunI_May2015.pdf} \hspace{0.05\textwidth}
	\includegraphics[width=0.4\textwidth]{./Detector/LHCb_Trigger_RunII_May2015.pdf}
	\captionof{figure}[\lhcb trigger scheme.]{\lhcb trigger scheme in 2012 (left) and 2015 (right). The data aquisition starts at 40\mhz bunch crossing rate. This is reduced by a \lone hardware triger to 1.1\mhz by selecting events with high \pt or \et signatures. These events are further selected by a software trigger: in 2012, this was done as a selection of inclusive and exclusive trigger lines, while in 2015, full offline-like event selection is performed thanks to full online detector calibration and alignment. In 2012, final output of 5\khz was written to storage in three streams, in 2015 the final output was 12.5\khz of fully-reconstructed events. Taken from~Ref.\,\cite{LHCb-trigger-diagram}.} \label{fig:LHCb-trig}    
\end{figure}

\subsubsection{Simulation}\label{sec:det_Sim}

In any high energy experiment, Monte Carlo~\cite{Monte-Carlo} simulation samples are needed to understand experimental conditions and the detector performance. Today, a simulation is a complicated project requiring vast computing power~\cite{LHCb-TDR-SOFT}. The generation of events used by the \lhcb collaboration~\cite{LHCb-TDR-COMP} is realized by the \gauss\footnote{Named after C. F. Gauss, German mathematician, making significant contributions to number theory, geometry, probability theory and other fields.} simulation framework~\cite{LHCb-Gauss}. The events are initially generated using \pythia\footnote{Named after Pythia, Oracle of Delphi. Pythia was channeling prophecies from the Greek god Apollo.}~\cite{Pythia1,Pythia2}. \pythia simulates the proton-proton collision according to the Standard Model (although it is also possible to simulate New Physics processes) and the hadronization of the produced quarks and gluons. The decays of B mesons are generated via \evtgen~\cite{EvtGen}. For this work, generating full dataset containing all kinds of final-state particles is not feasible. Therefore, events not containing a \Bu meson are immediately disregarded. Once a \Bu meson is found, they always decay into \Kstarp\mumu. The generated events then interact with the detector, which is simulated by \geant\footnote{\geant stands for GEometry ANd Tracking.}\cite{Geant1,Geant2}.  \vspace{\baselineskip}  

The digitization of the detector response is simulated using \boole\footnote{Named after G. Boole, the founder of boolean algebra.}~\cite{Boole}. At this step, noise is added to the detector response. The Level-0 trigger is also simulated in \boole, as it is purely a hardware trigger. From there on, the simulation is steeered into the same flow as the real data: the high-level trigger response is emulated by \moore\footnote{G. E. Moore is the author of Moore's law, the observation that the number of transistors on a microchip doubles every two  years.}\cite{Moore}, and the events are reconstructed using \brunel\footnote{I. K. Brunel was a British engineer, playing an important role in the industrial revolution.}~\cite{Brunel}. The simulation then mimics the real data and its reconstruction. \vspace{\baselineskip}   \vspace{\baselineskip}  

\clearpage    