\section{Criteria for the Optimal Signal Extraction}

The goal for the optimal signal reconstruction algorithm is to compute an unbiased estimate of the strength and arrival time of the 
Cherenkov signal with the highest possible resolution for all signal intensities. The MAGIC telescope has been optimized to 
lower the energy treshold of observation in any respect. Particularly the choice for an FADC system has been made with an eye on the 
possibility to extract the smallest possible signals from air showers. It would be inconsequent not to continue the optimization procedure
in the signal extraction algorithms and the subsequent image cleaning. 
\par
In the traditional image analysis, one takes the decision whether the extracted signal of a certain pixel is considered as signal or background. 
Those considered as signal are further used to compute the image parameters while the background ones are simply rejected. The calculation 
of the second moments of the image ``ellipse'' usually fails when applied to un-cleaned images, therefore the decision is yes or 
no\footnote{This restriction is not necessary any more in all advanced analyses using likelihood fits to the images or fourier transforms. Thereby any bias of the reconstructed signal leads to potentially wrong results.}. 
Moreover,
already low contributions of mis-estimated background can degrade the resolution of the image parameters considerably. If one wants to 
lower the threshold for signal recognition, it is therefore mandatory to increase the efficiency with which the background is recognized as 
such. If the background resolution is bad, the signal threshold goes up and vice versa.

Also an accurate determination of the signal arrival time may help to distinguish between signal and background. The signal arrival times vary smoothly from pixel to pixel while the background noise is randomly distributed in time. Therefore it must be insured that the reconstructed arrival time corresponds to the same reconstructed pulse as the reconstructed charge.

\par
One cuts on the probability that the reconstructed charge is due to background. This yields a lower reconstructed signal limit for an event 
being considered as signal at all. The lower the limit (keeping constant the background probability), the lower the analyzed energy 
threshold.
\par
Furthermore, the algorithm must be stable with respect to changes 
in observation conditions and background levels and between signals obtained from gamma or hadronic showers or from muons. 

Also the needed computing time is of concern.

\subsection{Bias and Mean-squared Error}

Consider a large number of identical signals $S$, corresponding to a fixed number of photo-electrons. By applying a signal extractor
we obtain a distribution of estimated signals $\widehat{S}$ (for fixed $S$ and
fixed background fluctuations $BG$). The distribution of the quantity

\begin{equation}
X = \widehat{S}-S 
\end{equation}

has the mean $B$ and the resolution $R$ defined as:

\begin{eqnarray}
   B   \ \ \ \  = \ \ \ \ \ \ <X> \ \ \ \ \  &=& \ \ <\widehat{S}> \ -\ S\\
   R^2 \ \ \ \  = \ <(X-B)^2> &=& \ Var[\widehat{S}] \label{eq:def:r}\\
   MSE \      = \ \ \ \ \ <X^2> \ \ \ \  &=& \ Var[\widehat{S}] +\ B^2
\end{eqnarray}

The parameter $B$ is also called the {\textit{\bf BIAS}} of the estimator and $MSE$ 
the {\textit{\bf MEAN-SQUARED ERROR}} which combines the variance of $\widehat{S}$ and 
the bias. Both depend generally on the size of $S$ and the background fluctuations $BG$, 
thus: $B = B(S,BG)$ and $MSE = MSE(S,BG)$.

\par
Usually, one measures easily the parameter $R$, but needs the $MSE$ for statistical analysis (e.g. 
in the image cleaning). 
However, only in case of a vanishing bias $B$, the two numbers are equal. Otherwise, 
the bias $B$ has to be known beforehand. 

In the case of MAGIC the background fluctuations are due to electronics noise  and the PMT response to LONS. The signals from the latter background are not distinguishable from the Cherenkov signals. Thus each algorithm which searches for the signals inside the recorded FADC time slices will have a bias. In case of no Cherenkov signal it will reconstruct the largest noise pulse. 

Note that every sliding window extractor, the digital filter and the spline extractor have a bias, 
especially at low or vanishing signals $S$, but usually a much smaller $R$ and in many cases a smaller $MSE$ than the fixed window 
extractors.

\subsection{Linearity}

The reconstructed signal should be proportional to the total integrated charge in the FADCs 
due to the PMT pulse from the Cherenkov signal.  A deviation from linearity is usually obtained in the following cases:

\begin{itemize}
\item At very low signals, the bias causes as too high reconstructed signal (positive $X$).
\item At very high signals, the FADC system goes into saturation and the reconstructed signal becomes too low (negative $X$).
\item Any error in the inter-calibration between the high- and low-gain acquisition channels yield an effective deviation from 
linearity.
\end{itemize}

The linearity is very important for the reconstruction of the shower energy and further the obtained energy spectra from the 
observed sources. 


\subsection{Low Gain Extraction}

Because of the peculiarities of the MAGIC data acquisition system, the extraction of the low-gain pulse is somewhat critical:
The low-gain pulse shape differs significantly from the high-gain shape. Due to the analogue delay line, the low-gain pulse is 
wider and the integral charge is distributed over a longer time window.

The time delay between high-gain 
and low-gain pulse is small, thus for large pulses, 
mis-interpretations between the tails of the high-gain pulse and the low-gain pulse might occur. Moreover, the total recorded time window 
is relatively small and for late high-gain pulses, parts of the low-gain pulse might already reach out of the recorded FADC window. 
A good extractor must be 
stably extracting the low-gain pulse without being confused by the above points. This is especially important since the low-gain 
pulses are due to the large signals with a big impact on the image parameters, especially the size parameter.


\subsection{Stability}

The signal extraction algorithms has to reconstruct stably the charge for different types of pulses 
with different intrinsic pulse shapes and backgrounds:

\begin{itemize}
\item{cosmics signals from gammas, hadrons and muons}
\item{calibration pulses from different LED color pulsers}
\item{pulse generator pulses in the pulpo setup}
\end{itemize}

An important point is the difference between the pulse shapes of the calibration and Cherenkov signals. It has to be ensured that the 
computed calibration factor between the reconstructed charge in FADC counts and photo electrons for calibration events 
is valid for signals from Cherenkov photons.



\subsection{Intrinsic Differences between Calibration and Cosmics Pulses}

The calibration pulse reconstruction sets two important constraints to the signal extractor:

\begin{enumerate}
\item As the standard calibration uses the F-Factor method in order to reconstruct the number of impinging photo-electrons,
the resolution of the extractor must be constant for different  signal heights, especially between the case: $S=0$ and 
$S = 40\pm 7$~photo-electrons which is the default intensity of the current calibration pulses. This constraint is especially  
non-trivial for extractors searching the signal in a sliding window.
\item As the calibration pulses are slightly wider than the cosmics pulses, the obtained conversion factors must not be affected by 
the difference in pulse shape. This puts severe contraints on all extractors which do not integrate the whole pulse or take the pulse 
shape into account.
\end{enumerate}

\subsection{Reconstruction Speed}

Depending on the reconstruction algorithm the signal reconstruction can take a significant amount of CPU time. 
Especially the more sophisticated signal extractors can be time consuming which search for the position of the Cherenkov signals 
in the recorded FADC time slices and perform a fit to these samples. At any case, the extractor should not be significantly slower than 
the reading and writing routines of the MARS software. 

Thus, for an online-analysis a different extraction algorithm might be chosen than for the final most accurate 
reconstruction of the signals offline.

\subsection{Applicability for Different Sampling Speeds / No Pulse Shaping.}

The current read-out system of the MAGIC telescope~\cite{Magic-DAQ} with 300~MSamples/s is relatively slow compared to the fast pulses of 
about 2\,ns FWHM of Cherenkov pulses. 
To acquire the pulse shape an artificial pulse shaping to about 6.5\,ns FWHM is used. Thereby also more night sky background light 
is integrated which acts as noise. 

For 2 ns FWHM fast pulses a 2 GSamples/s FADC provides at least 4 sampling points. This permits a reasonable reconstruction of the pulse shape. First prototype tests with fast digitization systems for MAGIC have been successfully conducted \cite{GSamlesFADC}. The signals have been reconstructed within the common MAGIC Mars software framework.

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: "MAGIC_signal_reco"
%%% End: 
