%!TEX root=../main.tex
\chapter{Numerical Implementation} \label{chap:numerics}
\minitoc

This chapter is devoted to the numerical implementation of the dynamic gradient damage model outlined in \cref{def:dynagraddama}. Semi-spatial discretization is performed in \cref{sec:spatial} based on the classical $C^0$ finite element method. The coupled two-field evolution problem is then discretized in the time domain based on the general $\beta$-Newmark scheme, see \cref{sec:timedis}. Some implementation issues are indicated in \cref{sec:implementation}.

In this contribution the spatial and temporal discretization is as usual decoupled and will be discussed below separately. Space-time finite element methods, see \cite{HughesHulbert:1988}, exploits fully the variational nature of the formulation \eqref{eq:vi} and can be considered as a possible improvement in the future. The elastic energy density split \eqref{eq:elasticTC} is adopted to take into account tension-compression asymmetry. The two damage constitutive laws \eqref{eq:at2} and \eqref{eq:at1} will be used. In this work the irreversibility condition and the variational inequality \eqref{eq:vi} will be effectively implemented, which amounts to solve numerically the weak wave equation \eqref{eq:weakform} and the minimality principle for damage \eqref{eq:crackmin} at every time step.

\section{Spatial Discretization} \label{sec:spatial}
The spatial discretization described here constitutes a dynamic extension of the work of \cite{BourdinFrancfortMarigo:2008,PhamAmorMarigoMaurini:2011} for the regularized fracture model \eqref{eq:Pualpha} and the quasi-static gradient damage model outlined in \cref{def:qsgraddama}. A discussion on the large-displacement situations is indicated at the end. The thematic subjects covered here are thus summarized in \cref{tab:summsd}.
\begin{table}[htbp]
\centering
\caption{Thematic subjects covered in this section} \label{tab:summsd}
\begin{tabular}{ccccc} \toprule
& Going dynamical & $\alpha\leftrightarrow\phi$ & $\nabla\alpha\to\Gamma$ & Experimental validation \\ \midrule
Theoretics & & & & \\
Numerics & \rightthumbsup & & & \\ \bottomrule
\end{tabular}
\end{table}

A semi spatial discretization is performed from a mesh $\Omega_h$ of the original domain $\Omega$. It should be ideally unstructured and uniform in mesh sizes otherwise some directions may be preferred when cracks propagate, see \cite{Negri:1999,PhamAmorMarigoMaurini:2011} and references therein for a discussion on the ideal mesh properties in order to achieve a better modeling of fracture via gradient-damage approaches. In particular, the typical element size $h$ of the mesh should be preferably smaller with respect to the internal length $\ell$ in order to calculate correctly the damage band profile, the dissipation energy \eqref{eq:surface} and the material response inside the crack process zone of order $\mathcal{O}(\ell)$. It leads often to a computationally demanding calculation which requires massive parallelization.

The displacement $\vec{u}_t$ and the damage field $\alpha_t$ will be both discretized with classical $C^0$ isoparametric finite elements based on $\Omega_h$. For two-dimensional plane problems, an arbitrary element possesses at every node 3 nodal degrees of freedom corresponding to 2 components of the displacement and 1 scalar value of the damage, see for example \cref{fig:q4}.
\begin{figure}[htbp]
\centering
\includegraphics[width=0.25\textwidth]{q4.pdf}
\caption{Local interpolation of $(\vec{u},\alpha)$ based on nodal values inside the element} \label{fig:q4}
\end{figure}
The symbols $\uvec$ and $\dvec$ are used to denote the current global displacement and damage nodal vectors. Inside a given physical element $\Omega_\me\in\Omega_h$, their local nodal vectors $\uvec^\me$ and $\dvec^\me$ achieve an interpolation of the displacement and damage fields as well as their derivatives
\begin{equation} \label{eq:interpolation}
\begin{aligned}
& \vec{u}_t(\vec{x})=\vec{N}(\vec{x})\uvec^\me\quad\text{and}\quad\eps(\vec{u}_t)(\vec{x})=\vec{B}(\vec{x})\uvec^\me\, , \\
& \alpha_t(\vec{x})=\vec{N}_\alpha(\vec{x})\dvec^\me\quad\text{and}\quad\nabla\alpha_t(\vec{x})=\vec{B}_\alpha(\vec{x})\dvec^\me
\end{aligned}
\end{equation}
where $\vec{N}$'s and $\vec{B}$'s are respectively the interpolation and differentiation matrices. The Voigt notation is assumed for the strain tensor $\eps(\vec{u}_t)$ and the damage gradient $\nabla\alpha_t$, which are written as column vectors. \emph{Linear} interpolation is used due to its low computational cost in a dynamic calculation. According to \cite{BourdinFrancfortMarigo:2008}, linear elements for the displacement and damage fields perform equally well compared to higher-order elements in terms of $\Gamma$-convergence of the damage dissipation energy. Finally this P1-P1 finite element discretization is not forbidden according to \cite{SimoneAskesPeerlingsSluys:2003}.

\paragraph{Displacement problem}
Plugging \eqref{eq:interpolation} into the weak elastic-damage dynamic wave equation \eqref{eq:weakform} and adopting the same interpolation for the testing function $\vec{w}_t$, we obtain the following spatially discretized dynamic evolution equation
\begin{equation} \label{eq:waveeqsdis}
\vec{M}\ddot{\uvec}=\vec{F}_\mathrm{ext}-\vec{F}_\mathrm{int}(\uvec,\dvec)
\end{equation}
with $\vec{M}$ the consistent mass matrix, $\vec{F}_\mathrm{ext}$ the external force vector corresponding to the potential \eqref{eq:power} and $\vec{F}_\mathrm{int}$ the internal force vector. The mass matrix is assembled from the elementary mass matrices which reads inside $\Omega_\mathrm{e}$
\[
\vec{M}=\int_{\Omega_\mathrm{e}}\rho\vec{N}^\mT\vec{N}\dx.
\]
For explicit dynamic situations, this matrix is lumped $\vec{M}\mapsto \overline{\vec{M}}$ using the classical row-summing techniques to improve computational efficiency and spectral properties, see \cite{Hughes:1987}. The global internal force vector is constructed from its elementary counterparts which are given by
\begin{equation} \label{eq:Fint}
\begin{aligned}
& \vec{F}_\mathrm{int}^\me=\int_{\Omega_\me}\vec{B}^\mT\sig\bigl(\vec{B}\uvec^\me,\vec{N}_\alpha\dvec^\me\bigr)\dx \\
&= \int_{\Omega_\me}\vec{B}^\mT\bigl(\mathsf{a}(\vec{N}_\alpha\dvec^\me)\sig_0^+(\vec{B}\uvec^\me)+\sig_0^-(\vec{B}\uvec^\me)\bigr)\dx\,,
\end{aligned}
\end{equation}
where the stress expression \eqref{eq:stressposneg} that takes into account tension-compression asymmetry is used. In explicit dynamics a residual stiffness $k_\mathrm{res}$ is not needed in the stiffness degradation function since no matrix inversion is needed, contrary to the implicit cases \cite{PhamAmorMarigoMaurini:2011,SchlueterWillenbuecherKuhnMueller:2014}.

For simplex finite elements (triangular and tetrahedral elements) the Jacobian of the transformation (between the reference and the physical elements) as well as the differentiation matrix $\vec{B}$ are constant, thus \eqref{eq:Fint} can be integrated exactly using an effective stress
\begin{equation} \label{eq:FintSim}
\vec{F}_\mathrm{int}^\me=\abs{\Omega_\me}\vec{B}^\mT\sig_\mathrm{eff}=\abs{\Omega_\me}\vec{B}^\mT(\mathsf{a}_\mathrm{eff}\sig_0^++\sig_0^-)\,,
\end{equation}
where $\abs{\Omega_\me}$ denotes the measure (area of volume) of $\Omega_\me$ and $\mathsf{a}_\mathrm{eff}$ stands for the effective stiffness degradation
\begin{equation} \label{eq:aeff}
\mathsf{a}_\mathrm{eff}=\frac{1}{\abs{\Omega_\me}}\int_{\Omega_\me}\mathsf{a}(\vec{N}_\alpha\dvec)\dx.
\end{equation}
Explicit expression of $\mathsf{a}_\mathrm{eff}$ can be readily computed and are given as follows.
\begin{itemize}
\item Triangular elements
\[
\mathsf{a}_\mathrm{eff}=\frac{1}{3}\left(\left(1-\frac{\alpha_1}{2}-\frac{\alpha_2}{2}\right)^2+\left(1-\frac{\alpha_2}{2}-\frac{\alpha_3}{2}\right)^2+\left(1-\frac{\alpha_1}{2}-\frac{\alpha_3}{2}\right)^2\right)
\]

\item Tetrahedral elements
\[
\mathsf{a}_\mathrm{eff}=1+\frac{1}{10}\sum_{i=1}^4\sum_{j=1}^4\alpha_i\alpha_j-\frac{1}{2}\sum_{i=1}^4\alpha_i
\]
\end{itemize}
The use of the effective stress $\sig_\mathrm{eff}$ improves computational efficiency and may also be served as an output of the current element.

For tensor product finite elements, a loop on the Gauss points is necessary and our experience suggests that 4 Gauss points for quadrilateral elements and 8 for hexagonal elements are sufficient. An effective stress can no longer be defined and the stress evaluated at these Gauss points will be used as the output variable.

\begin{remark}[Extension to large-displacements]
Numerical implications of the large-displacement extension proposed in \cref{sec:extensions} are discussed here. It is based on the explicit dynamics situations, where at the beginning of every time step the current configuration $\vphi_t(\Omega)$ is known and is updated from the last iteration. The Eulerian elastic-damage dynamic wave equation \eqref{eq:waveeq} will be naturally solved in the current deformed mesh obtained by constantly updating the mesh coordinates $\vec{x}_t=\vec{x}+\vec{u}_t(\vec{x})\in\Omega_t$.

This implies that the interpolation of the displacement and the damage \eqref{eq:interpolation}, as well as the calculation of the global internal force vector \eqref{eq:Fint} should be performed in the deformed element $\vphi_t(\Omega_\mathrm{e})$. If the interpolation $\vec{N}$'s can always be transformed to a reference element, the differentiation matrices $\vec{B}$'s should be evaluated with respect to the current deformed element geometry and hence require being constantly updated at the beginning of every time step.

The Hencky logarithmic strain $\vec{h}_t$ defined in \eqref{eq:logstrain} replaces the use of the linearized strain in the calculation of the stress tensor in \eqref{eq:Fint}. Although the polar decomposition is indeed unnecessary by remarking that $\log\vec{V}_t=\frac{1}{2}\log\vec{B}_t$, spectral decomposition of the left Cauchy-Green tensor $\vec{B}_t=\vec{F}_t\vec{F}_t^\mT$ is unavoidable.
\end{remark}

\paragraph{Damage problem}
Plugging the interpolation expression \eqref{eq:interpolation} into the energy minimization principle \eqref{eq:crackmin} and using the elastic energy density split \eqref{eq:elasticTC} leads to the following spatially discretized variational inequality
\begin{equation} \label{eq:crackdis}
q_{\uvec}(\dvec)\leq q_{\uvec}(\underline{\vec{\beta}})\text{ for all $\underline{\vec{\beta}}$ that $0\leq\dvec\leq\underline{\vec{\beta}}\leq 1$}
\end{equation}
which involves the following discrete functional which reads inside each element
\begin{equation} \label{eq:qdiscrete}
q_{\uvec}^\mathrm{e}(\dvec)=\int_{\Omega_\mathrm{e}}\bigl(\mathsf{a}(\vec{N}_\alpha\dvec^\me)\psi_0^+(\vec{B}\uvec^\me)+w(\vec{N}_\alpha\dvec^\me)+w_1\eta^2\dvec^{\me\mT}\vec{B}_\alpha^\mT\vec{B}_\alpha\dvec^\me\bigr)\dx.
\end{equation}
For sophisticated damage constitutive laws such as that used in \cite{LorentzGodard:2011}, it is a nonlinear convex functional where the Hessian matrix depends on the damage state during numerical solving. Fortunately, using the damage constitutive laws \eqref{eq:at2} and \eqref{eq:at1}, this functional $q_{\uvec}(\dvec)$ is quadratic with respect to the damage vector $\dvec$ and is given by
\begin{equation} \label{eq:Hb}
q_{\uvec}(\dvec)=\frac{1}{2}\dvec^\mT\vec{H}(\uvec)\dvec-\vec{b}(\uvec)^\mT\dvec.
\end{equation}
The Hessian matrix $\vec{H}$ and the second member vector $\vec{b}$ depend solely on the current deformation state $\uvec$ and hence are constant during the solving process of the damage problem. Their exact forms depend on the damage constitutive law used:
\begin{itemize}
\item For the \eqref{eq:at1} law for instance, they can be assembled from the elementary matrix and vector given by
\begin{align*}
\vec{H}^\me &= \int_{\Omega_\me}\left(2\psi_0^+(\vec{B}\uvec^\me)\vec{N}_\alpha^\mT\vec{N}_\alpha+2w_1\eta^2 \vec{B}_\alpha^\mT\vec{B}_\alpha\right)\dx, \\
\vec{b}^\me &= \int_{\Omega_\me}\left(2\psi_0^+\bigl(\vec{B}\uvec^\me\bigr)-w_1\right)\vec{N}_\alpha\dx.
\end{align*}

\item For the \eqref{eq:at2} model, they are given by
\begin{align*}
\vec{H}^\me &= \int_{\Omega_\me}\left(2\left(\psi_0^+\bigl(\vec{B}\uvec\bigr)+w_1\right)\vec{N}_\alpha^\mT \vec{N}_\alpha+2w_1\eta^2\vec{B}_\alpha^\mT \vec{B}_\alpha\right), \\
\vec{b}^\me &= \int_{\Omega_\me}2\psi_0^+\bigl(\vec{B}\uvec\bigr)\vec{N}_\alpha.
\end{align*}
\end{itemize}
These quantities can be evaluated exactly for simplex finite elements. For quadrilateral and hexahedral elements, an approximated using a numerical integration with respectively 4 and 8 Gauss points will be used.

\begin{remark}[Extension to large-displacements]
According to \eqref{eq:crackmin}, the damage minimality condition is naturally formulated in the initial reference configuration. From a physical point of view, this corresponds to the fact that the damage dissipation energy is destined to measure the length or the area of cracks defined in the reference configuration. Technically the concerned energetic functional can be written in the deformed mesh (at the expense of additional unpleasant $\vec{F}_t$ and $J_t$ terms), however it is not necessary \cite{PieroLancioniMarch:2007}.

From a implementation point of view, it implies that the interpolation and differentiation matrices $\vec{N}$'s and $\vec{B}$'s that corresponds to the initial configuration should be stored and will be used throughout the calculation.
\end{remark}

\section{Temporal Discretization} \label{sec:timedis}
This section described a temporal discretization of the dynamic gradient damage model. The thematic subjects covered here are thus summarized in \cref{tab:summtd}.
\begin{table}[htbp]
\centering
\caption{Thematic subjects covered in this section} \label{tab:summtd}
\begin{tabular}{ccccc} \toprule
& Going dynamical & $\alpha\leftrightarrow\phi$ & $\nabla\alpha\to\Gamma$ & Experimental validation \\ \midrule
Theoretics & & & & \\
Numerics & \rightthumbsup & & & \\ \bottomrule
\end{tabular}
\end{table}

Consider an arbitrary discretization $(t^n)$ of the time interval $I=[0,T]$ where the superscript $n$ denotes a quantity evaluated at the $n$-th time step. We will mainly focus on the time stepping procedures bringing the current known states $(\uvec^n,\dot{\uvec}^n,\ddot{\uvec}^n,\dvec^n)$ to the next time step $(\uvec^{n+1},\dot{\uvec}^{n+1},\ddot{\uvec}^{n+1},\dvec^{n+1})$. In the time-continuous model the weak elastic-damage dynamic wave equation \eqref{eq:weakform} and the damage minimality condition \eqref{eq:crackmin} are coupled in the first-order stability principle \eqref{eq:vi}. After temporal discretization $\uvec$ and $\dvec$ evaluated at the last time step $t=t^n$ and the current time step $t=t^{n+1}$ are in general involved in an implicit fashion. However, we observe that the energy minimization principle \eqref{eq:crackmin} for damage is not a genuine time evolution problem since time dependence is only introduced via the irreversibility condition. After a temporal discretization \eqref{eq:crackdis} at time $t=t^{n+1}$ reads
\begin{equation} \label{eq:crackstdis}
q_{\,\uvec^{n+1}}(\dvec^{n+1})\leq q_{\,\uvec^{n+1}}(\underline{\vec{\beta}}) \text{ for all $\underline{\vec{\beta}}$ that $0\leq\dvec^n\leq\underline{\vec{\beta}}\leq 1$}
\end{equation}
where the Hessian matrix and the second member vector in \eqref{eq:Hb} are evaluated at $\uvec^{n+1}$. The equation \eqref{eq:crackstdis} can be interpreted as a numerical minimization problem of the quadratic functional $q$ under the irreversible constraint that the current sought damage state $\dvec^{n+1}$ is pointwise within the bound $[\dvec^n,1]$
\begin{equation} \label{eq:cracknummin}
\dvec^{n+1}=\operatorname{arg min}q_{\,\uvec^{n+1}}(\cdot)\text{ subject to the constraints $0\leq\dvec^n\leq\dvec^{n+1}\leq 1$}.
\end{equation}
The next damage state $\dvec^{n+1}$ can thus be accurately calculated as long as the next deformation state $\uvec^{n+1}$ is known.

It remains then to specify the temporal discretization method used for the $\vec{u}$-problem. In this work we adopt the classical second-order accurate Newmark-$\beta$ integrator, which assumes the following time-stepping procedure
\begin{align}
\dot{\uvec}^{n+1} &= \dot{\uvec}^n+\frac{\Delta t}{2}\left(\ddot{\uvec}^n+\ddot{\uvec}^{n+1}\right)\,, \label{eq:un2} \\
\uvec^{n+1} &= \uvec^n+\Delta t\dot{\uvec}^n+\frac{1-2\beta}{2}\Delta t^2\ddot{\uvec}^n+\beta\Delta t^2\ddot{\uvec}^{n+1}. \label{eq:un1}
\end{align}
The implicit method $0<\beta\leq\frac{1}{2}$ may be suitable for intermediate situations between a quasi-static and an explicit dynamic calculation. In the present work it will be used to numerically investigate the quasi-static limit of the dynamic model, see \cref{sec:antiplane}. The explicit method $\beta=0$ with a lumped mass matrix $\overline{\vec{M}}$ should be preferred mainly in terms of computational efficiency for applications where the loading speed or the crack propagation speed is comparable to the material sound speed, since in general the time scale involved is typically of order $\mathcal{O}(\SI{1}{ms})\ll\mathcal{O}(\SI{1}{s})$. The explicit method is conditionally stable. The constraint prescribed on the current time increment $\Delta t$ is often determined by the CFL condition $\Delta t<\Delta t_\mathrm{CFL}=\min(h/c)$ where $h$ is the mesh size, $c$ is the material sound speed and the smallest value is chosen among all elements. This is not a very inconvenient feature since in the presence of high geometrical and material nonlinearities even unconditionally stable implicit schemes need a small time increment comparable to $\Delta t_\mathrm{CFL}$. In the calculation of the material sound speed, the current damage state $\alpha_t$ as well as the tension-compression split formulation \eqref{eq:elasticTC} is taken into account. Thus a totally damaged element under tension does not penalize the total computational time.

The spatially discretized elastic-damage equation reads
\begin{equation} \label{eq:waveeqsdistdis}
\vec{M}\ddot{\uvec}^{n+1}=\vec{F}_\mathrm{ext}^{n+1}-\vec{F}_\mathrm{int}(\uvec^{n+1},\dvec^{n+1}).
\end{equation}
It can be seen that the determination of the the new acceleration $\ddot{\uvec}^{n+1}$ requires the knowledge of the new deformation state $\uvec^{n+1}$ which itself determines the new damage field at time $t=t^{n+1}$ via \eqref{eq:cracknummin}. For the implicit Newmark method $\beta\neq 0$, \eqref{eq:un1} can thus be regarded as a nonlinear equation in $\uvec^{n+1}$, where nonlinearity results from the irreversibility condition when minimizing the total energy \eqref{eq:cracknummin}. To decouple the $(\uvec^{n+1},\dvec^{n+1})$ problem, we use a staggered time-stepping procedure as used in \cite{Bourdin:2011,BordenVerhooselScottHughesLandis:2012,HofackerMiehe:2012} among others. The idea is to update the acceleration $\ddot{\uvec}^{n+1}$ while fixing the damage state at its \emph{previous} known value $\dvec^n$. Hence \eqref{eq:waveeqsdistdis} becomes
\begin{equation} \label{eq:waveeqsdistdis2}
\vec{M}\ddot{\uvec}^{n+1}\approx\vec{F}_\mathrm{ext}^{n+1}-\vec{F}_\mathrm{int}(\uvec^{n+1},\dvec^n).
\end{equation}
When a relatively small time-step is used, it is expected that the damage increment $\dvec^{n+1}-\dvec^n$ is bounded and the staggered time-discrete model will converge to the continuous one, cf. \cite{LarsenOrtnerSuli:2010}. Introducing the displacement prediction at time $t=t^{n+1}$
\[
\tilde{\uvec}^{n+1}=\uvec^n+\Delta t\dot{\uvec}^n+\frac{1-2\beta}{2}\Delta t^2\ddot{\uvec}^n\,,
\]
from \eqref{eq:un1} we obtain the equation for $\uvec^{n+1}$
\begin{equation} \label{eq:getuvecnp1}
\vec{M}\frac{\uvec^{n+1}-\tilde{\uvec}^{n+1}}{\Delta t^2}=\beta\bigl(\vec{F}_\mathrm{ext}^{n+1}-\vec{F}_\mathrm{int}(\uvec^{n+1},\dvec^n)\bigr).
\end{equation}
In general due to the use of tension-compression asymmetry models \eqref{eq:elasticTC}, it is a nonlinear equation which requires several Newton iterations and the evaluation of the current tangent stiffness. The time-stepping procedure for the dynamic gradient damage model based on the implicit Newmark-$\beta$ method in a prediction-correction form is summarized in \cref{algo:implicit}.
\begin{algorithm}[htbp]
\caption{Staggered time-stepping procedure for the dynamic gradient damage model based on the implicit Newmark-$\beta$ method} \label{algo:implicit}
\begin{algorithmic}[1]\linespread{1.2}\selectfont\normalsize
\For{every successive time step $n\geq 0$}
  \State Prediction $\tilde{\uvec}^{n+1}=\uvec^n+\Delta t\dot{\uvec}^n+\frac{1-2\beta}{2}\Delta t^2\ddot{\uvec}^n$.
  \State Prediction $\tilde{\underline{\vec{v}}}^{n+1}=\dot{\uvec}^n+\frac{\Delta t}{2}\ddot{\uvec}^n$.
  \State Solve $\uvec^{n+1}$ via \eqref{eq:getuvecnp1}.
  \State Update $\ddot{\uvec}^{n+1}=(\uvec^{n+1}-\tilde{\uvec}^{n+1})/(\beta\Delta t^2)$.
  \State Update $\dot{\uvec}^{n+1}=\tilde{\underline{\vec{v}}}^{n+1}+\frac{\Delta t}{2}\ddot{\uvec}^{n+1}$.
  \State Solve $\dvec^{n+1}$ via \eqref{eq:cracknummin}.
\EndFor
\end{algorithmic}
\end{algorithm}

\begin{remark}
After temporal discretization, the elastic-damage dynamic wave equation \eqref{eq:weakform} and the damage minimality condition \eqref{eq:crackmin} can also be solved in a monolithic fashion inside a nonlinear Newton solver described for example in \cite{BordenVerhooselScottHughesLandis:2012,SchlueterWillenbuecherKuhnMueller:2014}. The irreversible condition contained in \eqref{eq:cracknummin} should be included in the monolithic solver to ensure that the damage variable is subject to a bound constraint during solving. Future work could be devoted to a detailed analysis of these schemes in terms of computational efficiency.
\end{remark}

\begin{remark}
In the staggered time-stepping procedure, the approximation $\ddot{\uvec}^{n+1}\approx\ddot{\uvec}^{n}$ simplifies the coupled solving of the displacement and the damage. However, we admit that the $(\uvec^{n+1},\dvec^{n+1})$ couple obtained at the end of the current time step do not necessarily satisfy the weak elastic-damage dynamic wave equation \eqref{eq:weakform} and the damage minimality condition \eqref{eq:crackmin}. Following the alternate minimization procedure common for quasi-static models, see \cite{PhamAmorMarigoMaurini:2011}, several alternate iterations could also be performed here until convergence. However in dynamics, since the time-step is in general close to the critical time-step (\emph{i.e.} very small), convergence could be reached within the first iteration. In any case when $\Delta t\to 0$, the discrete staggered model converges to the continuous one, see the remark given at the end of this section.
\end{remark}

In the explicit case when $\beta=0$, it turns out that the time evolution system in $(\uvec,\dvec)$ is automatically decoupled and the two subproblems separately in $\uvec^{n+1}$ and in $\dvec^{n+1}$ can be solved in a sequence at every time step, see \cref{fig:updatestate}.
\begin{figure}[htbp]
\centering
\[
\xymatrix{ & \vec{H}(\uvec^{n+1}) \ar[dr] & & & & & \\
\uvec^{n+1} \ar[ur] \ar[r] & \vec{b}(\uvec^{n+1}) \ar[r] & \dvec^{n+1} \ar[r] & \vec{F}_\mathrm{int}(\uvec^{n+1},\dvec^{n+1}) \ar[r] & \ddot{\uvec}^{n+1} \ar[r] & \dot{\uvec}^{n+3/2} \ar[r] & \uvec^{n+2} \\
& \dvec^n \ar[ur] & & \vec{F}_\mathrm{ext}^{n+1} \ar[ur] & \dot{\uvec}^{n+1/2} \ar[ur] & \uvec^{n+1} \ar[ur] &}
\]
\caption{Updating flow of the explicit time-stepping procedure for the discretized dynamic gradient damage model at the time step $t^{n+1}$}
\label{fig:updatestate}
\end{figure}
Indeed according to \eqref{eq:un1}, the current displacement state $\uvec^{n+1}$ can be directly determined from the previous kinematic states, which itself determines then the damage state via \eqref{eq:cracknummin}. Introducing the middle-step velocity
\[
\dot{\uvec}^{n+1/2}=\dot{\uvec}^n+\frac{\Delta t}{2}\ddot{\uvec}^n\,,
\]
the Newmark time-stepping \eqref{eq:un2} and \eqref{eq:un1} reads
\begin{align*}
\uvec^{n+1} &= \uvec^n+\Delta t\dot{\uvec}^{n+1/2}\,, \\
\dot{\uvec}^{n+1} &= \dot{\uvec}^{n+1/2}+\frac{\Delta t}{2}\ddot{\uvec}^{n+1}\,, \\
\dot{\uvec}^{n+1/2} &= \dot{\uvec}^{n-1/2}+\Delta t\ddot{\uvec}^{n}.
\end{align*}
The explicit time-stepping procedure for the discretized dynamic gradient damage model is then summarized in \cref{algo:explicit}. It is implemented by the author in the explicit dynamics software EPX, see \cite{EPX:2015}.
\begin{algorithm}[htbp]
\caption{Explicit time-stepping procedure for the dynamic gradient damage model} \label{algo:explicit}
\begin{algorithmic}[1]\linespread{1.2}\selectfont\normalsize
\For{every successive time step $n\geq 0$}
  \State Update $\dot{\uvec}^{n+1/2}=\dot{\uvec}^{n}+\frac{\Delta t}{2}\ddot{\uvec}^n$.
  \State Update $\uvec^{n+1}=\uvec^n+\Delta t\dot{\uvec}^{n+1/2}$.
  \State Solve $\dvec^{n+1}$ via \eqref{eq:cracknummin}.
  \State Solve $\ddot{\uvec}^{n+1}$ via \eqref{eq:waveeqsdistdis} with the lumped mass matrix $\overline{\vec{M}}$.
  \State Update $\dot{\uvec}^{n+1}=\dot{\uvec}^{n+1/2}+\frac{\Delta t}{2}\ddot{\uvec}^{n+1}$.
\EndFor
\end{algorithmic}
\end{algorithm}

The initialization phase for the above implicit and explicit time-stepping procedure is described in \cref{algo:init}. We observe that the initial damage is recomputed $\dvec^{-1}\mapsto\dvec^0$ in the step 2. The role of $\dvec^{-1}$ is to bring some \emph{a priori} knowledge of the damage field resulting from a previous calculation or more frequently to represent an initial crack $\dvec^{-1}=1$ on $\Gamma_0$. This step thus renders it compatible with the initial displacement condition and the energy minimization structure. Remark that in phase field approaches for example in \cite{BordenVerhooselScottHughesLandis:2012}, the initial crack is introduced via an initial history field $\mathcal{H}_0$ which is localized along the desired initial defect. It is due to the fact that the irreversible constraint is dropped during energy minimization \eqref{eq:crackmin} in their models.
\begin{algorithm}[htbp]
\caption{Initialization for the implicit and explicit time-stepping procedure described in \cref{algo:implicit,algo:explicit}} \label{algo:init}
\begin{algorithmic}[1]\linespread{1.2}\selectfont\normalsize
\State Given initial conditions $\uvec^0$, $\dot{\uvec}^0$ and $\dvec^{-1}$.
\State Reinitialize the damage $\dvec^0=\operatorname{arg min}q_{\,\uvec^0}(\cdot)$ subjected to constraints $0\leq\dvec^{-1}\leq\dvec^0\leq 1$.
\State Initialize the acceleration $\vec{M}\ddot{\uvec}^0=\vec{F}_\mathrm{ext}^0-\vec{F}_\mathrm{int}(\uvec^0,\dvec^0)$.
\end{algorithmic}
\end{algorithm}

\begin{remark}[Temporal convergence]
Remark that only the irreversiblity condition $\dot{\alpha}_t\geq 0$ and the variational inequality \eqref{eq:vi} is effectively implemented. The former condition is reinforced during energy minimization \eqref{eq:cracknummin}. It is shown in \cite{LarsenOrtnerSuli:2010} that the time-discrete numerical model summarized by \cref{algo:implicit,algo:explicit} will converge to the continuous model, \emph{i.e.} \cref{def:dynagraddama}. In particular, it will thus also balance energy as required in \eqref{eq:dyngdeb}, when the time increment becomes small. Their constructive proof makes use of the implicit Euler scheme used in \cite{Bourdin:2011}, however our experience suggests the same for the implicit and explicit Newmark schemes.
\end{remark}

\begin{remark}[Approximation of the Hencky logarithmic strain]
An approximation of the Hencky strain based on the following remarkable property established in \cite{XiaoBruhnsMeyers:1997} can be used: within a proper corotational frame the rate of the Hencky strain equals the stretching tensor. An increment of the Hencky strain can thus be given by $\Delta\vec{h}^n\approx\symgrad(\Delta\vec{u}^n)$ where $\symgrad$ denotes the symmetrized gradient operator and the displacement increment $\Delta\vec{u}^n=\vec{u}^n-\vec{u}^{n-1}$ is written in the current deformed configuration. To have better accuracy, a second-order approximation based on the incremental Almansi strain is used
\[
\Delta\vec{h}^n\approx\frac{1}{2}\bigl(\nabla\Delta\vec{u}^n+\nabla^\mT\Delta\vec{u}^n-(\nabla^\mT\Delta\vec{u}^n)(\nabla\Delta\vec{u}^n)\bigr).
\]
Finally the current Hencky strain is incremented $\vec{h}^n=\vec{h}^{n-1}+\Delta\vec{h}^n$.
\end{remark}

\section{Implementation} \label{sec:implementation}
This section provides some details on the implementation of the discretized numerical model summarized by \cref{algo:implicit,algo:explicit}. The thematic subjects covered here are thus summarized in \cref{tab:summim}.
\begin{table}[htbp]
\centering
\caption{Thematic subjects covered in this section} \label{tab:summim}
\begin{tabular}{ccccc} \toprule
& Going dynamical & $\alpha\leftrightarrow\phi$ & $\nabla\alpha\to\Gamma$ & Experimental validation \\ \midrule
Theoretics & & & & \\
Numerics & \rightthumbsup & & & \\ \bottomrule
\end{tabular}
\end{table}

\subsection{Numerical solving of the damage problem}
In this work, the damage energy minimization problem \eqref{eq:cracknummin} will be directly solved at the structural scale. It could be converted into an equivalent local problem defined for each element. This possibility requires introduction of Lagrange multipliers at every Gauss points and an identification between the nodal damage field and the damage defined at Gauss points, see \cite[p.~49]{Beaurain:2011}. The principal motivation of this kind of Lagriangian modeling is the ability in the software Code-Aster to impose more naturally the irreversibility condition, however the computational cost is higher due to additional unknown variables.

Consequently, \eqref{eq:cracknummin} can be regarded as a large scale bound-constrained minimization problem defined at the structural level. Due to the damage constitutive requirement, the problem is convex and gradient-based numerical algorithms can be applied. These methods call for the evaluation of the objective functional \eqref{eq:Hb} as well as its first and second derivatives (Hessian matrix $\vec{H}$). An efficient storage and manipulation of these objects is essential especially in an explicit dynamics context.

Here the library PETSc is adopted due to its optimized efficiency, see \cite{PETSc:2015}. As a high-level C++/Fortran numerical linear algebra backend, PETSc provides in particular the \texttt{Vec} and the \texttt{Mat} classes for defining vectors and matrices. The actual storage format is not fixed in advance and it suffices to call the function \texttt{Vec/MatSetType} to affect a particular format. The computational arrays (the CSR format for example) can be extracted for output but in general all operations of these objects \texttt{Vec}/\texttt{Mat} are independent of the storage format used and thus transparent to the user. As an example, a unique interface is available to conduct a matrix-vector product
\begin{lstlisting}[language=Fortran]
CALL MATMULT(H,X,GRAD,PETSCERR)
\end{lstlisting}
where the vector \texttt{GRAD} stocks the result of $\vec{H}\dvec$. PETSc is built on the Message Passing Interface (MPI) standard and only one generic version exists which can be run either in sequential or parallel. The calling functions are almost the same in both cases, thus the code could be parallelized with minor interface changes.

Specifically the Gradient Projection Conjugate Gradient (GPCG) algorithm proposed in \cite{MoreToraldo:1991} is used to numerically solve \eqref{eq:cracknummin} in an iterative fashion. It is already implemented in the TAO package of PETSc and is designed for quadratic bound-constrained minimization problems. Due to the bound constraint, approximate solutions $\bvec$ to \eqref{eq:cracknummin} can be defined using the projected gradient $[\vec{g}]$ of which the $i$-th component is given by
\[
0\overset{?}{\approx}[\vec{g}]_i=\begin{cases}
\partial_i q & \text{if $\bvec_i\in(\dvec_i^n,1)$}\,, \\
\min(\partial_i q, 0) & \text{if $\bvec_i=\dvec_i^n$}\,, \\
\max(\partial_i q, 0) & \text{if $\bvec_i=1$}.
\end{cases}
\]
At each solving iteration, the method consists of several gradient projections
\[
\bvec\gets\mathbb{P}\bigl(\bvec-c\nabla q(\bvec)\bigr)
\]
to \emph{approximately} identify the \emph{active} nodes, \emph{i.e.} those either $\dvec_i^{n+1}=\dvec_i^n$ or $\dvec_i^{n+1}=1$. Note that here we perform a gradient descent followed by a projection $\mathbb{P}$ onto the bound to ensure that $\dvec^n\leq\bvec\leq 1$. Then it applies the preconditioned conjugate gradient method to minimize an unconstrained reduced problem of the \emph{free} variables, \emph{i.e.} those satisfying $\dvec_i^n<\dvec_i^{n+1}<1$. The method proceeds to the next iteration until convergence. Interested readers are referred to \cite{MoreToraldo:1991} for a more detailed explanation of the algorithm. The incomplete Cholesky factorization preconditioner is applied block-wise into each decomposed subdomain. Computational load is also well balanced in parallel computations based on domain decomposition, see \cite{BensonMcInnesMore:2001}.

Using the PETSc library, both the implicit and explicit time-stepping \cref{algo:implicit,algo:explicit} are implemented by the author as a Python package named ``FEniCS Dynamic Gradient Damage'', see \cite{LiMaurini:2015}. It is based on the FEniCS Project \cite{LoggMardalWells:2012} for automated solution of partial differential equations. A specific C++ interface \texttt{PETScTAOSolver} is developed by the author which brings various mathematical optimization algorithms defined in PETSc/TAO into FEniCS. In this implementation the tension-compression asymmetry is not taken into account. A linearized strain theory is also assumed.

The explicit time-stepping procedure for the dynamic gradient damage model summarized in \cref{algo:explicit} is also implemented in EPX by the author, an explicit dynamics program dedicated to transient phenomena involving fluid-structure interaction \cite{EPX:2015}. Here all the tension-compression asymmetry models discussed in \cref{sec:TC} are implemented. The large-displacement extension, see \cref{sec:extensions}, is also by default activated in the software.

\subsection{Details of implementation in EPX} \label{sec:epx}
\paragraph{Initialization}
The initialization \texttt{INIT\_ENDOGRAD} of the gradient damage model is performed at the end of the routine \texttt{initia.ff}. It has several objectives
\begin{itemize}
\item Allocate various Fortran arrays needed in the model: the damage field \texttt{ALPHA}, the damage dissipation energy for all elements \texttt{EFISS}\ldots

\item Initialize the PETSc solver and several objects: the minimization solver \texttt{TAOSOLV}, the global Hessian matrix for damage \texttt{HALPHA}, the PETSc viewer \texttt{VIEWER} to have access to convergence information\ldots
\end{itemize}

To guarantee a good efficiency when assembling sparse matrices, it is essential that we preallocate enough memory by indicating to PETSc the number of non-zero elements at every row of the matrix. In parallel, the non-zeros elements should be treated separately depending whether they appear in the diagonal or off the diagonal of the current processor. If this preallocation phase is omitted, PETSc will allocate the needed memory by calling \texttt{PetscMalloc} every time it encounters a new unexpected non-zero term, which causes the execution time to increase significantly, see \cite{PETSc:2015}. An overestimation of the sparse structure of the mesh connectivity is performed: for every node in the mesh, we consider all the elements containing that node and count the total node numbers possessed by these elements. Only one loop on all the elements is needed during the initialization. This overestimation does virtually no harm to the overall computational efficiency, as during the final assembly of matrices in PETSc, the routines \texttt{MatAssemblyBegin/End} will be called to release all unnecessary preallocated memories.

During a MPI parallel computation, a permutation of nodes is needed according to the PETSc convention described by the documentation of the routine \texttt{MatMPIAIJSetPreallocation}. It is achieved during initialization by a loop on all the processors based on the mesh partition performed by EPX. At the end two integer Fortran arrays are provided: \texttt{CONV\_EP(I)} which gives the position of the $i$-th EPX node in the PETSc convention, while \texttt{CONV\_PE} converts the PETSc node ordering to the EPX one.

\paragraph{Time-stepping} The change to the EPX time iteration routines \texttt{calcul.ff} and \texttt{d\_calcul.ff} is minimal. We simply add the following pseudo code concerning the assembly and the solving of the damage problem before the elastodynamics part.
\begin{lstlisting}[language=Fortran]
...
IF (L_ENDOGRAD) THEN
  CALL SEQ/MPI_ASSEM_ALPHA(...)
  CALL RESO_ALPHA(...)
END IF
...
CALL CELEM(...)
...
\end{lstlisting}

We note that the routine \texttt{SEQ/MPI\_ASSEM\_ALPHA} constructs the Hessian matrix $\vec{H}$ and the second member $\vec{b}$ associated to the quadratic damage minimization problem by performing a first loop on all the elements. The copy and the correspondence between the global damage vector and the local damage vector specific to each element are conducted without modifying the arguments of all existing routines: \texttt{celem.ff}, \texttt{loopelm.ff}, \texttt{wpgen.ff} and all element routines \texttt{triang.ff} for example. The elementary variables associated with the current element $\alpha^\mathrm{e}$, $\vec{H}^\mathrm{e}$ and $\vec{b}^\mathrm{e}$ are all stored globally inside the module \texttt{m\_endograd\_data.ff}. They are preallocated during the initialization phase depending on the maximum local nodes. This current implementation is not thread-safe, thus OpenMP parallelization is not available.

\paragraph{Element routines} At every time step, the following two loops on elements are needed:
\begin{enumerate}
\item Knowing the current configuration $\vec{x}^n$ and $\vec{u}^n$, the routine \texttt{SEQ/MPI\_ASSEM\_ALPHA} opens a first loop on elements to calculate the elementary matrices $\vec{H}^\me$ and vectors $\vec{b}^\me$ for the damage problem \eqref{eq:cracknummin}. During this first loop, the current damage field is not yet known.

\item After energy minimization \eqref{eq:cracknummin}, the current damage is solved in \texttt{RESO\_ALPHA}. We then open a loop for the second time in \texttt{CELEM} on all the elements to calculate the internal force vector $\vec{F}_\mathrm{int}^\me$ which depends on the current damage state.
\end{enumerate}

Since it is needed to perform two loops on elements at every time step, the element routines should be carefully restructured to minimize the computational cost. Some logical indicators are specially used and introduced to partition the code:
\begin{itemize}
\item \texttt{MATPRI(NTH) == 115} indicates if the current element is affected by a gradient damage material. If so, the following two logical indicators are then relevant.

\item \texttt{L\_FIRSTLOOP} encloses the lines that should be run during the calling of \texttt{SEQ/MPI\_ASSEM\_ALPHA}, \emph{i.e.} in order to calculate the elementary matrices $\vec{H}^\me$ and vectors $\vec{b}^\me$ for the damage problem. In particular, the strain tensor will be calculated at this stage via \texttt{DSDX2D} or \texttt{DSDX3D}. The tension-compression asymmetry is also performed here to calculate $\sig_0^+$ and $\sig_0^-$. The positive stress is stored temporarily in the \texttt{SIG} array while the negative stress in the \texttt{ECR} vector.

\item \texttt{L\_SECONDLOOP} encloses the lines that should be run during the calling of \texttt{CELEM} where the stress tensor and the internal force vector $\vec{F}_\mathrm{int}^\me$ will be calculated. In particular the stress tensor will be updated via \eqref{eq:stressposneg}
\end{itemize}

\paragraph{Improved method of calculating eigenvalues}
For the tension-compression asymmetry model described in \cite{MieheHofackerWelschinger:2010,FreddiRoyer-Carfagni:2010}, we need to perform the spectral decomposition of the strain tensor, see for example \cref{algo:epspos3d,algo:epspos2d}. The \texttt{DSYEV} routine of LAPACK is purely numerical (iterative method) and consequently robust but slow. Here we use and implement an analytical method described in \cite{Scherzinger:2008aa} that is both robust (in the presence of two or three identical or near eigenvalues) and computationally efficient. Consider the problem
\[
\vec{A}\approx\mathbb{I}=\begin{bmatrix}
1 & &  \\
& 1+\frac{\epsilon}{4} & \frac{3\sqrt{\epsilon}}{4} \\
& \frac{3\sqrt{\epsilon}}{4} & 1+\frac{3\epsilon}{4}
\end{bmatrix}
\]
with $\epsilon=\num{1e-7}$. Theoretical solution $(d_i,\vec{v}_i)$ is given by
\begin{equation} \label{eq:eigenvalueana}
\begin{aligned}
& d_1=1+\epsilon\,,\quad d_2=d_3=1, \\
& \vec{v}_1=(0, 1/2, \sqrt{3}/2)\,,\quad \vec{v}_2=(-1, 0, 0)\quad\text{and}\quad\vec{v}_3=(0, \sqrt{3}/2, -1/2).
\end{aligned}
\end{equation}

The analytical solution \eqref{eq:eigenvalueana} is compared with the numerical ones given by \texttt{DSYEV} and the method described in \cite{Scherzinger:2008aa}:
\begin{itemize}
\item \texttt{DSYEV}: 15 significant figures for eigenvalues and eigenvectors, within \SI{63.7}{s} for \num{1e8} calculations.
\item New method: 15 significant figures for eigenvalues and 10 for eigenvectors, within \SI{23.5}{s} for \num{1e8} calculations.
\end{itemize}
As can be seen, a factor of 2.7 in time is gained.

\section*{Summary of this Chapter}
In this chapter we describe a direct numerical implementation of the dynamic gradient damage model. It applies to both 1-d, 2-d and 3-d physical problems. Its efficiency will be demonstrated via simulation results in \cref{chap:simulation}. The spatial discretization is based on classical $C^0$ finite element method and is presented in \cref{sec:spatial}. It is decoupled from the time-stepping scheme described in \cref{sec:timedis} for the $\vec{u}$-problem governed by the discrete elastic-damage dynamic wave equation \eqref{eq:waveeqsdistdis}. The explicit Newmark method will be used whenever inertial effects are dominant. Implicit methods parametrized by the $\beta$-parameter are applied for intermediate cases between explicit dynamic and quasi-static situations. Due to the same mathematical structure for the damage problem (bound-constrained convex optimization problem), \eqref{eq:cracknummin} is solved at the structural scale similarly to the quasi-static settings. The discrete numerical model is summarized in \cref{algo:implicit,algo:explicit}.

The computational architecture is summarized in \cref{sec:implementation}. The numerical solving of the damage problem is based on the numerical linear algebra library PETSc. It is introduced to the explicit dynamics software EPX for storage and manipulation of sparse matrices and vectors. The Gradient Projection Conjugate Gradient method is used to numerically solve \eqref{eq:cracknummin}.


\chapter{{\bf Summary and Outlook}}
\label{sec:summaryandoutlook}

\section{Summary}
The LHCb experiment was built to test the predictions of the SM and search for NP effects through the study of $\mathcal{CP}$ violating and rare decays of $b$-hadrons. So far measurements performed using the LHCb experiment, and other LHC experiments, have not revealed conclusive evidence for NP effects, although some interesting anomalies have been seen in measured results in heavy flavour physics~\cite{PhysRevLett.118.111801,Aaij:2014pli, Aaij:2015oid, ATLAS-CONF-2017-023,CMS-PAS-BPH-15-008,Aaij:2015esa,PhysRevLett.113.151601,Aaij:2017vbb,Aaij:2015yra,Huschle:2015rga, Lees:2012xj,Lees:2013uzd, Sato:2016svk,Altmannshofer:2017yso,Capdevila:2017bsm,Amhis:2016xyh}.
%~\cite{PhysRevLett.118.111801,Aaij:2014pli,Aaij:2015yra,Lees:2013uzd,Huschle:2015rga,Lees:2012xj,Aaij:2015oid,Aaij:2015esa,PhysRevLett.113.151601, R_K_star}. %show no significant deviations from predictions and confirm the predictive power of the SM.
The search for \bmumu decays was identified as one of the key measurements to be made with the LHCb experiment~\cite{Adeva:2009ny} as an indirect search for NP.
In 2011 LHCb joined the search for these decays, that began over 30 years ago, using the unprecedented energies available at the LHC. The first evidence for \bsmumu decays was found by the LHCb experiment with 2.1 \fb of Run~1 data from $pp$ collisions~\cite{Aaij:2012nna}. A combined analysis of the Run~1 data from the CMS and LHCb experiments produced the first observation of \bsmumu decays and the first evidence for \bdmumu decays~\cite{CMS:2014xfa}. The measured branching fractions of these decays are consistent with the SM predictions and place constraints on BSM theories. However, the precision of the measurements still leaves room for NP effects to be revealed, therefore it is important to improve the precision of the \BF measurements. With the observation of the \bs mode the search for \bsmumu decays is complete and properties of this decay, including the effective lifetime, can now be studied. The effective lifetime offers a new observable to test the SM in \bsmumu decays that is complementary to the \BF.

The measurements of the \bmumu \BFs and the \bsmumu effective lifetime with 4.4~\fb of Run~1 and Run~2 data collected by the LHCb experiment are presented in this dissertation. Figure~\ref{fig:BDT} shows a summary of the fit used to measure the \bmumu \BFs for candidates in Run~1 and Run~2 data with a global BDT value of BDT > 0.5. The measured \BFs are
\begin{equation}
%\begin{align}
\begin{split}
  \mathcal{B}(B^{0}_{s} \to \mu^{+} \mu^{-}) &= (3.0 \pm 0.6^{+0.3}_{-0.2}) \times 10^{-9\
} \\
  \mathcal{B}(B^{0} \to \mu^{+} \mu^{-}) &= (1.5^{+1.2 +0.2}_{-1.0 -0.1})    \times 10^{-\
10}.
%\end{align}
\end{split}
\label{eq:BFresults2}
\end{equation}
The \bs mode is observed with a statistical significance of 7.8$\sigma$, making this result the first single experiment observation of this decay and the most precise measurement to date. The \bd mode has a significance of 1.6$\sigma$, therefore a limit is placed on the \BF of $\mathcal{B}$(\bdmumu)$ < 3.4 \times 10^{-10}$ at the 95$\%$ confidence level. The measured values are consistent with the SM predictions. %and Figure~\ref{fig:BDT} shows \bmumu candidates with a global BDT value of BDT > 0.5. %plot of Bd bv Bs?? with the others superimposed?
\begin{figure}[tbp]
    \centering
        \includegraphics[width=0.8\textwidth]{./Figs/Summary/BDT_plot.pdf}
    \caption{\bmumu candidates with a global BDT value of BDT > 0.5 in 4.4~\fb of Run~1 and Run~2 data collected by the LHCb experiment and the mass fit used to measure the \bmumu \BFs overlaid.}
    \label{fig:BDT}
\end{figure}

The effective lifetime of \bsmumu decays is measured for the first time to be
\begin{equation}
\tau_{\mu\mu} = 2.04 \pm 0.44 \pm 0.05 \text{ ps},
\end{equation}
which is within 1.0$\sigma$ of the SM prediction. The result is consistent with \ADG = +1 hypothesis at 1.0$\sigma$ and with \ADG = $-1$ hypothesis at 1.4$\sigma$. Although the current precision of the measurement does not enable constraints to be placed on BSM theories it is important to illustrate the ability of the LHCb experiment to make this measurement.

The measured values of the \BF presented in this dissertation have already been used to help constrain parameters in BSM theories~\cite{Altmannshofer:2017wqy,Fleischer:2017ltw,Bobeth:2017xry,Chiang:2017etj}.
The possible values available for the parameters $P$ and $S$, defined in Section~\ref{sec:BFdef}, are shown in Figure~\ref{fig:NPcontss}, where the values are constrained from the \BF results in Equation~\ref{eq:BFresults2} and the results from the CMS collaboration in reference~\cite{Chatrchyan:2013bka}. The current measurements produce a circular band of possible $P$ and $S$ values, and a precise measurement of \ADG through the \bsmumu \el will help resolve the ambiguities.

\begin{figure}[tbp]
    \centering
        \includegraphics[width=0.7\textwidth]{./Figs/Summary/fig3.pdf}
    \caption{Constraints in the $P$ - $S$ plane where $P$ and $S$ are defined in Section~\ref{sec:BFdef}. The blue band corresponds to constraints from the \bmumu \BF measurements presented in this dissertation and the CMS experiment Run~1 results in reference~\cite{Chatrchyan:2013bka}. The dashed lines show different values for \ADG and the constraints assume $\varphi_{P}, \varphi_{S}\in {0, \pi}$. The figure is taken from~\cite{Fleischer:2017ltw}.}
    \label{fig:NPcontss}
\end{figure}

\section{Outlook}
The measured values of the branching fractions and the effective lifetime still leave plenty of room for NP effects to be observed with these decays. At the end of Run~2 of the LHC, the LHCb dataset will have almost doubled to 8~\fb, enabling the precision of these measurements to be improved. Looking further ahead, LHCb is expected to collect 50~\fb of data by the end of Run~4 and with the high luminosity LHC up to 300~\fb could be recorded.

With more data, the expected precision of the \BF measurements is expected to be reduced to $\sim 0.19 \times 10^{-9}$ with 50~\fb~\cite{LHCb-PUB-2014-040}. Not only are the \BF measurements in themselves interesting to test the SM but the ratio of the \BFs of the two modes is also useful to test the SM, in particular the MFV hypothesis. The current precision of the ratio of \BFs is $\sim 60\%$~\cite{CMS:2014xfa}, and future runs of the LHC will enable the precision of the ratio of \BFs to be reduced to 40$\%$ with 50~\fb of $pp$ data and 20$\%$ with 300~\fb of data~\cite{Aaij:2244311}.

The expected uncertainty achievable by the LHCb experiment for the \el at the end of Run~2 and after future runs of the LHC is estimated using pseudoexperiments based on the observed numbers of decays with 4.4~\fb and the current measurement strategy. At the end of Run~2, with 8~\fb, the median uncertainty of the \el will be $\sim$0.2 \ps which is reduced to $\sim$0.08~\ps with 50~\fb and $\sim$0.03~\ps with 300~\fb. Therefore, with 300~\fb the precision on the effective lifetime will enable \ADG = +1 to be distinguished from \ADG = $-1$ with a statistical significance of 5$\sigma$. The expected mass and decay time distributions for 8, 50 and 300~\fb are shown in Figure~\ref{fig:expected_dist}. The expected uncertainties for the \el measurement are conservative estimates because they are based on the current measurement strategy which was designed for low expected statistics. Therefore the precision of the measurement could be much better as different analysis methods can be taken advantage of with more statistics.

\begin{figure}[tbp]
    \centering
        \includegraphics[width=0.49\textwidth]{./Figs/Summary/8fb_mass.pdf}
        \includegraphics[width=0.49\textwidth]{./Figs/Summary/8fb_time.pdf}
        \includegraphics[width=0.49\textwidth]{./Figs/Summary/50fb_mass.pdf}
        \includegraphics[width=0.49\textwidth]{./Figs/Summary/50fb_time.pdf}
        \includegraphics[width=0.49\textwidth]{./Figs/Summary/300fb_mass.pdf}
        \includegraphics[width=0.49\textwidth]{./Figs/Summary/300fb_time.pdf}
    \caption{The expected mass and decay time distributions for \bsmumu candidates to measure the \el with 8, 50 and 300~\fb. The signal and background yields are determined from the observed number of \bsmumu and combinatorial background decays and the expected number of mis-identified backgrounds and \bdmumu decays in 4.4~\fb of Run~1 and Run~2 data.}
    \label{fig:expected_dist}
\end{figure}

The current systematic uncertainty on the \el is 0.05 \ps which is too large to allow possible NP effects to be observed. However, several components contributing to the total, such as the fit accuracy and the acceptance function systematic, will be reduced with the availability of more data enabling greater precision on the measurement. With more data, an alternative analysis approach could be used which would reduce the systematic uncertainties on the \el; the selection criteria can be designed so that it does not bias \bsmumu decay time distribution, therefore removing the need for an acceptance function and the associated systematic.
%Do I want to include more discussion on this?? Or prehaps add as a appendix? I don't think a long discussion will add much here but prehaps the details could be useful or someone will ask about it ....

The study of \bmumu decays has been in progress for over 30 years and with the energy and luminosity available at the LHC, the study of these decays is just as interesting as it ever was. As more data is collected by the LHCb experiment NP effects will have less and less space to hide. It will either be seen in \bmumu decays or these decays will place ever tighter constraints on BSM theories.


\chapter{Yield extraction}
\label{chap:prod:fitting}

Signal charm mesons can be distinguished from combinatorial background in the
invariant mass distribution, as shown in \cref{fig:prod:sel:D0ToKpi:offline}
for example.
However, the contributions from prompt and secondary charm are identical in the
invariant mass, and so another distribution must be used to distinguish between
the two sources of charm decays.

This analysis uses the logarithm of the \chisq\ of the \acl{IP}, \lnipchisq, to
obtain the prompt charm yields.
The momentum vector of prompt charm should point back to the \ac{PV}, and so
the \lnipchisq\ distribution is expected be centred around zero.
For secondary charm the \lnipchisq\ distribution is expected to peak at higher
values.
This separation is exploited to distinguish between prompt and secondary charm,
where the prompt signal yield in each \pTy\ bin is measured by a binned,
extended maximum likelihood fit to the \lnipchisq\ distribution.
The prompt and secondary models in this fit are described analytically as
peaking functions.
The combinatorial background is described by a non-parametric model taken from
the data outside the signal peak in the mass distribution.
This background model is normalised in the \lnipchisq\ fit to the number of
combinatorial background candidates in a signal window defined in the mass
distribution, measured in a fit to the charm hadron mass spectrum.

For all cases but the \PDstarp\ measurement, it is the mass of the charm hadron
that is used to discriminate all signal from combinatorial background.
For the \PDstarp\ measurement, the delta mass distribution is used instead,
defined as the difference \deltam\ between the reconstructed \PDstarp\ mass and
the reconstructed \PDzero mass
\begin{equation}
  \deltam = m(\PKminus\Ppiplus\Ppiplussoft) - m(\PKminus\Ppiplus).
  \label{eqn:prod:fitting:delta_mass}
\end{equation}
This has a nominal value of \SI{145.4}{\MeVcc}~\cite{PDG2014}.
The narrower signal peak allows for a better signal-to-background ratio.

\section{Signal-background discrimination}
\label{chap:prod:fitting:mass}

For each one-dimensional mass and \deltam\ fit, one PDF is defined per
discriminatory species: signal and combinatorial background.
In both the mass and \deltam\ distributions, the prompt and secondary signal
shapes are assumed to be identical, and for the \deltam\ fits the combinatorial
background is assumed to be indistinguishable from random soft pion
backgrounds, where a true \PDzero is combined with a random track in the event.
The total \ac{PDF} is constructed as the sum of the per-species \acp{PDF}, each $f_{s}$,
each weighted by the respective yield $N_{s}$
\begin{align}
  f(m) &= \frac{1}{\sum_{\textnormal{s}} N_{\textnormal{s}}}
          \sum_{\textnormal{s}} N_{\textnormal{s}}
          f_{\textnormal{s}}(m),\\
  f(\deltam) &= \frac{1}{\sum_{\textnormal{s}} N_{\textnormal{s}}}
                \sum_{\textnormal{s}} N_{\textnormal{s}}
                f_{\textnormal{s}}(\deltam).
\end{align}

For every mass fit, the background PDF $f_{\textnormal{Bkg.}}(m)$ is taken to
be a first-order polynomial, and the signal PDF $f_{\textnormal{Sig.}}(m)$ is
dependent on the charm hadron candidate, with details given in
Section~\ref{chap:prod:fitting:details}.
The combinatorial and random soft pion background in the \deltam\ fits are
modelled as a single empirical threshold function of the (un-normalised) form
\begin{equation}
  % (dm - dm0)^A * exp(B*dm)
  % The exponential factor has been omitted, as we just set B = 0
  R(x; \deltam_{0}, A) = {(x - \deltam_{0})}^A,
\end{equation}
where $\deltam_{0}$ is the threshold value, fixed to the charged pion rest mass
$m_{\Ppipm} = \SI{139.57}{\MeVcc}$~\cite{PDG2014}.
The signal PDF in \deltam\ is the sum of three normal distributions, sharing a
common mean but allowed to have different widths.

One mass or \deltam\ PDF, $f(m)$ or $f(\deltam)$, is constructed per \pTy\ bin,
and the likelihood is formed as the product of these such that each PDF is
fitted simultaneously when the \ac{NLL} is minimised.

\section{Prompt-secondary discrimination}
\label{chap:prod:fitting:ipchisq}

The prompt and secondary signal distributions are modelled by continuous,
parametric \acp{PDF}.
Rather than attempting to parameterise the combinatorial background
distribution, a \acf{KDE} \ac{PDF}~\cite{Poluektov:2014rxa}, or `template', is
created from a histogram of the \lnipchisq\ distribution in the lower and upper
sidebands of the reconstructed charm hadron mass.
In the case of the \PDstarp measurements, the data in the upper sideband of the
\deltam\ distribution are used instead.
This approach assumes that the mass and \lnipchisq\ are uncorrelated in the
background sample, such that the \lnipchisq\ shape in the signal region is the
same as that in the sidebands.

The signal region in each long-lived charm hadron mass distribution is defined
as a \SI{40}{\MeVcc}-wide window centred on the nominal rest mass of the given
charm hadron, taken to be \SI{1864.84}{\MeVcc}, \SI{1869.61}{\MeVcc}, and
\SI{1968.30}{\MeVcc} for \PDzero, \PDplus, and \PDsplus~\cite{PDG2014}.
The lower sideband is a \SI{20}{\MeVcc}-wide window centred \SI{50}{\MeVcc}
below the centre of the signal window, and the upper sideband is a
\SI{20}{\MeVcc}-wide window centred \SI{50}{\MeVcc} above the centre of the
signal window.
For the \PDstarp\ measurements, the signal region is defined as a window
\SI{6}{\MeVcc} wide, centred on the nominal \deltam\ value of
\SI{145.43}{\MeVcc}~\cite{PDG2014}.
The upper sideband, or just `sideband' as a lower sideband region is not
defined in \deltam, is defined as the region from \SI{4.5}{\MeVcc} to
\SI{9}{\MeVcc} above the centre of the signal region.
\Cref{fig:prod:fitting:regions_A,fig:prod:fitting:regions_B}
show the signal and sideband regions for each mode.

The integral of the \lnipchisq\ background template \ac{PDF} is
Gaussian-constrained to the number of background candidates in the mass or
\deltam\ signal region.
To avoid any complications due to correlations between the background template
\ac{PDF} and the fitted data, only the data in signal region are used in the
\lnipchisq\ fit.
For the \PDstarp\ measurements, this signal region requirement is made in both
the \PDzero mass and the \deltam\ distributions.

For each one-dimensional \lnipchisq\ fit, one \ac{PDF} $f_{s}$ per
discriminatory species is assigned: prompt signal, secondary signal, and
combinatorial background.
The total \acp{PDF} are constructed as the sum of per-species \acp{PDF},
each weighted by the respective yield $N_{s}$
\begin{equation}
  f(\lnipchisq) = \frac{1}{\sum_{\textnormal{s}} N_{\textnormal{s}}}
                  \sum_{\text{s}} N_{\text{s}}
                  f_{\text{s}}(\lnipchisq).
\end{equation}
The constraint on the background yield \nbkg\ is applied by multiplying the
likelihood by a normal distribution in \nbkg, whose mean is the number of
background candidates measured by the mass fit and whose width is the
uncertainty on that value.
This penalises the likelihood by reducing its value when the fitted \nbkg\
parameter is far away from the value found in the mass fit.

One \lnipchisq\ \ac{PDF} and background constraint is constructed per \pTy\
bin, and the likelihood is formed as the product of these such that each
\ac{PDF} is fitted simultaneously when the negative log-likelihood is
minimised.
The benefit of this construction is that some shape parameters can be shared
across bins, reducing the uncertainty on the fit parameters.
Which parameters are shared across bins and which are fitted independently is
dependent on the type of charm meson.
The shared and independent parameters are enumerated in
\cref{chap:prod:fitting:details}.

The prompt signal model $H$ in the \lnipchisq\ distribution is a modified
normal distribution, where the width is allowed to be asymmetric with respect
to the mean, and the tails are described by exponential functions,
\begin{equation}
  H(x; \mu, \sigma, \epsilon, \rho_{L}, \rho_{R}) =
  \begin{cases}
    \exp\left(\frac{\rho_{L}^{2}}{2} + \rho_{L}\frac{x - \mu}{(1 -
    \epsilon)\sigma}\right) & x < \mu - (\rho_{L}\sigma(1 -
        \epsilon)), \\
    \exp\left(-\left(\frac{x - \mu}{\sqrt{2}\sigma(1 -
    \epsilon)}\right)^{2}\right) & \mu - (\rho_{L}\sigma(1 - \epsilon))
          \leq x < \mu, \\
    \exp\left(-\left(\frac{x - \mu}{\sqrt{2}\sigma(1 +
    \epsilon)}\right)^{2}\right) & \mu \leq x < \mu + (\rho_{R}\sigma(1 +
          \epsilon)), \\
    \exp\left(\frac{\rho_{R}^{2}}{2} - \rho_{R}\frac{x - \mu}{(1 +
    \epsilon)\sigma}\right) & x \geq \mu + (\rho_{R}\sigma(1 +
        \epsilon)),
  \end{cases}
  \label{eqn:prod:fitting:ipchisq:signal_model}
\end{equation}
where the parameter $\mu$ is the mode of the distribution; $\sigma$ is the
average of the left and right widths; $\epsilon$ is the asymmetry between the
left and right widths; and $\rho_{L(R)}$ is the exponent for the left (right)
tail.
The secondary signal distribution is modelled by a normal distribution.
These shapes are motivated by the \lnipchisq\ distributions for prompt and
secondary signal decays observed in the \ac{MC} samples.

Given the large number of parameters to be fitted, some shape parameters in the
prompt and secondary signal \lnipchisq\ \acp{PDF} are fixed to values obtained
from `prefits' to the pure samples of prompt and secondary signal \ac{MC}
described in \cref{chap:prod:data:mc}.
The set of parameters that is fixed is dependent on the charm meson species.

\section{Mode-specific details}
\label{chap:prod:fitting:details}

As different final states exhibit different features in the mass, \deltam, and
\lnipchisq\ distributions, several aspects of the fits are different between
modes.
This \lcnamecref{chap:prod:fitting:details} gives the list of parameters that
are split across \pTy\ bins, and the list of parameters that are allowed to
float after the \ac{MC} prefits, for each mode.

Initially, no knowledge is assumed on which parameters should be independent
(to be `split') across the \pTy\ bins, nor of whether the \lnipchisq\
distribution is well-modelled by the \ac{MC}.
The chosen parameterisation is that which best describes the data.
For the mass fits, all parameters are initially fixed such that they are same
across all \pTy\ bins, and are then split one by one when it is observed that a
feature varies across the bins, such as the width of the signal peak.
All parameters of the \lnipchisq\ fits are first kept fixed to values found
from the fits to the simulated data, and then individual parameters are floated
if the total PDF does not model the data well.
Parameters are then split across \pTy\ bins in the same manner as described
below.

\subsection{Fit details for \PDzero}
\label{chap:prod:fitting:details:D0ToKpi}

For the \DzToKpi\ mode, the signal shape in the mass fit is the sum of a normal
and a Crystal Ball distribution~\cite{Skwarnicki:1986xj}, sharing a common mode
but allowed to have different widths.
The Crystal Ball function $C$ is a normal distribution but with a power-law
tail on one side, defined (un-normalised) as
\begin{equation}
  C(x; \mu, \sigma, \alpha, n) = \begin{cases}
    e^{-\frac{{(x - \mu)}^{2}}{2\sigma^{2}}}                          & \frac{x - \mu}{\sigma} > -\alpha, \\
    e^{-\frac{|\alpha|^{2}}{2}}
      {\left(\frac{n}{|\alpha|}\right)}^{n}
      {\left(\frac{n}{|\alpha|} - |\alpha| - \frac{x - \mu}{\sigma}\right)}^{-n} & \frac{x - \mu}{\sigma} \leq -\alpha,
  \end{cases}
  \label{eqn:prod:fitting:crystal_ball}
\end{equation}
where $\alpha$ defines where the power-law tail begins, in units of the width
of the core Gaussian $\sigma$, and $n$ is the power law exponent.
The mode and width of the total signal \ac{PDF} are split across \pTy\ bins, as
is the slope of the background \ac{PDF}.
The mode of the \lnipchisq\ prompt signal \ac{PDF} and the width of the
secondary signal \ac{PDF} are also split across \pTy\ bins.
The mode and width of the prompt signal \lnipchisq\ \ac{PDF} and all parameters
of the secondary signal \lnipchisq\ \ac{PDF} are floated in the fit to data,
and all other \lnipchisq\ shape parameters are fixed to the values from
\ac{MC}.

Prefits to the prompt signal and secondary signal \ac{MC} samples are given in
\cref{fig:prod:fitting:prefits:D0ToKpi}.

\subsubsection*{Fit details for \PDplus}
\label{chap:prod:fitting:details:DpToKpipi}

For the \DpToKpipi\ mode, the signal shape in the mass fit is the sum of a
normal and a Crystal Ball distribution, sharing a common mode but allowed to
have different widths.
The mode of the signal mass \ac{PDF} as well as the width of the Crystal Ball
component in the mass \ac{PDF} are split across \pTy\ bins, as is the slope of
the background mass \ac{PDF}.
The mode of the \lnipchisq\ prompt signal and secondary signal distributions
are split across \pTy\ bins.
The mode and tail parameters of the signal \lnipchisq\ \ac{PDF}, are floated
during the fit to data, with all other shape parameters fixed to the values
from \ac{MC}.

Prefits to the prompt signal and secondary signal data samples in \lnipchisq\
are given in \cref{fig:prod:fitting:prefits:DpToKpipi}.

\subsubsection*{Fit details for \PDsplus}
\label{chap:prod:fitting:details:DsToKKpi}

For the \DspTophipi\ mode, the signal shape in the mass fit is the sum of a two
normal distributions, sharing a common mean but allowed to have different
widths.
The mean and width of the signal mass \ac{PDF} and the slope of the background
mass \ac{PDF}, along with the mode of the \lnipchisq\ prompt signal \ac{PDF},
are split across \pTy\ bins.
The mode of the prompt signal \lnipchisq\ \ac{PDF} and all parameters of the
secondary \ac{PDF} are floated during the fit to data, with all other shape
parameters fixed to the values from \ac{MC}.

Prefits to the prompt signal and secondary signal data samples in \lnipchisq\
are given in \cref{fig:prod:fitting:prefits:DsToKKpi}.

\subsubsection*{Fit details for \PDstarp}
\label{chap:prod:fitting:details:DstToD0pi}

For the \PDstarp-tagged \DzToKpi\ mode, the width of the widest component of
the \deltam\ signal model, described in \cref{chap:prod:fitting:mass}, is split
across \pTy\ bins, along with the mean of the prompt signal \lnipchisq\
\ac{PDF}.
The mean of the prompt signal \lnipchisq\ \ac{PDF} and all parameters of the
secondary \ac{PDF} are floated during the fit to data, with all other shape
parameters fixed to the values from \ac{MC}.

Prefits to the prompt signal and secondary signal data samples in \PDzero
\lnipchisq\ are given in \cref{fig:prod:fitting:prefits:DstToD0pi_D0ToKpi}.

\subsection{Fit results}
\label{chap:prod:fitting:results}

For all fits, the covariance matrix is checked to be positive definite, and the
goodness-of-fit within each \pTy\ bin is checked visually to ensure that the
\ac{NLL} minimisation stopped at a sensible parameter value set.
Mass, \deltam, and \lnipchisq\ fits are given in
\cref{fig:prod:fitting:D0ToKpi,fig:prod:fitting:DpToKpipi,fig:prod:fitting:DsToKKpi,fig:prod:fitting:DstToD0pi_D0ToKpi},
where the data and models shown are the sums of the data and models over all
\pTy\ bins.
Prompt signal yields per \pTy\ bin are given in
\cref{tab:prod:fitting:D0ToKpi,tab:prod:fitting:DpToKpipi,tab:prod:fitting:DsToKKpi,tab:prod:fitting:DstToD0pi_D0ToKpi},
and those integrated across all bins in \cref{tab:prod:fitting:integrated}.

The plots show that the models match the data well, but there are some
significant discrepancies such as in
\cref{fig:prod:fitting:DsToKKpi:ipchisq,fig:prod:fitting:DstToD0pi_D0ToKpi:delta_mass}.
However, the discrepancies in these integrated plots are exaggerations of those
in the individual \pTy\ bin fits: they indicate that there is a consistent bias
in the individual bins, but do not necessarily indicate that these are
statistically significant.
For comparison,
\cref{fig:prod:fitting:D0ToKpi:sig_bkg,fig:prod:fitting:DpToKpipi:sig_bkg,fig:prod:fitting:DsToKKpi:sig_bkg,fig:prod:fitting:DstToD0pi_D0ToKpi:sig_bkg}
show the mass (or \deltam) and \lnipchisq\ fits for each meson in the \pTy\ bin
with the highest prompt signal yield and in the \pTy\ bin with the highest
combinatorial background yield.
These show that, in the individual \pTy\ bins, the fits model the data
significantly better than the integrated plots would suggest, and also that the
fit is flexible enough to model both high prompt signal and high combinatorial
background datasets.
The effect on the cross-section measurements of mis-modelling will be discussed
further in \cref{chap:prod:syst:fitting}.

In some \pTy\ bins, it is not possible to make a prompt signal yield
measurement due to insufficient data in those bins.
At this stage in the analysis, a cross-section measurement in a bin is
considered unfeasible if there is either no data (zero candidates), or if the
prompt signal yield $N_{i} \pm \sigma_{N_{i}}$ in that bin as determined in the
fit does not satisfy $N_{i} > 3\sigma_{N_{i}}$.

\begin{figure}
  \begin{subfigure}{0.5\textwidth}
    \includegraphics[width=\textwidth]{production/fitting/D0ToKpi_mass_offline_selection_regions}
    \caption{\DzToKpi}
    \label{fig:prod:fitting:regions:D0ToKpi}
  \end{subfigure}
  \begin{subfigure}{0.5\textwidth}
    \includegraphics[width=\textwidth]{production/fitting/DpToKpipi_mass_offline_selection_regions}
    \caption{\DpToKpipi}
    \label{fig:prod:fitting:regions:DpToKpipi}
  \end{subfigure}
  \caption{%
    Definition of signal window, in blue, and sidebands, in red, for
    \DzToKpi~(\subref*{fig:prod:fitting:regions:D0ToKpi}) and
    \DpToKpipi~(\subref*{fig:prod:fitting:regions:DpToKpipi}) candidates.
    The boundaries of the different regions are defined in
    \cref{chap:prod:fitting:ipchisq}.
    The full dataset is shown.
  }
  \label{fig:prod:fitting:regions_A}
\end{figure}

\begin{figure}
  \begin{subfigure}{0.5\textwidth}
    \includegraphics[width=\textwidth]{production/fitting/DsToKKpi_mass_offline_selection_regions}
    \caption{\DspTophipi}
    \label{fig:prod:fitting:regions:DsTophipi}
  \end{subfigure}
  \begin{subfigure}{0.5\textwidth}
    \includegraphics[width=\textwidth]{production/fitting/DstToD0pi_D0ToKpi_delta_mass_offline_selection_regions}
    \caption{\DstToDzpi}
    \label{fig:prod:fitting:regions:DstToD0pi_D0ToKpi}
  \end{subfigure}
  \caption{%
    Definition of signal window, in blue, and sidebands, in red, for
    \DspTophipi~(\subref*{fig:prod:fitting:regions:DsTophipi}) and
    \DstToDzpi~(\subref*{fig:prod:fitting:regions:DstToD0pi_D0ToKpi})
    candidates.
    The boundaries of the different regions are defined in
    \cref{chap:prod:fitting:ipchisq}.
    The full dataset is shown.
  }
  \label{fig:prod:fitting:regions_B}
\end{figure}

\begin{figure}
  \begin{subfigure}[b]{0.5\textwidth}
    \centering
    \includegraphics[width=\textwidth]{production/fitting/D0ToKpi_ipchisq_fit_pT_integrated_y_integrated_sig}
    \caption{Prompt}
    \label{fig:prod:fitting:prefits:D0ToKpi:prompt}
  \end{subfigure}
  \begin{subfigure}[b]{0.5\textwidth}
    \centering
    \includegraphics[width=\textwidth]{production/fitting/D0ToKpi_ipchisq_fit_pT_integrated_y_integrated_sec}
    \caption{Secondary}
    \label{fig:prod:fitting:prefits:D0ToKpi:secondary}
  \end{subfigure}
  \caption{%
    Distributions of \lnipchisq\ for simulated \DzToKpi\ decays: prompt signal
    \PDzero (\subref*{fig:prod:fitting:prefits:D0ToKpi:prompt}) and secondary
    signal \PDzero (\subref*{fig:prod:fitting:prefits:D0ToKpi:secondary}).
    The sum of the simultaneous likelihood fits in each \pTy\ bin is overlaid.
  }
  \label{fig:prod:fitting:prefits:D0ToKpi}
\end{figure}

\begin{figure}
  \begin{subfigure}[b]{0.5\textwidth}
    \centering
    \includegraphics[width=\textwidth]{production/fitting/DpToKpipi_ipchisq_fit_pT_integrated_y_integrated_sig}
    \caption{Prompt}
    \label{fig:prod:fitting:prefits:DpToKpipi:prompt}
  \end{subfigure}
  \begin{subfigure}[b]{0.5\textwidth}
    \centering
    \includegraphics[width=\textwidth]{production/fitting/DpToKpipi_ipchisq_fit_pT_integrated_y_integrated_sec}
    \caption{Secondary}
    \label{fig:prod:fitting:prefits:DpToKpipi:secondary}
  \end{subfigure}
  \caption{%
    Distributions of \lnipchisq\ for simulated \DpToKpipi\ decays: prompt
    signal \PDplus (\subref*{fig:prod:fitting:prefits:DpToKpipi:prompt}) and
    secondary signal \PDplus
    (\subref*{fig:prod:fitting:prefits:DpToKpipi:secondary}).
    The sum of the simultaneous likelihood fits in each \pTy\ bin is overlaid.
  }
  \label{fig:prod:fitting:prefits:DpToKpipi}
\end{figure}

\begin{figure}
  \begin{subfigure}[b]{0.5\textwidth}
    \centering
    \includegraphics[width=\textwidth]{production/fitting/DsToKKpi_ipchisq_fit_pT_integrated_y_integrated_sig}
    \caption{Prompt}
    \label{fig:prod:fitting:prefits:DsToKKpi:prompt}
  \end{subfigure}
  \begin{subfigure}[b]{0.5\textwidth}
    \centering
    \includegraphics[width=\textwidth]{production/fitting/DsToKKpi_ipchisq_fit_pT_integrated_y_integrated_sec}
    \caption{Secondary}
    \label{fig:prod:fitting:prefits:DsToKKpi:secondary}
  \end{subfigure}
  \caption{%
    Distributions of \lnipchisq\ for simulated \DspTophipi\ decays: prompt
    signal \PDsplus (\subref*{fig:prod:fitting:prefits:DsToKKpi:prompt}) and
    secondary signal \PDsplus
    (\subref*{fig:prod:fitting:prefits:DsToKKpi:secondary}).
    The sum of the simultaneous likelihood fits in each \pTy\ bin is overlaid.
  }
  \label{fig:prod:fitting:prefits:DsToKKpi}
\end{figure}

\begin{figure}
  \begin{subfigure}[b]{0.5\textwidth}
    \centering
    \includegraphics[width=\textwidth]{production/fitting/DstToD0pi_D0ToKpi_ipchisq_fit_pT_integrated_y_integrated_sig}
    \caption{Prompt}
    \label{fig:prod:fitting:prefits:DstToD0pi_D0ToKpi:prompt}
  \end{subfigure}
  \begin{subfigure}[b]{0.5\textwidth}
    \centering
    \includegraphics[width=\textwidth]{production/fitting/DstToD0pi_D0ToKpi_ipchisq_fit_pT_integrated_y_integrated_sec}
    \caption{Secondary}
    \label{fig:prod:fitting:prefits:DstToD0pi_D0ToKpi:secondary}
  \end{subfigure}
  \caption{%
    Distributions of \PDzero \lnipchisq\ for simulated \DstToDzpi, with
    \DzToKpi, decays: prompt signal \PDstarp\
    (\subref*{fig:prod:fitting:prefits:DstToD0pi_D0ToKpi:prompt}) and secondary
    signal \PDstarp\
    (\subref*{fig:prod:fitting:prefits:DstToD0pi_D0ToKpi:secondary}).
    The sum of the simultaneous likelihood fits in each \pTy\ bin is overlaid.
  }
  \label{fig:prod:fitting:prefits:DstToD0pi_D0ToKpi}
\end{figure}

\begin{figure}
  \begin{subfigure}[b]{0.5\textwidth}
    \centering
    \includegraphics[width=\textwidth]{production/fitting/D0ToKpi_mass_fit_pT_integrated_y_integrated}
    \caption{Mass}
    \label{fig:prod:fitting:D0ToKpi:mass}
  \end{subfigure}
  \begin{subfigure}[b]{0.5\textwidth}
    \centering
    \includegraphics[width=\textwidth]{production/fitting/D0ToKpi_ipchisq_fit_pT_integrated_y_integrated}
    \caption{\lnipchisq}
    \label{fig:prod:fitting:D0ToKpi:ipchisq}
  \end{subfigure}
  \caption{%
    Distributions for fully selected \DzToKpi\ candidates: \PDzero\ invariant
    mass (\subref*{fig:prod:fitting:D0ToKpi:mass}) and \PDzero\ \lnipchisq\
    (\subref*{fig:prod:fitting:D0ToKpi:ipchisq}) for a mass window of
    $\pm\SI{20}{\MeVcc}$ around the nominal \PDzero mass.
    The sum of the simultaneous likelihood fits in each \pTy\ bin is shown,
    with components as indicated in the legends.
  }
  \label{fig:prod:fitting:D0ToKpi}
\end{figure}

\begin{figure}
  \begin{subfigure}[b]{0.5\textwidth}
    \centering
    \includegraphics[width=\textwidth]{production/fitting/DpToKpipi_mass_fit_pT_integrated_y_integrated}
    \caption{Mass}
    \label{fig:prod:fitting:DpToKpipi:mass}
  \end{subfigure}
  \begin{subfigure}[b]{0.5\textwidth}
    \centering
    \includegraphics[width=\textwidth]{production/fitting/DpToKpipi_ipchisq_fit_pT_integrated_y_integrated}
    \caption{\lnipchisq}
    \label{fig:prod:fitting:DpToKpipi:ipchisq}
  \end{subfigure}
  \caption{%
    Distributions for fully selected \DpToKpipi\ candidates: \PDplus\ invariant
    mass (\subref*{fig:prod:fitting:DpToKpipi:mass}) and \PDplus\ \lnipchisq\
    (\subref*{fig:prod:fitting:DpToKpipi:ipchisq}) for a mass window of
    $\pm\SI{20}{\MeVcc}$ around the nominal \PDplus mass.
    The sum of the simultaneous likelihood fits in each \pTy\ bin is shown,
    with components as indicated in the legends.
  }
  \label{fig:prod:fitting:DpToKpipi}
\end{figure}

\begin{figure}
  \begin{subfigure}[b]{0.5\textwidth}
    \centering
    \includegraphics[width=\textwidth]{production/fitting/DsToKKpi_mass_fit_pT_integrated_y_integrated}
    \caption{Mass}
    \label{fig:prod:fitting:DsToKKpi:mass}
  \end{subfigure}
  \begin{subfigure}[b]{0.5\textwidth}
    \centering
    \includegraphics[width=\textwidth]{production/fitting/DsToKKpi_ipchisq_fit_pT_integrated_y_integrated}
    \caption{\lnipchisq}
    \label{fig:prod:fitting:DsToKKpi:ipchisq}
  \end{subfigure}
  \caption{%
    Distributions for fully selected \DspTophipi\ candidates: \PDsplus\
    invariant mass (\subref*{fig:prod:fitting:DpToKpipi:mass}) and \PDsplus\
    \lnipchisq\ (\subref*{fig:prod:fitting:DpToKpipi:ipchisq}) for a mass
    window of $\pm\SI{20}{\MeVcc}$ around the nominal \PDsplus mass.
    The sum of the simultaneous likelihood fits in each \pTy\ bin is shown,
    with components as indicated in the legends.
  }
  \label{fig:prod:fitting:DsToKKpi}
\end{figure}

\begin{figure}
  \begin{subfigure}[b]{0.5\textwidth}
    \centering
    \includegraphics[width=\textwidth]{production/fitting/DstToD0pi_D0ToKpi_mass_fit_pT_integrated_y_integrated}
    \caption{\PDzero mass}
    \label{fig:prod:fitting:DstToD0pi_D0ToKpi:mass}
  \end{subfigure}
  \begin{subfigure}[b]{0.5\textwidth}
    \centering
    \includegraphics[width=\textwidth]{production/fitting/DstToD0pi_D0ToKpi_delta_mass_fit_pT_integrated_y_integrated}
    \caption{Delta mass}
    \label{fig:prod:fitting:DstToD0pi_D0ToKpi:delta_mass}
  \end{subfigure}
  \begin{subfigure}[b]{0.5\textwidth}
    \centering
    \includegraphics[width=\textwidth]{production/fitting/DstToD0pi_D0ToKpi_ipchisq_fit_pT_integrated_y_integrated}
    \caption{\lnipchisq}
    \label{fig:prod:fitting:DstToD0pi_D0ToKpi:ipchisq}
  \end{subfigure}
  \caption{%
    Distributions for fully selected \PDstarp\ candidates, with \DzToKpi:
    \PDzero\ invariant mass
    (\subref*{fig:prod:fitting:DstToD0pi_D0ToKpi:mass}); $\deltam = m(\PDstarp)
    - m(\PDzero)$ (\subref*{fig:prod:fitting:DstToD0pi_D0ToKpi:delta_mass}) for
    a mass window of $\pm\SI{20}{\MeVcc}$ around the nominal \PDzero mass; and
    \PDzero\ \lnipchisq\ (\subref*{fig:prod:fitting:DstToD0pi_D0ToKpi:ipchisq})
    with an additional mass window of $\pm\SI{3}{\MeVcc}$ around the nominal
    \deltam\ value.
    The sum of the simultaneous likelihood fits in each \pTy\ bin is shown,
    with components as indicated in the legends.
  }
  \label{fig:prod:fitting:DstToD0pi_D0ToKpi}
\end{figure}

\begin{table}
  \caption{%
    Prompt signal yields in the fully selected dataset, summed over all
    \pTy\ bins in which a measurement is made.
  }
  \label{tab:prod:fitting:integrated}
  \centering
  \input{tables/production/fitting/integrated_signal_yields}
\end{table}

\begin{figure}
  \begin{subfigure}[b]{0.5\textwidth}
    \centering
    \includegraphics[width=\textwidth]{production/fitting/D0ToKpi_mass_fit_pT_3_y_2}
    \caption{Mass}
    \label{fig:prod:fitting:D0ToKpi:mass_high_sig}
  \end{subfigure}
  \begin{subfigure}[b]{0.5\textwidth}
    \centering
    \includegraphics[width=\textwidth]{production/fitting/D0ToKpi_ipchisq_fit_pT_3_y_2}
    \caption{\lnipchisq}
    \label{fig:prod:fitting:D0ToKpi:ipchisq_high_sig}
  \end{subfigure}
  \begin{subfigure}[b]{0.5\textwidth}
    \centering
    \includegraphics[width=\textwidth]{production/fitting/D0ToKpi_mass_fit_pT_0_y_3}
    \caption{Mass}
    \label{fig:prod:fitting:D0ToKpi:mass_high_bkg}
  \end{subfigure}
  \begin{subfigure}[b]{0.5\textwidth}
    \centering
    \includegraphics[width=\textwidth]{production/fitting/D0ToKpi_ipchisq_fit_pT_0_y_3}
    \caption{\lnipchisq}
    \label{fig:prod:fitting:D0ToKpi:ipchisq_high_bkg}
  \end{subfigure}
  \caption{%
    Distributions for fully selected \DzToKpi\ candidates: \PDzero\ invariant
    mass (\subref*{fig:prod:fitting:D0ToKpi:mass_high_sig} and
    \subref*{fig:prod:fitting:D0ToKpi:mass_high_bkg}); and \PDzero\ \lnipchisq\
    (\subref*{fig:prod:fitting:D0ToKpi:ipchisq_high_sig} and
    \subref*{fig:prod:fitting:D0ToKpi:ipchisq_high_bkg}) for a mass window of
    $\pm\SI{20}{\MeVcc}$ around the nominal \PDzero mass.
    The top Figures (\subref*{fig:prod:fitting:D0ToKpi:mass_high_sig} and
    \subref*{fig:prod:fitting:D0ToKpi:ipchisq_high_sig}) show the data and fits
    in the region \pTyrange{2}{2.5}{3}{3.5}, whilst the bottom Figures
    (\subref*{fig:prod:fitting:D0ToKpi:mass_high_bkg} and
    \subref*{fig:prod:fitting:D0ToKpi:ipchisq_high_bkg}) show the data and fits
    in the \pTyrange{0}{1}{3.5}{4} region.
  }
  \label{fig:prod:fitting:D0ToKpi:sig_bkg}
\end{figure}

\begin{figure}
  \begin{subfigure}[b]{0.5\textwidth}
    \centering
    \includegraphics[width=\textwidth]{production/fitting/DpToKpipi_mass_fit_pT_4_y_2}
    \caption{Mass}
    \label{fig:prod:fitting:DpToKpipi:mass_high_sig}
  \end{subfigure}
  \begin{subfigure}[b]{0.5\textwidth}
    \centering
    \includegraphics[width=\textwidth]{production/fitting/DpToKpipi_ipchisq_fit_pT_4_y_2}
    \caption{\lnipchisq}
    \label{fig:prod:fitting:DpToKpipi:ipchisq_high_sig}
  \end{subfigure}
  \begin{subfigure}[b]{0.5\textwidth}
    \centering
    \includegraphics[width=\textwidth]{production/fitting/DpToKpipi_mass_fit_pT_3_y_3}
    \caption{Mass}
    \label{fig:prod:fitting:DpToKpipi:mass_high_bkg}
  \end{subfigure}
  \begin{subfigure}[b]{0.5\textwidth}
    \centering
    \includegraphics[width=\textwidth]{production/fitting/DpToKpipi_ipchisq_fit_pT_3_y_3}
    \caption{\lnipchisq}
    \label{fig:prod:fitting:DpToKpipi:ipchisq_high_bkg}
  \end{subfigure}
  \caption{%
    Distributions for fully selected \DpToKpipi\ candidates: \PDplus\ invariant
    mass (\subref*{fig:prod:fitting:DpToKpipi:mass_high_sig} and
    \subref*{fig:prod:fitting:DpToKpipi:mass_high_bkg}); and \PDplus\
    \lnipchisq\ (\subref*{fig:prod:fitting:DpToKpipi:ipchisq_high_sig} and
    \subref*{fig:prod:fitting:DpToKpipi:ipchisq_high_bkg}) for a mass window of
    $\pm\SI{20}{\MeVcc}$ around the nominal \PDplus mass.
    The top Figures (\subref*{fig:prod:fitting:DpToKpipi:mass_high_sig} and
    \subref*{fig:prod:fitting:DpToKpipi:ipchisq_high_sig}) show the data and
    fits in the region \pTyrange{2.5}{3}{3}{3.5}, whilst the bottom Figures
    (\subref*{fig:prod:fitting:DpToKpipi:mass_high_bkg} and
    \subref*{fig:prod:fitting:DpToKpipi:ipchisq_high_bkg}) show the data and
    fits in the \pTyrange{2}{2.5}{3.5}{4} region.
  }
  \label{fig:prod:fitting:DpToKpipi:sig_bkg}
\end{figure}

\begin{figure}
  \begin{subfigure}[b]{0.5\textwidth}
    \centering
    \includegraphics[width=\textwidth]{production/fitting/DsToKKpi_mass_fit_pT_6_y_1}
    \caption{Mass}
    \label{fig:prod:fitting:DsToKKpi:mass_high_sig}
  \end{subfigure}
  \begin{subfigure}[b]{0.5\textwidth}
    \centering
    \includegraphics[width=\textwidth]{production/fitting/DsToKKpi_ipchisq_fit_pT_6_y_1}
    \caption{\lnipchisq}
    \label{fig:prod:fitting:DsToKKpi:ipchisq_high_sig}
  \end{subfigure}
  \begin{subfigure}[b]{0.5\textwidth}
    \centering
    \includegraphics[width=\textwidth]{production/fitting/DsToKKpi_mass_fit_pT_2_y_3}
    \caption{Mass}
    \label{fig:prod:fitting:DsToKKpi:mass_high_bkg}
  \end{subfigure}
  \begin{subfigure}[b]{0.5\textwidth}
    \centering
    \includegraphics[width=\textwidth]{production/fitting/DsToKKpi_ipchisq_fit_pT_2_y_3}
    \caption{\lnipchisq}
    \label{fig:prod:fitting:DsToKKpi:ipchisq_high_bkg}
  \end{subfigure}
  \caption{%
    Distributions for fully selected \DspTophipi\ candidates: \PDsplus\
    invariant mass (\subref*{fig:prod:fitting:DsToKKpi:mass_high_sig} and
    \subref*{fig:prod:fitting:DsToKKpi:mass_high_bkg}); and \PDsplus\
    \lnipchisq\ (\subref*{fig:prod:fitting:DsToKKpi:ipchisq_high_sig} and
    \subref*{fig:prod:fitting:DsToKKpi:ipchisq_high_bkg}) for a mass window of
    $\pm\SI{20}{\MeVcc}$ around the nominal \PDsplus mass.
    The top Figures (\subref*{fig:prod:fitting:DsToKKpi:mass_high_sig} and
    \subref*{fig:prod:fitting:DsToKKpi:ipchisq_high_sig}) show the data and
    fits in the region \pTyrange{4}{5}{2.5}{3}, whilst the bottom Figures
    (\subref*{fig:prod:fitting:DsToKKpi:mass_high_bkg} and
    \subref*{fig:prod:fitting:DsToKKpi:ipchisq_high_bkg}) show the data and
    fits in the \pTyrange{2}{2.5}{3.5}{4} region.
  }
  \label{fig:prod:fitting:DsToKKpi:sig_bkg}
\end{figure}

\begin{figure}
  \begin{subfigure}[b]{0.5\textwidth}
    \centering
    \includegraphics[width=\textwidth]{production/fitting/DstToD0pi_D0ToKpi_delta_mass_fit_pT_7_y_2}
    \caption{Delta mass}
    \label{fig:prod:fitting:DstToD0pi_D0ToKpi:delta_mass_high_sig}
  \end{subfigure}
  \begin{subfigure}[b]{0.5\textwidth}
    \centering
    \includegraphics[width=\textwidth]{production/fitting/DstToD0pi_D0ToKpi_ipchisq_fit_pT_7_y_2}
    \caption{\lnipchisq}
    \label{fig:prod:fitting:DstToD0pi_D0ToKpi:ipchisq_high_sig}
  \end{subfigure}
  \begin{subfigure}[b]{0.5\textwidth}
    \centering
    \includegraphics[width=\textwidth]{production/fitting/DstToD0pi_D0ToKpi_delta_mass_fit_pT_2_y_3}
    \caption{Delta mass}
    \label{fig:prod:fitting:DstToD0pi_D0ToKpi:delta_mass_high_bkg}
  \end{subfigure}
  \begin{subfigure}[b]{0.5\textwidth}
    \centering
    \includegraphics[width=\textwidth]{production/fitting/DstToD0pi_D0ToKpi_ipchisq_fit_pT_2_y_3}
    \caption{\lnipchisq}
    \label{fig:prod:fitting:DstToD0pi_D0ToKpi:ipchisq_high_bkg}
  \end{subfigure}
  \caption{%
    Distributions for fully selected \DstToDzpi, with \DzToKpi, candidates:
    $\deltam = m(\PDstarp) - m(\PDzero)$
    (\subref*{fig:prod:fitting:DstToD0pi_D0ToKpi:delta_mass_high_sig} and
    \subref*{fig:prod:fitting:DstToD0pi_D0ToKpi:delta_mass_high_bkg}) for a
    mass window of $\pm\SI{20}{\MeVcc}$ around the nominal \PDzero mass; and
    \PDzero\ \lnipchisq\
    (\subref*{fig:prod:fitting:DstToD0pi_D0ToKpi:ipchisq_high_sig} and
    \subref*{fig:prod:fitting:DstToD0pi_D0ToKpi:ipchisq_high_bkg}) with an
    additional mass window of $\pm\SI{3}{\MeVcc}$ around the nominal
    \PDstarp-\PDzero\ mass difference.
    The top Figures
    (\subref*{fig:prod:fitting:DstToD0pi_D0ToKpi:delta_mass_high_sig} and
    \subref*{fig:prod:fitting:DstToD0pi_D0ToKpi:ipchisq_high_sig}) show the
    data and fits in the region \pTyrange{4}{5}{3}{3.5}, whilst the bottom
    Figures (\subref*{fig:prod:fitting:DstToD0pi_D0ToKpi:delta_mass_high_bkg}
    and \subref*{fig:prod:fitting:DstToD0pi_D0ToKpi:ipchisq_high_bkg}) show the
    data and fits in the \pTyrange{1.5}{2}{3.5}{4} region.
  }
  \label{fig:prod:fitting:DstToD0pi_D0ToKpi:sig_bkg}
\end{figure}


\section{Hyperchains}

\textbf{todo: reorganize, mention commitments earlier, images!}

The previous approaches had a lot to offer, but considering they cons it is hard
to scale them in a reasonable way. PoW seems to work well only with big
computational effort being burned and PoS suffers from huge amount of security
holes that require very complicated algorithms that usually either don't solve
the problem at all or just move it further to another layer of abstraction.

Here we present a hybrid strategy which will benefit from stability of PoW
solutions but will offer the scalability of PoS systems. A Hyperchain is a
special kind of blockchain that sticks to an already existing chain. They are
going to be called respectively child- and parent-chain
\footnote{https://medium.com/@yanislav/hyperchains-secure-cheap-scalable-blockchain-technology-for-everyone-3ddec96a4152}.

The parent chain can be almost any blockchain in the world. In general, we want
to use some big existing PoW based chains (at the time of writing, preferably
Bitcoin or Ethereum, but not limited to) to reuse their burned work to maintain
the stability of the childchain. We would also like to have
PoS-like election system to choose the leaders on the hyperchain. In this case
however we have a really reliable – and most important, unpredictable – source
of randomness – the keyblock hash of the parent chain. The idea is not very new
though – there is already some research made in this direction
\footnote{https://eprint.iacr.org/2015/1015.pdf}.
The critics say that it is still possible to exploit it to mine blocks in such a
manner that the outcome would be beneficial, but in reality that reduces to
compound PoW – most likely the difficulty of mining such a block will go
squared, so in order to have actual control over the entropy one needs to
control the parent chain anyway.

Having this machinery it seems natural to start a new election each time a
keyblock was mined on the parent chain. The next leader shall be chosen
depending on the hash of that block and selected with proportional chances to
their stake. The selection algorithm is going to be straightforward – we take
the hash (let's say, MD5) and consider a whole MD5 counterdomain as a closed
line segment divided into intervals of lengths proportional to the stakes of the
delegates. The intervals are going to be sorted by the order of the respective
commitments that appeared on the parent chain. The generated hash will then
point into some subsection which will determine the winner.

$$Insert\ some\ nice\ image\ here$$

One of the important concepts of the commitment idea is to be able to rely on
the parent chain's stability. Therefore we want to treat it as a rigid skeleton
of the hyperchain which can be achieved by proper blockhash linking. Each
commitment must declare over which block is the delegating going to compete.
Therefore the commitment must consist of:
\begin{itemize}
\item The subject of delegation on the child chain
\item The block over the delegate is going to build
\item Singature of the delegate from the child chain
\end{itemize}

One dillema that rises at this point is whether should the commitment reference
the latest keyblock or the microblock of the child chain. Referencing microblock
on the first sight looks more consistent, but we believe that in reality would
lead to massive forking (especially when some peers wouldn't receive all of the
blocks). The problem with referencing keyblock is that the next leader could
steal the transactions and post them in their microblocks. This however can be
faced with the smarter feeing strategy: instead of giving the full fee to the
miner we can split it up and give the bigger part to the next leader that did
include the previous leader's microblocks in their continuation of the history.

$$Insert\ some\ nice\ image\ here$$