\chapter{Event Simulation}
	\label{chapter_event_simulation}
	The calculations presented in chapter \label{chapter_nlo_calc} represent jets of partons, while the data which were collected represent jets of hadrons.  In order to compare these, we must translate the predictions of partons onto predictions for hadrons.  Moreover, the data as immediately taken from the readout includes detector specific effects which we must correct for in order to compare our data with predictions, or with other experiments.  In order to accomplish these two goals, Leading Order {\MC} (MC) simulations were employed.  The MC used here simulates individual  events in the ZEUS detector in several steps.  

	For each event, points in a predetermined phase space are selected,  and leading order electron-quark matrix elements are combined with a PDF parameterization to produce a list of partons for the event.  This is referred to as the hard scatter, and the information about this list of exiting partons is said to describe the event at the {\it parton level}.  Then, a phenomenological model is employed to approximate hadronization for the partons, and the resulting list of hadrons is said to describe the event at the {\it hadron level}.  Lastly, a complete simulation of the detector, including material interactions, magnetic fields, detector components, trigger, and data readout is used to simulate how the detector would respond to each event.  The information produced by the detector simulation is of the same structure as the data taken from the actual detector, and is analyzed  in the same way.  This information is said to describe the event at the {\it detector level}.  

\section{PDF and Hard Scatter}
	\label{section_MC_hard_scatter}
	The incoming state of the simulated event is an electron and proton, which will interact via the protons partons.  Which flavor parton will interact, and the $x$ and $Q^2$ values of the interaction is determined by the proton PDFs and a pseudorandom number generator\footnote{A pseudorandom number generator is a deterministic algorithm for the production of numerical sequences which satisfy some statistical tests of randomness, such as uniform frequency and distribution of the numbers produced.}.  The PDFs used in the {\MC} were the CTEQ5D pdfs described in section~\ref{section_pdfs_specific}.
	The relative probability of processes were computed to leading order, which were stored in tables for efficient recall.  Pseudorandom numbers are generated select from these processes.  This component represents the hard scatter, after which the event contains an outgoing neutrino, one or two outgoing quarks or one gluon. and the proton remnant.  The available outgoing states in the {\MC} used in this analysis are depicted by the Feynman diagrams shown in section~\ref{section_mepjet}.  All {\MC} presented in this thesis used unpolarized matrix elements.

\section{Parton Cascade}
	\label{section_parton_cascade}
	As described in section~\ref{section_color_confinement}, quarks and gluons are not observed in the detector, but instead undergo QCD radiation and hadronization.   QCD radiation of hard-scatter partons is also called parton showering, and is an intrinsically non-perturbative process due to the low scales involved.  Two methods of simulating a parton cascade will be considered here:  Matrix-Element plus Parton Shower (MEPS) ~\cite{proc:hera:1987:149}, and the Color Dipole Model (CDM) ~\cite{np:b306:746}. 
	The MEPS approach generates parton showers from the DGLAP splitting functions.  Partons become less virtual as they radiate and split until a predetermined virtuality is reached, typically on the order of $1~\GeV$.  This is represented in figure ~\ref{figure_meps}.  Because the parton shower uses the DGLAP evolution equations, radiation is ordered strongly in decreasing $k_T$ and increasing proton fractional momenta.   {\MC} samples generated by the LEPTO~6.5 program~\cite{cpc:101:108} {\MC} presented in this thesis employ MEPS as implimented via \textsc{Jetset}~7.4~\cite{proc:hera:1987:149, manual:cern-th-7112/93}.
\begin{figure}
	\begin{center}
		\includegraphics[draft=false, width=.5\textwidth]{/home/hwolfe/thesis/figures//event_simulation/meps}
	\end{center}
		\caption[Schematic of MEPS]{
			\fixspacing{Schematic of MEPS}
		}
	\label{figure_meps}
\end{figure}

	CDM describes the proton remnant and its dissociated parton as a color dipole.  As the parton and remnant separate, the dipole energy increases until sufficient energy is reached to radiate a gluon, which bifurcates the dipole.  The two halves continue to stretch and split as more gluons are emitted.  Unlike MEPS, CDM does not order its radiation in $k_T$.  Samples of ARIADNE 4.08 ~\cite{cpc:71:15} MC presented in this thesis employ CDM. This is represented in figure ~\ref{figure_cdm}.  
	% at some point, all gluons are split into quarks.  when is that?


\begin{figure}
	\begin{center}
		\includegraphics[draft=false, width=.5\textwidth]{/home/hwolfe/thesis/figures//event_simulation/cdm}
	\end{center}
		\caption[Schematic of CDM]{
			\fixspacing{Schematic of CDM}
		}
	\label{figure_cdm}
\end{figure}

\section{Hadronization}
	Free partons are never observed due to color confinement, so the partons simulated during the cascade phase discussed in section~\ref{section_parton_cascade} must be converted into color singlet hadrons in order to describe physical data.  This process is referred to as hadronization.  Because it describes confinement, at scales of ($\mu \lesssim 1~\GeV$ ) where $\alphas$ is large, it necessarily cannot be described by perturbative QCD.  Several hadronization models are currently implimented in MC models, but only the Lund String Model~\cite{prep:97:31} is used in the MC results presented in this thesis.  

	In the Lund String Model, the color field between a $q\bar{q}$ pair is represented as a linear potential, described as a flux-tube or string of gluons.  Spatial stretching of this string results in a potential energy of $~\approx~1~\GeV /\fm$.  If the initial $q\bar{q}$ pair separate sufficiently the color field will contain enough potential energy to produce a new $q\bar{q}$ pair.  This is described in the model as occurring between the initial $q\bar{q}$ pair, as if the string had been cut.  
	%The flavors of the new $q\bar{q}$ pairs are chosen are ratios of approximately $u:d:s:c\approx 1:1:0.3:10^{-112}$, with the ratio $u:s$ being tuned to agree with LEP data .  
	This mechanism produces quarks with an approximately gaussian $p_T$ spectrum.  This process continues until some preset cutoff, when the $q\bar{q}$ pairs have small enough relative kinetic energy to be considered on-shell hadrons.  Groups of 2 and 3 quarks are then chosen to form mesons and hadrons.
\section{Description of Initial- and Final-State QED Radiation}
	\label{section_isr_fsr}
\begin{figure}
	\begin{center}
		\includegraphics[draft=false, width=.7\textwidth]{/home/hwolfe/thesis/figures//event_simulation/isr-fsr}
	\end{center}
		\caption[Feynman Diagrams for Higher Order QED Effects]{
			\fixspacing{Feynman Diagrams for Higher Order QED Effects}
		}
	\label{figure_isr_fsr}
\end{figure}
	While MC models can generate interactions at fixed electron and proton energies.  HERA data were produced with a broader kinematic spectrum, however, because of radiation of photons immediately before and after the hard interaction, as shown in figure ~\ref{figure_isr_fsr}.  This type of process is referred to as initial- and final-state radiation (ISR/FSR).  For this analysis, the MC implimentations used for event simulation were interfaced with the $\textsc{Heracles}$~4.6.1~\cite{cpc:69:155} program via $\textsc{Django}$~v1.3~\cite{cpc:81:381}.  The $\textsc{Heracles}$ program includes QED effects up to $\mathcal{O}(\alphaem^2)$.  The physical parameters used to compute QED effects were identical as those used for the pQCD calculations, stated in section~\ref{section_mepjet}.

\section{Detector and Trigger Simulation}
	\label{section_detector_trigger_reconstruction}
	Once an event has been simulated to produce real particles with definite momenta, these particles are used as input into a full detector simulation.  This simulation includes potential decays of short lived particles, the interactions with the active and passive materials in the detector, and the response of the electronics at all levels in the data-taking and reconstruction chain.   Information for the modeling of the detector response comes from test-beam data, and the simulation is referred to as the {\it {\MC} for ZEUS Analysis, Reconstruction and Trigger} (MOZART v2005a.1), which is based on $\textsc{GEANT}$~v3.21\cite{tech:cern-dd-ee-84-1}.

	The trigger simulation, called Complete ZGANA\footnote{The ZEUS GEANT Analysis (ZGANA v1.5) and TLT\_ZGANA are simulations of the ZEUS 1st+2nd and 3rd trigger systems, respectively.  CZAR is the combination of the two, encompassing the complete trigger chain.} Analysis Routine (CZAR v2005b.2) provides complete description of the ZEUS trigger system response to simulated events.  The output of MOZART and CZAR is an ADOMO table of detector signals which is organized similarly to data from the ZEUS detector.  The principle difference from real data is the additional information about the generator, parton, and hadronic portions of the simulation.  These ADOMO tables were then submitted to the ZEPHYR program discussed in the beginning of chapter \ref{chapter_event_reconstruction}, and were reconstructed  identically as the data were.  This type of information is referred to as being at the {\it detector level}.
