Index: trunk/MagicSoft/Mars/mcorsika/MCorsikaEvtHeader.cc
===================================================================
--- trunk/MagicSoft/Mars/mcorsika/MCorsikaEvtHeader.cc	(revision 9182)
+++ trunk/MagicSoft/Mars/mcorsika/MCorsikaEvtHeader.cc	(revision 9186)
@@ -37,5 +37,4 @@
 
 #include "MMcEvt.hxx"
-#include "MCorsikaRunHeader.h"
 
 ClassImp(MCorsikaEvtHeader);
@@ -78,5 +77,5 @@
 // return FALSE if there is no  header anymore, else TRUE
 //
-Int_t MCorsikaEvtHeader::ReadEvt(std::istream &fin, MCorsikaRunHeader &header)
+Int_t MCorsikaEvtHeader::ReadEvt(std::istream &fin)
 {
     char evth[4];
@@ -125,5 +124,5 @@
     fX =  f[117];
     fY = -f[97];
-
+/*
     if (fEvtNumber==1)
     {
@@ -138,5 +137,5 @@
         header.Print();
     }
-
+ */
     fin.seekg(1088-273*4, ios::cur);
 
Index: trunk/MagicSoft/Mars/mcorsika/MCorsikaEvtHeader.h
===================================================================
--- trunk/MagicSoft/Mars/mcorsika/MCorsikaEvtHeader.h	(revision 9182)
+++ trunk/MagicSoft/Mars/mcorsika/MCorsikaEvtHeader.h	(revision 9186)
@@ -13,6 +13,4 @@
 //class ifstream;
 #include <iosfwd>
-
-class MCorsikaRunHeader;
 
 class MCorsikaEvtHeader : public MParContainer
@@ -57,5 +55,5 @@
     Float_t GetY() const { return fY; }
 
-    Int_t ReadEvt(istream& fin, MCorsikaRunHeader &header);    // read in event header block
+    Int_t  ReadEvt(istream& fin);    // read in event header block
     Bool_t ReadEvtEnd(istream& fin); // read in event end block
 
Index: trunk/MagicSoft/Mars/mcorsika/MCorsikaRead.cc
===================================================================
--- trunk/MagicSoft/Mars/mcorsika/MCorsikaRead.cc	(revision 9182)
+++ trunk/MagicSoft/Mars/mcorsika/MCorsikaRead.cc	(revision 9186)
@@ -16,7 +16,7 @@
 !
 !
-!   Author(s): Thomas Bretz  12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
-!
-!   Copyright: MAGIC Software Development, 2000-2007
+!   Author(s): Thomas Bretz  11/2008 <mailto:tbretz@astro.uni-wuerzburg.de>
+!
+!   Copyright: Software Development, 2000-2008
 !
 !
@@ -26,11 +26,4 @@
 //
 //  MCorsikaRead
-//
-//  This tasks reads the raw binary file like specified in the TDAS???
-//  and writes the data in the corresponding containers which are
-//  either retrieved from the parameter list or created and added.
-//
-//  Use SetInterleave() if you don't want to read all events, eg
-//    SetInterleave(5) reads only each 5th event.
 //
 //  Input Containers:
@@ -38,5 +31,7 @@
 //
 //  Output Containers:
-//   MCorsikaRunHeader, MCorsikaEvtHeader, MCorsikaEvtData, MCorsikaCrateArray, MCorsikaEvtTime
+//   MCorsikaRunHeader
+//   MCorsikaEvtHeader
+//   MPhotonEvent
 //
 //////////////////////////////////////////////////////////////////////////////
@@ -51,6 +46,4 @@
 #include "MLogManip.h"
 
-//#include "MZlib.h"
-//#include "MTime.h"
 #include "MParList.h"
 #include "MStatusDisplay.h"
@@ -59,5 +52,4 @@
 #include "MCorsikaEvtHeader.h"
 
-//#include "MPhotonData.h"
 #include "MPhotonEvent.h"
 
@@ -103,5 +95,5 @@
 //
 MCorsikaRead::MCorsikaRead(const char *fname, const char *name, const char *title)
-    : fRunHeader(0), fEvtHeader(0), fEvent(0), fEvtData(0), fForceMode(kFALSE),
+    : fRunHeader(0), fEvtHeader(0), fEvent(0), /*fEvtData(0),*/ fForceMode(kFALSE),
     fFileNames(0), fNumFile(0), fNumEvents(0), fNumTotalEvents(0),
     fIn(0), fParList(0)
@@ -212,5 +204,5 @@
 
     const char *expname = gSystem->ExpandPathName(name);
-    fIn = new fstream(expname);
+    fIn = new ifstream(expname);
 
     const Bool_t noexist = !(*fIn);
@@ -245,16 +237,10 @@
     if (!fRunHeader->ReadEvt(*fIn))
         return kERROR;
-
-    if (!(*fIn))
-    {
-        *fLog << err << "Error: Accessing file '" << name << "'" << endl;
-        return kERROR;
-    }
+//    if (!fEvtHeader->ReadRunHeader(*fIn, *fRunHeader))
+//        return kERROR;
 
     const streampos pos = fIn->tellg();
-
     if (!ReadEvtEnd())
         return kERROR;
-
     fIn->seekg(pos, ios::beg);
 
@@ -267,6 +253,6 @@
     //  We print it after the first event was read because
     //  we still miss information which is stored in the event header?!?
-    //if (print)
-    //    fRunHeader->Print();
+    if (print)
+        fRunHeader->Print();
 
     if (!fParList)
@@ -386,14 +372,8 @@
         return kFALSE;
 
-    fEvtData = (MPhotonData*)pList->FindCreateObj("MPhotonData");
-    if (!fEvtData)
-        return kFALSE;
-
     fEvent = (MPhotonEvent*)pList->FindCreateObj("MPhotonEvent");
     if (!fEvent)
         return kFALSE;
 
-    //*fLog << inf << "Maintaining " << fEvent->GetClassName() << " found in MCorsikaEvent." << endl;
-
     *fLog << inf << "Calculating number of total events..." << flush;
     if (!CalcNumTotalEvents())
@@ -419,5 +399,5 @@
     // if there is no next event anymore stop eventloop
     //
-    Int_t rc = fEvtHeader->ReadEvt(fin, *fRunHeader); //read event header block
+    Int_t rc = fEvtHeader->ReadEvt(fin); //read event header block
     if (!rc)
         return kFALSE;
Index: trunk/MagicSoft/Mars/mcorsika/MCorsikaRead.h
===================================================================
--- trunk/MagicSoft/Mars/mcorsika/MCorsikaRead.h	(revision 9182)
+++ trunk/MagicSoft/Mars/mcorsika/MCorsikaRead.h	(revision 9186)
@@ -12,5 +12,4 @@
 class MCorsikaRunHeader;
 class MCorsikaEvtHeader;
-class MPhotonData;
 class MPhotonEvent;
 
@@ -18,10 +17,9 @@
 {
 private:
-    MCorsikaRunHeader  *fRunHeader;  // run header information container to fill from file
-    MCorsikaEvtHeader  *fEvtHeader;  // event header information container to fill from file
+    MCorsikaRunHeader *fRunHeader;  // run header information container to fill from file
+    MCorsikaEvtHeader *fEvtHeader;  // event header information container to fill from file
     MPhotonEvent      *fEvent;      // event information
-    MPhotonData       *fEvtData;    // raw evt data information container to fill from file
 
-    Bool_t          fForceMode;     // Force mode skipping defect events
+    Bool_t          fForceMode;     // Force mode skipping defect RUNE
 
     TList    *fFileNames;      // list of file names
@@ -30,5 +28,5 @@
     UInt_t    fNumTotalEvents; //! total number of events in all files
 
-    fstream  *fIn;             //! input stream (file to read from)
+    ifstream *fIn;             //! input stream (file to read from)
 
     MParList *fParList;        //! tasklist to call ReInit from
Index: trunk/MagicSoft/Mars/mcorsika/MCorsikaRunHeader.cc
===================================================================
--- trunk/MagicSoft/Mars/mcorsika/MCorsikaRunHeader.cc	(revision 9182)
+++ trunk/MagicSoft/Mars/mcorsika/MCorsikaRunHeader.cc	(revision 9186)
@@ -170,5 +170,39 @@
     fin.seekg(1020, ios::cur);     // skip the remaining data of this block
 
-    return kTRUE;
+    // -------------------- Read first event header -------------------
+
+    char evth[4];
+    fin.read(evth, 4);
+    if (memcmp(evth, "EVTH", 4))
+    {
+        *fLog << err << "ERROR - Wrong identifier: EVTH expected." << endl;
+        return kFALSE;
+    }
+
+    Float_t g[273];
+    fin.read((char*)&g, 273*4);
+    if (fin.eof())
+        return kFALSE;
+
+    fin.seekg(-274*4, ios::cur);
+
+    const Int_t n = TMath::Nint(g[96]);
+    if (n!=1)
+    {
+        *fLog << err << "ERROR - Currently only one impact parameter per event is supported." << endl;
+        return kFALSE;
+    }
+
+    //fImpactMax = g[86];
+
+    fZdMin = g[79];
+    fZdMax = g[80];
+    fAzMin = 180-g[81];
+    fAzMax = 180-g[82];
+
+    fViewConeInnerAngle = g[151];
+    fViewConeOuterAngle = g[152];
+
+    return kTRUE;;
 }
 
Index: trunk/MagicSoft/Mars/mcorsika/MCorsikaRunHeader.h
===================================================================
--- trunk/MagicSoft/Mars/mcorsika/MCorsikaRunHeader.h	(revision 9182)
+++ trunk/MagicSoft/Mars/mcorsika/MCorsikaRunHeader.h	(revision 9186)
@@ -33,4 +33,6 @@
     Float_t  fAzMax;                     // [rad] Azimuth (north=0; west=90)
 
+    //Float_t  fImpactMax;              // [cm] Maximum simulated impact
+
     Float_t fViewConeInnerAngle;      // [deg]
     Float_t fViewConeOuterAngle;      // [deg]
@@ -48,4 +50,8 @@
     Float_t GetAzMax() const { return fAzMax; }
 
+    //Float_t GetImpactMax() const { return fImpactMax; }
+
+    Float_t GetViewConeOuterAngle() const { return fViewConeOuterAngle; }
+
     UInt_t GetNumEvents() const { return fNumEvents; }
 
