source: trunk/MagicSoft/Simulation/Detector/ReflectorII/doc/Tdas0211.tex@ 1722

Last change on this file since 1722 was 1722, checked in by moralejo, 22 years ago
*** empty log message ***
File size: 65.8 KB
Line 
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%%% magic-tdas.tex -- template to write MAGIC-TDAS documents
3%%%-----------------------------------------------------------------
4%%% Kopyleft (K) 2000 J C Gonzalez
5%%% Max-Planck-Institut fuer Physik,
6%%% Foehringer Ring 6, 80805 Muenchen, Germany
7%%% E-mail: gonzalez@mppmu.mpg.de
8%%%-----------------------------------------------------------------
9%%% This program is free software; you can redistribute, copy,
10%%% modify, use it and its documentation for any purpose,
11%%% provided that the above copyright notice appear in all
12%%% copies and that both that copyright notice and this
13%%% permission notice appear in supporting documentation.
14%%%
15%%% This piece of code is distributed in the hope that it will
16%%% be useful, but WITHOUT ANY WARRANTY; without even the
17%%% implied warranty of FITNESS FOR A PARTICULAR PURPOSE.
18%%%
19%%% Although you can actually do whatever you want with this
20%%% file (following the copyright notice above), your are
21%%% strongly encouraged NOT to edit directly this file.
22%%% Instead, make a copy and edit the copy for your purposes.
23%%%
24%%% Modifying thie original file means that you actually have
25%%% the (very basic) knowledge needed to make things by your
26%%% own, and therefore... you will not get _any_ additional
27%%% support :-)
28%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
29%%% Last update: Time-stamp: <Thu Mar 2 09:31:41 CET 2000>
30%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
31%
32\documentclass[12pt]{article}
33
34\usepackage{magic-tdas}
35\usepackage{amssymb}
36
37%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
38%% BEGIN DOCUMENT
39%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
40\begin{document}
41
42%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
43%% Please, for the formatting just include here the standard
44%% elements: title, author, date, plus TDAScode
45%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
46\title{ The Reflector simulation program v.0.6 }
47\author{A.Moralejo\\
48 \texttt{<moralejo@pd.infn.it>}}
49\date{January 20, 2003\\}
50\TDAScode{MAGIC-TDAS 02-11\\ 030120/AMoralejo}
51%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
52
53%% title %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
54\maketitle
55
56%% abstract %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57\begin{abstract}
58In this document we provide a brief description of Reflector program
59(version 0.6) and a guide to install and run it. Some of the
60information contained in this document is also present in MAGIC-TDAS
6102-05 dealing with the previous version of the program, but it has also
62been included here for clarity. Two important bugs regarding the
63ray-tracing routine have been corrected in this new version.
64\par
65NOTE: In December 2002, a first release of Reflector 0.6 was made,
66together with a first version of the present TDAS note. Immediately
67after that (too short a time to justify a new version number), some
68other changes were implemented in the program to improve the
69atmospheric absorption routines, and the dependence of mirror
70reflectivity with wavelength was introduced. This document is the
71manual of the final 0.6 version of the reflector, including
72explanations of these last modifications.
73
74\end{abstract}
75
76\newpage
77%% contents %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
78\thetableofcontents
79
80\newpage
81
82%% body %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
83
84%------------------------------------------------------------
85\section{Introduction}
86
87The Reflector program was originally written by Jose Carlos Gonz\'alez
88and then improved by Harald Kornmayer. The Reflector program reads in
89MMCS output files (cerxxxxxx files from corsika) and writes an output
90file with the information about all the photons which reach the
91telescope focal plane (taking into account atmospheric and mirror
92absorption) and which are within the camera radius defined in the file
93{\bf magic.def}. In September 2001 D. Bastieri and C. Bigongiari
94released a new version (v.0.4) to adapt the program to a format change
95in the MMCS output. In June 2002 the version 0.5 was released, with
96small changes in the ouput file format and some bug fixing (see TDAS
9702-05).
98\par
99The aim of releasing the present version 0.6 was in principle only to
100add some missing information in the output. However, the ray-tracing
101routine was checked in detail and some inconsistencies were
102found. As a result of this, an important bug was detected which
103produced a systematic blurring of all the images. Later another bug
104was found in the calculation of the photon arrival time on the
105camera.These bugs, fixed in this version, are discussed in detail in
106section \ref{notes}.
107
108%------------------------------------------------------------
109\section{Description of simulation \label{descrip}}
110
111The main steps of the simulation are:
112
113\begin{enumerate}
114
115\item Atmospheric absorption.
116
117\item Checking if the photon hits the dish.
118
119\item Aluminum absorption.
120
121\item Determination of the mirror hitted.
122
123\item Mirror reflection.
124
125\item Checking if the photon is inside the camera borders.
126
127\item Calculation of photon arrival time on camera.
128
129\end{enumerate}
130
131The reflection of each mirror element is simulated in a realistic way
132by introducing a gaussian spread of the reflected photons positions on
133the camera plane. The sigma of this PSF is defined via the
134{\bf point\_spread} parameter in the telescope description file {\bf
135magic.def}, and has a value of 0.5 cm, which corresponds approximately
136to the quality of the MAGIC mirrors produced up to date. Also the
137possible misalignment of mirror elements is simulated (see section
138\ref{neededfiles}).
139
140\section{Notes on version 0.6 \label{notes}}
141
142\subsection {First bug fixed in the ray tracing}
143
144The previous versions of the reflector were extensively checked and a
145strange behaviour was found in them. It is a well known fact (see for
146instance the discussions in the MAGIC design report) that, to focus a
147telescope on an object placed at a finite distance, one has to shift
148the camera plane {\it away} from the mirror dish, with respect to the
149position in which an object at infinity (a star) would be
150focused (see fig. \ref{colimation}). For instance, with a paraboloid
151of focal distance f = 1697 cm, an object placed 10 km above the
152telescope would be focused on a plane at $\simeq 1700$ cm from the
153dish (a distance measured along the telescope axis).
154%
155\begin{figure}[h!]
156 \begin{center}
157 \epsfig{file=eps/colimation.eps,width=0.7\textwidth}
158 \caption{To focus an object at a finite distance h, the camera plane
159must be moved away from the mirror a distance d, given by the formula
160on the right. For MAGIC, the shift is of around 3 cm for a source
161located 10 km above the telescope.\label{colimation}}
162 \end{center}
163\end{figure}
164%
165\par
166With reflector program up to version 0.5, and using the mirror
167parameters in the standard magic.def file, we found out just the
168opposite behaviour. We wrote a program to produce files with the same
169structure as the Corsika Cherenkov output, but containing photons from
170a point source. If we set the source at infinity, we found the best
171spot placing the camera at a distance of 1697 cm (this can be changed in
172the magic.def file via the {\it focal\_distance} parameter). We can
173see the resulting spot in fig. \ref{spot_inf_f1697}. A completely
174independent ray-tracing program was used to verify that this is the
175spot that a f/1 16.97 m $\varnothing$ tesellated paraboloid should produce.
176%
177\begin{figure}[h]
178 \begin{center}
179 \epsfig{file=eps/spot_inf_f1697.eps,width=0.85\textwidth}
180 \caption{Image of a point like source placed at infinity with
181Reflector 0.5 (units of x and y are cm). Camera plane placed at 1697 cm
182from the mirror. The circle on the left indicates (small) pixel
183size. On the right side, projections on x and y of the
184spot. \label{spot_inf_f1697}}
185 \end{center}
186\end{figure}
187%
188If we now
189place the source 10 km above the telescope, the best spot is achieved
190at 1694 cm from the dish, instead of the expected 1700 cm
191(figs. \ref{spot10kmf1700} and \ref{spot10kmf1694}). It must be
192noted that for these and the following checks we removed all the
193gaussian smearing which the program introduces to simulate the
194possible mirror misalignments and surface irregularities (by the way,
195a feature which somehow optimistically was not included in the
196simulations shown in the MAGIC proposal). In this way we can check
197just the ray tracing.
198%
199\begin{figure}[h!]
200 \begin{center}
201 \epsfig{file=eps/spot10kmf1700.eps,width=0.85\textwidth}
202 \caption{Image of a point like source placed 10 km above the
203telescope with Reflector 0.5 (units of x and y are cm). Camera plane
204placed at f = 1700 cm from the mirror. The fact that the spot is so large
205indicates a problem in the simulation, since with this camera position
206the telescope should be focused at 10 km (see
207fig. \ref{spot_inf_f1697}) and hence produce a spot similar to the one
208shown in fig. \ref{spot_inf_f1697}. The hole in the middle of the spot
209corresponds to the hole in the mirror dish, and indicates by itself a
210focusing problem.
211\label{spot10kmf1700}}
212 \end{center}
213\end{figure}
214%
215\begin{figure}[h!]
216 \begin{center}
217 \epsfig{file=eps/spot10kmf1694.eps,width=0.85\textwidth}
218 \caption{Image of a point like source placed 10 km above the
219telescope with Reflector 0.5 (units of x and y are cm). Camera plane
220placed at f = 1694 cm from the mirror. Now the spot is small, but the
221camera plane is not at the expected position (see text).
222\label{spot10kmf1694}}
223 \end{center}
224\end{figure}
225%
226\par
227In order to rule out a possible mistake in the generation of the
228``false'' Cherenkov files, we repeated the check using real Corsika
229files, and directly looking at shower images ($\Theta = 10^\circ$
230incident gammas with a Crab-like spectrum). We must bear in mind that
231the shower maximum for gammas of 100 GeV lies around 10 km above the MAGIC
232level. From the result we can clearly see that the images are best
233focused at 1694 cm (fig. \ref{evcompare}), therefore confirming the
234existence of a real problem in the reflector simulation.
235%
236\begin{figure}[p]
237 \begin{center}
238 \epsfig{file=eps/evcompare.eps,width=0.85\textwidth}
239 \caption{Gamma shower images obtained with Reflector 0.5 placing
240the camera at 1700 cm (left) and 1694 cm (right) from the mirror
241dish. Primary gammas at $\theta = 10^\circ$, E = 16, 46 and 232 GeV.
242\label{evcompare}}
243 \end{center}
244\end{figure}
245%
246\paragraph {Check of the mirror parameters in the magic.def file\\}
247In the standard magic.def file we have been using up to now, the
248spherical mirrors centers were found to be distributed on the surface
249of a f = 1700 cm paraboloid. Their curvature radii, though discretized
250in 8 ``zones'' as explained in the design report, corresponded in
251average to the local mean curvature radius of the same parabolic
252surface. However, their orientations were those corresponding to a f =
2531697 cm paraboloid. Personally I do not think this is something
254intended, and looks more like an error, but anyway we checked that this
255was not the reason for the problems in the ray tracing: a test
256magic.def file was created with {\it all} the mirror parameters
257(positions, orientations and radii of curvature)
258calculated as for a f = 1697 cm paraboloid, and no significant
259difference could be seen. That
260is: i) the individual mirror orientations are the dominant factor, and
261the overall dish in the old reflector behaved indeed like a f = 1697
262cm parabolic
263mirror, and ii) the bug must be somewhere else. Even though the error
264was not there, a new magic.def file has been produced containing the
265parameters for the 956 mirrors of the final MAGIC design (instead of
266the 920 mirrors foreseen in the beginning).
267%
268\paragraph {Solution of the problem\\}
269Finally, a check of the routines in {\it ph2cph.c} revealed that the
270reflector program was actually misinterpreting the information read
271from the Cherenkov file written by Corsika. In figure \ref{coorsystems}
272we can see the definition of Corsika's coordinate system (see also the
273Corsika manual). In it, the x axis points north and the z axis points
274up. The zenith angle $\Theta$ of a particle trajectory is measured
275between the particle momentum and the negative z-axis, and the
276azimuthal angle $\Phi$ between the positive x-axis and the x-y
277component of the particle momentum, counterclockwise (0 -
2782$\pi$). When the direction cosines of a particle's trajectory are
279given, they refer also to its momentum vector (a downgoing
280vector)\footnote{In Corsika the third component of the momentum is
281measured along the negative z-axis and this is probably the origin of
282the confusion which resulted in the bug}. The same is true for the
283Cherenkov photons.
284%
285\begin{figure}[h]
286 \begin{center}
287 \epsfig{file=eps/coorsystems.eps,width=\textwidth}
288 \caption{Coordinate systems of Corsika and MAGIC.\label{coorsystems}}
289 \end{center}
290\end{figure}
291%
292\begin{figure}[h!]
293 \begin{center}
294 \epsfig{file=eps/parabola.eps,width=0.6\textwidth}
295 \caption{Misunderstanding of photon direction cosines from Corsika
296by Reflector v 0.5 and older versions.\label{parabola}}
297 \end{center}
298\end{figure}
299%
300Unfortunately, in the output of Corsika, only the direction cosines
301(u, v) with respect to the x and y axis are given. These completely
302determine the particle's trajectory as long as one knows that they
303refer to a downgoing versor, in which case one gets the third
304direction cosine as $w = -\sqrt{1-u^2-v^2}$, with a minus sign. However,
305in {\it ph2cph.c} we found exactly the opposite (lines 116 to 118 in
306v.05):
307
308\begin{verbatim}
309 r[0] = ph->u;
310 r[1] = ph->v;
311 r[2] = (float) sqrt(1.0 - r[0]*r[0] - r[1]*r[1]);
312\end{verbatim}
313
314This means that the program was interpreting u and v as the direction
315cosines of the {\it upgoing} versor towards which one should ``look''
316to see the incoming photon. The situation is depicted in figure
317\ref{parabola}. The two vectors at the bottom left of the plot are the
318two possible interpretations of the direction cosines u and v. These
319vectors have the same u and v, and differ only in the sign of their
320third components w. As the figure illustrates, the reflector
321simulation, by taking the wrong (positive) sign of w, was transforming
322the light coming from a point source 10 km away, into a convergent
323light beam which was then focused at a distance (1694 cm),
324shorter than the focal length of the paraboloid, and produced a
325blurred image at the theoretically optimal distance (1700 cm). Of
326course a paralel beam of light was focused at the right distance (1697
327cm) since in that case u = v = 0, and both the upgoing and downgoing
328versors have the same direction.
329\par
330The example in figure \ref{parabola} shows the case in which the
331telescope is pointing at zenith. It is easy to see that if the
332telescope was pointing in an arbitrary direction a few degrees away
333from zenith, the fact of taking the wrong sign in the third direction
334cosine would spoil the reflection completely, to the point that the
335spot would lie outside the camera limits. However, this is not what we
336observed: when using the older reflector versions for different zenith
337angles the images were still contained in the camera. The explanation
338is that the transformation between Corsika's coordinates system and
339the telescope system was also wrong, since the angles $\Phi$ and
340$\Theta$ which indicate the telescope orientation (see fixed\_target
341option in section \ref{commands}) follow the same convention taken
342from Corsika: for instance, for pointing the telescope towards North
343we should set $\Phi = 180^\circ$, because that would be the $\Phi$
344value for a particle or photon coming from North (see again
345fig. \ref{coorsystems}, left). This wrong transformation of coordinates
346oriented the telescope in a way that the situation was always like the
347one shown in fig. \ref{parabola}, and the image was formed in the
348camera also for $\Theta > 0$, though also defocused.
349\par
350The telescope coordinate system shown in figure \ref{coorsystems}
351(right) has its z-axis along the telescope axis, and the origin in the
352center of the mirror dish. This system is used in the ray tracing
353routine of the reflector simulation. When the telescope points up
354($\Theta = \Phi = 0$) this system matches exactly the one in Corsika.
355The general transformation between both is a simple rotation,
356since for the sake of simplicity we assume in the simulation that the
357origins always coincide. As we have said, in Reflector v.05 or older the rotation
358matrix was wrong: it had been written assuming that ($\Phi$, $\Theta$)
359indicated the direction towards which the telescope pointed. Actually,
360for the reasons already exposed, the telescope must point to
361($\Phi +\pi$, $\Theta$). The function in charge of building the rotation
362matrix is {\it makeOmega} (a part of {\it ph2cph.c}), which is called
363from {\it reflector.c}. For the present version we have simply
364replaced $\Phi$ by $\Phi + \pi$ in the function call. The transformation of
365coordinates is shown in figure \ref{telecoor}, and can be seen as a
366rotation of angle $\Phi +\pi$ around the z axis of Corsika plus a
367rotation of angle $\Theta$ around the y'' axis of the telescope (the
368same way in which the real MAGIC points).
369%
370\paragraph {New coordinate system of the camera \label{newcoordi}}
371We have introduced another change in Reflector 0.6 regarding the
372coordinates. In versions up to 0.5 the coordinates ($x_{camera}$,
373$y_{camera}$) of the photon impact point on the camera plane were
374given in the telescope system (x'', y'', z'') described in
375fig. \ref{coorsystems}. This was a bit confusing (a rotation of the
376telescope in the zenith axis resulted in a displacement in x'' of the
377images), in particular it would have been messy when working in wobble
378mode. We have now adopted the camera coordinate system proposed in
379TDAS 01-05: when the observer is looking from the center of the
380reflector in the direction of the telescope axis (towards the camera)
381the $x_{camera}$ axis points horizontally to the right, and the
382$y_{camera}$ axis points upwards. It is trivial from figure
383\ref{telecoor} to see that the transformation needed to obtain these
384coordinates is: $x_{camera} = -y''$, $\:y_{camera} = -x''$. This has been
385added at the end of {\it ph2cph.c}.
386%
387\begin{figure}[h]
388 \begin{center}
389 \epsfig{file=eps/telecoor.eps,width=\textwidth}
390 \caption{Transformation of coordinates between the Corsika and
391MAGIC coordinate systems.\label{telecoor}}
392 \end{center}
393\end{figure}
394%
395\paragraph {How old was the ray-tracing bug?\\}
396%
397The bug was certainly present in versions 0.4 and 0.5, but may be even
398older. Nevertheless, there is no doubt that the reflector program used
399for the simulation shown in the MAGIC design report was working
400fine. Extensive proof
401of this is provided in an appendix of the design report. A plausible
402explanation could be that, up to some date, the data being read in by
403the reflector program (the Corsika output) contained direction cosines
404which really referred to the upgoing versors of the photon directions,
405and until then the program worked well. Then may be the output of
406Corsika was changed to its present form, and the change went unnoticed.
407The Corsika version used then was 4.52, whereas all further work has
408been done with Corsika 5.20 or later versions. The Corsika history
409file shows no record of any change in this respect, but given that we
410have always used a slightly modified Corsika, it would not be
411surprising if the Cherenkov output was modified at some point in the
412MAGIC version of Corsika (MMCS). There is no documentation on this, so
413if anyone has any relevant information, please make it public.
414%
415\paragraph {Influence of the bug on image analysis\\}
416The fixing of the bug (resulting in sharper images) will for sure
417improve the results of the image analysis, in particular with regard
418to gamma / hadron separation. This could in part explain the
419differences we have been observing in the expected performance of
420MAGIC with respect to what was foreseen in the design report. However,
421we note here again that in the simulation used there, not only was the
422reflector working well, but also no noise was introduced in the
423reflecting process. This was surely too optimistic, and it implies
424that it will be hard to reproduce those results using a more realistic
425approach which accounts for mirror imperfections. However, the
426introduction of the noise (fig. \ref{refl06images}) has a less
427dramatic effect than the defocusing which the bug was producing.
428%
429\subsection {Performance of ray-tracing in the new version}
430In figure \ref{coma} we show the images of a point-like source at 10
431km from the telescope, produced with the Reflector version 0.6,
432and using the new version of the magic.def file (see see next
433section). No noise has been introduced in the reflection, the observed
434spots are just the result of optical aberrations. The light source has
435been put at slightly different viewing angles
436from the telescope. The results are comparable to those in the design
437report, actually these are a bit better, the difference probably being
438that the focal lengths of the mirror tiles in the older magic.def file
439were discretized in only eight values, while now they change rather
440continuously. Some images of a point source at infinity (a star) can be
441seen in fig. \ref{coma_star}. We can see that for any incidence angle,
442the area within which 50$\%$ of the light is concentrated is smaller
443than that of a small pixel.
444\par
445In figure \ref{refl06images} the images of three gamma events ($\theta
446= 10^\circ$, E = 16, 46, 232 GeV), the same of fig. \ref{evcompare}
447are shown. They have been produced with Reflector 0.6 assuming perfect
448spherical mirrors (left) and realistic ones (right). The images look
449reasonable, much sharper than with the older versions, even when the
450mirror imperfections are taken into account.
451%
452\begin{figure}[h!]
453 \begin{center}
454 \epsfig{file=eps/timing.eps,width=\textwidth}
455 \caption{Test of reflector isochrony. The arrival time
456distributions of photons in the camera are shown for (buggy) Reflector
4570.5 and for Reflector 0.6. The sketch in the center shows the test for
458the case in which the light beam is paralel to the telescope axis
459(left plot). On the right, the same test has been made with light
460arriving 1 degree off axis.
461 \label{timing}}
462 \end{center}
463\vspace*{-1cm}
464\end{figure}
465%
466\subsection {Second bug: photon timing}
467%
468After a first release of Reflector 0.6 had been made public, another
469important bug was found. We tried to check whether the simulated
470reflecting dish was really ``isochronous''. A paralel beam of photons,
471all sharing the same arrival time on the ground, were processed by the
472simulation program and their arrival times on the camera plane were
473histogrammed. The result can be seen in fig. \ref{timing} (dashed
474histograms). This time the bug was quite evident: since Corsika gives
475us the arrival time of photons on ground, the path from the point
476where the photon hits the dish to the ground has to be subtracted (or
477added, because since the center of the dish in the MC is at $z = 0$,
478the mirror reflecting the photon may have $z < 0$ when the dish is
479inclined). The sign in this subtraction (in {\it ph2cph.c}) was
480wrong. This bug was present in both versions 0.5 and 0.4, and might
481be related to the other one (a change of orientation of the z axis
482at some point may have produced it). Since in the simulation made for
483the design report the timing played little or no role (the camera
484simulation did not consider the arrival times of photons) it is not
485possible to know whether the bug was already in the code by then.
486\par
487This bug means that all the studies made up to now regarding photon
488arrival times on the camera are completely useless (for instance, the
489optimization of the time parameters in the L1 trigger has to be redone
490from scratch!).
491%
492\subsection{The new magic.def file}
493A new magic.def file (see sect. \ref{neededfiles}) has been created
494and included in the Reflector 0.6 package. Now the number of
495individual mirror tiles is 956, matching
496the number and distribution of the final MAGIC design. The mirror
497centers and orientations are those corresponding to a paraboloid of
4981697 cm focal (hence the camera plane is placed at 1700 cm from the
499dish). The focal lengths have been calculated by R. Mirzoyan taking
500into account the so called ``shortening effect'' (see design report).
501A new axisdev.dat file (se again \ref{neededfiles}) with data for the
502956 mirrors is also included.
503%
504\subsection{The new reflectivity.dat file}
505Up to version 0.5 of the program, the reflectivity of the mirrors
506(which the program reads in from the file reflectivity.dat) was
507considered to be equal to $90\%$ for all wavelengths. Following
508measurements performed in Padua of a mirror sample, the reflectivity
509has been found to be between 80 and 90$\%$ in the range from 280 to 650 nm,
510with a dependence on wavelength which is shown in figure \ref{reflec}.
511%
512\begin{figure}[h!]
513 \begin{center}
514 \epsfig{file=eps/reflec.eps,width=0.7\textwidth,height=0.4\textwidth}
515 \caption{Reflectivity of the MAGIC telescope mirrors as a
516function of the wavelength of the incident light. The dip around 350
517nm is due to destructive interference of the light reflected on the
518aluminum plate with that reflected on the protective coating of the
519mirror. \label{reflec}}
520 \end{center}
521\end{figure}
522%
523\begin{figure}[p]
524 \begin{center}
525 \epsfig{file=eps/coma.eps,width=0.85\textwidth}
526 \caption{Reflector 0.6. Images of a point-like source at
52710 km from the telescope for different incident angles (from on-axis
528to 2 degrees off-axis). The quantity d50 indicates the diameter of a
529circle (plotted) containing 50$\%$ of the reflected light. Note that
530the z-axis scale is logarithmic, and the same in the first five
531plots. The last plot shows the x-axis projections in linear scale.
532 \label{coma}}
533 \end{center}
534\vspace*{-1cm}
535\end{figure}
536%
537\begin{figure}[p]
538 \begin{center}
539 \epsfig{file=eps/refl06images.eps,width=0.85\textwidth}
540 \caption{Reflector 0.6. Images of the three gamma showers shown in
541fig. \ref{evcompare}, without noise added in the reflection (left) and
542with the standard noise (right) as described in section
543\ref{descrip}. Note that the orientation of the images has changed as a
544result of the introduction of a new camera coordinate system (see page
545\pageref{newcoordi}).
546 \label{refl06images}}
547 \end{center}
548\vspace*{-1cm}
549\end{figure}
550%
551\begin{figure}[p]
552 \begin{center}
553 \epsfig{file=eps/coma_star.eps,width=0.85\textwidth}
554 \caption{Reflector 0.6. Images of a star. The quantity d50
555indicates the diameter of a circle (plotted) containing 50$\%$ of the
556reflected light.
557 \label{coma_star}}
558 \end{center}
559\vspace*{-1cm}
560\end{figure}
561%
562\subsection{The {\itshape cermaker} program}
563A test program to produce cer files (input for the reflector)
564containing photons from a point-light source of light placed in any
565position has been added to the Reflector package {\it
566(tester/cermaker.c)}. This is the same program used to produce the
567plots shown in this report. The usage is as follows:
568\begin{verbatim}
569cermaker source_x(cm) source_y(cm) source_z(cm) [events]
570\end{verbatim}
571The source position is given with respect to the telescope. The output
572file is called {\it cer000001}, and can be read by the reflector program.
573%
574\subsection{Changes in the atmospheric absorption routines}
575%
576In the present version of the program, the simulation of atmospheric
577absorption has undergone major changes with respect to the original
578implementation by J.C. Gonz\'alez and Aitor Ibarra. Three options are
579available in the simulation: ATM\_NOATMOSPHERE, ATM\_90PERCENT and
580ATM\_CORSIKA (see section \ref{commands}). In the
581first two, 100$\%$ and 90$\%$ of the emitted light respectively
582reaches the telescope mirror, regardless of the emission height. The
583changes in the present version affect only the third option, which is
584the recommended one for running reflector in the standard MAGIC MC
585production. In this case, a detailed estimate of the atmospheric
586transmission is done.
587\par
588Three contributions to the atmospheric opacity
589are considered: Rayleigh scattering, Mie scattering by aerosols, and
590absorption by ozone. Details on how the effect of these three
591components is calculated are given in appendix A. In reflector
592versions older than 0.6,
593due to a bug, the contribution of Mie scattering and Ozone absorption
594was slightly overestimated because the vertical height of the emission
595point above sea level was interpreted as height above the
596telescope. The difference is small, since the density of the aerosols
597responsible for Mie scattering decreases very fast with height and
598therefore the absorption is hardly increased by going up 2.2 km in the
599region were most of the Cherenkov light is produced. In the case of
600ozone, its contribution is only important in the very low end of the
601Cherenkov light spectrum, and so the effect of the bug in the total
602amount of light reaching the telescope is negligible. Another change
603is that now the observation level is read in from the cer file, instead
604of being a fixed parameter in the routines. In this way the reflector
605program has become more flexible, and can now be used to process cer
606files produced for a detector at a different observation level.
607\par
608Another problem in the old implementation of absorption was that the
609variation of the optical depth of the atmosphere with the zenith angle
610$\theta$ was assumed to be the same for Mie scattering, ozone
611absorption and Rayleigh scattering: the so called {\it air
612mass} (see appendix A for details) was therefore calculated only once,
613using the overall density profile of air molecules (which does not
614match that of aerosols or ozone), and used to account for the
615variation of all three effects with $\theta$, while rigorously
616speaking it is only valid for Rayleigh scattering. Now, the simulation
617of Mie scattering and ozone absorption has been moved from {\it
618attenu.f} to {\it atm.c} and is done in a more accurate way which
619takes into account the vertical profile of aerosols and ozone (see
620appendix A for details).
621%
622\subsection{Other changes in Reflector 0.6}
623
624Some other minor improvements have been introduced in Reflector 0.6:
625
626\begin{enumerate}
627
628\item reflector.c: Introduced NaN (Not a Number) check in the photon
629loop. If NaNs are found in a photon data block (there are some in the
630Corsika output from time to time, for unkown reason), it is not processed.
631
632\item ph2cph.c: Introduced "check of positiveness" before taking a
633square root in the calculation of the photon trajectory intersection
634with the paraboloid (resulted sometimes in NaNs when the photon did
635not intersect the paraboloid).
636
637\item Added an option for the wobble mode in the input card (see
638section \ref{opt}).
639
640\item New output format (see sect. \ref{out}): we have removed a null
641byte that was written immediately after the ascii label containing the
642reflector program version number at the begining of the file. This
643byte was there for historical reasons and had no function
644whatsoever. Then we have added a Run header, which is like that of
645Corsika, plus a couple of variables concerning the reflector
646parameters: the wobble mode and the atmospheric model
647used for the simulation. The event header has also been changed to
648include all the information present in the Corsika event
649header. We also added in the event header three new variables which
650tell us for each event what fraction of the Cherenkov photons on the
651camera plane has been produced by electrons, muons, or other
652particles.
653\par
654Finally, the ascii files {\it magic.def}, {\it
655axisdev.dat} and {\it reflectivity.dat} which the program has used as
656input are now attached at the end of the output file, so that each
657output file contains all the relevant information on how it was
658produced.
659
660\end{enumerate}
661
662%------------------------------------------------------------
663\section{How to Install Reflector Program \label{installation}}
664
665You can get the current version of the Reflector Program from the
666MAGIC web page: \\
667{\bf http://hegra1.mppmu.mpg.de/MAGICWeb/ }\\
668You can find
669the latest public version of this program as tarred gzipped file in
670the Monte Carlo Download area (you need the usual password). You have to
671download the file reflector\_0.6.tar.gz and then follow the
672instructions below:
673
674\begin{description}
675\item[Decompress the file using:]
676 gunzip reflector*.tar.gz
677\item[Unpack the tar file with:]
678 tar xvf reflector*.tar
679\item[Go to the directory where the source files are:]
680 cd MagicProgs/Simulation/Detector/Reflector\_0.6/
681\item[Make symbolic links running the script:]
682 refl-install
683\item[Check if all dependencies are fulfilled:]
684 make depend
685\item[Compile the program:]
686 make
687\end{description}
688
689If everything goes right you should have an executable file called
690{\bf reflector}.
691
692%------------------------------------------------------------
693\section{How to Run Reflector Program \label{running}}
694
695You need a steering card to run the Reflector program. You can find an
696example in the {\bf MagicProgs/Simulation/Detector/Reflector\_0.6/input.card}
697file. You have to modify this file according to your needs (see below
698for instructions about steering card) and then run the program with the
699following statement:\\
700
701\hspace{1cm}{\bf reflector $<$ input.card}
702
703%------------------------------------------------------------
704\section{Needed Files \label{neededfiles}}
705
706The Reflector program needs some other files to run. These files are
707the following:
708\begin{itemize}
709\item {\bf magic.def}: contains the description of MAGIC telescope
710geometry, together with some other parameters needed by the Reflector
711program.
712\item {\bf axisdev.dat}: contains data to simulate the possible
713deviation of the spot of each single mirror on the camera plane due
714to its non perfect alignment. The values are x, y coordinates
715distributed at random (according to a gaussian with $\sigma =
7160.5$ cm).
717\item {\bf reflectivity.dat}: contains the mirror reflectivity index as
718a function of the wavelength.
719\end{itemize}
720
721All these files (included in the reflector package) are usually kept
722in the {\bf MagicProgs/Simulation/Detector/Data/} directory and {\it
723in principle} you should {\bf not} make any change in them to run the
724program.
725
726%------------------------------------------------------------
727\section{Steering Card}
728
729The steering card sets all the parameters and options
730to steer the reflection simulation. Each line of the steering card is
731a statement with its parameters, if it is the case. Lines beginning
732with \# are considered comments. The Reflector program parses all the
733lines sequentially. Then if you repeat a statement with different
734options only the last one will be considered.
735
736\subsection{Mandatory Commands \label{commands}}
737
738\begin{description}
739
740\item[reflector 0.6]
741
742 This statement must be the first line of the steering card
743 file. The Reflector program checks it to verify if it is reading
744 a steering card.
745
746\item[output\_file /disk99/reflex/Gamma\_0\_7\_1001to1010\_w0.rfl]
747
748 The output\_file command specifies the name and the
749 path of the output file. The path can be absolute, like in the
750 example above, or relative. Although any name can be used,
751 conventionally the Reflector program
752 output file name has the .rfl extension, and starts with
753 the primary particle name. The first number indicates the
754 zenith angle of the incident primaries, the second one
755 indicates the production site (7 is for Padua) and is related
756 to the random number generator seed used by CORSIKA. Then the run
757 number range is shown (10 runs in this case, from 1001 to
758 1010). Each run corresponds to 10000 showers. Finally, the
759 label "w0" means no wobble mode was used (telescope pointing
760 at the source). Alternatively, the "w+" or "w-" labels (only
761 in gamma files) refer to the two pointings in the
762 Wobble-observation mode (see TDAS 01-05 by W. Wittek).
763
764\item[ct\_file /path/magic.def]
765
766 The ct\_file statement defines where the program can find the
767 telescope characteristics. Usually, the magic.def file is kept in
768 MagicProgs/Simulation/Detector/Data
769
770\item[atm\_model ATM\_CORSIKA]
771
772 The atm\_model statement tells the program what kind of
773 atmospheric absorption model to use. Possible choices are:
774 ATM\_NOATMOSPHERE,\\ ATM\_90PERCENT and ATM\_CORSIKA,
775 corresponding respectively to no absorption, a 10$\%$
776 absorption and a model using the US Standard atmosphere (see
777 Corsika manual, appendix C) for the Rayleigh scattering and a
778 model by L. Elterman \cite{elterman64,elterman65} for the Mie
779 scattering and ozone absorption (see appendix A). The third
780 model should be chosen for the standard MC MAGIC production.
781
782\item[cer\_files]
783
784 All the lines following this statement are considered files to
785 be processed by the Reflector program, one for each line,
786 eventually with their paths (see the example below). Therefore this
787 command must be the last one.\\
788 \\
789 cer\_files\\
790 /disk99/cer001001\\
791 /disk99/cer001002\\
792 /disk99/cer001003\\
793 ........ \\
794 /disk99/cer001009\\
795 /disk99/cer001010\\
796 \\
797 The cer file name can be followed by two numbers, for example:
798 \\
799 /disk99/cer001001 376 5723\\
800 \\
801 In this case the program processes only the events between and
802 including the numbers given.
803
804\end{description}
805
806\subsection{Optional Commands \label{opt}}
807
808\begin{description}
809
810\item[verbose\_level 1]
811
812 Sets the quantity of information printed out by Reflector
813 when running. Possible values are 0 to 4
814
815\item[max\_events 50000]
816
817 Fixes the maximum number of events to process.
818
819\item[energy\_cuts 100 1000]
820
821 This statement forces the Reflector to process only showers
822 with primary energy between the given values (GeV).
823
824\item[seeds n1 n2]
825
826 Seeds for the random number generators to used by the program
827 for the simulation of the absorption (both in the atmosphere
828 and on the mirror). Default values are 3141592 and
829 2718182.
830
831\item[telescope\_position x y]
832
833 Option included in version 0.5 of Reflector. Usually it is
834 not needed, since for normal MC production for MAGIC the
835 telescope is placed at the origin of coordinates (0,0). But,
836 if for some reason, we produce cerxxxxxx files with the
837 telescope in a different position, we must inform the
838 Reflector program in the input card using this option
839 (otherwise Reflector will fail to {\it find} the photons
840 in the cer file).
841
842\item[reflectivity\_file /path/reflectivity.dat]
843
844 File containing mirror reflectivity as a function of
845 wavelength (see section \ref{neededfiles}). If this option is
846 not supplied, the program will look for \\
847 ``../Data/reflectivity.dat'' as previous versions of
848 Reflector did.
849
850\item[axisdev\_file /path/axisdev.dat]
851
852 File containing single mirror spot deviation in {\bf x} and
853 {\bf y} on the camera in cm (see section
854 \ref{neededfiles}) for each mirror. If this option is not
855 supplied, the program will look for ``../Data/axisdev.dat''
856 as previous versions of Reflector did.
857
858\item[fixed\_target $\Theta$ $\Phi$]
859
860 This statement fixes the telescope axis position. The first
861 number is the zenith angle $\Theta$ (deg) while the second is
862 the azimuthal angle $\Phi$ (deg). This corresponds to {\it
863 CORSIKA}'s definition of primary particle incident direction
864 (see fig. \ref{coorsystems}, left). For instance, $\phi = 90^\circ$
865 means that the telescope is pointing towards East. If this
866 option is omitted the telescope will always point in the
867 direction of the Corsika primary (whatever it is), or a
868 slightly modified direction if the wobble\_mode option is used
869 (see next point). When running the reflector over gamma data
870 generated in a range of zenith angles, one should therefore
871 ommit the fixed\_target option.
872
873\item[wobble\_mode w]
874
875 Indicates whether the reflection should be done in the wobble
876 mode, that is, with shifted pointing with respect to the
877 nominal telescope orientation (given by fixed\_target or
878 otherwise, see above). The wobble mode is described in TDAS
879 01-05. Possible values for w are 0 (no wobble mode), 1, -1
880 (image shift along $x_{camera}$ axis) and 3 (image shift along
881 $y_{camera}$ axis).
882
883\end{description}
884
885%------------------------------------------------------------
886
887\section{Output file \label{out}}
888The reflector output file begins with two ascii lines, the first of
889which informs us of the program version with which it has been
890produced (NOTE: in the following, the dollar symbol \verb"$" stands
891for a carriage return):\\
892\\
893\verb"reflector 0.6$START---RUN$" \\
894\\
895Then there is run header which is basically the one from Corsika with
896two added variables, {\it wobble\_mode} and {\it
897atmospheric\_model}. Check the Corsika manual for the meaning and
898units of the rest of them. All of the variables are 4-byte real numbers
899except the first, which is a 4 character string containing the run
900header ascii label from Corsika:
901\vspace*{0.5cm}
902\\
903%
904\begin{tabular}{lll}
905\multicolumn{2}{c}{Variable} & Description \\
906\hline
907&& \\
9081 & ASCII Label & 'RUNH' \\
9092 & RunNumber & \\
9103 & date & \\
9114 & Corsika\_version & \\
9125 & NumObsLev & \\
9136 to 15 & HeightLev[10] & \\
91416 & SlopeSpec & \\
91517 & ELowLim & \\
91618 & EUppLim & \\
91719 & EGS4\_flag & \\
91820 & NKG\_flag & \\
91921 & Ecutoffh & \\
92022 & Ecutoffm & \\
92123 & Ecutoffe & \\
92224 & Ecutoffg & \\
92325 to 74 & C[50] & \\
92475 & wobble\_mode & Wobble mode with which the reflector was run (TDAS
92501-05) \\
92676 & atmospheric\_model & Atmospheric model used for the absorption
927simulation \\
928&& 0 = no atmosphere; 1 = atm\_90percent; \\
929&& 2 = atm\_corsika. \\
93077 to 94 & dummy1[18] & not used \\
93195 to 134 & CKA[40] & \\
932135 to 139 & CETA[5] & \\
933&\\
934\hline
935\end{tabular}
936
937\newpage
938
939\begin{tabular}{lll}
940\multicolumn{2}{c}{Variable} & \parbox{11cm}{Description} \\
941\hline
942&& \\
943140 to 140 & CSTRBA[11] & \\
944151 to 254 & dummy2[104] & not used \\
945255 to 259 & AATM[5] & \\
946260 to 264 & BATM[5] & \\
947265 to 269 & CATM[5] & \\
948270 to 273 & NFL[4] & \\
949&\\
950\hline
951\end{tabular}
952\vspace*{0.5cm}
953\\
954%
955Then there comes a carriage return followed by the ascii flag which
956indicates the start of an event, and again a carriage return:\\
957\\
958\verb"$START-EVENT$"\\
959\\
960and then the binary event header. Each variable is a 4-byte
961float number except for the first one which is the event header label
962from Corsika (a string of 4 characters). Some of of the variables from
963Corsika are not explained here (see Corsika manual instead).
964\vspace*{0.5cm}
965\\
966\begin{tabular}{lll}
967\multicolumn{2}{c}{Variable} & Description \\
968\hline
969&& \\
9701 & ASCII label & 'EVTH' \\
9712 & EvtNumber & Event Number \\
9723 & PrimaryID & Primary particle identification code \\
9734 & Etotal & Primary particle total energy (GeV) \\
9745 & Thick0 & CORSIKA's starting altitude in g/cm2 \\
9756 & FirstTarget & CORSIKA's number of first target if fixed \\
9767 & zFirstInt & Height of first interaction in cm \\
9778 to 10 & p[3] & Primary particle momentum in x,y,-z directions (GeV) \\
97811 & Theta & Primary particle zenith angle (rad) \\
97912 & Phi & Primary particle azimuth angle (rad) \\
980
98113 & NumRndSeq & Number of different CORSIKA random sequences (max. 10) \\
98214 to 43 & RndData[10][3] & RndData[i][0]: integer seed of sequence i \\
983& & RndData[i][1]: number of offset random calls (mod $10^6$) of sequence i. \\
984& & RndData[i][2]: number of offset random calls ($/10^6$) of sequence i. \\
985
98644 & RunNumber & Run number \\
98745 & DateRun & Date of run yymmdd \\
98846 & Corsika\_version & Version of {\it CORSIKA} \\
989
99047 & NumObsLev & Number of observation levels (should be always 1 for
991us) \\
99248 to 57 & HeightLev[10] & Height of observation levels in cm \\
993
99458 & SlopeSpec & Energy spectrum slope \\
99559 & ELowLim & Energy lower limit (GeV) \\
99660 & EUppLim & Energy upper limit (GeV) \\
99761 & Ecutoffh & \\
99862 & Ecutoffm & \\
99963 & Ecutoffe & \\
1000& \\
1001\hline
1002\end{tabular}
1003%
1004\newpage
1005%
1006
1007\begin{tabular}{lll}
1008
1009\multicolumn{2}{c}{Variable} & \parbox{11cm}{Description} \\
1010\hline
1011&& \\
101264 & Ecutoffg & \\
101365 & NFLAIN & \\
101466 & NFLDIF & \\
101567 & NFLPI0 & \\
101668 & NFLPIF & \\
101769 & NFLCHE & \\
101870 & NFRAGM & \\
101971 & Bx & \\
102072 & By & \\
102173 & EGS4yn & \\
102274 & NKGyn & \\
102375 & GHEISHAyn & \\
102476 & VENUSyn & \\
102577 & CERENKOVyn & \\
102678 & NEUTRINOyn & \\
102779 & HORIZONTyn & \\
102880 & COMPUTER & \\
102981 & ThetaMin & Minimum Theta of primaries (deg) \\
103082 & ThetaMax & Maximum Theta of primaries (deg) \\
103183 & PhiMin & Minimum Phi of primaries (deg) \\
103284 & PhiMax & Maximum Phi of primaries (deg) \\
103385 & CBunchSize & \\
103486 & CDetInX & \\
103587 & CDetInY & \\
103688 & CSpacInX & \\
103789 & CSpacInY & \\
103890 & CLenInX & \\
103991 & CLenInY & \\
104092 & COutput & \\
104193 & AngleNorthX& \\
104294 & MuonInfo & \\
104395 & StepLength & \\
104496 & CWaveLower & Wavelength lower limit (nm) \\
104597 & CWaveUpper & Wavelength upper limit (nm) \\
104698 & Multipl & \\
104799 to 138 & CorePos[2][20] & Core positions of randomized shower \\
1048139 to 140 & SIBYLL[2] & \\
1049141 to 142 & QGSJET[2] & \\
1050143 to 144 & DPMJET[2] & \\
1051145 & VENUS\_cross & \\
1052146 & mu\_mult\_scat & \\
1053147 & NKG\_range & \\
1054148 to 149 & EFRCTHN[2] & \\
1055150 to 151 & WMAX[2] & \\
1056& \\
1057\hline
1058\end{tabular}
1059
1060\newpage
1061
1062\begin{tabular}{lll}
1063\multicolumn{2}{c}{Variable} & \parbox{11cm}{Description} \\
1064\hline
1065&& \\
1066152 & rthin\_rmax & \\
1067153 to 154 & viewcone\_angles[2] & Inner and outer angles of Corsika's VIEWCONE
1068option. \\
1069155 & telescopePhi & Telescope azimuth (rad). Measured from South, counter-clockwise \\
1070156 & telescopeTheta & Telescope zenith angle (rad) \\
1071157 & TimeFirst & Arrival time on camera of first photon (ns) \\
1072158 & TimeLast & Arrival time on camera of last photon (ns) \\
1073
1074&& 6 next variables: CORSIKA longitudinal particle fit parameters \\
1075&& \hspace{0.5cm} (see CORSIKA manual for precise meaning and units)\\
1076159 & longi\_Nmax & Numer of charged particles at maximum \\
1077160 & longi\_t0 & Atmospheric depth of shower starting point (N=0) \\
1078161 & longi\_tmax & Atmospheric depth of shower maximum (g/cm$^2$) \\
1079162 & longi\_a & \\
1080163 & longi\_b & For {\bf longi\_a}, {\bf longi\_b}, {\bf longi\_c}, see CORSIKA manual \\
1081164 & longi\_c & \\
1082165 & longi\_chi2 & $\chi^2/dof$ of the fit\\
1083166 & CORSIKAPhs & Original photons written by {\it CORSIKA} \\
1084167 & AtmAbsPhs & Photons absorbed by the atmosphere \\
1085168 & MirrAbsPhs & Photons absorbed by the mirror \\
1086169 & OutOfMirrPhs & Photons outside the mirror \\
1087170 & BlackSpotPhs & Photons lost in the "black spot" \\
1088171 & OutOfChamPhs & Photons outside the camera \\
1089172 & CPhotons & Photons reaching the camera \\
1090
1091173 & elec\_cph\_fraction & Fraction of C-photons produced by electrons \\
1092174 & muon\_cph\_fraction & Fraction of C-photons produced by muons \\
1093175 & other\_cph\_fraction & Fraction of C-photons produced by electrons \\
1094176 to 182 & dummy[7] & not used \\
1095& \\
1096\hline
1097\end{tabular}
1098%
1099\vspace*{0.5cm}
1100\\
1101The event header is followed by 8-word blocks, one for each Cherenkov
1102photon that reaches the camera. A photon block contains the following
1103variables (as 4-byte float numbers):
1104\vspace*{0.5cm}
1105\\
1106\begin{tabular}{ll}
1107Variable & Description \\
1108\hline
1109& \\
1110w & 100000 $\times$ Particle\_type + 1000 $\times$ n + Wavelength (nm) \\
1111 & Particle\_type indicates what particle produced the C-photon. Its value is 2 for electrons \\
1112 & and positrons, and the standard codes of Corsika for the rest. \\
1113 & n is the index from 1 to ICERML (see Corsika manual) for the case in which each Corsika \\
1114 & shower is used more than once (normally, in MMCS will be just 1). \\
1115x, y & Impact point in camera coordinates (cm) \\
1116u, v & Director cosines of down-going versor indicating the photon direction \\
1117t & Arrival time on camera (ns), measured from the time of first
1118interaction of the primary \\
1119h & Production height (cm), measured above sea level on the
1120vertical of the telescope location \\
1121 & (it is not the {\it true} height which would be measured on
1122the vertical of the emitting particle!) \\
1123phi & Incidence angle with respect to camera plane (rad) \\
1124& \\
1125\hline
1126\end{tabular}
1127\vspace*{0.5cm}
1128\\
1129After the last photon block of an event there is a carriage return
1130followed by the ascii flag indicating the event end, and then two more
1131carriage returns before the ascii flag of the beginning of the next
1132event, and so on:\\
1133\\
1134\verb"$END---EVENT$$START-EVENT$Event_header....$END---EVENT$$END-----RUN$$START---RUN$..."\\
1135\\
1136The flag ``\verb$END-----RUN$'' appears after the last event in a run
1137(that is, the last event processed of each of the input cer
1138files). After the last processed run, an end of file flag is
1139written:\\
1140\\
1141\verb"...$END---EVENT$$END-----RUN$$END----FILE$"\\
1142\\
1143Finally, after this flag an ``ascii tail'' has been attached to the file:
1144it consists of the ascii files {\it magic.def}, {\it axisdev.dat} and
1145{\it reflectivity.dat} one after the other, separated by carriage returns:
1146\\
1147\\
1148\verb"$magic.def$axisdev.dat$reflectivity.dat"\\
1149\\
1150In this way all the relevant parameters used to produce the output are
1151kept together with the reflected events.
1152%------------------------------------------------------------
1153\newpage
1154\renewcommand{\thesubsection}{A.\arabic{subsection}}
1155\section*{Appendix A : atmospheric absorption}
1156\addcontentsline{toc}{section}{Appendix A : atmospheric absorption}
1157%
1158The simulation of the absorption of Cherenkov light in the atmosphere
1159has been included in the {\it Reflector} program because this feature
1160was not yet available in the first versions of CORSIKA used within the
1161MAGIC collaboration. In the latest CORSIKA versions, the atmospheric
1162absorption has been included as an option, but it is not
1163compatible with the simulation of a curved atmosphere \cite{cor02},
1164and hence we have kept this step as a part of our reflector
1165simulation. This appendix describes how the atmospheric absorption is
1166implemented in the program when the option ATM\_CORSIKA (see section
1167\ref{commands}) is chosen.
1168\par
1169The geometry of the problem is sketched in figure
1170\ref{fig:atmoscheme}. A Cherenkov photon is emitted in point A and
1171travels towards the telescope placed at B. At any moment, the height
1172$h$ of the photon above sea level is related to the distance $L$
1173between the photon and the telescope through
1174%
1175\begin{equation}
1176(R+h)^2 = (R+h_1)^2 + L^2 + 2 L \; (R+h_1) \; \cos \theta
1177\label{eq:height}
1178\end{equation}
1179%
1180, where $R$ is the Earth radius, $h_1$ the height (a.s.l.) of the
1181observation level and $\theta$ is the zenith angle of the photon
1182trajectory measured at the telescope site. The Cherenkov output of
1183CORSIKA contains for each photon the height $h_C$ of the emission
1184point A, measured along the vertical of the observer. The {\it true
1185vertical height} $h_2$ of the emission point can be obtained by
1186replacing $L$ by $(h_C-h_1)/\cos \theta$ in equation
1187(\ref{eq:height}).
1188%
1189\begin{figure}[ht]
1190\begin{center}
1191\mbox{ \epsfig{file=eps/atmoscheme.eps,width=0.8\textwidth} }
1192\end{center}
1193\caption[]
1194{Calculation of the true vertical height $h_2$ of the emission point
1195of a Cherenkov photon (point A), and the optical path traversed down to the
1196telescope (point B).}
1197\label{fig:atmoscheme}
1198\end{figure}
1199%
1200\par
1201The optical path $I(\theta, h_1, h_2)$ traversed by the photon can be
1202calculated integrating the air density along the trajectory
1203$\overline{\text{AB}}$. For the case $h/R \ll 1$, we can drop in
1204(\ref{eq:height}) the terms in $(h/R)^2$ and smaller, and then solve
1205for L. Deriving now with respect to $h$, we have:
1206%
1207\begin{equation}
1208\frac{dL}{dh} \simeq \sqrt{\frac{R}{2\;(h-h_1)+R\;\cos^2 \theta}}
1209\qquad \text{for} \qquad \frac{h}{R} \ll 1
1210\label{eq:dldh}
1211\end{equation}
1212%
1213\subsection{Rayleigh scattering}
1214Rayleigh scattering is the scattering of light by particles smaller
1215than its wavelength. These are in our case the air molecules. The
1216transmission coefficient due to Rayleigh scattering is a strong
1217function of the wavelength $\lambda$:
1218%
1219\begin{equation}
1220T_{\text{Rayl}} (\lambda) = \exp \Biggl[ - \frac{I(\theta, h_1, h_2)}{x_R} \; \Biggl(\frac{400 \;
1221\text{nm}}{\lambda}\Biggl)^4 \; \Biggl]
1222\label{eq:rayleigh}
1223\end{equation}
1224%
1225Here $I(\theta, h_1, h_2)$ is the optical path (in g/cm$^2$) traversed
1226between points A and B, and $x_R = 2970$ g/cm$^2$ is the mean free path of
1227the Rayleigh scattering at $\lambda = 400$ nm.
1228\par
1229A convenient way of expressing the optical path is the following:
1230%
1231\begin{equation}
1232I\;(\theta, h_1, h_2) = (x_1 - x_2) \cdot \mathcal{AM}\;(\theta, h_1, h_2)
1233\end{equation}
1234Here $x_{i=1,2}$ is the mass overburden of the atmosphere above a
1235height $h_i$ (in the
1236vertical direction) and $\mathcal{AM}$ is the so called {\it air
1237mass}\footnote{If we set $h_2 = \infty$, we have the usual definition
1238of {\it air mass} in optical astronomy.}, defined as
1239%
1240\begin{equation}
1241\mathcal{AM} \equiv \frac{I\;(\theta,h_1,h_2)}{I\;(0^\circ,h_1,h_2)}
1242\label{eq:airmass}
1243\end{equation}
1244%
1245, which is a function mainly of the zenith angle $\theta$ (see
1246fig. \ref{fig:airmass}). In our simulation, for the calculation of the
1247mass overburden $x_i$ we have used the U.S. standard atmosphere
1248parametrized by J. Linsley \cite{cor02}, the same we used in Corsika
1249for the shower development simulation. It consists of five layers: in
1250the lower four the density decreases exponentially with height, and in
1251the upper one the mass overburden cecreases linearly until it vanishes
1252at $h = 112.8$ km.
1253%
1254\begin{figure}[ht]
1255\begin{center}
1256\mbox{ \epsfig{file=eps/airmass.eps,width=0.8\textwidth} }
1257\end{center}
1258\caption[]
1259{Dependence with zenith angle of the air mass as defined in the
1260text. The air mass has been calculated for an exponential atmosphere
1261with scale height $H = 7.4$ km, for the observation level of MAGIC
1262(2.2 km a.s.l.), and for light coming from $h_2 = 10$ and at 100 km a.s.l. As
1263we can see the dependence with the emission height $h_2$ is very small.}
1264\label{fig:airmass}
1265\end{figure}
1266%
1267\par
1268For the estimate of $\mathcal{AM}$, a simpler atmospheric model has
1269been used, in which the vertical density profile is described by a
1270single exponential: $\rho = \rho_0 \; e^{-h/H}$ with scale height $H
1271= 7.4$ km. This simplifies the calculations, and is accurate enough
1272for our purposes. Using (\ref{eq:dldh}) the optical path $I(\theta,
1273h_1, h_2)$ can then be obtained approximately as:
1274%
1275\begin{equation}
1276I(\theta, h_1, h_2) = \int_A^B \rho\;(h)\; \frac{dL}{dh} \; dh \simeq
1277\sqrt{\frac{R}{2}} \;
1278\int_{h_1}^{h_2} \frac{\rho_0
1279\;e^{-h/H}}{\sqrt{h-h_1+\frac{1}{2}\;R\;\cos^2 \theta}} \; dh
1280\label{eq:optpath}
1281\end{equation}
1282%
1283and finally:
1284%
1285\begin{equation}
1286\mathcal{AM} \simeq e^{-\frac{R \sin^2 \theta}{2H}}
1287\cdot
1288\frac{
1289\text{erfc}\;(\sqrt{\frac{R \cos^2 \theta}{2H}})
1290\;-\;
1291\text{erfc}\;(\sqrt{\frac{2 (h_2 - h_1) + R \cos^2 \theta}{2H}})
1292}
1293{
1294\text{erfc}\;(\sqrt{\frac{R}{2H}})
1295\;-\;
1296\text{erfc}\;(\sqrt{\frac{2(h_2 - h_1) + R}{2 H}})
1297}
1298\label{eq:airmass2}
1299\end{equation}
1300%
1301where we have used the complementary error function $\text{erfc}\;(x)
1302= \frac{2}{\sqrt{\pi}}\int_x^\infty e^{-t^2} dt$. From
1303(\ref{eq:airmass2}), $\mathcal{AM}$ can be readily evaluated for any
1304value of $\theta$, $h_1$ and $h_2$. In fig. \ref{fig:rayleigh} the
1305resulting Rayleigh transmission coefficient $T_{\text{Rayl}}$ finally
1306obtained from (\ref{eq:rayleigh}) is plotted versus the zenith angle
1307for three wavelengths.
1308%
1309\begin{figure}[ht]
1310\begin{center}
1311\mbox{ \epsfig{file=eps/rayleigh.eps,width=\textwidth} }
1312\end{center}
1313\caption[]
1314{Rayleigh transmission coefficient as a function of zenith angle for three
1315different wavelengths. The solid, dashed and dotted lines correspond
1316respectively to light coming from 5, 10 and 20 km distance from the
1317telescope.}
1318\label{fig:rayleigh}
1319\end{figure}
1320%
1321\subsection{Mie scattering}
1322Cherenkov light also suffers Mie scattering through interaction with
1323small dust particles suspended in the air (aerosols), whose size is
1324comparable to the wavelength of the light. In our simulation of the
1325attenuation due to aerosols we have used the model proposed by
1326Elterman \cite{elterman64,elterman65}, which considers an aerosol
1327number density $N_p$ which (roughly) decreases exponentially up to 10
1328km a.s.l. with scale height $H \simeq 1.2$ km, followed by a more
1329tenuous layer between 10 and 30 km (see fig. \ref{fig:aerosol}a). In
1330this model, the aerosol size distribution is considered to be
1331unchanged with altitude.
1332%
1333\begin{figure}[ht]
1334\begin{center}
1335\mbox{ \epsfig{file=eps/aerosol.eps,width=0.9\textwidth} }
1336\end{center}
1337\caption[]
1338{Aerosol model by Elterman: in (a), number density of
1339aerosols as a function of height above sea level; in (b), aerosol
1340attenuation coefficient at sea level as a function of wavelength.}
1341\label{fig:aerosol}
1342\end{figure}
1343%
1344\par
1345Measured values of the aerosol attenuation coefficients at sea level
1346$\beta_p(0)$ for different wavelengths \cite{elterman65} are shown in
1347figure \ref{fig:aerosol}b. To obtain the attenuation coefficient at a
1348given height $h$, we simply do $\beta_p(h, \lambda) = \beta_p(0,
1349\lambda) \cdot N_p(h)/N_p(0)$. In the Elterman model the aerosol
1350transmission coefficient for the trajectory from A to B depicted in
1351figure \ref{fig:atmoscheme} would then be:
1352%
1353\begin{equation}
1354T_{\text{Mie}}(\lambda) = e^{-\tau_{mie}} \quad \text{, with}\quad
1355\tau_{mie}(h_1, h_2, \theta, \lambda) = \frac{\beta_p(0, \lambda)}{N_p(0)} \;
1356\int_{h_1}^{h_2}
1357\; N_p(h) \;\; \frac{dL}{dh}\; dh
1358\label{eq:aerosoltau}
1359\end{equation}
1360%
1361Here $\tau_{mie}$ is the aerosol optical depth of the path from A to
1362B. Given that the aerosol density distribution is not a simple
1363exponential, we have to do the integral in (\ref{eq:aerosoltau})
1364numerically. The integral depends on $h_2$ and on $\theta$, through
1365$dL/dh$ (it also
1366depends on $h_1$, but this is the observation level and therefore
1367fixed). In this case we use the exact expression for $\;dL/dh\;$ which can be
1368obtained from (\ref{eq:height}). At the beginning of each simulation
1369run we calculate and store the results of the integral for values of
1370$\theta$ between 0 and 90$^\circ$ (in steps of $1^\circ$), and of
1371$h_2$ from $h_1$ up to 30 km (in steps of 100 m). To do the integral a
1372linear interpolation has been used to obtain the value of $N_p$ for
1373any height. During the simulation of each Cherenkov photon, we get the
1374corresponding precalculated value of the integral and deduce
1375$T_{\text{Mie}}$ from expression (\ref{eq:aerosoltau}).
1376%
1377\begin{figure}[ht]
1378\begin{center}
1379\mbox{ \epsfig{file=eps/mie.eps,width=\textwidth} }
1380\end{center}
1381\caption[]
1382{Aerosol transmission coefficient for three different wavelengths as a
1383function of the distance between the photon emission point and the
1384telescope. Plots for four different zenith angles between 0 and 80
1385degrees are shown.}
1386\label{fig:mie}
1387\end{figure}
1388%
1389\par
1390Since in this model the aerosols are concentrated mainly at very low
1391altitude, the transmission coefficient is more or less constant above
1392a certain height (which depends on $\theta$), as can be seen in
1393fig. \ref{fig:mie}. For instance, for vertically incident 300 nm light
1394emitted higher than 4 km above the telescope, the Mie transmission is
1395about 0.95.
1396%
1397\subsection{Absorption by Ozone}
1398%
1399The absorption of Cherenkov light by Ozone has been implemented
1400following also the Elterman standard atmosphere \cite{elterman65}. The
1401coefficient for ozone absorption is given by
1402%
1403\begin{equation}
1404\beta_3(h,\lambda) = A_v(\lambda) \cdot D_3(h)
1405\end{equation}
1406%
1407, where $A_v(\lambda)$ is the Vigroux \cite{vigroux53} ozone
1408absorption coefficient (cm$^{-1}$) and $D_3(h)$ is the ozone
1409concentration (cm km$^{-1}$) according to Elterman. The transmission
1410coefficient of Ozone in the path $\overline{\text{AB}}$ is then:
1411%
1412\begin{equation}
1413T_{\text{Ozone}}(\lambda) = e^{-\tau_{oz}} \quad \text{, with}\quad
1414\tau_{oz}(h_1, h_2, \theta, \lambda) = A_v(\lambda) \; \int_{h_1}^{h_2}
1415\; D_3(h) \;\; \frac{dL}{dh}\; dh
1416\label{eq:ozonetau}
1417\end{equation}
1418%
1419\begin{figure}[ht]
1420\begin{center}
1421\mbox{ \epsfig{file=eps/ozone.eps,width=\textwidth} }
1422\end{center}
1423\caption[]
1424{Ozone concentration vertical profile (a) and Vigroux coefficients for
1425Ozone absorption (b). The Vigroux coefficients for $\lambda =$ 380 and
1426400 nm are zero.}
1427\label{fig:ozone}
1428\end{figure}
1429%
1430\par
1431Once again, like in the case of Mie scattering, the optical depth
1432$\tau_{oz}$ is the product of a factor which depends on $\lambda$ and
1433an integral which depends on $h_1$, $h_2$ and $\theta$. We proceed in
1434the same way as before, precalculating the values of the integral in
1435steps of $\Delta\theta = 1^\circ$ and $\Delta h = 100$ m, up to a
1436height of 50 km a.s.l. (where the ozone concentration becomes
1437negligible), and then reading the appropriate values for every
1438simulated photon.
1439\par
1440Finally, the overall atmospheric transmission coefficient is
1441calculated as
1442%
1443\begin{equation}
1444T_{total} = T_{Ray} \cdot T_{Mie} \cdot T_{Ozone}
1445\end{equation}
1446%
1447In figure \ref{fig:absorplot} the atmospheric transmission as a
1448function of the distance to the telescope for $\theta = 0^\circ$ is
1449shown. Ozone absorption turns out to be dominant below 320 nm, while
1450Rayleigh scattering is the main cause of the loss of photons at longer
1451wavelengths.
1452%
1453\begin{figure}[ht]
1454\begin{center}
1455\mbox{ \epsfig{file=eps/absorplot.eps,width=\textwidth} }
1456\end{center}
1457\caption[]
1458{Total transmission coefficient for vertically incident light as a
1459function of the distance between the emission point and the
1460telescope. The contributions of absorption by ozone and of Rayleigh
1461and Mie scattering are also shown for comparison.}
1462\label{fig:absorplot}
1463\end{figure}
1464%
1465\newpage
1466\section*{Appendix B : files in the reflector package}
1467\addcontentsline{toc}{section}{Appendix B : files in the reflector package}
1468
1469The list of all Reflector files follows.
1470\begin{verbatim}
1471
1472MagicProgs/Simulation/Detector/Reflector_0.6/Changelog
1473MagicProgs/Simulation/Detector/Reflector_0.6/Makefile
1474MagicProgs/Simulation/Detector/Reflector_0.6/atm.c
1475MagicProgs/Simulation/Detector/Reflector_0.6/atm.h
1476MagicProgs/Simulation/Detector/Reflector_0.6/attach.c
1477MagicProgs/Simulation/Detector/Reflector_0.6/attenu.f
1478MagicProgs/Simulation/Detector/Reflector_0.6/config.mk.linux
1479MagicProgs/Simulation/Detector/Reflector_0.6/config.mk.linux-gnu
1480MagicProgs/Simulation/Detector/Reflector_0.6/config.mk.osf1
1481MagicProgs/Simulation/Detector/Reflector_0.6/diag.c
1482MagicProgs/Simulation/Detector/Reflector_0.6/diag.h
1483MagicProgs/Simulation/Detector/Reflector_0.6/geometry.c
1484MagicProgs/Simulation/Detector/Reflector_0.6/geometry.h
1485MagicProgs/Simulation/Detector/Reflector_0.6/header.c
1486MagicProgs/Simulation/Detector/Reflector_0.6/header.h
1487MagicProgs/Simulation/Detector/Reflector_0.6/init.c
1488MagicProgs/Simulation/Detector/Reflector_0.6/init.h
1489MagicProgs/Simulation/Detector/Reflector_0.6/input.card
1490MagicProgs/Simulation/Detector/Reflector_0.6/lagrange.h
1491MagicProgs/Simulation/Detector/Reflector_0.6/parms.c
1492MagicProgs/Simulation/Detector/Reflector_0.6/parms.h
1493MagicProgs/Simulation/Detector/Reflector_0.6/ph2cph.c
1494MagicProgs/Simulation/Detector/Reflector_0.6/refl-install
1495MagicProgs/Simulation/Detector/Reflector_0.6/reflector.c
1496MagicProgs/Simulation/Detector/Reflector_0.6/version.h
1497
1498MagicProgs/Simulation/Detector/Reflector_0.6/doc/Tdas0211.ps
1499MagicProgs/Simulation/Detector/Reflector_0.6/doc/Tdas0211.tex
1500MagicProgs/Simulation/Detector/Reflector_0.6/doc/magic-tdas.sty
1501MagicProgs/Simulation/Detector/Reflector_0.6/doc/magiclogo.eps
1502MagicProgs/Simulation/Detector/Reflector_0.6/doc/eps/absorplot.eps
1503MagicProgs/Simulation/Detector/Reflector_0.6/doc/eps/aerosol.eps
1504MagicProgs/Simulation/Detector/Reflector_0.6/doc/eps/airmass.eps
1505MagicProgs/Simulation/Detector/Reflector_0.6/doc/eps/atmoscheme.eps
1506MagicProgs/Simulation/Detector/Reflector_0.6/doc/eps/colimation.eps
1507MagicProgs/Simulation/Detector/Reflector_0.6/doc/eps/coma.eps
1508MagicProgs/Simulation/Detector/Reflector_0.6/doc/eps/coma_star.eps
1509MagicProgs/Simulation/Detector/Reflector_0.6/doc/eps/coorsystems.eps
1510MagicProgs/Simulation/Detector/Reflector_0.6/doc/eps/evcompare.eps
1511MagicProgs/Simulation/Detector/Reflector_0.6/doc/eps/mie.eps
1512MagicProgs/Simulation/Detector/Reflector_0.6/doc/eps/ozone.eps
1513MagicProgs/Simulation/Detector/Reflector_0.6/doc/eps/parabola.eps
1514MagicProgs/Simulation/Detector/Reflector_0.6/doc/eps/rayleigh.eps
1515MagicProgs/Simulation/Detector/Reflector_0.6/doc/eps/refl06images.eps
1516MagicProgs/Simulation/Detector/Reflector_0.6/doc/eps/reflec.eps
1517MagicProgs/Simulation/Detector/Reflector_0.6/doc/eps/spot10kmf1694.eps
1518MagicProgs/Simulation/Detector/Reflector_0.6/doc/eps/spot10kmf1700.eps
1519MagicProgs/Simulation/Detector/Reflector_0.6/doc/eps/spot_inf_f1697.eps
1520MagicProgs/Simulation/Detector/Reflector_0.6/doc/eps/telecoor.eps
1521MagicProgs/Simulation/Detector/Reflector_0.6/doc/eps/timing.eps
1522
1523MagicProgs/Simulation/Detector/Reflector_0.6/tester/Makefile
1524MagicProgs/Simulation/Detector/Reflector_0.6/tester/cermaker.c
1525
1526MagicProgs/Simulation/Detector/Data/axisdev.dat
1527MagicProgs/Simulation/Detector/Data/magic.def
1528MagicProgs/Simulation/Detector/Data/reflectivity.dat
1529
1530MagicProgs/Simulation/Detector/lib/libranlib.a.osf1
1531MagicProgs/Simulation/Detector/lib/libranlib.a.linux
1532
1533\end{verbatim}
1534
1535%%% BIBLIOGRAPHY %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1536
1537%%>>>> Use the following if you are using BibTeX for bibliography
1538%\theBibliography
1539
1540%%>>>> Or the following if you include here by hand your
1541%%>>>> bibliographic entries
1542
1543\begin{thebibliography}{00}
1544
1545\bibitem{elterman64}
1546L. Elterman, Applied Optics Vol. 3, No. 6 (1964) 745.
1547
1548\bibitem{elterman65}
1549L. Elterman, R.B. Toolin, S.L. Valley (editor), Handbook of
1550geophysics and space environments, McGraw-Hill, N.Y. (1965).
1551
1552\bibitem{cor02}D. Heck and J. Knapp, EAS Simulation with CORSIKA: A User's
1553Manual, 2002.
1554
1555\bibitem{vigroux53}
1556E. Vigroux, Contributions \`a l'étude expérimentale de l'absorption
1557de l'ozone, Annales de Physique, v. 8 (1953) 709.
1558
1559\end{thebibliography}
1560
1561\end{document}
1562%
1563%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1564%%% 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
1565%%% 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
1566%%% Digits 0 1 2 3 4 5 6 7 8 9
1567%%% Exclamation ! Double quote " Hash (number) #
1568%%% Dollar $ Percent % Ampersand &
1569%%% Acute accent ' Left paren ( Right paren )
1570%%% Asterisk * Plus + Comma ,
1571%%% Minus - Point . Solidus /
1572%%% Colon : Semicolon ; Less than <
1573%%% Equals = Greater than > Question mark ?
1574%%% At @ Left bracket [ Backslash \
1575%%% Right bracket ] Circumflex ^ Underscore _
1576%%% Grave accent ` Left brace { Vertical bar |
1577%%% Right brace } Tilde ~
1578%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1579%% Local Variables:
1580%% mode:latex
1581%% mode:font-lock
1582%% mode:auto-fill
1583%% time-stamp-line-limit:100
1584%% End:
1585%% EOF
Note: See TracBrowser for help on using the repository browser.