\chapter{Spacal Calibration}

As was mentioned in the last chapter, the measurement of the proton
structure function is only possible if the event kinematic is correct
and precise reconstructed. The resolution of the reconstruction methods rely
directly on the precision of the measurement of the angles and
energies of the scattered electron and of the hadronical final state. 
Therefore the calibration of the SpaCal and LAr calorimeters has special
importance. 

In this chapter the calibration of the Spacal calorimeter and the
determination of its uncertainty is explained.

\section{Spacal Reconstruction}

In order to achieve a precise energy measurement, the spacal
calorimeter is constantly munitored at the data taking stage, since
the gain variation of its photomultipliers vary a few percent per
hour. The variations are measured with the
help of the light-emiting-diode (LED) system situaded at the back side
of the calorimeter. This consist of a set of
LEDs connected via optical fibers to the light mixers of the
photomultipliers. The measurement of the photodiode is used to identify
inestabilities of the LED intensity and thus any change of the
photomultiplier gain can be detected and corrected offline. 

The inital energy calibration at DST level is obtained using the
correction factors of the LED system and calibration factors obtained
with cosmic muons and proton beam halo muons. At this stage the energy
measurement is precise up to $5\%$. 

In this chapter a detailed study of the energy calibration is
performed. The method used to calibrate correspond to events localized
in the ``kinematic peak'' region and 

At analysis level, the 

The energy calibration has to provide:

\begin{itemize}
  \item a good energy resolution, therefore is vital to have a
  relative equalization of the response of the calorimeter
  cells.
  \item a correct reconstruction of the event kinematic, therefore the
  determination of the absolute energy scale has to be known.
\end{itemize}

\section{Kinematic peak}

\begin{figure}[t]
\begin{center}
\includegraphics[height=8.5cm]{./spacal/figures/energyq2xv2.eps}
\caption{Kinematical plane trayectories for differents scatter energies}
\end{center}
\label{kinpeak}
\end{figure}

In DIS events at low values of $Q^2$, the energy distribution of the
scattered electron has a characteristic shape with a maximum close to
the electron beam energy and commonly is known as the {\it kinematic
  peak}. 

In Fig. \ref{kinpeak} different contours of constant electron
scattered energies are shown. The kinematic region around $E_e=27.5$ does
not depend basically on $Q^2$, being the scattered energy a constant
for values of $x=E_{inc}/E_{p}$. The kinematic peak region is allmost
independent of the structure function assumption and therefore is a
good kinematic region to perform calibration studies.

\begin{figure}[h]
\begin{center}
\includegraphics[height=7.0cm]{./spacal/figures/egenrec.eps}
\includegraphics[height=7.0cm]{./spacal/figures/resolutionda_mc.eps}
\caption{(a) Generated and Reconstructed Energy distribution of the
  scattered electron. (b) Resolution of the reconstructed energy
  measured by Spacal (area distribution) and determined by the Double 
  angle method (solid line)}
\end{center}
\label{spakinrec}
\end{figure}

In Fig. \ref{spakinrec}(a) the energy distribution of
the scattered electron at generator level and reconstruction level is
shown. One can clearly see that once the
detector response is applied, the electron scattered energy is
broader. The resolution between generator and reconstructed level is
shown in In Fig. \ref{spakinrec}(b) where a deviation up to $1\%$ of
the generated variable $E_{gen}$ is observed. 
In order to obtain a better energy
resolution at larger scattered energies an additional calibration
procedure has to be applied to the data, the method used here to
calibrate is given by the double angle method.

\section{Double angle method}

In order to have a precise energy measurement in the kinematical range
explored better than $1\%$ at kinematic peak, a extra calibration
procedure has to be performed. 

The reference energy to perform 
the calibration is the energy determined by the double angle method $E_{DA}$:

\begin{equation}
E_{DA} = E_{inc} \frac{1-y_{DA}}{\sin ^{2} \theta_e /2}
\label{eqeda}
\end{equation}

where $Y_{DA}$ is given by Eq. \ref{kinda} and depend only on the
measurement of $\theta_e$ and $\theta_h$ and therefore is independent 
on the measurement of the scattered energy $E_e$.

The calibration sample constitutes events in the kinematic peak
region $20$GeV$<E_{e}<32$Gev. 
Events with a high energy electron in the spacal and a well
reconstructed central tracker vertex were selected. Furthermore a
validation of the electron by the BST and the BDC is required. In
order to select low y events a cut on thetah < 80 was applied. A
possible influence of events at very low y where the hadronic final
state escaped detection in forward direction was suppresed requiring
thetahad>15 

\section{Calibration Procedure}
\subsection{Cell Gains}

\begin{figure}[h]
\begin{center}
\includegraphics[height=7.0cm]{./spacal/figures/eoldnew_mc.eps}
\includegraphics[height=7.0cm]{./spacal/figures/eoldnew_data.eps}
\caption{Calibrated and uncalibrated energy distributions for (a)
  MC and (b) data of the shifted vertex period}
\end{center}
\label{gainsdatamc}
\end{figure}

\subsection{Inbox Corrections}

\subsection{Crack Corrections}

\subsection{Radial Corrections}

\section{Energy Uncertainty at kinematic peak}

\subsection{KS Test}

\section{Energy measurement at low Energies}

\subsection{$\pi ^{0}$ reconstruction}

\subsection{Energy Uncertainty at $\pi ^{0}$ mass}


%\begin{figure}[t]
%\begin{center}
%\includegraphics[height=14.5cm]{./introduction/figures/f2_w_q2_withoutSv.eps}
%\label{figallmqcd}
%\caption{$\sigma_{tot}^{\gamma p} \propto F_2(x,W^2)/Q^2$}
%\end{center}
%\end{figure}



