Index: trunk/MagicSoft/Simulation/Corsika/Simone/simone.cxx
===================================================================
--- trunk/MagicSoft/Simulation/Corsika/Simone/simone.cxx	(revision 721)
+++ trunk/MagicSoft/Simulation/Corsika/Simone/simone.cxx	(revision 722)
@@ -25,4 +25,5 @@
   
   Int_t iPhotonInShower ; 
+  Int_t iShowers = 0 ; 
   
   Float_t lambda ; 
@@ -69,59 +70,66 @@
   //   same sice than the EventHeader
   Event.read( cerfile ); 
-
+  Event.Print() ; 
   //    now we read in the event 
-  
-  Event.read( cerfile );
-  
-  Event.Print() ; 
-  
-  //
-  //   loop over the particles (cerenkov photons) in 
-  //   the file 
-  //
-  
-  iPhotonInShower = 0 ; 
   
   while( ! (cerfile.eof() || cerfile.bad() )) {
     
-    cout << "   testit " ; 
+    Event.read( cerfile );
+  
+    Event.Print() ; 
+    
+    iShowers++ ; 
+
     //
-    //   read in the particles
+    //   loop over the particles (cerenkov photons) in 
+    //   the file 
     //
     
-    Photon.read ( cerfile ) ; 
+    iPhotonInShower = 0 ; 
     
-    //
-    //   only if the wavelength lambda is greater than 
-    //   1.0 it is a real cerenkov photon 
-    //
-    lambda = Photon.get_wl() ; 
+    while( ! (cerfile.eof() || cerfile.bad() )) {
 
-    Photon.print() ; 
+      //
+      //   read in the particles
+      //
+      
+      Photon.read ( cerfile ) ; 
+      
+      //
+      //   only if the wavelength lambda is greater than 
+      //   1.0 it is a real cerenkov photon 
+      //
+      lambda = Photon.get_wl() ; 
+      
+      //      Photon.print() ; 
+      
+      if ( lambda < 1.0 ) { 
+	// here we got to the next event reading in all the ZERO 
+	// from the file 
+	while ( lambda < 1. && ! (cerfile.eof() || cerfile.bad() ) ) { 
+	  
+	  Photon.read ( cerfile ) ; 
+	  lambda = Photon.get_wl() ;	
+	  //	  cout << lambda << endl ; 
+	} 
+	
+	//	go back in the file
+	cerfile.seekg( -28, ios::cur  ) ; 
+	
+	//  read in an Event footer or something like that
+	Event.read( cerfile );
+	
+	break ; 
+      } 
+      
+      iPhotonInShower++ ; 
+      
+    }
     
-    if ( lambda < 1.0 ) { 
-      // here we got to the next event reading in all the ZERO 
-      // from the file 
-      while ( lambda < 1.) { 
-	Photon.read ( cerfile ) ; 
-	lambda = Photon.get_wl() ;	
-      } 
+    cout << "Number of Photons In Shower: " 
+	 <<  iPhotonInShower << endl ; 
+    
+	
 
-      //      sprintf (" size of Photon: %d \n", (int) sizeof( CORParticle )) ; 
-      fseek ( cerfile, -sizeof(CORParticle), SEEK_CUR(1) ); 
-
-      cout << sizeof ( CORParticle ) ;
-      cout << sizeof ( int ) ; 
-
-      break ; 
-      
-      
-      
-      
-    } 
-    
-    
-    iPhotonInShower++ ; 
-    
   }
   
@@ -130,7 +138,5 @@
   //
   
-  cerfile.close();
-  
-  
+  cerfile.close();  
   
 }
