%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% magic-tdas.tex -- template to write MAGIC-TDAS documents %%%----------------------------------------------------------------- %%% Kopyleft (K) 2000 J C Gonzalez %%% Max-Planck-Institut fuer Physik, %%% Foehringer Ring 6, 80805 Muenchen, Germany %%% E-mail: gonzalez@mppmu.mpg.de %%%----------------------------------------------------------------- %%% This program is free software; you can redistribute, copy, %%% modify, use it and its documentation for any purpose, %%% provided that the above copyright notice appear in all %%% copies and that both that copyright notice and this %%% permission notice appear in supporting documentation. %%% %%% This piece of code is distributed in the hope that it will %%% be useful, but WITHOUT ANY WARRANTY; without even the %%% implied warranty of FITNESS FOR A PARTICULAR PURPOSE. %%% %%% Although you can actually do whatever you want with this %%% file (following the copyright notice above), your are %%% strongly encouraged NOT to edit directly this file. %%% Instead, make a copy and edit the copy for your purposes. %%% %%% Modifying thie original file means that you actually have %%% the (very basic) knowledge needed to make things by your %%% own, and therefore... you will not get _any_ additional %%% support :-) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Last update: Time-stamp: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \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{ The Reflector simulation program v.0.5 } \author{A.Moralejo\\ \texttt{}} \date{June 04, 2002\\} \TDAScode{MAGIC-TDAS 02-05\\ 020604/AMoralejo} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% title %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \maketitle %% abstract %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{abstract} In this document we provide a brief description of Reflector program (version 0.5) and a guide to install and run it. \end{abstract} %% contents %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \thetableofcontents \newpage %% body %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %------------------------------------------------------------ \section{Introduction} The Reflector program was originally written by Jose Carlos Gonz\'alez and then improved by Harald Kornmayer. In September 2001 D. Bastieri and C. Bigongiari released a new version (v.0.4) to adapt it to a format change in the MMCS output. The Reflector program reads in MMCS output files (cerxxxxxx files from corsika) and writes an output file with the information about all the photons which reach the telescope focal plane (taking into account atmospheric and mirror absorption) and which are within the camera radius defined in the file {\bf magic.def}. %------------------------------------------------------------ \section{Description of simulation} The main steps of the simulation are: \begin{enumerate} \item Atmospheric absorption. \item Checking if the photon hits the dish. \item Aluminum absorption. \item Determination of the mirror hitted. \item Mirror reflection. \item Checking if the photon is inside the camera borders. \item Calculation of photon arrival time on camera. \end{enumerate} The reflection of each mirror element is simulated in a realistic way by introducing a gaussian spread of the reflected photons positions on the camera plane. The sigma of this PSF is defined via the {\bf point\_spread} parameter in the telescope description file {\bf magic.def}, and has a value of 0.5 cm, which corresponds approximately to the quality of the MAGIC mirrors produced up to date. Also the possible misalignment of mirror elements is simulated (see section \ref{neededfiles}). \section{Notes on version 0.5} \begin{enumerate} \item An error was found by T. Hengstebeck in step 2 (see above) in version 0.4. This was the main reason for the release of this corrected version 0.5. The error was in {\bf ph2cph.c}, and was a confusion between {\it CORSIKA}'s coordinate system and the coordinate system of the telescope. The error had no effect when the telescope was pointing at zenith, but resulted on a loss of photons (which should have been reflected), which became larger with increasing $\theta$. The fractions of lost photons were negligible up to $\theta \simeq 10^\circ$ and then 0.006, 0.012, 0.019, 0.070, 0.286, 0.433 respectively for $\theta = $ 15, 20, 25, 40, 60 and $70^\circ$. \item NEW VARIABLES: some variables which were unused in the event header of the output have changed meaning to incorporate some relevant items. The header size is the same as before, so this output files will be readable by all {\bf camera} versions at least up to 0.5. The twelve new variables (see header structure in section \ref{out}) are the following: % \begin{itemize} \item {\bf TelescopePhi, TelescopeTheta:} telescope orientation chosen in the input card (in degrees). \item {\bf ViewConeRadius:} if ViewConeRadius $> 0$, indicates the outer radius of the viewing cone chosen in {\it CORSIKA} via the \texttt{VIEWCONE} option for the random generation of the of the primaries' incidence directions. The inner radius is assumed 0, and the direction around which the cone is defined is given by the header variables {\bf ThetaMin}, {\bf PhiMin} (which equal in that case {\bf ThetaMax}, {\bf PhiMax}). The \texttt{VIEWCONE} option should be the standard for MAGIC MC generation in the case of hadronic primaries. However, if ViewConeRadius is 0, it will mean that the \texttt{VIEWCONE} option has not been used and the generation of directions has been done in a ``square'' sky window {\bf (PhiMin, PhiMax), (ThetaMin, ThetaMax)}, as in older versions of {\it CORSIKA}. \item {\bf num\_mirrors:} total number of mirrors in the dish. For {\it historical} reasons we are using as default a dish with 920 mirrors. This should perhaps be updated in the future to the final design with (may be) 956 mirrors. It is not a very critical detail, since the only difference will be a global change in the amount of light reaching the camera, and this amount depends also on other factors like mirror reflectivity (which in the real telescope will change with time). \item {\bf mean\_reflectivity:} mean value of the mirror reflectivity values in the range 270 - 610 nm, as read from the input file {\bf reflectivity.dat}. No spectral weighting is done on this mean, since at the time of the calculation the Cherenkov spectrum is not known by the program. In principle, we will still use a constant reflectivity value of 0.9, independent of wavelength, but this may change in the future to render the simulation more realistic. \item {\bf longi\_Nmax, logi\_t0, longi\_tmax, longi\_a, longi\_b, longi\_c, longi\_chi2:} longitudinal charged particle distribution parameters and $\chi^2$ of the fit. See {\it CORSIKA} manual for precise meaning of these (which changed slightly from version 5.61 onwards). The most important of them is {\bf longi\_tmax}, the atmospheric depth (in g/cm$^2$) of the shower maximum. \end{itemize} % \item We added an option to tell the Reflector program where (in {\it CORSIKA}'s coordinates) the telescope should be placed (see section \ref{opt}). This is important because the cerxxxxxx files contain only the photons which reach the ground near the telescope (in the standard mode of production for MAGIC, those hitting a sphere of 20 m diameter centered on the telescope), and the previous versions of Reflector only worked if the telescope was placed at its default position (0,0). For certain studies it is sometimes necessary to shift the telescope to a different position (for instance, to generate showers with impact point fixed with respect to the telescope). \item In the magic.def file which comes with Reflector\_0.5 the value of the parameter {\bf camera\_width} (radius around the center of the camera beyond which the photons are not written to the Reflector output file) has been changed from 100 to 70 cm, which allows to reduce the size of the output files, while it is a value safe enough to keep all the photons needed by the camera program. \item Removed some useless bits of code: in previous versions a binary file, {\bf magic.def.mirr}, containing the mirror data was created once the ASCII file {\bf magic.def} was read. Later, everytime the Reflector was run, it read the mirror data from magi.def.mirr. Now magic.def.mirr has been suppressed and the data are always read from magic.def. Another obsolete file, {\bf focals.dat} has been removed from the {\bf Data/} directory. \end{enumerate} %------------------------------------------------------------ \section{How to Install Reflector Program \label{installation}} You can get the current version of the Reflector Program from the MAGIC web page: \\ {\bf http://hegra1.mppmu.mpg.de/MAGICWeb/ }\\ You can find the latest public version of this program as tarred gzipped file in the Monte Carlo Download area (you need the usual password). You have to download the file reflector\_0.5.tar.gz and then follow the instructions below: \begin{description} \item[Decompress the file using:] gunzip reflector*.tar.gz \item[Unpack the tar file with:] tar xvf reflector*.tar \item[Make symbolic links running the script:] refl-install \item[Go to the directory where the source files are:] cd MagicProgs/Simulation/Detector/Reflector\_0.5/ \item[Check if all dependencies are fulfilled:] make depend \item[Compile the program:] make \end{description} If everything goes right you should have an executable file called {\bf reflector}. %------------------------------------------------------------ \section{How to Run Reflector Program \label{running}} You need a steering card to run the Reflector program. You can find an example in the {\bf MagicProgs/Simulation/Detector/Reflector\_0.5/input.card} file. You have to modify this file according to your needs (see below for instructions about steering card) and then run the program with the following statement:\\ \hspace{1cm}{\bf reflector $<$ input.card} %------------------------------------------------------------ \section{Needed Files \label{neededfiles}} The Reflector program needs some other files to run. These files are the following: \begin{itemize} \item {\bf magic.def}: contains the description of MAGIC telescope geometry, together with some other parameters needed by the Reflector program. \item {\bf axisdev.dat}: contains data to simulate the possible deviation of the spot of each single mirror on the camera plane due to its non perfect alignment. The values are x, y coordinates distributed at random (according to a gaussian with $\sigma \simeq 0.5$ cm). \item {\bf reflectivity.dat}: contains the mirror reflectivity index as a function of the wavelength. \end{itemize} All these files are usually in the {\bf MagicProgs/Simulation/Detector/Data/} directory and in principle you should {\bf not} make any change in them. %------------------------------------------------------------ \section{Steering Card} The steering card sets all the parameters and options to steer the reflection simulation. Each line of the steering card is a statement with its parameters, if it is the case. Lines beginning with \# are considered comments. The Reflector program parses all the lines sequentially. Then if you repeat a statement with different options only the last one will be considered. \subsection{Mandatory Commands} \begin{description} \item[reflector 0.5] This statement must be the first line of the steering card file. The Reflector program checks it to verify if it is reading a steering card. \item[output\_file /disk99/reflex/Gamma\_0\_7\_1001to1010\_w0.rfl] The output\_file command specifies the name and the path of the output file. The path can be absolute, like in the example above, or relative. Although any name can be used, conventionally the Reflector program output file name has the .rfl extension, and starts with the primary particle name. The first number indicates the zenith angle of the incident primaries, the second one indicates the production site (7 is for Padua) and is related to the random number generator seed used by CORSIKA. Then the run number range is shown (10 runs in this case, from 1001 to 1010). Each run corresponds to 10000 showers. Finally, the label "w0" means no wobble mode was used (telescope pointing at the source). Alternatively, the "w+" or "w-" labels (only in gamma files) refer to the two pointings in the Wobble-observation mode (see TDAS 01-05 by W. Wittek). \item[ct\_file ../Data/magic.def] The ct\_file statement defines where the program can find the telescope characteristics. The path in the example above is correct to run reflector in MagicProgs/Simu\-la\-tion/De\-tector/Reflector\_0.5/ directory. If you want to run it in a different directory you have to modify the path accordingly. \item[atm\_model ATM\_CORSIKA] The atm\_model statement says to the program what kind of atmospheric absorption model to use. Possible choices are: ATM\_CORSIKA, ATM\_ISO\-THERMAL, ATM\_90\-PER\-CENT and ATM\_NO\-ATMO\-SPHE\-RE. \item[fixed\_target 0. 90.] This statement fixes the telescope axis position. The first number is the zenith angle $\theta$ (deg) while the second is the azimuthal angle $\phi$ (deg). This corresponds to {\it CORSIKA}'s definition of primary particle incident direction (see {\it CORSIKA} manual). $\phi = 90^\circ$ means that the telescope is pointing towards East (bear in mind that in {\it CORSIKA} $(\phi, \theta)$ indicates the direction of the {\it momentum} of the incident particle). \item[cer\_files] All the lines following this statement are considered files to be processed by the Reflector program, one for each line, eventually with their paths (see the example below). Therefore this command must be the last one.\\ \\ cer\_files\\ /disk99/cer001001\\ /disk99/cer001002\\ /disk99/cer001003\\ ........ \\ /disk99/cer001009\\ /disk99/cer001010\\ \\ The cer file name can be followed by two numbers, for example: \\ /disk99/cer001001 376 5723\\ \\ In this case the program processes only the events between and including the numbers given. \end{description} \subsection{Optional Commands \label{opt}} \begin{description} \item[verbose\_level 1] Sets the quantity of information printed out by Reflector when running. Possible values are 0 to 4 \item[max\_events 50000] Fixes the maximum number of events to process. \item[energy\_cuts 100 1000] This statement forces the Reflector to process only showers with primary energy between the given values (GeV). \item[seeds n1 n2] Seeds for the random number generators to used by the program for the simulation of the absorption (both in the atmosphere and on the mirror). Default values are 3141592 and 2718182. \item[telescope\_position x y] Option included in version 0.5 of Reflector. Usually it is not needed, since for normal MC production for MAGIC the telescope is placed at the origin of coordinates (0,0). But, if for some reason, we produce cerxxxxxx files with the telescope in a different position, we must inform the Reflector program in the input card using this option (otherwise Reflector will fail to {\it find} the photons in the cer file). \item[reflectivity\_file /path/reflectivity.dat] File containing mirror reflectivity as a function of wavelength (see section \ref{neededfiles}). If this option is not supplied, the program will look for ``../Data/reflectivity.dat'' as previous versions of Reflector did. \item[axisdev\_file /path/axisdev.dat] File containing single mirror spot deviation in {\bf x} and {\bf y} on the camera in cm (see section \ref{neededfiles}) for each mirror. If this option is not supplied, the program will look for ``../Data/axisdev.dat'' as previous versions of Reflector did. \end{description} %------------------------------------------------------------ \section{Output file \label{out}} The output file begins with some ascii lines:\\ \\ \verb"reflector 0.5" \\ \verb"START---RUN" \\ \verb"START-EVENT" \\ After the \verb"START-EVENT" flag there is a blank line and then the binary event header, which contains the following informations (each variable is a 4-byte float number): \\ \begin{tabular}{ll} Variable & Description \\ \hline EvtNumber & Event Number \\ PrimaryID & Primary particle identification code \\ Etotal & Primary particle total energy (GeV) \\ Thick0 & CORSIKA's starting altitude in g/cm2 \\ FirstTarget & CORSIKA's number of first target if fixed \\ zFirstInt & Height of first interaction in cm \\ p[3] & Primary particle momentum in x,y,-z directions (GeV) \\ Theta & Primary particle zenith angle (rad) \\ Phi & Primary particle azimuth angle (rad) \\ NumRndSeq & Number of different CORSIKA random sequences (max. 10) \\ RndData[10][3] & RndData[i][0]: integer seed of sequence i \\ & RndData[i][1]: number of offset random calls (mod $10^6$) of sequence i. \\ & RndData[i][2]: number of offset random calls ($/ 10^6$) of sequence i. \\ RunNumber & Run number \\ DateRun & Date of run yymmdd \\ Corsika\_version & Version of {\it CORSIKA} \\ NumObsLev & Number of observation levels (should be always 1 for us) \\ HeightLev & Height of observation level in cm \\ num\_mirrors & Number of mirrors \\ mean\_reflectivity & Mean reflectivity between 270 and 610 nm \\ & \\ & 6 next variables: CORSIKA longitudinal particle fit parameters \\ & \hspace{0.5cm} (see CORSIKA manual for precise meaning and units)\\ longi\_Nmax & Numer of charged particles at maximum \\ longi\_t0 & Atmospheric depth of shower starting point (N=0) \\ longi\_tmax & Atmospheric depth of shower maximum (g/cm$^2$) \\ longi\_a & \\ longi\_b & For {\bf longi\_a}, {\bf longi\_b}, {\bf longi\_c}, see CORSIKA manual \\ longi\_c & \\ longi\_chi2 & $\chi^2/dof$ of the fit\\ & \\ SlopeSpec & Energy spectrum slope \\ ELowLim & Energy lower limit (GeV) \\ EUppLim & Energy upper limit (GeV) \\ ThetaMin & Minimum Theta of primaries (deg) \\ ThetaMax & Maximum Theta of primaries (deg) \\ PhiMin & Minimum Phi of primaries (deg) \\ PhiMax & Maximum Phi of primaries (deg) \\ CWaveLower & Wavelength lower limit (nm) \\ CWaveUpper & Wavelength upper limit (nm) \\ CorePos[2][20] & Core positions of randomized shower \\ TimeFirst & Arrival time on camera of first photon (ns) \\ TimeLast & Arrival time on camera of last photon (ns) \\ & Next three variables changed meaning in version 0.5: \\ telescopePhi & Telescope azimuth (rad). Measured from South, counter-clockwise \\ telescopeTheta & Telescope zenith angle (rad) \\ ViewConeRadius & Outer radius (deg) in {\it CORSIKA}'s VIEWCONE option, if used. Inner r is assumed 0.\\ \hline \end{tabular} % \newpage % \begin{tabular}{ll} Variable & Description \\ \hline CORSIKAPhs & Original photons written by {\it CORSIKA} \\ AtmAbsPhs & Photons absorbed by the atmosphere \\ MirrAbsPhs & Photons absorbed by the mirror \\ OutOfMirrPhs & Photons outside the mirror \\ BlackSpotPhs & Photons lost in the "black spot" \\ OutOfChamPhs & Photons outside the camera \\ CPhotons & Photons reaching the camera \\ \hline \end{tabular} \vspace*{1cm} The event header is followed by 8-word blocks, one for each photon that reaches the camera. A photon block contains the following variables: \begin{tabular}{ll} Variable & Description \\ \hline w & Wavelength (nm) \\ x, y & Impact point in camera coordinates (cm) \\ u, v & Director cosines \\ t & Arrival time on camera (ns) \\ h & Production height (cm) \\ phi & Incidence angle with respect to camera plane (rad) \\ \hline \end{tabular} After the last event photon block there is a blank line, an \verb$END---EVENT$ flag, another blank line and then the following event. After the last event in a run it appears the flag \verb$END-----RUN$, while after every processed runs, you can find a \verb$END----FILE$ flag. %------------------------------------------------------------ \section{Future improvements} Possible improvements of the reflector simulation could be: \begin{enumerate} \item Introduce dependence of mirror reflectivity as a function of wavelength using recent measurements performed on real mirrors. \item Adittion of a Run header: some parameters which are the same for each run are still kept (again for historical reasons) in the event header. It would be better to move them to a Run header. This has not yet been implemented in this version in order to make it compatible with the corresponding version of the {\it camera} program. I would also allow to include more detailed information on the used telescope geometry (number and position of mirrors) and reflectivity (as a function of wavelength). \end{enumerate} \par Please contact \texttt{moralejo@pd.infn.it}. for suggestions on other features to be implemented in future versions. \section{Appendix} The list of all Reflector files follows. \begin{verbatim} refl-install MagicProgs/Simulation/Detector/Reflector_0.5/Makefile MagicProgs/Simulation/Detector/Reflector_0.5/atm.c MagicProgs/Simulation/Detector/Reflector_0.5/atm.h MagicProgs/Simulation/Detector/Reflector_0.5/attenu.f MagicProgs/Simulation/Detector/Reflector_0.5/config.mk.linux MagicProgs/Simulation/Detector/Reflector_0.5/config.mk.linux-gnu MagicProgs/Simulation/Detector/Reflector_0.5/config.mk.osf1 MagicProgs/Simulation/Detector/Reflector_0.5/diag.c MagicProgs/Simulation/Detector/Reflector_0.5/diag.h MagicProgs/Simulation/Detector/Reflector_0.5/geometry.c MagicProgs/Simulation/Detector/Reflector_0.5/geometry.h MagicProgs/Simulation/Detector/Reflector_0.5/header.c MagicProgs/Simulation/Detector/Reflector_0.5/header.h MagicProgs/Simulation/Detector/Reflector_0.5/init.c MagicProgs/Simulation/Detector/Reflector_0.5/init.h MagicProgs/Simulation/Detector/Reflector_0.5/input.card MagicProgs/Simulation/Detector/Reflector_0.5/lagrange.h MagicProgs/Simulation/Detector/Reflector_0.5/parms.c MagicProgs/Simulation/Detector/Reflector_0.5/parms.h MagicProgs/Simulation/Detector/Reflector_0.5/ph2cph.c MagicProgs/Simulation/Detector/Reflector_0.5/reflector.c MagicProgs/Simulation/Detector/Reflector_0.5/version.h MagicProgs/Simulation/Detector/Reflector_0.5/doc/magic-tdas.sty MagicProgs/Simulation/Detector/Reflector_0.5/doc/magiclogo.eps MagicProgs/Simulation/Detector/Reflector_0.5/doc/Tdas0205.ps MagicProgs/Simulation/Detector/Reflector_0.5/doc/Tdas0205.tex MagicProgs/Simulation/Detector/Data/axisdev.dat MagicProgs/Simulation/Detector/Data/magic.def MagicProgs/Simulation/Detector/Data/reflectivity.dat \end{verbatim} %%% BIBLIOGRAPHY %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%>>>> Use the following if you are using BibTeX for bibliography %\theBibliography %%>>>> Or the following if you include here by hand your %%>>>> bibliographic entries \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