Index: /old/MagicDoku/strategy_mc_ana.tex
===================================================================
--- /old/MagicDoku/strategy_mc_ana.tex	(revision 15423)
+++ /old/MagicDoku/strategy_mc_ana.tex	(revision 15423)
@@ -0,0 +1,976 @@
+\documentclass[12pt]{article}
+
+\usepackage{magic-tdas} 
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% BEGIN DOCUMENT
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\begin{document}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Please, for the formatting just include here the standard
+%% elements: title, author, date, plus TDAScode
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\title{Outline of a standard analysis for MAGIC \\
+(including Monte Carlo work)}
+\author{R. B\"ock, H. Kornmayer, W. Wittek\\ 
+\texttt{h.kornmayer@web.de, wittek@mppmu.mpg.de}}
+
+\date{ \today}
+\TDAScode{MAGIC-TDAS 01-??\\ ??????/W.Wittek}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%% title %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\maketitle
+
+%% abstract %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\begin{abstract}
+
+\end{abstract}
+
+%% contents %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\thetableofcontents
+
+\newpage
+
+%% body %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%------------------------------------------------------------
+\section{Aim of this paper}
+The aim of this paper is to describe the procedure to obtain the
+absolute energy spectrum of a point source from the data taken with
+MAGIC. This includes work on Mont Carlo (MC) data and the analysis of
+the real data.
+
+Various steps in the procedure will depend on details of the MC
+generation, on the way the real data are taken, etc.. These details
+have therefore to be specified, which is done in Section 2.
+
+In Section 3 some basic definitions and formulas are collected in
+order to avoid any misunderstanding of the meaning of frequently
+used terms.
+
+Section 4 describes the MC work and Section 5 the actual analysis of
+the real data.
+
+One aim of this paper is also to define jobs for those who want to
+join the activities in the software developments. As will be seen, the
+main ingredients both for the MC work and the real data analysis are
+available. However, certain parts have yet to be implemented, others
+have to be changed, modified, improved or extended. Last not least
+extensive tests have to be performed.
+
+
+
+\section{Assumptions}
+The assumptions for a 'standard analysis' listed below are the result of
+discussions in the software group. Some of them are rather arbitrary. 
+They should by no means be
+understood as final or optimal choices. They should be considered as a
+starting point. As our experience with the analysis grows we may
+have to revise some of the assumptions.
+
+The aim in all what follows is to define a strategy that is as simple 
+and robust as possible. Tests that have yet to be performed will tell
+us whether the assumptions are reasonable and realistic.
+
+The assumptions are :
+
+\begin{itemize}
+\item Mode of observation :\\
+Data are taken in the wobble mode (\cite{konopelko99}). 
+This means that the telescope is
+directed not to the position of the selected source but rather to a
+position which has a certain offset ($\Delta\beta$) from the source
+position. Every 20 minutes of observation the sign of $\Delta\beta$ is 
+changed. The two wobble positions are called wobble position 1 and 2.
+
+$\Delta \beta$ may be chosen to be a direction difference 
+in celestial coordinates
+(declination $\delta$, right ascension $\Phi$) or in local coordinates
+(zenith angle $\Theta$, azimuthal angle $\phi$).
+However the direction $\Delta \beta$ is defined,
+the sky region projected onto the camera is different for
+wobble positions 1 and 2. 
+
+If $\Delta \beta$ is defined to be a direction difference 
+in celestial coordinates,
+the sky region projected onto the camera for a fixed wobble position 
+remains the same during tracking of a source, although the sky image 
+is rotating in the camera.
+
+If $\Delta \beta$ is defined to be a direction difference 
+in local coordinates,
+the sky region projected onto the camera is changing continuously 
+during tracking of a source. The centers of the projected sky regions
+lie on a circle, which is centered at the source position.
+
+If $\Delta \beta$ is defined to be a direction difference 
+in the local azimuthal 
+angle $\phi$, the center of the camera and the source position
+would always have the same zenith angle $\Theta$. Since the reconstruction
+efficiency of showers mainly depends on $\Theta$, this may be an
+advantage of defining $\Delta \beta$ in this way.
+
+The wobble mode has to be understood as an alternative to taking on-
+and off-data in separate runs. Choosing the wobble mode thus implies
+that one is taking on-data only, from which also the 'off-data' have to be
+obtained by some procedure.
+
+We propose to define $\Delta \beta$ as a direction difference in the
+local azimuthal angle $\phi$ :
+$\Delta \phi\;=\;\Delta \beta\;/\;sin(\Theta)$. For very small
+$\Theta$ ($\Theta\;<\; 1$ degree) $\Delta \beta$ should be defined
+differently, also to avoid large rotation speeds of the telescope.
+
+Since the radius of the trigger area is 0.8 degrees, we propose 
+to choose $\Delta \beta\;=\;0.4$ degrees.
+ 
+
+\item Pedestals :\\
+Pedestals and their fluctuations are not determined from triggered
+showers but rather from pedestal events. The pedestal events are taken 
+'continuously' at a constant rate of 5 Hz. In this way the pedestals
+and their fluctuations are always up to date, and the presence of
+stars and their position in the camera can be monitored continuously.
+
+\item Gamma/hadron separation :\\
+It is assumed that it is possible to define a gamma/hadron separation
+which is independent 
+ \begin{itemize}
+ \item[-] of the level of the light of the night sky (LONS)
+ \item[-] of the presence of stars in the field of view (FOV) of the camera
+ \item[-] of the orientation of the sky image in the camera
+ \item[-] of the source being observed
+ \end{itemize}
+
+It has yet to be proven that this is possible. The corresponding
+procedures have to be developed, which includes a proper treatment of the
+pedestal fluctuations in the image analysis. 
+
+The gamma/hadron separation will be given in terms of a set of cuts
+(or certain conditions) on quantities which in general are not
+identical to the measured quantities but which are derived from them. The
+measurable quantities are :
+ \begin{itemize}
+ \item[-] the direction $\Theta$ and $\phi$ the telescope is pointing to
+ \item[-] the image parameters
+ \item[-] the pedestal fluctuations 
+ \end{itemize}
+
+Under the above assumption the only dependence to be considered for
+the collection areas (see Section 3) is the dependence on the type of
+the cosmic ray particle (gamma, proton, ...), on its energy and on the
+zenith angle $\Theta$.
+
+It has to be investigated whether also the azimuthal angle $\phi$ has to be
+taken into account, for example because of influences from the earth
+magnetic field.
+
+\item Trigger condition :\\
+
+\item Standard analysis cuts :\\ 
+ 
+\end{itemize}
+
+
+\section{Definitions and formulas}
+\subsection{Definitions}
+
+\begin{itemize} 
+\item The direction $(\Theta,\phi)$ :\\
+$(\Theta,\phi)$ denotes the direction the telescope is pointing to,
+not the position of the source being observed.
+
+\item Image parameters :\\
+The standard definition of the image parameters is assumed. See for
+example \cite{hillas85,fegan96,reynolds93}. We should also make use of
+additional parameters like asymmetry parameters, number of islands or
+mountains etc.
+\end{itemize}
+ 
+Quantities which are not directly measurable, but which can be
+estimated from the image parameters are :
+
+\begin{itemize} 
+\item Impact parameter :\\
+The impact parameter $p$ is defined as the vertical distance 
+of the telescope from the shower axis. 
+
+\item The energy of the shower
+\end{itemize}
+
+
+\subsection{Formulas}
+\subsubsection{Differential gamma flux and collection area for a point source}
+
+The differential gamma flux from a point source $s$ is given by
+
+\begin{eqnarray}
+\Phi^{\gamma}_s(E)\;=\;\dfrac{dN^{\gamma}_s}{dE \cdot dF \cdot dt} 
+\end{eqnarray} 
+
+where $dN^{\gamma}_s$ is the number of gammas from the source $s$ in
+the bin $dE,\;dF,\;dt$ of energy, area and time respectively. We
+denote the probability for 'observing' a gamma shower with energy
+$E$, zenith angle $\Theta$ and position $F$ in a plane perpendicular
+to the source direction by $R^{\gamma}(E,\Theta,F)$. Depending on the
+special study, the term 'observing' may mean triggering,
+reconstructing, etc. 
+
+The effective collection area is defined as
+
+\begin{eqnarray}
+F^{\gamma}_{eff}(E,\Theta)\;  &=  &\int R^{\gamma}(E,\Theta,F)\cdot dF  
+\label{eq:form-1}
+\end{eqnarray} 
+
+A side remark : The well known behaviour that the effective collection 
+area (well above the threshold energy) is larger for larger zenith angles
+$\Theta$, is due to the fact that at higher $\Theta$ the distance of
+the shower maximum (where the majority of Cherenkov photons is
+emitted) from the detector is larger than at smaller $\Theta$. The
+area in which $R^{\gamma}(E,\Theta,F)$ contributes significantly to
+the integral (\ref{eq:form-1}) is therefore larger, resulting in a
+larger $F^{\gamma}_{eff}(E,\Theta)$. For the simulation this means,
+that the maximum impact parameter should be chosen larger for larger $\Theta$.
+
+The number of $\gamma$ showers observed in the bin $\Delta \Theta$ of
+the zenith angle and in the bin $\Delta E$ of the energy is
+then :
+
+\begin{eqnarray}
+\Delta N^{\gamma,obs}_s(E,\Theta)  &= &\int R^{\gamma}(E,\Theta,F) \cdot
+ \Phi^{\gamma}_s(E) \cdot dE \cdot dF \cdot dt \\
+                                   &= &\Delta T_{on}(\Theta) \cdot
+ \int_{\Delta E}{} \Phi^{\gamma}_s(E)\cdot
+ F^{\gamma}_{eff}(E,\Theta)\cdot dE \\
+\end{eqnarray} 
+
+Assuming that $F^{\gamma}_{eff}(E,\Theta)$ depends only weakly on $E$
+in the (sufficiently small) interval $\Delta E$ gives
+
+\begin{eqnarray}
+\Delta N^{\gamma,obs}_s(E,\Theta)  
+                         &\approx   &\Delta T_{on}(\Theta) \cdot 
+  F^{\gamma}_{eff}(E,\Theta) \cdot \int_{\Delta E}{}
+ \Phi^{\gamma}_s(E)\cdot dE               \label{eq:form0}\\
+                         &\approx   &\Delta T_{on}(\Theta) \cdot 
+  F^{\gamma}_{eff}(E,\Theta) \cdot \Delta E \cdot 
+  \overline{\Phi^{\gamma}_s}(E)       \label{eq:form1}
+\end{eqnarray} 
+
+Here $\Delta T_{on}(\Theta)$ is the effective on-time for the data
+taken in the zenith angle bin $\Delta \Theta$ and $\overline{\Phi^{\gamma}_s}(E)$
+is the average differential gamma flux in the energy bin $\Delta E$ :
+
+\begin{eqnarray}
+\overline{\Phi^{\gamma}_s}(E)  &=  
+                     &\dfrac{1}{\Delta E}\;\int_{\Delta E}{}
+                     \Phi^{\gamma}_s(E)\cdot dE
+\end{eqnarray} 
+
+By inverting equation (\ref{eq:form1}) and setting 
+$\Delta E\;=\;(E^{up}-E^{low})\;\;\;\;\overline{\Phi^{\gamma}_s}(E)$ can
+be written as
+
+\begin{eqnarray}
+  \overline{\Phi^{\gamma}_s}(E)    &=
+  &\dfrac{\Delta N^{\gamma,obs}_s(E,\Theta)}  
+{\Delta T_{on}(\Theta) \cdot F^{\gamma}_{eff}(E,\Theta) \cdot 
+ (E^{up}-E^{low}) }
+ \label{eq:form2}
+\end{eqnarray} 
+
+By means of equation (\ref{eq:form2}) $\overline{\Phi^{\gamma}_s}(E)$
+can be determined
+from the measured $\Delta N^{\gamma,obs}_s(E,\Theta)$ and 
+$\Delta T_{on}(\Theta)$, using the collection area
+$F^{\gamma}_{eff}(E,\Theta)$, which is obtained from MC data.
+
+Equation (\ref{eq:form2}) is for a limited and fixed region of
+the zenith angle. One may calculate $\overline{\Phi^{\gamma}_s}(E)$ from the
+data taken at all $\Theta$, in which case
+
+\begin{eqnarray}
+  \overline{\Phi^{\gamma}_s}(E)    &=
+  &\dfrac{\sum_i\Delta N^{\gamma,obs}_s(E,\Theta_i)}  
+         {\sum_i\Delta T_{on}(\Theta_i) \cdot F^{\gamma}_{eff}(E,\Theta_i)
+          \cdot (E^{up}_i-E^{low}_i) }
+ \label{eq:form3}
+\end{eqnarray} 
+
+If a fixed spectral index $\alpha$ is assumed for the differential 
+source spectrum
+
+\begin{eqnarray}
+ \Phi^{\gamma}_s(E)  &=  &\Phi^{\gamma}_0 \cdot 
+                       \left(\dfrac{E}{GeV}\right)^{-\alpha}
+\end{eqnarray} 
+
+one gets
+
+\begin{eqnarray}
+ \int_{\Delta E}{} \Phi^{\gamma}_s(E) \cdot dE  &=  
+ &\dfrac{\Phi^{\gamma}_0}{1-\alpha} 
+  \left[ \left(\dfrac{E^{up}} {GeV}\right)^{1-\alpha} -
+         \left(\dfrac{E^{low}}{GeV}\right)^{1-\alpha} \right]\cdot GeV 
+ \label{eq:form4}
+\end{eqnarray} 
+
+Inserting (\ref{eq:form4}) into (\ref{eq:form0}) yields
+
+\begin{eqnarray}
+  \Phi^{\gamma}_0    &=
+  &\dfrac{\Delta N^{\gamma,obs}_s(E,\Theta)}  
+         {\Delta T_{on}(\Theta) \cdot F^{\gamma}_{eff}(E,\Theta)
+          \cdot 
+  \left[ \left(\dfrac{E^{up}} {GeV}\right)^{1-\alpha} -
+         \left(\dfrac{E^{low}}{GeV}\right)^{1-\alpha} \right]} 
+  \cdot \dfrac{1-\alpha}{GeV}
+  \label{eq:form5}
+\end{eqnarray} 
+
+which by summing over all $\Theta$ bins gives
+
+\begin{eqnarray}
+  \Phi^{\gamma}_0    &=
+  &\dfrac{\sum_i\Delta N^{\gamma,obs}_s(E,\Theta_i)}  
+         {\sum_i\Delta T_{on}(\Theta_i) \cdot F^{\gamma}_{eff}(E,\Theta_i)
+          \cdot 
+  \left[ \left(\dfrac{E^{up}_i} {GeV}\right)^{1-\alpha} -
+         \left(\dfrac{E^{low}_i}{GeV}\right)^{1-\alpha} \right]} 
+  \cdot \dfrac{1-\alpha}{GeV}
+  \label{eq:form6}
+\end{eqnarray} 
+
+If applied to MC data, for which $\overline{\Phi^{\gamma}_s}(E)$ is known,
+equation (\ref{eq:form1}) can also be used to
+determine the collection area $F^{\gamma}_{eff}(E,\Theta)$ : 
+
+\begin{eqnarray}
+F^{\gamma}_{eff}(E,\Theta)  &=  
+ &\dfrac{\Delta N^{\gamma,MC,reconstructed}_s(E,\Theta)}
+        {\Delta T_{on}(\Theta) \cdot \overline{\Phi^{\gamma}_s}(E) \cdot
+         (E^{up}-E^{low})}
+\end{eqnarray} 
+
+This procedure of determining $F^{\gamma}_{eff}(E,\Theta)$ amounts to
+performing the integration in equation (\ref{eq:form-1}) by MC. An
+important precondition is that in the MC simulation all gamma showers for
+which $R^{\gamma}(E,\Theta,F)$ is greater than zero were
+simulated. This means in particular that the MC simulation of gammas 
+extends to sufficiently large impact parameters. In reality, in order to save
+computer time showers will be generated up to a maximum
+value of the impact parameter (possibly depending on the zenith
+angle). An appropriate correction for that has to be applied later in
+the analysis.
+
+Knowing $F^{\gamma}_{eff}(E,\Theta)$, the gamma fluxes can be obtained
+from the experimental data using equation (\ref{eq:form2}),
+(\ref{eq:form3}), (\ref{eq:form5}) or (\ref{eq:form6}).
+
+Of course, the MC data sample used for calculating 
+$F^{\gamma}_{eff}(E,\Theta)$ and the experimental data sample used for
+determining the gamma flux by means of $F^{\gamma}_{eff}(E,\Theta)$
+have to be defined identically in many respects : in particular
+the set of cuts
+and the offset between source position and telescope orientation have
+to be the same in the MC data and the experimental data sample.
+
+
+ 
+\subsubsection{Differential flux and collection area for
+hadronic cosmic rays}
+
+In the case of hadronic cosmic rays, which arrive from all directions 
+$\Omega$, the differential hadron flux is given by
+
+\begin{eqnarray}
+\Phi^{h}(E)\;=\;\dfrac{dN^{h}}{dE \cdot dF \cdot dt \cdot d\Omega} 
+\label{eq:form-12}
+\end{eqnarray} 
+
+
+In contrast to (\ref{eq:form-1}) the effective collection area for hadrons
+is defined as
+
+\begin{eqnarray}
+F^{h}_{eff}(E,\Theta)\;  &=  &\int R^{h}(E,\Theta,F,\Omega)\cdot dF
+ \cdot d\Omega  
+\label{eq:form-11}
+\end{eqnarray} 
+
+Note that for a fixed orientation of the telescope $(\Theta,\phi)$ the
+hadrons are coming from all directions $\Omega$. The reconstruction
+efficiency $R^h(E,\Theta,F,\Omega)$ of hadrons therefore depends also
+on $\Omega$.
+
+With the definitions (\ref{eq:form-12}) and (\ref{eq:form-11})
+very similar formulas are obtained for hadrons as
+were derived for photons in the previous section. For clarity they
+are written down explicitely :
+
+\begin{eqnarray}
+\Delta N^{h,obs}(E,\Theta)  &= &\int R^{h}(E,\Theta,F) \cdot
+ \Phi^{h}(E) \cdot dE \cdot dF \cdot dt \\
+                                   &= &\Delta T_{on}(\Theta) \cdot
+ \int_{\Delta E}{} \Phi^{h}(E)\cdot
+ F^{h}_{eff}(E,\Theta)\cdot dE \\
+\end{eqnarray} 
+
+\begin{eqnarray}
+\Delta N^{h,obs}(E,\Theta) 
+                         &\approx   &\Delta T_{on}(\Theta) \cdot 
+  F^{h}_{eff}(E,\Theta) \cdot \int_{\Delta E}{}
+ \Phi^{h}(E)\cdot dE               \label{eq:form10}\\
+                         &\approx   &\Delta T_{on}(\Theta) \cdot 
+  F^{h}_{eff}(E,\Theta) \cdot \Delta E \cdot 
+  \overline{\Phi^{h}}(E)       \label{eq:form11}
+\end{eqnarray} 
+
+
+\begin{eqnarray}
+\overline{\Phi^{h}}(E)  &=  
+                     &\dfrac{1}{\Delta E}\;\int_{\Delta E}{}
+                     \Phi^{h}(E)\cdot dE
+\end{eqnarray} 
+
+
+\begin{eqnarray}
+  \overline{\Phi^{h}}(E)    &=
+  &\dfrac{\Delta N^{h,obs}(E,\Theta)}  
+{\Delta T_{on}(\Theta) \cdot F^{h}_{eff}(E,\Theta) \cdot 
+ (E^{up}-E^{low}) }
+ \label{eq:form12}
+\end{eqnarray} 
+
+
+
+\begin{eqnarray}
+  \overline{\Phi^{h}}(E)    &=
+  &\dfrac{\sum_i\Delta N^{h,obs}(E,\Theta_i)}  
+         {\sum_i\Delta T_{on}(\Theta_i) \cdot F^{h}_{eff}(E,\Theta_i)
+          \cdot (E^{up}_i-E^{low}_i) }
+ \label{eq:form13}
+\end{eqnarray} 
+
+
+\begin{eqnarray}
+ \Phi^{h}(E)  &=  &\Phi^{h}_0 \cdot 
+                       \left(\dfrac{E}{GeV}\right)^{-\beta}
+\end{eqnarray} 
+
+
+\begin{eqnarray}
+ \int_{\Delta E}{} \Phi^{h}(E) \cdot dE  &=  
+ &\dfrac{\Phi^{h}_0}{1-\beta} 
+  \left[ \left(\dfrac{E^{up}} {GeV}\right)^{1-\beta} -
+         \left(\dfrac{E^{low}}{GeV}\right)^{1-\beta} \right]\cdot GeV 
+ \label{eq:form14}
+\end{eqnarray} 
+
+
+\begin{eqnarray}
+  \Phi^{h}_0    &=
+  &\dfrac{\Delta N^{h,obs}(E,\Theta)}  
+         {\Delta T_{on}(\Theta) \cdot F^{h}_{eff}(E,\Theta)
+          \cdot 
+  \left[ \left(\dfrac{E^{up}} {GeV}\right)^{1-\beta} -
+         \left(\dfrac{E^{low}}{GeV}\right)^{1-\beta} \right]} 
+  \cdot \dfrac{1-\beta}{GeV}
+  \label{eq:form15}
+\end{eqnarray} 
+
+
+\begin{eqnarray}
+  \Phi^{h}_0    &=
+  &\dfrac{\sum_i\Delta N^{h,obs}(E,\Theta_i)}  
+         {\sum_i\Delta T_{on}(\Theta_i) \cdot F^{h}_{eff}(E,\Theta_i)
+          \cdot 
+  \left[ \left(\dfrac{E^{up}_i} {GeV}\right)^{1-\beta} -
+         \left(\dfrac{E^{low}_i}{GeV}\right)^{1-\beta} \right]} 
+  \cdot \dfrac{1-\beta}{GeV}
+  \label{eq:form16}
+\end{eqnarray} 
+
+
+Note that $\Phi^{h}(E)$, $\Phi^h_0$ and $F^{h}_{eff}(E,\Theta)$ differ
+from      $\Phi^{\gamma}(E)$, $\Phi^{\gamma}_0$ and 
+$F^{\gamma}_{eff}(E,\Theta)$ by the dimension of the
+solid angle, due to the additional factor $d\Omega$ in
+(\ref{eq:form-12}) and (\ref{eq:form-11}).
+
+Like in the case of gammas from point sources, the effective area 
+$F^h_{eff}(E,\Theta)$ for
+hadrons can be calculated by applying equation (\ref{eq:form11}) to MC
+data, for which $\overline{\Phi^h}(E)$ is known :
+
+\begin{eqnarray}
+F^{h}_{eff}(E,\Theta)  &=  
+ &\dfrac{\Delta N^{h,MC,reconstructed}(E,\Theta)}
+        {\Delta T_{on}(\Theta) \cdot \overline{\Phi^{h}}(E) \cdot
+         (E^{up}-E^{low})}
+\end{eqnarray} 
+
+Similar to the case of gammas from point sources,
+this procedure of determining $F^h_{eff}(E,\Theta)$ amounts to
+performing the integrations in equation (\ref{eq:form-11}) by MC. The
+precondition in the case of hadrons is that in the 
+MC simulation all hadron showers for
+which $R^{h}(E,\Theta,F,\Omega)$ is greater than zero were
+simulated. So the simulation should not only include large enough
+impact parameters but also a sufficiently large range of $\Omega$ at
+fixed orientation $(\Theta,\phi)$ of the telescope.
+
+Knowing $F^{h}_{eff}(E,\Theta)$, the hadron fluxes can be obtained
+from the experimental data using equation (\ref{eq:form12}),
+(\ref{eq:form13}), (\ref{eq:form15}) or (\ref{eq:form16}).
+
+
+\subsubsection{Measurement of the absolute differential flux of gammas 
+from a point source by normalizing to the flux of hadronic cosmic rays}
+
+In section 3.2.1 a procedure was described for measuring the absolute
+differential flux of gammas from a point source. The result for 
+$\overline{\Phi^{\gamma}_s}(E)$ depends on a reliable determination of
+the collection area $F^{\gamma}_{eff}(E,\Theta)$ by MC and the
+measurement of the on-time $\Delta T_{on}(\Theta)$.
+
+The dependence on the MC simulation may be reduced by normalizing to
+the known differential flux of hadronic cosmic rays. Combining
+equations (\ref{eq:form2}) and (\ref{eq:form12}), and assuming that
+$\Delta T_{on}(\Theta)$ is the same for the gamma and the hadron
+sample, yields
+
+\begin{eqnarray}
+\dfrac{\overline{\Phi^{\gamma}_s}(E)}
+      {\overline{\Phi^{h}}(E)}          &=  &
+\dfrac{\Delta N^{\gamma,obs}(E,\Theta)}
+      {\Delta N^{h,obs}(E,\Theta)}      \cdot
+\dfrac{F^{h}_{eff}(E,\Theta)}
+      {F^{\gamma}_{eff}(E,\Theta)}
+\label{eq:form20}
+\end{eqnarray} 
+
+If $\overline{\Phi^{h}}(E)$ is assumed to be known from other
+experiments, equation (\ref{eq:form20}) allows to determine 
+$\overline{\Phi^{\gamma}_s}(E)$ from
+the experimental number of gamma and hadron showers using the
+collection areas for gammas and hadrons from the MC. Since only the
+ratio of the collection areas enters the dependence on the
+MC simulation is reduced.
+
+If data from all zenith angles are to be used the corresponding
+expression for $\overline{\Phi^{\gamma}_s}(E)$ is (see equations
+(\ref{eq:form3}) and (\ref{eq:form13}))
+
+\begin{eqnarray}
+\dfrac{\overline{\Phi^{\gamma}_s}(E)}
+      {\overline{\Phi^{h}}(E)}          &=  &
+\dfrac{\sum_i \Delta N^{\gamma,obs}(E,\Theta_i)}
+      {\sum_i \Delta N^{h,obs}(E,\Theta_i)}      \cdot
+\dfrac{\sum_i \Delta T_{on}(\Theta_i) \cdot F^{h}_{eff}(E,\Theta_i) 
+                                      \cdot (E^{up}_i-E^{low}_i)}
+      {\sum_i \Delta T_{on}(\Theta_i) \cdot F^{\gamma}_{eff}(E,\Theta_i) 
+                                      \cdot (E^{up}_i-E^{low}_i)}
+\label{eq:form21}
+\end{eqnarray} 
+
+Clearly, the set of cuts defining the gamma sample is different from
+the set of cuts defining the hadron sample. However, 
+$\Delta N^{\gamma,obs}$ and $\Delta N^{h,obs}$ can still be measured 
+simultaneously, in which case $\Delta T_{on}(\Theta_i)$ is the same for
+the gamma and the hadron sample. Measuring gammas and hadrons
+simultaneously has the advantage that variations of the detector 
+properties or of the atmospheric conditions during the observation 
+partly cancel in (\ref{eq:form20}) and (\ref{eq:form21}).
+
+If fixed spectral indices $\alpha$ and $\beta$ are assumed for the 
+differential 
+gamma and the hadron fluxes respectively one obtains for the ratio
+$\Phi^{\gamma}_0\;/\;\Phi^h_0$
+(see (\ref{eq:form5}) and (\ref{eq:form15}))
+
+\begin{eqnarray}
+\dfrac{\Phi^{\gamma}_0}
+      {\Phi^{h}_0}          &=  &
+\dfrac{\Delta N^{\gamma,obs}(E,\Theta)}
+      {\Delta N^{h,obs}(E,\Theta)}      \cdot
+\dfrac{F^{h}_{eff}(E,\Theta) \cdot
+  \left[ \left(\dfrac{E^{up}} {GeV}\right)^{1-\alpha} -
+         \left(\dfrac{E^{low}}{GeV}\right)^{1-\alpha} \right]} 
+      {F^{\gamma}_{eff}(E,\Theta)
+  \left[ \left(\dfrac{E^{up}} {GeV}\right)^{1-\beta} -
+         \left(\dfrac{E^{low}}{GeV}\right)^{1-\beta} \right]} \cdot
+\dfrac{1-\beta}{1-\alpha}
+\label{eq:form22}
+\end{eqnarray} 
+
+or, when using the data from all zenith angles,
+(see (\ref{eq:form6}) and (\ref{eq:form16}))
+
+\begin{eqnarray}
+\dfrac{\Phi^{\gamma}_0}
+      {\Phi^{h}_0}          &=  &
+\dfrac{\sum_i\Delta N^{\gamma,obs}(E,\Theta_i)}
+      {\sum_i\Delta N^{h,obs}(E,\Theta_i)}      \cdot
+\dfrac{\sum_i F^{h}_{eff}(E,\Theta_i) \cdot
+  \left[ \left(\dfrac{E^{up}_i} {GeV}\right)^{1-\alpha} -
+         \left(\dfrac{E^{low}_i}{GeV}\right)^{1-\alpha} \right]} 
+      {\sum_i F^{\gamma}_{eff}(E,\Theta_i)
+  \left[ \left(\dfrac{E^{up}_i} {GeV}\right)^{1-\beta} -
+         \left(\dfrac{E^{low}_i}{GeV}\right)^{1-\beta} \right]} \cdot
+\dfrac{1-\beta}{1-\alpha}
+\label{eq:form23}
+\end{eqnarray} 
+
+
+
+% &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
+% &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
+% &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
+
+
+\section{MC work}
+
+\subsection{Overview of the MC and analysis chain}
+
+After a few iterations to improve the programs in speed, 
+reliability, ... there is a sample of available programs 
+to simulate the behaviour of the MAGIC telescope. 
+Due to the big amount of diskspace needed for this simulation
+it was decided, that not only one program will generate 
+the MAGIC telescope, but a subsequent chain of different 
+programs. In figure \ref{MC_progs} you can see a overview of 
+the existing programs and their connections. 
+\begin{figure}[h]
+\setlength{\unitlength}{1.cm}
+  \begin{picture}(18.,12.)
+	\put (0., 0.){\framebox(18.,12.){}}
+
+	\put (1, 11.5){{\sl Air shower programs}}
+	\put (1., 10.){\framebox(3.,1.){MMCS}}
+	\put (2., 10.){\vector(0,-1){.9} }
+	\put (1., 8.){\framebox(3.,1.){reflector}}
+	\put (2., 8.){\vector(0,-1){.9}}
+
+	\put (6, 10.){{\sl star background programs}}
+	\put (6.,8.){\framebox(3.,1.){starresponse}}
+	\put (6., 8.){\line(0, -1){1.5}}
+	\put (10.,8.){\framebox(3,1){starfieldadder}}
+	\put (10., 8.){\line(0, -1){1.5}}
+	\put (10., 6.5){\vector(-1,0){6.} }
+
+	\put (1., 6.){\framebox(3.,1.){camera}}
+	\put (2., 6.){\vector(3,-1){5.} }
+
+	
+	
+	\put (14, 11.5){{\sl real data programs}}
+	\put (14, 8.){\framebox(3,1){MAGIC DAQ}}	
+	\put (15, 8.){\vector(0,-1){.9} }
+	\put (14, 6.){\framebox(3.,1.){MERPP}}	
+	\put (15., 6.){\vector(-3,-1){5.} }
+	
+	\put (8.75, 3.7){\oval(4.,1.)}	
+	\put (7., 3.5){MAGIC root file}	
+	\put (8., 3.2){\vector(0, -1){1.0}}
+
+	\put (7, 1.){\framebox(3.,1.){MARS}}
+
+	\thicklines
+	\put (5., 11.){\line(0, -1){6.5}}	
+	\put (13., 12.){\line(0, -1){7.5}}	
+
+  \end{picture}  
+\caption{Overview of the existing programs in the MC of
+MAGIC.}
+\label{MC_progs} 
+\end{figure} 
+A detailed description of the properties of the different programs can be found
+in section \ref{sec_exist_progs}. 
+From that diagram you can see the following features of the simulation and
+analysis chain of MAGIC.  
+\begin{enumerate} 
+  \item The simulation of Air showers and the simulation of the night sky 
+	background (NSB) is seperated.  
+
+  \item The NSB is seperated in two parts, the contribution from the starfield
+	and from a diffuse part. 
+
+  \item To speed up the production the starresponse program creates a databases 
+	for stars of different magnitude. 
+
+  \item The join of air showers and NSB is done in the camera program. 
+
+  \item The analysis of MC \underline{and} real data will be done with only one program. 
+	This program is called MARS (Magic Analysis and Reconstruction Software). 
+	The output of the camera program from Monte Carlo data and the output of 
+	the MERPP (MERging and PreProcessing) program for the real data are the same. 
+	So there is no need to use different programs for the analysis. The file 
+	generated by this program used the root package from CERN for data storage. 
+\end{enumerate} 
+In this section we will only describe the usage of the Monte Carlo programs. The 
+descriptions of the MERPP and MARS can be found somewhere else\footnote{Look on the 
+MAGIC home page for more information.}. 
+
+\subsection{Existing programs} 
+\label{sec_exist_progs}
+\subsubsection{MMCS - Magic Monte Carlo Simulation} 
+ 
+This program is based on a CORSIKA simulation. It is used to generate
+air showers for the MAGIC telecope. At the start one run of the 
+program, one has to define the details of the simulation. 
+One can specify the following parameters of an shower 
+(see also figure \ref{pic_shower}): 
+%
+\begin{enumerate}
+  \item the type of the particles in one run ($PartID$)
+  \item the energy range of the particles ($E_1, E_2$) 
+  \item the slope of the Energy spectra 
+  \item the range of the shower core on the ground $r_{core}$. 
+  \item the direction of the shower by setting the range of 
+	zenith angle ($\Theta_1, \Theta_2$) and 
+	azimuth angle  ($\phi_1, \phi_2$)
+\end{enumerate}
+%
+\begin{figure}[h]
+\setlength{\unitlength}{1.5cm}
+\begin{center} 
+  \begin{picture}(9.,6.)
+	\put (0., 0.){\framebox(9.,6.){}}
+
+	\thicklines
+	% telescope
+	\put (5., .5){\oval(.75, .75)[t]} 
+	\put (3., 1.){{\sl Telesope position}}	
+	\put (4.5, 1.){\vector(1, -1){0.5}}
+	% observation level 
+	\put (.5, .5){\line(1, 0){8}}
+	\put (.5, .6){{\sl Observation level}}	
+
+	% air shower
+	\put (4. , 5.5 ){\line(2, -3){3.3}}
+	\put (4.5, 5.5 ){{\sl Particle Type ($PartId$)}}
+	\put (4.5, 5.25){{\sl Energy ($E_1 < E < E_2$)}}
+	\put (4.5, 5.  ) {$\Theta_1 < \Theta < \Theta_2$}
+	\put (4.5, 4.75) {$\phi_1 < \phi < \phi_2$}
+	\put (7.5, .75){{\sl shower core}}
+	
+	\thinlines
+	\put (5., .25){\line(1,0){2.3}} 
+	\put (6.1, .25){{\sl $r_{Core}$}}
+	
+	\put (5., .5){\line(4,3){1.571}} 	
+	\put (6., 1.35){{\sl $p$}}
+
+  \end{picture}  
+\end{center} 
+  \caption {The parameter of an shower that are possible to define
+at the begin of an MMCS run.}
+\label{pic_shower} 
+\end{figure} 
+Other parameters, that will be important in the analysis later,
+can be calculated. I.e. the impact parameter $p$ is defined by 
+the direction 
+of the shower ($\Theta, \phi$) and the core position 
+($x_{core}, y_{core}$). 
+
+The program MMCS will track the whole shower development 
+through the atmosphere. All the cerenkov particles that hit a 
+sphere around the telesope (in the figure \ref{pic_shower} 
+drawn as the circle around the telecope position) are stored 
+on disk. It is important to recognize, that up to now no 
+information of the pointing of the telescope was taking into
+account.  
+This cerenkov photons are the input for the next program, 
+called reflector. 
+
+
+\subsubsection{reflector} 
+
+The aim of the reflector program is the 
+tracking of the cerenkov photons to the camera 
+of the MAGIC telescope. So this
+is the point where we introduce a specific pointing of 
+the telescope ($\Theta_{MAGIC}, \phi_{MAGIC}$).
+For all cerenkov photons the program 
+tests if the mirrors are hitten, calculates the 
+probability for the reflection and tracks them to the 
+mirror plane. All the photons that are hitting the 
+camera are written to disk (*.rfl)  
+with their important parameters 
+($x_{camera}, y_{camera}, \lambda, t_{arrival}$). 
+These parameters are the input from the shower simulation
+for the next program in the 
+MC simulation chain, the camera program. 
+
+\subsubsection{camera} 
+
+The camera program simulates the behaviour of the 
+PMTs and the electronic of the trigger and FAC system. 
+For each photon out of the reflector file (*.rfl) the 
+camera program calculates the probability to generate
+an photo electron out of the photo cathode. If a photo
+electrons was ejected, this will create a signal in the 
+trigger and FADC system of the hitted pixel. 
+You have to specify the
+parameter of the signal shaping 
+(shape, Amplitude, FWHM of signal)
+at the beginning of the 
+camera, seperatly for the trigger and the FADC system. 
+All signal from all photoelectrons are superimposed for
+each pixel. As an example you can see the output of 
+the trigger and FADC system in figure \ref{fig_trigger_fadc}. 
+\begin{figure}[h]
+
+ \caption{The response of one shower from the trigger (left) and 
+fadc system (right).}
+\label{fig_trigger_fadc}
+\end{figure}
+
+All these analog signals going into the trigger system are used 
+to check if for a given event a trigger signal was generated or 
+not. But before the start of the camera program on also has to
+set a few parameters of the trigger system like: 
+\begin{itemize}
+  \item diskriminator threshold
+  \item mulitplicity
+  \item topology 
+\end{itemize} 
+With this set of parameter the camera program will analyse
+if one event has triggered. For the triggered event all the FADC
+content will be writen on the file (*.root). In addition all the 
+information about the event ($PartID, E, \Theta$,...) and 
+information of trigger (FirstLevel, SecondLevel, ..) are also 
+be written to the file.
+
+One of the nice features of the camera program is the possiblity
+so simulate the NSB, the diffuse and the star light part of it. 
+But before doing this, on has to start other programs 
+(called starresponse and starfieldadder) that are describe 
+below.
+
+\subsubsection{starresponse}
+
+This program will simulate the analog response for stars of
+a given brightness $B$. 
+
+
+\subsubsection{starfieldadder}
+
+
+
+
+
+
+
+\subsection{What to do} 
+
+\begin{itemize} 
+  \item pedestal fluctuations
+  \item trigger
+  \item rates (1st level, 2nd level, .... ) 
+  \item discriminator thresholds
+  \item Xmax
+  \item collection area
+  \item $\gamma$/h-Seperation
+  \item magnetic field studies ($\phi$-dependence) 
+  \item rotating star field
+\end{itemize} 
+
+
+
+\subsection{A suggestion for an initial workplan} 
+We propose in the following a list of tasks whose common goal
+it is to provide and use data files with a definition of data suitable for
+initial studies, e.g. trigger rates, and for subsequent further 
+analysis in MARS, e.g. $\gamma$/h-separation. We consider this list to be
+minimal and a first step only.
+Given the amount of work that will have to be invested, the detailed 
+assumptions below should be backed up by collaboration-wide agreement; also, some
+input from groups is essential, so PLEASE REACT. 
+ 
+Event generation should be done with the following conditions:
+\begin{itemize}
+  \item Signal definition: we will use the Crab, over a range of zenith angles
+  (define!!). A minimum of 20,000 (can we get that?) triggers will be 
+  generated, starting from existing MMCS files;
+  \item Observation mode: observations are assumed off-axis,
+  with an offset of $\pm 0.4 \deg $ in $\Delta \beta$ along the direction of the
+  local azimuthal angle $\phi$,
+  switching sign every 500 events (see 'Assumptions' above);
+  \item Adding star field: adapt starfieldadder and starresponse to the
+  Crab. Ignore star field rotation problems for the moment, until a separate study
+  is available (??);
+  \item Pedestal fluctuations: all pixel values are smeared by a Gaussian
+  centered at zero with a sigma of 1.5 photoelectrons;
+  \item Trigger:  Padova to define (!!) the grouping of pixels, the
+  trigger thresholds, and a method to avoid triggering on stars. We assume 
+  only a first-level trigger.
+\end{itemize}
+With this event sample available, we suggest to embark on several studies,
+which will help us in understanding better the MAGIC performance, and will
+also pave our way into future analysis.
+\begin{itemize}
+  \item determine trigger rates (1st level only), as function of energy and
+  zenith angle (also of impact parameter?);
+  \item determine gamma acceptance, 
+  as function of energy and zenith angle (also of impact parameter?);  
+  \item determine effective collection area (gammas and hadrons), 
+  as function of energy and zenith angle (also of impact parameter?);  
+  \item show the position of the shower maximum (Xmax);
+  \item start comparing methods for $\gamma$/h-separation, i.e. the generation
+  of ON and OFF samples from the observations;
+  \item start magnetic field studies ($\phi$-dependence); 
+  \item eventually, study the effect of the rotating star field.
+\end{itemize} 
+
+
+
+\section{Analysis of the real data}
+
+\begin{thebibliography}{xxxxxxxxxxxxxxx}
+\bibitem{fegan96}D.J.Fegan, Space Sci.Rev. 75 (1996)137
+\bibitem{hillas85}A.M.Hillas, Proc. 19th ICRC, La Jolla 3 (1985) 445
+\bibitem{konopelko99}A.Konopelko et al., Astropart. Phys. 10 (1999)
+275
+\bibitem{reynolds93}P.T.Reynolds et al., ApJ 404 (1993) 206
+\end{thebibliography}
+
+
+\end{document}
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%% Upper-case    A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
+%%% Lower-case    a b c d e f g h i j k l m n o p q r s t u v w x y z
+%%% Digits        0 1 2 3 4 5 6 7 8 9
+%%% Exclamation   !           Double quote "          Hash (number) #
+%%% Dollar        $           Percent      %          Ampersand     &
+%%% Acute accent  '           Left paren   (          Right paren   )
+%%% Asterisk      *           Plus         +          Comma         ,
+%%% Minus         -           Point        .          Solidus       /
+%%% Colon         :           Semicolon    ;          Less than     <
+%%% Equals        =           Greater than >          Question mark ?
+%%% At            @           Left bracket [          Backslash     \
+%%% Right bracket ]           Circumflex   ^          Underscore    _
+%%% Grave accent  `           Left brace   {          Vertical bar  |
+%%% Right brace   }           Tilde        ~
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Local Variables:
+%% mode:latex
+%% mode:font-lock
+%% mode:auto-fill
+%% time-stamp-line-limit:100
+%% End:
+%% EOF
+
+
+
+
+
+
+
+
+
