Index: /trunk/Mars/mcore/fits.h
===================================================================
--- /trunk/Mars/mcore/fits.h	(revision 17034)
+++ /trunk/Mars/mcore/fits.h	(revision 17035)
@@ -463,4 +463,6 @@
             return it==cols.end() ? 0 : it->second.num;
         }
+	
+
 
         // There may be a gap between the main table and the start of the heap:
@@ -660,5 +662,6 @@
                 // Check for table name. Skip until eof or requested table are found.
                 // skip the current table?
-                if (!tableName.empty() && tableName!=fTable.Get<string>("EXTNAME"))
+                if ((!tableName.empty() &&         tableName!=fTable.Get<string>("EXTNAME")) ||
+                    ( tableName.empty() && "ZDrsCellOffsets"==fTable.Get<string>("EXTNAME")))
                 {
                     const streamoff skip = fTable.GetTotalBytes();
@@ -711,10 +714,37 @@
     fits(const string &fname, const string& tableName="", bool force=false) : izstream(fname.c_str())
     {
+        gLog << "Here..." <<endl;
         Constructor(fname, "", tableName, force);
+        if ((fTable.is_compressed && !force) ||
+            (fTable.name == "ZDrsCellOffsets" && !force))
+        {
+#ifdef __EXCEPTIONS
+            throw runtime_error("You are trying to read a compressed fits with the base fits class. Please use factfits instead.");
+#else
+            gLog << ___err___ << "ERROR - You are trying to read a compressed fits with the base fits class. Please use factfits instead." << endl;
+#endif
+            clear(rdstate()|ios::badbit);
+        }
     }
 
     fits(const string &fname, const string &fout, const string& tableName, bool force=false) : izstream(fname.c_str())
     {
+        gLog << "There..." << endl;
         Constructor(fname, fout, tableName, force);
+        if ((fTable.is_compressed && !force) ||
+            (fTable.name == "ZDrsCellOffsets" && !force))
+        {
+#ifdef __EXCEPTIONS
+            throw runtime_error("You are trying to read a compressed fits with the base fits class. Please use factfits instead.");
+#else
+            gLog << ___err___ << "ERROR - You are trying to read a compressed fits with the base fits class. Please use factfits instead." << endl;
+#endif
+            clear(rdstate()|ios::badbit);
+        }
+    }
+
+    fits() : izstream()
+    {
+
     }
 
@@ -999,5 +1029,5 @@
     }
 
-    size_t GetNumRows() const { return fTable.num_rows; }
+//    size_t GetNumRows() const { return fTable.num_rows; }
     size_t GetRow() const { return fRow==(size_t)-1 ? 0 : fRow; }
 
@@ -1011,4 +1041,14 @@
 
     bool IsCompressedFITS() const { return fTable.is_compressed;}
+
+    virtual size_t GetNumRows() const
+    {
+        return fTable.Get<size_t>("NAXIS2");
+    }
+
+    virtual size_t GetBytesPerRow() const
+    {
+        return fTable.Get<size_t>("NAXIS1");
+    }
 };
 
Index: /trunk/Mars/mcore/zfits.h
===================================================================
--- /trunk/Mars/mcore/zfits.h	(revision 17034)
+++ /trunk/Mars/mcore/zfits.h	(revision 17035)
@@ -37,24 +37,26 @@
 
     // Basic constructor
-    zfits(const string& fname, const string& tableName="",
-          bool force=false) : fits(fname, tableName, force),
-        fNumTiles(0),
-        fNumRowsPerTile(0),
-        fCurrentRow(-1),
-        fHeapOff(0),
-        fTileSize(0)
-    {
+    zfits(const string& fname, const string& tableName="", bool force=false) : fits(),
+                                                                               fNumTiles(0),
+                                                                               fNumRowsPerTile(0),
+                                                                               fCurrentRow(-1),
+                                                                               fHeapOff(0),
+                                                                               fTileSize(0)
+    {
+        open(fname.c_str());
+        Constructor(fname, "", tableName, force);
         InitCompressionReading();
     }
 
     // Alternative contstructor
-    zfits(const string& fname, const string& fout, const string& tableName,
-          bool force=false) : fits(fname, fout, tableName, force),
-              fNumTiles(0),
-              fNumRowsPerTile(0),
-              fCurrentRow(-1),
-              fHeapOff(0),
-              fTileSize(0)
-    {
+    zfits(const string& fname, const string& fout, const string& tableName, bool force=false) : fits(),
+                                                                                                fNumTiles(0),
+                                                                                                fNumRowsPerTile(0),
+                                                                                                fCurrentRow(-1),
+                                                                                                fHeapOff(0),
+                                                                                                fTileSize(0)
+    {
+        open(fname.c_str());
+        Constructor(fname, fout, tableName, force);
         InitCompressionReading();
     }
@@ -83,4 +85,19 @@
         return fits::IsFileOk() && rawsum;
     };
+
+    size_t GetNumRows() const
+    {
+        if (fTable.is_compressed)
+            return fTable.Get<size_t>("ZNAXIS2");
+        else
+            return fTable.Get<size_t>("NAXIS2");
+    }
+    size_t GetBytesPerRow() const
+    {
+        if (fTable.is_compressed)
+            return fTable.Get<size_t>("ZNAXIS1");
+        else
+            return fTable.Get<size_t>("NAXIS1");
+    }
 
 protected:
Index: /trunk/Mars/mraw/MRawFitsRead.cc
===================================================================
--- /trunk/Mars/mraw/MRawFitsRead.cc	(revision 17034)
+++ /trunk/Mars/mraw/MRawFitsRead.cc	(revision 17035)
@@ -45,5 +45,5 @@
 #include "MLogManip.h"
 
-#include "fits.h"
+#include "factfits.h"
 #include "MTime.h"
 
@@ -133,15 +133,15 @@
 Bool_t MRawFitsRead::IsFits(const char *name)
 {
-    return fits(name).good();
+    return factfits(name).good();
 }
 
 istream *MRawFitsRead::OpenFile(const char *filename)
 {
-    return new fits(filename);
+    return new factfits(filename);
 }
 
 Bool_t MRawFitsRead::ReadRunHeader(istream &stream)
 {
-    fits &fin = static_cast<fits&>(stream);
+    factfits &fin = static_cast<factfits&>(stream);
 
     if (fin.GetStr("TELESCOP")!="FACT")
@@ -154,5 +154,5 @@
 
     fRawRunHeader->SetValidMagicNumber();
-    fRawRunHeader->SetNumEvents(fin.GetUInt("NAXIS2"));
+    fRawRunHeader->SetNumEvents(fin.GetNumRows());//GetUInt("NAXIS2"));
     fRawRunHeader->InitPixels(fin.GetUInt("NPIX"));
     fRawRunHeader->SetObservation(type=="4294967295"?"":fin.GetStr("RUNTYPE"), "FACT");
@@ -175,5 +175,5 @@
 Bool_t  MRawFitsRead::InitReadData(istream &stream)
 {
-    fits &fin = static_cast<fits&>(stream);
+    factfits &fin = static_cast<factfits&>(stream);
 
     MArrayB **data   = reinterpret_cast<MArrayB**>(fRawEvtData1->DataMember("fHiGainFadcSamples"));
@@ -216,5 +216,5 @@
 Bool_t MRawFitsRead::ReadEvent(istream &stream)
 {
-    if (!static_cast<fits&>(stream).GetNextRow())
+    if (!static_cast<factfits&>(stream).GetNextRow())
         return kFALSE;
 
@@ -231,4 +231,4 @@
 void MRawFitsRead::SkipEvent(istream &fin)
 {
-    static_cast<fits&>(fin).SkipNextRow();
-}
+    static_cast<factfits&>(fin).SkipNextRow();
+}
