\chapter{SpaCal Calibration}
\label{Chapspacalib}

As it was mentioned in the last chapter, the measurement of the proton  
structure function is only possible if the event kinematics is correctly
and precisely reconstructed. The resolution of the reconstruction
methods relies directly on the precision of the measurement of the
angles and energies of the scattered electron and of the hadronical
final state.  
 
Since the energy measurement enters directly to the event kinematics,
especially for the electron method, and represent the 
largest source of systematic uncertainty for the measurement of
$F_2$ for values of $x \geq 10^{-4}$, it is important to perform a precise 
calibration of the energy measured by the SpaCal calorimeter on
analysis level. In this chapter the calibration of the SpaCal
calorimeter and the determination of its uncertainty is explained. 

In section \ref{SecCalibsample} the calibration sample is explained,
afterwards in section \ref{Secdacalibration} the method used to
calibrate the shifted vertex data and the MC sample is introduced. Since
the energy measurement has to be understood better than the percent
level, the double angle calibration procedure originally
introduced in 
\cite{SGlazov} is used to calibrate the electromagnetic section of the
SpaCal calorimeter. The scale of the electromagnetic energy
measurement is derived in section \ref{Secenergyscale} using the
cluster of the scattered electron with energies of $27.5\,$GeV. In order to
study the scale of the energy measurement at lower energies, the
reconstruction of the invariant mass of $\pi^{0}$ decays using the
SpaCal calorimeter is presented in section \ref{Secp0study}. 

\section{Calibration Sample}
\label{SecCalibsample}
 
\begin{figure}[t]
\begin{center}
\begin{minipage}{0.45\textwidth}
\setlength{\unitlength}{1cm}
\includegraphics[height=8.0cm]{./spacal/figures/egen.eps}
\put(-1.5,1.5){\small{(a)}}
\end{minipage}
\begin{minipage}{0.45\textwidth}
\setlength{\unitlength}{1cm}
\includegraphics[height=8.0cm]{./spacal/figures/energyq2xv2.eps}
\put(-1.5,1.5){\small{(b)}}
\end{minipage}
\caption{(a) Scattered electron energy distribution for DIS
  events at generator level (b) Kinematical plane trajectories for
  different energies (solid lines) of the scattered electron. In red
  lines are also illustrated contours of constant angles of the
  scattered electron $\theta_e$.} 
\label{Figkinpeak}
\end{center}
\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 commonly known as the {\it kinematic
  peak}. In Fig. \ref{Figkinpeak}(a) the energy distribution of the
scattered electron at generator level for a DIS selected sample is
shown.

The kinematical properties of events located in the kinematic peak
region are unique and are used to determine the scale of the electron
energy measurement. In Fig. \ref{Figkinpeak}(b), the $Q^2\!-\!x$ plane is
shown with different contours of constant scattered electron energies.
If the energy of the scattered electron coincides with the energy of
the incoming electron, then the contour correspond to a fixed
$x \approx 0.032$ for all values of $Q^2$. This kinematic region is only
accessible for larger electron scattering angles as can be seen from
Fig. \ref{Figkinpeak}(b), where the angle of the scattered electron is
also shown. At this value of $x$ the proton structure function
$F_2$ is approximately flat (see Fig. \ref{Figf2vsq2x}) therefore
events located in the kinematic peak region are almost independent of
structure function assumptions and thus appropriate to
perform calibration studies \cite{kinpeak}. 
%The kinematic peak region is exploited to calibrate the SpaCal calorimeter.  

The calibration of the SpaCal calorimeter begins already during the data
taking. The
variation of the gains of the photomultipliers are measured with the
help of the light-emitting-diode (LED) system situated at the back side
of the calorimeter \cite{ledsystem}. Each photomultiplier receives well
defined constant 
light pulses and afterwards photodiodes are used to identify
instabilities of the LED intensity. The instabilities are read out to
the data base and afterwards an offline correction of the
photomultiplier gain is performed. 

After applying the correction factors determined by the LED system,
the inner cells of the calorimeter are calibrated using events
localized in the ``kinematic peak'' region \cite{spacalcosmic}. Due to the
decreasing statistic at larger $Q^2$ the outer  part of the
calorimeter is calibrated with muons 
coming from either cosmic rays or from proton beam halo \cite{beamhalo}
events.  

Nevertheless an improved calibration of the SpaCal calorimeter, which
is able to 
reduce the uncertainty of the $F_2$ measurement at high values of $x$,
can only be achieved on analysis level. The energy calibration has
to provide: 

\begin{itemize}
  \item a good energy resolution, therefore it is vital to obtain a
  relative equalization of response of the calorimeter cells.
  \item a correct reconstruction of the event kinematics, therefore the
  absolute energy scale has to be determined.
\end{itemize}

The method to calibrate the SpaCal calorimeter used in this analysis was
introduced in \cite{SGlazov} and uses events localized in the kinematic peak
region. The SpaCal energy measurement is compared with a reference
energy obtained by the double angle (DA) reconstruction method, which
will be explained in section \ref{Secdacalibration}.

In this analysis the ``hottest-cell'' calibration method introduced in
\cite{AMeyer} is used as a cross check of the energy calibrated with
the DA method. The ``hottest-cell'' method compares directly the energy
distribution of the data and the MC simulation in the kinematic peak
region. 

%The event selection is performed such that the energy
%distribution of the scattered electron of the data and the MC are of
%nearly gaussian shape. Since the ``hottest-cell'' method is restricted
%by statistics due to the degradation of the resolution of the event 
%kinematic at large values of $x$ is used in this analysis
%only as a cross check of the calibration with the DA method.

\section{Calibration with the Double angle method}
\label{Secdacalibration}

As we have seen in section \ref{SubSecdamethod} the event kinematics
can be completely reconstructed using the angle of the scattered
electron $\theta_e$ and of the hadronic final state
$\theta_{had}$. This allows to derive the energy of the scattered
electron independently of the SpaCal energy measurement. The energy
measured by the DA method (DA energy) is given by:  

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

Following Eq. \ref{Eqeda} one can see that the DA energy can be
reconstructed in the kinematic peak region $E_{inc}^{0} \approx
27.5\,$GeV, if the scattered electron is measured at large angles
$\theta_{e} \approx 180^{\circ}$ and low values of $y$ (see also
Fig. \ref{Figkinpeak}(b)). 

The angle $\theta_e$ of the scattered electron is measured with the BST. In 
case the event is out of the acceptance of the BST, then the BDC and
the central tracking devices are used to
reconstruct the electron scattering angle. In both cases a well
reconstructed vertex around $30\,$cm with respect the expected
collision point at $z=70\,$cm is required.  
Events at low $y$ are selected applying a cut on the hadronic angle
$\theta_{had} < 80 ^{\circ}$, this cut allows a maximum value of $y$
of approximately $0.15$. The influence of events at very low $y$ where the 
hadronic final state escapes often undetected in the forward direction, was
suppressed by requiring $\theta_{had}>15^{\circ}$.

In order to minimize contributions of photoproduction background
events, an additional SpaCal selection is  
applied. Only events with exactly one cluster in the
SpaCal calorimeter with an energy in the kinematic peak
region $20\,$GeV$<E_{e}<32\,$GeV are accepted. In addition the 
radius of the cluster $R_{clog}$ must be less than $4\,$cm. The cuts
introduced in this paragraph and in the previous one constitute the
{\it DA selection}. 

The energy measured by the SpaCal calorimeter can be calibrated with
the DA energy $E_{DA}$ only in case the resolution of the DA energy is
better than the resolution of the SpaCal energy measurement.
This can be verified using the MC simulation where the
generated energy $E_{gen}$ is taken as the reference for both the DA
and the SpaCal energy measurements. The resolution of the DA energy
and of the SpaCal energy measurement are compared in
Fig. \ref{Figdaresol}. A shift up to $2\%$ of the generated variable
is observed  
in case of the SpaCal measurement, while $E_{DA}$ deviates by only
$0.4\%$. Therefore the DA energy is well suited to be the
reference energy scale for the SpaCal calibration. 

%The generated electron energy $E_{gen}$ is compared with both the DA
%and the SpaCal measurement. 

\begin{figure}[t]
\begin{center}
%\includegraphics[width=12.0cm]{./spacal/psnoise/edaresol.eps}
\includegraphics[height=10.0cm]{./spacal/figures/calibeps/eps/resolutionda.eps}
\caption{Resolution of the reconstructed energy
  measured by SpaCal (shaded histogram) and determined by the Double 
  angle method (solid line)}
\label{Figdaresol}
\end{center}
\end{figure}

The calibration procedure is an iterative process, where the reference
energy $E_{DA}$ is compared to the uncalibrated measured energy
$E_{SpaCal}^{uncal}$ using 
the previous DA selection. The cali\-bration gain factors $g$
are obtained such that $E_{SpaCal}^{cal} = (1+g)E_{SpaCal}^{uncal}$,
thus the deviation of $\delta = E_{DA}/E_{SpaCal}^{uncal}$ from $1$
correspond to the needed calibration factor. 

In order to ensure homogeneity over the whole 
SpaCal plane the following calibration factors are required:

\begin{enumerate}
\item {\bf Gain} calibration factors for each cell of the calorimeter.
\item {\bf Inbox and Cracks} calibration factors which correct for the losses of
  energy due to the SpaCal cell module geometry.
\item {\bf Radial} calibration factors, calculated as function of the
  transversal distance of the impact point of the scattered electron
  to the center of the beam pipe $R_{SpaCal}$. 
\end{enumerate}

This set of calibration constants will be applied sequentially
to the uncalibrated energy $E_{SpaCal}^{uncal}$. First, each cell
belonging to the electron cluster is corrected with its corresponding
gain factor (see section \ref{Subsecgains}). Next the inbox
corrections will be applied (see section \ref{Subsecinbox})
according to the coordinates of the hottest cell of the electron
cluster. Finally, using the coordinates of the hottest cell, the
corresponding radial calibration factors are applied (see section
\ref{Subsecradial}). This serie of corrections constitute the main DA
calibration chain. The calibration procedure is performed for both
data and MC. 

\subsection{Cell Gains}
\label{Subsecgains}

The first calibration constants are derived for each cell of the
SpaCal calo\-rimeter. As we have seen from section
\ref{Subseceidspacal}, the energy measured by SpaCal is constructed as
the sum of the energies of the cells which are assigned to the electron
cluster.

\begin{equation}
E_{SpaCal} =  \sum_{cell_i} E_i
\label{EqenergySpa}
\end{equation}

\begin{figure}[t]
\begin{center}
%\includegraphics[height=7.0cm]{./spacal/figures/celldelta.eps}
\includegraphics[height=7.0cm]{./spacal/figures/calibeps/calnewbstinner9cm/gainsit_calnewbstinner9cm.eps}
\caption{$\delta$ pull distributions for two cells of the SpaCal
  calorimeter. The dashed line correspond to the first gain determination
  while the solid line is the pull distribution obtained after
  eight iterations}
\label{Figpulliter1}
\end{center}
\end{figure}

The gain of each calorimeter cell is calculated using an iterative
procedure. The energy depositions of all cells which form the 
electron cluster are used to define individual ``cell-pull''
distributions $\delta_{cell-i}$.  

Each cell contributes to the pull distributions of the entire sample
with a weight $w_{i}$ given by the fraction of its measured energy
$E_i$ to the total energy of the electron cluster $E_{SpaCal}$. Thus,
the pull distribution for the $cell-i$ is defined as, 

\begin{equation}
\delta_{cell-i} = \frac{E_{DA}}{E_{SpaCal}^{uncal}} \hspace{0.5cm}
\textrm{having a weight}
\hspace{0.5cm} w_{i} = \frac{E_{i}}{E_{SpaCal}^{uncal}} 
\label{Eqpulldist}
\end{equation}

If all cells would be already calibrated, the $\delta_{cell-i}$ pull
distribution should be centered around $1$. If this is not the case,
then the deviation of the $\delta_{cell-i}$ distribution from
$1$ corresponds to the gain factor with which the cell has to be
corrected. The dashed line in 
Fig. \ref{Figpulliter1} shows the pull distribution for two example
cells of the SpaCal calorimeter. Since the shape of the pull
distribution is 
generally not of Gaussian shape, the deviation of $\delta_{cell_i}$ to
$1$ is obtained 
using a robust fit which removes the outliers in the distribution
\cite{robustfit}. In cases where cells do not have enough statistics to perform an
individual fit, a global fit for all those cells is performed.

\begin{figure}[t]
\begin{center}
\includegraphics[width=16.0cm]{./spacal/figures/calibeps/calnewbstinner9cm/gains_calnewbstinner9cm.eps}
\caption{Calibrated and uncalibrated $E_{DA}/E_{SpaCal}$ distributions for data
  and MC of the shifted vertex period, as function of $R_{SpaCal}$.}
\label{Figgainsdatamc}
\end{center}
\end{figure}

In order to ensure the convergence of the calibration method, an iterative
gain determination of the cells is performed. The gains of the
iteration $it$ are obtained using:

\[E_{SpaCal}^{uncal} \rightarrow E_{SpaCal}^{it}= \sum E_{i}
\prod_{k=0}^{k=it-1}(1+g_k) \]

and thus the pull distribution for the $cell-i$ for the iteration $it$ is
changed according to: 

\begin{equation}
\delta_{cell-i}^{it} = \frac{E_{DA}}{\sum_{i} E_{i}
  \prod_{k=0}^{k=it-1}(1+g_{k})} 
\hspace{2cm} w_{i}^{it} =
\frac{E_i(1+g_{i}^{it})}{\sum_{i} E_{i}\prod_{k=0}^{k=it-1}(1+g_{k})} 
\label{Eqdeltai}
\end{equation}

for $k=0$ the gains $g_{k}=0$ and in this case Eq. \ref{Eqdeltai} is equal to
Eq.\ref{Eqpulldist}. Usually $8$ iterations are needed to achieve a
result which is stable within  $0.001\%$. In Fig. \ref{Figpulliter1}
are also shown the pull distribution for the same SpaCal cells after
applying the gains obtained after eight iterations. 

The gain factors correct the energy measurement by $2\%$ to
$3\%$. Fig \ref{Figgainsdatamc} shows the variation of 
$\delta$ as function of the transverse distance of the cluster from
the center of the beam pipe $R_{SpaCal}$ for the uncalibrated $\delta$
and after the gains are applied. A significant improvement is achieved
taking the gains into account. Nevertheless some variations stay,
which are minimized by the following steps.

\subsection{Inbox Corrections}
\label{Subsecinbox}

\begin{figure}[t]
\begin{center}
\includegraphics[width=5.0cm]{./spacal/figures/spamodule.eps} 
\caption{Schematic view of one module of the SpaCal calorimeter. Cells in the
  middle, corner and border define the topology 1,2 and 3, respectively.}
\label{Figspamodulecol}
\end{center}
\end{figure}

Using the gains calibration constants derived in the previous section, the
energy measured by the SpaCal calorimeter has to be corrected further due
to several effects.
As we have seen in section \ref{Secspacalcalorimeter}, the SpaCal
calorimeter is constructed of super\-mo\-dules containing
$16$ cells each. Therefore energy losses due to the dead material present
between the supermodules is expected. Cells placed in the corner of
the supermodule are more affected by energy losses than the cells
situated in the middle of the 16 cell module.

In order to compensate for this losses, the measurement of the energy
is corrected as function of the impact point of the electron candidate
{\it inside} the cell. In order to take into account the position of
the cell inside the supermodule, three topologies are defined as
illustrated in Fig. \ref{Figspamodulecol}.
The cells situated in the middle, corners and at the borders
define the topologies 1,2 and 3 respectively.

\begin{figure}[t]
\begin{center}
\includegraphics[width=14.0cm,height=7.5cm]{./spacal/figures/inboxcorr.eps}
\caption{Calibration factors for the different cell topology inside
  the module for data and MC. T1,T2 and T3 correspond to the different
  topologies.}
\label{Figinboxcor}
\end{center}
\end{figure}

For each inbox topology the cell is divided in a grid with spacing of
$8\,$mm. The coordinates of the hottest cell are used to
determine the position of the electron candidate inside the cell.
The inbox corrections are derived using the same DA selection as in the
the gain determination. Since the insert modules have cells with
different geometry and are affected by leakage, an additional cut on
$R_{SpaCal} > 10\,$cm was applied. The inbox
corrections are obtained with the same robust fit procedure as the gain
determination, but no iteration for the inbox correction is performed.

\begin{figure}[t]
\begin{center}
\includegraphics[width=16.cm]{./spacal/figures/calibeps/calnewbstinner9cm/crack_calnewbstinner9cm.eps}
\caption{$E_{DA}/E_{SpaCal}$ distribution using the gains, inbox and
  crack calibration factors as function of $R_{SpaCal}$.}
\label{Figgainresult}
\end{center}
\end{figure}

Fig. \ref{Figinboxcor} shows the correction factors for data
and MC due to the energy losses between the modules. For data cells in the
corner are corrected up to $2\%$, while $1\%$ of correction is
obtained for the border cells and up to $0.5\%$ for the cells located
in the center of the module. 

Another source of energy losses in the calorimeter is due to the
inhomogeneity of the SpaCal cells inside the module. Since the variable 
$R_{box} = max(|x_{cell}|,|y_{cell}|)$ covers the calorimeter surface in
squares, it was used to correct the energy losses between the
cells. The corrections are derived comparing the DA energy with the
calibrated SpaCal energy with gains and inbox corrections. Four sets of
calibration factors as function of $R_{box}$ are derived for 4 $\phi$
sectors, each covering one quarter of the SpaCal surface.

This procedure corrects the energy measurement by $0.3\%$ in addition.
Fig. \ref{Figgainresult} show the deviation of the energy measurement
from the reference energy $E_{DA}$ as a function of $R_{SpaCal}$ after
the inbox and crack calibration factors are applied. 

%\begin{figure}[t]
%\begin{center}
%\includegraphics[width=16.cm]{./spacal/figures/calibeps/calnewbstinner9cm/crack_calnewbstinner9cm.eps}
%\caption{Uncalibrated and calibrated $E_{DA}/E_{SpaCal}$ distribution
%  as function of $R_{spa}$.}
%\label{Figx}
%\end{center}
%\end{figure}

\begin{figure}[t]
\begin{center}
\includegraphics[width=16.cm]{./spacal/figures/calibeps/calnewbstinner9cm/finalradial_calnewbstinner9cm.eps}
\caption{$E_{DA}/E_{SpaCal}$ distribution using the whole calibration
  factors as function of $R_{SpaCal}$.}
\label{Figradialcheck}
\end{center}
\end{figure}

\subsection{Radial Corrections}
\label{Subsecradial}

As we can see from Fig.\ref{Figgainsdatamc} and
Fig.\ref{Figgainresult} after the gains 
inbox and crack calibration factors are applied, a significant
improvement of the measured energy over the SpaCal plane is achieved. 
Nevertheless a radial dependence of the calibrated $\delta$ pull quantity 
up to $1.2\%$ still remains. Such a deviation is probably due to 
dead material located in front of the SpaCal calorimeter which is not
properly implemented in the MC simulation. In particular the
deviations observed at $R_{SpaCal} \approx 12.\,20\,$cm corresponds to
the CIZ and COZ electronics \cite{victor}. This dependence is
corrected by deriving the last calibration factors as function of the
measured radius $R_{SpaCal}$. In analogy to the crack corrections,
four sets of calibration factors are derived for the same 4 $\phi$
sectors. 

In Fig. \ref{Figradialcheck} is shown the radial dependence of
$\delta$ after the complete calibration procedure is applied. The
remaining differences between data and MC do not exceed $0.2\%$ for
allmost all the regions covered by the SpaCal calorimeter.  

\subsection{MC Smearing}

The uncalibrated and calibrated energy distribution of the scattered
electron for the whole calibration sample is shown in
Fig. \ref{Figsmear}(a) and (b). 
It can be seen, that the  mean value
of data and MC of the energy distribution agrees after the whole DA
calibration factors are applied. Nevertheless, the MC
resolution is better than the 
resolution of the data. Therefore it is necessary to smear the MC
simulation in order to fit its resolution to the one of the data.

In order to determine the optimum value of the smearing, the
calibrated energy in the MC was smeared with different factors varying
between $0\%$ and $0.4\%$. The value of $\chi^{2}$ of the deviation
between data and MC was used to determine the optimum value. The best
value was found to be $0.2\%$. In
Fig. \ref{Figsmear}(c) the calibrated energy distributions of
data and MC with the additional smearing of $0.2\%$ are shown. 

However the smearing of the MC results in a constant systematic
shift of the energy distribution of about $0.15\%$. This systematic
shift can be avoided by introducing in the MC calibration chain, the
smearing value starting from the inbox corrections. In
Fig. \ref{Figsmear}(d) is shown the calibrated energy distribution  
when the smearing is applied to the MC calibration. All distributions in Fig. 
\ref{Figsmear} are normalized using their total number of events.

\begin{figure}[t]
\setlength{\unitlength}{1cm}
\begin{center}
\begin{minipage}{0.40\textwidth}
\includegraphics[width=6.5cm]{./spacal/figures/calibeps/calnewbstinner9cm/uncalibenergy_calnewbstinner9cm.eps} 
\put(-1.5,5.5){\small{(a)}}
\end{minipage}
\begin{minipage}{0.40\textwidth}
\includegraphics[width=6.5cm]{./spacal/figures/calibeps/calnewbstinner9cm/calibenergy_calnewbstinner9cm.eps}
\put(-1.5,5.5){\small{(b)}}
\end{minipage}
\begin{minipage}{0.40\textwidth}
\includegraphics[width=6.5cm]{./spacal/figures/calibeps/calnewbstinner9cm/calibenergysmear_calnewbstinner9cm.eps}
\put(-1.5,5.5){\small{(c)}}
\end{minipage}
\begin{minipage}{0.40\textwidth}
\includegraphics[width=6.5cm]{./spacal/figures/calibeps/calnonoisesubinner9cmzvsmear/calibenergy_calnonoisesubinner9cmzvsmear.eps}
\put(-1.5,5.5){\small{(d)}}
\end{minipage}
\caption{Comparison of data and MC of (a) uncalibrated (b) calibrated (c),(d) smeared energy distribution measured by SpaCal.}
\label{Figsmear}
\end{center}
\end{figure}

\section{Energy Scale}
\label{Secenergyscale}

\begin{figure}[h]
\begin{center}
\setlength{\unitlength}{1cm}
\begin{minipage}{0.45\textwidth}
\epsfig{figure=./spacal/figures/calibeps/eps/edanonoisesub.eps,width=\textwidth}
\put(-2.,5.5){\small{(a)}}
\end{minipage}
\begin{minipage}{0.45\textwidth}
\setlength{\unitlength}{1cm}
\epsfig{figure=./spacal/figures/calibeps/eps/edanoisesub.eps,width=\textwidth}
\put(-2.,5.5){\small{(b)}}
\end{minipage}
\begin{minipage}{0.45\textwidth}
\epsfig{figure=./spacal/figures/calibeps/eps/spanonoisesub.eps,width=\textwidth}
\put(-2.,5.5){\small{(c)}}
\end{minipage}
\begin{minipage}{0.45\textwidth}
\epsfig{figure=./spacal/figures/calibeps/eps/spanoisesub.eps,width=\textwidth}
\put(-2.,5.5){\small{(d)}}
\end{minipage}
\caption{Resolution of the DA energy measurement in case the noise is
  not subtracted (a) and subtracted (b) during the reconstruction of
  $\theta _{had}$. In figure (c) and (d) is shown the resolution of
  the SpaCal measurement after applying the DA calibration, in the
  case $\theta_{had}$ is reconstructed not subtracting (c) and 
  subtracting (d) the LAr noise.}
\label{Figedanoise}
\end{center}
\end{figure}

We have seen in the previous sections that after performing the DA
calibration, the agreement between the data and the MC simulation is
of the order of $0.2\%$. Nevertheless the resolution of $E_{DA}$ the energy
derived by the DA method has not a completely symmetric shape and it
is displaced from zero by  
$0.4\%$, as is it shown in Fig. \ref{Figedanoise}(a). 
The long tail of the distribution in Fig. \ref{Figedanoise} (a) 
is due to showering \cite{wallny} and due to final state radiation events, where
the scattered electron radiates a photon, which deposits its energy
indistinguishable in the same cluster as the electron.

The DA energy of the scattered electron relies directly on the
measurement of the hadronic and electron scattering angles.
The hadronical final state is constructed, combining the tracks measured
in the central tracking devices with the energy depositions measured
by the LAr calorimeter and the SpaCal calorimeter. During 
the reconstruction, isolated energy depositions in the LAr are 
investigated in order to identify noise. The recognition of the
LAr-noise is performed with different thresholds depending on the
position of the energy cluster in the LAr calorimeter 
(see chapter \ref{Chaphadfinalstate} for more details).

%The resolution of the DA energy in case the noise is substracted stay
%of the same  order as in Fig. \ref{Figedanoise}(a), but the mean value
%of the DA energy from the generated energy decreases considerably and
%tends to be zero. 

Up to now the identified noise is not subtracted during
the reconstruction of $\theta_{had}$. However, this isolated energy
deposition can influence the measurement of $\theta_{had}$ and therefore 
the DA energy could be affected. 
While the resolution of the DA energy is nearly independent of the
subtraction of noise in the $\theta_{had}$ reconstruction, the mean
value decreases considerably and tends to be zero (see
Fig. \ref{Figedanoise}(b)). 
The whole calibration procedure is therefore
repeated, subtracting the identified noise during the reconstruction
of the hadronical angle $\theta_{had}$.
The gain calibration factors differ up to
$0.5\%$, while the inbox, cracks, radial corrections stay in the
same order. 

In order to determine which calibration procedure should be applied during
the analysis, the scale of the energy measurement at the
kinematic peak for both calibration setups will be compared.
Therefore the comparison between the SpaCal calibrated energy
and the generated energy is necessary. This comparison is shown in
Fig. \ref{Figedanoise} for both calibration schemes. In case the
noise is subtracted, the scale of the SpaCal measurement is $0.5\%$
while in case the noise is not subtracted, the calibrated SpaCal
measurement coincides with the generated quantity as it is shown by
the lines in Fig. \ref{Figedanoise}(c) and (d).

Since the aim of the calibration procedure is to have a SpaCal
energy measurement close to the generated energy, the calibration
scheme not subtracting the noise is chosen. In such way
displacements of the SpaCal energy in the kinematic peak from the
generated energy are avoided. 


\section{Cross check with the Hottest cell calibration}

The hottest cell calibration method uses as well the kinematic peak
region to derive individual cell calibration factors. In contrast to
the DA method, the SpaCal measurement of the electron cluster is
directly compared with the MC simulation \cite{AMeyer}.

In order to have an electron energy distribution with a Gaussian
shape almost free of tails, the calibration sample uses the
following selection:

\begin{itemize}
\item Events in which the electron cluster has a energy between $20$
  and $30\,$GeV and a cluster radius less than $4\,$cm.
\item Radiative events are suppressed allowing a maximum value
  of $y$ of $0.05$.
\item The noise contribution is suppressed applying $y>0.005$.
\end{itemize}

\begin{figure}[p]
\begin{center}
\epsfig{figure=./spacal/figures/calibeps/calnewbstinner9cm/calnewbstinner9cm_cellbycell_v2.eps,width=\textwidth}
%\includegraphics[height=15.cm]{./spacal/figures/calibeps/calnewbstinner9cm/calnewbstinner9cm_cellbycell_v2.eps}
\caption{Calibrated energy distributions of the inner cells of the
  SpaCal calorimeter for the hottest cell calibration selection. Full points represent the data of the shifted vertex period, while the histogram illustrates the {\small MC DJANGOH}.}
\label{Fighottestcell}
\end{center}
\end{figure}

The calibration gain factors are derived as:

\begin{equation}
g_{i} = \frac{<E_{cl,i}^{MC}>}{E_{cl,i}^{data}}
\end{equation}

where $<E_{cl,i}>$ is the mean of the electron cluster energy, which 
is assigned to the hottest cell $i$. The statistics of
the sample decreases considerably with increasing distances from the
beam pipe and thus individual calibration factors
can be determined only for the inner cells.

Since in the last sections data and MC were calibrated with the DA
method, the hottest cell calibration selection is used only to cross
check the DA calibration in a slightly different kinematic region
where the effect of the tails due to radiative events is reduced.

In Fig. \ref{Fighottestcell} the {\bf DA calibrated} cell
distributions for the  
hottest cell calibration selection are shown. There is 
no significant {\it shift} between data and MC for almost all
cells. However, this selection allows us to identify which cells have
to be rejected from the analysis due to their bad shape
distribution. This correspond to the insert cells denoted by the
numbers $15,6,9,12$ and the cells $31$ and $29$.

\section{Energy measurement at low Energies}
\label{Secp0study}


\begin{figure}[t]
\begin{center}
\begin{minipage}{0.48\textwidth}
\setlength{\unitlength}{1cm}
\epsfig{figure=./spacal/figures/studyp0/uncalibp0mass.eps,width=\textwidth}
\put(-2.4,6.5){\small{(a)}}
\end{minipage}
\begin{minipage}{0.48\textwidth}
\setlength{\unitlength}{1cm}
\epsfig{figure=./spacal/figures/studyp0/calibp0mass.eps,width=\textwidth}
\put(-2.4,6.5){\small{(b)}}
\end{minipage}
\caption{Invariant mass of $\pi^{0}$ invariant mass for energy clusters measured by SpaCal
before (a) and (b) after applying the DA calibration.}
\label{Figp0peak}
\end{center}
\end{figure}

As was shown in the previous sections, the DA calibration is performed
with electron clusters where the energy lies in the kinematical peak
region. A comparison between the data and the MC simulation shows that 
the energy measurement has a scale uncertainty of $0.2\%$ in kinematic
peak. If the DA calibration derived in the last sections is also valid
for lower energies, then it is necessary to known what is its
uncertainty. 

One method used to study the scale of the 
energy measurement of the SpaCal calorimeter towards lower energies,
uses the reconstruction of the invariant mass of $\pi^{0} \rightarrow
\gamma \gamma $ decays.
The invariant mass is calculated according to:

\begin{equation}
m_{\pi^{0}} = \sqrt{2E_{\gamma 1}E_{\gamma 2}(1-\cos \theta_{\gamma \gamma})}
\label{Eqp0}
\end{equation}

\begin{figure}[t]
\begin{center}
\begin{minipage}{0.45\textwidth}
\setlength{\unitlength}{1cm}
\epsfig{figure=./spacal/figures/studyp0/controlplots_maxval.eps,width=\textwidth}
\put(-2.0,6.5){\small{(a)}}
\end{minipage}
\begin{minipage}{0.45\textwidth}
\setlength{\unitlength}{1cm}
\epsfig{figure=./spacal/figures/studyp0/controlplots_minval.eps,width=\textwidth}
\put(-2.0,6.5){\small{(b)}}
\end{minipage}
\begin{minipage}{0.45\textwidth}
\setlength{\unitlength}{1cm}
\epsfig{figure=./spacal/figures/studyp0/controlplots_sepval.eps,width=\textwidth}
\put(-2.0,6.5){\small{(c)}}
\end{minipage}
\begin{minipage}{0.45\textwidth}
\setlength{\unitlength}{1cm}
\epsfig{figure=./spacal/figures/studyp0/controlplots_energy.eps,width=\textwidth}
\put(-2.0,6.5){\small{(d)}}
\end{minipage}
%\begin{minipage}{0.45\textwidth}
%\setcaptionwidth{\textwidth}
\caption{Control distributions of the $\pi^{0}$ invariant mass
  sample. The (a) maximal (b) minimal energy of the photons measured
  by the SpaCal calorimeter. (c) The separation between the cluster on
  the SpaCal plane (d) the energy sum of the two photon cluster.}
\label{Figp0controlplot}
%\end{minipage}
\end{center}
\end{figure}

\noindent where $E_{\gamma 1}$ and $E_{\gamma 2}$ are the energies of
the photons, which can be measured by the SpaCal calorimeter, and
$\theta_{\gamma \gamma}$ is the opening angle between the two photons.
In order to suppress background from random coincidences in the
$\pi^{0}$ mass reconstruction sample, the following selection cuts were
applied:

\begin{itemize}
\item Events having only two clusters in the SpaCal calorimeter and
  triggered by S9 are used (see section \ref{Sectriggerfiducuts}). Since the threshold of S9 is $2\,$GeV, the 
  clusters must have a minimum energy of $2\,$GeV (see section
  \ref{Sectriggerfiducuts}).  
\item In order to measure a precise separation angle, only events
  having a well reconstructed vertex around $30\,$cm of the expected
  position at $z=70\,$cm are used.
\item A cut of a minimum distance of $10\,$cm between the clusters is required
  to avoid overlap between the selected clusters 
\end{itemize}

In Fig. \ref{Figp0peak} the reconstructed mass of the
$\pi^{0}$ decays is shown for data and {\small DJANGOH} MC before and
after the DA calibration is applied. The introduction of the DA SpaCal
calibration, decreases the observed shift of the mass reconstructed
distribution by almost $0.5\%$.
However a shift between the data and the MC simulation is still observed. 
The value of this displacement determines the scale of the energy measurement 
at the $\pi^{0}$ mass. The shift is studied using the
Kolmogorov-Smirnov (KS-test).
The invariant mass distribution of the $\pi^{0}$ of the MC is shifted
until the KS-test between the shifted-MC invariant mass and the 
data shows the maximum probability. 

In order to study the dependence of the scale on the different
variables used to reconstruct the invariant mass, the entire $\pi
^{0}$ sample is divided into sub-samples with approximately equal
statistic. Fig. \ref{Figp0controlplot}(a) and (b) shows the comparison
between data and MC of the maximal, minimal energy of the photon
clusters, while in Fig \ref{Figp0controlplot}(c) the separation
distance between the two cluster on the SpaCal plane is shown. The
lines represent the imposed cut used to define the subsamples. For
each subsample, the shift between data and MC of the invariant mass
using the KS-test is studied. 

\begin{figure}[t]
\begin{center}
\begin{minipage}{0.45\textwidth}
\setlength{\unitlength}{1cm}
\epsfig{figure=./spacal/figures/studyp0/halfstudy_scale.eps,width=\textwidth}
\put(-2.0,4.5){\small{(a)}}
\end{minipage}
\begin{minipage}{0.45\textwidth}
\setlength{\unitlength}{1cm}
\epsfig{figure=./spacal/figures/studyp0/correctedcalibp0mass.eps,width=\textwidth}
\put(-2.0,6.5){\small{(b)}}
\end{minipage}
\caption{(a) Scale of the energy measurement using the $\pi^{0}$
  sample. (b) Reconstruction of the $\pi^{0} \rightarrow \gamma \gamma$ invariant mass for
  energy clusters measured with the SpaCal calorimeter after applying
  the DA calibration and correcting the scale.}
\label{Figp0scale}
\end{center}
\end{figure}

In Fig. \ref{Figp0scale}(a) is shown the result of the KS-test for the invariant-mass 
subsamples, a shift of $2.5\%$ is necessary to fit the MC with the data.
Correcting the MC for the scale value of $2.5\%$, the agreement between
the two invariant mass distributions considerably improves (see Fig
\ref{Figp0scale}(b)). 

In order to determine the error of the scale, several checks to the
$\pi^{0}$ invariant mass selection are performed.
Fig. \ref{Figp0controlplot}(d) shows the sum of the energy of the two photon
clusters of the $\pi ^{0}$ candidate. One observes
that the data distribution is not completely described by the
MC, therefore the energy distribution of the data of
Fig. \ref{Figp0controlplot}(d) was used to weight the MC. The weighted
distributions of the MC were used to derive again the energy
scale. The resulting scale have values which does not exceed $1\%$ of
the ones shown in Fig. \ref{Figp0scale}(a). The error of the scale is
thus quoted to be $1\%$. 

%Since the $\pi ^{0}$ is a two body decay process, a reweight
%on the minimal energy to the $\pi$ after fixing the scale is applied. The agreement
%between data and MC improves conducing to a remaining uncertainty of $1\%$.   

\section{Energy measurement Uncertainty}

The differences of the energy scale at low energies $E \approx 2\,$GeV
and at kinematic peak $E \approx 27.5\,$GeV correspond to the non
linearity behaviour of the SpaCal energy response, previously studied
in \cite{victor}. The energy measurement of the data will be corrected
assuming that the energy scale is linear. The scale at kinematic peak
and at $\pi^{0}$ mass ($E \approx 2\,$GeV) are used to derive the
linear correction. QED Compton events were used in \cite{paper,victor}
to check the calorimeter energy scale in the range $4-24\,$GeV, the
linear energy correction derived in this analysis is in agreement with
those results performed for different data sample periods.

The correction and the uncertainty of the scale of the SpaCal energy
measurement is given by:  

\begin{itemize}
  \item $0\% \pm 0.2 \%$ for E$=27.5\,$GeV
  \item $2.5\% \pm 1\%$ for $\pi^{0}$ Energy (E$=2\,$GeV)
\end{itemize}

The uncertainty of the energy measurement will be used to derive the
systematic uncertainty of the $F_2$ measurement.


