Index: trunk/MagicSoft/Simulation/Corsika/Simone/simone.cxx
===================================================================
--- trunk/MagicSoft/Simulation/Corsika/Simone/simone.cxx	(revision 688)
+++ trunk/MagicSoft/Simulation/Corsika/Simone/simone.cxx	(revision 721)
@@ -6,4 +6,5 @@
 //
 #include <stdlib.h>
+#include <stdio.h>
 
 #include "COREventHeader.hxx"
@@ -43,73 +44,93 @@
   }
 
-  sprintf (path , "%s", argv[1] ) ; 
+  // copy the argument to filename 
+
+  sprintf (cername , "%s", argv[1] ) ; 
+
     
-  for (int i_cer = 1; i_cer <= 100; i_cer++ ) {
+  cout << cername  << endl ; 
+      
+  //
+  //   try to open the files
+  // 
+    
+  cerfile.open( cername );
+    
+  if ( cerfile.bad() ) { 
+    cout << "Cannot open input file:  " << cername << endl ;
+    exit (1) ; 
+  }
+    
+  //   
+  //    cout << " Read event " << endl ;
+  //
+  
+  //   tricky stuff. We read in the RunHeader which has by chance the
+  //   same sice than the EventHeader
+  Event.read( cerfile ); 
+
+  //    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 " ; 
     //
-    //   create the file names 
+    //   read in the particles
     //
-    sprintf ( cername, "%s/cer%06d", path, i_cer ) ; 
-    sprintf ( datname, "%s/dat%06d", path, i_cer ) ; 
     
-    //      cout << cername  << endl ; 
-    //      cout << datname  << endl ; 
+    Photon.read ( cerfile ) ; 
     
     //
-    //   try to open the files
-    // 
+    //   only if the wavelength lambda is greater than 
+    //   1.0 it is a real cerenkov photon 
+    //
+    lambda = Photon.get_wl() ; 
+
+    Photon.print() ; 
     
-    cerfile.open( cername );
-    
-    if ( cerfile.bad() ) { 
-      cout << "Cannot open input file:  " << cername << endl ;
-      continue ; 
-    }
-    
-    //   
-    //    cout << " Read event " << endl ;
-    //
-    
-    Event.read( cerfile );
-  
-    Event.Print() ; 
+    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() ;	
+      } 
 
-    //
-    //   loop over the particles (cerenkov photons) in 
-    //   the file 
-    //
-    
-    iPhotonInShower = 0 ; 
-    
-    while( ! (cerfile.eof() || cerfile.bad() )) {
+      //      sprintf (" size of Photon: %d \n", (int) sizeof( CORParticle )) ; 
+      fseek ( cerfile, -sizeof(CORParticle), SEEK_CUR(1) ); 
+
+      cout << sizeof ( CORParticle ) ;
+      cout << sizeof ( int ) ; 
+
+      break ; 
       
-      //
-      //   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() ; 
       
-      if ( lambda < 1.0 ) 
-	break ; 
-      
-      iPhotonInShower++ ; 
-      
-      Photon.print() ; 
-    }
-    
-    //
-    //   close the file
-    //
-    
-    cerfile.close();
+    } 
     
     
+    iPhotonInShower++ ; 
     
-  } 
+  }
+  
+  //
+  //   close the file
+  //
+  
+  cerfile.close();
+  
+  
   
 }
