Index: trunk/MagicSoft/Simulation/Detector/TimeCam/MTrigger.card
===================================================================
--- trunk/MagicSoft/Simulation/Detector/TimeCam/MTrigger.card	(revision 353)
+++ trunk/MagicSoft/Simulation/Detector/TimeCam/MTrigger.card	(revision 353)
@@ -0,0 +1,6 @@
+channel_threshold    2.5
+gate_length          3.
+
+response_fwhm        2.5
+response_ampl        1.   
+exit
Index: trunk/MagicSoft/Simulation/Detector/TimeCam/Makefile
===================================================================
--- trunk/MagicSoft/Simulation/Detector/TimeCam/Makefile	(revision 353)
+++ trunk/MagicSoft/Simulation/Detector/TimeCam/Makefile	(revision 353)
@@ -0,0 +1,379 @@
+##################################################################
+#
+# makefile
+#
+# @file        makefile 
+# @title       Simulation of the camera and trigger logic
+# @author      J C Gonz\'alez
+# @email       gonzalez@mppmu.mpg.de
+# @date        Fri Mar 12 11:51:11 MET 1999
+#
+#_______________________________________________________________
+#
+# Created: Fri Mar 12 11:51:11 MET 1999
+# Author:  Jose Carlos Gonzalez
+# Purpose: Makefile for the compilation of the camera program
+# Notes:   
+#    
+#---------------------------------------------------------------
+#
+# $RCSfile: Makefile,v $
+# $Revision: 1.1.1.1 $
+# $Author: harald $ 
+# $Date: 2000-02-08 15:13:44 $
+#
+##################################################################
+# @maintitle
+
+# @code
+
+INCLUDEMK = config.mk.${OSTYPE}
+include ${INCLUDEMK}
+
+# @endcode
+
+# @code 
+
+# common flags
+INCLUDES = -I${INCLUDE}      \
+		   -I${INCLUDE_COR}  \
+		   -I${INCLUDE_MC}   \
+		   -I${INCLUDE_EVITA}   \
+		   -I${INCLUDE_TRIGGER}   \
+		   -I${INCLUDE_FADC}   \
+		   -I${INCLUDE_REFL} \
+                   -I${INCLUDE_ROOT} \
+	           -I${INCLUDE_CPLUS}
+
+RANLIB  = -L${RANLIBDIR} -lranlib
+
+# what is needed for ROOT is inside the config.mk... file
+
+
+# special flags
+
+osf_FORLIBS = -lUfor -lfor -lutil -lots -lm 
+#linux_FORLIBS =  -lf2c -lm /usr/lib/libc.a
+linux_FORLIBS =  -lm -ldl 
+#linux_FORLIBS =  -lm -ldl -rdynamic
+generic_FORLIBS = -lm 
+
+FORLIBS = ${${SYSTEM}_FORLIBS}
+
+# compilation and linking flags
+
+CXXFLAGS  = -D__${SYSTEM}__ ${INCLUDES} ${OPTIM} ${DEBUG}
+CFLAGS    = ${CXXFLAGS}
+FFLAGS    = ${CXXFLAGS}
+LIBS      = ${RANLIB} ${ROOTLIBS} ${ROOTGLIBS} ${GLIBS}
+
+#------------------------------------------------------------------------------
+
+#.SILENT:
+
+.SUFFIXES: .c .cxx .C .c++ .h .hxx .H .h++ .o .so .f
+
+SRCS = \
+	${INCLUDE_MC}/MCEventHeader.cxx \
+	${INCLUDE_MC}/MCCphoton.cxx \
+	${INCLUDE_TRIGGER}/MTrigger.cxx \
+	${INCLUDE_TRIGGER}/MGTriggerSignal.cxx \
+	${INCLUDE_EVITA}/MRawPixel.cxx \
+	${INCLUDE_EVITA}/MRawEvt.cxx \
+	${INCLUDE_EVITA}/MMcEvt.cxx \
+	${INCLUDE_EVITA}/MMcTrig.cxx \
+	MCamCint.cxx \
+	creadparam.cxx \
+	timecam.cxx   
+
+HEADERS = \
+	MCEventHeader.hxx \
+	MCCphoton.hxx \
+	MTRigger.hxx \
+	MGTriggerSignal.hxx \
+	MRawPixel.h \
+	MRawEvt.h \
+	MMcEvt.h \
+	MMcTrig.hxx \
+	lagrange.h \
+	atm.h \
+	creadparam.h \
+	timecam.h
+
+OBJS = \
+	${INCLUDE_MC}/MCEventHeader.o \
+	${INCLUDE_MC}/MCCphoton.o \
+	${INCLUDE_TRIGGER}/MTrigger.o \
+	${INCLUDE_TRIGGER}/MGTriggerSignal.o \
+	${INCLUDE_EVITA}/MRawPixel.o \
+	${INCLUDE_EVITA}/MRawEvt.o \
+	${INCLUDE_EVITA}/MMcEvt.o \
+	${INCLUDE_EVITA}/MMcTrig.o \
+	MCamCint.o \
+	creadparam.o \
+	timecam.o      
+
+############################################################
+
+all: ${PROGRAM}
+
+depend:
+	@makedepend $(SRCS) $(INCLUDES) -fMakefile 2> kk.kk ; cat kk.kk
+
+doc: camera-doc
+
+camera-doc: 
+	@echo "Generating documentation for camera . . . "
+	$(DOCUM) -latex -o camera.tex \
+	camera.cxx camera.h \
+	creadparam.cxx creadparam.h \
+	moments.cxx moments.h
+	latex "\nonstopmode\input{camera.tex}" && \
+	makeindex camera && \
+	latex "\nonstopmode\input{camera.tex}" && \
+	latex "\nonstopmode\input{camera.tex}"
+	@echo "Files camera.tex and camera.dvi generated."
+
+${PROGRAM}: $(OBJS) 
+	@echo "Linking..." 
+	echo `ls -m $(OBJS)|sed 's/,/ +/g' `" + libraries => " $@
+	$(CXX) $(CXXFLAGS) $(OBJS) $(LIBS) -o $@
+	@echo "done."
+
+
+MCamCint.cxx: 	${INCLUDE_EVITA}/MRawPixel.h \
+		${INCLUDE_EVITA}/MRawEvt.h \
+		${INCLUDE_EVITA}/MMcEvt.h \
+		${INCLUDE_EVITA}/MMcTrig.hxx \
+		${INCLUDE_EVITA}/Mdefine.h
+
+		@echo
+		@echo "Generating dictionary ..."
+		@echo
+
+		@$(ROOTSYS)/bin/rootcint -f  \
+		MCamCint.cxx -c \
+		${INCLUDE_EVITA}/MRawPixel.h \
+		${INCLUDE_EVITA}/MRawEvt.h \
+		${INCLUDE_EVITA}/MMcEvt.h \
+		${INCLUDE_EVITA}/MMcTrig.hxx \
+		${INCLUDE_EVITA}/Mdefine.h \
+		${INCLUDE_EVITA}/LinkDef.h
+
+		@echo
+		@echo "Dictionary done"
+		@echo
+
+.cxx.o:	
+	@echo "Compiling " $<
+	$(CXX) $(CXXFLAGS) -c $< -o $@
+
+.c.o:	
+	@echo "Compiling " $<
+	$(CC) $(CFLAGS) -c $< -o $@
+
+lclean:
+	@echo "Cleanning..."
+	@rm -f *.o core 
+
+clean:
+	@echo "Cleanning..."
+	@rm -f $(OBJS) core 
+	@rm -f MCamCint.cxx MCamCint.h 
+
+mrproper: clean
+	@echo "Mr.Proper in action . . ."
+	@rm -f $(PROGRAM)
+
+ctags:
+	@echo "Creating CTAGS file . . ."
+	@ctags -txw $(SRCS) $(HEADERS) > CTAGS
+
+etags:
+	@echo "Creating TAGS file . . ."
+	@etags -C $(SRCS) $(HEADERS)
+
+listsrc:
+	@ls -m $(SRCS) $(HEADERS) | sed 's/,//g'
+
+redo: clean all
+
+cflags: 
+	@echo $(INCLUDES) $(CXXFLAGS)
+
+# @endcode
+
+# DO NOT DELETE THIS LINE -- make depend depends on it.
+
+../include-MC/MCEventHeader.o: ../include-MC/MCEventHeader.hxx
+../include-MC/MCEventHeader.o: ../include-GENERAL/Rtypes.h
+../include-MC/MCEventHeader.o: /usr/include/g++/iostream.h
+../include-MC/MCEventHeader.o: /usr/include/g++/streambuf.h
+../include-MC/MCEventHeader.o: /usr/include/libio.h /usr/include/_G_config.h
+../include-MC/MCEventHeader.o: /usr/include/bits/types.h
+../include-MC/MCEventHeader.o: /usr/include/features.h
+../include-MC/MCEventHeader.o: /usr/include/sys/cdefs.h
+../include-MC/MCEventHeader.o: /usr/include/gnu/stubs.h
+../include-MC/MCEventHeader.o: /usr/lib/gcc-lib/i486-linux/2.7.2.3/include/stddef.h
+../include-MC/MCEventHeader.o: /usr/lib/gcc-lib/i486-linux/2.7.2.3/include/stdarg.h
+../include-MC/MCEventHeader.o: /usr/include/g++/iomanip.h
+../include-MC/MCEventHeader.o: /usr/include/g++/fstream.h
+../include-MC/MCEventHeader.o: /usr/include/stdlib.h /usr/include/sys/types.h
+../include-MC/MCEventHeader.o: /usr/include/time.h /usr/include/endian.h
+../include-MC/MCEventHeader.o: /usr/include/bits/endian.h
+../include-MC/MCEventHeader.o: /usr/include/sys/select.h
+../include-MC/MCEventHeader.o: /usr/include/bits/select.h
+../include-MC/MCEventHeader.o: /usr/include/bits/sigset.h
+../include-MC/MCEventHeader.o: /usr/include/sys/sysmacros.h
+../include-MC/MCEventHeader.o: /usr/include/alloca.h /usr/include/math.h
+../include-MC/MCEventHeader.o: /usr/include/bits/huge_val.h
+../include-MC/MCEventHeader.o: /usr/include/bits/mathdef.h
+../include-MC/MCEventHeader.o: /usr/include/bits/mathcalls.h
+../include-MC/MCEventHeader.o: /usr/lib/gcc-lib/i486-linux/2.7.2.3/include/float.h
+../include-MC/MCEventHeader.o: ../include-CORSIKA/COREventHeader.hxx
+../include-MC/MCCphoton.o: ../include-MC/MCCphoton.hxx
+../include-MC/MCCphoton.o: ../include-GENERAL/Rtypes.h
+../include-MC/MCCphoton.o: /usr/include/g++/iostream.h
+../include-MC/MCCphoton.o: /usr/include/g++/streambuf.h /usr/include/libio.h
+../include-MC/MCCphoton.o: /usr/include/_G_config.h /usr/include/bits/types.h
+../include-MC/MCCphoton.o: /usr/include/features.h /usr/include/sys/cdefs.h
+../include-MC/MCCphoton.o: /usr/include/gnu/stubs.h
+../include-MC/MCCphoton.o: /usr/lib/gcc-lib/i486-linux/2.7.2.3/include/stddef.h
+../include-MC/MCCphoton.o: /usr/lib/gcc-lib/i486-linux/2.7.2.3/include/stdarg.h
+../include-MC/MCCphoton.o: /usr/include/g++/iomanip.h
+../include-MC/MCCphoton.o: /usr/include/g++/fstream.h /usr/include/stdlib.h
+../include-MC/MCCphoton.o: /usr/include/sys/types.h /usr/include/time.h
+../include-MC/MCCphoton.o: /usr/include/endian.h /usr/include/bits/endian.h
+../include-MC/MCCphoton.o: /usr/include/sys/select.h
+../include-MC/MCCphoton.o: /usr/include/bits/select.h
+../include-MC/MCCphoton.o: /usr/include/bits/sigset.h
+../include-MC/MCCphoton.o: /usr/include/sys/sysmacros.h /usr/include/alloca.h
+../include-MC/MCCphoton.o: /usr/include/string.h /usr/include/math.h
+../include-MC/MCCphoton.o: /usr/include/bits/huge_val.h
+../include-MC/MCCphoton.o: /usr/include/bits/mathdef.h
+../include-MC/MCCphoton.o: /usr/include/bits/mathcalls.h
+../include-MC/MCCphoton.o: /usr/lib/gcc-lib/i486-linux/2.7.2.3/include/float.h
+../include-MC/MCCphoton.o: ../include-GENERAL/jcmacros.h
+../include-MTrigger/MTrigger.o: ../include-MTrigger/MTrigger.hxx
+../include-MTrigger/MTrigger.o: /usr/include/g++/iostream.h
+../include-MTrigger/MTrigger.o: /usr/include/g++/streambuf.h
+../include-MTrigger/MTrigger.o: /usr/include/libio.h /usr/include/_G_config.h
+../include-MTrigger/MTrigger.o: /usr/include/bits/types.h
+../include-MTrigger/MTrigger.o: /usr/include/features.h
+../include-MTrigger/MTrigger.o: /usr/include/sys/cdefs.h
+../include-MTrigger/MTrigger.o: /usr/include/gnu/stubs.h
+../include-MTrigger/MTrigger.o: /usr/lib/gcc-lib/i486-linux/2.7.2.3/include/stddef.h
+../include-MTrigger/MTrigger.o: /usr/lib/gcc-lib/i486-linux/2.7.2.3/include/stdarg.h
+../include-MTrigger/MTrigger.o: /usr/include/math.h
+../include-MTrigger/MTrigger.o: /usr/include/bits/huge_val.h
+../include-MTrigger/MTrigger.o: /usr/include/bits/mathdef.h
+../include-MTrigger/MTrigger.o: /usr/include/bits/mathcalls.h
+../include-MTrigger/MTrigger.o: /usr/lib/gcc-lib/i486-linux/2.7.2.3/include/float.h
+../include-MTrigger/MTrigger.o: /cern/root/include/TROOT.h
+../include-MTrigger/MTrigger.o: /cern/root/include/TObject.h
+../include-MTrigger/MTrigger.o: /cern/root/include/TRandom.h
+../include-MTrigger/MTrigger.o: /cern/root/include/TH1.h
+../include-MTrigger/MTrigger.o: ../../../include-Classes/Mdefine.h
+../include-MTrigger/MTrigger.o: ../../../include-Classes/MMcEvt.h
+../include-MTrigger/MTrigger.o: /usr/include/stdlib.h
+../include-MTrigger/MTrigger.o: /usr/include/sys/types.h /usr/include/time.h
+../include-MTrigger/MTrigger.o: /usr/include/endian.h
+../include-MTrigger/MTrigger.o: /usr/include/bits/endian.h
+../include-MTrigger/MTrigger.o: /usr/include/sys/select.h
+../include-MTrigger/MTrigger.o: /usr/include/bits/select.h
+../include-MTrigger/MTrigger.o: /usr/include/bits/sigset.h
+../include-MTrigger/MTrigger.o: /usr/include/sys/sysmacros.h
+../include-MTrigger/MTrigger.o: /usr/include/alloca.h /usr/include/stdio.h
+../include-MTrigger/MTrigger.o: /usr/include/bits/stdio_lim.h
+../include-MTrigger/MTrigger.o: /usr/include/string.h /usr/include/unistd.h
+../include-MTrigger/MTrigger.o: /usr/include/bits/posix_opt.h
+../include-MTrigger/MTrigger.o: /usr/include/bits/confname.h
+../include-MTrigger/MTrigger.o: /usr/include/getopt.h /usr/include/fcntl.h
+../include-MTrigger/MTrigger.o: /usr/include/bits/fcntl.h
+../include-MTrigger/MTrigger.o: ../include-MTrigger/MTriggerDefine.h
+../include-MTrigger/MTrigger.o: /cern/root/include/TFile.h
+../include-MTrigger/MTrigger.o: /cern/root/include/TObjArray.h
+../include-MTrigger/MTrigger.o: ../include-MTrigger/MGTriggerSignal.hxx
+../include-MTrigger/MTrigger.o: /cern/root/include/TApplication.h
+../include-MTrigger/MTrigger.o: /cern/root/include/TVirtualX.h
+../include-MTrigger/MTrigger.o: /cern/root/include/TGListBox.h
+../include-MTrigger/MTrigger.o: /cern/root/include/TGClient.h
+../include-MTrigger/MTrigger.o: /cern/root/include/GuiTypes.h
+../include-MTrigger/MTrigger.o: /cern/root/include/TGFrame.h
+../include-MTrigger/MTrigger.o: /cern/root/include/TGIcon.h
+../include-MTrigger/MTrigger.o: /cern/root/include/TGLabel.h
+../include-MTrigger/MTrigger.o: /cern/root/include/TGButton.h
+../include-MTrigger/MTrigger.o: /cern/root/include/TGTextEntry.h
+../include-MTrigger/MTrigger.o: /cern/root/include/TGMsgBox.h
+../include-MTrigger/MTrigger.o: /cern/root/include/TGMenu.h
+../include-MTrigger/MTrigger.o: /cern/root/include/TGCanvas.h
+../include-MTrigger/MTrigger.o: /cern/root/include/TGComboBox.h
+../include-MTrigger/MTrigger.o: /cern/root/include/TGTab.h
+../include-MTrigger/MTrigger.o: /cern/root/include/TGSlider.h
+../include-MTrigger/MTrigger.o: /cern/root/include/TGDoubleSlider.h
+../include-MTrigger/MTrigger.o: /cern/root/include/TGFileDialog.h
+../include-MTrigger/MTrigger.o: /cern/root/include/TRootEmbeddedCanvas.h
+../include-MTrigger/MTrigger.o: /cern/root/include/TCanvas.h
+../include-MTrigger/MTrigger.o: /cern/root/include/TH2.h
+../include-MTrigger/MTrigger.o: /cern/root/include/TSystem.h
+../include-MTrigger/MTrigger.o: /cern/root/include/TEnv.h
+../include-MTrigger/MGTriggerSignal.o: ../include-MTrigger/MGTriggerSignal.hxx
+../include-MTrigger/MGTriggerSignal.o: /usr/include/stdlib.h
+../include-MTrigger/MGTriggerSignal.o: /usr/include/features.h
+../include-MTrigger/MGTriggerSignal.o: /usr/include/sys/cdefs.h
+../include-MTrigger/MGTriggerSignal.o: /usr/include/gnu/stubs.h
+../include-MTrigger/MGTriggerSignal.o: /usr/lib/gcc-lib/i486-linux/2.7.2.3/include/stddef.h
+../include-MTrigger/MGTriggerSignal.o: /usr/include/sys/types.h
+../include-MTrigger/MGTriggerSignal.o: /usr/include/bits/types.h
+../include-MTrigger/MGTriggerSignal.o: /usr/include/time.h
+../include-MTrigger/MGTriggerSignal.o: /usr/include/endian.h
+../include-MTrigger/MGTriggerSignal.o: /usr/include/bits/endian.h
+../include-MTrigger/MGTriggerSignal.o: /usr/include/sys/select.h
+../include-MTrigger/MGTriggerSignal.o: /usr/include/bits/select.h
+../include-MTrigger/MGTriggerSignal.o: /usr/include/bits/sigset.h
+../include-MTrigger/MGTriggerSignal.o: /usr/include/sys/sysmacros.h
+../include-MTrigger/MGTriggerSignal.o: /usr/include/alloca.h
+../include-MTrigger/MGTriggerSignal.o: /usr/include/g++/iostream.h
+../include-MTrigger/MGTriggerSignal.o: /usr/include/g++/streambuf.h
+../include-MTrigger/MGTriggerSignal.o: /usr/include/libio.h
+../include-MTrigger/MGTriggerSignal.o: /usr/include/_G_config.h
+../include-MTrigger/MGTriggerSignal.o: /usr/lib/gcc-lib/i486-linux/2.7.2.3/include/stdarg.h
+../include-MTrigger/MGTriggerSignal.o: /cern/root/include/TROOT.h
+../include-MTrigger/MGTriggerSignal.o: /cern/root/include/TApplication.h
+../include-MTrigger/MGTriggerSignal.o: /cern/root/include/TVirtualX.h
+../include-MTrigger/MGTriggerSignal.o: /cern/root/include/TGListBox.h
+../include-MTrigger/MGTriggerSignal.o: /cern/root/include/TGClient.h
+../include-MTrigger/MGTriggerSignal.o: /cern/root/include/GuiTypes.h
+../include-MTrigger/MGTriggerSignal.o: /cern/root/include/TGFrame.h
+../include-MTrigger/MGTriggerSignal.o: /cern/root/include/TGIcon.h
+../include-MTrigger/MGTriggerSignal.o: /cern/root/include/TGLabel.h
+../include-MTrigger/MGTriggerSignal.o: /cern/root/include/TGButton.h
+../include-MTrigger/MGTriggerSignal.o: /cern/root/include/TGTextEntry.h
+../include-MTrigger/MGTriggerSignal.o: /cern/root/include/TGMsgBox.h
+../include-MTrigger/MGTriggerSignal.o: /cern/root/include/TGMenu.h
+../include-MTrigger/MGTriggerSignal.o: /cern/root/include/TGCanvas.h
+../include-MTrigger/MGTriggerSignal.o: /cern/root/include/TGComboBox.h
+../include-MTrigger/MGTriggerSignal.o: /cern/root/include/TGTab.h
+../include-MTrigger/MGTriggerSignal.o: /cern/root/include/TGSlider.h
+../include-MTrigger/MGTriggerSignal.o: /cern/root/include/TGDoubleSlider.h
+../include-MTrigger/MGTriggerSignal.o: /cern/root/include/TGFileDialog.h
+../include-MTrigger/MGTriggerSignal.o: /cern/root/include/TRootEmbeddedCanvas.h
+../include-MTrigger/MGTriggerSignal.o: /cern/root/include/TCanvas.h
+../include-MTrigger/MGTriggerSignal.o: /cern/root/include/TH1.h
+../include-MTrigger/MGTriggerSignal.o: /cern/root/include/TH2.h
+../include-MTrigger/MGTriggerSignal.o: /cern/root/include/TRandom.h
+../include-MTrigger/MGTriggerSignal.o: /cern/root/include/TSystem.h
+../include-MTrigger/MGTriggerSignal.o: /usr/include/stdio.h
+../include-MTrigger/MGTriggerSignal.o: /usr/include/bits/stdio_lim.h
+../include-MTrigger/MGTriggerSignal.o: /cern/root/include/TEnv.h
+../include-MTrigger/MGTriggerSignal.o: ../../../include-Classes/MMcEvt.h
+../include-MTrigger/MGTriggerSignal.o: /usr/include/string.h
+../include-MTrigger/MGTriggerSignal.o: /usr/include/unistd.h
+../include-MTrigger/MGTriggerSignal.o: /usr/include/bits/posix_opt.h
+../include-MTrigger/MGTriggerSignal.o: /usr/include/bits/confname.h
+../include-MTrigger/MGTriggerSignal.o: /usr/include/getopt.h
+../include-MTrigger/MGTriggerSignal.o: /usr/include/fcntl.h
+../include-MTrigger/MGTriggerSignal.o: /usr/include/bits/fcntl.h
+../include-MTrigger/MGTriggerSignal.o: /cern/root/include/TObject.h
+../include-MTrigger/MGTriggerSignal.o: /cern/root/include/TPavesText.h
+../include-MTrigger/MGTriggerSignal.o: /cern/root/include/TObjArray.h
Index: trunk/MagicSoft/Simulation/Detector/TimeCam/ShortManual.tex
===================================================================
--- trunk/MagicSoft/Simulation/Detector/TimeCam/ShortManual.tex	(revision 353)
+++ trunk/MagicSoft/Simulation/Detector/TimeCam/ShortManual.tex	(revision 353)
@@ -0,0 +1,223 @@
+%
+% Musterbrief, Auszuege aus DIN 5008, Adressenbeispiele
+%
+% Das unmittelbar Folgende enthaelt alle Befehle des dinbrief.sty,
+% kann daher als Vorlage dienen.
+%
+\documentstyle[german]{article}
+\textwidth 140mm
+\textheight 200mm
+%\pagestyle{empty}
+
+	
+\begin{document}
+%
+%  
+%
+
+%
+%    Short introduction about the camera program
+%
+\section{Camera Program}
+
+\subsection{Abstract}
+	
+The Camera Program is for the simulation of the MAGIC camera. The
+input is the output of the program Reflector, what are all the
+cerenkov photons hitting the camera. All these photons are reflected
+from the mirrors. 
+
+The determination of the pixel that is hitted by one cerenkov photon
+is the first working step of the program. Then the simulation of the
+different efficencies inside the camera are following (i.e. the
+absorption due to the distance between mirrors and the camera plane, 
+the quantuum efficency of the photocathod...). 
+So after this first part we
+know the time and the Pixel identification of each
+photo electron leaving the photo cathod. 
+
+The simulation of the trigger is the next step inside the camera
+program.  
+For each photo electron one create a standard response signal.
+Also the noise (from opto-electonic) of the trigger signal is
+implemented. 
+After doing this for all photo electrons, the program
+calculates the diskriminator signal for each channel. With this
+digital signals the program decides  if a trigger is created. 
+All this trigger studies are implemented in
+the (C++) class MTrigger. At the end of each event you have the
+knowledge if there occurs a trigger signal or not. 
+
+The output of the program is a root tree (using the root package from
+CERN). In this tree there are different branches. One branch stores
+the information about the MonteCarlo event (McEvt). One the result of
+the trigger studies (McTrig). And last but not least, there is a
+branch in which the expected raw data format is stored (MRawEvt). 
+ 
+\subsection{Usage}
+
+To start the Camera Program you have to create a steercard file (see
+chapter \ref{chap_steercard}).
+I.e. this file is called {\bf input.card}. Then start the program with
+the command:
+\begin{center}
+ \bf {camera $<$ input.card }
+\end{center}
+With the steercard file one can control the program and its different
+features. In the followin you will find a special list of all the 
+steercard control words. 
+
+\subsection{Steercard control}
+\label{chap_steercard}
+
+With the steercard file the user can control the procedure of the
+Camera Program. At the beginning of the program, all lines in this
+file are read in. Depending on the first word in the line, a control
+value for the further program behaviour is set. 
+
+A list of the different steerword is following. They are seperated by
+their importance for a good simulation. 
+
+\begin{itemize} 
+  \item {\bf input and output files} \\
+	 the following steerword are neccessary to read in the data
+	 from the right file and to store the output in the right
+	 files. 
+
+	\begin{itemize}
+	   \item {\bf ct\_file } \\
+		This steerword controls the geometry of the used
+   	 	cerenkov telescope. At the beginning of the
+   	        development is was planned to simulated different
+	        types (MAGIC and CT1 of HEGRA). But if you want to
+        	simulated only for MAGIC put the following line into
+		your steercard file: \\
+		ct\_file   \hspace{10mm}   ../Data/magic.def
+	   \item {\bf input\_file} \\
+		With this line you declare the input file for the
+		camera program. The input file is the output file of
+		the Reflector Program. So the line may look like: \\
+		input\_file  \hspace{10mm}     /dat1/RefData/prot.rfl
+	   \item {\bf root\_file} \\
+		The output of the Camera Program is written in a root
+		tree. To give the root file a name used this steercard
+		control line: \\
+		root\_file   \hspace{10mm}     /dat1/CamData/prot.root
+
+		To control the different branches of the root tree,
+	   	there are some steerwords to do this job. 
+                \begin{itemize}
+		   \item {\bf nowrite\_McEvt} \\
+			In a normal run the Camera Program writes
+	   		the information of the Monte Carlo Event to
+	   		the root tree. If you use a line like:
+			nowrite\_McEvt \\
+			it does not. This is useful for testing the 
+			reconstruction precision, because the analyser 
+			doesn't now anaything about the input. 
+			
+                   \item {\bf write\_RawEvt} \\
+			If you want to create the branch with the raw 
+			data format of the events, you must use this
+			command. If you don't use it, the camera
+			program will not create and fill this branch. 
+			
+		   \item {\bf write\_McTrig} \\
+			To study some properties of the triggers, it
+			is useful to create a branch with the McTrig
+			information in it. To do this use this
+			steerword. If you don't use it, you won't get
+			any McTrig information.   
+
+                   \item Be aware! If you don't use one of this three 
+			steerwords, you get only the Monte Carlo
+			Information (McEvt) in your root tree file. 
+		\end{itemize}
+	\end{itemize}
+
+   \item {\bf amount of output data} \\
+	For different studies on needs a different amount of output
+	data. To study trigger effiencies it is neccessary to write
+	all events to file, but for the optimisation of reconstruction
+	methods you need only the triggered events. There is a
+	steerword, that controls the difference: 
+	\begin{itemize}
+	   \item {\bf write\_all\_images} \\
+		If you use this steerword, you write out all events. 
+		But the default behaviour is to write only the
+		triggered events. 
+
+	\end{itemize}
+   \item {\bf Parameters of the camera} \\
+	It is possible to control some behaviours of the camera with
+	the steercard. They all are listed here: 
+	\begin{itemize}
+	   \item {\bf ana\_pixels} \\
+		In earlier development steps it was possible to change
+	   	the size of the camera with this variable. But for the
+		actual version of the camera layout it is neccessary
+	   	to put the following line into your steercard: 
+  		ana\_pixels   \hspace{10mm}     577
+	   \end{itemize}
+
+   \item {\bf Simulation of the Night Sky Background} \\
+	Due to the night sky background there are a lot of other
+	photons reaching the camera. It is possible to simulate the
+	behaviour of such NSK photons using the Camera Program. 
+	You can switch the NSB on and set the value of NSB photons. 
+	This is done with the following steerwords: 
+	\begin{itemize}
+	   \item {\bf nsb\_on} \\
+		To start the simulation of the NSB use this
+		steerword.
+	   \item {\bf nsb\_mean} \\
+		To set the NSB to a given value use the following
+		line:\\[1mm]
+		nsb\_mean   \hspace{10mm}     0.09 \\[1mm]
+		This value corresponds to 0.09 NSB photon in 1 ns for
+		the inner pixels. 
+	\end{itemize}
+	
+
+   \item {\bf Parameters of the random generator} \\
+	The simulation of some efficencies need a random
+	generator. This generator is a part of the ranlib. To set the
+	seed of the generator you can use the following steercard
+	line: 
+	\begin{itemize}
+	   \item {\bf seeds} \\
+		You must put a line in your steercard file, that looks
+		like: 	 \\ 
+  		seeds   \hspace{5mm}  12345\hspace{5mm}  67890
+	   \end{itemize}
+
+   \item {\bf Don't forget the end} \\
+	Very important is the last line in the steercard file. This
+	linie indicates the end of the steercard. So don't forget to
+	put end\_file marker at the end of the file!!\\[1mm]
+	{\bf end\_file} \\
+\end{itemize}
+So at the end the file may look like: 
+\begin{verbatim}
+#
+input_file    /dat1/RefData/gamma.rfl
+root_file     /dat1/CamData/gamma.root
+#
+ct_file       ../Data/magic.def
+#
+write_all_images
+#
+write_McTrig
+#
+ana_pixels    577
+#
+seeds   69184 10406
+#
+end_file
+\end{verbatim}
+
+\end{document}
+
+
+
+
Index: trunk/MagicSoft/Simulation/Detector/TimeCam/config.mk.linux-gnu
===================================================================
--- trunk/MagicSoft/Simulation/Detector/TimeCam/config.mk.linux-gnu	(revision 353)
+++ trunk/MagicSoft/Simulation/Detector/TimeCam/config.mk.linux-gnu	(revision 353)
@@ -0,0 +1,86 @@
+##################################################################
+#
+# config.mk
+#
+# @file        config.mk
+# @title       small configuration file for Makefile
+# @author      J C Gonz\'alez
+# @email       gonzalez@mppmu.mpg.de
+# @date        Fri Mar 12 11:51:11 MET 1999
+#
+#_______________________________________________________________
+#
+# Created: Fri Mar 12 11:51:11 MET 1999
+# Author:  Jose Carlos Gonzalez
+# Purpose: Makefile for the compilation of the camera program
+# Notes:   
+#    
+#---------------------------------------------------------------
+# $RCSfile: config.mk.linux-gnu,v $
+# $Revision: 1.1.1.1 $
+# $Author: harald $ 
+# $Date: 2000-02-08 15:13:44 $
+##################################################################
+# @maintitle
+
+# @code
+
+# program
+
+PROGRAM = timecam
+
+# compilers
+
+CC            = g++
+CXX           = g++
+F77           = f77
+
+DOCUM         = ${HOME}/detector/sus/sus
+
+# includes
+
+INCLUDE         = ../include-GENERAL
+INCLUDE_COR     = ../include-CORSIKA
+INCLUDE_MC      = ../include-MC
+INCLUDE_TRIGGER = ../include-MTrigger
+INCLUDE_FADC    = ../include-MFadc
+INCLUDE_EVITA   = ../../../include-Classes
+INCLUDE_REFL    = ../Reflector
+INCLUDE_ROOT    = ${ROOTSYS}/include
+INCLUDE_CPLUS   = /usr/include/g++
+
+OPTIM    = -O2 -Wall -fno-rtti -fno-exceptions -fPIC
+DEBUG    = -g 
+
+# libraries
+
+ROOTLIBS =  `root-config --libs`
+
+#  	-L/CERN/root/lib -lNew -lCore -lCint -lHist \
+#		-lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript \
+#		-lMatrix -lPhysics -lm  
+
+ROOTGLIBS = `root-config --glibs`
+
+# 	-L/CERN/root/lib -lNew -lCore -lCint -lHist \
+#		-lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript \
+#		-lMatrix -lPhysics -lGui -lm  
+
+GLIBS = 	$(ROOTLIBS) $(ROOTGLIBS)
+
+
+
+RANLIBDIR = ../lib
+CERNDIR = /cern
+
+# system
+
+SYSTEM  = linux
+
+# uncomment this for quiet compilation
+
+.SILENT:
+
+# @endcode
+##EOF
+
Index: trunk/MagicSoft/Simulation/Detector/TimeCam/config.mk.osf1
===================================================================
--- trunk/MagicSoft/Simulation/Detector/TimeCam/config.mk.osf1	(revision 353)
+++ trunk/MagicSoft/Simulation/Detector/TimeCam/config.mk.osf1	(revision 353)
@@ -0,0 +1,82 @@
+##################################################################
+#
+# config.mk
+#
+# @file        config.mk
+# @title       small configuration file for Makefile
+# @author      J C Gonz\'alez
+# @email       gonzalez@mppmu.mpg.de
+# @date        Fri Mar 12 11:51:11 MET 1999
+#
+#_______________________________________________________________
+#
+# Created: Fri Mar 12 11:51:11 MET 1999
+# Author:  Jose Carlos Gonzalez
+# Purpose: Makefile for the compilation of the camera program
+# Notes:   
+#    
+#---------------------------------------------------------------
+# $RCSfile: config.mk.osf1,v $
+# $Revision: 1.1.1.1 $
+# $Author: harald $ 
+# $Date: 2000-02-08 15:13:44 $
+##################################################################
+# @maintitle
+
+# @code
+
+# program
+
+PROGRAM = timecam
+
+# compilers
+
+CC            = cc
+CXX           = cxx
+F77           = f77
+
+DOCUM         = ${HOME}/detector/sus/sus
+
+# includes
+
+INCLUDE         = ../include-GENERAL
+INCLUDE_COR     = ../include-CORSIKA
+INCLUDE_MC      = ../include-MC
+INCLUDE_TRIGGER = ../include-MTrigger
+INCLUDE_EVITA   = ../../../include-Classes
+INCLUDE_REFL    = ../Reflector
+INCLUDE_ROOT    = ${ROOTSYS}/include
+INCLUDE_CPLUS   = /usr/include/cxx
+
+OPTIM    = -ieee -arch host    
+#OPTIM    = -O2 -Wall -fno-rtti -fno-exceptions -fPIC
+DEBUG    = -g 
+
+# libraries
+
+ROOTLIBS =  	-L/CERN/root/lib -lNew -lCore -lCint -lHist \
+		-lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript \
+		-lMatrix -lPhysics -lm  
+
+ROOTGLIBS = 	-L/CERN/root/lib -lNew -lCore -lCint -lHist \
+		-lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript \
+		-lMatrix -lPhysics -lGui -lm  
+
+GLIBS = 	$(ROOTLIBS) $(ROOTGLIBS)
+
+
+
+RANLIBDIR = ../lib
+CERNDIR = /cern
+
+# system
+
+SYSTEM  = linux
+
+# uncomment this for quiet compilation
+
+.SILENT:
+
+# @endcode
+##EOF
+
Index: trunk/MagicSoft/Simulation/Detector/TimeCam/creadparam.cxx
===================================================================
--- trunk/MagicSoft/Simulation/Detector/TimeCam/creadparam.cxx	(revision 353)
+++ trunk/MagicSoft/Simulation/Detector/TimeCam/creadparam.cxx	(revision 353)
@@ -0,0 +1,1161 @@
+//=//////////////////////////////////////////////////////////////////////
+//=
+//= creadparam            
+//=
+//= @file        creadparam.cxx
+//= @desc        Reading of parameters file
+//= @author      J C Gonzalez
+//= @email       gonzalez@mppmu.mpg.de
+//= @date        Thu May  7 16:24:22 1998
+//=
+//=----------------------------------------------------------------------
+//=
+//= Created: Thu May  7 16:24:22 1998
+//= Author:  Jose Carlos Gonzalez
+//= Purpose: Program for reflector simulation
+//= Notes:   See files README for details
+//=    
+//=----------------------------------------------------------------------
+//=
+//= $RCSfile: creadparam.cxx,v $
+//= $Revision: 1.1.1.1 $
+//= $Author: harald $ 
+//= $Date: 2000-02-08 15:13:44 $
+//=
+//=//////////////////////////////////////////////////////////////////////
+
+// @T \newpage
+
+//!@section Source code of |creadparam.cxx|.
+
+/*!@"
+  
+  This section describes briefly the source code for the file
+  |creadparam.cxx|. This file is very closely related to the file
+  |readparams.cxx| from the |reflector| program. Actually, this later
+  file was the ancestror of the file you are looking at.
+
+  All the defines it uses are located in the file |creadparam.h|. In
+  the first one we can see the definitions of the commands available
+  for the parameters file. We describe these commands in a later
+  section.
+  
+  @"*/
+
+//!@subsection Includes and Global variables definition.
+
+/*!@"
+  
+  All the defines are located in the file {\tt creadparam.h}.
+
+  @"*/
+ 
+//!@{
+
+#include "creadparam.h"
+
+//!@}
+
+//!@subsection Definition of global variables.
+
+/*!@"
+
+  Here we define the global variables where the values from the
+  parameters file are stored.
+  
+  @"*/
+
+//!@{
+
+static char Input_filename[PATH_MAX_LENGTH];  //@< input filename
+static char Output_filename[PATH_MAX_LENGTH]; //@< output filename
+static char Data_filename[PATH_MAX_LENGTH];   //@< data filename
+static char DIAG_filename[PATH_MAX_LENGTH];  //@< data filename
+static char ROOT_filename[PATH_MAX_LENGTH];   //@< data filename
+static char CT_filename[PATH_MAX_LENGTH];     //@< name of the CT def. file
+static int simulateNSB = TRUE;                //@< Will we simulate NSB?
+static int anaPixels = -1;      //@< number of pixels for the analysis
+static float meanNSB;           //@< NSB mean value (per pixel)
+static float qThreshold;        //@< Threshold value
+static float qTailCut;          //@< Tail Cut value
+static int nIslandsCut;         //@< Islands Cut value
+static int countIslands = TRUE; //@< Will we count the islands?
+static long int Seeds[2]; 
+static int *Skip;
+static int nSkip=0;
+static int Data_From_STDIN = FALSE;
+static int Read_Phe = FALSE;
+static int Read_Phe_All = FALSE;
+static int Write_All_Images = FALSE;
+static int Write_McEvt  = TRUE;
+static int Write_McTrig = FALSE;
+static int Write_RawEvt = FALSE;
+static int Write_All_Data = FALSE;
+static int Select_Energy = TRUE;
+static float Select_Energy_le = 0.0;           //@< GeV
+static float Select_Energy_ue = 100000.0;      //@< GeV
+static float Trigger_Radius;
+static int Set_Trigger_Radius=FALSE;
+static float fCorrection;
+static int Apply_Correction=FALSE;
+//!@}
+
+//!@subsection The function |readparam()|.
+
+//!-----------------------------------------------------------
+// @name  creadparam
+//                                                
+// @desc  read parameters from the stdin / parameters file
+//
+// @var   *filename  Name of the parameters file (NULL->STDIN)
+//
+// @date Mon Sep 14 13:27:56 MET DST 1998
+//------------------------------------------------------------
+// @function
+
+//!@{ 
+void 
+readparam(char * filename)
+{
+  char sign[] = GLUE_postp( PROGRAM, VERSION ); //@< initialize sign
+  char line[LINE_MAX_LENGTH];    //@< line to get from the stdin
+  char token[ITEM_MAX_LENGTH];   //@< a single token
+  int i, j;                      //@< dummy counters
+  ifstream ifile;
+
+  // use cin or ifile (reading from STDIN or from parameters file?
+  if ( filename != NULL )
+    ifile.open( filename );
+
+  // get signature
+  if ( filename != NULL )
+    ifile.getline(line, LINE_MAX_LENGTH);
+  else
+    cin.getline(line, LINE_MAX_LENGTH);
+  line[strlen(SIGNATURE)] = '\0';
+  strcpy(line, sign);
+  if (strcmp(sign, SIGNATURE) != 0) {
+    cerr << "ERROR: Signature of parameters file is not correct\n";
+    cerr << '"' << sign << '"' << '\n';
+    cerr << "should be: " << SIGNATURE << '\n';
+    exit(1);
+  }
+
+  // loop till the "end" directive is reached
+  int is_end = FALSE;
+  while (! is_end) {          
+
+    // get line from file or stdin
+    if ( filename != NULL )
+      ifile.getline(line, LINE_MAX_LENGTH);
+    else
+      cin.getline(line, LINE_MAX_LENGTH);
+
+    // skip comments (start with '#')
+    if (line[0] == '#')
+      continue;
+
+    // show user comments (start with '>')
+    if (line[0] == '>') {
+      cout << line << endl << flush;
+      continue;
+    }
+
+    // look for each item at the beginning of the line
+    for (i=0; i<=end_file; i++) 
+      if (strstr(line, ITEM_NAMES[i]) == line)
+        break;
+        
+    // if it is not a valid line, just ignore it
+    if (i == end_file+1) {
+      cerr << "Skipping unknown token in [" << line << "]\n";
+      continue;
+    }
+
+    // case block for each directive
+    switch ( i ) {
+
+    case input_file:          //@< name of the input file
+          
+      // get the name of the input_file from the line
+      sscanf(line, "%s %s", token, Input_filename);
+
+      break;
+
+    case output_file:         //@< name of the output file
+          
+      // get the name of the output_file from the line
+      sscanf(line, "%s %s", token, Output_filename);
+
+      break;
+
+    case data_file:           //@< name of the data file
+          
+      // get the name of the data_file from the line
+      sscanf(line, "%s %s", token, Data_filename);
+
+      break;
+
+    case diag_file:          //@< name of the DIAG file
+          
+      // get the name of the data_file from the line
+      sscanf(line, "%s %s", token, DIAG_filename);
+      cout << '[' << DIAG_filename << ']' << endl << flush;
+
+      break;
+
+    case root_file:          //@< name of the ROOT file
+          
+      // get the name of the data_file from the line
+      sscanf(line, "%s %s", token, ROOT_filename);
+      cout << '[' << ROOT_filename << ']' << endl << flush;
+
+      break;
+
+    case ct_file:             //@< name of the telescope file
+          
+      // get the name of the ct_file from the line
+      sscanf(line, "%s %s", token, CT_filename);
+
+      break;
+
+    case nsb_on:              //@< simulate NSB?
+          
+      // we will simulate NSB
+      simulateNSB = TRUE;
+          
+      break;
+
+    case nsb_off:             //@< simulate NSB?
+          
+      // we will NOT simulate NSB
+      simulateNSB = FALSE;
+          
+      break;
+
+    case nsb_mean:            //@< value of <NSB> per pixel
+          
+      // get value of <NSB> (in photons)
+      sscanf(line, "%s %f", token, &meanNSB);
+      simulateNSB = TRUE;
+
+      break;
+
+    case ana_pixels:          //@< number of pixels for analysis
+          
+      // number of pixels for analysis
+      sscanf(line, "%s %d", token, &anaPixels);
+
+      break;
+
+    case threshold:           //@< value of threshold for trigger (q0)
+          
+      // get value of threshold (in ph.e.)
+      sscanf(line, "%s %f", token, &qThreshold);
+
+      break;
+
+    case tail_cut:            //@< value of tail_cut (t0)
+          
+      // get value of tail_cut (in ph.e.)
+      sscanf(line, "%s %f", token, &qTailCut);
+
+      break;
+
+    case islands_on:          //@< DO count islands
+          
+      // DO count islands
+      countIslands = TRUE;
+          
+      break;
+
+    case islands_off:         //@< do NOT count islands
+          
+      // do NOT count islands
+      countIslands = FALSE;
+          
+      break;
+
+    case islands_cut:         //@< value of islands_cut (i0)
+          
+      // get value of islands_cut (in ph.e.)
+      sscanf(line, "%s %d", token, &nIslandsCut);
+      countIslands = TRUE;
+
+      break;
+
+    case seeds:               //@< values of seeds for random numbers
+          
+      // get seeds
+      sscanf(line, "%s %ld %ld", token, &Seeds[0], &Seeds[1]);
+
+      break;
+
+    case skip:                //@< skip pathological showers
+          
+      // get showers to skip
+      cin >> nSkip;
+      Skip = new int[nSkip];
+      for (j=0; j<nSkip; ++j) {
+        cin >> Skip[j];
+        cout << Skip[j] << endl << flush;
+      }
+
+      break;
+
+    case data_from_stdin:     //@< to read data from stdin
+          
+      // change boolean value
+      Data_From_STDIN = TRUE;
+
+      break;
+
+    case read_phe:            //@< to read PHE files
+          
+      // change boolean value
+      Read_Phe = TRUE;
+
+      break;
+
+    case read_phe_all:        //@< to read PHE files from write_all_images
+          
+      // change boolean value
+      Read_Phe_All = TRUE;
+
+      break;
+
+    case write_all_images:    //@< to write ALL the images
+          
+      // change boolean value
+      Write_All_Images = TRUE;
+
+      break;
+
+    case nowrite_McEvt:    //@< do not write the McEvt info
+          
+      // change boolean value
+      Write_McEvt = FALSE;
+
+      break;
+
+    case write_McTrig:    //@< to write the McTrig info
+          
+      // change boolean value
+      Write_McTrig = TRUE;
+
+      break;
+
+    case write_RawEvt:    //@< to write the RawEvt data
+          
+      // change boolean value
+      Write_RawEvt = TRUE;
+
+      break;
+
+
+
+
+    case write_all_data:      //@< to write single pixel data
+          
+      // change boolean value
+      Write_All_Data = TRUE;
+
+      break;
+
+    case select_energy:       //@< value of islands_cut (i0)
+          
+      // get energy range
+      sscanf(line, "%s %f %f", token, &Select_Energy_le, &Select_Energy_ue);
+      Select_Energy = TRUE;
+
+      break;
+
+    case trigger_radius:      //@< set radius of trigger area 
+          
+      // get trigger radius
+      sscanf(line, "%s %f", token, &Trigger_Radius);
+      Set_Trigger_Radius = TRUE;
+
+      break;
+
+    case correction:          //@< apply a kind of correction to pixel values
+          
+      // get trigger radius
+      sscanf(line, "%s %f", token, &fCorrection);
+      Apply_Correction = TRUE;
+
+      break;
+
+    case end_file:            //@< end of the parameters file
+
+      // show a short message
+      is_end = TRUE;
+
+      break;
+
+    } // switch ( i ) 
+
+  } // while (! is_end)
+
+  // after the loop is finished, return to the main function
+  return;
+}
+//!@}
+
+
+//!-----------------------------------------------------------
+// @name get_input_filename
+//                                                
+// @desc get name of the input file
+//
+// @return   Name of the Input file
+//
+// @date Mon Sep 14 13:27:56 MET DST 1998
+//------------------------------------------------------------
+// @function 
+
+//!@{
+char *
+get_input_filename(void)
+{
+  return (Input_filename);
+}
+//!@}
+
+
+//!-----------------------------------------------------------
+// @name get_output_filename
+//                                                
+// @desc get name of the output file
+//
+// @return   Name of the Output file
+//
+// @date Mon Sep 14 13:27:56 MET DST 1998
+//------------------------------------------------------------
+// @function 
+
+//!@{
+char *
+get_output_filename(void)
+{
+  return (Output_filename);
+}
+//!@}
+
+
+//!-----------------------------------------------------------
+// @name get_data_filename
+//                                                
+// @desc get name of the data file
+//
+// @return   Name of the Data file
+//
+// @date Mon Sep 14 13:27:56 MET DST 1998
+//------------------------------------------------------------
+// @function 
+
+//!@{
+char *
+get_data_filename(void)
+{
+  return (Data_filename);
+}
+//!@}
+
+
+//!-----------------------------------------------------------
+// @name get_diag_filename
+//                                                
+// @desc get name of the diagnostic output file
+//
+// @return   Name of the DIAG file
+//
+// @date Mon Sep 14 13:27:56 MET DST 1998
+//------------------------------------------------------------
+// @function 
+
+//!@{
+char *
+get_diag_filename(void)
+{
+  return (DIAG_filename);
+}
+//!@}
+
+
+//!-----------------------------------------------------------
+// @name get_root_filename
+//                                                
+// @desc get name of the ROOT file
+//
+// @return   Name of the ROOT file
+//
+// @date Mon Sep 14 13:27:56 MET DST 1998
+//------------------------------------------------------------
+// @function 
+
+//!@{
+char *
+get_root_filename(void)
+{
+  return (ROOT_filename);
+}
+//!@}
+
+
+
+//!-----------------------------------------------------------
+// @name get_ct_filename
+//                                                
+// @desc get name of CT definition file
+//
+// @return   Name of the CT definition file
+//
+// @date Mon Sep 14 13:27:56 MET DST 1998
+//------------------------------------------------------------
+// @function 
+
+//!@{
+char *
+get_ct_filename(void)
+{
+  return (CT_filename);
+}
+//!@}
+
+
+//!-----------------------------------------------------------
+// @name get_nsb
+//                                                
+// @desc are we going to simulate NSB ?
+//
+// @var  *n  Mean value for the NSB (ph.e./pixel)
+// @return   TRUE: we'll simulate NSB; FALSE: we won't
+//
+// @date Mon Sep 14 13:27:56 MET DST 1998
+//------------------------------------------------------------
+// @function 
+
+//!@{
+int
+get_nsb(float *n)
+{
+  *n = meanNSB;
+  return ( simulateNSB );
+}
+//!@}
+
+
+//!-----------------------------------------------------------
+// @name get_threshold   
+//                                                
+// @desc get threshold value
+//
+// @return   Value of the threshold q$_0$
+//
+// @date Mon Sep 14 13:27:56 MET DST 1998
+//------------------------------------------------------------
+// @function 
+
+//!@{
+float 
+get_threshold(void)
+{
+  return( qThreshold );
+}
+//!@}
+
+
+//!-----------------------------------------------------------
+// @name get_tail_cut   
+//                                                
+// @desc get tail cut value
+//
+// @return   Value for the Tail-cut
+//
+// @date Mon Sep 14 13:27:56 MET DST 1998
+//------------------------------------------------------------
+// @function 
+
+//!@{
+float 
+get_tail_cut(void)
+{
+  return( qTailCut );
+}
+//!@}
+
+
+//!-----------------------------------------------------------
+// @name get_islands_cut
+//                                                
+// @desc are we going to count the islands ?
+//
+// @var  *n  Cut on islands number
+// @return   TRUE: we'll count the islands; FALSE: we won't
+//
+// @date Mon Sep 14 13:27:56 MET DST 1998
+//------------------------------------------------------------
+// @function 
+
+//!@{
+int
+get_islands_cut(int *n)
+{
+  *n = nIslandsCut;
+  return ( countIslands );
+}
+//!@}
+
+
+//!-----------------------------------------------------------
+// @name get_ana_pixels
+//                                                
+// @desc number of pixels for the analysis
+//
+// @return  Number of pixels to use in the image parameters
+//
+// @date Mon Sep 14 13:27:56 MET DST 1998
+//------------------------------------------------------------
+// @function 
+
+//!@{
+int
+get_ana_pixels(void)
+{
+  return ( anaPixels );
+}
+//!@}
+
+
+//!-----------------------------------------------------------
+// @name get_seeds
+//                                                
+// @desc are we going to count the islands ?
+//
+// @var  *n  Number of the seed
+// @return   N-th random-number Seed
+//
+// @date Mon Sep 14 13:27:56 MET DST 1998
+//------------------------------------------------------------
+// @function 
+
+//!@{
+long int
+get_seeds(int n)
+{
+  return ( Seeds[n] );
+}
+//!@}
+
+
+//!-----------------------------------------------------------
+// @name get_skip_showers
+//                                                
+// @desc get list of showers to skip
+//
+// @var *s1  Pointer to a vector of number of showers
+//
+// @date Mon Sep 14 13:27:56 MET DST 1998
+//------------------------------------------------------------
+// @function 
+
+//!@{
+void 
+get_skip_showers( int *s )
+{
+  int i;
+  for (i=0; i<nSkip; ++i)
+    s[i] = Skip[i];
+}
+//!@}
+
+
+//!-----------------------------------------------------------
+// @name get_nskip_showers
+//                                                
+// @desc get number of showers to skip
+//
+// @return  Number of showers to be skipped
+//
+// @date Mon Sep 14 13:27:56 MET DST 1998
+//------------------------------------------------------------
+// @function 
+
+//!@{
+int 
+get_nskip_showers( void )
+{
+  return( nSkip );
+}
+//!@}
+
+
+//!-----------------------------------------------------------
+// @name get_data_from_stdin
+//                                                
+// @desc get whether we will read the data from the STDIN
+//
+// @return  TRUE: we'll read data from STDIN; FALSE: we won't
+//
+// @date Wed Nov 25 13:21:00 MET 1998
+//------------------------------------------------------------
+// @function 
+
+//!@{
+int
+get_data_from_stdin(void)
+{
+  return ( Data_From_STDIN );
+}
+//!@}
+
+
+//!-----------------------------------------------------------
+// @name get_read_phe
+//                                                
+// @desc get whether we will read PHE files
+//
+// @return  TRUE: we'll read PHE files; FALSE: we won't
+//
+// @date Wed Nov 25 13:21:00 MET 1998
+//------------------------------------------------------------
+// @function 
+
+//!@{
+int
+get_read_phe(void)
+{
+  return ( Read_Phe );
+}
+//!@}
+
+
+//!-----------------------------------------------------------
+// @name get_read_phe_all
+//                                                
+// @desc get whether we will read PHE files, with write_all_images
+//
+// @return  TRUE: we'll do it; FALSE: we won't
+//
+// @date Wed Nov 25 13:21:00 MET 1998
+//------------------------------------------------------------
+// @function 
+
+//!@{
+int
+get_read_phe_all(void)
+{
+  return ( Read_Phe_All );
+}
+//!@}
+
+
+//!-----------------------------------------------------------
+// @name write_all_images
+//                                                
+// @desc write all images to .phe, even those without trigger
+//
+// @return  TRUE: we'll write everything; FALSE: we won't
+//
+// @date Wed Nov 25 13:21:00 MET 1998
+//------------------------------------------------------------
+// @function 
+
+//!@{
+int
+get_write_all_images(void)
+{
+  return ( Write_All_Images );
+}
+//!@}
+
+
+//!-----------------------------------------------------------
+// @name write_all_data
+//                                                
+// @desc write single pixel data to file .dat
+//
+// @return  TRUE: we'll write everything; FALSE: we won't
+//
+// @date Wed Nov 25 13:21:00 MET 1998
+//------------------------------------------------------------
+// @function 
+
+//!@{
+int
+get_write_all_data(void)
+{
+  return ( Write_All_Data );
+}
+//!@}
+
+
+//!-----------------------------------------------------------
+// @name write_McEvt
+//                                                
+// @desc write the McEvt class for each event to the .root file 
+//
+// @return  TRUE: we'll write it;  FALSE: we won't
+//
+//------------------------------------------------------------
+// @function 
+
+//!@{
+int
+get_write_McEvt(void)
+{
+  return ( Write_McEvt );
+}
+//!@}
+
+//!-----------------------------------------------------------
+// @name write_McTrig
+//                                                
+// @desc write the McTrig class for each event to the .root file 
+//
+// @return  TRUE: we'll write it;  FALSE: we won't
+//
+//------------------------------------------------------------
+// @function 
+ 
+//!@{
+int
+get_write_McTrig(void)
+{
+  return ( Write_McTrig );
+}
+//!@}
+
+//!-----------------------------------------------------------
+// @name write_RawEvt
+//                                                
+// @desc write the RawEvt class for each event to the .root file 
+//
+// @return  TRUE: we'll write it;  FALSE: we won't
+//
+//------------------------------------------------------------
+// @function 
+
+//!@{
+int
+get_write_RawEvt(void)
+{
+  return ( Write_RawEvt );
+}
+//!@}
+
+
+//!-----------------------------------------------------------
+// @name get_select_energy                                      
+//
+// @desc return energy range allowed for showers from .phe file
+//
+// @var *le  Lower limit in the allowed energy range
+// @var *ue  Lower limit in the allowed energy range
+// @return  TRUE: we make selection on the energy; FALSE: we don't
+//
+// @date Wed Nov 25 13:21:00 MET 1998
+//------------------------------------------------------------
+// @function 
+
+//!@{
+int
+get_select_energy(float *le, float *ue)
+{
+  *le = Select_Energy_le;
+  *ue = Select_Energy_ue;
+  return ( Select_Energy );
+}
+//!@}
+
+
+//!-----------------------------------------------------------
+// @name get_trigger_radius                                  
+//
+// @desc return the radius of the trigger area in the camera (if set)
+//
+// @var *radius  Radius of the trigger area in the camera
+// @return  TRUE: we choose a given radius for the trigger area
+//
+// @date Fri May  7 11:07:43 MET DST 1999
+//------------------------------------------------------------
+// @function 
+
+//!@{
+int get_trigger_radius(float *radius)
+{
+  *radius = Trigger_Radius;
+  return ( Set_Trigger_Radius );
+}
+//!@}
+
+
+//!-----------------------------------------------------------
+// @name get_trigger_radius                                  
+//
+// @desc return the radius of the trigger area in the camera (if set)
+//
+// @var *radius  Radius of the trigger area in the camera
+// @return  TRUE: we choose a given radius for the trigger area
+//
+// @date Fri May  7 11:07:43 MET DST 1999
+//------------------------------------------------------------
+// @function 
+
+//!@{
+int get_correction(float *corr)
+{
+  *corr = fCorrection;
+  return ( Apply_Correction );
+}
+//!@}
+
+
+//=------------------------------------------------------------
+//!@subsection Log of this file.
+
+//!@{
+//
+// $Log: not supported by cvs2svn $
+// Revision 1.1.1.1  1999/11/05 11:59:34  harald
+// This the starting point for CVS controlled further developments of the
+// camera program. The program was originally written by Jose Carlos. 
+// But here you can find a "rootified" version to the program. This means 
+// that there is no hbook stuff in it now. Also the output of the
+// program changed to the MagicRawDataFormat. 
+//
+// The "rootification" was done by Dirk Petry and Harald Kornmayer. 
+//
+// In the following you can see the README file of that version:
+//
+// ==================================================
+//
+// Fri Oct 22  1999   D.P.
+//
+// The MAGIC Monte Carlo System
+//
+// Camera Simulation Programme
+// ---------------------------
+//
+// 1) Description
+//
+// This version is the result of the fusion of H.K.'s
+// root_camera which is described below (section 2)
+// and another version by D.P. which had a few additional
+// useful features.
+//
+// The version compiles under Linux with ROOT 2.22 installed
+// (variable ROOTSYS has to be set).
+//
+// Compile as before simply using "make" in the root_camera
+// directory.
+//
+// All features of H.K.'s root_camera were retained.
+//
+// Additional features of this version are:
+//
+//   a) HBOOK is no longer used and all references are removed.
+//
+//   b) Instead of HBOOK, the user is given now the possibility of 
+//      having Diagnostic data in ROOT format as a complement
+//      to the ROOT Raw data.
+//
+//      This data is written to the file which is determined by
+//      the new input parameter "diag_file" in the camera parameter
+//      file.
+//
+//      All source code file belonging to this part have filenames
+//      starting with "MDiag".
+//
+//      The user can read the output file using the following commands
+//      in an interactive ROOT session:
+//
+//        	root [0] .L MDiag.so
+// 	root [1] new TFile("diag.root");
+// 	root [2] new TTreeViewer("T");
+// 	
+//      This brings up a viewer from which all variables of the
+//      TTree can be accessed and histogrammed. This example
+//      assumes that you have named the file "diag.root", that
+//      you are using ROOT version 2.22 or later and that you have
+//      the shared object library "MDiag.so" which is produced
+//      by the Makefile along with the executable "camera".
+//        
+//  !   The contents of the so-called diag file is not yet fixed.
+//  !   At the moment it is what J.C.G. used to put into the HBOOK
+//  !   ntuple. In future versions the moments calculation can be
+//  !   removed and the parameter list be modified correspondingly.
+//
+//   c) Now concatenated reflector files can be read. This is useful
+//      if you have run the reflector with different parameters but
+//      you want to continue the analysis with all reflector data
+//      going into ONE ROOT outputfile.
+//
+//      The previous camera version contained a bug which made reading 
+//      of two or more concatenated reflector files impossible.
+//
+//   d) The reflector output format was changed. It is now version
+//      0.4 .
+//      The change solely consists in a shortening of the flag
+//      definition in the file 
+//
+//            include-MC/MCCphoton.hxx  
+//
+//  !   IF YOU WANT TO READ REFLECTOR FORMAT 0.3, you can easily
+//  !   do so by recompiling camera with the previous version of
+//  !   include-MC/MCCphoton.hxx.
+//
+//      The change was necessary for saving space and better
+//      debugging. From now on, this format can be frozen.
+//
+//  !   For producing reflector output in the new format, you
+//  !   of course have to recompile your reflector with the
+//  !   new include-MC/MCCphoton.hxx .
+//
+//   e) A first version of the pixelization with the larger
+//      outer pixels is implemented. THIS IS NOT YET FULLY
+//      TESTED, but first rough tests show that it works
+//      at least to a good approximation.
+//
+//      The present version implements the camera outline
+//      with 18 "gap-pixels" and 595 pixels in total as
+//      shown in 
+//
+//         http://sarastro.ifae.es/internal/home/hardware/camera/numbering.ps
+//
+//      This change involved 
+//
+// 	(i) The file pixels.dat is no longer needed. Instead
+//           the coordinates are generated by the program itself
+//           (takes maybe 1 second). In the file 
+//
+// 		pixel-coords.txt
+//
+// 	  in the same directory as this README, you find a list
+//           of the coordinates generated by this new routine. It
+//           has the format
+//
+//               number   i   j   x  y  size-factor
+//
+//           where i and j are J.C.G.'s so called biaxis hexagonal
+//           coordinates (for internal use) and x and y are the
+//           coordinates of the pixel centers in the standard camera
+//           coordinate system in units of centimeters. The value
+//           of "size-factor" determines the linear size of the pixel
+//           relative to the central pixels. 
+//
+//         (ii) The magic.def file has two additional parameters
+//           which give the number of central pixels and the
+//           number of gap pixels
+//
+//         (iii) In camera.h and camera.cxx several changes were 
+//           necessary, among them the introduction of several
+//           new functions 
+//
+//      The newly suggested outline with asymmetric Winston cones
+//      will be implemented in a later version.
+//
+//   f) phe files can no longer be read since this contradicts
+//      our philosophy that the analysis should be done with other
+//      programs like e.g. EVITA and not with "camera" itself.
+//      This possibility was removed. 
+//
+//   g) ROOT is no longer invoked with an interactive interface.
+//      In this way, camera can better be run as a batch program and
+//      it uses less memory.
+//
+//   h) small changes concerning the variable "t_chan" were necessary in
+//      order to avoid segmentation faults: The variable is used as an
+//      index and it went sometimes outside the limits when camera
+//      was reading proton data. This is because the reflector files
+//      don't contain the photons in a chronological order and also
+//      the timespread can be considerably longer that the foreseen
+//      digitisation timespan. Please see the source code of camera.cxx
+//      round about line 1090.
+//
+//   j) several unused variables were removed, a few warning messages
+//      occur when you compile camera.cxx but these can be ignored at
+//      the moment.
+//
+// In general the program is of course not finished. It still needs
+// debugging, proper trigger simulation, simulation of the asymmetric
+// version of the outer pixels, proper NSB simulation, adaption of
+// the diag "ntuple" contents to our need and others small improvements.
+//
+// In the directory rfl-files there is now a file in reflector format 0.4
+// containing a single event produced by the starfiled adder. It has
+// a duration of 30 ns and represents the region around the Crab Nebula.
+// Using the enclosed input parameter file, camera should process this
+// file without problems.
+//
+// 2) The README for the previous version of root_camera
+//
+// README for a preliminary version of the 
+// root_camera program. 
+//
+// root_camera is based on the program "camera"of Jose Carlos
+// Gonzalez. It was changed in the way that only the pixelisation 
+// and the distibution of the phe to the FADCs works in a 
+// first version. 
+//
+// Using the #undef command most possibilities of the orignal 
+// program are switched of. 
+//
+// The new parts are signed by 
+//
+// - ROOT or __ROOT__ 
+//   nearly all  important codelines for ROOT output are enclosed 
+//   in structures like 
+//   #ifdef __ROOT__ 
+//   
+//     code 
+//
+//   #endif __ROOT__ 
+//
+//   In same case the new lines are signed by a comment with the word 
+//   ROOT in it. 
+//
+//   For timing of the pulse some variable names are changed. 
+//   (t0, t1, t  -->  t_ini, t_fin, t_1st, t_chan,...) 
+//   Look also for this changes. 
+//
+//   For the new root-file is also a change in readparm-files
+//
+//
+// - __DETAIL_TRIGGER__
+//
+//   This is for the implementation of the current work on trigger 
+//   studies. Because the class MTrigger is not well documented it 
+//   isn´t a part of this tar file. Only a dummy File exists. 
+//
+//
+//
+// With all files in the archive, the root_camera program should run. 
+//
+// A reflector file is in the directory rfl-files
+//
+// ==================================================
+//
+// From now on, use CVS for development!!!!
+//
+//
+//
+// Revision 1.2  1999/10/22 15:01:28  petry
+// version sent to H.K. and N.M. on Fri Oct 22 1999
+//
+// Revision 1.1.1.1  1999/10/21 16:35:11  petry
+// first synthesised version
+//
+// Revision 1.6  1999/03/15  14:59:08  gonzalez
+// camera-1_1
+//
+// Revision 1.5  1999/03/02  09:56:12  gonzalez
+// *** empty log message ***
+//
+// Revision 1.4  1999/01/14  17:32:41  gonzalez
+// Added to camera the STDIN input option (data_from_input)
+//
+//!@}
+
+//=EOF
Index: trunk/MagicSoft/Simulation/Detector/TimeCam/creadparam.h
===================================================================
--- trunk/MagicSoft/Simulation/Detector/TimeCam/creadparam.h	(revision 353)
+++ trunk/MagicSoft/Simulation/Detector/TimeCam/creadparam.h	(revision 353)
@@ -0,0 +1,489 @@
+//=//////////////////////////////////////////////////////////////////////
+//=
+//= creadparam                
+//=
+//= @file        creadparam.h
+//= @desc        Header file
+//= @author      J C Gonzalez
+//= @email       gonzalez@mppmu.mpg.de
+//= @date        Thu May  7 16:24:22 1998
+//=
+//=----------------------------------------------------------------------
+//=
+//= Created: Thu May  7 16:24:22 1998
+//= Author:  Jose Carlos Gonzalez
+//= Purpose: Program for reflector simulation
+//= Notes:   See files README for details
+//=    
+//=----------------------------------------------------------------------
+//=
+//= $RCSfile: creadparam.h,v $
+//= $Revision: 1.1.1.1 $
+//= $Author: harald $ 
+//= $Date: 2000-02-08 15:13:44 $
+//=
+//=//////////////////////////////////////////////////////////////////////
+
+// @T \newpage
+
+//!@section Source code of |creadparam.h|.
+
+/*!@"
+
+  In this section you can find the source code for the file
+  |creadparam.h|.  This file is mainly needed by
+  |creadparam.cxx|. Here is located the definition of the commands you
+  can use in the parameters file. In this file, the first line must be
+  |camera 'version'|, where |'version'| is the appropiate version of
+  the output format (NOT the version of the camera program) which can
+  read the commands written in that parameters file. You cannot mix
+  parameters files and executables with different versions. The
+  current version is |camera 0.2|.
+
+  The commands now available for the parameters file are:
+
+  @itemize
+  
+  @- |input_file| filename :    
+     Sets the name of the input file (|.rfl|).
+  @- |output_file| filename :    
+     Sets the name of the output file (|.phe|).
+  @- |ct_file| filename :    
+     Sets the name of the CT definition file (|.def|).
+  @- |data_file| filename :    
+     Sets the name of the output data file (|.dat|).
+  @- |nsb_on| :    
+     Activates the NSB simulation. This is the default.
+  @- |nsb_off| :    
+     De-activates the NSB simulation.
+  @- |nsb_mean| number :    
+     Sets the mean value for the NSB.
+     Default value: 6 for CT1, 6 for MAGIC.
+     This implies always |nsb_on|.
+  @- |threshold| number :    
+     Sets the Threshold value q0. Default value: 10.
+  @- |tail_cut| number : 
+     Sets the Tail-Cut value.
+     Default value: 7.
+  @- |islands_cut| number :    
+     Sets the Islands-Cut value i0.
+     Default value: 10.
+  @- |end_file|
+     Last command in the parameters file.
+
+  @enditemize
+
+  @ignoreHTML
+  A parameters file (a small one) looks like this:
+
+  |camera 0.2|
+
+  |input_file    gm100-500.rfl|
+
+  |output_file   gm100-500.phe|
+
+  |output_file   gm100-500.dat|
+
+  |ct_file       magic.def|
+
+  |threshold     10.0|
+
+  |tail_cut      7.0|
+
+  |nsb_mean      5.0|
+
+  |end_file|
+  @endignoreHTML
+
+@"*/
+
+//!@{
+
+#ifndef _creadparam_
+#define _creadparam_
+
+#ifndef _this_
+#define _this_ creadparam
+#endif
+
+//!@}
+
+//!@subsection Include files.
+
+//!@{
+
+#include <iostream.h>
+#include <fstream.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+#include <float.h>
+
+#include "jcmacros.h"
+#include "jcdebug.h"
+
+#include "timecam-v.h"
+
+//!@}
+
+//!@subsection Macro-definitions, and constants.
+
+//!@{
+
+// now we define the list ITEM_LIST of possible items in
+// the parameters file. note that they are functions of
+// T(x). we will change T(x) to be the real item or the
+// string of this item when needed
+
+#define ITEM_LIST   /* LIST OF ITEMS IN THE PARAMETERS FILE */     \
+T(input_file),      /* input file */                              \
+T(output_file),     /* output file */                              \
+T(data_file),       /* data file */                              \
+T(diag_file),       /* diagnostic output file (ROOT format) */   \
+T(root_file),       /* ROOT file */                              \
+T(ct_file),         /* file with the characteristics of the CT */  \
+T(ana_pixels),      /* size of the camera for parameters calculation */  \
+T(nsb_on),          /* activates NSB simulation */ \
+T(nsb_off),         /* de-activates NSB simulation */ \
+T(nsb_mean),        /* mean value of NSB contribution per pixel */ \
+T(threshold),       /* value of q0 for trigger */ \
+T(tail_cut),        /* value of tail cut (t0) */ \
+T(islands_on),      /* DO count islands */ \
+T(islands_off),     /* do NOT count islands */ \
+T(islands_cut),     /* value of islands cut (i0) */ \
+T(seeds),           /* seeds for random number generation */ \
+T(data_from_stdin), /* to read data from STDIN */ \
+T(skip),            /* skip pathological showers */ \
+T(read_phe_all),    /* id., but was processed with write_all_images */ \
+T(read_phe),        /* read an already camera processed file */ \
+T(write_all_images),/* write to file .phe ALL images (even w.o. trigger)*/ \
+T(nowrite_McEvt),   /* nowrite to file .root McEvt infos */ \
+T(write_McTrig),    /* write to file .root McTrig infos */ \
+T(write_RawEvt),    /* write to file .root RawEvt infos */ \
+T(write_all_data),  /* write to file .dat ALL image data */ \
+T(select_energy),   /* energy range to read: only for .phe files */ \
+T(trigger_radius),  /* trigger radius for the camera */ \
+T(correction),      /* factor for correction in the pixel values */ \
+T(end_file)         /* end of the parameters file */
+  
+#define T(x)  x             // define T() as the name as it is
+
+enum ITEM_TYPE {
+  ITEM_LIST
+};
+
+#undef T
+
+#define T(x)  #x              // define T() as the string of x
+
+const char *const ITEM_NAMES[] = {
+  ITEM_LIST
+};
+
+#undef T
+
+#define LINE_MAX_LENGTH  400
+#define ITEM_MAX_LENGTH  40
+#define PATH_MAX_LENGTH  120
+
+// mean values of NSB contribution per pixel
+
+static const float Mean_NSB_MAGIC = 5.0; //@< for MAGIC
+static const float Mean_NSB_CT1 = 5.0;   //@< for CT1
+
+//!@}
+
+//!@subsection Prototypes of functions.
+
+//!@{
+
+//++
+// prototypes
+//--
+
+void readparam(char * filename);
+char *get_input_filename(void);
+char *get_output_filename(void);
+char *get_data_filename(void);
+char *get_diag_filename(void);
+char *get_root_filename(void);
+char *get_ct_filename(void);
+int get_nsb(float *n);
+float get_threshold(void);
+float get_tail_cut(void);
+int get_islands_cut(int *n);
+long int get_seeds(int n);
+int get_ana_pixels(void);
+void get_skip_showers( int *s ); 
+int get_nskip_showers( void ); 
+int get_data_from_stdin(void);
+int get_read_phe(void);
+int get_read_phe_all(void);
+int get_write_all_images(void);
+//
+int get_write_McEvt(void);
+int get_write_McTrig(void);
+int get_write_RawEvt(void);
+//
+int get_write_all_data(void);
+int get_select_energy(float *le, float *ue);
+int get_trigger_radius(float *radius);
+int get_correction(float *corr);
+//!@}
+
+//!@{
+
+#endif // ! _creadparam_
+
+//!@}
+
+//=------------------------------------------------------------
+//!@subsection Log of this file.
+
+//!@{
+
+/*
+ * $Log: not supported by cvs2svn $
+ * Revision 1.1.1.1  1999/11/05 11:59:34  harald
+ * This the starting point for CVS controlled further developments of the
+ * camera program. The program was originally written by Jose Carlos. 
+ * But here you can find a "rootified" version to the program. This means 
+ * that there is no hbook stuff in it now. Also the output of the
+ * program changed to the MagicRawDataFormat. 
+ *
+ * The "rootification" was done by Dirk Petry and Harald Kornmayer. 
+ *
+ * In the following you can see the README file of that version:
+ *
+ * ==================================================
+ *
+ * Fri Oct 22  1999   D.P.
+ *
+ * The MAGIC Monte Carlo System
+ *
+ * Camera Simulation Programme
+ * ---------------------------
+ *
+ * 1) Description
+ *
+ * This version is the result of the fusion of H.K.'s
+ * root_camera which is described below (section 2)
+ * and another version by D.P. which had a few additional
+ * useful features.
+ *
+ * The version compiles under Linux with ROOT 2.22 installed
+ * (variable ROOTSYS has to be set).
+ *
+ * Compile as before simply using "make" in the root_camera
+ * directory.
+ *
+ * All features of H.K.'s root_camera were retained.
+ *
+ * Additional features of this version are:
+ *
+ *   a) HBOOK is no longer used and all references are removed.
+ *
+ *   b) Instead of HBOOK, the user is given now the possibility of 
+ *      having Diagnostic data in ROOT format as a complement
+ *      to the ROOT Raw data.
+ *
+ *      This data is written to the file which is determined by
+ *      the new input parameter "diag_file" in the camera parameter
+ *      file.
+ *
+ *      All source code file belonging to this part have filenames
+ *      starting with "MDiag".
+ *
+ *      The user can read the output file using the following commands
+ *      in an interactive ROOT session:
+ *
+ *        	root [0] .L MDiag.so
+ * 	root [1] new TFile("diag.root");
+ * 	root [2] new TTreeViewer("T");
+ * 	
+ *      This brings up a viewer from which all variables of the
+ *      TTree can be accessed and histogrammed. This example
+ *      assumes that you have named the file "diag.root", that
+ *      you are using ROOT version 2.22 or later and that you have
+ *      the shared object library "MDiag.so" which is produced
+ *      by the Makefile along with the executable "camera".
+ *        
+ *  !   The contents of the so-called diag file is not yet fixed.
+ *  !   At the moment it is what J.C.G. used to put into the HBOOK
+ *  !   ntuple. In future versions the moments calculation can be
+ *  !   removed and the parameter list be modified correspondingly.
+ *
+ *   c) Now concatenated reflector files can be read. This is useful
+ *      if you have run the reflector with different parameters but
+ *      you want to continue the analysis with all reflector data
+ *      going into ONE ROOT outputfile.
+ *
+ *      The previous camera version contained a bug which made reading 
+ *      of two or more concatenated reflector files impossible.
+ *
+ *   d) The reflector output format was changed. It is now version
+ *      0.4 .
+ *      The change solely consists in a shortening of the flag
+ *      definition in the file 
+ *
+ *            include-MC/MCCphoton.hxx  
+ *
+ *  !   IF YOU WANT TO READ REFLECTOR FORMAT 0.3, you can easily
+ *  !   do so by recompiling camera with the previous version of
+ *  !   include-MC/MCCphoton.hxx.
+ *
+ *      The change was necessary for saving space and better
+ *      debugging. From now on, this format can be frozen.
+ *
+ *  !   For producing reflector output in the new format, you
+ *  !   of course have to recompile your reflector with the
+ *  !   new include-MC/MCCphoton.hxx .
+ *
+ *   e) A first version of the pixelization with the larger
+ *      outer pixels is implemented. THIS IS NOT YET FULLY
+ *      TESTED, but first rough tests show that it works
+ *      at least to a good approximation.
+ *
+ *      The present version implements the camera outline
+ *      with 18 "gap-pixels" and 595 pixels in total as
+ *      shown in 
+ *
+ *         http://sarastro.ifae.es/internal/home/hardware/camera/numbering.ps
+ *
+ *      This change involved 
+ *
+ * 	(i) The file pixels.dat is no longer needed. Instead
+ *           the coordinates are generated by the program itself
+ *           (takes maybe 1 second). In the file 
+ *
+ * 		pixel-coords.txt
+ *
+ * 	  in the same directory as this README, you find a list
+ *           of the coordinates generated by this new routine. It
+ *           has the format
+ *
+ *               number   i   j   x  y  size-factor
+ *
+ *           where i and j are J.C.G.'s so called biaxis hexagonal
+ *           coordinates (for internal use) and x and y are the
+ *           coordinates of the pixel centers in the standard camera
+ *           coordinate system in units of centimeters. The value
+ *           of "size-factor" determines the linear size of the pixel
+ *           relative to the central pixels. 
+ *
+ *         (ii) The magic.def file has two additional parameters
+ *           which give the number of central pixels and the
+ *           number of gap pixels
+ *
+ *         (iii) In camera.h and camera.cxx several changes were 
+ *           necessary, among them the introduction of several
+ *           new functions 
+ *
+ *      The newly suggested outline with asymmetric Winston cones
+ *      will be implemented in a later version.
+ *
+ *   f) phe files can no longer be read since this contradicts
+ *      our philosophy that the analysis should be done with other
+ *      programs like e.g. EVITA and not with "camera" itself.
+ *      This possibility was removed. 
+ *
+ *   g) ROOT is no longer invoked with an interactive interface.
+ *      In this way, camera can better be run as a batch program and
+ *      it uses less memory.
+ *
+ *   h) small changes concerning the variable "t_chan" were necessary in
+ *      order to avoid segmentation faults: The variable is used as an
+ *      index and it went sometimes outside the limits when camera
+ *      was reading proton data. This is because the reflector files
+ *      don't contain the photons in a chronological order and also
+ *      the timespread can be considerably longer that the foreseen
+ *      digitisation timespan. Please see the source code of camera.cxx
+ *      round about line 1090.
+ *
+ *   j) several unused variables were removed, a few warning messages
+ *      occur when you compile camera.cxx but these can be ignored at
+ *      the moment.
+ *
+ * In general the program is of course not finished. It still needs
+ * debugging, proper trigger simulation, simulation of the asymmetric
+ * version of the outer pixels, proper NSB simulation, adaption of
+ * the diag "ntuple" contents to our need and others small improvements.
+ *
+ * In the directory rfl-files there is now a file in reflector format 0.4
+ * containing a single event produced by the starfiled adder. It has
+ * a duration of 30 ns and represents the region around the Crab Nebula.
+ * Using the enclosed input parameter file, camera should process this
+ * file without problems.
+ *
+ * 2) The README for the previous version of root_camera
+ *
+ * README for a preliminary version of the 
+ * root_camera program. 
+ *
+ * root_camera is based on the program "camera"of Jose Carlos
+ * Gonzalez. It was changed in the way that only the pixelisation 
+ * and the distibution of the phe to the FADCs works in a 
+ * first version. 
+ *
+ * Using the #undef command most possibilities of the orignal 
+ * program are switched of. 
+ *
+ * The new parts are signed by 
+ *
+ * - ROOT or __ROOT__ 
+ *   nearly all  important codelines for ROOT output are enclosed 
+ *   in structures like 
+ *   #ifdef __ROOT__ 
+ *   
+ *     code 
+ *
+ *   #endif __ROOT__ 
+ *
+ *   In same case the new lines are signed by a comment with the word 
+ *   ROOT in it. 
+ *
+ *   For timing of the pulse some variable names are changed. 
+ *   (t0, t1, t  -->  t_ini, t_fin, t_1st, t_chan,...) 
+ *   Look also for this changes. 
+ *
+ *   For the new root-file is also a change in readparm-files
+ *
+ *
+ * - __DETAIL_TRIGGER__
+ *
+ *   This is for the implementation of the current work on trigger 
+ *   studies. Because the class MTrigger is not well documented it 
+ *   isn´t a part of this tar file. Only a dummy File exists. 
+ *
+ *
+ *
+ * With all files in the archive, the root_camera program should run. 
+ *
+ * A reflector file is in the directory rfl-files
+ *
+ * ==================================================
+ *
+ * From now on, use CVS for development!!!!
+ *
+ *
+ *
+ * Revision 1.2  1999/10/22 15:01:29  petry
+ * version sent to H.K. and N.M. on Fri Oct 22 1999
+ *
+ * Revision 1.1.1.1  1999/10/21 16:35:11  petry
+ * first synthesised version
+ *
+ * Revision 1.7  1999/03/15  14:59:09  gonzalez
+ * camera-1_1
+ *
+ * Revision 1.6  1999/03/02  09:56:13  gonzalez
+ * *** empty log message ***
+ *
+ * Revision 1.5  1999/01/14  17:32:43  gonzalez
+ * Added to camera the STDIN input option (data_from_input)
+ *
+ */
+
+//!@}
+//=EOF
Index: trunk/MagicSoft/Simulation/Detector/TimeCam/input.card
===================================================================
--- trunk/MagicSoft/Simulation/Detector/TimeCam/input.card	(revision 353)
+++ trunk/MagicSoft/Simulation/Detector/TimeCam/input.card	(revision 353)
@@ -0,0 +1,31 @@
+#camera 0.3
+#data_from_stdin
+#verbose_level 0 
+input_file    /dat1/RefData/test.rfl
+#input_file    /hd31/Maggi/RefData/prot_test.rfl
+#input_file    /hd31/Maggi/RefData/prot_2001-2025.rfl
+#input_file    /hd31/Maggi/RefData/prot_2101-2125.rfl
+#input_file    /hd31/Maggi/RefData/prot_2126-2150.rfl
+#input_file    /hd31/Maggi/RefData/prot_2151-2175.rfl
+root_file     /dat1/CamData/test-raw.root
+#root_file     /hd31/Maggi/CamData/prot_2151-2175.root
+#
+ct_file       ../Data/magic.def
+#
+write_all_images
+#
+#nowrite_McEvt
+write_McTrig
+#write_RawEvt
+#
+ana_pixels    577
+#
+#nsb_on
+#nsb_mean      0.09
+#
+#islands_off
+#
+seeds   69184 10406
+#
+end_file
+
Index: trunk/MagicSoft/Simulation/Detector/TimeCam/pixelcoord.dat
===================================================================
--- trunk/MagicSoft/Simulation/Detector/TimeCam/pixelcoord.dat	(revision 353)
+++ trunk/MagicSoft/Simulation/Detector/TimeCam/pixelcoord.dat	(revision 353)
@@ -0,0 +1,625 @@
+##################################################
+camera 0.2
+
+Processor of the reflector output
+J C Gonzalez, Jun 1998
+##################################################
+
+[/dat1/CamData/test-raw.root]
+[/dat1/CamData/gamma-raw.root]
+[camera 0.2]: Filenames:
+	                  In:	/dat1/RefData/gamma.rfl
+	                ROOT:	/dat1/CamData/gamma-raw.root
+	                  CT:	../Data/magic.def
+[camera 0.2]: Flags:
+	     Data_From_STDIN: [ off]
+	    Write_All_Images: [ ON ]
+[camera 0.2]: Root output:
+	         Write_McEvt: [ ON ]
+	        Write_McTrig: [ ON ]
+	        Write_RawEvt: [ off]
+[camera 0.2]: Parameters:
+	    NSB (phes/pixel): 0.000000 [ ON ]
+	    i0 (Islands-cut): 0.000000 \
+[camera 0.2]: Selections::
+	              Energy: [ ON ]  (0.000000:100000.000000)
+[read_ct_file]: start.
+[read_ct_file]: <Type of Telescope>: MAGIC
+[read_ct_file]: <Focal distance>: 1700.000000 cm
+[read_ct_file]: s(Focal distance): 0.000000 cm
+[read_ct_file]: <Point spread>: 0.500000 cm
+[read_ct_file]: s(Point spread): 0.500000 cm
+[read_ct_file]: s(Adjustment): 0.500000 cm
+[read_ct_file]: Radius of the black spots: 0.500000 cm
+[read_ct_file]: Camera width: 1000.000000 cm
+[read_ct_file]: Number of pixels: 577
+[read_ct_file]: Pixel width: 3.000000 cm
+[read_ct_file]: Number of central pixels: 397
+[read_ct_file]: Number of gap pixels: 0
+[read_ct_file]: Number of mirrors: 920
+[read_ct_file]: Radii of the mirrors: 24.750000 cm
+[read_ct_file]: Table of mirrors data:
+[read_ct_file]: Allocating memory for ct_data
+[read_ct_file]: Reading mirrors data...
+[read_ct_file]: done.
+[read_pixels]: Openning the file "../Data/qe.dat" . . .
+[read_pixels]: Reading data . . .
+[read_pixels]: Done.
+  577  397  0  180
+    1      0.000      0.000      0.000
+    2      3.000      0.000      3.000
+    3      1.500      2.598      3.000
+    4     -1.500      2.598      3.000
+    5     -3.000      0.000      3.000
+    6     -1.500     -2.598      3.000
+    7      1.500     -2.598      3.000
+    8      6.000      0.000      3.000
+    9      4.500      2.598      3.000
+   10      3.000      5.196      3.000
+   11      0.000      5.196      3.000
+   12     -3.000      5.196      3.000
+   13     -4.500      2.598      3.000
+   14     -6.000      0.000      3.000
+   15     -4.500     -2.598      3.000
+   16     -3.000     -5.196      3.000
+   17      0.000     -5.196      3.000
+   18      3.000     -5.196      3.000
+   19      4.500     -2.598      3.000
+   20      9.000      0.000      3.000
+   21      7.500      2.598      3.000
+   22      6.000      5.196      3.000
+   23      4.500      7.794      3.000
+   24      1.500      7.794      3.000
+   25     -1.500      7.794      3.000
+   26     -4.500      7.794      3.000
+   27     -6.000      5.196      3.000
+   28     -7.500      2.598      3.000
+   29     -9.000      0.000      3.000
+   30     -7.500     -2.598      3.000
+   31     -6.000     -5.196      3.000
+   32     -4.500     -7.794      3.000
+   33     -1.500     -7.794      3.000
+   34      1.500     -7.794      3.000
+   35      4.500     -7.794      3.000
+   36      6.000     -5.196      3.000
+   37      7.500     -2.598      3.000
+   38     12.000      0.000      3.000
+   39     10.500      2.598      3.000
+   40      9.000      5.196      3.000
+   41      7.500      7.794      3.000
+   42      6.000     10.392      3.000
+   43      3.000     10.392      3.000
+   44      0.000     10.392      3.000
+   45     -3.000     10.392      3.000
+   46     -6.000     10.392      3.000
+   47     -7.500      7.794      3.000
+   48     -9.000      5.196      3.000
+   49    -10.500      2.598      3.000
+   50    -12.000      0.000      3.000
+   51    -10.500     -2.598      3.000
+   52     -9.000     -5.196      3.000
+   53     -7.500     -7.794      3.000
+   54     -6.000    -10.392      3.000
+   55     -3.000    -10.392      3.000
+   56      0.000    -10.392      3.000
+   57      3.000    -10.392      3.000
+   58      6.000    -10.392      3.000
+   59      7.500     -7.794      3.000
+   60      9.000     -5.196      3.000
+   61     10.500     -2.598      3.000
+   62     15.000      0.000      3.000
+   63     13.500      2.598      3.000
+   64     12.000      5.196      3.000
+   65     10.500      7.794      3.000
+   66      9.000     10.392      3.000
+   67      7.500     12.990      3.000
+   68      4.500     12.990      3.000
+   69      1.500     12.990      3.000
+   70     -1.500     12.990      3.000
+   71     -4.500     12.990      3.000
+   72     -7.500     12.990      3.000
+   73     -9.000     10.392      3.000
+   74    -10.500      7.794      3.000
+   75    -12.000      5.196      3.000
+   76    -13.500      2.598      3.000
+   77    -15.000      0.000      3.000
+   78    -13.500     -2.598      3.000
+   79    -12.000     -5.196      3.000
+   80    -10.500     -7.794      3.000
+   81     -9.000    -10.392      3.000
+   82     -7.500    -12.990      3.000
+   83     -4.500    -12.990      3.000
+   84     -1.500    -12.990      3.000
+   85      1.500    -12.990      3.000
+   86      4.500    -12.990      3.000
+   87      7.500    -12.990      3.000
+   88      9.000    -10.392      3.000
+   89     10.500     -7.794      3.000
+   90     12.000     -5.196      3.000
+   91     13.500     -2.598      3.000
+   92     18.000      0.000      3.000
+   93     16.500      2.598      3.000
+   94     15.000      5.196      3.000
+   95     13.500      7.794      3.000
+   96     12.000     10.392      3.000
+   97     10.500     12.990      3.000
+   98      9.000     15.588      3.000
+   99      6.000     15.588      3.000
+  100      3.000     15.588      3.000
+  101      0.000     15.588      3.000
+  102     -3.000     15.588      3.000
+  103     -6.000     15.588      3.000
+  104     -9.000     15.588      3.000
+  105    -10.500     12.990      3.000
+  106    -12.000     10.392      3.000
+  107    -13.500      7.794      3.000
+  108    -15.000      5.196      3.000
+  109    -16.500      2.598      3.000
+  110    -18.000      0.000      3.000
+  111    -16.500     -2.598      3.000
+  112    -15.000     -5.196      3.000
+  113    -13.500     -7.794      3.000
+  114    -12.000    -10.392      3.000
+  115    -10.500    -12.990      3.000
+  116     -9.000    -15.588      3.000
+  117     -6.000    -15.588      3.000
+  118     -3.000    -15.588      3.000
+  119      0.000    -15.588      3.000
+  120      3.000    -15.588      3.000
+  121      6.000    -15.588      3.000
+  122      9.000    -15.588      3.000
+  123     10.500    -12.990      3.000
+  124     12.000    -10.392      3.000
+  125     13.500     -7.794      3.000
+  126     15.000     -5.196      3.000
+  127     16.500     -2.598      3.000
+  128     21.000      0.000      3.000
+  129     19.500      2.598      3.000
+  130     18.000      5.196      3.000
+  131     16.500      7.794      3.000
+  132     15.000     10.392      3.000
+  133     13.500     12.990      3.000
+  134     12.000     15.588      3.000
+  135     10.500     18.187      3.000
+  136      7.500     18.187      3.000
+  137      4.500     18.187      3.000
+  138      1.500     18.187      3.000
+  139     -1.500     18.187      3.000
+  140     -4.500     18.187      3.000
+  141     -7.500     18.187      3.000
+  142    -10.500     18.187      3.000
+  143    -12.000     15.588      3.000
+  144    -13.500     12.990      3.000
+  145    -15.000     10.392      3.000
+  146    -16.500      7.794      3.000
+  147    -18.000      5.196      3.000
+  148    -19.500      2.598      3.000
+  149    -21.000      0.000      3.000
+  150    -19.500     -2.598      3.000
+  151    -18.000     -5.196      3.000
+  152    -16.500     -7.794      3.000
+  153    -15.000    -10.392      3.000
+  154    -13.500    -12.990      3.000
+  155    -12.000    -15.588      3.000
+  156    -10.500    -18.187      3.000
+  157     -7.500    -18.187      3.000
+  158     -4.500    -18.187      3.000
+  159     -1.500    -18.187      3.000
+  160      1.500    -18.187      3.000
+  161      4.500    -18.187      3.000
+  162      7.500    -18.187      3.000
+  163     10.500    -18.187      3.000
+  164     12.000    -15.588      3.000
+  165     13.500    -12.990      3.000
+  166     15.000    -10.392      3.000
+  167     16.500     -7.794      3.000
+  168     18.000     -5.196      3.000
+  169     19.500     -2.598      3.000
+  170     24.000      0.000      3.000
+  171     22.500      2.598      3.000
+  172     21.000      5.196      3.000
+  173     19.500      7.794      3.000
+  174     18.000     10.392      3.000
+  175     16.500     12.990      3.000
+  176     15.000     15.588      3.000
+  177     13.500     18.187      3.000
+  178     12.000     20.785      3.000
+  179      9.000     20.785      3.000
+  180      6.000     20.785      3.000
+  181      3.000     20.785      3.000
+  182      0.000     20.785      3.000
+  183     -3.000     20.785      3.000
+  184     -6.000     20.785      3.000
+  185     -9.000     20.785      3.000
+  186    -12.000     20.785      3.000
+  187    -13.500     18.187      3.000
+  188    -15.000     15.588      3.000
+  189    -16.500     12.990      3.000
+  190    -18.000     10.392      3.000
+  191    -19.500      7.794      3.000
+  192    -21.000      5.196      3.000
+  193    -22.500      2.598      3.000
+  194    -24.000      0.000      3.000
+  195    -22.500     -2.598      3.000
+  196    -21.000     -5.196      3.000
+  197    -19.500     -7.794      3.000
+  198    -18.000    -10.392      3.000
+  199    -16.500    -12.990      3.000
+  200    -15.000    -15.588      3.000
+  201    -13.500    -18.187      3.000
+  202    -12.000    -20.785      3.000
+  203     -9.000    -20.785      3.000
+  204     -6.000    -20.785      3.000
+  205     -3.000    -20.785      3.000
+  206      0.000    -20.785      3.000
+  207      3.000    -20.785      3.000
+  208      6.000    -20.785      3.000
+  209      9.000    -20.785      3.000
+  210     12.000    -20.785      3.000
+  211     13.500    -18.187      3.000
+  212     15.000    -15.588      3.000
+  213     16.500    -12.990      3.000
+  214     18.000    -10.392      3.000
+  215     19.500     -7.794      3.000
+  216     21.000     -5.196      3.000
+  217     22.500     -2.598      3.000
+  218     27.000      0.000      3.000
+  219     25.500      2.598      3.000
+  220     24.000      5.196      3.000
+  221     22.500      7.794      3.000
+  222     21.000     10.392      3.000
+  223     19.500     12.990      3.000
+  224     18.000     15.588      3.000
+  225     16.500     18.187      3.000
+  226     15.000     20.785      3.000
+  227     13.500     23.383      3.000
+  228     10.500     23.383      3.000
+  229      7.500     23.383      3.000
+  230      4.500     23.383      3.000
+  231      1.500     23.383      3.000
+  232     -1.500     23.383      3.000
+  233     -4.500     23.383      3.000
+  234     -7.500     23.383      3.000
+  235    -10.500     23.383      3.000
+  236    -13.500     23.383      3.000
+  237    -15.000     20.785      3.000
+  238    -16.500     18.187      3.000
+  239    -18.000     15.588      3.000
+  240    -19.500     12.990      3.000
+  241    -21.000     10.392      3.000
+  242    -22.500      7.794      3.000
+  243    -24.000      5.196      3.000
+  244    -25.500      2.598      3.000
+  245    -27.000      0.000      3.000
+  246    -25.500     -2.598      3.000
+  247    -24.000     -5.196      3.000
+  248    -22.500     -7.794      3.000
+  249    -21.000    -10.392      3.000
+  250    -19.500    -12.990      3.000
+  251    -18.000    -15.588      3.000
+  252    -16.500    -18.187      3.000
+  253    -15.000    -20.785      3.000
+  254    -13.500    -23.383      3.000
+  255    -10.500    -23.383      3.000
+  256     -7.500    -23.383      3.000
+  257     -4.500    -23.383      3.000
+  258     -1.500    -23.383      3.000
+  259      1.500    -23.383      3.000
+  260      4.500    -23.383      3.000
+  261      7.500    -23.383      3.000
+  262     10.500    -23.383      3.000
+  263     13.500    -23.383      3.000
+  264     15.000    -20.785      3.000
+  265     16.500    -18.187      3.000
+  266     18.000    -15.588      3.000
+  267     19.500    -12.990      3.000
+  268     21.000    -10.392      3.000
+  269     22.500     -7.794      3.000
+  270     24.000     -5.196      3.000
+  271     25.500     -2.598      3.000
+  272     30.000      0.000      3.000
+  273     28.500      2.598      3.000
+  274     27.000      5.196      3.000
+  275     25.500      7.794      3.000
+  276     24.000     10.392      3.000
+  277     22.500     12.990      3.000
+  278     21.000     15.588      3.000
+  279     19.500     18.187      3.000
+  280     18.000     20.785      3.000
+  281     16.500     23.383      3.000
+  282     15.000     25.981      3.000
+  283     12.000     25.981      3.000
+  284      9.000     25.981      3.000
+  285      6.000     25.981      3.000
+  286      3.000     25.981      3.000
+  287      0.000     25.981      3.000
+  288     -3.000     25.981      3.000
+  289     -6.000     25.981      3.000
+  290     -9.000     25.981      3.000
+  291    -12.000     25.981      3.000
+  292    -15.000     25.981      3.000
+  293    -16.500     23.383      3.000
+  294    -18.000     20.785      3.000
+  295    -19.500     18.187      3.000
+  296    -21.000     15.588      3.000
+  297    -22.500     12.990      3.000
+  298    -24.000     10.392      3.000
+  299    -25.500      7.794      3.000
+  300    -27.000      5.196      3.000
+  301    -28.500      2.598      3.000
+  302    -30.000      0.000      3.000
+  303    -28.500     -2.598      3.000
+  304    -27.000     -5.196      3.000
+  305    -25.500     -7.794      3.000
+  306    -24.000    -10.392      3.000
+  307    -22.500    -12.990      3.000
+  308    -21.000    -15.588      3.000
+  309    -19.500    -18.187      3.000
+  310    -18.000    -20.785      3.000
+  311    -16.500    -23.383      3.000
+  312    -15.000    -25.981      3.000
+  313    -12.000    -25.981      3.000
+  314     -9.000    -25.981      3.000
+  315     -6.000    -25.981      3.000
+  316     -3.000    -25.981      3.000
+  317      0.000    -25.981      3.000
+  318      3.000    -25.981      3.000
+  319      6.000    -25.981      3.000
+  320      9.000    -25.981      3.000
+  321     12.000    -25.981      3.000
+  322     15.000    -25.981      3.000
+  323     16.500    -23.383      3.000
+  324     18.000    -20.785      3.000
+  325     19.500    -18.187      3.000
+  326     21.000    -15.588      3.000
+  327     22.500    -12.990      3.000
+  328     24.000    -10.392      3.000
+  329     25.500     -7.794      3.000
+  330     27.000     -5.196      3.000
+  331     28.500     -2.598      3.000
+  332     33.000      0.000      3.000
+  333     31.500      2.598      3.000
+  334     30.000      5.196      3.000
+  335     28.500      7.794      3.000
+  336     27.000     10.392      3.000
+  337     25.500     12.990      3.000
+  338     24.000     15.588      3.000
+  339     22.500     18.187      3.000
+  340     21.000     20.785      3.000
+  341     19.500     23.383      3.000
+  342     18.000     25.981      3.000
+  343     16.500     28.579      3.000
+  344     13.500     28.579      3.000
+  345     10.500     28.579      3.000
+  346      7.500     28.579      3.000
+  347      4.500     28.579      3.000
+  348      1.500     28.579      3.000
+  349     -1.500     28.579      3.000
+  350     -4.500     28.579      3.000
+  351     -7.500     28.579      3.000
+  352    -10.500     28.579      3.000
+  353    -13.500     28.579      3.000
+  354    -16.500     28.579      3.000
+  355    -18.000     25.981      3.000
+  356    -19.500     23.383      3.000
+  357    -21.000     20.785      3.000
+  358    -22.500     18.187      3.000
+  359    -24.000     15.588      3.000
+  360    -25.500     12.990      3.000
+  361    -27.000     10.392      3.000
+  362    -28.500      7.794      3.000
+  363    -30.000      5.196      3.000
+  364    -31.500      2.598      3.000
+  365    -33.000      0.000      3.000
+  366    -31.500     -2.598      3.000
+  367    -30.000     -5.196      3.000
+  368    -28.500     -7.794      3.000
+  369    -27.000    -10.392      3.000
+  370    -25.500    -12.990      3.000
+  371    -24.000    -15.588      3.000
+  372    -22.500    -18.187      3.000
+  373    -21.000    -20.785      3.000
+  374    -19.500    -23.383      3.000
+  375    -18.000    -25.981      3.000
+  376    -16.500    -28.579      3.000
+  377    -13.500    -28.579      3.000
+  378    -10.500    -28.579      3.000
+  379     -7.500    -28.579      3.000
+  380     -4.500    -28.579      3.000
+  381     -1.500    -28.579      3.000
+  382      1.500    -28.579      3.000
+  383      4.500    -28.579      3.000
+  384      7.500    -28.579      3.000
+  385     10.500    -28.579      3.000
+  386     13.500    -28.579      3.000
+  387     16.500    -28.579      3.000
+  388     18.000    -25.981      3.000
+  389     19.500    -23.383      3.000
+  390     21.000    -20.785      3.000
+  391     22.500    -18.187      3.000
+  392     24.000    -15.588      3.000
+  393     25.500    -12.990      3.000
+  394     27.000    -10.392      3.000
+  395     28.500     -7.794      3.000
+  396     30.000     -5.196      3.000
+  397     31.500     -2.598      3.000
+  398     36.000      3.464      6.000
+  399     33.000      8.660      6.000
+  400     30.000     13.856      6.000
+  401     27.000     19.053      6.000
+  402     24.000     24.249      6.000
+  403     21.000     29.445      6.000
+  404     15.000     32.909      6.000
+  405      9.000     32.909      6.000
+  406      3.000     32.909      6.000
+  407     -3.000     32.909      6.000
+  408     -9.000     32.909      6.000
+  409    -15.000     32.909      6.000
+  410    -21.000     29.445      6.000
+  411    -24.000     24.249      6.000
+  412    -27.000     19.053      6.000
+  413    -30.000     13.856      6.000
+  414    -33.000      8.660      6.000
+  415    -36.000      3.464      6.000
+  416    -36.000     -3.464      6.000
+  417    -33.000     -8.660      6.000
+  418    -30.000    -13.856      6.000
+  419    -27.000    -19.053      6.000
+  420    -24.000    -24.249      6.000
+  421    -21.000    -29.445      6.000
+  422    -15.000    -32.909      6.000
+  423     -9.000    -32.909      6.000
+  424     -3.000    -32.909      6.000
+  425      3.000    -32.909      6.000
+  426      9.000    -32.909      6.000
+  427     15.000    -32.909      6.000
+  428     21.000    -29.445      6.000
+  429     24.000    -24.249      6.000
+  430     27.000    -19.053      6.000
+  431     30.000    -13.856      6.000
+  432     33.000     -8.660      6.000
+  433     36.000     -3.464      6.000
+  434     42.000      3.464      6.000
+  435     39.000      8.660      6.000
+  436     36.000     13.856      6.000
+  437     33.000     19.053      6.000
+  438     30.000     24.249      6.000
+  439     27.000     29.445      6.000
+  440     24.000     34.641      6.000
+  441     18.000     38.105      6.000
+  442     12.000     38.105      6.000
+  443      6.000     38.105      6.000
+  444      0.000     38.105      6.000
+  445     -6.000     38.105      6.000
+  446    -12.000     38.105      6.000
+  447    -18.000     38.105      6.000
+  448    -24.000     34.641      6.000
+  449    -27.000     29.445      6.000
+  450    -30.000     24.249      6.000
+  451    -33.000     19.053      6.000
+  452    -36.000     13.856      6.000
+  453    -39.000      8.660      6.000
+  454    -42.000      3.464      6.000
+  455    -42.000     -3.464      6.000
+  456    -39.000     -8.660      6.000
+  457    -36.000    -13.856      6.000
+  458    -33.000    -19.053      6.000
+  459    -30.000    -24.249      6.000
+  460    -27.000    -29.445      6.000
+  461    -24.000    -34.641      6.000
+  462    -18.000    -38.105      6.000
+  463    -12.000    -38.105      6.000
+  464     -6.000    -38.105      6.000
+  465      0.000    -38.105      6.000
+  466      6.000    -38.105      6.000
+  467     12.000    -38.105      6.000
+  468     18.000    -38.105      6.000
+  469     24.000    -34.641      6.000
+  470     27.000    -29.445      6.000
+  471     30.000    -24.249      6.000
+  472     33.000    -19.053      6.000
+  473     36.000    -13.856      6.000
+  474     39.000     -8.660      6.000
+  475     42.000     -3.464      6.000
+  476     48.000      3.464      6.000
+  477     45.000      8.660      6.000
+  478     42.000     13.856      6.000
+  479     39.000     19.053      6.000
+  480     36.000     24.249      6.000
+  481     33.000     29.445      6.000
+  482     30.000     34.641      6.000
+  483     27.000     39.837      6.000
+  484     21.000     43.301      6.000
+  485     15.000     43.301      6.000
+  486      9.000     43.301      6.000
+  487      3.000     43.301      6.000
+  488     -3.000     43.301      6.000
+  489     -9.000     43.301      6.000
+  490    -15.000     43.301      6.000
+  491    -21.000     43.301      6.000
+  492    -27.000     39.837      6.000
+  493    -30.000     34.641      6.000
+  494    -33.000     29.445      6.000
+  495    -36.000     24.249      6.000
+  496    -39.000     19.053      6.000
+  497    -42.000     13.856      6.000
+  498    -45.000      8.660      6.000
+  499    -48.000      3.464      6.000
+  500    -48.000     -3.464      6.000
+  501    -45.000     -8.660      6.000
+  502    -42.000    -13.856      6.000
+  503    -39.000    -19.053      6.000
+  504    -36.000    -24.249      6.000
+  505    -33.000    -29.445      6.000
+  506    -30.000    -34.641      6.000
+  507    -27.000    -39.837      6.000
+  508    -21.000    -43.301      6.000
+  509    -15.000    -43.301      6.000
+  510     -9.000    -43.301      6.000
+  511     -3.000    -43.301      6.000
+  512      3.000    -43.301      6.000
+  513      9.000    -43.301      6.000
+  514     15.000    -43.301      6.000
+  515     21.000    -43.301      6.000
+  516     27.000    -39.837      6.000
+  517     30.000    -34.641      6.000
+  518     33.000    -29.445      6.000
+  519     36.000    -24.249      6.000
+  520     39.000    -19.053      6.000
+  521     42.000    -13.856      6.000
+  522     45.000     -8.660      6.000
+  523     48.000     -3.464      6.000
+  524     54.000      3.464      6.000
+  525     51.000      8.660      6.000
+  526     48.000     13.856      6.000
+  527     45.000     19.053      6.000
+  528     42.000     24.249      6.000
+  529     39.000     29.445      6.000
+  530     36.000     34.641      6.000
+  531     33.000     39.837      6.000
+  532     30.000     45.033      6.000
+  533     24.000     48.497      6.000
+  534     18.000     48.497      6.000
+  535     12.000     48.497      6.000
+  536      6.000     48.497      6.000
+  537      0.000     48.497      6.000
+  538     -6.000     48.497      6.000
+  539    -12.000     48.497      6.000
+  540    -18.000     48.497      6.000
+  541    -24.000     48.497      6.000
+  542    -30.000     45.033      6.000
+  543    -33.000     39.837      6.000
+  544    -36.000     34.641      6.000
+  545    -39.000     29.445      6.000
+  546    -42.000     24.249      6.000
+  547    -45.000     19.053      6.000
+  548    -48.000     13.856      6.000
+  549    -51.000      8.660      6.000
+  550    -54.000      3.464      6.000
+  551    -54.000     -3.464      6.000
+  552    -51.000     -8.660      6.000
+  553    -48.000    -13.856      6.000
+  554    -45.000    -19.053      6.000
+  555    -42.000    -24.249      6.000
+  556    -39.000    -29.445      6.000
+  557    -36.000    -34.641      6.000
+  558    -33.000    -39.837      6.000
+  559    -30.000    -45.033      6.000
+  560    -24.000    -48.497      6.000
+  561    -18.000    -48.497      6.000
+  562    -12.000    -48.497      6.000
+  563     -6.000    -48.497      6.000
+  564      0.000    -48.497      6.000
+  565      6.000    -48.497      6.000
+  566     12.000    -48.497      6.000
+  567     18.000    -48.497      6.000
+  568     24.000    -48.497      6.000
+  569     30.000    -45.033      6.000
+  570     33.000    -39.837      6.000
+  571     36.000    -34.641      6.000
+  572     39.000    -29.445      6.000
+  573     42.000    -24.249      6.000
+  574     45.000    -19.053      6.000
+  575     48.000    -13.856      6.000
+  576     51.000     -8.660      6.000
+  577     54.000     -3.464      6.000
Index: trunk/MagicSoft/Simulation/Detector/TimeCam/timecam-v.h
===================================================================
--- trunk/MagicSoft/Simulation/Detector/TimeCam/timecam-v.h	(revision 353)
+++ trunk/MagicSoft/Simulation/Detector/TimeCam/timecam-v.h	(revision 353)
@@ -0,0 +1,12 @@
+#ifndef VERSION 
+
+#define PROGRAM camera
+#define VERSION 0.2
+
+#define GLUE_prep(x,y) #x" "#y
+#define GLUE_postp(x,y) GLUE_prep(x,y)
+
+const char SIGNATURE[] = GLUE_postp( PROGRAM, VERSION );
+
+#endif // ! VERSION
+
Index: trunk/MagicSoft/Simulation/Detector/TimeCam/timecam.cxx
===================================================================
--- trunk/MagicSoft/Simulation/Detector/TimeCam/timecam.cxx	(revision 353)
+++ trunk/MagicSoft/Simulation/Detector/TimeCam/timecam.cxx	(revision 353)
@@ -0,0 +1,2879 @@
+//!/////////////////////////////////////////////////////////////////////
+//
+// camera                
+//
+// @file        camera.cxx
+// @title       Camera simulation
+// @subtitle    Code for the simulation of the camera phase
+// @desc        Code for the simulation of the camera of CT1 and MAGIC
+// @author      J C Gonzalez
+// @email       gonzalez@mppmu.mpg.de
+// @date        Thu May  7 16:24:22 1998
+//
+//----------------------------------------------------------------------
+//
+// Created: Thu May  7 16:24:22 1998
+// Author:  Jose Carlos Gonzalez
+// Purpose: Program for reflector simulation
+// Notes:   See files README for details
+//    
+//----------------------------------------------------------------------
+//
+// $RCSfile: timecam.cxx,v $
+// $Revision: 1.1.1.1 $
+// $Author: harald $ 
+// $Date: 2000-02-08 15:13:44 $
+//
+////////////////////////////////////////////////////////////////////////
+// @tableofcontents @coverpage
+
+//=-----------------------------------------------------------
+//!@section Source code of |camera.cxx|.
+
+/*!@"
+
+  In this section we show the (commented) code of the program for the
+  read-out of the output files generated by the simulator of the
+  reflector, |reflector 0.3|.
+
+  @"*/
+
+//=-----------------------------------------------------------
+//!@subsection Includes and Global variables definition.
+
+//!@{
+
+// includes for ROOT
+// BEWARE: the order matters!
+
+#include "TROOT.h"
+
+#include "TApplication.h"
+
+#include "TFile.h"
+#include "TTree.h"
+#include "TBranch.h"
+#include "TCanvas.h"
+
+#include "MTrigger.hxx"
+#include "MFadc.hxx"
+
+#include "MRawEvt.h"
+#include "MMcEvt.h"
+#include "MMcTrig.hxx"
+
+/*!@" 
+
+  All the defines are located in the file |camera.h|.
+
+  @"*/
+
+#include "timecam.h"
+//!@}
+
+/*!@"
+
+  The following set of flags are used in time of compilation. They do
+  not affect directly the behaviour of the program at run-time
+  (though, of course, if you disconnected the option for
+  implementation of the Trigger logic, you will not be able to use any
+  trigger at all. The 'default' values mean default in the sense of
+  what you got from the server when you obtained this program.
+
+  @"*/
+
+//!@{
+
+// flag for debugging (default: OFF )
+#define __DEBUG__
+#undef  __DEBUG__
+
+// flag for NNT in CT1 camera (default: ON )
+#undef  __CT1_NO_NEIGHBOURS__
+#define __CT1_NO_NEIGHBOURS__
+
+// flag for calculation of NSB (default: ON )
+#undef  __NSB__
+#define __NSB__
+
+// flag for calculation of QE for pixels (default: ON )
+#undef  __QE__
+#define __QE__
+
+
+// flag for implementation of DETAIL_TRIGGER (default: ON )
+//
+//      This is the new implementation of Trigger studies
+//      It relies on a better simulation of the time stucture 
+//      of the PhotoMultiplier. For more details see the 
+//      documentation of the --> class MTrigger <-- 
+#undef  __DETAIL_TRIGGER__
+#define __DETAIL_TRIGGER__
+
+// flag for implementation of TRIGGER (default: ON )
+#define __TRIGGER__
+#undef  __TRIGGER__
+
+// flag for implementation of Tail-Cut (default: ON )
+#define __TAILCUT__
+#undef  __TAILCUT__
+
+
+// flag for calculation of islands stat. (default: ON )
+#define __ISLANDS__
+#undef  __ISLANDS__
+
+// flag for calculation of image parameters (default: ON )
+#define __MOMENTS__
+#undef  __MOMENTS__
+
+// flag for ROOT  (default: ON )
+#undef  __ROOT__
+#define __ROOT__
+
+// flag for INTERAKTIV  (default: OFF )
+#undef  __INTERAKTIV__
+#define __INTERAKTIV__
+//!@}
+
+//=-----------------------------------------------------------
+//!@subsection Definition of global variables.
+
+/*!@"
+
+  Now we define some global variables with data about the telescope, 
+  such as "focal distance",  number of pixels/mirrors, 
+  "size of the camera", and so on.
+
+  @"*/
+
+/*!@"
+
+  Depending on the telescope we are using (CT1 or MAGIC), the 
+  information stored in the definition file is different.
+  The variable |ct_Type| has the value 0 when we use
+  CT1, and 1 when we use MAGIC.
+
+  @"*/
+
+//!@{
+static int   ct_Type;         //@< Type of telescope: 0:CT1, 1:MAGIC
+//!@}
+
+/*!@"
+
+  And this is the information about the whole telescope.
+
+  @"*/
+
+//!@{
+
+// parameters of the CT (from the CT definition file) 
+
+////@: Focal distances [cm]
+//static float *ct_Focal;       
+
+//@: Mean Focal distances [cm]
+static float ct_Focal_mean;   
+
+//@: STDev. Focal distances [cm]
+static float ct_Focal_std;    
+
+//@: Mean Point Spread function [cm]
+static float ct_PSpread_mean; 
+
+//@: STDev. Point Spread function [cm]
+static float ct_PSpread_std;  
+
+//@: STDev. Adjustmente deviation [cm]
+static float ct_Adjustment_std; 
+
+//@: Radius of the Black Spot in mirror [cm]
+static float ct_BlackSpot_rad;
+
+//@: Radius of one mirror [cm]
+static float ct_RMirror;      
+
+//@: Camera width [cm]
+static float ct_CameraWidth;  
+
+//@: Pixel width [cm]
+static float ct_PixelWidth;   
+
+//@: ct_PixelWidth_corner_2_corner = ct_PixelWidth / cos(60)
+static float ct_PixelWidth_corner_2_corner; 
+
+//@: ct_PixelWidth_corner_2_corner / 2
+static float ct_PixelWidth_corner_2_corner_half; 
+
+//@: Number of mirrors
+static int ct_NMirrors = 0;   
+
+//@: Number of pixels
+static int ct_NPixels;        
+
+//@: Number of pixels
+static int ct_NCentralPixels;        
+
+//@: Number of pixels
+static int ct_NGapPixels;        
+
+//@: ct_Apot = ct_PixelWidth / 2
+static float ct_Apot;          
+
+//@: ct_2Apot = 2 * ct_Apot = ct_PixelWidth 
+static float ct_2Apot;         
+
+//@: name of the CT definition file to use
+static char ct_filename[256];  
+
+//@: list of showers to be skipped
+static int *Skip;
+
+//@: number of showers to be skipped
+static int nSkip=0;
+
+//@: flag: TRUE: data come from STDIN; FALSE: from file
+static int Data_From_STDIN = FALSE;
+
+//@: flag: TRUE: write all images to output; FALSE: only triggered showers
+static int Write_All_Images = FALSE;
+
+static int Write_McEvt  = TRUE;
+static int Write_McTrig = FALSE;
+static int Write_RawEvt = FALSE;
+
+//@: flag: TRUE: selection on the energy
+static int Select_Energy = TRUE;
+
+//@: Lower edge of the selected energy range (in GeV)
+static float Select_Energy_le = 0.0; 
+
+//@: Upper edge of the selected energy range (in GeV)
+static float Select_Energy_ue = 100000.0; 
+
+//!@}
+
+/*!@"
+
+  The following double-pointer is a 2-dimensional table with information 
+  about each pixel. The routine read_pixels will generate
+  the information for filling it using igen_pixel_coordinates().
+
+  @"*/
+
+//!@{
+// Pointer to a tables/Arrays with information about the pixels
+// and data stored on them with information about the pixels
+
+//@: table for IJ sys.
+static float pixels[PIX_ARRAY_SIDE][PIX_ARRAY_SIDE][4];   
+
+//@: coordinates x,y for each pixel
+static float **pixary;  
+
+//@: indexes of pixels neighbours of a given one
+static int **pixneig;   
+
+//@: number of neighbours a pixel have
+static int *npixneig;   
+
+//@: contents of the pixels (ph.e.)
+static float *fnpix;    
+
+//@: contents of the pixels (ph.e.) after cleanning
+static float *fnpixclean; 
+
+//!@}
+
+/*!@"
+
+  The following double-pointer is a 2-dimensional table with the
+  Quantum Efficiency @$QE@$ of each pixel in the camera, as a function
+  of the wavelength @$\lambda@$. The routine |read_pixels()| will read
+  also this information from the file |qe.dat|.
+
+  @"*/
+
+//!@{
+// Pointer to a table with QE, number of datapoints, and wavelengths
+
+//@: table of QE
+static float ***QE;
+
+//@: number of datapoints for the QE curve
+static int pointsQE;
+
+//@: table of QE
+static float *QElambda;
+//!@}
+
+/*!@"
+
+  The following double-pointer is a 2-dimensional table with information 
+  about each mirror in the dish. The routine |read_ct_file()| will read
+  this information from the CT definition file.
+
+  @"*/
+
+//!@{
+// Pointer to a table with the following info.:
+
+static float **ct_data;       
+
+/*
+ *  TYPE=0  (CT1)
+ *      i   s   rho   theta   x   y   z   thetan  phin  xn   yn   zn
+ * 
+ *       i : number of the mirror
+ *       s : arc length [cm]
+ *     rho : polar rho of the position of the center of the mirror [cm]
+ *   theta : polar angle of the position of the center of the mirror [cm]
+ *       x : x coordinate of the center of the mirror [cm]
+ *       y : y coordinate of the center of the mirror [cm]
+ *       z : z coordinate of the center of the mirror [cm]
+ *  thetan : polar theta angle of the direction where the mirror points to
+ *    phin : polar phi angle of the direction where the mirror points to
+ *      xn : xn coordinate of the normal vector in the center (normalized)
+ *      yn : yn coordinate of the normal vector in the center (normalized)
+ *      zn : zn coordinate of the normal vector in the center (normalized)
+ * 
+ *  TYPE=1  (MAGIC)
+ *      i  f   sx   sy   x   y   z   thetan  phin 
+ * 
+ *       i : number of the mirror
+ *       f : focal distance of that mirror
+ *      sx : curvilinear coordinate of mirror's center in X[cm]
+ *      sy : curvilinear coordinate of mirror's center in X[cm]
+ *       x : x coordinate of the center of the mirror [cm]
+ *       y : y coordinate of the center of the mirror [cm]
+ *       z : z coordinate of the center of the mirror [cm]
+ *  thetan : polar theta angle of the direction where the mirror points to
+ *    phin : polar phi angle of the direction where the mirror points to
+ *      xn : xn coordinate of the normal vector in the center (normalized)
+ *      yn : yn coordinate of the normal vector in the center (normalized)
+ *      zn : zn coordinate of the normal vector in the center (normalized)
+ */
+//!@} 
+
+/*!@"
+
+  We define a table into where random numbers will be stored. 
+  The routines used for random number generation are provided by
+  |RANLIB| (taken from NETLIB, |www.netlib.org|), and by 
+  the routine |double drand48(void)| (prototype defined in 
+  |stdlib.h|) through the macro |RandomNumber| defined in 
+  |camera.h|.
+
+  @"*/
+
+//!@{
+// table of random numbers
+
+// (unused)
+//static double RandomNumbers[500];  
+//!@}
+
+/*!@"
+
+  The following is a variable to count the number of Cphotons
+  in the different steps of the simulation. 
+  The definition is as follows:
+  @[
+  \mbox{CountCphotons}[ \mbox{FILTER} ] \equiv
+  \mbox{\it Number of photons after the filter} \mbox{FILTER}
+  @]
+  The filters are defined and can be found in the file |camera.h|.
+
+  @"*/
+
+//!@{
+// vector to count photons at any given step of the simulation
+
+//static int CountCphotons[10];  
+//!@}
+
+/*!@"
+
+  The following are the set of parameters calculated for each image.
+  The routines for their calculations are in |moments.cxx|.
+
+  @"*/
+
+//!@{
+// parameters of the images
+
+//static Moments_Info *moments_ptr; 
+//static LenWid_Info *lenwid_ptr;
+
+//static float *maxs;
+//static int *nmaxs;
+//static float length, width, dist, xdist, azw, miss, alpha, *conc; 
+//static float phiasym, asymx, asymy;
+//static float charge, smax, maxtrigthr_phe;
+
+//!@}
+
+extern char FileName[];
+
+
+//=-----------------------------------------------------------
+// @subsection Main program.
+
+//!@{
+
+//++++++++++++++++++++++++++++++++++++++++
+// MAIN PROGRAM 
+//----------------------------------------
+
+int main(int argc, char **argv) 
+{
+  //!@' @#### Definition of variables.
+  //@'
+
+  char inname[256];           //@< input file name
+  char rootname[256] ;        //@< ROOT file name 
+
+  char parname[256];          //@< parameters file name
+
+  char sign[20];              //@< initialize sign
+
+  char flag[SIZE_OF_FLAGS + 1];  //@< flags in the .rfl file
+
+  ifstream inputfile;         //@< stream for the input file
+
+  MCEventHeader mcevth;       //@< Event Header class (MC)
+  MCCphoton cphoton;          //@< Cherenkov Photon class (MC)
+
+  float thetaCT, phiCT;       //@< parameters of a given shower
+  float thetashw, phishw;     //@< parameters of a given shower
+  float coreD, coreX, coreY;  //@< core position and distance
+  float impactD;              //@< impact parameter
+  float l1, m1, n1;           //@< auxiliary variables
+  float l2, m2, n2;           //@< auxiliary variables
+  float num, den;             //@< auxiliary variables
+
+  int nshow=0;                //@< partial number of shower in a given run
+  int ntshow=0;               //@< total number of showers
+  int ncph_in=0;              //@< number of (input) photons in one shower 
+  int ntcph_in=0;             //@< total number of input photons
+
+  int ncph_out=0;             //@< number of (output) photons in one shower
+  int ntcph_out=0;            //@< total number of output photons
+
+  int i, ii, k;               //@< simple counters
+
+  float t_ini;                //@< time of the first Cphoton read in
+  float t;                    //@< time for a single photon
+  float t_first ;             //@< time of the first cerenkov particle reaching the ground 
+  float t_last  ;             //@< time of the last cerenkov particle reaching the ground 
+
+  int   t_chan ;              //@< the bin (channel) in time of a single photon
+  
+  int   startchan ;           //@< the first bin with entries in the time slices
+
+  float cx, cy, ci, cj;       //@< coordinates in the XY and IJ systems
+  int ici, icj, iici, iicj;   //@< coordinates in the IJ (integers)
+
+  int nPMT;                   //@< number of pixel
+
+  float wl, last_wl;          //@< wavelength of the photon
+  float qe;                   //@< quantum efficiency
+  float **qeptr;
+
+  int simulateNSB;            //@< Will we simulate NSB?
+  float meanNSB;              //@< NSB mean value (per pixel and ns)
+  float meanPois;             //@< NSB mean value for simulation
+  float timeNSB ;             //@< time of NSB photon
+
+  int nIslandsCut;            //@< Islands Cut value
+  int countIslands;           //@< Will we count the islands?
+  int anaPixels;
+    
+  float fCorrection;          //@< Factor to apply to pixel values (def. 1.)
+
+  //  int ntrigger = 0;           //@< number of triggers in the whole file
+
+  float plateScale_cm2deg;    //@< plate scale (deg/cm)
+  float degTriggerZone;       //@< trigger area in the camera (radius, in deg.)
+
+  float dtheta, dphi;         //@< deviations of CT from shower axis
+
+  int still_in_loop = FALSE;
+
+  char    Signature[20];
+
+  float *image_data;
+  int nvar; 
+  // int  hidt;
+
+  struct camera cam; // structure holding the camera definition
+
+  //!@' @#### Definition of variables for |getopt()|.
+  //@'
+
+  int ch, errflg = 0;          //@< used by getopt
+
+  /*!@'
+
+    @#### Beginning of the program.
+    
+    We start with the main program. First we (could) make some
+    presentation, and follows the reading of the parameters file (now
+    from the |stdin|), the reading of the CT parameters file, and the
+    creation of the output file, where the processed data will be
+    stored.
+
+  */
+
+  //++
+  // START
+  //--
+
+  // make unbuffered output
+
+  cout.setf ( ios::stdio );
+
+  // parse command line options (see reflector.h)
+  
+  parname[0] = '\0';
+
+  optarg = NULL;
+  while ( !errflg && ((ch = getopt(argc, argv, COMMAND_LINE_OPTIONS)) != -1) )
+    switch (ch) {
+    case 'f':
+      strcpy(parname, optarg);
+      break;
+    case 'h':
+      usage();
+      break;
+    default :
+      errflg++;
+    }
+  
+  // show help if error
+  
+  if ( errflg>0 )
+    usage();
+
+  // make some sort of presentation
+
+  present();
+  
+  // read parameters file
+
+  if ( strlen(parname) < 1 )
+    readparam(NULL);
+  else
+    readparam(parname);
+
+  // read data from file or from STDIN?
+
+  Data_From_STDIN = get_data_from_stdin();
+
+  // write all images, even those without trigger?
+
+  Write_All_Images = get_write_all_images();
+
+  Write_McEvt  = get_write_McEvt()  ; 
+  Write_McTrig = get_write_McTrig() ; 
+  Write_RawEvt = get_write_RawEvt() ; 
+
+  // get filenames
+
+  strcpy( inname, get_input_filename() );
+  strcpy( rootname, get_root_filename() );
+  strcpy( ct_filename, get_ct_filename() );
+
+  // get different parameters of the simulation
+
+  simulateNSB = get_nsb( &meanNSB );
+  countIslands = get_islands_cut( &nIslandsCut );
+
+  // get selections on the parameters
+  
+  Select_Energy = get_select_energy( &Select_Energy_le, &Select_Energy_ue);
+  
+  // log filenames information
+
+  log(SIGNATURE,
+      "%s:\n\t%20s:\t%s\n\t%20s:\t%s\n\t%20s:\t%s\n",
+      "Filenames",
+      "In", inname, 
+      "ROOT",  rootname, 
+      "CT", ct_filename);
+
+  
+  // log flags information
+
+  log(SIGNATURE,
+      "%s:\n\t%20s: %s\n\t%20s: %s\n",
+      "Flags",
+      "Data_From_STDIN",   ONoff(Data_From_STDIN),  
+      "Write_All_Images",  ONoff(Write_All_Images));
+
+
+  // log flags information
+
+  log(SIGNATURE,
+      "%s:\n\t%20s: %s\n\t%20s: %s\n\t%20s: %s\n",
+      "Root output",
+      "Write_McEvt",   ONoff(Write_McEvt),  
+      "Write_McTrig",  ONoff(Write_McTrig),  
+      "Write_RawEvt",  ONoff(Write_RawEvt));
+      
+  // log parameters information
+  
+  log(SIGNATURE,
+      "%s:\n\t%20s: %f %s\n\t%20s: %f %s\n",
+      "Parameters",
+      "NSB (phes/pixel)", meanNSB, ONoff(simulateNSB),
+      "i0 (Islands-cut)", nIslandsCut, ONoff(countIslands));
+  
+  // log selections
+  
+  log(SIGNATURE,
+      "%s:\n\t%20s: %s  (%f:%f)\n",
+      "Selections:",
+      "Energy", ONoff(Select_Energy), Select_Energy_le, Select_Energy_ue);
+  
+  // set all random numbers seeds
+
+  setall( get_seeds(0), get_seeds(1) );
+
+  // get list of showers to evt. skip
+
+  nSkip = get_nskip_showers();
+
+  if (nSkip > 0) {
+    Skip = new int[ nSkip ]; 
+    get_skip_showers( Skip );
+
+    log(SIGNATURE, "There are some showers to skip:\n");
+    for (i=0; i<nSkip; ++i)
+      log(SIGNATURE, "\tshower # %d\n", Skip[i]);
+  }
+  
+  // read parameters from the ct.def file
+
+  read_ct_file();
+  
+  // read pixels data
+  
+  read_pixels(&cam);
+
+
+    Int_t Lev0, Lev1, Lev2 ; 
+
+  // initialise ROOT
+
+  TROOT simple("simple", "MAGIC Telescope Monte Carlo");
+
+
+#ifdef __DETAIL_TRIGGER__
+
+  MTrigger  Trigger ;         //@< A instance of the Class MTrigger 
+
+  MMcTrig *McTrig   = new MMcTrig() ; 
+
+
+  //  MFadc fadc ; 
+
+#endif // __DETAIL_TRIGGER__ 
+  
+#ifdef __ROOT__
+
+  MRawEvt *Evt   = new MRawEvt() ; 
+  MMcEvt  *McEvt = new MMcEvt (); 
+
+  // initalize the ROOT file 
+  //
+  //     erzeuge ein Root file 
+  //
+
+  TFile outfile ( rootname , "RECREATE" ) ; 
+
+  //
+  //      create a Tree for the Event data stream 
+  //
+
+  TTree EvtTree("EvtTree","Events of Run");
+
+  Int_t bsize=128000; Int_t split=1;
+
+  //
+  //    check which branches to create (you are able to controll this via
+  //    the input file
+  // 
+
+  if ( Write_McEvt == TRUE ) {
+    EvtTree.Branch("MMcEvt","MMcEvt", 
+		   &McEvt, bsize, split);
+  }
+
+  if ( Write_McTrig == TRUE ) {
+    EvtTree.Branch("MMcTrig","MMcTrig", 
+		   &McTrig, bsize, split);
+  }
+
+  if ( Write_RawEvt == TRUE ) {
+    EvtTree.Branch("MRawEvt","MRawEvt", 
+		   &Evt, bsize, split);
+  }
+
+
+  unsigned short ulli = 0 ; 
+
+#endif // __ROOT__
+
+#ifdef __NSB__
+  TRandom GenNSB ; 
+#endif // __NSB__
+
+#ifdef __INTERAKTIV__
+  TApplication theApp("App", &argc, argv);
+
+  if (gROOT->IsBatch()) {
+    fprintf(stderr, "%s: cannot run in batch mode\n", argv[0]);
+    //    return 1;
+  }
+#endif // __INTERAKTIV__
+  
+
+  // for safety and for dimensioning image_data: count the elements in the 
+  // diagnostic data branch
+
+  i=0;
+  i++; // "n"
+  i++; // "primary"
+  i++; // "energy"
+  i++; // "cored"
+  i++; // "impact"
+  i++; // "xcore"
+  i++; // "ycore"
+  i++; // "theta"
+  i++; // "phi"
+  i++; // "deviations"
+  i++; // "dtheta"
+  i++; // "dphi"
+  i++; // "trigger"
+  i++; // "ncphs"
+  i++; // "maxpassthr_phe"    
+  i++; // "nphes"
+  i++; // "nphes2"
+  i++; // "length"
+  i++; // "width"
+  i++; // "dist"
+  i++; // "xdist"
+  i++; // "azw"
+  i++; // "miss"
+  i++; // "alpha"
+  i++; // "conc2"
+  i++; // "conc3"
+  i++; // "conc4"
+  i++; // "conc5"
+  i++; // "conc6"
+  i++; // "conc7"
+  i++; // "conc8"
+  i++; // "conc9"
+  i++; // "conc10"
+  i++; // "asymx"
+  i++; // "asymy"
+  i++; // "phiasym"
+
+  nvar = i;
+  image_data = new float[nvar];
+
+  // set plate scale (deg/cm) and trigger area (deg)
+
+  plateScale_cm2deg = ( ct_Type == 0 ) ? (0.244/2.1) : 0.030952381;
+
+  if ( ! get_trigger_radius( &degTriggerZone ) )
+    degTriggerZone = ( ct_Type == 0 ) ? (5.0) : (5.0);
+
+  if ( ! get_correction( &fCorrection ) )
+    fCorrection = 1.0;
+
+  // number of pixels for parameters
+    
+  anaPixels = get_ana_pixels();
+  anaPixels = (anaPixels == -1) ? ct_NPixels : anaPixels;
+
+  // open input file if we DO read data from a file
+
+  if (! Data_From_STDIN) {  
+    log( SIGNATURE, "Openning input \"rfl\" file %s\n", inname );
+    inputfile.open( inname );
+    if ( inputfile.bad() ) 
+      error( SIGNATURE, "Cannot open input file: %s\n", inname );
+  }
+  
+  // get signature, and check it
+  // NOTE: this part repeats further down in the code;
+  // if you change something here you probably want to change it 
+  // there as well
+
+  strcpy(Signature, REFL_SIGNATURE);
+
+  strcpy(sign, Signature);
+
+  if ( Data_From_STDIN ) 
+    cin.read( (char *)sign, strlen(Signature));
+  else
+    inputfile.read( (char *)sign, strlen(Signature));
+
+  if (strcmp(sign, Signature) != 0) {
+    cerr << "ERROR: Signature of .rfl file is not correct\n";
+    cerr << '"' << sign << '"' << '\n';
+    cerr << "should be: " << Signature << '\n';
+    exit(1);
+  }
+
+  if ( Data_From_STDIN ) 
+    cin.read( (char *)sign, 1);
+  else
+    inputfile.read( (char *)sign, 1);
+
+  // initializes flag
+  
+  strcpy( flag, "                                        \0" );
+
+  // allocate space for PMTs numbers of pixels
+  
+  fnpix = new float [ ct_NPixels ];
+  fnpixclean = new float [ ct_NPixels ];
+
+#ifdef __ROOT__
+  
+  // construct MFADC
+
+#endif // __ROOT__ 
+
+  
+  //  moments_ptr = moments( anaPixels, NULL, NULL, 0.0, 1 );
+        
+  //!@' @#### Main loop.
+  //@'
+
+  //begin my version
+                                           
+  // get flag
+    
+  if ( Data_From_STDIN ) 
+    cin.read( flag, SIZE_OF_FLAGS );
+  else
+    inputfile.read ( flag, SIZE_OF_FLAGS );
+
+  // loop over the file
+
+  still_in_loop = TRUE;
+
+  while (
+         ((! Data_From_STDIN) && (! inputfile.eof()))
+         ||
+         (Data_From_STDIN && still_in_loop)
+         ) { 
+
+
+
+    // reading .rfl files 
+    if( isA( flag, FLAG_END_OF_FILE ) ){ // end of file
+	  log(SIGNATURE, "End of file . . .\n");
+	  still_in_loop  = FALSE;
+	  
+	  if ( Data_From_STDIN ) 
+	    cin.read( (char *)sign, 1);
+	  else
+	    inputfile.read( (char *)sign, 1);
+
+
+    }
+    else if(!isA( flag, FLAG_START_OF_RUN )){
+      error( SIGNATURE, "Expected start of run flag, but found: %s\n", flag );
+    }
+    else { // found start of run
+      nshow=0;
+      // read next flag
+
+      if ( Data_From_STDIN ) 
+	cin.read( flag, SIZE_OF_FLAGS );
+      else
+	inputfile.read ( flag, SIZE_OF_FLAGS );
+
+      while( isA( flag, FLAG_START_OF_EVENT   )){ // while there is a next event
+	/*!@'
+	  
+	  For the case  |FLAG\_START\_OF\_EVENT|,
+	  we read each Cherenkov photon, and follow these steps:
+	  
+	  @enumerate
+	  
+	  @- Transform XY-coordinates to IJ-coordinates.
+	  
+	  @- With this, we obtain the pixel where the photon hits.
+	  
+	  @- Use the wavelength $\lambda$ and the table of QE, and
+	  calculate the estimated (third order interpolated) quantum
+	  efficiency for that photon. The photon can be rejected.
+	  
+	  @- If accepted, then add to the pixel.
+	  
+	  @endenumerate
+	  
+	  In principle, we should stop here, and use another program to
+	  'smear' the image, to add the Night Sky Background, and to
+	  simulate the trigger logic, but we will make this program
+	  quick and dirty, and include all here.
+	  
+	  If we are reading PHE files, we jump to the point where the
+	  pixelization process already has finished.
+	  
+	*/
+	
+	++nshow;
+
+	if ( fmod ( nshow, 1000. ) == 0. ) 
+	  log(SIGNATURE, "Event %d(+%d)\n", nshow, ntshow);
+	
+
+	// get MCEventHeader
+	
+	if ( Data_From_STDIN ) 
+	  cin.read( (char*)&mcevth, mcevth.mysize() );
+	else
+	  mcevth.read( inputfile );
+	
+	// calculate core distance and impact parameter
+	
+	coreD = mcevth.get_core(&coreX, &coreY);
+	
+	// calculate impact parameter (shortest distance betwee the original
+	// trajectory of the primary (assumed shower-axis) and the
+	// direction where the telescope points to
+	// 
+	// we use the following equation, given that the shower core position
+	// is (x1,y1,z1)=(x,y,0),the  trajectory is given by (l1,m1,n1),
+	// and the telescope position and orientation are (x2,y2,z2)=(0,0,0)
+	// and (l2,m2,n2)
+	//
+	//               |                     |
+	//               | x1-x2  y1-y2  z1-z2 |
+	//               |                     |
+	//             + |   l1     m1     n1  |
+	//             - |                     |
+	//               |   l2     m2     n2  |
+	//               |                     |
+	// dist = ------------------------------------        ( > 0 )
+	//        [ |l1 m1|2   |m1 n1|2   |n1 l1|2 ]1/2
+	//        [ |     |  + |     |  + |     |  ]
+	//        [ |l2 m2|    |m2 n2|    |n2 l2|  ]
+	//
+	// playing a little bit, we get this reduced for in our case:
+	//
+	//
+	// dist = (- m2 n1 x + m1 n2 x + l2 n1 y - l1 n2 y - l2 m1 z + l1 m2 z) /
+	//         [(l2^2 (m1^2 + n1^2) + (m2 n1 - m1 n2)^2 - 
+	//          2 l1 l2 (m1 m2 + n1 n2) + l1^2 (m2^2 + n2^2) ] ^(1/2)
+	
+	// read the direction of the incoming shower
+	
+	thetashw = mcevth.get_theta();
+	phishw = mcevth.get_phi();
+	
+	// calculate vector for shower
+	
+	l1 = sin(thetashw)*cos(phishw);
+	m1 = sin(thetashw)*sin(phishw);
+	n1 = cos(thetashw);
+	
+	// read the deviation of the telescope with respect to the shower
+	
+	mcevth.get_deviations ( &thetaCT, &phiCT );
+	
+	if ( (thetaCT == 0.) && (phiCT == 0.) ) {
+	  
+	  // CT was looking to the source (both lines are parallel)
+	  // therefore, we calculate the impact parameter as the distance 
+	  // between the CT axis and the core position
+	  
+	  impactD = dist_r_P( 0., 0., 0., l1, m1, n1, coreX, coreY, 0. );
+	  
+	} else {
+	  
+	  // the shower comes off-axis
+	  
+	  // obtain with this the final direction of the CT
+	  
+	  thetaCT += thetashw;
+	  phiCT   += phishw;
+ 	  
+	  // calculate vector for telescope
+	  
+	  l2 = sin(thetaCT)*cos(phiCT);
+	  m2 = sin(thetaCT)*sin(phiCT);
+	  n2 = cos(thetaCT);
+	  
+	  num = (m1*n2*coreX - m2*n1*coreX + l2*n1*coreY - l1*n2*coreY);
+	  den = (SQR(l1*m2 - l2*m1) + 
+		 SQR(m1*n2 - m2*n1) + 
+		 SQR(n1*l2 - n2*l1));
+	  den = sqrt(den);
+	  
+	  impactD = fabs(num)/den;
+	  
+	  // fprintf(stderr, "[%f %f,%f %f] (%f %f %f) (%f %f %f) %f/%f = ",
+	  //         thetashw, phishw, thetaCT, phiCT, l1, m1, n1, l2, m2, n2,
+	  //         num, den);
+	  
+	}
+
+	// clear camera
+	
+	for ( i=0; i<ct_NPixels; ++i ){
+ 
+	  fnpix[i] = 0.0;
+	}
+
+#ifdef __ROOT__	
+	// clear the MFADC 
+	  
+#endif // __ROOT__ 
+
+	ntcph_in +=ncph_in;
+	ncph_in = 0;
+
+	ntcph_out +=ncph_out;
+	ncph_out = 0;
+
+
+#ifdef __DETAIL_TRIGGER__ 
+	//
+	//   clear Trigger 
+	//
+      
+	Trigger.Reset() ; 
+#endif // __DETAIL_TRIGGER__ 
+
+	//  fadc.Reset() ; 
+
+	//
+	//    Read out the first and last time of cerenkovs
+	//
+	
+	mcevth.get_times ( &t_first, &t_last ) ; 
+
+	//- - - - - - - - - - - - - - - - - - - - - - - - - 
+	// read photons and "map" them into the pixels
+	//--------------------------------------------------      
+	
+	// initialize CPhoton
+	
+	cphoton.fill(0., 0., 0., 0., 0., 0., 0., 0.);
+	
+	// read the photons data
+	
+	if ( Data_From_STDIN ) 
+	  cin.read( flag, SIZE_OF_FLAGS );
+	else
+	  inputfile.read ( flag, SIZE_OF_FLAGS );
+	 
+	// loop over the photons
+
+	t_ini = -99999;
+	
+	while ( !isA( flag, FLAG_END_OF_EVENT ) ) {
+	  
+	  memcpy( (char*)&cphoton, flag, SIZE_OF_FLAGS );
+
+	  if ( Data_From_STDIN ) 
+	    cin.read( ((char*)&cphoton)+SIZE_OF_FLAGS, cphoton.mysize()-SIZE_OF_FLAGS );
+	  else
+	    inputfile.read( ((char*)&cphoton)+SIZE_OF_FLAGS, cphoton.mysize()-SIZE_OF_FLAGS );
+	
+	  // increase number of photons
+	  
+	  ncph_in++;
+
+	  t = cphoton.get_t() ; 
+
+
+	  /*!@'
+	    
+	    @#### Pixelization (for the central pixels).
+	    
+	    In order to calculate the coordinates, we use the
+	    change of system described in the documentation
+	    of the source code of |pixel\_coord.cxx|.
+	    Then, we will use simply the matrix of change
+	    from one system to the other. In our case, this is:
+	    
+	    @[
+	    \begin{bmatrix}X\\Y\\\end{bmatrix}                                
+	    =
+	    \begin{bmatrix}
+	    1 & \cos(60^\circ)\\
+	    0 & \sin(60^\circ)\\
+	    \end{bmatrix}                                
+	    \begin{bmatrix}I\\J\\\end{bmatrix}                                
+	    @]
+	    
+	    and hence
+	    
+	    @[
+	    \begin{bmatrix}I\\J\\\end{bmatrix}                                
+	    =
+	    \begin{bmatrix}    
+	    1 & -\frac{\cos(60^\circ)}{\sin(60^\circ)}\\
+	    0 &\frac{1}{\sin(60^\circ)}\\
+	    \end{bmatrix}                                
+	    \begin{bmatrix}X\\Y\\\end{bmatrix}                                
+	    @]
+	    
+	  */
+	  
+	  //+++
+	  // Pixelization
+	  //---
+	  
+	  // calculate ij-coordinates
+	  
+	  // We use a change of coordinate system, using the following 
+	  // matrix of change (m^-1) (this is taken from Mathematica output).
+	  /*
+	   * In[1]:= m={{1,cos60},{0,sin60}}; MatrixForm[m]
+	   *
+	   * Out[1]//MatrixForm= 1       cos60
+	   * 
+	   *                     0       sin60
+	   * 
+	   * In[2]:= inv=Inverse[m]; MatrixForm[inv]
+	   * 
+	   * Out[2]//MatrixForm=              cos60
+	   *                                -(-----)
+	   *                       1          sin60
+	   * 
+	   *                                    1
+	   *                                  -----
+	   *                       0          sin60
+	   * 
+	   */
+	  
+	  // go to IJ-coordinate system
+	  
+	  cx = cphoton.get_x();
+	  cy = cphoton.get_y(); 
+	  
+	  // get wavelength
+	  
+	  last_wl = wl;
+	  wl = cphoton.get_wl();
+	  
+	  if ( wl < 1.0 )
+	    break;
+	  
+	  if ( (wl > 600.0) || (wl < 290.0) )
+	    break;
+	  
+	  // check if photon is inside outermost camera radius
+
+	  if(sqrt(cx*cx + cy*cy) > (cam.dxc[ct_NPixels-1]+1.5*ct_PixelWidth)){ 
+	   
+	    // read next CPhoton
+	    if ( Data_From_STDIN ) 
+	      cin.read( flag, SIZE_OF_FLAGS );
+	    else
+	      inputfile.read ( flag, SIZE_OF_FLAGS );
+	    
+	    // go to beginning of loop, the photon is lost
+	    continue;
+
+	  }
+
+	  // cout << "@#1 " << nshow << ' ' << cx << ' ' << cy << endl;
+	  
+	  ci = floor( (cx - cy*COS60/SIN60)/ ct_2Apot + 0.5);
+	  cj = floor( (cy/SIN60) / ct_2Apot + 0.5);
+	  
+	  ici = (int)(ci);
+	  icj = (int)(cj);
+	  
+	  iici = ici+PIX_ARRAY_HALF_SIDE;
+	  iicj = icj+PIX_ARRAY_HALF_SIDE;
+	  
+	  // is it inside the array?
+	  
+	  if ( (iici > 0) && (iici < PIX_ARRAY_SIDE) &&
+	       (iicj > 0) && (iicj < PIX_ARRAY_SIDE) ) {
+	    	  
+	    // try to put into pixel
+	    
+	    // obtain the pixel number for this photon
+	    
+	    nPMT = (int)
+	      pixels[ici+PIX_ARRAY_HALF_SIDE][icj+PIX_ARRAY_HALF_SIDE][PIXNUM];
+	  
+	  }
+	  else{
+
+	    nPMT = -1;
+
+	  }
+
+	  // check if outside the central camera
+	  
+	  if ( (nPMT < 0) || (nPMT >= ct_NCentralPixels) ) {
+
+	    // check the outer pixels
+	    nPMT = -1;
+
+	    for(i=ct_NCentralPixels; i<ct_NPixels; i++){
+	      if( bpoint_is_in_pix( cx, cy, i, &cam) ){
+		nPMT = i;
+		break;
+	      }
+	    }
+	   
+	    if(nPMT==-1){// the photon is in none of the pixels
+
+	      // read next CPhoton
+	      if ( Data_From_STDIN ) 
+		cin.read( flag, SIZE_OF_FLAGS );
+	      else
+		inputfile.read ( flag, SIZE_OF_FLAGS );
+	      
+	      // go to beginning of loop, the photon is lost
+	      continue;
+	    }
+	    
+	  }
+	  
+#ifdef __QE__
+	  
+	  //!@' @#### QE simulation.
+	  //@'
+	  
+	  //+++
+	  // QE simulation
+	  //---
+	  
+	  // find data point to be used in Lagrange interpolation (-> k)
+	  
+	  qeptr = (float **)QE[nPMT];
+	  
+	  FindLagrange(qeptr,k,wl);
+	  
+	  // if random > quantum efficiency, reject it
+	  
+	  qe = Lagrange(qeptr,k,wl) / 100.0;
+
+	  // fprintf(stdout, "%f\n", qe);
+	  
+	  if ( RandomNumber > qe ) {
+	    
+	    // read next CPhoton
+	    if ( Data_From_STDIN ) 
+	      cin.read( flag, SIZE_OF_FLAGS );
+	    else
+	      inputfile.read ( flag, SIZE_OF_FLAGS );
+	    
+	    // go to beginning of loop
+	    continue;
+	    
+	  }
+	  
+#endif // __QE__
+	  
+	  //+++
+	  // Cphoton is accepted
+	  //---
+	  
+	  ncph_out++ ; 
+
+	  // increase the number of Cphs. in the PMT, i.e.,
+	  // increase in one unit the counter of the photons
+	  // stored in the pixel nPMT
+	  
+	  fnpix[nPMT] += 1.0;
+
+#ifdef __DETAIL_TRIGGER__ 
+	  //
+	  //  fill the Trigger class with this phe
+	  //
+	  //
+	  Trigger.Fill( nPMT, ( t - t_first ) ) ; 
+
+	  // fadc.Fill( nPMT, ( t - t_first ), Trigger.Fill( nPMT, ( t - t_first ) ) ) ; 
+
+#endif // __DETAIL_TRIGGER__ 
+	  
+	  // read next CPhoton
+
+	  if ( Data_From_STDIN ) 
+	    cin.read( flag, SIZE_OF_FLAGS );
+	  else
+	    inputfile.read ( flag, SIZE_OF_FLAGS );
+
+	}  // end while, i.e. found end of event
+	
+	if ( fmod ( nshow, 1000. ) == 0. ) 
+	  log(SIGNATURE, 
+	      "End of this event: in: %d cphs(+%d). out: %d cphs(+%d). .\n",
+	      ncph_in,  ntcph_in,
+	      ncph_out, ntcph_out);
+	
+	// show number of photons
+	
+	//cout << ncph_in << " photons read . . . " << endl << flush;
+	
+	// skip it ?
+	
+	for ( i=0; i<nSkip; ++i ) {
+	  if (Skip[i] == (nshow+ntshow)) {
+	    i = -1;
+	    break;
+	  }
+	}
+	
+	// if after the previous loop, the exit value of i is -1
+	// then the shower number is in the list of showers to be
+	// skipped
+	
+	if (i == -1) {
+	  log(SIGNATURE, "\t\tskipped!\n");
+	  continue;
+	}
+	
+	/*!@'
+	  
+	  After reading all the Cherenkov photons for a given event,
+	  we have in the table of number of photons for each pixel
+	  only the 'raw' amount of Cherenkov photons @$n_p@$. Now, we
+	  should take this number as the mean value of the
+	  distribution of photons in that pixel @$p@$, following a
+	  Poisson distribution.
+	  
+	  @[ n_p \equiv \mu_p @]
+	  
+	  and with this number the amount of light coming from the
+	  shower is calculated @$\hat{n}_p@$.
+	  
+	  Then, we calculate the amount of Night Sky Background we
+	  must introduce in that pixel @$p@$. We calculate this using
+	  again a Poisson distribution with mean @$\mu_\mathrm{NSB}@$
+	  (defined in the |camera.h| file). The value of
+	  @$\mu_\mathrm{NSB}@$ is obtained from measurements. With this
+	  value, the amount of photons @$\hat{n}_\mathrm{NSB}@$ coming
+	  from the Night Sky Background is calculated.
+	  
+	  Finally, the amount of photons for that pixels is:
+	  @[ \hat{n}_p^\mathrm{final} = \hat{n}_p + \hat{n}_\mathrm{NSB} @]
+	  
+	*/
+	
+	// after reading all the photons, our camera is filled
+	
+	if ( Select_Energy ) {
+	  if (( mcevth.get_energy() < Select_Energy_le ) ||
+	      ( mcevth.get_energy() > Select_Energy_ue )) {
+	    log(SIGNATURE, "select_energy: shower rejected.\n");
+	    continue;
+	  }
+	}
+	
+#ifdef __NSB__
+	
+	//!@' @#### NSB (Night Sky Background) simulation.
+	//@'
+	
+	//+++
+	// NSB simulation
+	//---
+	
+	// add NSB "noise"
+	// TO DO: make meanNSB an array and read the contents from a file!
+	
+	//	if ( simulateNSB )
+	//	  for ( i=0; i<ct_NPixels; ++i ) 
+	//	    fnpix[i] += (float)ignpoi( meanNSB );
+	//      old version of Jose Carlos
+	
+	if ( simulateNSB) {
+	  //
+	  //  loop over all pixels and scramble the number 
+	  //  of NSB photons to put in it. For the number use
+	  //  a poison distribution with a mean calculated from meanNSB
+	  //  and the TOTAL_TRIGGER_TIME
+	  //
+	  for ( Int_t nsbPix = 0 ; nsbPix < CAMERA_PIXELS ; nsbPix++ ) {
+	    //
+	    //
+	    meanPois = meanNSB * TOTAL_TRIGGER_TIME ;  
+	  
+	    //  loop over the scrambled number if Photons in this pixels
+	    
+	    for ( Int_t photNSB=0; photNSB<GenNSB.Poisson(meanPois);
+		  photNSB++){
+	      //
+	      // now scramble the time at that the photo electron of the 
+	      // NSB photon is leaving the photo cathod
+	      // 
+	      
+	      timeNSB = GenNSB.Rndm() * TOTAL_TRIGGER_TIME ; 
+
+	      Trigger.FillNSB ( nsbPix, timeNSB ) ; 
+
+	    }
+		
+
+	  }
+
+	}
+#endif // __NSB__
+	
+	// if we should apply any kind of correction, do it here.
+
+	for ( i=0; i<ct_NPixels; ++i ) 
+	  fnpix[i] *= fCorrection;
+
+#ifdef __DETAIL_TRIGGER__ 
+	//
+	//   now the noise of the electronic 
+	//   (preamps, optical transmission,..)  is introduced. 
+	//   This is done inside the class MTrigger by the method ElecNoise. 
+	//   
+	Trigger.ElecNoise() ;
+	
+	//
+	//   look if in all the signals in the trigger signal branch
+	//   is a possible Trigger. Therefore we habe to diskriminate all
+	//   the simulated analog signals (Method Diskriminate in class
+	//   MTrigger). We look simultanously for the moments at which
+	//   there are more than TRIGGER_MULTI pixels above the 
+	//   CHANNEL_THRESHOLD. 
+	//
+
+	McTrig->SetZeroLevel( Lev0 = (Short_t) Trigger.Diskriminate() ) ; 
+	Lev1 = Lev2 = 0 ; 
+	
+	//
+	//   Start the First Level Trigger simulation
+	//
+	
+	if ( Lev0 > 0 ) {
+	  McTrig->SetFirstLevel ( Lev1 = Trigger.FirstLevel() )  ;
+	}
+
+#endif // __DETAIL_TRIGGER__ 
+
+#ifdef __ROOT__
+
+	//
+	//  Fill the header of this event 
+	//
+	
+	Evt->FillHeader ( (UShort_t) (ntshow + nshow) ,  20 ) ; 
+	
+	//
+	//   fill the MMcEvt with all information  
+	//
+	
+	McEvt->Fill( (UShort_t) mcevth.get_primary() , 
+		     mcevth.get_energy(), 
+		     mcevth.get_theta(), 
+		     mcevth.get_phi(), 
+		     mcevth.get_core(),
+		     mcevth.get_coreX(),
+		     mcevth.get_coreY(),
+		     impactD,
+		     ulli, ulli, 
+		     (UShort_t) ncph_in, 
+		     ulli, 
+		     (UShort_t) ncph_out ) ; 
+	
+	//
+	//    write it out to the file outfile
+	// 
+	
+	EvtTree.Fill() ; 
+	
+#endif // __ROOT__ 
+
+	//
+	//    if a first level trigger occurred, then 
+	//       1. do some other stuff (not implemented) 
+	//       2. start the gui tool
+
+	if ( Lev1 > 0 ) {
+
+	  // fadc.Scan( Trigger.GetFirstLevelTime(0) )  ; 
+
+#ifdef __INTERAKTIV__ 
+	  Trigger.ShowSignal(McEvt) ;
+#endif
+	}
+	
+
+
+#ifdef __ROOT__ 
+	//    clear all
+	Evt->Clear() ; 
+	McEvt->Clear() ; 
+	McTrig->Clear() ; 
+#endif // __ROOT__
+      
+	
+	//++++++++++++++++++++++++++++++++++++++++++++++++++
+	// at this point we have a camera full of
+	// ph.e.s
+	// we should first apply the trigger condition,
+	// and if there's trigger, then clean the image,
+	// calculate the islands statistics and the
+	// other parameters of the image (Hillas' parameters
+	// and so on).
+	//--------------------------------------------------
+	
+#ifdef __DEBUG__  
+	printf("\n");
+	
+	for ( ici=0; ici<PIX_ARRAY_SIDE; ++ici ) {
+	  
+	  for ( icj=0; icj<PIX_ARRAY_SIDE; ++icj ) {
+	    
+	    if ( (int)pixels[ici][icj][PIXNUM] > -1 ) {
+	      
+	      if ( fnpix[(int)pixels[ici][icj][PIXNUM]] > 0. ) {
+		
+		printf ("@@ %4d %4d %10f %10f %4f (%4d %4d)\n", nshow, 
+			(int)pixels[ici][icj][PIXNUM], 
+			pixels[ici][icj][PIXX],
+			pixels[ici][icj][PIXY],
+			fnpix[(int)pixels[ici][icj][PIXNUM]], ici, icj);
+		
+	      } 
+	    }  
+	  }
+	}
+	
+	for (i=0; i<ct_NPixels; ++i) {
+	  printf("%d (%d): ", i, npixneig[i]);
+	  for (j=0; j<npixneig[i]; ++i) 
+	    printf(" %d", pixneig[i][j]);
+	  printf("\n");
+	}
+	
+#endif // __DEBUG__
+	
+
+	//!@' @#### Save data.
+	//@'
+	
+	//++++++++++++++++++++++++++++++++++++++++++++++++++
+	// we now have all information we want
+	// the only thing we must do now is writing it to 
+	// the output file
+	//--------------------------------------------------
+
+	//++ 
+	// save the image to the file
+	//--
+	
+	if ( Data_From_STDIN ) 
+	  cin.read( flag, SIZE_OF_FLAGS );
+	else
+	  inputfile.read ( flag, SIZE_OF_FLAGS );
+	
+      } // end while there is a next event
+
+      if( !isA( flag, FLAG_END_OF_RUN   )){
+	error( SIGNATURE, "Expected end of run flag, but found: %s\n", flag );
+      }
+      else { // found end of run
+	ntshow += nshow;
+	log(SIGNATURE, "End of this run with %d events . . .\n", nshow);
+	
+	//	if ( Data_From_STDIN ) 
+	//  cin.read( flag, SIZE_OF_FLAGS );
+	// else
+	//  inputfile.read ( flag, SIZE_OF_FLAGS );
+	
+	// huschel start here
+
+	if( isA( flag, FLAG_END_OF_FILE ) ){ // end of file
+	  log(SIGNATURE, "End of file . . .\n");
+	  still_in_loop  = FALSE;
+	  
+	  if ((! Data_From_STDIN) && (! inputfile.eof())){
+	    
+	    // we have concatenated input files.
+	    // get signature of the next part and check it.
+	    // NOTE: this part repeats further up in the code;
+	    // if you change something here you probably want to change it 
+	    // there as well
+	    
+	    strcpy(Signature, REFL_SIGNATURE);
+	    
+	    strcpy(sign, Signature);
+	    
+	    inputfile.read( (char *)sign, strlen(Signature));
+	    
+	    if (strcmp(sign, Signature) != 0) {
+	      cerr << "ERROR: Signature of .rfl file is not correct\n";
+	      cerr << '"' << sign << '"' << '\n';
+	      cerr << "should be: " << Signature << '\n';
+	      exit(1);
+	    }
+	    
+	    if ( Data_From_STDIN ) 
+	      cin.read( (char *)sign, 1);
+	    else
+	      inputfile.read( (char *)sign, 1);
+	    
+	  }	
+	  
+	  // huschel ends here 
+	  
+	} // end if found end of file
+
+      } // end if found end of run
+      
+      if ( Data_From_STDIN ) 
+	cin.read( flag, SIZE_OF_FLAGS );
+      else
+	inputfile.read ( flag, SIZE_OF_FLAGS );
+      
+    } // end if else found start of run
+  } // end big while loop
+
+  //!@' @#### End of program.
+  //@'
+
+  //end my version
+
+#ifdef __ROOT__
+      //++
+      // put the Event to the root file
+      //--
+
+      EvtTree.Write() ; 
+      outfile.Write() ;
+      outfile.Close() ; 
+
+#endif // __ROOT__
+              
+  // close input file
+  
+  ntcph_in += ncph_in;
+  ntcph_out += ncph_out;
+  log( SIGNATURE, 
+       "%d event(s), with a total of %d C.photons in and %d C.photons out \n", 
+       ntshow, ntcph_in, ntcph_out );
+
+  //  log( SIGNATURE, "Fraction of triggers: %5.1f%% (%d out of %d)\n", 
+  //   ((float)ntrigger) / ((float)ntshow) * 100.0, ntrigger, ntshow);
+
+  // close files
+  
+  log( SIGNATURE, "Closing files\n" );
+
+  inputfile.close();
+
+#ifdef __DETAIL_TRIGGER__ 
+  // Output of Trigger statistics
+  //
+
+  //  Trigger.PrintStat() ; 
+#endif // __DETAIL_TRIGGER__ 
+
+  // program finished
+
+  log( SIGNATURE, "Done.\n");
+  
+  return( 0 );
+
+}
+//!@}
+
+// @T \newpage
+
+//!@subsection Functions definition.
+
+//!-----------------------------------------------------------
+// @name present
+//
+// @desc Make some presentation
+//
+// @date Sat Jun 27 05:58:56 MET DST 1998
+//------------------------------------------------------------
+// @function
+
+//!@{
+void 
+present(void)
+{
+  cout << "##################################################\n"
+       <<  SIGNATURE << '\n' << '\n'
+       << "Processor of the reflector output\n"
+       << "J C Gonzalez, Jun 1998\n"
+       << "##################################################\n\n"
+       << flush ;
+}
+//!@}
+
+
+//!-----------------------------------------------------------
+// @name usage
+//
+// @desc show help
+//
+// @date Tue Dec 15 16:23:30 MET 1998
+//------------------------------------------------------------
+// @function 
+
+//!@{
+void 
+usage(void)
+{
+  present();
+  cout << "\nusage ::\n\n"
+       << "\t camera "
+       << " [ -@ paramfile ] "
+       << " [ -h ] "
+       << "\n\n or \n\n"
+       << "\t camera < paramfile"
+       << "\n\n";
+  exit(0);
+}
+//!@}
+
+
+//!-----------------------------------------------------------
+// @name log                             
+//                                   
+// @desc function to send log information
+//
+// @var    funct  Name of the caller function
+// @var    fmt    Format to be used (message)
+// @var    ...    Other information to be shown
+//
+// @date Sat Jun 27 05:58:56 MET DST 1998
+//------------------------------------------------------------
+// @function  
+
+//!@{
+void
+log(const char *funct, char *fmt, ...)
+{
+  va_list args;
+  
+  //  Display the name of the function that called error
+  printf("[%s]: ", funct);
+  
+  // Display the remainder of the message
+  va_start(args, fmt);
+  vprintf(fmt, args);
+  va_end(args);
+}
+//!@}
+
+
+//!-----------------------------------------------------------
+// @name error                                                    
+//                                                           
+// @desc function to send an error message, and abort the program
+//
+// @var    funct  Name of the caller function
+// @var    fmt    Format to be used (message)
+// @var    ...    Other information to be shown
+//
+// @date Sat Jun 27 05:58:56 MET DST 1998
+//------------------------------------------------------------
+// @function  
+
+//!@{
+void
+error(const char *funct, char *fmt, ...)
+{
+  va_list args;
+
+  //  Display the name of the function that called error
+  fprintf(stderr, "ERROR in %s: ", funct);
+
+  // Display the remainder of the message
+  va_start(args, fmt);
+  vfprintf(stderr, fmt, args);
+  va_end(args);
+
+  perror(funct);
+
+  abort();
+}
+//!@}
+
+
+//!-----------------------------------------------------------
+// @name isA                               
+//                                             
+// @desc returns TRUE(FALSE), if the flag is(is not) the given
+//
+// @var    s1     String to be searched
+// @var    flag   Flag to compare with string s1
+// @return TRUE: both strings match; FALSE: oth.
+//
+// @date Wed Jul  8 15:25:39 MET DST 1998
+//------------------------------------------------------------
+// @function  
+
+//!@{
+int 
+isA( char * s1, const char * flag ) {
+  return ( (strncmp((char *)s1, flag, SIZE_OF_FLAGS)==0) ? 1 : 0 ); 
+}
+//!@}
+
+
+//!-----------------------------------------------------------
+// @name read_ct_file           
+//                          
+// @desc read CT definition file
+//
+// @date Sat Jun 27 05:58:56 MET DST 1998
+//------------------------------------------------------------
+// @function  
+
+//!@{
+void
+read_ct_file(void)
+{
+  char line[LINE_MAX_LENGTH];    //@< line to get from the ctin
+  char token[ITEM_MAX_LENGTH];   //@< a single token
+  int i, j;                      //@< dummy counters
+
+  log( "read_ct_file", "start.\n" );
+
+  ifstream ctin ( ct_filename );
+
+  if ( ctin.bad() ) 
+    error( "read_ct_file", 
+           "Cannot open CT def. file: %s\n", ct_filename );
+  
+  // loop till the "end" directive is reached
+
+  while (!ctin.eof()) {          
+
+    // get line from stdin
+
+    ctin.getline(line, LINE_MAX_LENGTH);
+
+    // look for each item at the beginning of the line
+
+    for (i=0; i<=define_mirrors; i++) 
+      if (strstr(line, CT_ITEM_NAMES[i]) == line)
+        break;
+    
+    // if it is not a valid line, just ignore it
+
+    if (i == define_mirrors+1) 
+      continue;
+    
+    // case block for each directive
+
+    switch ( i ) {
+
+    case type:                // <type of telescope> (0:CT1 ¦ 1:MAGIC)
+      
+      // get focal distance
+
+      sscanf(line, "%s %d", token, &ct_Type);
+
+      log( "read_ct_file", "<Type of Telescope>: %s\n", 
+           ((ct_Type==0) ? "CT1" : "MAGIC") );
+
+      break;
+
+    case focal_distance:      // <focal distance> [cm]
+      
+      // get focal distance
+
+      sscanf(line, "%s %f", token, &ct_Focal_mean);
+
+      log( "read_ct_file", "<Focal distance>: %f cm\n", ct_Focal_mean );
+
+      break;
+
+    case focal_std:           // s(focal distance) [cm]
+      
+      // get focal distance
+
+      sscanf(line, "%s %f", token, &ct_Focal_std);
+
+      log( "read_ct_file", "s(Focal distance): %f cm\n", ct_Focal_std );
+
+      break;
+
+    case point_spread:        // <point spread> [cm]
+      
+      // get point spread
+
+      sscanf(line, "%s %f", token, &ct_PSpread_mean);
+
+      log( "read_ct_file", "<Point spread>: %f cm\n", ct_PSpread_mean );
+
+      break;
+
+    case point_std:           // s(point spread) [cm]
+      
+      // get point spread
+
+      sscanf(line, "%s %f", token, &ct_PSpread_std);
+
+      log( "read_ct_file", "s(Point spread): %f cm\n", ct_PSpread_std );
+
+      break;
+
+    case adjustment_dev:      // s(adjustment_dev) [cm]
+      
+      // get point spread
+
+      sscanf(line, "%s %f", token, &ct_Adjustment_std);
+
+      log( "read_ct_file", "s(Adjustment): %f cm\n", ct_Adjustment_std );
+
+      break;
+
+    case black_spot:          // radius of the black spot in the center [cm]
+      
+      // get black spot radius
+
+      sscanf(line, "%s %f", token, &ct_BlackSpot_rad);
+
+      log( "read_ct_file", "Radius of the black spots: %f cm\n", 
+           ct_BlackSpot_rad);
+
+      break;
+
+    case r_mirror:            // radius of the mirrors [cm]
+      
+      // get radius of mirror
+
+      sscanf(line, "%s %f", token, &ct_RMirror);
+
+      log( "read_ct_file", "Radii of the mirrors: %f cm\n", ct_RMirror );
+
+      break;
+
+    case n_mirrors:           // number of mirrors
+      
+      // get the name of the output_file from the line
+
+      sscanf(line, "%s %d", token, &ct_NMirrors);
+
+      log( "read_ct_file", "Number of mirrors: %d\n", ct_NMirrors );
+
+      break;
+
+    case camera_width:        // camera width [cm]
+      
+      // get the name of the ct_file from the line
+
+      sscanf(line, "%s %f", token, &ct_CameraWidth);
+
+      log( "read_ct_file", "Camera width: %f cm\n", ct_CameraWidth );
+
+      break;
+
+    case n_pixels:           // number of pixels
+      
+      // get the name of the output_file from the line
+
+      sscanf(line, "%s %d", token, &ct_NPixels);
+
+      log( "read_ct_file", "Number of pixels: %d\n", ct_NPixels );
+
+      break;
+
+    case n_centralpixels:           // number of central pixels
+      
+      // get the name of the output_file from the line
+
+      sscanf(line, "%s %d", token, &ct_NCentralPixels);
+
+      log( "read_ct_file", "Number of central pixels: %d\n", ct_NCentralPixels );
+
+      break;
+
+    case n_gappixels:           // number of gap pixels
+      
+      // get the name of the output_file from the line
+
+      sscanf(line, "%s %d", token, &ct_NGapPixels);
+
+      log( "read_ct_file", "Number of gap pixels: %d\n", ct_NGapPixels );
+
+      break;
+
+    case pixel_width:         // pixel width [cm]
+      
+      // get the name of the ct_file from the line
+
+      sscanf(line, "%s %f", token, &ct_PixelWidth);
+
+      ct_PixelWidth_corner_2_corner = ct_PixelWidth / cos(RAD(30.0));
+      ct_PixelWidth_corner_2_corner_half =
+        ct_PixelWidth_corner_2_corner * 0.50;
+      ct_Apot = ct_PixelWidth / 2;
+      ct_2Apot = ct_Apot * 2.0;
+
+      log( "read_ct_file", "Pixel width: %f cm\n", ct_PixelWidth );
+
+      break;
+
+    case define_mirrors:      // read table with the parameters of the mirrors
+
+      log( "read_ct_file", "Table of mirrors data:\n" );
+
+      // check whether the number of mirrors was already set
+
+      if ( ct_NMirrors == 0 )
+        error( "read_ct_file", "NMirrors was not set.\n" );
+      
+      // allocate memory for paths list
+
+      log( "read_ct_file", "Allocating memory for ct_data\n" );
+
+      ct_data = new float*[ct_NMirrors];
+
+      for (i=0; i<ct_NMirrors; i++) 
+        ct_data[i] = new float[CT_NDATA];
+
+      // read data
+
+      log( "read_ct_file", "Reading mirrors data...\n" );
+
+      for (i=0; i<ct_NMirrors; i++)
+        for (j=0; j<CT_NDATA; j++)
+          ctin >> ct_data[i][j];
+
+      break;
+
+    } // switch ( i ) 
+
+  } // end while
+
+  // end
+
+  log( "read_ct_file", "done.\n" );
+
+  return;
+}
+//!@}
+
+
+//!-----------------------------------------------------------
+// @name read_pixels  
+//                          
+// @desc read pixels data
+//
+// @date Fri Mar 12 16:33:34 MET 1999
+//------------------------------------------------------------
+// @function
+
+//!@{
+void 
+read_pixels(struct camera *pcam)
+{
+  ifstream qefile;
+  char line[LINE_MAX_LENGTH];
+  int n, i, j, k;
+  float qe;
+
+  //------------------------------------------------------------
+  // first, pixels' coordinates
+
+  pcam->inumpixels = ct_NPixels;
+  pcam->inumcentralpixels = ct_NCentralPixels;
+  pcam->inumgappixels = ct_NGapPixels;
+  pcam->inumbigpixels = ct_NPixels - ct_NCentralPixels - ct_NGapPixels;
+  pcam->dpixdiameter_cm =  ct_PixelWidth; 
+
+  // initialize pixel numbers
+
+  for ( i=0; i<PIX_ARRAY_SIDE; ++i ) 
+    for ( j=0; j<PIX_ARRAY_SIDE; ++j ) 
+      pixels[i][j][PIXNUM] = -1;
+
+  pixary = new float* [2*ct_NCentralPixels];
+  for ( i=0; i<2*ct_NCentralPixels; ++i ) 
+    pixary[i] = new float[2];
+
+  pixneig = new int* [ct_NCentralPixels];
+  for ( i=0; i<ct_NCentralPixels; ++i ) {
+    pixneig[i] = new int[6];
+    for ( j=0; j<6; ++j ) 
+      pixneig[i][j] = -1;
+  }
+
+  npixneig = new int[ct_NCentralPixels];
+  for ( i=0; i<ct_NCentralPixels; ++i ) 
+    npixneig[i] = 0;
+
+  // generate all coordinates
+
+  igen_pixel_coordinates(pcam);
+
+  // transfer coordinates to the working arrays for
+  // the central pixels
+
+  for(k=0; k<ct_NCentralPixels; k++){
+
+    i = (int) pcam->di[k];
+    j = (int) pcam->dj[k];
+
+    pixels[i+PIX_ARRAY_HALF_SIDE][j+PIX_ARRAY_HALF_SIDE][PIXNUM] = k;
+    pixels[i+PIX_ARRAY_HALF_SIDE][j+PIX_ARRAY_HALF_SIDE][PIXX] = pcam->dxc[k];
+    pixels[i+PIX_ARRAY_HALF_SIDE][j+PIX_ARRAY_HALF_SIDE][PIXY] = pcam->dyc[k];
+   
+    pixary[k][0] = pcam->dxc[k];
+    pixary[k][1] = pcam->dyc[k];
+  }
+
+  // calculate tables of neighbours
+  
+#ifdef __DEBUG__
+  for ( n=0 ; n<ct_NPixels ; ++n ) {
+    cout << "Para el pixel " << n << ": ";	
+    for ( i=n+1 ; (i<ct_NPixels)&&(npixneig[n]<6) ; ++i) {
+      if ( pixels_are_neig(n,i) == TRUE ) {
+        pixneig[n][npixneig[n]] = i;
+        pixneig[i][npixneig[i]] = n;
+        cout << i << ' ';
+        ++npixneig[n];
+        ++npixneig[i];
+      }
+    }
+    cout << endl << flush;
+  }
+#else // ! __DEBUG__
+  for ( n=0 ; n<ct_NCentralPixels ; ++n ) 
+    for ( i=n+1 ; (i<ct_NCentralPixels)&&(npixneig[n]<6) ; ++i) 
+      if ( pixels_are_neig(n,i) == TRUE ) {
+        pixneig[n][npixneig[n]] = i;
+        pixneig[i][npixneig[i]] = n;
+        ++npixneig[n];
+        ++npixneig[i];
+      }
+#endif // ! __DEBUG__
+  
+#ifdef __DEBUG__
+  for ( n=0 ; n<ct_NPixels ; ++n ) {
+    cout << n << ':';
+    for ( j=0; j<npixneig[n]; ++j) 
+      cout << ' ' << pixneig[n][j];
+    cout << endl << flush;
+  }
+#endif // __DEBUG__  
+
+  //------------------------------------------------------------
+  // second, pixels' QE
+
+  // try to open the file
+
+  log("read_pixels", "Openning the file \"%s\" . . .\n", QE_FILE);
+  
+  qefile.open( QE_FILE );
+  
+  // if it is wrong or does not exist, exit
+  
+  if ( qefile.bad() )
+    error( "read_pixels", "Cannot open \"%s\". Exiting.\n", QE_FILE );
+  
+  // read file
+
+  log("read_pixels", "Reading data . . .\n");
+
+  i=-1;
+
+  while ( ! qefile.eof() ) {          
+
+    // get line from the file
+
+    qefile.getline(line, LINE_MAX_LENGTH);
+
+    // skip if comment
+
+    if ( *line == '#' )
+      continue;
+
+    // if it is the first valid value, it is the number of QE data points
+
+    if ( i < 0 ) {
+
+      // get the number of datapoints 
+
+      sscanf(line, "%d", &pointsQE);
+      
+      // allocate memory for the table of QEs
+      
+      QE = new float ** [ct_NPixels];
+
+      for ( i=0; i<ct_NPixels; ++i ) {
+        QE[i] = new float * [2];
+        QE[i][0] = new float[pointsQE];
+        QE[i][1] = new float[pointsQE];
+      }
+      
+      QElambda = new float [pointsQE];
+
+      for ( i=0; i<pointsQE; ++i ) {
+        qefile.getline(line, LINE_MAX_LENGTH);
+        sscanf(line, "%f", &QElambda[i]);
+      }
+
+      i=0;
+
+      continue;
+    }
+
+    // get the values (num-pixel, num-datapoint, QE-value)
+    
+    sscanf(line, "%d %d %f", &i, &j, &qe);
+
+    if ( ((i-1) < ct_NPixels) && ((i-1) > -1) &&
+         ((j-1) < pointsQE)   && ((j-1) > -1) ) {
+      QE[i-1][0][j-1] = QElambda[j-1];
+      QE[i-1][1][j-1] = qe;
+    }
+
+  }
+
+  // close file
+
+  qefile.close();
+
+  // end
+
+  log("read_pixels", "Done.\n");
+
+}
+//!@}
+
+
+//!-----------------------------------------------------------
+// @name pixels_are_neig                        
+//                                             
+// @desc check whether two pixels are neighbours
+//
+// @var pix1      Number of the first pixel
+// @var pix2      Number of the second pixel
+// @return        TRUE: both pixels are neighbours; FALSE: oth.
+//
+// @date Wed Sep  9 17:58:37 MET DST 1998
+//------------------------------------------------------------
+// @function  
+
+//!@{
+int
+pixels_are_neig(int pix1, int pix2)
+{ 
+  if ( sqrt(SQR( pixary[pix1][0] - pixary[pix2][0] ) +
+            SQR( pixary[pix1][1] - pixary[pix2][1] ) ) 
+       > ct_PixelWidth_corner_2_corner ) 
+    return ( FALSE );
+  else
+    return ( TRUE );
+}
+//!@}
+
+//!-----------------------------------------------------------
+// @name igen_pixel_coordinates
+//                                             
+// @desc generate the pixel center coordinates
+//
+// @var *pcam     structure camera containing all the
+//                camera information
+// @return        total number of pixels
+//
+// DP
+//
+// @date Thu Oct 14 10:41:03 CEST 1999
+//------------------------------------------------------------
+// @function  
+
+//!@{
+/******** igen_pixel_coordinates() *********************************/
+
+int igen_pixel_coordinates(struct camera *pcam) { 
+            /* generate pixel coordinates, return value is number of pixels */
+
+  int i, itot_inside_ring, iN, in, ipixno, iring_no, ipix_in_ring, isegment;
+  float fsegment_fract;
+  double dtsize;
+  double dhsize;
+  double dpsize;
+  double dxfirst_pix;
+  double dyfirst_pix;
+  double ddxseg1, ddxseg2, ddxseg3, ddxseg4, ddxseg5, ddxseg6;
+  double ddyseg1, ddyseg2, ddyseg3, ddyseg4, ddyseg5, ddyseg6;
+  
+
+  double dstartx, dstarty;   /* for the gap pixels and outer pixels */
+  int j, nrow;
+
+  dpsize = pcam->dpixdiameter_cm;
+  dtsize = dpsize * sqrt(3.) / 2.;
+  dhsize = dpsize / 2.;
+
+  /* Loop over central pixels to generate co-ordinates  */
+
+  for(ipixno=1; ipixno <= pcam->inumcentralpixels; ipixno++){
+
+    /* Initialise variables. The central pixel = ipixno 1 in ring iring_no 0 */
+
+    pcam->dpixsizefactor[ipixno] = 1.;
+
+    in = 0;
+
+    i = 0;
+    itot_inside_ring = 0;
+    iring_no = 0;
+
+    /* Calculate the number of pixels out to and including the ring containing pixel number */
+    /* ipixno e.g. for pixel number 17 in ring number 2 itot_inside_ring = 19 */
+
+    while (itot_inside_ring == 0){
+      
+      iN = 3*(i*(i+1)) + 1;
+      
+      if (ipixno <= iN){
+	iring_no = i;
+	itot_inside_ring = iN;
+      }
+      
+      i++;
+    }
+    
+    
+    /* Find the number of pixels which make up ring number iring_no e.g. ipix_in_ring = 6 for ring 1 */    
+        
+    ipix_in_ring = 0;
+    for (i = 0; i < iring_no; ++i){
+
+      ipix_in_ring = ipix_in_ring + 6;
+    }
+
+    /* The camera is viewed as 6 radial segments ("pie slices"). Knowing the number of pixels in its */
+    /* ring calculate which segment the pixel ipixno is in. Then find how far across this segment it is */
+    /* as a fraction of the number of pixels in this sixth of the ring (ask SMB). */
+        
+    isegment = 0;
+    fsegment_fract = 0.;
+    if (iring_no > 0) {
+      
+      isegment = (int)((ipixno - itot_inside_ring + ipix_in_ring - 0.5) / iring_no + 1); /* integer division ! numbering starts at 1 */
+      
+      fsegment_fract = (ipixno - (itot_inside_ring - ipix_in_ring)) - ((isegment-1)*iring_no) - 1 ;
+      
+    }
+
+    /* the first pixel in each ring lies on the positive x axis at a distance dxfirst_pix = iring_no * the */
+    /* pixel width (flat to flat) dpsize. */
+        
+    dxfirst_pix = dpsize*iring_no;
+    dyfirst_pix = 0.;
+
+    /* the vector between the first and last pixels in a segment n is (ddxsegn, ddysegn) */
+
+    ddxseg1 = - dhsize*iring_no;
+    ddyseg1 = dtsize*iring_no;
+    ddxseg2 = -dpsize*iring_no;
+    ddyseg2 = 0.;
+    ddxseg3 = ddxseg1;
+    ddyseg3 = -ddyseg1;
+    ddxseg4 = -ddxseg1;
+    ddyseg4 = -ddyseg1;
+    ddxseg5 = -ddxseg2;
+    ddyseg5 = 0.;
+    ddxseg6 = -ddxseg1;
+    ddyseg6 = ddyseg1;
+    
+    /* to find the position of pixel ipixno take the position of the first pixel in the ring and move */
+    /* anti-clockwise around the ring by adding the segment to segment vectors. */
+
+    switch (isegment) {
+      
+    case 0:
+
+      pcam->dxc[ipixno-1] = 0.;
+      pcam->dyc[ipixno-1] = 0.; 
+
+    case 1: 
+      pcam->dxc[ipixno-1] = dxfirst_pix - dhsize*fsegment_fract;
+      pcam->dyc[ipixno-1] = dyfirst_pix + dtsize*fsegment_fract;
+      
+      break;
+      
+    case 2:
+      
+      pcam->dxc[ipixno-1] = dxfirst_pix + ddxseg1 - dpsize*fsegment_fract;
+      pcam->dyc[ipixno-1] = dyfirst_pix + ddyseg1 + 0.;
+      
+      break;
+      
+    case 3:
+      
+      pcam->dxc[ipixno-1] = dxfirst_pix + ddxseg1 + ddxseg2 - dhsize*fsegment_fract;
+      pcam->dyc[ipixno-1] = dyfirst_pix + ddyseg1 + ddyseg2 - dtsize*fsegment_fract;
+      
+      break;
+      
+    case 4:
+      
+      pcam->dxc[ipixno-1] = dxfirst_pix + ddxseg1 + ddxseg2 + ddxseg3 + dhsize*fsegment_fract;
+      pcam->dyc[ipixno-1] = dyfirst_pix + ddyseg1 + ddyseg2 + ddyseg3 - dtsize*fsegment_fract;
+      
+      break;
+      
+    case 5:
+      
+      pcam->dxc[ipixno-1] = dxfirst_pix + ddxseg1 + ddxseg2 + ddxseg3 + ddxseg4 + dpsize*fsegment_fract;
+      pcam->dyc[ipixno-1] = dyfirst_pix + ddyseg1 + ddyseg2 + ddyseg3 + ddyseg4 + 0.;
+    
+      break;
+      
+    case 6:
+      
+      pcam->dxc[ipixno-1] = dxfirst_pix + ddxseg1 + ddxseg2 + ddxseg3 + ddxseg4 + ddxseg5 + dhsize*fsegment_fract;
+      pcam->dyc[ipixno-1] = dyfirst_pix + ddyseg1 + ddyseg2 + ddyseg3 + ddyseg4 + ddyseg5 + dtsize*fsegment_fract;
+      
+      break;
+      
+    default: 
+
+      fprintf(stderr, "ERROR: problem in coordinate generation for pixel %d\n", ipixno);
+      return(0);
+      
+    } /* end switch */
+
+  } /* end for */
+
+  dstartx = pcam->dxc[pcam->inumcentralpixels - 1] + dhsize;
+  dstarty = pcam->dyc[pcam->inumcentralpixels - 1] + dtsize;
+
+  if(pcam->inumgappixels > 0){   /* generate the positions of the gap pixels */
+    
+    j = pcam->inumcentralpixels;
+
+    for(i=0; i<pcam->inumgappixels; i=i+6){
+      pcam->dxc[j + i ] = dstartx + 2. * (i/6 + 1) * dpsize; 
+      pcam->dyc[j + i ] = dstarty;
+      pcam->dpixsizefactor[j + i] = 1.;
+      pcam->dxc[j + i + 1] = pcam->dxc[j + i ] / 2.;
+      pcam->dyc[j + i + 1] = sqrt(3.) * pcam->dxc[j + i + 1];
+      pcam->dpixsizefactor[j + i + 1] = 1.;
+      pcam->dxc[j + i + 2] = - pcam->dxc[j + i + 1];
+      pcam->dyc[j + i + 2] = pcam->dyc[j + i + 1];
+      pcam->dpixsizefactor[j + i+ 2] = 1.;
+      pcam->dxc[j + i + 3] = - pcam->dxc[j + i];
+      pcam->dyc[j + i + 3] = dstarty;
+      pcam->dpixsizefactor[j + i+ 3] = 1.;
+      pcam->dxc[j + i + 4] = pcam->dxc[j + i + 2];
+      pcam->dyc[j + i + 4] = - pcam->dyc[j + i + 2];
+      pcam->dpixsizefactor[j + i+ 4] = 1.;
+      pcam->dxc[j + i + 5] = pcam->dxc[j + i + 1];
+      pcam->dyc[j + i + 5] = - pcam->dyc[j + i + 1];
+      pcam->dpixsizefactor[j + i + 5] = 1.;
+    } /* end for */
+  } /* end if */
+
+  /* generate positions of the outer pixels */
+
+  if( pcam->inumbigpixels > 0 ){
+
+    j = pcam->inumcentralpixels + pcam->inumgappixels;
+
+    for(i=0; i<pcam->inumbigpixels; i++){
+      pcam->dpixsizefactor[j + i] = 2.;
+    }
+
+    in = 0;
+
+    nrow = (int) ceil(dstartx / 2. / dpsize);    
+
+    while(in < pcam->inumbigpixels){
+
+      pcam->dxc[j + in] = dstartx + dpsize;
+      pcam->dyc[j + in] = dstarty + 2 * dpsize / sqrt(3.);
+      pcam->dxc[j + in + nrow] = dstartx / 2. - dpsize / 2.;
+      pcam->dyc[j + in + nrow] = sqrt(3.)/2. * dstartx + 2.5 * dpsize/sqrt(3.);
+      pcam->dxc[j + in + 3 * nrow - 1] = - pcam->dxc[j + in];
+      pcam->dyc[j + in + 3 * nrow - 1] = pcam->dyc[j + in];
+      pcam->dxc[j + in + 3 * nrow] = - pcam->dxc[j + in];
+      pcam->dyc[j + in + 3 * nrow] = - pcam->dyc[j + in];
+      pcam->dxc[j + in + 5 * nrow - 1] = pcam->dxc[j + in + nrow];
+      pcam->dyc[j + in + 5 * nrow - 1] = - pcam->dyc[j + in + nrow];
+      pcam->dxc[j + in + 6 * nrow - 1] = pcam->dxc[j + in];
+      pcam->dyc[j + in + 6 * nrow - 1] = - pcam->dyc[j + in];
+      for(i=1; i<nrow; i++){
+	pcam->dxc[j + in + i] = pcam->dxc[j + in] - i * dpsize;
+	pcam->dyc[j + in + i] = pcam->dyc[j + in] + i * dpsize * sqrt(3.);
+	pcam->dxc[j + in + i + nrow] = pcam->dxc[j + in + nrow] - i * 2 * dpsize;
+	pcam->dyc[j + in + i + nrow] = pcam->dyc[j + in + nrow];
+        pcam->dxc[j + in + 3 * nrow - 1 - i] = - pcam->dxc[j + in + i];
+	pcam->dyc[j + in + 3 * nrow - 1- i] = pcam->dyc[j + in + i];
+	pcam->dxc[j + in + i + 3 * nrow] = - pcam->dxc[j + in + i];
+	pcam->dyc[j + in + i + 3 * nrow] = - pcam->dyc[j + in + i];
+	pcam->dxc[j + in + 5 * nrow - 1 - i] = pcam->dxc[j + in + i + nrow];
+	pcam->dyc[j + in + 5 * nrow - 1 - i] = - pcam->dyc[j + in + i + nrow];
+	pcam->dxc[j + in + 6 * nrow - 1 - i] = pcam->dxc[j + in + i];
+	pcam->dyc[j + in + 6 * nrow - 1 - i] = - pcam->dyc[j + in + i];
+      }
+      in = in + 6 * nrow;
+      dstartx = dstartx + 2. * dpsize;
+      nrow = nrow + 1;
+    } /* end while */
+
+  } /* end if */
+
+  /* generate the ij coordinates */
+
+  for(i=0; i<pcam->inumpixels; i++){
+    pcam->dj[i] = pcam->dyc[i]/SIN60/dpsize;
+    pcam->di[i] = pcam->dxc[i]/dpsize - pcam->dj[i]*COS60;
+
+    //    fprintf(stdout, "%d %f %f %f %f %f\n", 
+    //	    i+1, pcam->di[i], pcam->dj[i], pcam->dxc[i], pcam->dyc[i],
+    //	    pcam->dpixsizefactor[i]);
+
+  }
+
+  return(pcam->inumpixels);
+
+}
+//!@}
+
+//!-----------------------------------------------------------
+// @name bpoint_is_in_pix
+//                                             
+// @desc check if a point (x,y) in camera coordinates is inside a given pixel
+// 
+// @var *pcam     structure camera containing all the
+//                camera information
+// @var dx, dy    point coordinates in centimeters
+// @var ipixnum   pixel number (starting at 0)
+// @return        TRUE if the point is inside the pixel, FALSE otherwise
+//
+// DP
+//
+// @date Thu Oct 14 16:59:04 CEST 1999
+//------------------------------------------------------------
+// @function  
+
+//!@{
+
+/******** bpoint_is_in_pix() ***************************************/
+
+int bpoint_is_in_pix(double dx, double dy, int ipixnum, struct camera *pcam){
+  /* return TRUE if point (dx, dy) is in pixel number ipixnum, else return FALSE (use camera coordinate system) */
+  /* the pixel is assumed to be a "closed set" */
+
+  double a, b; /* a = length of one of the edges of one pixel, b = half the width of one pixel */
+  double c, xx, yy; /* auxiliary variable */
+
+  b = pcam->dpixdiameter_cm / 2. * pcam->dpixsizefactor[ipixnum];
+  a = pcam->dpixdiameter_cm / sqrt(3.) * pcam->dpixsizefactor[ipixnum];
+  c = 1. - 1./sqrt(3.);
+  if((ipixnum < 0)||(ipixnum >= pcam->inumpixels)){
+    fprintf(stderr, "Error in bpoint_is_in_pix: invalid pixel number %d\n", ipixnum);
+    fprintf(stderr, "Exiting.\n");
+    exit(203);
+  }
+  xx = dx - pcam->dxc[ipixnum];
+  yy = dy - pcam->dyc[ipixnum];
+
+  if(((-b <= xx) && (xx <= 0.) && ((-c * xx - a) <= yy) && (yy <= ( c * xx + a))) ||
+     ((0. <  xx) && (xx <= b ) && (( c * xx - a) <= yy) && (yy <= (-c * xx + a)))   ){
+    return(TRUE); /* point is inside */
+  }
+  else{
+    return(FALSE); /* point is outside */
+  }
+}
+
+//!@}
+
+//------------------------------------------------------------
+// @name dist_r_P                          
+//                                     
+// @desc distance straight line r - point P
+//
+// @date Sat Jun 27 05:58:56 MET DST 1998
+// @function @code 
+//------------------------------------------------------------
+// dist_r_P
+//
+// distance straight line r - point P
+//------------------------------------------------------------
+
+float 
+dist_r_P(float a, float b, float c, 
+         float l, float m, float n,
+         float x, float y, float z)
+{
+  return (
+          sqrt((SQR((a-x)*m-(b-y)*l) +
+                SQR((b-y)*n-(c-z)*m) +
+                SQR((c-z)*l-(a-x)*n))/
+               (SQR(l)+SQR(m)+SQR(n))
+               )
+          );
+}
+// @endcode
+
+
+//=------------------------------------------------------------
+//!@subsection Log of this file.
+
+//!@{
+//
+// $Log: not supported by cvs2svn $
+// Revision 1.1.1.1  1999/11/05 11:59:31  harald
+// This the starting point for CVS controlled further developments of the
+// camera program. The program was originally written by Jose Carlos. 
+// But here you can find a "rootified" version to the program. This means 
+// that there is no hbook stuff in it now. Also the output of the
+// program changed to the MagicRawDataFormat. 
+//
+// The "rootification" was done by Dirk Petry and Harald Kornmayer. 
+//
+// In the following you can see the README file of that version:
+//
+// ==================================================
+//
+// Fri Oct 22  1999   D.P.
+//
+// The MAGIC Monte Carlo System
+//
+// Camera Simulation Programme
+// ---------------------------
+//
+// 1) Description
+//
+// This version is the result of the fusion of H.K.'s
+// root_camera which is described below (section 2)
+// and another version by D.P. which had a few additional
+// useful features.
+//
+// The version compiles under Linux with ROOT 2.22 installed
+// (variable ROOTSYS has to be set).
+//
+// Compile as before simply using "make" in the root_camera
+// directory.
+//
+// All features of H.K.'s root_camera were retained.
+//
+// Additional features of this version are:
+//
+//   a) HBOOK is no longer used and all references are removed.
+//
+//   b) Instead of HBOOK, the user is given now the possibility of 
+//      having Diagnostic data in ROOT format as a complement
+//      to the ROOT Raw data.
+//
+//      This data is written to the file which is determined by
+//      the new input parameter "diag_file" in the camera parameter
+//      file.
+//
+//      All source code file belonging to this part have filenames
+//      starting with "MDiag".
+//
+//      The user can read the output file using the following commands
+//      in an interactive ROOT session:
+//
+//        	root [0] .L MDiag.so
+// 	root [1] new TFile("diag.root");
+// 	root [2] new TTreeViewer("T");
+// 	
+//      This brings up a viewer from which all variables of the
+//      TTree can be accessed and histogrammed. This example
+//      assumes that you have named the file "diag.root", that
+//      you are using ROOT version 2.22 or later and that you have
+//      the shared object library "MDiag.so" which is produced
+//      by the Makefile along with the executable "camera".
+//        
+//  !   The contents of the so-called diag file is not yet fixed.
+//  !   At the moment it is what J.C.G. used to put into the HBOOK
+//  !   ntuple. In future versions the moments calculation can be
+//  !   removed and the parameter list be modified correspondingly.
+//
+//   c) Now concatenated reflector files can be read. This is useful
+//      if you have run the reflector with different parameters but
+//      you want to continue the analysis with all reflector data
+//      going into ONE ROOT outputfile.
+//
+//      The previous camera version contained a bug which made reading 
+//      of two or more concatenated reflector files impossible.
+//
+//   d) The reflector output format was changed. It is now version
+//      0.4 .
+//      The change solely consists in a shortening of the flag
+//      definition in the file 
+//
+//            include-MC/MCCphoton.hxx  
+//
+//  !   IF YOU WANT TO READ REFLECTOR FORMAT 0.3, you can easily
+//  !   do so by recompiling camera with the previous version of
+//  !   include-MC/MCCphoton.hxx.
+//
+//      The change was necessary for saving space and better
+//      debugging. From now on, this format can be frozen.
+//
+//  !   For producing reflector output in the new format, you
+//  !   of course have to recompile your reflector with the
+//  !   new include-MC/MCCphoton.hxx .
+//
+//   e) A first version of the pixelization with the larger
+//      outer pixels is implemented. THIS IS NOT YET FULLY
+//      TESTED, but first rough tests show that it works
+//      at least to a good approximation.
+//
+//      The present version implements the camera outline
+//      with 18 "gap-pixels" and 595 pixels in total as
+//      shown in 
+//
+//         http://sarastro.ifae.es/internal/home/hardware/camera/numbering.ps
+//
+//      This change involved 
+//
+// 	(i) The file pixels.dat is no longer needed. Instead
+//           the coordinates are generated by the program itself
+//           (takes maybe 1 second). In the file 
+//
+// 		pixel-coords.txt
+//
+// 	  in the same directory as this README, you find a list
+//           of the coordinates generated by this new routine. It
+//           has the format
+//
+//               number   i   j   x  y  size-factor
+//
+//           where i and j are J.C.G.'s so called biaxis hexagonal
+//           coordinates (for internal use) and x and y are the
+//           coordinates of the pixel centers in the standard camera
+//           coordinate system in units of centimeters. The value
+//           of "size-factor" determines the linear size of the pixel
+//           relative to the central pixels. 
+//
+//         (ii) The magic.def file has two additional parameters
+//           which give the number of central pixels and the
+//           number of gap pixels
+//
+//         (iii) In camera.h and camera.cxx several changes were 
+//           necessary, among them the introduction of several
+//           new functions 
+//
+//      The newly suggested outline with asymmetric Winston cones
+//      will be implemented in a later version.
+//
+//   f) phe files can no longer be read since this contradicts
+//      our philosophy that the analysis should be done with other
+//      programs like e.g. EVITA and not with "camera" itself.
+//      This possibility was removed. 
+//
+//   g) ROOT is no longer invoked with an interactive interface.
+//      In this way, camera can better be run as a batch program and
+//      it uses less memory.
+//
+//   h) small changes concerning the variable "t_chan" were necessary in
+//      order to avoid segmentation faults: The variable is used as an
+//      index and it went sometimes outside the limits when camera
+//      was reading proton data. This is because the reflector files
+//      don't contain the photons in a chronological order and also
+//      the timespread can be considerably longer that the foreseen
+//      digitisation timespan. Please see the source code of camera.cxx
+//      round about line 1090.
+//
+//   j) several unused variables were removed, a few warning messages
+//      occur when you compile camera.cxx but these can be ignored at
+//      the moment.
+//
+// In general the program is of course not finished. It still needs
+// debugging, proper trigger simulation, simulation of the asymmetric
+// version of the outer pixels, proper NSB simulation, adaption of
+// the diag "ntuple" contents to our need and others small improvements.
+//
+// In the directory rfl-files there is now a file in reflector format 0.4
+// containing a single event produced by the starfiled adder. It has
+// a duration of 30 ns and represents the region around the Crab Nebula.
+// Using the enclosed input parameter file, camera should process this
+// file without problems.
+//
+// 2) The README for the previous version of root_camera
+//
+// README for a preliminary version of the 
+// root_camera program. 
+//
+// root_camera is based on the program "camera"of Jose Carlos
+// Gonzalez. It was changed in the way that only the pixelisation 
+// and the distibution of the phe to the FADCs works in a 
+// first version. 
+//
+// Using the #undef command most possibilities of the orignal 
+// program are switched of. 
+//
+// The new parts are signed by 
+//
+// - ROOT or __ROOT__ 
+//   nearly all  important codelines for ROOT output are enclosed 
+//   in structures like 
+//   #ifdef __ROOT__ 
+//   
+//     code 
+//
+//   #endif // __ROOT__ 
+//
+//   In same case the new lines are signed by a comment with the word 
+//   ROOT in it. 
+//
+//   For timing of the pulse some variable names are changed. 
+//   (t0, t1, t  -->  t_ini, t_fin, t_1st, t_chan,...) 
+//   Look also for this changes. 
+//
+//   For the new root-file is also a change in readparm-files
+//
+//
+// - __DETAIL_TRIGGER__
+//
+//   This is for the implementation of the current work on trigger 
+//   studies. Because the class MTrigger is not well documented it 
+//   isn´t a part of this tar file. Only a dummy File exists. 
+//
+//
+//
+// With all files in the archive, the root_camera program should run. 
+//
+// A reflector file is in the directory rfl-files
+//
+// ==================================================
+//
+// From now on, use CVS for development!!!!
+//
+//
+//
+// Revision 1.3  1999/10/22 15:01:28  petry
+// version sent to H.K. and N.M. on Fri Oct 22 1999
+//
+// Revision 1.2  1999/10/22 09:44:23  petry
+// first synthesized version which compiles and runs without crashing;
+//
+// Revision 1.1.1.1  1999/10/21 16:35:10  petry
+// first synthesised version
+//
+// Revision 1.13  1999/03/15  14:59:05  gonzalez
+// camera-1_1
+//
+// Revision 1.12  1999/03/02  09:56:10  gonzalez
+// *** empty log message ***
+//
+//
+//!@}
+
+//=EOF
Index: trunk/MagicSoft/Simulation/Detector/TimeCam/timecam.h
===================================================================
--- trunk/MagicSoft/Simulation/Detector/TimeCam/timecam.h	(revision 353)
+++ trunk/MagicSoft/Simulation/Detector/TimeCam/timecam.h	(revision 353)
@@ -0,0 +1,526 @@
+//=//////////////////////////////////////////////////////////////////////
+//=
+//= camera                
+//=
+//= @file        camera.h
+//= @desc        Header file
+//= @author      J C Gonzalez
+//= @email       gonzalez@mppmu.mpg.de
+//= @date        Thu May  7 16:24:22 1998
+//=
+//=----------------------------------------------------------------------
+//=
+//= Created: Thu May  7 16:24:22 1998
+//= Author:  Jose Carlos Gonzalez
+//= Purpose: Program for reflector simulation
+//= Notes:   See files README for details
+//=    
+//=----------------------------------------------------------------------
+//=
+//= $RCSfile: timecam.h,v $
+//= $Revision: 1.1.1.1 $
+//= $Author: harald $ 
+//= $Date: 2000-02-08 15:13:44 $
+//=
+//=//////////////////////////////////////////////////////////////////////
+
+// @T \newpage
+
+//!@section Source code of |camera.h|.
+
+/*!@"
+
+  This section shows the include file |camera.h|
+
+  @"*/
+
+//=-----------------------------------------------------------
+//!@subsection Include files.
+
+//!@{
+
+#include <iostream.h>
+#include <fstream.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdarg.h>
+#include <math.h>
+#include <sys/types.h>
+#include <dirent.h>
+#include <unistd.h>
+#include <libgen.h>
+
+#include "timecam-v.h"
+
+#include "jcmacros.h"
+#include "jcdebug.h"
+
+#include "creadparam.h"
+#include "atm.h"
+
+#include "lagrange.h"
+
+#include "MCEventHeader.hxx"
+#include "MCCphoton.hxx"
+
+// command line options available
+
+#define COMMAND_LINE_OPTIONS    "f:h"
+
+/*@'
+
+  This is C++, but RANLIB routines are written in pure ANSI C.
+  In order to read easily these routines, we must include
+  the following directive
+  
+*/
+
+extern "C" { 
+#include "ranlib.h"       
+}
+
+// version of the reflector program that can read
+
+#define REFL_PROGRAM reflector
+#define REFL_VERSION 0.3
+
+const char REFL_SIGNATURE[] = GLUE_postp( REFL_PROGRAM, REFL_VERSION );
+
+//!@}
+
+//=------------------------------------------------------------
+//!@subsection Macro-definitions, and constants.
+
+//!@{
+#define SIN60   0.866025403784439
+#define COS60   0.500000000000000
+
+#define RandomNumber  drand48()
+
+#define PIX_ARRAY_SIDE       40
+#define PIX_ARRAY_HALF_SIDE  20
+#define PIXNUM               0
+#define PIXX                 1
+#define PIXY                 2
+
+#define iMAXNUMPIX  595 // total maximum possible number of pixels in the camera
+
+//@ the trigger threshold up to which the maximum passable threshold is tested 
+#define iMAX_THRESHOLD_PHE   50 
+
+//@ number of the 1st. pixel of a sector s in a ring r (central pixel: ring=0)
+#define FIRST_PIXEL(r,s)   ( ((r)>0) ? (3*(r)*((r)-1) + (r)*(s) + 1) : 0 )
+
+//@ number of the pixels include in a camera of r pixels
+#define NUMBER_PIXELS(r)   ( ((r)>0) ? FIRST_PIXEL((r)+1,0) : 1 )
+
+//@ now we define the list CT_ITEM_LIST of possible items in the CT def. file
+#define CT_ITEM_LIST  /* LIST OF ITEMS IN THE CT DEFINITION FILE */  \
+T(type),              /* type of definition file */                  \
+T(focal_distance),    /* std(focal distance) */                      \
+T(focal_std),         /* focal distance */                           \
+T(point_spread),      /* std(point spread)   */                      \
+T(point_std),         /* point spread   */                           \
+T(adjustment_dev),    /* std of adjustment deviation   */            \
+T(black_spot),        /* radius of the black spot in center of mirror */ \
+T(n_mirrors),         /* number of mirrors */                        \
+T(r_mirror),          /* radius of one mirror */                     \
+T(camera_width),      /* camera width */                             \
+T(n_pixels),          /* total number of pixels in the camera */     \
+T(n_centralpixels),   /* number of central pixels in the camera */   \
+T(n_gappixels),       /* number of gap pixels in the camera */       \
+T(pixel_width),       /* pixel width */                              \
+T(define_mirrors)     /* this entry is followed by the def. of pixels */
+  
+#define T(x)  x               //@< define T() as the name as it is
+
+enum CT_ITEM_TYPE {
+  CT_ITEM_LIST
+};
+
+#undef T
+
+#define T(x)  #x              //@< define T() as the string of x
+
+const char *const CT_ITEM_NAMES[] = {
+  CT_ITEM_LIST
+};
+
+#undef T
+
+
+// TYPE=0  (CT1)
+//     i   s   rho   theta   x   y   z   thetan  phin  xn   yn   zn
+//
+//      i : number of the mirror
+//      s : arc length [cm]
+//    rho : polar rho of the position of the center of the mirror [cm]
+//  theta : polar angle of the position of the center of the mirror [cm]
+//      x : x coordinate of the center of the mirror [cm]
+//      y : y coordinate of the center of the mirror [cm]
+//      z : z coordinate of the center of the mirror [cm]
+// thetan : polar theta angle of the direction where the mirror points to
+//   phin : polar phi angle of the direction where the mirror points to
+//     xn : xn coordinate of the normal vector in the center (normalized)
+//     yn : yn coordinate of the normal vector in the center (normalized)
+//     zn : zn coordinate of the normal vector in the center (normalized)
+//
+// TYPE=1  (MAGIC)
+//     i  f   sx   sy   x   y   z   thetan  phin 
+//
+//      i : number of the mirror
+//      f : focal distance of that mirror
+//     sx : curvilinear coordinate of mirror's center in X[cm]
+//     sy : curvilinear coordinate of mirror's center in X[cm]
+//      x : x coordinate of the center of the mirror [cm]
+//      y : y coordinate of the center of the mirror [cm]
+//      z : z coordinate of the center of the mirror [cm]
+// thetan : polar theta angle of the direction where the mirror points to
+//   phin : polar phi angle of the direction where the mirror points to
+//     xn : xn coordinate of the normal vector in the center (normalized)
+//     yn : yn coordinate of the normal vector in the center (normalized)
+//     zn : zn coordinate of the normal vector in the center (normalized)
+
+#define CT_I       0
+
+#define CT_S       1
+#define CT_RHO     2
+#define CT_THETA   3
+
+#define CT_FOCAL   1
+#define CT_SX      2
+#define CT_SY      3
+
+#define CT_X       4
+#define CT_Y       5
+#define CT_Z       6
+#define CT_THETAN  7
+#define CT_PHIN    8
+#define CT_XN      9
+#define CT_YN     10
+#define CT_ZN     11
+
+#define CT_NDATA  12
+ 
+//!@}
+
+//=------------------------------------------------------------
+//!@subsection data types
+
+struct camera { /* camera parameters for imaging */
+  int inumpixels;
+  int inumcentralpixels;
+  int inumgappixels;
+  int inumbigpixels;
+  double dpixdiameter_cm; /* diameter of the central and gap pixels in centimeters */
+  double dpixsizefactor[iMAXNUMPIX]; /* size of the pixel relative to  dpixdiameter_deg */
+  double dxc[iMAXNUMPIX]; /* Pixel coordinates in camera coordinate system (x points from pixel 1 to 2). */
+  double dyc[iMAXNUMPIX]; /* The numbering of the pixels in these arrays starts at 0! */
+  double dxpointcorr_deg; /* correction of the pixel coordinates; to be added to dxc[] to get correct value */
+  double dypointcorr_deg; /* correction of the pixel coordinates; to be added to dxc[] to get correct value */
+  double di[iMAXNUMPIX]; /* i coordinate in JCs bi-axis hexagonal coordinate system */
+  double dj[iMAXNUMPIX]; /* j coordinate in JCs bi-axis hexagonal coordinate system */
+ 
+};
+
+
+//=------------------------------------------------------------
+//!@subsection Pre-defined file names.
+
+//!@{
+
+#define QE_FILE     "../Data/qe.dat"
+
+//!@}
+
+//=------------------------------------------------------------
+//!@subsection Prototypes of functions.
+
+//!@{
+
+//++
+// prototypes
+//--
+
+#define ONoff(x)  ((x==TRUE) ? "[ ON ]" : "[ off]")
+
+// Under Linux, the nint function does not exist, so we have to define it.
+#define nint(x)  ((int)floor((x)+0.5))
+
+void present(void);
+void usage(void);
+void clean(void);
+void log(const char *funct, char *fmt, ...);
+void error(const char *funct, char *fmt, ...);
+int isA( char * s1, const char * flag );
+void read_ct_file(void);
+int igen_pixel_coordinates(struct camera *cam);
+void read_pixels(struct camera *cam); 
+int pixels_are_neig(int pix1, int pix2);
+int bpoint_is_in_pix(double dx, double dy, int ipixnum, struct camera *pcam); 
+float  dist_r_P(float a, float b, float c, 
+                float l, float m, float n,
+                float x, float y, float z);
+     
+//!@}
+
+//=------------------------------------------------------------
+//!@subsection Log of this file.
+
+//!@{
+
+/*
+ *$Log: not supported by cvs2svn $
+ *Revision 1.3  1999/11/11 20:29:29  harald
+ *Small changes to run the new version on a linux machine.
+ *
+ *Revision 1.2  1999/11/10 07:42:41  harald
+ *Small change to read the right data files in.
+ *
+ *Revision 1.1.1.1  1999/11/05 11:59:31  harald
+ *This the starting point for CVS controlled further developments of the
+ *camera program. The program was originally written by Jose Carlos. 
+ *But here you can find a "rootified" version to the program. This means 
+ *that there is no hbook stuff in it now. Also the output of the
+ *program changed to the MagicRawDataFormat. 
+ *
+ *The "rootification" was done by Dirk Petry and Harald Kornmayer. 
+ *
+ *In the following you can see the README file of that version:
+ *
+ *==================================================
+ *
+ *Fri Oct 22  1999   D.P.
+ *
+ *The MAGIC Monte Carlo System
+ *
+ *Camera Simulation Programme
+ *---------------------------
+ *
+ *1) Description
+ *
+ *This version is the result of the fusion of H.K.'s
+ *root_camera which is described below (section 2)
+ *and another version by D.P. which had a few additional
+ *useful features.
+ *
+ *The version compiles under Linux with ROOT 2.22 installed
+ *(variable ROOTSYS has to be set).
+ *
+ *Compile as before simply using "make" in the root_camera
+ *directory.
+ *
+ *All features of H.K.'s root_camera were retained.
+ *
+ *Additional features of this version are:
+ *
+ *  a) HBOOK is no longer used and all references are removed.
+ *
+ *  b) Instead of HBOOK, the user is given now the possibility of 
+ *     having Diagnostic data in ROOT format as a complement
+ *     to the ROOT Raw data.
+ *
+ *     This data is written to the file which is determined by
+ *     the new input parameter "diag_file" in the camera parameter
+ *     file.
+ *
+ *     All source code file belonging to this part have filenames
+ *     starting with "MDiag".
+ *
+ *     The user can read the output file using the following commands
+ *     in an interactive ROOT session:
+ *
+ *       	root [0] .L MDiag.so
+ *	root [1] new TFile("diag.root");
+ *	root [2] new TTreeViewer("T");
+ *	
+ *     This brings up a viewer from which all variables of the
+ *     TTree can be accessed and histogrammed. This example
+ *     assumes that you have named the file "diag.root", that
+ *     you are using ROOT version 2.22 or later and that you have
+ *     the shared object library "MDiag.so" which is produced
+ *     by the Makefile along with the executable "camera".
+ *       
+ * !   The contents of the so-called diag file is not yet fixed.
+ * !   At the moment it is what J.C.G. used to put into the HBOOK
+ * !   ntuple. In future versions the moments calculation can be
+ * !   removed and the parameter list be modified correspondingly.
+ *
+ *  c) Now concatenated reflector files can be read. This is useful
+ *     if you have run the reflector with different parameters but
+ *     you want to continue the analysis with all reflector data
+ *     going into ONE ROOT outputfile.
+ *
+ *     The previous camera version contained a bug which made reading 
+ *     of two or more concatenated reflector files impossible.
+ *
+ *  d) The reflector output format was changed. It is now version
+ *     0.4 .
+ *     The change solely consists in a shortening of the flag
+ *     definition in the file 
+ *
+ *           include-MC/MCCphoton.hxx  
+ *
+ * !   IF YOU WANT TO READ REFLECTOR FORMAT 0.3, you can easily
+ * !   do so by recompiling camera with the previous version of
+ * !   include-MC/MCCphoton.hxx.
+ *
+ *     The change was necessary for saving space and better
+ *     debugging. From now on, this format can be frozen.
+ *
+ * !   For producing reflector output in the new format, you
+ * !   of course have to recompile your reflector with the
+ * !   new include-MC/MCCphoton.hxx .
+ *
+ *  e) A first version of the pixelization with the larger
+ *     outer pixels is implemented. THIS IS NOT YET FULLY
+ *     TESTED, but first rough tests show that it works
+ *     at least to a good approximation.
+ *
+ *     The present version implements the camera outline
+ *     with 18 "gap-pixels" and 595 pixels in total as
+ *     shown in 
+ *
+ *        http://sarastro.ifae.es/internal/home/hardware/camera/numbering.ps
+ *
+ *     This change involved 
+ *
+ *	(i) The file pixels.dat is no longer needed. Instead
+ *          the coordinates are generated by the program itself
+ *          (takes maybe 1 second). In the file 
+ *
+ *		pixel-coords.txt
+ *
+ *	  in the same directory as this README, you find a list
+ *          of the coordinates generated by this new routine. It
+ *          has the format
+ *
+ *              number   i   j   x  y  size-factor
+ *
+ *          where i and j are J.C.G.'s so called biaxis hexagonal
+ *          coordinates (for internal use) and x and y are the
+ *          coordinates of the pixel centers in the standard camera
+ *          coordinate system in units of centimeters. The value
+ *          of "size-factor" determines the linear size of the pixel
+ *          relative to the central pixels. 
+ *
+ *        (ii) The magic.def file has two additional parameters
+ *          which give the number of central pixels and the
+ *          number of gap pixels
+ *
+ *        (iii) In camera.h and camera.cxx several changes were 
+ *          necessary, among them the introduction of several
+ *          new functions 
+ *
+ *     The newly suggested outline with asymmetric Winston cones
+ *     will be implemented in a later version.
+ *
+ *  f) phe files can no longer be read since this contradicts
+ *     our philosophy that the analysis should be done with other
+ *     programs like e.g. EVITA and not with "camera" itself.
+ *     This possibility was removed. 
+ *
+ *  g) ROOT is no longer invoked with an interactive interface.
+ *     In this way, camera can better be run as a batch program and
+ *     it uses less memory.
+ *
+ *  h) small changes concerning the variable "t_chan" were necessary in
+ *     order to avoid segmentation faults: The variable is used as an
+ *     index and it went sometimes outside the limits when camera
+ *     was reading proton data. This is because the reflector files
+ *     don't contain the photons in a chronological order and also
+ *     the timespread can be considerably longer that the foreseen
+ *     digitisation timespan. Please see the source code of camera.cxx
+ *     round about line 1090.
+ *
+ *  j) several unused variables were removed, a few warning messages
+ *     occur when you compile camera.cxx but these can be ignored at
+ *     the moment.
+ *
+ *In general the program is of course not finished. It still needs
+ *debugging, proper trigger simulation, simulation of the asymmetric
+ *version of the outer pixels, proper NSB simulation, adaption of
+ *the diag "ntuple" contents to our need and others small improvements.
+ *
+ *In the directory rfl-files there is now a file in reflector format 0.4
+ *containing a single event produced by the starfiled adder. It has
+ *a duration of 30 ns and represents the region around the Crab Nebula.
+ *Using the enclosed input parameter file, camera should process this
+ *file without problems.
+ *
+ *2) The README for the previous version of root_camera
+ *
+ *README for a preliminary version of the 
+ *root_camera program. 
+ *
+ *root_camera is based on the program "camera"of Jose Carlos
+ *Gonzalez. It was changed in the way that only the pixelisation 
+ *and the distibution of the phe to the FADCs works in a 
+ *first version. 
+ *
+ *Using the #undef command most possibilities of the orignal 
+ *program are switched of. 
+ *
+ *The new parts are signed by 
+ *
+ *- ROOT or __ROOT__ 
+ *  nearly all  important codelines for ROOT output are enclosed 
+ *  in structures like 
+ *  #ifdef __ROOT__ 
+ *  
+ *    code 
+ *
+ *  #endif __ROOT__ 
+ *
+ *  In same case the new lines are signed by a comment with the word 
+ *  ROOT in it. 
+ *
+ *  For timing of the pulse some variable names are changed. 
+ *  (t0, t1, t  -->  t_ini, t_fin, t_1st, t_chan,...) 
+ *  Look also for this changes. 
+ *
+ *  For the new root-file is also a change in readparm-files
+ *
+ *
+ *- __DETAIL_TRIGGER__
+ *
+ *  This is for the implementation of the current work on trigger 
+ *  studies. Because the class MTrigger is not well documented it 
+ *  isn´t a part of this tar file. Only a dummy File exists. 
+ *
+ *
+ *
+ *With all files in the archive, the root_camera program should run. 
+ *
+ *A reflector file is in the directory rfl-files
+ *
+ *==================================================
+ *
+ *From now on, use CVS for development!!!!
+ *
+ *
+ *
+ *Revision 1.3  1999/10/22 15:32:56  petry
+ *tidied-up version, really sent to H.K. and N.M., 22-10-99
+ *
+ *Revision 1.2  1999/10/22 15:01:28  petry
+ *version sent to H.K. and N.M. on Fri Oct 22 1999
+ *
+ *Revision 1.1.1.1  1999/10/21 16:35:10  petry
+ *first synthesised version
+ *
+ * Revision 1.8  1999/03/15  14:59:06  gonzalez
+ * camera-1_1
+ *
+ * Revision 1.7  1999/03/02  09:56:11  gonzalez
+ * *** empty log message ***
+ *
+ * Revision 1.6  1999/01/14  17:32:40  gonzalez
+ * Added to camera the STDIN input option (data_from_input)
+ *
+ */
+
+//!@}
+//=EOF
+
