Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 1596)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 1597)
@@ -12,4 +12,10 @@
    * mgeom/Makefile:
      - modified to compile new classes
+
+   * mmc/MMcConfigRunHeader.[h,cc]
+     -added
+
+   *mmc/Makefile
+     -modified to compile new classes
 
  2002/11/08: Thomas Bretz
Index: /trunk/MagicSoft/Simulation/Detector/Camera/Makefile
===================================================================
--- /trunk/MagicSoft/Simulation/Detector/Camera/Makefile	(revision 1596)
+++ /trunk/MagicSoft/Simulation/Detector/Camera/Makefile	(revision 1597)
@@ -19,7 +19,7 @@
 #
 # $RCSfile: Makefile,v $
-# $Revision: 1.20 $
+# $Revision: 1.21 $
 # $Author: blanch $ 
-# $Date: 2002-10-29 17:24:51 $
+# $Date: 2002-11-08 17:51:11 $
 #
 ##################################################################
@@ -83,5 +83,5 @@
 	  ${INCLUDE_EVITA_MC}   \
 	  ${INCLUDE_EVITA_RAW}   \
-	  ${INCLUDE_MARS_MGEOM}  \
+	  ${INCLUDE_MARS_MGEOM}
 
 LIBRARIES = $(SUBDIRS:=.a)
@@ -866,4 +866,4 @@
 camera.o: moments.h ../include-MC/MCEventHeader.hxx
 camera.o: /usr/include/g++/iomanip.h ../include-CORSIKA/COREventHeader.hxx
-camera.o: ../include-MC/MCCphoton.hxx ../../../include-Classes/MBase/MArray.h
-camera.o: ../include-GENERAL/ranlib.h
+camera.o: ../include-MC/MCEventHeader_2.hxx ../include-MC/MCCphoton.hxx
+camera.o: ../../../include-Classes/MBase/MArray.h ../include-GENERAL/ranlib.h
Index: /trunk/MagicSoft/Simulation/Detector/Camera/camera.cxx
===================================================================
--- /trunk/MagicSoft/Simulation/Detector/Camera/camera.cxx	(revision 1596)
+++ /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.
Index: /trunk/MagicSoft/include-Classes/MMcFormat/MMcConfigRunHeader.cc
===================================================================
--- /trunk/MagicSoft/include-Classes/MMcFormat/MMcConfigRunHeader.cc	(revision 1597)
+++ /trunk/MagicSoft/include-Classes/MMcFormat/MMcConfigRunHeader.cc	(revision 1597)
@@ -0,0 +1,118 @@
+/* ======================================================================== *\
+!
+! *
+! * This file is part of MARS, the MAGIC Analysis and Reconstruction
+! * Software. It is distributed to you in the hope that it can be a useful
+! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
+! * It is distributed WITHOUT ANY WARRANTY.
+! *
+! * Permission to use, copy, modify and distribute this software and its
+! * documentation for any purpose is hereby granted without fee,
+! * provided that the above copyright notice appear in all copies and
+! * that both that copyright notice and this permission notice appear
+! * in supporting documentation. It is provided "as is" without express
+! * or implied warranty.
+! *
+!
+!
+!   Author(s): Oscar Blanch  11/2002 (blanch@ifae.es)
+!
+!   Copyright: MAGIC Software Development, 2000-2001
+!
+!
+\* ======================================================================== */
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// MMcConfigRunHeader
+//
+// Root storage container for the MONTE CARLO CONFIGURATION information
+//
+// It saves in a root file all the infromation about values in the configuration
+// files used in the Monte Carlo production: MagicDef (definition of the teslescope),
+// Reflectivity.dat (mirror reflectivities), qe.dat (PMT QEs), axisdev.dat (mirrors 
+// deviations) and lightguides.dat (Effect of the Light Guides).
+//
+////////////////////////////////////////////////////////////////////////////
+
+#ifndef MARS_MMcConfigRunHeader
+#include "MMcConfigRunHeader.h"
+#endif
+
+#include <fstream.h>
+#include <iomanip.h>
+
+#include "MLog.h"
+#include "MLogManip.h"
+ClassImp(MMcConfigRunHeader);
+
+// --------------------------------------------------------------------------
+//
+// Default constructor.
+//
+//
+MMcConfigRunHeader::MMcConfigRunHeader(const char *name, const char *title)
+{
+    fName  = name  ? name  : "MMcConfigRunHeader";
+    fTitle = title ? title : "Mc Configuration Information";
+
+    fNumMirrors=0;
+    fNumPMTs=0;
+
+    fRadiusMirror=-10.0;
+    fFocalDist=-10.0;
+    fFocalStdev=-10.0;
+    fPointSpread=-10.0;
+    fPointStdev=-10.0;
+    fDevAdjust=-10.0;
+    fBlackSpot=-10.0;
+    fCameraWidth=-10.0;
+
+    fIncidentTheta->Set(181);
+    fLightGuidesFactor->Set(181);
+
+    fMirrors = new TClonesArray("MGeomMirror", 0);
+    fPMTs = new TClonesArray("MGeomPMT", 0);
+
+}
+
+// -------------------------------------------------------------------------
+//
+// SetMagicDef
+//
+void MMcConfigRunHeader::SetMagicDef(const Float_t  radius,
+				     const Float_t  focal,
+				     const Float_t  stdfocal,
+				     const Float_t  point,
+				     const Float_t  stdpoint,
+				     const Float_t  adjust,
+				     const Float_t  spot,
+				     const Float_t  camwidth)
+{
+    fRadiusMirror=radius;
+    fFocalDist=focal;
+    fFocalStdev=stdfocal;
+    fPointSpread=point;
+    fPointStdev=stdpoint;
+    fDevAdjust=adjust;
+    fBlackSpot=spot;
+    fCameraWidth=camwidth;
+    
+}
+
+void  MMcConfigRunHeader::SetLightGuides(TArrayF *theta, TArrayF *factor){
+  
+  if(fIncidentTheta->GetSize()==theta->GetSize() &&
+     fLightGuidesFactor->GetSize()==factor->GetSize()){
+    theta->Copy(*fIncidentTheta);
+    factor->Copy(*fLightGuidesFactor);
+  }
+  else
+    *fLog<<err << "MMcConfigRunHeader::SetLightGuides: fIncidentTheta "
+	<<"and fLightGuidesFactor do not have "
+	<<"size of setting arrays"<<endl;
+
+}
+
+
+
Index: /trunk/MagicSoft/include-Classes/MMcFormat/Makefile
===================================================================
--- /trunk/MagicSoft/include-Classes/MMcFormat/Makefile	(revision 1596)
+++ /trunk/MagicSoft/include-Classes/MMcFormat/Makefile	(revision 1597)
@@ -20,5 +20,5 @@
 # @endcode 
 
-INCLUDES = -I.  -I../mbase -I../MBase
+INCLUDES = -I.  -I../mbase -I../MBase -I../mgeom
 
 # @code 
@@ -37,7 +37,11 @@
            MMcTrig.cxx 
 
-SRCS    = $(SRCFILES)
-HEADERS = $(SRCFILES:.cxx=.hxx)
-OBJS    = $(SRCFILES:.cxx=.o) 
+SRCFILESCC = MMcConfigRunHeader.cc
+
+
+SRCS    = $(SRCFILES) 
+
+HEADERS = $(SRCFILES:.cxx=.hxx) $(SRCFILESCC:.cc=.h)
+OBJS    = $(SRCFILES:.cxx=.o) $(SRCFILESCC:.cc=.o)
 
 ############################################################
@@ -45,5 +49,5 @@
 all: $(LIB)
 
-include ../Makefile.rules
+include ../Makefile.rules 
 
 clean:	rmcint rmobjs rmcore rmlib
