\chapter{Event Reconstruction}
	\label{chapter_event_reconstruction}
	Events from the ZEUS detector which passed the FLT, SLT and TLT  triggers were written to tape for storage and later analysis.  Reconstruction of events begins with the EVB (see section \ref{section_SLT}.) which combined all detector signals from the event into a single ADAMO table entry.  Entries were then processed by the ZEPHYR program, which used calibration constant tables for each component and each run to interpret detector signals as energies, times, and positions.  Offline analysis in this work was performed using the ORANGE (Overlying Routine or Analysis Ntuple GEneration) software framework, which is based on EAZE (Effortless Analysis of ZEUS Events).  ORANGE and EAZE provide routines which retrieve data records, perform specialized and modifiable reconstruction of event variables, integrate the CERN libraries, and perform basic event selections.
\section{Track and Vertex Reconstruction}
	While the nominal interaction point for $ep$ interactions is at the origin of the ZEUS coordinate system, finite dimensions of the beam bunches caused real interactions to occur with a spread in all three dimensions.  Information from the tracking components of the ZEUS detector were used to reconstruct the tracks of individual charged particles and estimate the location of the initial $ep$ interaction.  This is performed using the VCTRACK~\cite{zn:98:58} program.  The VCTRACK package uses information from all tracking detectors, with primary information coming from the CTD.  Track finding begins with CTD seeds, each of which contains three neighboring hits in the outermost axial superlayers of the CTD.  Each seed is extrapolated iteratively towards the inner superlayers, aided by a \lq\lq virtual hit" which is fixed to the beam line.  As hits are added to the tracks, trajectory parameters of each track are recalculated with each iteration.  Tracks that share 15\% or more of their hits with other tracks at any stage are removed.  An initial estimate of the $z$-position of each hit from the $z$-by-timing information is used, which is later refined using stereo superlayer hits.	The next step of reconstruction proceeds by extrapolating the innermost hit of each track outward. Fitted tracks are then used as input to an algorithm which tests candidate primary and secondary vertices.  Vertices are then chosen based on a $\chi^2$ minimization routine, and tracks matched to the primary vertex are then refitted using the primary vertex as a starting point.  For all events in the study, the $x$ and $y$ vertex positions were set to 0 after track fitting and electron finding, which is described in section \ref{section_electron_finding}.  
\section{Calorimeter Reconstruction}
	\label{section_cal_reconstruction}
	Information from the ZEUS calorimeter was used to reconstruct the energies and positions of particles.  Each cell provides pulse amplitude and timing information from two PMTs, which are compared to ensure accuracy and provide improvements in position reconstruction.  Several sources of uncertainty enter the calorimeter reconstruction.  These include noise from uranium absorber decays, noise from readout electronics and PMT discharges, which occurred when the high voltage from a PMT base discharged spontaneously to the encasement.   The behavior of each PMT was monitored during operation and calibrations to ensure proper functioning, PMTs listed in a table of unreliable PMTs for each run were ignored during reconstruction.  To suppress uranium radiation in reconstruction, EMC cells with $E < 80$~MeV and HAC cells with $E < 140$~MeV were neglected.  To suppress PMT discharge signals, cells were ignored if the imbalance between left and right PMTs, $I_{\mbox{cell}} = \left|\left(E_{\mbox{L}}-E_{\mbox{R}}\right)/\left(E_{\mbox{L}}+E_{\mbox{R}}\right)\right|> 0.7$, and that cell had an average energy greater than $700\MeV$.  Cell selection was performed in this analysis by the ZEUS Noise04s routine.  

	Simulations of the energy response of the CAL differ from that of the true response~\cite{zn:96:104}.  While this could be corrected by adjusting the energy values of the simulation, historically this is performed by altering the final CAL cell energies in the ZEUS data.  For each FEMC cell, the energy was multiplied by a factor of 1.024.  The same procedure was performed using factors of 0.941 for FHAC, 1.053 for BEMC, 1.096 for BHAC, and 1.022 for all RCAL cells.  No adjustment to calorimeter cell values was applied to {\MC} events.

\section{Electron Reconstruction}
	\label{section_electron_finding}
	A major source of background to CC DIS is NC DIS, which has a principle signal as an isolated electron deposit located in the calorimeter.  In order to reject events arising from NC interactions, the electron finder {\SINISTRA}95~\cite{Abramowicz:1995zi} was applied to all events.  \SINISTRA~is a neural network which has been trained on simulated low-$Q^2$ NC DIS data to produce the best separation between electromagnetic and hadronic energy deposits by using the properties of shower profiles to establish the characteristics of the initiating particle.  

	Scattered particles such as single electrons often deposit their energy into more than one calorimeter cell, and often in ways which involve cells in both the BCAL and RCAL.  Before input into \SINISTRA, groups of calorimeter cells called {\it islands}~\cite{Abramowicz:1995zi} were formed, where each island is a potential deposit from an electron.  The 17 inputs to the neural network were the total energy of the cells in the island, and 16 showering profile parameters called Zernike moments and Legendre functions.  The output of \SINISTRA~is a real number between 0 and 1, which is interpreted as a likelihood that the island in question resulted from an isolated electron.  Clusters with \SINISTRA~output near one are considered to be electron-like.   In this analysis, only the candidate with greatest \SINISTRA~likelihood was considered, and events were only considered to have a candidate if the likelihood was greater than 0.9.  The reconstructed energy of an electron candidate was the sum of the cell energies in its island, and the position of the candidate was determined from the energy weighted island center.  For candidates with likelihood greater than 0.9 and energy greater than $10\GeV$, \SINISTRA~was estimated to have 80\% purity and nearly 100\% efficiency~\cite{thesis:wodarczyk:1999}.  
%\section{Hadronic Quantities}
	
\section{Kinematic Reconstruction}
	Basic kinematic quantities were reconstructed from the calorimeter energy deposits, which were treated as massless particles.
\begin{eqnarray}
	\mbox{Total energy} & : & E\subcal = \sum_{i} E_i\\
	\mbox{Longitudinal momentum in the CAL} & : & p_z = \sum_{i} p_{z,i}\\
	\mbox{Transverse momentum in the CAL} & : & p_{T,\mbox{\small CAL}} = \sqrt{\left(\sum_{i} p_{x,i}\right)^2+\left(\sum_{i} p_{y,i}\right)^2}\\
	\mbox{Cosine of hadronic system angle} & : & cos \gamma_h = \frac{p_T^2-(E-p_z)^2}{p_T^2+(E-p_z)^2}
\end{eqnarray}
	In charged current interactions at ZEUS, the exiting neutrino escapes detection, requiring kinematic quantities to be reconstructed from the hadronic system alone.  To prevent bias in our estimation of these values due to particles which escape detection down the beam pipe, the Jaquet-Blondel method~\cite{ref_jaq_blondel} of reconstruction was used.  This method relies only on the transverse momenta, $p_{T}$ and difference in energy and $z$-component momenta, $E-p_z$ of each particle, which are small for particles scattered near the beamline.  The reconstructed values of  $Q^2$, $x$, and $y$ are:
\begin{eqnarray}
	{\yjb}\subcal & = & \frac{E-p_z}{2E_e}\nonumber\\
	{\qsqjb}\subcal & = & \frac{p_{T,\mbox{CAL}}}{1-{\yjb}\subcal}\nonumber\\
	{\xjb}\subcal & = & \frac{p_T}{s{\yjb}\subcal(1-{\yjb}\subcal)}.
	\label{equation_jaquet_blondel}
\end{eqnarray}

% \section{Dead Material and Transverse Energy Corrections}
% 	\label{section_dead_material_transv_energy}
% 	In NC DIS, an ideal calorimeter would report zero transverse momentum, and equal transverse energy for the electron and the hadronic system.  Alternative methods for measuring $y$ from the electron and $\yjb$ would also be equal.  To improve the description of the data by the simulation, a sample of NC DIS events was selected and the hadronic-electromagnetic response was compared to  simulation.  Linear correction functions in bins of $\gamma_h$ were applied to $p_{T,\mbox{CAL}}$ and ${\yjb}\subcal$.  	The corrected values of $p_{T,\mbox{CAL}}$ and ${\yjb}\subcal$ were used to reconstruct ${\qsqjb}\subcal$ and ${\xjb}\subcal$. 
% 
% 	The Interior of ZEUS detector contained several components which are not designed to detect particles, such as the beam pipe and solenoid.  As particles traversed these objects, they lost energy which is not recorded, smearing the aforementioned estimators in a way which is difficult to directly measure.  To reconstruct the kinematic variables of hadrons for the event, simulations were used to predict linear correction functions.  Functions chosen in bins of $\gamma_h$ and $p_{T,\mbox{CAL}}$ were applied to $p_{T,\mbox{CAL}}$.  Functions in bins of $\gamma_h$ and ${\yjb}\subcal$ were applied to correct ${\yjb}\subcal$.  These values were considered to represent the kinematics of the event after stable particles were produced, but before particles interacted with the ZEUS detector.  This is referred to as {\it hadron level} information.  The corrected values of $p_T$ and $\yjb$ were used to reconstruct $\qsqjb$ and $\xjb$
% 
% \begin{figure}
% 	\label{fig_pt_y_correction_functions}
% 	\begin{center}
% 		%\epsfig{file=figures/introduction/pdg_ratio_n_colors.ps,width=.8\textwidth}
% 		\includegraphics[draft=false, width=.49\textwidth]{/home/hwolfe/thesis/figures/event_reconstruction/cc0412col}
% 		\includegraphics[draft=false, width=.49\textwidth]{/home/hwolfe/thesis/figures/event_reconstruction/cc0413col}
% 		%http://pdg.lbl.gov/2007/reviews/hadronicrpp.pdf
% 	\end{center}
% 		\caption[Dead Material Correction Functions for $\yjb$ And $p_T$.]{
% 			\fixspacing{
% 				Dead Material Correction Functions for $\yjb$ And $p_T$..The $x$-coordinate values represents values from simulated events from hadrons, and the $y$-coordinate values represent the calorimeter-extracted values.  The method used for producing these plots is described in section \ref{section_detector_sim_reconstruction}.
% 			}
% 		}
% \end{figure}


\section{Jet Reconstruction}
	\label{section_jet_reconstruction}
	Calorimeter cells were combined in the laboratory frame using the $k_T$ cluster algorithm~\cite{np:b406:187} to form jets of calorimeter cells.  The algorithm was also used to cluster jets of hadrons and partons in the simulations, so in this section we will refer only to \lq\lq objects" being clustered for generality.  All clustering objects were considered massless.  The algorithm defines the distance of each particle from the beam line as  $d_i = E_{T,i}^2$, and the distance between two objects as $d_{ij} = \min{\left(E_{T,i}^2,  E_{T,j}^2\right)} \times \left[\left(\eta_i-\eta_j\right)^2+\left(\phi_i-\phi_j\right)^2\right]$.  The algorithm begins by identifying $\min{\left(d_i, d_{ij}\right)}$.  If $d_{kl}=\min{\left(d_i, d_{ij}\right)}$ for some $k$, $l$, then objects $k$, and $l$ are merged into a cluster (here indexed as $m$) with properties 
\begin{eqnarray}
	E_{T,m} & = & E_{T,j} + E_{T,k}\nonumber\\
	\eta_m & = & \frac{{E_{T,j}\eta_j+E_{T,k}\eta_k}}{E_{T,j}+E_{T,k}}\nonumber\\
	\phi_m & = & \frac{{E_{T,j}\phi_j+E_{T,k}\phi_k}}{E_{T,j}+E_{T,k}}.
\end{eqnarray}
	If $d_{n}=\min{\left(d_i, d_{ij}\right)}$ for some $n$, then object $n$ is considered a jet, and no longer participates in the merging procedure.  In this analysis, the $k_T$ algorithm was applied in the lab frame in inclusive mode, meaning that all objects are merged into jets.  Phase space requirements were applied to each jet, neglecting objects outside acceptance or poor reconstruction, which is described in section \ref{section_jet_selection}.  

	The $k_T$ algorithm is an alternative to the cone algorithm~\cite{eucell}, which is primarily used in hadron-hadron colliders.  The cone algorithm begins by selecting high-$E_T$ deposits as seed jets.  Other objects contained in an $\eta-\phi$ cone of a given radius are considered as belonging to a single jet.  The angle of a given cone is then modified to maximize the $E_T$ contained within, or to match the jet-axis with the cone-axis.  This algorithm has ambiguities resulting from the choice of minimum seed $E_T$, as well as the prescription to resolve overlapping cones.  The algorithm also is infra-red unsafe, meaning that the jet-cross section diverges as the seed threshhold is lowered.  The resulting jets can be dramatically different between two events differing only by low $E_T$ QCD radiation.  The algorithm requires vary little processing power, however, and was used to select events at the third level trigger, as will be described in section~\ref{section_third_level_trigger}.  In all other parts of this thesis, all jets are found using the $k_T$ cluster algorithm.
% 	Similarly to correction of detector effects for the kinematic variables, detector jet variables were also corrected.  Resolution studies (shown in section \ref{section_detector_sim_reconstruction}) showed that $\rapjet$ and $\phijet$ shoed no systematic smearing from detector effects, and no corrections were applied.  Linear correction functions for dead material were prepared from simulations.  Functions in bins of calorimeter $\etjet$ and $\rapjet$ were applied to jets of calorimeter cells to produce jet $E_T$ from jets of hadrons.  
% \section{Jet Energy Scale Uncertainties}
% 	In order to improve the description of hadronic jets, additional correction factors were applied to the jets in a similar fashion as the transverse energy corrections described in section \ref{section_dead_material_transv_energy}.  A sample of NC DIS was extracted where each event was required to have single a jet.  Because the jet would ideally have equal $E_T$ to the scattered electron in this sample, the $E_T$ of the electron was used to calibrate the CAL response to each jet.  This was extracted in terms of linear functions of $E_T$ in bins of $\rapjet$, which were then applied to the hadronic jet $E_T$s in the CC sample.  
