\chapter{The Standard Model}
    \label{chapter:StandardModel}

This chapter describes the main theoretical and phenomenological concepts of the Standard Model of particle physics, and the structure of the proton.
Monte Carlo simulations of Standard Model processes are also discussed in the following.

\section{Introduction to the Standard Model}
    \label{sec:IntroSM}

The Standard Model (SM) of particle physics \cite{Glashow:1961tr, Weinberg:1967tq, Salam:1980jd} is a renormalizable quantum field theory based on the total invariance under the gauge group

\begin{equation}
SU(3)_{c}\otimes SU(2)_{L}\otimes U(1)_{Y}
\label{eq:SMSymmetryGroup}
\end{equation}

\noindent that describes the properties of all the fundamental particles and the interactions among them.
The SM is divided into a bosonic and a fermionic sectors.
The bosonic sector of the SM is responsible for three of the four interactions in Nature.
Gravity cannot be accommodated, thus being one of the main motivations to look for physics beyond the Standard Model.
Table~\ref{tab:bosons} summarizes the boson classification of the SM.

\begin{table}[!ht]
  \begin{center}
    \begin{small}
      \setlength{\tabcolsep}{0.0pc}
      \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}lcccc}
        \noalign{\smallskip}\hline\noalign{\smallskip}
         {\bf Mediator}               & {\bf Mass [GeV]}     & {\bf Interaction} & {\bf Electric charge} & {\bf Spin} \\
        \noalign{\smallskip}\hline\noalign{\smallskip}
         Gluon ($\times 8$) $(g)$     & 0                    & strong            & 0                     & 1 \\
         Photon ($\gamma$)            & 0                    & electromagnetic   & 0                     & 1 \\
         $Z$                          & $91.1876 \pm 0.0021$ & weak (neutral)    & 0                     & 1 \\
         $W^{\pm}$                    & $80.385 \pm 0.015$   & weak (charged)    & $\pm 1$               & 1 \\
         Higgs ($H$)                  & $125.7 \pm 0.4$      & -                 & 0                     & 0 \\
        \noalign{\smallskip}\hline\noalign{\smallskip}
      \end{tabular*}
    \end{small}
  \end{center}
  \caption[Bosonic fields in the Standard Model.]{Boson classification in the Standard Model.}
  \label{tab:bosons}
\end{table}

The fermionic sector is composed of quarks and leptons, and is organized in three families (generations).
Generations only differ one to another by their mass.
Table \ref{tab:QuarksAndLeptons} provides a classification of the Standard Model quarks and leptons.

\begin{table}[!t]
  \begin{center}
    \begin{small}
      \setlength{\tabcolsep}{0.0pc}
      \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}l|ccc}
        \hline
        \textbf{SM fermions}     & \textbf{1st generation}         & \textbf{2nd generation}         & \textbf{3rd generation} \\
        \hline
        \multirow{4}{*}{QUARKS}  & Up (\textbf{u})                 & Charm (\textbf{c})              & Top (\textbf{t})\\
                                 & \tiny{charge = $+2/3$}          & \tiny{charge = $+2/3$}          & \tiny{charge = $+2/3$} \\
%        \cline{2-4}
& & & \\
                                 & Down (\textbf{d})               & Strange (\textbf{s})            & Bottom (\textbf{b})\\
                                 & \tiny{charge = $-1/3$}          & \tiny{charge = $-1/3$}          & \tiny{charge = $-1/3$} \\
        \hline
        \multirow{4}{*}{LEPTONS}& Electron neutrino ($\nu_e$)     & Muon neutrino ($\nu_\mu$)       & Tau neutrino ($\nu_\tau$)\\
                                 & \tiny{charge = $0$}             & \tiny{charge = $0$}             & \tiny{charge = $0$} \\
%        \cline{2-4}
& & & \\
                                 & Electron ($e$)                  & Muon ($\mu$)                    & Tau ($\tau$)\\
                                 & \tiny{charge = $-1$}            & \tiny{charge = $-1$}            & \tiny{charge = $-1$} \\
        \hline
      \end{tabular*}
    \end{small}
  \end{center}
  \caption[Fermionic fields in the Standard Model.]{Classification of the fermionic fields in the SM. For each lepton and quark there is a corresponding anti-particle. The electric charge is shown in units of the electron charge.}
  \label{tab:QuarksAndLeptons}
\end{table}

The following sections briefly describe the different theories that conform the basis of the Standard Model formulation.

\section{Quantum Electrodynamics}
    \label{sec:QED}

Quantum Electrodynamics (QED) was developed in the late 1940's and the beginning of the 1950's by Feynman, Schwinger and Tomonaga, in order to describe the electromagnetic interactions between electrons and photons.
It is a renormalizable relativistic quantum field theory, invariant under a global change of phase (or gauge) $\theta$:

\begin{equation}
\psi \rightarrow \psi' = e^{iQ\theta} \phi,
\label{eq:QEDInvariance}
\end{equation}

\noindent where $Q$ represents the charge and $\psi$ is a spin-1/2 Dirac field, satisfying a lagrangian

\begin{equation}
\lagrangian = \bar{\psi}(i\gamma^{\mu}\partial_\mu -m)\psi.
\label{eq:QEDLagrangianGlobalInvariant}
\end{equation}

There is no reason not to promote the global symmetry from Equation~\ref{eq:QEDInvariance} to a local one, $\theta = \theta(x)$.
If the lagrangian in Equation~\ref{eq:QEDLagrangianGlobalInvariant} is required to be locally invariant under this symmetry, the covariant derivative needs to be introduced:

\begin{equation}
\nabla_\mu \equiv \partial_\mu - ieQA_\mu,
\label{eq:QEDCovariantDerivative}
\end{equation}

\noindent where the new field $A_\mu$ satisfies:

\begin{equation}
A_\mu \rightarrow A_\mu' = A_\mu + \frac{1}{e}\partial_\mu \theta.
\label{eq:QEDPhotonTransformation}
\end{equation}

Therefore, under local gauge invariance the lagrangian from Equation~\ref{eq:QEDLagrangianGlobalInvariant} becomes:

\begin{equation}
\lagrangian_{\text{QED}} = \bar{\psi}(i\gamma^{\mu}\nabla_\mu -m)\psi = \bar{\psi}(i\gamma^{\mu}\partial_\mu -m)\psi + \lagrangian_I
\label{eq:QEDLagrangianLocalInvariant}
\end{equation}

\noindent where $\lagrangian_I$ describes the interaction between the fermion and $A_\mu$:

\begin{equation}
\lagrangian_{I} = eQA_\mu(\bar{\psi}\gamma^\mu \psi).
\label{eq:QEDLagrangianInteraction}
\end{equation}

Local gauge invariance required the addition of the interaction term to the QED lagrangian and thus, the presence of the new field $A_\mu$.
Therefore, a kinetic term for this new field needs to be added, which is of the form:

\begin{equation}
\lagrangian_{K} = -\frac{1}{4} F_{\mu\nu}F^{\mu\nu},
\label{eq:QEDLagrangianPhoton}
\end{equation}

\noindent where $F_{\mu\nu} \equiv \partial_\mu A_\nu - \partial_\nu A_\mu$.

To summarize, QED is described by the presence of two fields: a Dirac field with spin-1/2 and a spin-1 field that can be associated to the photon, which appears as a consequence of the requirement of the local gauge invariance.

\section{Electroweak theory}
    \label{sec:EWK}

The weak theory was proposed in 1934 by Enrico Fermi in order to give an explanation to the neutron $\beta$-decay.
In this theory, four fermions directly interacted with one another: the neutron (or a down-quark) decayed directly into a proton (or an up-quark), an electron and a neutrino.
The strength of the coupling was proportional to $G_F$, the so-called Fermi's constant.

Fermi diagrams described the data remarkably well at tree level, but loop diagrams could not be calculated reliably because Fermi's interaction was not renormalizable.
The solution was found by Glashow, Salam and Weinberg~\cite{Weinberg:1967tq}, by unifying the weak and electromagnetic interactions into one single theoretical framework, known as the Standard Electroweak Model.
Therefore, both the electromagnetic and the weak interactions can be seen as two manifestations of the same fundamental interaction.

These interactions are unified under the group $SU(2)_L \otimes U(1)_Y$.
The first part of the group has dimension three, and therefore, it has three generators: $\hat{T}_i = \frac{\sigma_i}{2}\;(i=1, 2, 3)$, where $\sigma_i$ are the three Pauli matrices.
A new quantum number called weak isospin, $T$ is introduced, associated to the different spin-like multiplets.
Since the weak interaction only affects the left-handed particles (right-handed antiparticles), the left-handed fermions transform as doublets and the right-handed particles (left-handed antiparticles) as singlets:

\begin{equation}
\begin{split}
f_L^i = \left(
    \begin{matrix}
    \nu_L^i \\
    \ell_L^i
    \end{matrix} \right) ,\;
    \left(
    \begin{matrix}
    u_L^i \\
    d_L^i
    \end{matrix} \right) \\
f_R^i = \ell_R^i,\; u_R^i,\; d_R^i
\end{split}
\label{eq:EWKmultiplets}
\end{equation}

\noindent where $i=1,2,3$ is the family (generation) index.

The $U(1)_Y$ part of the symmetry is simpler, since it only has one hypercharge generator, $\hat{Y}$.
The Standard Model electroweak lagrangian is obtained by requiring invariance under local gauge group transformations.
As it was shown for the QED case (see Section \ref{sec:QED}), this can be achieved by introducing the covariant derivative:

\begin{equation}
\nabla_\mu \equiv \partial_\mu - ig\vec{T}\cdot\vec{W}_\mu - ig'\frac{Y}{2}B_\mu,
\label{eq:EWKCovariantDerivative}
\end{equation}

\noindent where $g$ and $g'$ are the coupling constant of the $SU(2)_L$ and $U(1)_Y$ gauge groups respectively.
Therefore, the lagrangian can be written as:

\begin{equation}
\lagrangian_{\text{EWK}} = \lagrangian_{f} + \lagrangian_{G}.
\label{eq:EWKLagrangianNoHiggs}
\end{equation}

The first term of Equation \ref{eq:EWKLagrangianNoHiggs} is the lagrangian that describes the fermion sector and their interactions, and can be written as:

\begin{equation}
\lagrangian_{f} = \sum_{f=l,q}{\bar{f} \, i\gamma^\mu \nabla_\mu \,f},
\label{eq:EWKLagrangianFermions}
\end{equation}

\noindent where $\nabla_\mu$ is taken from Equation \ref{eq:EWKCovariantDerivative}.
The second term is the lagrangian describing the gauge the contribution from the gauge fields:

\begin{equation}
\lagrangian_{G} = -\frac{1}{4}W_{\mu\nu}^i W^{\mu\nu}_i - \frac{1}{4}B_{\mu\nu}B^{\mu\nu} + \lagrangian_{GF} + \lagrangian_{FP},
\label{eq:EWKLagrangianGauge}
\end{equation}

\noindent where $i=1, 2, 3$, and $W_{\mu\nu}^i$ and $B_{\mu\nu}$ are the field tensors for $SU(2)_L$ and $U(1)_Y$ gauge groups, defined as:

\begin{equation}
\begin{split}
W_{\mu\nu}^i & \equiv \partial_\mu W_\nu^i - \partial_\nu W_\mu^i + g\epsilon^{ijk} W_\mu^j W_\nu^k \\
B_{\mu\nu} & \equiv \partial_\mu B_\nu - \partial_\nu B_\mu
\end{split}
\label{EWKFieldTensors}
\end{equation}

\noindent and $\lagrangian_{GF}$ and $\lagrangian_{FP}$ are the gauge fixing and the Faddeev-Popov lagrangians~\cite{Peskin:1995ev}, whose details lay beyond the scope of this Chapter.

The introduction of a mass terms for both the fermions or the gauge fields break the local $SU(2)_L$ gauge invariance of the lagrangian.
This is not in agreement with experimental observations which point to massive vector bosons.
Therefore, a mechanism for generating non-zero masses while preserving the consistency of the theory at high energies, needs to be introduced.
This mechanism is explained in the following.

\subsection{The Higgs mechanism}
    \label{sec:HiggsMechanism}

In the Standard Model, the masses for all the fields are generated via the Higgs mechanism of Spontaneous Symmetry Breaking (SSB).
In the SSB, a new doublet of $SU(2)_L \otimes U(1)_Y$ (also known as Higgs field) is introduced:

\begin{equation}
\Phi \equiv \left(
    \begin{matrix}
    \phi^{+} \\
    \phi^{0}
    \end{matrix}
    \right),
\label{eq:HiggsFieldRaw}
\end{equation}

\noindent where the ``+'' and ``0'' indices indicates the electric charge of the field, related to the third component of the weak isospin $T_3$ and the hypercharge $Y$ by the Gell-Mann Nishijima formula:

\begin{equation}
\hat{Q} = \hat{T}_3 + \frac{\hat{Y}}{2}.
\label{eq:ElectricChargeDefinition}
\end{equation}

This definition will be well motivated in the following lines.
The lagrangian that contains the kinetic and potential terms for this new field in Equation \ref{eq:HiggsFieldRaw}, and to be added to the electroweak potential in Equation~\ref{eq:EWKLagrangianNoHiggs}, is:

\begin{equation}
\lagrangian_{\Phi} = (\nabla_\mu \Phi)^{\dagger} (\nabla^\mu \Phi) - V(\Phi),
\label{eq:HiggsLagrangian}
\end{equation}

\noindent where

\begin{equation}
V(\Phi) = \mu^2 \Phi^{\dagger} \Phi + \lambda(\Phi^{\dagger} \Phi)^2.
\label{eq:HiggsPotential}
\end{equation}

If $\lambda>0$ and $\mu^2<0$, the minimum of the potential $V(\Phi)$ is found in

\begin{equation}
\Phi^{\dagger} \Phi = -\frac{\mu^2}{2m} \equiv \frac{v^2}{2},
\label{eq:HiggsMinimumOfPotential}
\end{equation}

\noindent and therefore the field $\Phi$ has a non-zero vacuum expectation value (VEV) $\langle\Phi\rangle_0 \equiv \langle0|\Phi|0\rangle = \frac{v}{\sqrt{2}}\neq 0$.

The Goldstone theorem states that a massless scalar (called Goldstone boson) appears when a continuous symmetry is spontaneously broken, and a field gets a VEV.
These VEVs can then be absorbed by a gauge field as a longitudinal polarization component and therefore, the gauge field acquires mass.
Since the photon is the only electroweak boson known to be massless, the symmetry is chosen to be broken so that the Higgs fields that adquire a VEV are the ones with zero electric charge:

\begin{equation}
\Phi_0 \equiv \left(
    \begin{matrix}
    0 \\
    v
    \end{matrix}
    \right).
\label{eq:VEVdefinition}
\end{equation}

Expanding the field around the true minimum of the theory, the complex field $\Phi$ becomes:

\begin{equation}
\Phi_0 = e^{i\frac{\vec{\sigma}\cdot\vec{\xi}(x)}{2}} \, \frac{1}{\sqrt{2}} \left(
    \begin{matrix}
    0 \\
    v + H(x)
    \end{matrix}
    \right),
\label{eq:HiggsField}
\end{equation}

\noindent where the three parameters $\vec{\xi}(x)$ correspond to the motion through the degenerated minima in the space, which can be set to zero ($\vec{\xi}(x)=0$) due to the gauge invariance of the lagrangian.

Furthermore, nothing prevents the Higgs doublet to couple to the fermion fields.
Therefore, the last missing piece of the final lagrangian of the electroweak Standard Model is the Yukawa lagrangian:

\begin{equation}
\lagrangian_{YW} = \sum_{f=l,q}{\lambda_f \left[ \bar{f}_L \Phi f_R + \bar{f}_R \bar{\Phi}f_L \right]},
\label{eq:HiggsYukawaLagrangian}
\end{equation}

\noindent where the matrices $\lambda_f$ describe the so called Yukawa couplings between the single Higgs doublet and the fermions.
The Yukawa lagrangian is gauge invariant since the combinations $\bar{f}_L \Phi f_R$ and $\bar{f}_R \bar{\Phi} f_L$ are $SU(2)_L$ singlets.

By introducing the expansion from Equation \ref{eq:HiggsField} in the Yukawa lagrangian in Equation \ref{eq:HiggsYukawaLagrangian}, the tree level predictions for the mass of the fermions can be obtained:

\begin{equation}
m_f = \lambda_f \frac{v}{\sqrt{2}}
\label{eq:HiggsFermionMasses}
\end{equation}

\noindent where $f$ stands for the fermions of the theory.
On the other hand, the tree level mass of the Higgs boson can be calculated from the Higgs lagrangian in Equation \ref{eq:HiggsLagrangian}, and it is found to be:

\begin{equation}
m_H = \sqrt{-2\mu^2} = \sqrt{2\lambda} v
\label{eq:HiggsHiggsMass}
\end{equation}

From the same Higgs lagrangian, the electroweak boson masses can also be obtained.
The relevant term in Equation \ref{eq:HiggsLagrangian} is

\begin{equation}
\begin{split}
& \left|\left(-ig\frac{\sigma}{2}\vec{W}_\mu - i\frac{g'}{2}B_\mu \right)\Phi\right|^2 \\
&= \frac{1}{8} \left|\left(
    \begin{matrix}
    gW_\mu^3 + g'B_\mu & g(W_\mu^1 - iW_\mu^2) \\
    g(W_\mu^1 + iW_\mu^2) & -gW_\mu^3 + g'B_\mu
    \end{matrix}
    \right)
    \left(
    \begin{matrix}
    0 \\%
    v   \
    \end{matrix}
    \right) \right|^2 \\
&= \frac{1}{8} v^2 g^2 \left[(W_\mu^1)^2 + (W_\mu^2)^2\right] + \frac{1}{8} v^2 (g'B_\mu - gW_\mu^3)(g'B^\mu - gW^{3\mu}) \\
&= \left(\frac{1}{2}vg\right)^2 W_\mu^{+} W^{-\mu} + \frac{1}{8} v^2 \left(W_\mu^3, B_\mu\right)
    \left(
    \begin{matrix}
    g^2 & -gg' \\
    -gg' & g'^2
    \end{matrix}
    \right)
    \left(
    \begin{matrix}
    W_\mu^3 \\
    B_\mu
    \end{matrix}
    \right),
\end{split}
\label{eq:HiggsBosonMassDemonstration}
\end{equation}

\noindent since $W^{\pm} = (W^1 \mp iW^2)/\sqrt{2}$.
The remaining off-diagonal term in the $W_\mu^3$ and $B_\mu$ basis cancel in the $Z_\mu$ and $A_\mu$ basis (which are the true mass eigenstates):

\begin{equation}
\begin{split}
\frac{1}{8}v^2\left[g^2\left(W_\mu^3\right)^2 - 2gg'W_\mu^3 B^\mu + g'^2B_\mu^2\right] = & \frac{1}{8}v^2\left[ gW_\mu^3 - g'B_\mu\right]^2 \\
& + 0 \left[g'W_\mu^3 + gB_\mu\right].
\end{split}
\label{eq:HiggsBosonMassDemonstration2}
\end{equation}

\noindent where

\begin{equation}
Z_\mu = \frac{gW_\mu^3 - g'B_\mu}{\sqrt{g^2 + g'^2}}
\label{eq:HiggsZdefinition}
\end{equation}

\begin{equation}
A_\mu = \frac{g'W_\mu^3 + gB_\mu}{\sqrt{g^2 + g'^2}}.
\label{eq:HiggsAdefinition}
\end{equation}

From Equations \ref{eq:HiggsBosonMassDemonstration} and \ref{eq:HiggsBosonMassDemonstration2}, the tree level prediction for masses of the gauge bosons is:

\begin{equation}
m_W = \frac{vg}{2}
\label{eq:HiggsWmass}
\end{equation}

\begin{equation}
m_Z = v \frac{\sqrt{g^2 + g'^2}}{2}
\label{eq:HiggsZmass}
\end{equation}

\begin{equation}
m_\gamma = 0.
\label{eq:HiggsAmass}
\end{equation}

%\noindent By knowing that the electric charge of the photon is 0, the Nijijima equation bla bla bla can be cross-chequed.
Finally, the Gell-Mann Nishijima formula shown in Equation \ref{eq:ElectricChargeDefinition} can be validated with the boson definitions:

\begin{equation}
\begin{split}
\hat{Q}A_\mu &= 0 \\
\hat{Q}Z_\mu &= 0 \\
\hat{Q}W^{\pm}_\mu &= \pm 1.
\end{split}
\label{eq:ValidationElectricChargeDefinition}
\end{equation}

\section{Quantum Chromodynamics}
    \label{sec:QCD}

Quantum Chromodynamics (QCD) was developed by Gell-Mann and Fritzsch in 1972 to describe the strong interactions in the SM, responsible for the behavior of quarks being held together by the strong force, carried by gluons.
As it was the case for the Electroweak Standard Model, quantum field theory is the framework in which QCD is developed.
In this case, the ``color'' group $SU(3)_c$ (see Equation \ref{eq:SMSymmetryGroup}) is the starting global symmetry.
This new quantum number (color) is introduced to refer to three different possible states of the quarks and it constitutes an exact symmetry of the theory.
The local gauge symmetry is promoted to a local one by introducing the covariant derivative:

\begin{equation}
\nabla_\mu \equiv \partial_\mu - ig_s \left(\frac{\lambda_\alpha}{2}\right)A_\mu^\alpha
\label{eq:QCDCovariantDerivative}
\end{equation}

\noindent where $g_s$ is the strong coupling constant (usually referred as $\alpha_s\equiv g_s^2 / 4\pi$ in the literature), $\frac{\lambda_\alpha}{2}$ are the $SU(3)_c$ generators, with $\alpha=1,\ldots,8$, and $A_\mu^\alpha$ are the gluon fields.
After the replacement of the normal derivatives by the covariant ones, the lagrangian of QCD is given by:

\begin{equation}
\lagrangian_{\text{QCD}} = \sum_{q}{\bar{q}(x)\left(i\gamma^\mu \nabla_\mu - m_q\right)q(x) - \frac{1}{4}F^{\alpha}_{\mu\nu}F^{\alpha\,\mu\nu}},
\label{eq:QCDlagrangian}
\end{equation}

\noindent where $\gamma^{\mu}$ are the Dirac $\gamma$-matrices and $q$ is a vector of three components corresponding to the different colors of a given quark type.
Gluons transform under the adjoin representation, while quarks are said to be in the fundamental representation of the $SU(3)$ color group.
The interactions between quarks and gluons are enclosed in the definition of the covariant derivative in Equation \ref{eq:QCDCovariantDerivative}.
The field tensor $F^{\alpha}_{\mu\nu}$ is given by

\begin{equation}
F^{\alpha}_{\mu\nu} = \partial_{\mu}A_{\nu}^{\alpha} - \partial_{\nu}A_{\mu}^{\alpha} - g_s f_{\alpha\beta\delta}A_{\mu}^{\beta}A_{\nu}^{\delta}
\label{eq:fieldTensorQCD}
\end{equation}

\noindent where $ f_{\alpha\beta\delta}$ are the structure constants of the $SU(3)$ group.
The third term of the tensor describes the gluon self-interaction and is responsible for the non-abelian nature of QCD.

The strong coupling constant changes with the scale of the interaction, as it can be seen in Figure~\ref{fig:alphaRunning}.
The Renormalization Group Equation (RGE) determines the running of the coupling strength with the scale in a quantum field theory.
For QCD, the 1-loop order RGE reads:

\begin{figure}[!ht]
  \begin{center}
    \mbox{
        \includegraphics[width=0.795\textwidth]{StandardModel/Figures/asq-2009.eps}
    }
  \end{center}
  \caption[Measurement of $\alpha_s(Q)$~\cite{Bethke:2009jm}.]{Measurement of $\alpha_s(Q)$~\cite{Bethke:2009jm}.}
  \label{fig:alphaRunning}
\end{figure}

\begin{equation}
\mu_{R}^{2} \frac{d\alpha_s(\mu_{R}^{2})}{d\mu_{R}^{2}} = -(33 - 2n_{f})\alpha_{s}^{2}(\mu_{R}^{2}),
\label{eq:RGE_QCD}
\end{equation}

\noindent where $\alpha_{s}(\mu_R)$ is the coupling as a function of an (unphysical) renormalization scale $\mu_R$, and $n_f$ is the number of families or generations.

The minus sign in the previous equation has its origin in the gluon self-interaction and leads to the two main characteristic properties of QCD: \emph{asymptotic freedom} and \emph{confinement}.
The integration of Equation \ref{eq:RGE_QCD} shows that at very high energies or equivalently, at very short distances the strong interaction coupling is weak.
This situation is called asymptotic freedom and is totally supported by the results from deep inelastic scattering (DIS) experiments (described in the next section).
Therefore, inside hadrons, the quarks behave as almost being free particles.
In the $\unit[100]{GeV}$-$\unit[1]{TeV}$ energy range, $\alpha_s\sim 0.1$, and perturbation theory can be applied to QCD (pQCD).

This equation also shows that the coupling constant asymptotically diverges at low energies (large distances), making therefore impossible to produce isolated quarks.
When in a $q\bar{q}$ pair, the quarks begin to separate from each other, the energy of the field between them increases.
At some point, it is energetically favorable to create an additional $q\bar{q}$ pair, so at the end, there are only colorless bound states (hadrons).
This situation is called color confinement and it is related to the process of jet formation (Section~\ref{subsec:HadronizationModels}).

\section{Deep Inelastic Scattering}
    \label{sec:DIS}

\subsection{Probing the proton}
    \label{subsec:ProvingProton}

Deep Inelastic Scattering (DIS) experiments have been performed since the 1960's to study the internal structure of nucleons.
Electrons with energies up to $\unit[20]{GeV}$ were sent against a target of hydrogen:

\begin{equation}
e + P \rightarrow e + X,
\label{eq:DISschema}
\end{equation}

\noindent where $P$ is the proton and $X$ is any hadronic final state (Figure~\ref{fig:DISexample}).

\begin{figure}[!t]
  \begin{center}
    \mbox{
        \includegraphics[width=0.495\textwidth]{StandardModel/Figures/DISexample.eps}
    }
  \end{center}
  \caption[Kinematic quantities for the description of the Deep Inelastic scattering.]{Kinematic quantities for the description of deep inelastic scattering. The quantities $k$ and $k'$ are the four-momenta of the incoming and outgoing leptons, $P$ is the four-momentum of a nucleon with mass $M$, and $W$ is the mass of the recoiling system $X$. The exchanged particle is a $\gamma$, $W^{\pm}$, or $Z$; it transfers four-momentum $q = k - k^{\prime}$ to the nucleon. \protect\cite{Beringer:1900zz}}
  \label{fig:DISexample}
\end{figure}

The kinematics of DIS can be described by the variables:

\begin{equation}
Q^2 \equiv -q^2 = (k-k')^2 \qquad\qquad x = \frac{Q^2}{2(P \cdot q)},
\label{eq:DISvariables}
\end{equation}

\noindent where $k$ and $k'$ are the four momentum of the incoming and outgoing electrons, $P$ is the momentum of the incoming proton and $x$ is interpreted as the fraction of the proton momentum carried by the interacting quark.

In the first DIS experiments, a larger number of large-angle deflected electrons than expected was found.
A phenomenological explanation to these results was given, considering the proton to be composed of non-interacting point-like particles, called \emph{partons}.
Therefore, $eP$ collisions can be regarded as ``hard'' interactions between the electron and partons inside the proton.
The Parton Model considers nucleons as bound states of three partons, each carrying a fraction $x$ of the total nucleon momentum such that:

\begin{equation}
\sum_{\text{partons}}{x_p} = 1.
\label{eq:sumFractionProton}
\end{equation}

In the parton model, the total cross section can be expressed in terms of electron-parton $ep$ interaction cross section:

\begin{equation}
\sigma(eP\rightarrow eX) = f \otimes \sigma(ep\rightarrow ep),
\label{eq:FactorizationTheoremSketch}
\end{equation}

\noindent where $f$ is the parton density, also called parton distribution function (PDF).
The term $f_i(x)dx$ gives the probability of finding a parton of type $i$ in the proton carrying a fraction between $x$ and $x+dx$ of the proton total momentum.
A prediction of the parton model is that, in the infinite-momentum frame of the proton, where $Q^2 \rightarrow \infty$ and the transverse momentum of the partons inside the proton are small, the parton densities are only a function of $x$.
This behavior is called Bjorken scaling.

However, in QCD, the radiation of gluons from the quarks leads to a violation of the scaling predicted by the Parton Model.
In particular, the DIS cross section can be written as:

\begin{equation}
\frac{d^2\,\sigma (e^{\pm}P)}{dx\,dQ^2} = \frac{4\pi\alpha^2}{xQ^4} \left( y^2 x F_1(x, Q^2) + (1-y) F_2(x, Q^2) \mp y(1-y)x F_3(x, Q^2) \right)
\label{eq:DISxsection}
\end{equation}

\noindent where $y = \frac{Q}{sx}$ and $F_i$ are the proton structure functions defined as:

\begin{equation}
F_1 = \frac{1}{2}\sum_i{e_i^2 f_i} \qquad \qquad F_2 = \frac{1}{2}\sum_i{e_i^2 x f_i},
\label{eq:DISformfactors}
\end{equation}

\noindent that explicitly depend on $Q$, and $F_3$ is found to be zero in parity conserving photon exchanges.
The reason for this dependence is that, an increase in $Q^2$ allows the gluons exchanged by the quarks (and their subsequent splittings into $q\bar{q}$ pairs) to be better resolved by the photon.
Figure~\ref{fig:ProtonPDFs} shows the parton distribution functions of a proton measured at different values of $Q^2$.
Valence quarks dominate for large values of $x$ (they carry the biggest fraction of the total proton momentum), while gluons and sea quarks dominate at low $x$.
This figure also shows that as $Q^2$ increases, the probability for finding gluons and sea quarks at low $x$ values is higher.

\begin{figure}[!ht]
  \begin{center}
    \mbox{
        \includegraphics[width=0.995\textwidth]{StandardModel/Figures/ProtonPDF.eps}
    }
  \end{center}
  \caption[Distributions of the parton distribution functions $xf(x)$.]{Distributions of the parton distribution functions $xf(x)$ (where $f = u_v,\, d_v,\, \bar{u},\, \bar{d},\, s \approx \bar{s},\, c=\bar{c},\, b=\bar{b}$) obtained in NNLO \texttt{NNPDF2.3} global analysis at scales $\mu^2 = \unit[10]{GeV^2}$ and $\mu^2 = \unit[10^4]{GeV^2}$, with $\alpha_s(M_Z) = 0.118$. \protect\cite{Beringer:1900zz}}
  \label{fig:ProtonPDFs}
\end{figure}

\subsection{Parton Distribution Function}
    \label{subsec:PDF_proton}

The partonic description of the hadrons that are collided determines the theoretical predictions on high energy physics.
Perturbative QCD cannot predict the form of the PDFs, but can describe their evolution with the variation of the scale $Q^2$:

\begin{equation}
\begin{split}
\frac{d}{d\log{Q^2}}f_{q}(x, Q^2) = \frac{\alpha_s}{2\pi}\int_{x}^{1}{\frac{dy}{y}\,f_{q}(y, Q^2)\,P_{qq}\left(\frac{x}{y}\right) + f_{g}(y, Q^2)\,P_{qg}\left(\frac{x}{y}\right)} \\
\frac{d}{d\log{Q^2}}f_{g}(x, Q^2) = \frac{\alpha_s}{2\pi}\int_{x}^{1}{\frac{dy}{y}\,f_{q}(y, Q^2)\,P_{gq}\left(\frac{x}{y}\right) + f_{g}(y, Q^2)\,P_{gg}\left(\frac{x}{y}\right)}.
\end{split}
\label{eq:EvolutionPDF}
\end{equation}

\noindent where $P_{ab}(z)$ are the Dokshitzer-Gribov-Lipatov-Altarelli-Parisi (DGLAP) splitting functions, that describe the probability that a parton of type $b$ radiates a quark or a gluon of type $a$, carrying a fraction $z$ of the initial's parton momentum.
In particular, the first expression describes the change of the quark densities with $Q^2$ due to gluon radiation and gluon splitting, while the second expression describes the change of the gluon densities with $Q^2$ due to gluon radiation from quarks and gluons.
The DGLAP splitting functions at the lowest order in $\alpha_s$, in the small angle approximation and averaging over the polarizations and spins are expressed as~\cite{Halzen}:

\begin{equation}
\begin{split}
&P_{qq}(z) = \frac{4}{3}\frac{1+z^2}{1-z}, \\
&P_{gq}(z) = \frac{4}{3}\frac{1+(1-z)^2}{z}, \\
&P_{qg}(z) = \frac{1}{2}\left(z^2+(1-z)^2\right), \\
&P_{gg}(z) = 6\left(\frac{1-z}{z} + \frac{z}{1-z} + z(1-z)\right).
\end{split}
\label{eq:DGLAP}
\end{equation}

\subsection{PDF parametrization}

Experimental data are fitted to obtain the parton densities at a given scale $Q^2$, and the evolution equations \ref{eq:EvolutionPDF} are used to predict the PDFs at different scales.
Figure~\ref{fig:DIS_F2fit} shows the structure function $F_2$ as a function of $x$ and $Q^2$ as measured from DIS and fixed target experiments, and the evolution predicted with the DGLAP equations.
The structure function $F_2$ shows no dependence on $Q^2$ for large values of $x$.
However, as $x$ decreases, the effect of the gluons and sea quarks start to be important, thus violating the Bjorken scaling.

\begin{figure}[!t]
  \begin{center}
    \mbox{
        \includegraphics[width=0.995\textwidth]{StandardModel/Figures/StructureFunctionZEUS.eps}
    }
  \end{center}
  \caption[The proton structure function $F_2$ versus $Q^2$ at fixed values of $x$.]{The proton structure function $F_2$ versus $Q^2$ at fixed values of $x$. Data are from the ZEUS94 and SVX95 analyses and from the NMC and BCDMS fixed target experiments. For clarity an amount $C_i = 13.6-0.6i$ is added to $F_2$ where $i=1$ (18) for the lowest (highest) $x$ value~\cite{Breitweg:1998dz}.}
  \label{fig:DIS_F2fit}
\end{figure}

The PDFs are expected to be smooth functions of the scaling variable $x$, and can be parametrized.
In this analysis, the parametrization provided by the CTEQ~\cite{Lai:1994bb}, CT10~\cite{Lai:2010vv} and MSTW~\cite{Martin:2009iq} collaborations are used.
As an example, the CT10 parametrizaton used for the quarks and the gluon parton densities is:

\begin{equation}
xf_i(x, Q^2_0) = A_0 \cdot x^{A_1}(1-x)^{A_2}\exp{(A_3x + A_4 x^2 + A_5\sqrt{x})},
\label{eq:parametrizationPDF}
\end{equation}

\noindent where $f_i$ is a particular parton density at $Q^2_0$ and $A_i$ are the parameters to be fitted, obtained with a $\chi^2$ parametrization over data from different types of measurements.
Not all these parameters are free, since these functions must satisfy flavor and momentum sum rules.

\section{Monte Carlo simulation}
    \label{sec:MCSimulation}

Monte Carlo (MC) codes are tools that enable the description of the final states resulting from high-energy collisions, where the state-of-the-art knowledge about QED and QCD is implemented by using MC techniques.
They have been developed to help interpreting the data from high energy particle colliders in order to extract the measurement of fundamental physical parameters or to infer the possible existence of new physics beyond the SM.
The next subsections are devoted to describe the different phases of a MC event generation~\cite{Skands:2011pf,ellis2003qcd}.
Figure~\ref{fig:HardCollisionEvolution} shows the general structure of a hard proton-proton collision.
The dotted circle {\em H} separates the perturbative QCD (hard process, initial and final state radiation) from non-perturbative contributions (underlying event, hadronization and PDFs).
%Finally, a summary of the characteristics of the MC generators used in the analysis presented will be shown.

\begin{figure}[!ht]
  \begin{center}
    \mbox{
        \includegraphics[width=0.995\textwidth]{StandardModel/Figures/HardInteractionEvolution.eps}
    }
  \end{center}
  \caption[General structure of a hard proton-proton collision.]{General structure of a hard proton-proton collision. HP, denotes the hard process, and UE, is the underlying event~\protect\cite{Mangano:2005dj}.}
  \label{fig:HardCollisionEvolution}
\end{figure}

\subsection{Parton-level event generators}
    \label{subsec:EventGenerators}

The cross section for a two-hadron interaction with momenta $P_1$ and $P_2$, can be factorized into short- and long-distance effects delimited by a factorization scale $\mu_F$, according to the factorization theorem:

\begin{equation}
\begin{split}
\sigma(P_1, P_2) = \sum_{i, j} \int dx_1\, dx_2\, f_i(x, \mu_F^2)\, f_j(x, \mu_F^2) \\
  \times\; \hat{\sigma}_{ij}(p_1, p_2, \alpha_s(\mu_R^2), Q^2/\mu_F^2,  Q^2/\mu_R^2)
\end{split}
\label{eqXSecQCDComputation}
\end{equation}

\noindent where $f_i$ are the PDFs of each interacting parton, the sum runs over all parton types, and $\hat{\sigma}_{ij}$ is the parton cross section for incoming partons with momenta $p_1=x_1P_1$ and $p_2=x_2P_2$, respectively.
As long as the same factorization scale is used, the same PDFs extracted from DIS experiments can be used for $ep$, $\pp$ and $\ppbar$ experiments.
$\hat{\sigma}_{ij}$ is calculated at a given order on pQCD, which introduces a dependence on a renormalization scale $\mu_R$, that is usually chosen to be equal to $\mu_F$.

Schematically, the all-orders partonic cross section, $\hat{\sigma}_{ij}$ for a given process $F$, with any extra emission, can be expressed as:

\begin{equation}
\begin{split}
\hat{\sigma}_{ij} &= \int{d\mathcal{O}\; \frac{\hat{\sigma}_{ij}}{d\mathcal{O}}} \\
                  &= \int{d\mathcal{O}} \; \underbrace{\sum_{k=0}^{\infty}{\int{d\Phi_{F+k}}}}_{\Sigma\text{ legs}}
                                          |\underbrace{\sum_{\ell=0}^{\infty}{\mathcal{M}^{\ell}_{F+k}} }_{\Sigma \text{ loops}}|^2 \delta(\mathcal{O} - \mathcal{O}(\Phi_{F+k})) ,
\end{split}
\label{eq:AllOrdersXSection}
\end{equation}

\noindent where the sum over $k$ represents the sum over additional ``real emission'' corrections, called legs, and the sum over $\ell$ represents the sum over additional virtual corrections, loops.
$\Phi_{F+k}$ represents the phase space of the configuration with $k$ legs and $\ell$ loops.

The various fixed order truncations of pQCD can be recovered by limiting the nested sums in Equation~\ref{eq:AllOrdersXSection} to include only specific values of $k+\ell$.
Therefore,

\begin{itemize}
\item $k=0$, $\ell=0$: Leading order (usually tree-level) for inclusive $F$ production.
\item $k=n$, $\ell=0$: Leading order for $F+n$~jets.
\item $k+\ell \leq n$: N$^n$LO for $F$ (includes N$^{n-1}$LO for $F+1$ jet,  N$^{n-2}$LO for $F+2$ jets, and so on up to LO for $F+n$ jets).
\end{itemize}

The Kinoshita-Lee-Nauenberg (KLN) theorem~\cite{Kinoshita:1962ur,Lee:1964is} states that the divergences originated in the loops exactly cancel against those from the real emissions, order by order in perturbation theory.
However, in a fixed order calculation, e.g. leading order, in the situation for which $k\geq1, \ell=0$, the integration over the full momentum phase space will include configurations in which one or more of the $k$ partons become collinear or soft, thus leading to singularities in the integration region.
For this reason, the integration region needs to be modified to include only ``hard, well-separated'' momenta.
The remaining part of the phase space is then considered by the parton shower generators.

\subsection{Parton shower generators}
    \label{subsec:PartonShowerGenerators}

As already mentioned, the fixed order calculations introduced in the previous section are only valid if two conditions are fulfilled:

\begin{enumerate}
\item The strong coupling, $\alpha_s$, is small, so that perturbation theory is valid.
\item The phase space region is restricted to configurations in which real emissions are ``hard and well-separated''.
\end{enumerate}

Parton showers are included in the MC simulations to approximately account for the rest of higher order contributions to emulate a complete final state.
By the successive parton emission, the partons in the final state produce a cascade, where the splitting functions (Eq.~\ref{eq:DGLAP}) govern the radiation process.
A parton shower generator simulates the successive emission of quarks and gluons from the partons in the final (or initial) state.
This simulation is approximate, since it assumes completely independent parton emissions, neglects any interference term among them and does not consider virtual corrections.
In the almost-collinear splitting of a parton, the $n+1$-parton differential cross-section can be related to the $n$-parton cross section before splitting as

\begin{equation}
d\sigma_{n+1} \approx d\sigma_n \; dP_i(z,\mu^2)
\label{eq:PSrelation}
\end{equation}

\noindent where

\begin{equation}
dP_i(z,\mu^2) = \frac{d\mu^2}{\mu^2} \; \frac{\alpha_s}{2\pi} \; P_{ji}(z)dz
\label{eq:dPi}
\end{equation}

\noindent shows the probability that parton $i$ will split into two partons at a virtuality scale $\mu$ and with parton $j$ carrying a fraction $z$ of the $i$'s parton momentum and $P_{ji}(z)$ are the same DGLAP equations from Eq. \ref{eq:DGLAP}.
This relation is universal, so for any process involving $n$ partons, this equation can be applied to obtain an approximation for $\sigma_{n+1}$.
This probability diverges logarithmically in the soft ($z=1, 0$) and collinear ($\mu = 0$) regions, which can be understood as a consequence of the non-perturbativity of QCD at low scales.
These divergences are not a problem because detectors will not be able to resolve two partons very close one another, thus introducing an effective cutoff to screen these regions.

The quality of the approximation from Equation~\ref{eq:dPi} is governed by how many terms besides the leading one shown in this equation are included.
Including all possible terms, the most general form for the cross section of the process $F + n$ jets, restricted to the phase-space region above some infrared cutoff scale, has the following algebraic structure:

\begin{equation}
\sigma_{F+n} = \alpha_s^n (\ln^{2n} + \ln^{2n-1} + \ln^{2n-2} + \cdots + \ln + \mathcal{R}),
\label{leadinglogapproximation}
\end{equation}

\noindent and therefore, the simplest approximation one can build from this equation is the ``leading-logarithmic'' (LL), in which all the terms of the series are dropped but the $\ln^{2n}$ one.

For the computer implementation of the parton shower, the Monte Carlo programs use Sudakov form factors:

\begin{equation}
\Delta_i(q_1^2, q_2^2) = \exp{\left( - \sum_{j} \int_{q_2^2}^{q_1^2}{\,\int_{z_\text{min}}^{z_\text{max}}{dP_i(z',dq'^2)}} \right)},
\label{eq:Sudakov}
\end{equation}

\noindent derived from the splitting functions.
The Sudakov form factors represent the probability that a parton evolves from an initial scale $q_1$ to a lower scale $q_2$ without branching.

To simplify the implementation of the calculations in the Monte Carlo programs, the radiations are separated into initial-state and final-state showers, depending on whether they start off an incoming or outgoing parton of the hard scattering.
In the final-state showers, the Monte Carlo branching algorithm operates in steps:

\begin{enumerate}
\item When a branching $a\rightarrow b + c$ occurs at scale $q_a$, the fraction of momentum carried by the daughter partons $x_b/x_a$ is determined using the appropriate splitting function $P_{ab}$, and the opening angle $\theta_a$ between $b$ and $c$ is given by $q_a = E_a^2(1-\cos{\theta_a})$.

\item The scale at which the partons $b$ and $c$ will branch is determined with the Sudakov factors.
Since the scale $q_a$ is proportional to the virtual mass, $q_b$ and $q_c$ are kinematically constrained to satisfy $\sqrt{q_a} > \sqrt{q_b} + \sqrt{q_c}$, thus imposing that the subsequent branchings on the daughter partons will have smaller opening angles.

\item The shower is terminated when these virtualities have fallen to the hadronization scale, $Q^2\sim\unit[1]{GeV}$.
\end{enumerate}

In the initial state showers, the same algorithm is applied, but operated backwards in time.
Starting from an incoming parton at the hard interaction $b$, it finds the branching $a\rightarrow b+c$, where $c$ can further branch in a final-state fashion.
Therefore, in the construction of the initial-state shower, the fraction of momentum $x$ is increased, and at the end it will match that described by the PDFs.

\subsection{Matrix element and parton shower matching}
    \label{subsec:MEandPSmatching}

The addition of the parton shower to the parton-level event generator can introduce double-counting of events in some regions of the phase space.
This is illustrated in a very simple way in Figure~\ref{fig:MatchingOverlap}.
The LO cross section for some process (green area), $F$, with a LL shower added to it (yellow area), is found in the left-pane of this figure.
To improve the description of the $F+1$ process from LL to LO, one needs to add the actual LO matrix element for $F+1$ (with a LL parton shower description as well).
However, the LO matrix element for $F+1$ is divergent, and therefore, only the phase-space region with at least one hard resolved jet can be covered (illustrated by the half shaded boxes in the middle pane of Figure~\ref{fig:MatchingOverlap}).
When one adds these two samples, the LL terms of the inclusive cross section for $F+1$ are counted twice, once from the shower of $F$, and once from the matrix element for $F+1$, illustrated by the red areas of the right-hand pane of Figure~\ref{fig:MatchingOverlap}.

\begin{figure}[!ht]
  \begin{center}
    \mbox{
        \includegraphics[width=0.995\textwidth]{StandardModel/Figures/MatchingMCOverlap.eps}
    }
  \end{center}
  \caption[Double-counting problem caused by adding cross sections involving matrix elements with different numbers of legs]
{Illustration of the double-counting problem caused by naively adding cross sections involving matrix elements with different numbers of legs~\cite{Skands:2011pf}.}
  \label{fig:MatchingOverlap}
\end{figure}

To remove this overlap, the phase space covered by the matrix element calculation, and the space covered by the parton shower evolution needs to be separated.
There are two main matching schemes: the Catani-Krauss-Kuhn-Webber (CKKW \cite{Catani:2001cc}) and the Michelangelo L. Mangano (MLM \cite{Mangano:2006rw}) methods.
They separate the phase space into the ME and PS regions by introducing resolution parameters that distinguish between resolved and non-resolved jets, to be described by the ME and the PS, respectively.

In the CKKW algorithm, a parton branching history is generated using the \kt{} algorithm \cite{Catani:1991hj}, given a configuration with $n$ partons in the final state.
The values of $\alpha_s$ in every vertex of the branching, and the Sudakov factor from every line between the vertices, are used to reweight the matrix elements.
The initial conditions of the shower are then set to have a smooth transition between the reweighted matrix elements and the parton shower, where the hard emissions in the shower evolution are vetoed if they have enough transverse momentum to produce a separate jet, according to the \kt{} algorithm.

The matching MLM procedure starts by separating the events in exclusive samples of $n$ partons in the final state, and then, the parton shower is developed in that event using a PS Monte Carlo.
The parton configuration after the showering is then processed with a cone jet algorithm, with a radius $R_{\text{jet}}$.
Then, the original $n$ partons are matched to the jets if $\Delta R(\text{jet}, \text{parton}) < R_{\text{jet}}$.
If all the partons are matched to a jet and there are no extra jets, i.e. $N_{\text{jets}}=n$, the event is accepted.
Otherwise, the event is rejected to avoid further hard emissions that would lead to additional jets.
Finally, the events with different jet multiplicities, $n=0, 1, 2, \ldots, k$, are recombined in a single sample.
The events in the sample with parton multiplicities higher than $k$ jets are accepted if $N_\text{jets}\geq k$.

\subsection{Hadronization models}
    \label{subsec:HadronizationModels}

As the collision process evolves and the partons radiate and travel further apart, the QCD running coupling increases as the values of the shower evolution scale $Q^2$ decrease.
Therefore, the confining effects of QCD become important and the dynamics enter a non-perturbative phase which leads to the formation of the observed final-state hadrons.
Event generators have to rely on models based on general features of QCD.

As a consequence of the factorization assumption and color preconfinement, the hadronization of the partons is independent of the hard scattering process.
Therefore, the parameters of a model used to describe a hadronization can be fitted to the results of one experiment and then applied to another.

The most used hadronization models are the string fragmentation and the cluster hadronization models, which are described below.

\begin{figure}[!ht]
  \begin{center}
    \mbox{
        \includegraphics[width=0.495\textwidth]{StandardModel/Figures/HadronizationString.eps}
        \includegraphics[width=0.495\textwidth]{StandardModel/Figures/HadronizationCluster.eps}
    }
  \end{center}
  \caption[Illustration of different hadronization models.]{Illustration of string fragmentation (left) and cluster hadronization (right) \protect\cite{Ellis:1991qj}.}
  \label{fig:HadronizationModels}
\end{figure}

\subsubsection{String fragmentation hadronization model}
    \label{subsubsec:StringModel}

The string model for hadronizaton, schematically shown in Figure \ref{fig:HadronizationModels} (left), uses string dynamics to describe the flux between a $q\bar{q}$ pair.
It is based on the observation that at large distances the potential energy of color sources increases linearly with their separation.
In the evolution of the hadronization process, the potential energy of the string increases as partons travel further apart at the expense of its kinetic energy.
When this energy becomes higher than the mass of a light $q\bar{q}$ pair, a new $q'\bar{q}'$ is created and the string breaks into two shorter strings creating two color-singlet states $q'\bar{q}$ and $q\bar{q}'$.
If the relative momentum of the new $q\bar{q}$ pairs connected to the same string is large enough, the string might break again.
Gluons act as ``kinks'' in the string, that add extra tension to it.
The creation of heavy quarks is suppressed during the hadronization as the production of light quark pairs ($u$, $d$ and $s$) is more energy favored.
The formation of baryons, 3-quark states, is achieved by considering them quark-diquark states, where diquarks are simply treated as antiquarks.

\subsubsection{Cluster hadronization model}
    \label{subsubsec:ClusterModel}

The cluser model is based on the color pre-confinement of the branching processes.
The process starts by splitting gluons that remain after parton shower into quark-antiquark pairs, so that only quarks are present.
They are then grouped in color-singlets.
The mass spectrum of these clusters peaks at low values of the order of the GeV, but has a broad tail at high masses.
The clusters decay typically into two hadrons.
Heavier hadrons are naturally suppressed by the mass spectra.
Furthermore, the heaviest clusters can decay into smaller clusters that subsequently decay into hadrons.
A sketch of this model is shown in Figure \ref{fig:HadronizationModels} (right).

\subsection{Underlying event}
    \label{subsec:UnderlyingEvent}

The underlying event (UE) refers to the interactions involving partons that do not directly take part in the hard scattering.
It cannot be described perturbatively because the interactions happen at low transferred momentum.
These interactions also involve flavor and color connections to the hard scattering, and therefore they cannot be separated from the hard scattering in general.
The presence of particles originated in the UE can affect the interpretation of the data, for example, by contributing to the energy associated to the jets.
Phenomenological models~\cite{Butterworth:1996zw} are used to simulate the UE and are tuned to minimum bias data from hadron colliders~\cite{Sjostrand:2006za}.

\subsection{Monte Carlo generators}
    \label{subsec:MCgenerators}

A summary of the different MC generators used in this Thesis is presented in Table~\ref{tab:MCgenSummary}, and briefly discussed in the following sections~\cite{Buckley:2011ms, Aad:2010ah}.

\begin{table}[!ht]
  \begin{center}
    \begin{small}
      \setlength{\tabcolsep}{0.0pc}
      \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}ccccc}
        \noalign{\smallskip}\hline\hline\noalign{\smallskip}
        \textbf{Monte} & \textbf{Matrix}  & \textbf{ISR/} & \multirow{2}{*}{\textbf{Hadronization}} & \textbf{Underlying} \\
        \textbf{Carlo} & \textbf{element} & \textbf{FSR}  &                                         & \textbf{event} \\
        \noalign{\smallskip}\hline\noalign{\smallskip}
        \pythia{}      & LO               & Parton shower & String model  & Minimum bias \\
        \herwig{}      & LO               & Parton shower & Cluster model & \jimmy{}  \\
        \multirow{2}{*}{\sherpa{}}      & \multirow{2}{*}{LO}               & \pythia{}     & \multirow{2}{*}{\pythia{}}     & \multirow{2}{*}{\pythia{}} \\
         & & (CKKW matching)& & \\
        \multirow{3}{*}{\alpgen{}}      & \multirow{3}{*}{LO}               & \pythia{} or   & \multirow{3}{*}{\pythia{}}     & \multirow{3}{*}{\pythia{}} \\
         & & \herwig{}& & \\
         & & (MLM matching)& & \\
        \mcnlo{}       & NLO              & \herwig{} & \herwig{} & \herwig{} (\jimmy{})\\
        \multirow{2}{*}{\powheg{}}      & \multirow{2}{*}{NLO}               & \pythia{} or     & \pythia{} or     & \pythia{} or \\
         & & \herwig{} & \herwig{} & \herwig{} \\
        \multirow{2}{*}{\acer{}}      & \multirow{2}{*}{LO}               & \pythia{} or     & \pythia{} or     & \pythia{} or \\
         & & \herwig{} & \herwig{} & \herwig{} \\
        \multirow{2}{*}{\madgraph{}}      & \multirow{2}{*}{LO}               & \pythia{}     & \multirow{2}{*}{\pythia{}}    & \multirow{2}{*}{\pythia{}} \\
           & & (MLM matching) & &  \\
        \noalign{\smallskip}\hline\hline\noalign{\smallskip}
      \end{tabular*}
    \end{small}
  \end{center}
  \caption[Summary of the Monte Carlo generators used in the analysis.]{Summary of the Monte Carlo generators used in the analysis.}
  \label{tab:MCgenSummary}
\end{table}

\subsubsection{General purpose Monte Carlo generators}

\pythia{}~\cite{Sjostrand:2006za} and \herwig{}~\cite{Corcella:2000bw,Bahr:2008dy} are general purpose event generators that use matrix elements at leading-order in perturbation theory in QCD.
They are optimized to compute 2-to-1 and 2-to-2 processes, although 2-to-$n$ ($n>2$) processes can be achieved with initial- and final-state radiation, ordered in $\pt$ (angle) in the case of \pythia{} (\herwig{}).
For hadronization, \pythia{} uses the string model, while the cluster model is used in \herwig{}.
The latest is normally interfaced with \jimmy{}~\cite{Butterworth:1996zw} to model the underlying event.

\subsubsection{Multi-leg Monte Carlo generators}

\sherpa{} \cite{Gleisberg:2008ta}, \alpgen{} \cite{Mangano:2002ea} and \madgraph{} \cite{Alwall:2011uj} are multi-purpose event generators, specialized in the computation of matrix elements involving 2-to-$n$ processes at LO in pQCD.
\madgraph{} and \alpgen{} compute separated ME up to $n=6$ and $n=9$, respectively.

In \sherpa{} the different jet multiplicities are generated in a single inclusive sample directly.
Parton showers and hadronizations are performed with either \pythia{} or \herwig{} for \alpgen{} and \sherpa{}, while \madgraph{} needs to be interfaced with \pythia{}.
The ME/PS matching is performed with the CKKW scheme in \sherpa{}, and with the MLM scheme in \alpgen{} and \madgraph{}.
Finally, \alpgen{} and \madgraph{} use \pythia{} to simulate the UE, while \sherpa{} uses its own implementation, closely following following the \pythia{} implementation.

In the analysis presented in the following chapters, \sherpa{} and \alpgen{} MC generators are used to model the $W/Z$+jets and the dibosons ($WW$, $ZZ$ or $WZ$) Standard Model processes.
The \madgraph{} interface, is instead used for the implementation of the new physics models.

\subsubsection{Next-to-leading order Monte Carlo generators}

\mcnlo{} \cite{Frixione:2008ym} and \powheg{} \cite{Frixione:2007vw} are event generators that use matrix elements at NLO in pQCD.
In the analysis, they are used to simulate processes involving the production of a top quark.
\powheg{} is interfaced with either \pythia{} or \herwig{} for the modeling of the PS, hadronization or UE, while \mcnlo{} is interfaced with \herwig{}.


\section{Utility Verbs}
\label{utilityverbs}

\begin{tabular}{l}
{\apl resh\qlarrow\qlbrace\qlpar\qlpar\qlpar\qrho\qomega\qrpar\qdivide\qalpha\qrpar\qcomma\qalpha\qrpar\qrho\qomega\qrbrace}\\
{\apl uint8\qlarrow\qlbrace\02\qdtack\qnuax\01\qltack\08~resh~\qomega\qrbrace}\\
{\apl sum\qlarrow\qlbrace\qplus\qslash\qomega\qrbrace}\\
{\apl any\qlarrow\qlbrace\qor\qslash\qomega\qrbrace}
 or {\apl any\qlarrow\qlbrace0\qne\qplus\qslash\qomega\qrbrace}\\
{\apl all\qlarrow\qlbrace\qand\qslash\qomega\qrbrace}
 or {\apl all\qlarrow\qlbrace\qlpar\qrho\qomega\qrpar\qeq\qplus\qslash\qomega\qrbrace}\\
{\apl b256\qlarrow\0\qtran\qlpar\08\qrho\02\qrpar\qutack\qiota\0256}\\
{\apl PopcountTab\qlarrow\qplus\qslash\0b256}\\
{\apl RevTab\qlarrow\02\qdtack\qrotf\qtran\0b256}\\
{\apl ZeroNonzeroTab\qlarrow\0PopcountTab\qcomma\00}\\
{\apl First0Tab\qlarrow\0b256\qiota\qnuax\01\qrtack\00}\\
{\apl First1Tab\qlarrow\qrotate\0First0Tab}\\
\end{tabular}

\begin{figure}
{\apl\small
\begin{tabular}{l}
infix\qlarrow\qlbrace\qtilde\01\quarrow\qovrbar\02\quarrow\qlpar\02\qplus\02\qstile\0\qomega\qrpar\qrho\qalpha\qlbr\00~1\qrbr\qrbrace\\
cscan\qlarrow\qlbrace~m\qlarrow\qomega\qiota\0\qtilde\qalpha\qlbr\00\qrbr\\
~~~~~~~~i\qlarrow\0\qalpha~infix~m\\
~~~~~~~~s\qlarrow\qlpar\00\qustile\qlpar\qrho\qomega\qrpar\qbar\0m\qplus\01\qrpar\qrho\0i\qeq\0\qalpha\qlbr\02\qrbr\\
~~~~~~~~\qlpar\0m\qrho\qalpha\qlbr\00~1\qrbr\qrpar\qcomma\qlpar\0m\qne\qrho\qomega\qrpar\qslash\0i\qcomma\0s\qrbrace\\
ltscan~~\qlarrow\qlbrace\00~0~0~cscan~\qomega\qrbrace\\
orscan~~\qlarrow\qlbrace\00~0~1~cscan~\qomega\qrbrace\\
norscan~\qlarrow\qlbrace\00~1~0~cscan~\qomega\qrbrace\\
gescan~~\qlarrow\qlbrace\00~1~1~cscan~\qomega\qrbrace\\
nandscan\qlarrow\qlbrace\01~0~0~cscan~\qomega\qrbrace\\
gtscan~~\qlarrow\qlbrace\01~0~1~cscan~\qomega\qrbrace\\
lescan~~\qlarrow\qlbrace\01~1~0~cscan~\qomega\qrbrace\\
andscan~\qlarrow\qlbrace\01~1~1~cscan~\qomega\qrbrace\\
\end{tabular}
}
\caption{McDonnell's Boolean scan verbs}
\label{caretscanverbs}
\end{figure}


\section{Contribution}\label{contribution}

%The previous work on model typing \cite{ecmfa12} introduces substitutability into model types, and formally defines a subtyping relation between two model types specified using MOF\cite{MOF}.
%The previous work, however, only considers MOF-based structural subtyping in which the structure of two model types determines whether one is subtype of the other, which limits the applicability of model subtyping in a setting where OCL contracts are needed to precisely define modeling languages (e.g., specifying a model transformation).

In this paper we extend the subtyping relation described in \cite{ecmfa12} by taking into account OCL contracts for a safe substitutability of models conforming to metamodels including contracts. This provides a safe reuse of model transformations expressed on metamodels that include contracts.
Specifically, we extend the MOF class matching (cf. Def. 2 of Section \ref{background}) by considering contracts matching (Section \ref{classmatching}) and provide a technique for analyzing the matching of OCL contracts associated with two classes with different model types (Section \ref{analyzingcontract}). In this section we describe the contract matching technique we developed to support contract-aware model substitutability. We also describe an Alloy-based prototype tool that supports contract matching (Section \ref{toolsupport}), and illustrate the use of contract-aware substitutability using the motivating examples (Section \ref{casestudy}).

\subsection{Contract-aware MOF Class Matching}\label{classmatching}

We consider the use of OCL invariants added to MOF classes to specify additional structural properties, and OCL pre-/post-conditions defined in the context of MOF class operations to specify the model manipulation rules (e.g., transformation) associated with model types.
The MOF class matching relation is thus determined by two aspects: the structural features specified using MOF (e.g., classes, properties, operation signatures, etc.) and the contracts expressed using OCL (e.g., invariants and pre-/post-conditions).
%While the previous work \cite{ecmfa12} used the structural elements (cf. Def. 3 of \cite{ecmfa12}) to determine the matching relation between two MOF classes, the focus of this paper is to provide a formal definition of the contract matching used to support the contract-aware MOF class matching.

The substitutability through model subtyping is a specialization of the Liskov Substitution Principle \cite{liskov1994behavioral} on the model type system.
Specifically the contract matching relation that enables contract-aware model substitutability must abide by the following rules: (1) invariants of the supermodel type cannot be weakened in a sub model type, (2) pre-conditions cannot be strengthened in a sub model type, and (3) post-conditions cannot be weakened in a sub model type.
The extended MOF class matching relation is formalized as follows:

\begin{definition}[Contract-aware MOF Class Matching] Class $T'$ matches T (written $T'$ <\# T) iff their structures match (cf. Def. 3 of \cite{ecmfa12}), their invariants match and their operation pre-/post-conditions match, where
\begin{enumerate}
\item[1] \textbf{Invariants Match} is defined as follows:\\
let T.ownedInvariant = $\{$$inv_{T1}$, $inv_{T2}$, ..., $inv_{Tk}$ $\}$ be the invariants defined for $T$;\\
let $result_T$ = $inv_{T1}$ $\wedge$ $inv_{T2}$ $\wedge$ ... $\wedge$ $inv_{Tk}$;\\
let SuperClass(T) = $\{$$cls_1$, $cls_2$, ..., $cls_n$$\}$ where $cls_i$ is a superclass of T; \\
let $cls_i$.ownedInvariant = $\{$ $inv_{i1}$, $inv_{i2}$, ..., $inv_{ik}$ $\}$ be the invariants defined for $cls_i$, for i = 1, .., n;\\
let $result_i$ = $inv_{i1}$ $\wedge$ $inv_{i2}$ $\wedge$ ... $\wedge$ $inv_{ik}$, for i = 1, .., n;\\
let invs = $result_1$ $\wedge$ $result_2$ $\wedge$ ... $\wedge$ $result_n$ $\wedge$ $result_T$;\\
\\
let T$'$.ownedInvariant = $\{$$inv'_{T1}$, $inv'_{T2}$, ..., $inv'_{Tk}$ $\}$ be the invariants defined for $T'$;\\
let $result'_T$ = $inv'_{T1}$ $\wedge$ $inv'_{T2}$ $\wedge$ ... $\wedge$ $inv'_{Tk}$;\\
let SuperClass(T$'$) = $\{$$cls'_1$, $cls'_2$, ..., $cls'_n$$\}$ where $cls'_i$ is a superclass of T$'$; \\
let $cls'_i$.ownedInvariant = $\{$ $inv'_{i1}$, $inv'_{i2}$, ... , $inv'_{ik}$ $\}$ be the invariants defined for $cls'_i$, for i = 1, .., n;\\
let $result'_i$ = $inv'_{i1}$ $\wedge$ $inv'_{i2}$ $\wedge$ ... $\wedge$ $inv'_{ik}$, for i = 1, .., n;\\
let invs$'$ = $result'_1$ $\wedge$ $result'_2$ $\wedge$ ... $\wedge$ $result'_n$ $\wedge$ $result'_T$;\\
\\
The invariants of T and T$'$ match if Models(invs) $\supseteq$ Models(invs$'$), where $Models(invs)$ returns all models that satisfy $invs$ and $Models(invs')$ returns all models that satisfy $invs'$.\\
%\begin{algorithmic}
%\State let result1 = true, result2 = true, invs = true, invs$'$ = true
%\For {each cls in SuperClass(T)}
%    \For {each inv in cls.ownedInvariant}
%		 		\State {result1 = result1 $\wedge$ inv}
%    \EndFor
%    \State {invs = invs $\wedge$ result1}
%\EndFor
%\For {each cls$'$ in SuperClass(T$'$)}
%    \For {each inv$'$ in cls$'$.ownedInvariant}
%		 		\State {result2 = result2 $\wedge$ inv$'$}
%    \EndFor
%    \State {invs$'$ = invs$'$ $\wedge$ result2}
%\EndFor

%\State Models(invs) $\supseteq$ Models(invs$'$)
%\end{algorithmic}

%let invs: Constraint = SuperClasses(T)$\rightarrow$iterate(cls: Class, result1 : Constraint = true $|$ result1 and cls.ownedInvariant$\rightarrow$iterate(inv: Constraint, result2 : Constraint = true$|$ result2 and inv)),\\
%let invs$'$: Constraint = SuperClasses(T$'$)$\rightarrow$iterate(cls: Class, result1 : Constraint = true$|$ result1 and  cls.ownedInvariant$\rightarrow$iterate(inv: Constraint, result2 : Constraint = true $|$ result2 and inv)),\\
%invs $\supseteq$ invs$'$\\

%{\em Note that {\em SuperClasses(T)} returns $T$ plus all super classes of $T$.
%$invs$ is the conjunction of the invariants defined in the context of $T$ and its super classes, and $invs'$ is the conjunction of the invariants defined in the context of $T'$ and its super classes.
%{\em Models(invs)} returns all models that satisfy $invs$.
%The clause {\em Models(invs) $\supseteq$ Models(invs$'$)} specifies that the models satisfying $invs$ must include the models satisfying $invs'$ (i.e., $invs$ are weaker than $invs'$).}\\

\item[2] \textbf{Pre-/post-conditions Match} is defined as follows:\\
$\forall$ op $\in$ T.ownedOperation, $\exists$ $S'$ $\in$ SuperClasses($T'$) such that $\exists$ $op'$ $\in$ $S'$.ownedOperation and:\\
	\begin{enumerate}
		\item[2.1]
		let op.ownedPrecondition = $\{$$pre_{1}$, $pre_{2}$, ..., $pre_{k}$ $\}$ be the pre-conditions defined for $op$;\\
		let pres = $pre_{1}$ $\wedge$ $pre_{2}$ $\wedge$ ... $\wedge$ $pre_{k}$;\\
		let op$'$.ownedPrecondition = $\{$$pre'_{1}$, $pre'_{2}$, ..., $pre'_{k}$ $\}$ be the pre-conditions defined for $op'$;\\
		let pres$'$ = $pre'_{1}$ $\wedge$ $pre'_{2}$ $\wedge$ ... $\wedge$ $pre'_{k}$;\\
		\\
		%\begin{algorithmic}
		%	\State let pres = true, pres$'$ = true,
		%	\For {each pre in op.ownedPrecondition}
		%		\State {pres = pres $\wedge$ pre}
		%	\EndFor
		%	\For {each pre$'$ in op$'$.ownedPrecondition}
		%		\State {pres$'$ = pres$'$ $\wedge$ pre$'$}
		%	\EndFor
		%	\State Models(pres$'$) $\supseteq$ Models(pres)
		%\end{algorithmic}

		%let pres$'$: Constraint = op$'$.ownedPrecondition$\rightarrow$iterate(pre: Constraint, result : Constraint = true $|$ result and pre), \\
		%let pres : Constraint = op.ownedPrecondition$\rightarrow$iterate(pre: Constraint, result : Constraint = true $|$ result and pre), \\
		%pres$'$ $\supseteq$ pres
		\item[2.2]
		let op.ownedPostcondition = $\{$$post_{1}$, $post_{2}$, ..., $post_{k}$ $\}$ be the post-conditions defined for $op$;\\
		let posts = $post_{1}$ $\wedge$ $post_{2}$ $\wedge$ ... $\wedge$ $post_{k}$;\\
		let op$'$.ownedPostcondition = $\{$$post'_{1}$, $post'_{2}$, ..., $post'_{k}$ $\}$ be the post-conditions defined for $op'$;\\
		let posts$'$ = $post'_{1}$ $\wedge$ $post'_{2}$ $\wedge$ ... $\wedge$ $post'_{k}$;\\
		\\
		The operation specifications of T and T$'$ match if Models(pres$'$) $\supseteq$ Models(pres) and Models(posts) $\supseteq$ Models(posts$'$)
		%\begin{algorithmic}
		%	\State let posts = true, posts$'$ = true,
		%	\For {each post in op.ownedPostcondition}
		%		\State {posts = posts $\wedge$ post}
		%	\EndFor
		%	\For {each post$'$ in op$'$.ownedPostcondition}
		%		\State {posts$'$ = posts$'$ $\wedge$ post$'$}
		%	\EndFor
		%	\State Models(posts) $\supseteq$ Models(posts$'$)
		%\end{algorithmic}

		%let posts$'$: Constraint = op$'$.ownedPostcondition$\rightarrow$iterate(post: Constraint, result : Constraint = true $|$ result and post),\\
		%let posts : Constraint = op.ownedPostcondition$\rightarrow$iterate(post: Constraint, result : Constraint = true $|$ result and post), \\
		%posts	$\supseteq$ posts$'$\\
		\end{enumerate}

%{\em Note that $pres$ is the conjunction of pre-conditions defined in the context of $op$, and $pres'$ is the conjunction of the pre-conditions defined in the context of $op'$. The models satisfying $pres'$ must include the models satisfying $pres$.
%$posts$ is the conjunction of post-conditions defined in the context of $op$, and $posts'$ is the conjunction of the post-conditions defined in the context of $op'$. The models satisfying $posts$ must include the models satisfying $posts'$.}

\end{enumerate}

\label{definition1}
\end{definition}

%The extended MOF class matching that enables contract-aware model substitutability can thus be used to determine the subtyping relation between two model types that include contracts .

\subsection{Analyzing the Matching of Contracts}\label{analyzingcontract}

Definition \ref{definition1} can be used to formally reason about the matching relation between two MOF classes with contracts.
The MOF class matching relation in Definition \ref{definition1} includes the matching of the contracts from classes of two model types.
Consequently, analyzing such relations requires one to formally analyze the relation between contracts (e.g., to check if the models satisfying one contract includes the models satisfying the other).
To do this, a query function $Models$($MT$, $C$) is used to compute all models that both conform to a model type $MT$ and satisfy an OCL contract $C$ defined in $MT$. %A contract can be an invariant, a pre-condition or a post-condition.
Thus given contract $C_1$ in a candidate supermodel type $MT_1$ and contract $C_2$ in a candidate sub model type $MT_2$, $C_1$ matches $C_2$ iff (1) $C_1$, $C_2$ are invariants, and $Models$($MT_1$, $C_1$) $\supseteq$ $Models$($MT_2$, $C_2$), (2) $C_1$, $C_2$ are pre-conditions, and $Models$($MT_2$, $C_2$) $\supseteq$ $Models$($MT_1$, $C_1$), and (3) $C_1$, $C_2$ are post-conditions, and $Models$($MT_1$, $C_1$) $\supseteq$ $Models$($MT_2$, $C_2$).

Checking the contract matching requires a tool to implement the functionality of the query function $Models$($MT$, $C$).
%For example, given a contract defined in a model type, a tool is needed to generate the models that both conform to the model type and satisfy the contract.
We use the Alloy Analyzer \cite{jackson2002alloy} for this purpose. The Alloy Analyzer is used to analyze Alloy specifications. It is supported by a SAT-based model finder.
The Alloy Analyzer can generate models that conform to a model type expressed in Alloy in terms of signatures and fields that specify the model type structure and a predicate that expresses the contracts.
In this paper we use the Alloy Analyzer at the back-end to check whether two contracts match.

For example, given a candidate supermodel type $MT_1$ and a candidate sub model type $MT_2$, with two OCL invariants respectively, $C_1$ and $C_2$, the procedure below can be used to check if $C_1$ matches $C_2$.

\begin{enumerate}
\item (preprocess) Since model subtyping requires each element in the supermodel type to be matched by an element in the sub model type (see Definition \ref{definition1}), the contract defined in the supermodel type refers to elements that also exist in the sub model type.
Thus we can move $C_1$ to $MT_2$, and use only the sub model type (i.e., $MT_2$) to check whether $C_1$ and $C_2$ match.
%move $C_1$ to $MT_2$, and check the relation between $C_1$ and $C_2$ in $MT_2$.
%Note that the procedure described in the paper uses only one model type to check the relation between $C_1$ and $C_2$.
%Note that it is difficult to check the relation between a contract in a super model type and a contract in a submodel type, since the contract in a submodel type may reference structural elements (e.g., MOF classes) that are not included by the super model type.

\item Transform $MT_2$ to an Alloy model using the technique described in \cite{sun2011rigorous}.
Convert $C_1$ and $C_2$ into two Alloy predicates, $P_1$ and $P_2$, respectively.

\item Run an empty predicate in the Alloy Analyzer to search for a model conforming to the model type $MT_2$.
If the Analyzer returns no model satisfying the empty predicate (i.e., $Models$($MT_2$, $\emptyset$) = $\emptyset$), $Models$($MT_2$, $C_1$) = $\emptyset$ and $Models$($MT_2$, $C_2$) = $\emptyset$. In this case $C_1$ matches $C_2$ since $\emptyset$ is a subset of $\emptyset$; otherwise, continue to the next step.

\item Run $P_1$ and $P_2$ respectively.
If the Alloy Analyzer returns no model for each predicate (i.e., $Models$($MT_2$, $C_1$) = $\emptyset$ and $Models$($MT_2$, $C_2$) = $\emptyset$), then $C_1$ matches $C_2$; if the Alloy Analyzer returns a model (or models) for only $P_1$, then $C_1$ matches $C_2$; if the Alloy Analyzer returns a model (or models) for only $P_2$, then $C_1$ does not match $C_2$; otherwise, continue to the next step.

\item Run a predicate to search for a model satisfying both $P_1$ and $P_2$.
If the Alloy Analyzer returns a model satisfying the predicate, continue to the next step; otherwise, $C_1$ does not match $C_2$.

\item Run a predicate $P_3$ to search for a model satisfying both $P_1$ and $\neg{P_2}$ (i.e., the negation of $P_2$), and another predicate $P_4$ to search for a model satisfying both $P_2$ and $\neg{P_1}$.
If the Alloy Analyzer returns no model for both $P_3$ and $P_4$ (i.e., $Models$($MT_2$, $C_1$) = $Models$($MT_2$, $C_2$)), $C_1$ matches $C_2$; if the Alloy Analyzer returns a model (or models) satisfying only $P_3$, $Models$($MT_2$, $C_1$) $\supset$ $Models$($MT_2$, $C_2$) and $C_1$ matches $C_2$;
%if the Alloy Analyzer returns a model (or models) satisfying only $P_4$, $Models$($MT_2$, $C_1$) $\subset$ $Models$($MT_2$, $C_2$) and $C_1$ does not match $C_2$;
otherwise, $C_1$ does not match $C_2$.
\end{enumerate}

%Note that Step 4, 5, and 6 of the above procedure can be skipped if we only check whether $C_1$ includes $C_2$.
%The Alloy keyword ``implies'' (i.e., use $P_2$ $implies$ $P_1$ to check if $C_2$ is included by $C_1$) can be directly used to infer whether $C_1$ includes $C_2$.
The approach uses the Alloy Analyzer at the back-end to analyze the relation between two contracts, and it thus requires a translation from OCL expressions to Alloy specifications.
The OCL to Alloy translation used in the prototype tool we developed is based on translation rules described in work by Bordbar et al. \cite{anastasakis2010challenges}.

\subsection{Contract Matching Checking Tool}\label{toolsupport}

\begin{figure}[!t]
%\centering
\hspace{-5ex}
\includegraphics[width=5.3in]{fig/ToolSupport.pdf}
\caption{Contract Matching Checking Tool Overview}
\label{fig:toolsupport}
\end{figure}

The contract matching approach described in the previous subsection has been implemented in a prototype tool.
Figure \ref{fig:toolsupport} shows an overview of the prototype tool.
It consists of an OCL parser, an Ecore\footnote{Ecore is an implementation aligned with MOF included in the Eclipse Modeling Framework \cite{steinberg2008emf}.}/OCL transformer and the use of the Alloy Analyzer.
The Ecore/OCL transformer is developed using Kermeta \cite{muller2005weaving}, an aspect-oriented metamodeling tool.
The inputs of the prototype are (1) an Ecore file that specifies two model types, and (2) a textual OCL file that specifies the contracts from each model type.
The model types and contracts are automatically transformed to an Alloy model consisting of signatures and predicates.

The prototype provides several interfaces to check contract matching.
For example, {\em matchInv(inv1: Constraint, inv2: Constraint)} is used to check whether $inv1$ matches $inv2$.
In addition, {\em matchInvs(cls1: Class, cls2: Class)} can be used to check whether the invariants defined in $cls1$ and the invariants defined in $cls2$ match.
%A relation query is transformed to an Alloy assertion that is added to the generated Alloy model.

%The prototype then uses the APIs provided by the Alloy Analyzer to pass the Alloy model to the Alloy SAT solver.
%The result returned by the Alloy SAT solver is interpreted by the prototype to get feedback on the relation between two contracts. This relation is then used to check a declared subtyping relation between two model types.

\subsection{Case Study}\label{casestudy}

In this section we illustrate how to use our approach to define model types and subtyping relations between them to ensure a safe reuse of model transformations.

\subsubsection{A Simple Case Study of Structural Substitutability}

\begin{figure}[!t]
\centering
\includegraphics[width=4.8in]{fig/CaseStudy1.jpg}
\caption{A Simple Example of Structural Substitutability in Kermeta}
\label{fig:casestudy1}
\end{figure}

Let us reconsider the scheduling example described in Section \ref{structuralexample}.
A model transformation performs a static scheduling on an acyclic dependence graph.
The model transformation needs a metamodel for ``Acyclic Graph'' (due to space limitation, the metamodel is not shown in the paper).
The model type $AcyclicGraph$ (see Figure \ref{fig:casestudy1}) shows a simple example of model type definition for the dependency graph used in the example.
Its definition consists of metaclasses that specify a graph structure, an invariant that specifies the acyclicity property, and a model transformation that takes as input an acyclic graph.

Suppose that in another context a colored graph is used as an intermediate representation and it extends the concept of nodes by introducing additional information.
To reuse the transformation defined in $AcyclicGraph$, a colored graph must be a subtype of $AcyclicGraph$.
The model type $ColoredAcyclicGraph$ ensues the subtyping relation by adding an acyclicity invariant in its definition. However, the model type $ColoredGraph$ does not specify any invariants.
A compilation error will thus show that the $transfo$ operation cannot take as input an instance of $ColoredGraph$ because $ColoredGraph$ is not a subtype of $AcyclicGraph$.

\subsubsection{A Simple Case Study of Behavioral Substitutability}

\begin{figure}[!t]
\centering
\includegraphics[width=4.8in]{fig/CaseStudy2.jpg}
\caption{A Simple Example of Behavioral Substitutability in Kermeta}
\label{fig:casestudy2}
\end{figure}

In the optimizing compiler community, the daily task for software engineers is to design compilation chains in the right partial order, that is, scheduling the various passes (i.e., optimization, translation, code generation, analysis, etc.).
Designing compilation chains would benefit from behavioral substitutability by opening the way to describe ``abstract'' compilation chains, capitalizing a given knowledge in terms of constraints (pre-/post-conditions) to schedule a set of passes for a given purpose, where each pass would be then implemented in various ways, but conforming to the pre-/post-conditions defined in the abstract compilation chain.

Figure \ref{fig:casestudy2} shows a simple example of model types used for the compilation chain.
Suppose that the abstract model transformation $\mathit{transfo}$ defined in $MT$ is used for optimization purpose and define a post condition stating that the model must conform to the Static Single Assignment (SSA) form. $MT$ also contains $\mathit{transfo2}$ as the next pass of the compilation chain and states as precondition that the model must conform to the SSA form.
The two model types $subMT1$ and $subMT2$ implement the model transformation $\mathit{transfo}$ but only $subMT1$ ensures as postcondition the SSA form. While $subMT2$ is not in this case a sub model type to $MT$, a compilation error for $m2.$$\mathit{transfo}().$$\mathit{transfo}2()$ will be returned. This shows that the model returned by $\mathit{transfo}$ in $subMT2$ (typed by $subMT2$) is not of type $MT$, and can not reuse $\mathit{transfo2}$.


\documentclass[a4paper]{article}
%\usepackage{html}
\usepackage[dvips]{graphics,color,epsfig}
\usepackage{path}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{psfrag}
\newcommand{\N}{\ensuremath{\mathbb{N}}}
\newcommand{\F}{\ensuremath{\mathbb{F}}}
\newcommand{\Z}{\ensuremath{\mathbb{Z}}}
\newcommand{\R}{\ensuremath{\mathbb{R}}}
\newcommand{\Q}{\ensuremath{\mathbb{Q}}}
\newcommand{\C}{\ensuremath{\mathbb{C}}}

\newtheorem{lemma}{Lemma}
\newtheorem{assumption}{Assumption}
\newtheorem{definition}{Definition}

\title{Test\_suite\_QP\_solver}
\author{Frans Wessendorp}
\begin{document}
\maketitle
\section{Validity check}
All of the validity checks of a solution computed by the solver are done using
the complete set of constraints; since the solver itself works with an active
set method and therefore uses the reduced basis matrix $\check{M}_{B}$
and its inverse we here restate the relationship given in \cite{Frans_Deg}.
If the basis heading is given as
$\left[C, S_{B}, B_{O}, B_{S} \right]$ the basis matrix
$M_{B}$ has the following form
\begin{equation}
\label{def:basis_matrix}
M_{B}:=
\left(\begin{array}{c|c|c|c}
        0 & 0 & A_{C, B_{O}} & 0 \\
        \hline
	0 & 0 & A_{S_{B}, B_{O}} & A_{S_{B}, B_{S}} \\
	\hline
        A_{C, B_{O}}^{T} & A_{S_{B}, B_{O}}^{T} & D_{B_{O}, B_{O}}
	  & 0 \\
        \hline
        0 & A_{S_{B}, B_{S}}^{T} & 0
	  & 0 \\
      \end{array}
\right).
\end{equation}
and the inverse $M_{B}^{-1}$ in terms of the reduced basis inverse
$\check{M}_{B}^{-1}$
\begin{equation}
\label{eq:M_B_inv_exp}
M_{B}^{-1}=
\left(\begin{array}{c|c|c|c}
        \left(\check{M}_{B}^{-1}\right)_{C,C} &
	0 &
	\left(\check{M}_{B}^{-1}\right)_{C,B_{O}} &
	 \left(\check{M}_{B}^{-1}\right)_{C, B_{O}}\alpha^{T} \\
	\hline
	0 &
	0 &
	0 &
	A_{S_{B},B_{S}} \\
	\hline
	\left(\check{M}_{B}^{-1}\right)_{B_{O}, C} &
	0 &
	\left(\check{M}_{B}^{-1}\right)_{B_{O}, B_{O}} &
          \left(\check{M}_{B}^{-1}\right)_{B_{O},B_{O}}\alpha^{T} \\
	\hline
	\alpha\left(\check{M}_{B}^{-1}\right)_{B_{O},
	C} &
	A_{S_{B}, B_{S}}^{T} &
	\alpha\left(\check{M}_{B}^{-1}\right)_{B_{O},
	B_{O}} &
	\alpha\left(\check{M}_{B}^{-1}\right)_{B_{O}, B_{O}}\alpha^{T}
      \end{array}
\right)
\end{equation}

\subsection{Verifying Feasibility}
\subsection{Verifying Optimality}
\subsection{Verifying Unboundedness}
Since the solver delivers, in case of unboundedness, implicitly a feasible
solution $x^{*}$ and a vector
$w$ such that
\begin{equation}
\label{eq:Unboundedness}
x^{*}-tw \quad \text{for} \quad t>0
\end{equation}
is a feasible solution
we by convention define the single nonzero nonbasic component of the basic
feasible direction $w$ to be negative:
\begin{eqnarray}
\label{def:w_B}
w_{B}&:=&q_{B}=\left(M_{B}^{-1}\right)_{B_{O} \cup B_{S}, \bullet}
\left(
\begin{array}{c}
A_{C,j} \\
\hline
A_{S_{B}, j} \\
\hline
2D_{B_{O}, j} \\
\hline
2D_{B_{S}, j}
\end{array}
\right) \\
\label{def:w_N}
w_{N}&:=&-e_{\{j\}}
\end{eqnarray}
where $j \in N$ and $e_{\{j\}}$ denotes the unit vector with $\left|N\right|$
entries.

Feasibility of the solution in Equation~(\ref{eq:Unboundedness}) requires
$w <0$ and $Aw=0$. That the latter is true for $w$ defined by
Equations~(\ref{def:w_B}) and~(\ref{def:w_N}) shows the following computation
where we use the
Definitions~(\ref{def:basis_matrix}) and~(\ref{eq:M_B_inv_exp})
\begin{eqnarray}
Aw
&=&
A_{C \cup S_{B}, B_{O} \cup B_{S}}
\left(M_{B}^{-1}\right)_{B_{O} \cup B_{S}, \bullet}
\left(
\begin{array}{c}
A_{C,j} \\
\hline
A_{S_{B}, j} \\
\hline
2D_{B_{O}, j} \\
\hline
0
\end{array}
\right)
-A_{C \cup S_{B}, j}
\nonumber \\
&=&
\left(M_{B}\right)_{C \cup S_{B}, B_{O} \cup B_{S}}
\left(M_{B}^{-1}\right)_{B_{O} \cup B_{S}, \bullet}
\left(
\begin{array}{c}
A_{C,j} \\
\hline
A_{S_{B}, j} \\
\hline
2D_{B_{O}, j} \\
\hline
0
\end{array}
\right)
-A_{C \cup S_{B}, j}
\nonumber \\
&=&
\left(M_{B}\right)_{C \cup S_{B}, \bullet}
M_{B}^{-1}
\left(
\begin{array}{c}
A_{C,j} \\
\hline
A_{S_{B}, j} \\
\hline
2D_{B_{O}, j} \\
\hline
0
\end{array}
\right)
-A_{C \cup S_{B}, j}
\nonumber \\
&=&
\left[
  I_{C\cup S_{B},C\cup S_{B}} \left|\right.
  \mathbf{0}_{C\cup S_{B},B_{O}\cup B_{S}}
\right]
\left(
\begin{array}{c}
A_{C,j} \\
\hline
A_{S_{B}, j} \\
\hline
2D_{B_{O}, j} \\
\hline
0
\end{array}
\right)
-A_{C \cup S_{B}, j}
\nonumber \\
&=&
0
\end{eqnarray}

\subsubsection{Linear Case}
We are minimizing the objective function
\begin{equation}
f\left(x\right):=c^{T}x,
\end{equation}
so for $t>0$
\begin{eqnarray}
f(x^{*}-tw)
&=&
c^{T}\left(x^{*}-tw\right)
\nonumber \\
&=&
f\left(x^{*}\right) -tc^{T}w
\end{eqnarray}
Since we are minimizing we must require $c^{T}w>0$.
Subsuming we obtain together with the above the necessary conditions for
unboundedness.
\begin{enumerate}
\item $w_{x_{i}} \leq 0$ for $i \in B_{O} \cup B_{S}$
\item $Aw=0$
\item $c^{T}w>0$
\end{enumerate}

\subsubsection{Quadratic Case}
We are minimizing the objective function
\begin{equation}
f\left(x\right):=c^{T}x+x^{T}Dx,
\end{equation}
using the symmetry of $D$ we obtain for $t>0$
\begin{eqnarray}
f(x^{*}-tw)
&=&
c^{T}\left(x^{*}-tw\right)
 +\left(x^{*}-tw\right)^{T}D\left(x^{*}-tw\right)
\nonumber \\
&=&
c^{T}x^{*} - tc^{T}w + {x^{*}}^{T}Dx^{*} - tw^{T}Dx^{*}-t{x^{*}}^{T}Dw
 +t^{2}w^{T}Dw
\nonumber \\
&=&
c^{T}x^{*} + {x^{*}}^{T}Dx^{*} + t^{2}w^{T}Dw
 -t\left[\left(c^{T}+2{x^{*}}^{T}D\right)w\right]
\nonumber \\
&=&
f\left(x^{*}\right) + t^{2}w^{T}Dw
 -t\left[\left(c^{T}+2{x^{*}}^{T}D\right)w\right]
\end{eqnarray}
Since $D$ is positive semidefinite $w^{T}Dw \geq 0$ and since we are minimizing
we must require $w^{T}Dw=0$ and $\left(c^{T}+2{x^{*}}^{T}D\right)w>0$.
Subsuming we obtain together with the above the necessary conditions for
unboundedness.
\begin{enumerate}
\item $w_{x_{i}} \leq 0$ for $i \in B_{O} \cup B_{S}$
\item $Aw=0$
\item $w^{T}Dw = 0$
\item $\left(c^{T}+2{x^{*}}^{T}D\right)w>0$
\end{enumerate}
\begin{thebibliography}{99}
\bibitem{Sven} Sven Sch\"{o}nherr. Quadratic Programming in Geometric Optimization:
Theory, Implementation, and Applications, Dissertation, Diss. ETH No 14738, ETH
Z\"{u}rich, Institute of Theoretical Computer Science, 2002.
\bibitem{Chvatal} Va\v{s}ek Chv\'{a}tal. \textit{Linear Programming}. W. H. Freeman and Company,
New York, Chapter 8, 1983
\bibitem{Frans_Deg} Degeneracy
\end{thebibliography}
\end{document}


%---------------------------------------------------------------------
%  Writeup of the improved search of Run II data for single top quark
%  production at DZero.
%  Started: Oct 2006
%  Authors: The Single Top Working Group
%---------------------------------------------------------------------
%

\appendix
\section*{Appendix 10 --- Measure of Significance}
\label{appendix-significance}

The term ``significance'' has different definitions depending on our
goal. If the goal is to define the single top signal significance,
then an appropriate definition would be the ratio of the signal cross
section at the peak of the posterior probability density to the width
of the posterior, as defined in Appendix~9, which is inversely
proportional to the uncertainty on the cross section measurement.

However, if the goal is to define the significance of excess in data
over background, then one possible definition is the
p-value~\cite{Fisher}. For Poisson data, the p-value is the
probability to get a count equal to or greater than the count
observed, assuming that the count is due to background only. The
background hypothesis, in this context, is the {\em null hypothesis},
that is, the hypothesis we seek to reject. Fisher, who invented it,
saw the p-value as a measure of evidence against the null. If the
p-value is sufficiently small one may well consider rejecting the null
in favor of the hypothesis that something other than background is
present. Therefore a significantly small p-value would indicate how
``significant'' enough the excess of events over background is, to
claim a discovery.

%The p-value is a well-defined statistical quantity in the so-called
%frequentist approach. However, it can be computed only if the null
%hypothesis (in this case, the background) can be stated precisely. In
%order to take into account the uncertainties in our background
%estimation, one defines a hybrid approach by doing a Bayesian
%integration over the background prior. Details of the implementation
%of the p-value with background uncertainties, and using spectral
%distributions can be found in~\cite{d0note5258}.

%There are many ways to define ``a'' p-value.
%\begin{itemize}
%\item In a purely frequentist approach, we can generate fake
%data-sets with no signal and re-run the whole analysis obtaining a
%result for each one of these ``ensembles''. The number of ensembles
%that yield a result equal to the observed or higher, divided by the
%total number of ensembles is the p-value.
%\item A hybrid method that starts from the background estimate and
%takes the uncertainties in to account by integrating over the
%background prior, as described in ~\cite{d0note5258}.
%\item Another commonly used method in the field is the modifed
%frequentist approach.
%\end{itemize}

We can generate multiple pseudo-datasets containing only background
events and run them through the analysis exactly as if they were the
real data events, and obtain a cross section from each one of
them. The p-value can then be calculated as the number of these
ensembles that yield a result equal to the observed or higher, divided
by the total number of ensembles.

To generate these ensembles, we use background events from our model
and treat the fluctuations of each background source separately. We
draw random events from each background source separately, as
indicated by the allowed variation due to systematic and statistical
uncertainties. The event weights are taken into account such that
events with a higher weight will be more likely to be picked. The
variance of the background events is large: we start from 1.34M
electron events and 1.28M muon events, then only consider the two
thirds of these that have not been used in the discriminant
training. The nominal background yields are 755 electron events and
643 muon events. Thus, each ensemble is generated picking around 700
events from around 850,000. The source of background most affected by
oversampling is multijets, since some channels contain very few events
that will be picked repeatedly. Given that the multijet background is
very small and the statistical errors dominate, this does not
introduce a large bias.

The ensemble generation includes a flat (i.e., normalization only, not
shape changing) 20\% error for the {\ttbar} yield ($N_{\ttbar}$),
which represents approximately the overall yield uncertainty from all
systematic effects combined (see Appendix~6). The shift in the
{\ttbar} yield:
$$
N_{\ttbar}^{\prime}
= N_{\ttbar}\times {\rm Gaussian}({\rm mean=1},{\rm width=0.2})
$$
is the same for electrons and muons. The treatment of the $W$+jets and
multijet backgrounds accounts for the normalization to data from the
matrix method and for the effect of $b$-tagging. The error from the
matrix method normalization of $W$+jets and multijet events is
incorporated in the ensemble generation by letting each sample
(multijets, $Wc\bar{c}$, $Wb\bar{b}$ and $Wjj$) fluctuate with a
different random number $r$ sampled from a Gaussian distribution:
\begin{eqnarray*}
r_{\rm QCD} = {\rm Gaussian}(1,0.2) \\
r_{Wjj}     = {\rm Gaussian}(1,0.2) \\
r_{Wbb}     = {\rm Gaussian}(1,0.2) \\
r_{Wcc}     = {\rm Gaussian}(1,0.2)
\end{eqnarray*}

The background sum of $W$+jets and multijets yields $N_{\rm WQCD}$ is
fluctuated to become $N_{\rm WQCD}^{\prime}$:
\begin{eqnarray*}
N_{\rm WQCD}          &=& N_{\rm QCD} + N_{Wjj} + N_{Wbb} + N_{Wcc} \\
N_{\rm WQCD}^{\prime} &=& r_{\rm QCD}\times N_{\rm QCD}
                        + r_{Wjj}    \times N_{Wjj}
                        + r_{Wbb}    \times N_{Wbb}
                        + r_{Wcc}    \times N_{Wcc}
\end{eqnarray*}
These two expressions fix the normalization to data. What is changed
here is the composition of each of the subcomponents. Once the
correlation between multijets and $W$+jets is taken care of, we also
need to take into account the effect of $b$-tagging. We split the
summed samples of $W$+jets and multijets into 1-tag and 2-tags
sets. The average uncertainty on these samples is 5\% and 12\%
respectively (see Appendix~6), so we form a scale factor $S^{\rm
tag}_{\rm WQCD}$ that incorporates the different rates for tagging
single- and double-tagged events in these samples:
\begin{eqnarray*}
r_{\rm 1tag} &=& {\rm Gaussian}(1,0.05) \\
r_{\rm 2tag} &=& {\rm Gaussian}(1,0.12) \\
S^{\rm tag}_{\rm WQCD}
             &=& \frac{r_{\rm 1tag} \times N^{\rm 1tag}_{\rm WQCD}
                    +  r_{\rm 2tag} \times N^{\rm 2tag}_{\rm WQCD}}
                {N^{\rm 1tag}_{\rm WQCD} + N^{\rm 2tag}_{\rm WQCD}}
\end{eqnarray*}

Finally, the multijets and $W$+jets event yields are fluctuated to:
$$
N_{i}^{\prime} = r_{i} \times \frac{N_{\rm WQCD}}
                                   {N_{\rm WQCD}^{\prime}}
                       \times S_{\rm tag}^{\rm WQCD}
                       \times N_{i} ~;~ i = {\rm QCD}, Wjj, Wbb, Wcc
$$

Once each background source has been fluctuated, we randomly pick
events based on a Poisson distribution of the new systematics-shifted
total background sum:
$$
N_{\rm Data}^{\prime} = N_{\rm QCD}^{\prime}
                      + N_{Wjj}^{\prime}
                      + N_{Wbb}^{\prime}
                      + N_{Wcc}^{\prime}
                      + N_{\ttbar}^{\prime}
$$

We have generated about 60,000 ensembles of pseudo-data with this
method that we use to measure the signifince or p-value of our search.