Index: trunk/MagicSoft/Simulation/Detector/Camera/camera.cxx
===================================================================
--- trunk/MagicSoft/Simulation/Detector/Camera/camera.cxx	(revision 1559)
+++ trunk/MagicSoft/Simulation/Detector/Camera/camera.cxx	(revision 1597)
@@ -21,7 +21,7 @@
 //
 // $RCSfile: camera.cxx,v $
-// $Revision: 1.45 $
+// $Revision: 1.46 $
 // $Author: blanch $ 
-// $Date: 2002-10-29 17:15:27 $
+// $Date: 2002-11-08 17:51:00 $
 //
 ////////////////////////////////////////////////////////////////////////
@@ -1588,19 +1588,72 @@
 
 	    if (Write_McEvt) {
-	      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,
-			   (UInt_t)mcevth.get_CORSIKA(), 
-			   (UInt_t)mcevth.get_AtmAbs(), 
-			   (UInt_t)mcevth.get_MirrAbs()+mcevth.get_OutOfMirr()+mcevth.get_BlackSpot(), 
-			   (UInt_t) ncph, 
-			   (UInt_t) inumphe,
-			   (UInt_t) inumphensb+inumphe);
-		}
+	      Float_t ftime, ltime;
+	      if (reflector_file_version<6){
+		mcevth.get_times(&ftime, &ltime);
+		McEvt->Fill( -1.0, 
+			     (UShort_t) mcevth.get_primary() , 
+			     mcevth.get_energy(),
+			     -1.0,
+			     -1.0,
+			     -1.0, 
+			     mcevth.get_theta(), 
+			     mcevth.get_phi(), 
+			     mcevth.get_core(),
+			     mcevth.get_coreX(),
+			     mcevth.get_coreY(),
+			     impactD,
+			     mcevth_2.get_theta_CT(),
+			     mcevth_2.get_phi_CT(),
+			     ftime,
+			     ltime,
+			     0,
+			     0,
+			     0,
+			     0,
+			     0,
+			     0,
+			     0,
+			     (UInt_t)mcevth.get_CORSIKA(), 
+			     (UInt_t)mcevth.get_AtmAbs(), 
+			     (UInt_t)mcevth.get_MirrAbs()+mcevth.get_OutOfMirr()+mcevth.get_BlackSpot(), 
+			     (UInt_t) ncph, 
+			     (UInt_t) inumphe,
+			     (UInt_t) inumphensb+inumphe);
+	      }
+	      else{
+		Float_t Nmax, t0, tmax, a, b, c, chi2;
+		mcevth.get_times(&ftime, &ltime);
+		chi2=mcevth_2.get_NKGfit(&Nmax, &t0, &tmax, &a, &b, &c);
+		McEvt->Fill( mcevth_2.get_evt_number(),
+			    (UShort_t) mcevth_2.get_primary() , 
+			     mcevth_2.get_energy(),
+			     mcevth_2.get_thick0(),
+			     mcevth_2.get_first_target(),
+			     mcevth_2.get_z_first_int(),
+			     mcevth_2.get_theta(), 
+			     mcevth_2.get_phi(), 
+			     mcevth_2.get_core(),
+			     mcevth_2.get_coreX(),
+			     mcevth_2.get_coreY(),
+			     impactD,
+			     mcevth_2.get_theta_CT(),
+			     mcevth_2.get_phi_CT(),
+			     ftime,
+			     ltime,
+			     Nmax,
+			     t0,
+			     tmax,
+			     a,
+			     b,
+			     c,
+			     chi2,
+			     (UInt_t)mcevth_2.get_CORSIKA(), 
+			     (UInt_t)mcevth_2.get_AtmAbs(), 
+			     (UInt_t)mcevth_2.get_MirrAbs()+mcevth_2.get_OutOfMirr()+mcevth_2.get_BlackSpot(), 
+			     (UInt_t) ncph, 
+			     (UInt_t) inumphe,
+			     (UInt_t) inumphensb+inumphe);
+	      }
+	    }
 	    //  Fill the Tree with the current leaves of each branch
 	    i=EvtTree.Fill() ;
@@ -1705,18 +1758,4 @@
 	    
 	    if (Write_McEvt){
-	      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,
-			   (UInt_t)mcevth.get_CORSIKA(), 
-			   (UInt_t)mcevth.get_AtmAbs(), 
-			   (UInt_t)mcevth.get_MirrAbs()+mcevth.get_OutOfMirr()+mcevth.get_BlackSpot(), 
-			   (UInt_t) ncph, 
-			   (UInt_t) inumphe,
-			   (UInt_t) inumphensb+inumphe);
 		}
 	    //   We don not count photons out of the camera.	
@@ -1881,5 +1920,6 @@
 		    corsika,
 		    (UInt_t)(REFL_VERSION_A*100),
-		    (UInt_t)(VERSION*100));
+		    (UInt_t)(VERSION*100),
+		    0);
   
   //  Fill the Header Tree with the current leaves of each branch
@@ -3369,4 +3409,5 @@
   static char cflag[SIZE_OF_FLAGS + 1]; // auxiliary variable
   static MCEventHeader evth; // the event header
+  static MCEventHeader evth_2; // the event header
   static float nphe[iMAXNUMPIX];    // the number of photoelectrons in each pixel
   int reflector_file_version;
@@ -3421,10 +3462,16 @@
       
       if( isA( cflag, FLAG_START_OF_EVENT   )){ // there is a event
-	
+
 	// get MCEventHeader
 	
-	fread( (char*)&evth, evth.mysize(), 1, infile );
-	
-	integtime_ns = evth.get_energy();
+	if (reflector_file_version<6)
+	  fread( (char*)&evth, evth.mysize(), 1, infile );
+	else
+	  fread( (char*)&evth_2, evth_2.mysize(), 1, infile );
+	  
+	if (reflector_file_version<6)
+	  integtime_ns = evth.get_energy();
+	else
+	  integtime_ns = evth_2.get_energy();
 
 	// memorize where we are in the file
@@ -3637,4 +3684,7 @@
 //
 // $Log: not supported by cvs2svn $
+// Revision 1.45  2002/10/29 17:15:27  blanch
+// Reading several reflector versions.
+//
 // Revision 1.44  2002/10/18 16:53:03  blanch
 // Modification to read several reflector files.
@@ -3773,4 +3823,7 @@
 //
 // $Log: not supported by cvs2svn $
+// Revision 1.45  2002/10/29 17:15:27  blanch
+// Reading several reflector versions.
+//
 // Revision 1.44  2002/10/18 16:53:03  blanch
 // Modification to read several reflector files.
