Index: trunk/MagicSoft/Simulation/Detector/ReflectorII/Changelog
===================================================================
--- trunk/MagicSoft/Simulation/Detector/ReflectorII/Changelog	(revision 1722)
+++ trunk/MagicSoft/Simulation/Detector/ReflectorII/Changelog	(revision 1725)
@@ -1,3 +1,8 @@
 ** Add changes at the beginning! **
+
+22/01/2003 A. Moralejo
+
+Fixed small bug in reflector.c. The end of run flag was not written to the
+output when the max_events option was used in the input card.
 
 21/01/2003 A. Moralejo
Index: trunk/MagicSoft/Simulation/Detector/ReflectorII/reflector.c
===================================================================
--- trunk/MagicSoft/Simulation/Detector/ReflectorII/reflector.c	(revision 1722)
+++ trunk/MagicSoft/Simulation/Detector/ReflectorII/reflector.c	(revision 1725)
@@ -75,6 +75,11 @@
 
     /*	Processing loop	*/
-    while(event < max_Events && GetEvent())
+    while(GetEvent())
       {
+	if (event >= max_Events)
+	  {
+	    fwrite(FLAG_END_OF_RUN, SIZE_OF_FLAGS, 1, rflfile);
+	    break;
+	  }
 	if (ProcessEvent(cheadp, cerfile, rflfile)) 
 	  event++;
