Index: trunk/MagicSoft/Simulation/Detector/Reflector/Makefile
===================================================================
--- trunk/MagicSoft/Simulation/Detector/Reflector/Makefile	(revision 347)
+++ trunk/MagicSoft/Simulation/Detector/Reflector/Makefile	(revision 348)
@@ -19,7 +19,7 @@
 #
 # $RCSfile: Makefile,v $
-# $Revision: 1.3 $
+# $Revision: 1.4 $
 # $Author: harald $ 
-# $Date: 1999-11-11 20:29:30 $
+# $Date: 2000-01-28 09:19:54 $
 #
 ##################################################################
@@ -180,123 +180,72 @@
 ../include-CORSIKA/COREventHeader.o: ../include-CORSIKA/COREventHeader.hxx
 ../include-CORSIKA/COREventHeader.o: /usr/include/stdlib.h
-../include-CORSIKA/COREventHeader.o: /usr/include/features.h
-../include-CORSIKA/COREventHeader.o: /usr/include/sys/cdefs.h
-../include-CORSIKA/COREventHeader.o: /usr/include/gnu/stubs.h
-../include-CORSIKA/COREventHeader.o: /usr/lib/gcc-lib/i486-linux/2.7.2.3/include/stddef.h
+../include-CORSIKA/COREventHeader.o: /usr/include/standards.h
+../include-CORSIKA/COREventHeader.o: /usr/include/getopt.h
 ../include-CORSIKA/COREventHeader.o: /usr/include/sys/types.h
-../include-CORSIKA/COREventHeader.o: /usr/include/gnu/types.h
-../include-CORSIKA/COREventHeader.o: /usr/include/time.h
-../include-CORSIKA/COREventHeader.o: /usr/include/endian.h
-../include-CORSIKA/COREventHeader.o: /usr/include/bytesex.h
+../include-CORSIKA/COREventHeader.o: /usr/include/mach/machine/vm_types.h
 ../include-CORSIKA/COREventHeader.o: /usr/include/sys/select.h
-../include-CORSIKA/COREventHeader.o: /usr/include/selectbits.h
-../include-CORSIKA/COREventHeader.o: /usr/include/alloca.h
 ../include-CORSIKA/COREventHeader.o: /usr/include/math.h
-../include-CORSIKA/COREventHeader.o: /usr/include/huge_val.h
-../include-CORSIKA/COREventHeader.o: /usr/include/mathcalls.h
-../include-CORSIKA/COREventHeader.o: /usr/lib/gcc-lib/i486-linux/2.7.2.3/include/float.h
 ../include-CORSIKA/CORParticle.o: ../include-CORSIKA/CORParticle.hxx
 ../include-CORSIKA/CORParticle.o: /usr/include/stdlib.h
-../include-CORSIKA/CORParticle.o: /usr/include/features.h
-../include-CORSIKA/CORParticle.o: /usr/include/sys/cdefs.h
-../include-CORSIKA/CORParticle.o: /usr/include/gnu/stubs.h
-../include-CORSIKA/CORParticle.o: /usr/lib/gcc-lib/i486-linux/2.7.2.3/include/stddef.h
+../include-CORSIKA/CORParticle.o: /usr/include/standards.h
+../include-CORSIKA/CORParticle.o: /usr/include/getopt.h
 ../include-CORSIKA/CORParticle.o: /usr/include/sys/types.h
-../include-CORSIKA/CORParticle.o: /usr/include/gnu/types.h
-../include-CORSIKA/CORParticle.o: /usr/include/time.h /usr/include/endian.h
-../include-CORSIKA/CORParticle.o: /usr/include/bytesex.h
+../include-CORSIKA/CORParticle.o: /usr/include/mach/machine/vm_types.h
 ../include-CORSIKA/CORParticle.o: /usr/include/sys/select.h
-../include-CORSIKA/CORParticle.o: /usr/include/selectbits.h
-../include-CORSIKA/CORParticle.o: /usr/include/alloca.h /usr/include/math.h
-../include-CORSIKA/CORParticle.o: /usr/include/huge_val.h
-../include-CORSIKA/CORParticle.o: /usr/include/mathcalls.h
-../include-CORSIKA/CORParticle.o: /usr/lib/gcc-lib/i486-linux/2.7.2.3/include/float.h
+../include-CORSIKA/CORParticle.o: /usr/include/math.h
 ../include-CORSIKA/CORStatfile.o: ../include-CORSIKA/CORStatfile.hxx
 ../include-CORSIKA/CORStatfile.o: /usr/include/stdlib.h
-../include-CORSIKA/CORStatfile.o: /usr/include/features.h
-../include-CORSIKA/CORStatfile.o: /usr/include/sys/cdefs.h
-../include-CORSIKA/CORStatfile.o: /usr/include/gnu/stubs.h
-../include-CORSIKA/CORStatfile.o: /usr/lib/gcc-lib/i486-linux/2.7.2.3/include/stddef.h
+../include-CORSIKA/CORStatfile.o: /usr/include/standards.h
+../include-CORSIKA/CORStatfile.o: /usr/include/getopt.h
 ../include-CORSIKA/CORStatfile.o: /usr/include/sys/types.h
-../include-CORSIKA/CORStatfile.o: /usr/include/gnu/types.h
-../include-CORSIKA/CORStatfile.o: /usr/include/time.h /usr/include/endian.h
-../include-CORSIKA/CORStatfile.o: /usr/include/bytesex.h
+../include-CORSIKA/CORStatfile.o: /usr/include/mach/machine/vm_types.h
 ../include-CORSIKA/CORStatfile.o: /usr/include/sys/select.h
-../include-CORSIKA/CORStatfile.o: /usr/include/selectbits.h
-../include-CORSIKA/CORStatfile.o: /usr/include/alloca.h /usr/include/math.h
-../include-CORSIKA/CORStatfile.o: /usr/include/huge_val.h
-../include-CORSIKA/CORStatfile.o: /usr/include/mathcalls.h
-../include-CORSIKA/CORStatfile.o: /usr/lib/gcc-lib/i486-linux/2.7.2.3/include/float.h
+../include-CORSIKA/CORStatfile.o: /usr/include/math.h
 ../include-MC/MCEventHeader.o: ../include-MC/MCEventHeader.hxx
-../include-MC/MCEventHeader.o: /usr/include/stdlib.h /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/include/sys/types.h
-../include-MC/MCEventHeader.o: /usr/include/gnu/types.h /usr/include/time.h
-../include-MC/MCEventHeader.o: /usr/include/endian.h /usr/include/bytesex.h
-../include-MC/MCEventHeader.o: /usr/include/sys/select.h
-../include-MC/MCEventHeader.o: /usr/include/selectbits.h
-../include-MC/MCEventHeader.o: /usr/include/alloca.h /usr/include/math.h
-../include-MC/MCEventHeader.o: /usr/include/huge_val.h
-../include-MC/MCEventHeader.o: /usr/include/mathcalls.h
-../include-MC/MCEventHeader.o: /usr/lib/gcc-lib/i486-linux/2.7.2.3/include/float.h
+../include-MC/MCEventHeader.o: /usr/include/stdlib.h /usr/include/standards.h
+../include-MC/MCEventHeader.o: /usr/include/getopt.h /usr/include/sys/types.h
+../include-MC/MCEventHeader.o: /usr/include/mach/machine/vm_types.h
+../include-MC/MCEventHeader.o: /usr/include/sys/select.h /usr/include/math.h
 ../include-MC/MCEventHeader.o: ../include-CORSIKA/COREventHeader.hxx
 ../include-MC/MCCphoton.o: ../include-MC/MCCphoton.hxx /usr/include/stdlib.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/include/sys/types.h /usr/include/gnu/types.h
-../include-MC/MCCphoton.o: /usr/include/time.h /usr/include/endian.h
-../include-MC/MCCphoton.o: /usr/include/bytesex.h /usr/include/sys/select.h
-../include-MC/MCCphoton.o: /usr/include/selectbits.h /usr/include/alloca.h
-../include-MC/MCCphoton.o: /usr/include/string.h /usr/include/math.h
-../include-MC/MCCphoton.o: /usr/include/huge_val.h /usr/include/mathcalls.h
-../include-MC/MCCphoton.o: /usr/lib/gcc-lib/i486-linux/2.7.2.3/include/float.h
-atm.o: atm.h /usr/include/stdlib.h /usr/include/features.h
-atm.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
-atm.o: /usr/lib/gcc-lib/i486-linux/2.7.2.3/include/stddef.h
-atm.o: /usr/include/sys/types.h /usr/include/gnu/types.h /usr/include/time.h
-atm.o: /usr/include/endian.h /usr/include/bytesex.h /usr/include/sys/select.h
-atm.o: /usr/include/selectbits.h /usr/include/alloca.h /usr/include/stdio.h
-atm.o: /usr/include/libio.h /usr/include/_G_config.h
-atm.o: /usr/lib/gcc-lib/i486-linux/2.7.2.3/include/stdarg.h
-atm.o: /usr/include/stdio_lim.h /usr/include/string.h /usr/include/math.h
-atm.o: /usr/include/huge_val.h /usr/include/mathcalls.h
-atm.o: /usr/lib/gcc-lib/i486-linux/2.7.2.3/include/float.h reflector-v.h
-readparam.o: readparam.h /usr/include/stdlib.h /usr/include/features.h
-readparam.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
-readparam.o: /usr/lib/gcc-lib/i486-linux/2.7.2.3/include/stddef.h
-readparam.o: /usr/include/sys/types.h /usr/include/gnu/types.h
-readparam.o: /usr/include/time.h /usr/include/endian.h /usr/include/bytesex.h
-readparam.o: /usr/include/sys/select.h /usr/include/selectbits.h
-readparam.o: /usr/include/alloca.h /usr/include/stdio.h /usr/include/libio.h
-readparam.o: /usr/include/_G_config.h
-readparam.o: /usr/lib/gcc-lib/i486-linux/2.7.2.3/include/stdarg.h
-readparam.o: /usr/include/stdio_lim.h /usr/include/string.h
-readparam.o: /usr/include/math.h /usr/include/huge_val.h
-readparam.o: /usr/include/mathcalls.h
-readparam.o: /usr/lib/gcc-lib/i486-linux/2.7.2.3/include/float.h
-readparam.o: /usr/include/unistd.h /usr/include/posix_opt.h
-readparam.o: /usr/include/confname.h reflector-v.h atm.h
-reflector.o: reflector.h /usr/include/stdlib.h /usr/include/features.h
-reflector.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
-reflector.o: /usr/lib/gcc-lib/i486-linux/2.7.2.3/include/stddef.h
-reflector.o: /usr/include/sys/types.h /usr/include/gnu/types.h
-reflector.o: /usr/include/time.h /usr/include/endian.h /usr/include/bytesex.h
-reflector.o: /usr/include/sys/select.h /usr/include/selectbits.h
-reflector.o: /usr/include/alloca.h /usr/include/stdio.h /usr/include/libio.h
-reflector.o: /usr/include/_G_config.h
-reflector.o: /usr/lib/gcc-lib/i486-linux/2.7.2.3/include/stdarg.h
-reflector.o: /usr/include/stdio_lim.h /usr/include/string.h
-reflector.o: /usr/include/math.h /usr/include/huge_val.h
-reflector.o: /usr/include/mathcalls.h
-reflector.o: /usr/lib/gcc-lib/i486-linux/2.7.2.3/include/float.h
-reflector.o: /usr/include/dirent.h /usr/include/direntry.h
-reflector.o: /usr/include/posix1_lim.h /usr/include/local_lim.h
-reflector.o: /usr/include/linux/limits.h /usr/include/unistd.h
-reflector.o: /usr/include/posix_opt.h /usr/include/confname.h reflector-v.h
-reflector.o: readparam.h atm.h ../include-CORSIKA/COREventHeader.hxx
+../include-MC/MCCphoton.o: /usr/include/standards.h /usr/include/getopt.h
+../include-MC/MCCphoton.o: /usr/include/sys/types.h
+../include-MC/MCCphoton.o: /usr/include/mach/machine/vm_types.h
+../include-MC/MCCphoton.o: /usr/include/sys/select.h /usr/include/string.h
+../include-MC/MCCphoton.o: /usr/include/strings.h /usr/include/math.h
+atm.o: atm.h /usr/include/stdlib.h /usr/include/standards.h
+atm.o: /usr/include/getopt.h /usr/include/sys/types.h
+atm.o: /usr/include/mach/machine/vm_types.h /usr/include/sys/select.h
+atm.o: /usr/include/stdio.h /usr/include/sys/seek.h /usr/include/va_list.h
+atm.o: /usr/include/sys/limits.h /usr/include/sys/machine/machlimits.h
+atm.o: /usr/include/sys/syslimits.h /usr/include/sys/machine/machtime.h
+atm.o: /usr/include/sys/rt_limits.h /usr/include/string.h
+atm.o: /usr/include/strings.h /usr/include/math.h reflector-v.h
+readparam.o: readparam.h /usr/include/stdlib.h /usr/include/standards.h
+readparam.o: /usr/include/getopt.h /usr/include/sys/types.h
+readparam.o: /usr/include/mach/machine/vm_types.h /usr/include/sys/select.h
+readparam.o: /usr/include/stdio.h /usr/include/sys/seek.h
+readparam.o: /usr/include/va_list.h /usr/include/sys/limits.h
+readparam.o: /usr/include/sys/machine/machlimits.h
+readparam.o: /usr/include/sys/syslimits.h /usr/include/sys/machine/machtime.h
+readparam.o: /usr/include/sys/rt_limits.h /usr/include/string.h
+readparam.o: /usr/include/strings.h /usr/include/math.h /usr/include/float.h
+readparam.o: /usr/include/fp_class.h /usr/include/unistd.h
+readparam.o: /usr/include/sys/access.h reflector-v.h atm.h
+reflector.o: reflector.h /usr/include/stdlib.h /usr/include/standards.h
+reflector.o: /usr/include/getopt.h /usr/include/sys/types.h
+reflector.o: /usr/include/mach/machine/vm_types.h /usr/include/sys/select.h
+reflector.o: /usr/include/stdio.h /usr/include/sys/seek.h
+reflector.o: /usr/include/va_list.h /usr/include/sys/limits.h
+reflector.o: /usr/include/sys/machine/machlimits.h
+reflector.o: /usr/include/sys/syslimits.h /usr/include/sys/machine/machtime.h
+reflector.o: /usr/include/sys/rt_limits.h /usr/include/string.h
+reflector.o: /usr/include/strings.h /usr/include/stdarg.h /usr/include/math.h
+reflector.o: /usr/include/dirent.h /usr/include/unistd.h
+reflector.o: /usr/include/sys/access.h reflector-v.h readparam.h
+reflector.o: /usr/include/float.h /usr/include/fp_class.h atm.h
+reflector.o: ../include-CORSIKA/COREventHeader.hxx
 reflector.o: ../include-CORSIKA/CORParticle.hxx
 reflector.o: ../include-CORSIKA/CORStatfile.hxx
 reflector.o: ../include-MC/MCEventHeader.hxx ../include-MC/MCCphoton.hxx
+reflector.o: /usr/include/ranlib.h /usr/include/ar.h
Index: trunk/MagicSoft/Simulation/Detector/Reflector/param
===================================================================
--- trunk/MagicSoft/Simulation/Detector/Reflector/param	(revision 347)
+++ trunk/MagicSoft/Simulation/Detector/Reflector/param	(revision 348)
@@ -6,5 +6,5 @@
 # Sample parameters file
 #
-verbose_level 2
+verbose_level 1
 #
 #fixed_target  0. 0.
@@ -12,10 +12,10 @@
 #skip 1 2946
 #range_events 381 382
-#max_events   2
+max_events   10000
 #energy_cuts   800. 1000.
 #
 ct_file        ../Data/magic.def 
 #
-output_file   /data/reflect/test.rfl
+output_file   /hd02/Maggi/RefData/prot.rfl
 #
 atm_model     ATM_CORSIKA
@@ -23,5 +23,5 @@
 #
 data_paths 1
-/data/mmcs
+/hd02/Maggi/Data/mmcs_prod_14_2003_30:30000
 #
 #data_from_stdin
Index: trunk/MagicSoft/Simulation/Detector/Reflector/readparam.cxx
===================================================================
--- trunk/MagicSoft/Simulation/Detector/Reflector/readparam.cxx	(revision 347)
+++ trunk/MagicSoft/Simulation/Detector/Reflector/readparam.cxx	(revision 348)
@@ -19,7 +19,7 @@
 //=
 //= $RCSfile: readparam.cxx,v $
-//= $Revision: 1.1.1.1 $
+//= $Revision: 1.2 $
 //= $Author: harald $ 
-//= $Date: 1999-10-29 07:00:33 $
+//= $Date: 2000-01-28 09:19:54 $
 //=
 //=//////////////////////////////////////////////////////////////////////
@@ -120,4 +120,7 @@
 static int Data_To_STDOUT = FALSE;
 
+//@: number of times a shower is going to be processed
+static int nRepeat_Random = 1;
+
 //!@}
 
@@ -148,5 +151,5 @@
 // @desc  read parameters from the stdin / parameters file
 //
-// @var   *filename  Name of the parameters file (NULL->STDIN)
+// @var   *filename  Name of the parameters file (0->STDIN)
 //
 // @date Mon Sep 14 13:27:56 MET DST 1998
@@ -166,9 +169,9 @@
 
   // use cin or ifile (reading from STDIN or from parameters file?
-  if ( filename != NULL )
+  if ( filename != 0 )
     ifile.open( filename );
 
   // get signature
-  if ( filename != NULL )
+  if ( filename != 0 )
     ifile.getline(line, LINE_MAX_LENGTH);
   else
@@ -188,5 +191,5 @@
 
     // get line from file or stdin
-    if ( filename != NULL )
+    if ( filename != 0 )
       ifile.getline(line, LINE_MAX_LENGTH);
     else
@@ -233,5 +236,5 @@
       for (i=0; i<Num_of_paths; i++) {
 
-        if ( filename != NULL )
+        if ( filename != 0 )
           ifile.getline(Paths_list[i], PATH_MAX_LENGTH);
         else
@@ -358,5 +361,4 @@
       
       break;
-      
     
     case random_pointing:     // uses a random CT pointing for each shower
@@ -369,8 +371,16 @@
       cerr << "random_pointing: " << Random_Pointing_MaxDist << ' ';
       Random_Pointing_MaxDist = RAD(Random_Pointing_MaxDist);
-      cerr << Random_Pointing_MaxDist << " radians \n";
-
-      break;
-      
+      cerr << Random_Pointing_MaxDist << " radians \n" << flush;
+
+      break;
+      
+    case repeat_random:       // number of times a random pointing is to be done
+          
+      // set nRepeat_Random
+      sscanf(line, "%s %d", token, &nRepeat_Random);
+
+      cerr << "repeat_random: " << nRepeat_Random << '\n' << flush;
+
+      break;
     
     case block:               // analyzes data in blocks
@@ -410,5 +420,5 @@
   } // while (! is_end)
 
-  if ( filename != NULL ) {
+  if ( filename != 0 ) {
     ifile.close();
   }
@@ -821,4 +831,24 @@
 
 
+//!---------------------------------------------------------------------
+// @name get_repeat_random
+//       
+// @desc get number of times a random displacement is going to be done
+//
+// @return   number of times
+//
+// @date 
+//----------------------------------------------------------------------
+// @function
+
+//!@{ 
+int
+get_repeat_random(void)
+{
+  return ( nRepeat_Random );
+}
+//!@}
+
+
 //=------------------------------------------------------------
 //!@subsection Log of this file.
@@ -827,4 +857,7 @@
 //
 // $Log: not supported by cvs2svn $
+// Revision 1.14  2000/01/27  10:47:54  gonzalez
+// JAN2000-STABLE
+//
 // Revision 1.13  1999/10/05  11:06:38  gonzalez
 // Sep. 1999
Index: trunk/MagicSoft/Simulation/Detector/Reflector/readparam.h
===================================================================
--- trunk/MagicSoft/Simulation/Detector/Reflector/readparam.h	(revision 347)
+++ trunk/MagicSoft/Simulation/Detector/Reflector/readparam.h	(revision 348)
@@ -19,7 +19,7 @@
 //=
 //= $RCSfile: readparam.h,v $
-//= $Revision: 1.1.1.1 $
+//= $Revision: 1.2 $
 //= $Author: harald $ 
-//= $Date: 1999-10-29 07:00:33 $
+//= $Date: 2000-01-28 09:19:54 $
 //=
 //=//////////////////////////////////////////////////////////////////////
@@ -123,4 +123,5 @@
 T(block),           /* size of the block of files, when 'blocking' */ \
 T(random_pointing), /* random CT pointing from each shower (hadrons) */ \
+T(repeat_random),   /* number of times a random pointing is to be done */ \
 T(data_from_stdin), /* read data from STDIN */ \
 T(data_to_stdout),  /* read data from STDIN */ \
@@ -193,4 +194,5 @@
 int get_data_to_stdout(void);
 int get_random_pointing(float *maxdist);
+int get_repeat_random(void);
 
 //!@}
@@ -209,4 +211,7 @@
 /*
  * $Log: not supported by cvs2svn $
+ * Revision 1.14  2000/01/27  10:47:54  gonzalez
+ * JAN2000-STABLE
+ *
  * Revision 1.13  1999/10/05  11:06:37  gonzalez
  * Sep. 1999
Index: trunk/MagicSoft/Simulation/Detector/Reflector/reflector.cxx
===================================================================
--- trunk/MagicSoft/Simulation/Detector/Reflector/reflector.cxx	(revision 347)
+++ trunk/MagicSoft/Simulation/Detector/Reflector/reflector.cxx	(revision 348)
@@ -20,7 +20,7 @@
 //
 // $RCSfile: reflector.cxx,v $
-// $Revision: 1.8 $
+// $Revision: 1.9 $
 // $Author: harald $ 
-// $Date: 2000-01-28 08:59:49 $
+// $Date: 2000-01-28 09:19:54 $
 //
 ////////////////////////////////////////////////////////////////////////
@@ -795,4 +795,10 @@
 int Random_Pointing = FALSE;
 
+//@: number of times a shower is going to be processed
+int nRepeat_Random;
+
+//@: number of times a shower is already processed
+int nRepeated;
+
 //@: maximum random pointing distance
 float Random_Pointing_MaxDist; // [radians]
@@ -921,5 +927,5 @@
   parname[0] = '\0';
 
-  optarg = NULL;
+  optarg = 0;
   while ( !errflg && ((ch = getopt(argc, argv, COMMAND_LINE_OPTIONS)) != -1) )
     switch (ch) {
@@ -945,5 +951,5 @@
 
   if ( strlen(parname) < 1 )
-    readparam(NULL);
+    readparam(0);
   else
     readparam(parname);
@@ -1165,7 +1171,12 @@
     outputfile.write( SIGNATURE, sizeof(SIGNATURE) );
 
+  // get random pointing variables
+  
+  Random_Pointing = get_random_pointing( &Random_Pointing_MaxDist );
+
   // generate a sort of log information
 
   if ( verbose >= VERBOSE_MINIMAL ) {
+    log( SIGNATURE, "Random poi.:       %f\n", Random_Pointing_MaxDist );
     log( SIGNATURE, "Atmospheric model: %s\n", get_atm_mod() );
     log( SIGNATURE, "Number of paths:   %d\n", get_num_of_paths() );
@@ -1177,4 +1188,8 @@
 
   get_energy_cuts( &lE, &uE );
+
+  // get number of times which a shower is going to be used
+  // at different pointing directions
+  nRepeat_Random = get_repeat_random();   
 
   /*!@'
@@ -1202,5 +1217,5 @@
     directory = opendir(pathname);
 
-    if ( directory == NULL ) 
+    if ( directory == 0 ) 
       error( SIGNATURE, 
              "Cannot open directory %s\n", pathname );
@@ -1232,5 +1247,5 @@
         log(SIGNATURE, " * * * READING DATA FROM STDIN * * *\n");
 
-      get_stdin_files( 0, lE, uE, TRUE);
+      get_stdin_files(0, lE, uE, TRUE);
 
     }
@@ -1246,6 +1261,8 @@
     //            maximum number is not reached ) )
 
+    nRepeated = 0;
+
     while ( (
-             ((de = readdir( directory )) != NULL) &&
+             ((de = readdir( directory )) != 0) &&
              (num_cer_files < max_num_cer_files)
              )
@@ -1255,5 +1272,9 @@
              (num_cer_files < max_num_cer_files)
              ) ) {
-      
+	/*
+      // increment the number of times this files is used
+      nRepeated++;
+	*/
+
       // if Block > 0, then we wait till a file __DOIT is present
       
@@ -1440,5 +1461,5 @@
         
       mcevth.put_times ( stat.get_tfirst(), stat.get_tlast() );
-
+        
       // get direction where the CT is pointing to
       // (or, better, from when the shower is coming from)
@@ -1451,5 +1472,5 @@
 
       // do we want random pointing (around shower axis) ?
-      if ( get_random_pointing( &Random_Pointing_MaxDist ) == TRUE ) {
+      if ( Random_Pointing == TRUE ) {
 
         // we do, then get a random position
@@ -1986,10 +2007,11 @@
         // the photon actually hit the mirror!!
 
+        
         t = t + ((( xm[2] > 0. ) ? -1.0 : +1.0) *
                  sqrt( SQR(xm[0] - xcut[0]) +
                        SQR(xm[1] - xcut[1]) +
                        SQR(xm[2] - xcut[2]) ) / Speed_of_Light_air_cmns);
-
-	// add path from the mirror till the camera
+                 
+        // add path from the mirror till the camera
 
         t = t + sqrt( SQR(xcutCT[0] - xcam[0]) +
@@ -2212,5 +2234,5 @@
 
   delete [] ct_Focal;        
-  ct_Focal = NULL;
+  ct_Focal = 0;
 
   // delete reflectivity table
@@ -2221,5 +2243,5 @@
   
   delete [] Reflectivity;    
-  Reflectivity = NULL;
+  Reflectivity = 0;
 
   // delete mirrors' data table
@@ -2230,5 +2252,5 @@
   
   delete [] ct_data;
-  ct_data = NULL;
+  ct_data = 0;
 }
 //!@}
@@ -3492,37 +3514,41 @@
 {
   float distance;
-  float it, ip,Nit;
+  float it, ip;
   float sin_theta, cos_theta;
   float sin_newtheta, cos_newtheta;
   float sin_iphi, cos_iphi;
   float iphi;
-  float range_aux;
-  int i;
-
-  //Random position of the CT. It is the distance
-  //between shower axis and CT position and its  
-  //distribution follows sin(it).
-
-  range_aux=1.0-sin(M_PI/2-range);
-  Nit = RandomNumber * range_aux;
+
+  // for the moment, we only simulate an uniform distribution,
+  // since our theta distribution in the generation of events is
+  // already uniform for hadrons, which are the main targets for
+  // using this option
+
+  it = RandomNumber * range;
   ip = RandomNumber * 2.0 * M_PI;
-  it = M_PI/2-asin((1.0-Nit));
-
-  sin_theta = sin(theta);
-  cos_theta = cos(theta);
-
-  cos_newtheta = cos_theta*cos(it) - sin_theta*sin(it)*cos(ip);
-  *newtheta = acos( cos_newtheta );
-  sin_newtheta = sin( *newtheta );
-  
-  if(theta!=0){
-    sin_iphi = sin(it)*sin(ip)/sin_newtheta;
-    cos_iphi = ((cos(it)-cos_newtheta*cos_theta)/(sin_newtheta*sin_theta));
+
+  if ( theta == 0.0 ) {
+
+    *newtheta = it;
+    *newphi = ip;
+
+  } else {
+    
+    sin_theta = sin(theta);
+    cos_theta = cos(theta);
+
+    cos_newtheta = cos_theta*cos(it) + sin_theta*sin(it)*cos(ip);
+    *newtheta = acos( cos_newtheta );
+    sin_newtheta = sin( *newtheta );
+    
+    sin_iphi = sin(it)*sin(ip) / sin_newtheta;
+    cos_iphi = (( cos(it) - cos_newtheta * cos_theta ) /
+                ( sin_newtheta * sin_theta ));
     
     iphi = atan2( sin_iphi, cos_iphi );
+    
+    *newphi = phi + iphi;
+
   }
-  else iphi=ip;
-
-  *newphi = phi + iphi;
 
   return( it );
@@ -3536,19 +3562,10 @@
 //!@{
 //
-// Revision 1.3  2000/01/03 12:41:26  harald
-// There was a small mistake with +/- signs in the prevois versions. This
-// line was founded by Jose Carlos. His remark is following:
-//
-// Look for the comment I include here in this block: you will see that
-// now the following expression has a +- sign, where before it was only
-// + (or -, I don't remember, but only one)
-//
-// Revision 1.2  1999/11/01 11:05:54  harald
-// Small changes to comile the reflector program under linux.
-// (Different use of NULL on DECalphas-osf1 and on linux)
-//
-// Revision 1.1.1.1  1999/10/29  07:00:33  harald
-// This is the startpoint for the futher development of the Reflector program
-// of Jose Carlos. For all developments use this CVS-controlled directory.
+// $Log: not supported by cvs2svn $
+// Revision 1.20  2000/01/27  10:47:54  gonzalez
+// JAN2000-STABLE
+//
+// Revision 1.19  1999/11/19  20:52:31  gonzalez
+// *** empty log message ***
 //
 // Revision 1.18  1999/10/05  11:11:12  gonzalez
Index: trunk/MagicSoft/Simulation/Detector/Reflector/reflector.h
===================================================================
--- trunk/MagicSoft/Simulation/Detector/Reflector/reflector.h	(revision 347)
+++ trunk/MagicSoft/Simulation/Detector/Reflector/reflector.h	(revision 348)
@@ -19,7 +19,7 @@
 //=
 //= $RCSfile: reflector.h,v $
-//= $Revision: 1.1.1.1 $
+//= $Revision: 1.2 $
 //= $Author: harald $ 
-//= $Date: 1999-10-29 07:00:34 $
+//= $Date: 2000-01-28 09:19:54 $
 //=
 //=//////////////////////////////////////////////////////////////////////
