Index: trunk/Mars/mcore/DrsCalib.h
===================================================================
--- trunk/Mars/mcore/DrsCalib.h	(revision 17269)
+++ trunk/Mars/mcore/DrsCalib.h	(revision 17274)
@@ -1234,9 +1234,5 @@
     std::string ReadFitsImp(const std::string &str, std::vector<float> &vec)
     {
-#ifndef __MARS__
-        std::fits file(str);
-#else
         fits file(str);
-#endif
         if (!file)
         {
Index: trunk/Mars/mcore/factfits.h
===================================================================
--- trunk/Mars/mcore/factfits.h	(revision 17269)
+++ trunk/Mars/mcore/factfits.h	(revision 17274)
@@ -135,5 +135,5 @@
         if (calib.bad())
         {
-            clear(rdstate()|ios::badbit);
+            clear(rdstate()|std::ios::badbit);
             return;
         }
@@ -145,7 +145,7 @@
         if (calib.GetNumRows() != 1)
         {
-            clear(rdstate()|ios::badbit);
-#ifdef __EXCEPTIONS
-            throw runtime_error("Table 'ZDrsCellOffsets' found, but not with one row as expected");
+            clear(rdstate()|std::ios::badbit);
+#ifdef __EXCEPTIONS
+            throw std::runtime_error("Table 'ZDrsCellOffsets' found, but not with one row as expected");
 #else
             gLog << ___err___ << "ERROR - Table 'ZDrsCellOffsets' found, but not with one row as expected" << endl;
@@ -155,7 +155,7 @@
         if (calib.GetStr("TTYPE1") != "OffsetCalibration")
         {
-            clear(rdstate()|ios::badbit);
-#ifdef __EXCEPTIONS
-            throw runtime_error("Table 'DrsCalib' found, but first column is not the one expected");
+            clear(rdstate()|std::ios::badbit);
+#ifdef __EXCEPTIONS
+            throw std::runtime_error("Table 'DrsCalib' found, but first column is not the one expected");
 #else
             gLog << ___err___ << "ERROR - Table 'DrsCalib' found, but first column is not the one expected" << endl;
@@ -165,7 +165,7 @@
         if (calib.GetStr("TFORM1") != "1474560I")  // 1024*1440
         {
-            clear(rdstate()|ios::badbit);
-#ifdef __EXCEPTIONS
-            throw runtime_error("Table 'DrsCalib' has wrong column format (TFROM1)");
+            clear(rdstate()|std::ios::badbit);
+#ifdef __EXCEPTIONS
+            throw std::runtime_error("Table 'DrsCalib' has wrong column format (TFROM1)");
 #else
             gLog << ___err___ << "ERROR - Table 'DrsCalib' has wrong column format (TFORM1)" << endl;
@@ -180,8 +180,8 @@
             return;
 
-        clear(rdstate()|ios::badbit);
-
-#ifdef __EXCEPTIONS
-        throw runtime_error("Reading column 'OffsetCalibration' failed.");
+        clear(rdstate()|std::ios::badbit);
+
+#ifdef __EXCEPTIONS
+        throw std::runtime_error("Reading column 'OffsetCalibration' failed.");
 #else
         gLog << ___err___ << "ERROR - Reading column 'OffsetCalibration' failed." << endl;
@@ -190,5 +190,5 @@
     }
 
-    vector<int16_t> fOffsetCalibration; ///< integer values of the drs calibration used for compression
+    std::vector<int16_t> fOffsetCalibration; ///< integer values of the drs calibration used for compression
 
     size_t fOffsetStartCellData;
Index: trunk/Mars/mcore/fits.h
===================================================================
--- trunk/Mars/mcore/fits.h	(revision 17269)
+++ trunk/Mars/mcore/fits.h	(revision 17274)
@@ -23,8 +23,10 @@
 #include <iomanip>
 #include <iostream>
-#define gLog cerr
+#ifndef gLog
+#define gLog std::cerr
 #define ___err___   ""
 #define ___warn___  ""
 #define ___all___   ""
+#endif
 #else
 #include "MLog.h"
@@ -44,9 +46,4 @@
 
 #include "checksum.h"
-
-#ifndef __MARS__
-namespace std
-{
-#endif
 
 class fits : public izstream
@@ -136,5 +133,5 @@
                 throw std::runtime_error(str.str());
 #else
-                gLog << ___err___ << "ERROR - " << str.str() << endl;
+                gLog << ___err___ << "ERROR - " << str.str() << std::endl;
                 return false;
 #endif
@@ -148,5 +145,5 @@
                 throw std::runtime_error(str.str());
 #else
-                gLog << ___err___ << "ERROR - " << str.str() << endl;
+                gLog << ___err___ << "ERROR - " << str.str() << std::endl;
                 return false;
 #endif
@@ -160,5 +157,5 @@
                 throw std::runtime_error(str.str());
 #else
-                gLog << ___err___ << "ERROR - " << str.str() << endl;
+                gLog << ___err___ << "ERROR - " << str.str() << std::endl;
                 return false;
 #endif
@@ -319,5 +316,5 @@
                         throw std::runtime_error(str.str());
 #else
-                        gLog << ___err___ << "ERROR - " << str.str() << endl;
+                        gLog << ___err___ << "ERROR - " << str.str() << std::endl;
                         return;
 #endif
@@ -337,5 +334,5 @@
                 throw std::runtime_error("Column size mismatch");
 #else
-                gLog << ___err___ << "ERROR - Column size mismatch" << endl;
+                gLog << ___err___ << "ERROR - Column size mismatch" << std::endl;
                 return;
 #endif
@@ -362,5 +359,5 @@
                     continue;
 
-                gLog << ___all___ << setw(2) << it->second.type << '|' << it->first << '=' << it->second.value << '/' << it->second.comment << '|' << endl;
+                gLog << ___all___ << std::setw(2) << it->second.type << '|' << it->first << '=' << it->second.value << '/' << it->second.comment << '|' << std::endl;
             }}
 
@@ -376,5 +373,5 @@
             for (Sorted::const_iterator it=sorted.cbegin(); it!=sorted.cend(); it++)
             {
-                gLog << ___all___ << setw(6) << it->second.offset << "| ";
+                gLog << ___all___ << std::setw(6) << it->second.offset << "| ";
                 gLog << it->second.num << 'x';
                 switch (it->second.type)
@@ -389,5 +386,5 @@
                 case 'D': gLog << "double(64)"; break;
                 }
-                gLog << ": " << it->first.second << " [" << it->second.unit << "]" << endl;
+                gLog << ": " << it->first.second << " [" << it->second.unit << "]" << std::endl;
             }
         }
@@ -427,5 +424,5 @@
                 throw std::runtime_error(str.str());
 #else
-                gLog << ___err___ << "ERROR - " << str.str() << endl;
+                gLog << ___err___ << "ERROR - " << str.str() << std::endl;
                 return T();
 #endif
@@ -557,5 +554,5 @@
     }
 
-    void Constructor(const string &fname, string fout, const string& tableName, bool force, int tableNumber=-1)
+    void Constructor(const std::string &fname, std::string fout, const std::string& tableName, bool force, int tableNumber=-1)
     {
         char simple[10];
@@ -568,9 +565,9 @@
         if (memcmp(simple, "SIMPLE  = ", 10))
         {
-            clear(rdstate()|ios::badbit);
+            clear(rdstate()|std::ios::badbit);
 #ifdef __EXCEPTIONS
             throw std::runtime_error("File is not a FITS file.");
 #else
-            gLog << ___err___ << "ERROR - File is not a FITS file." << endl;
+            gLog << ___err___ << "ERROR - File is not a FITS file." << std::endl;
             return;
 #endif
@@ -596,9 +593,9 @@
                 if (!good())
                 {
-                    clear(rdstate()|ios::badbit);
+                    clear(rdstate()|std::ios::badbit);
 #ifdef __EXCEPTIONS
                     throw std::runtime_error("FITS file corrupted.");
 #else
-                    gLog << ___err___ << "ERROR - FITS file corrupted." << endl;
+                    gLog << ___err___ << "ERROR - FITS file corrupted." << std::endl;
                     return;
 #endif
@@ -609,9 +606,9 @@
                     if (!rc && !force)
                     {
-                        clear(rdstate()|ios::badbit);
+                        clear(rdstate()|std::ios::badbit);
 #ifdef __EXCEPTIONS
                         throw std::runtime_error("END keyword missing in FITS header.");
 #else
-                        gLog << ___err___ << "ERROR - END keyword missing in FITS file... file might be corrupted." << endl;
+                        gLog << ___err___ << "ERROR - END keyword missing in FITS file... file might be corrupted." << std::endl;
                         return;
 #endif
@@ -637,5 +634,5 @@
                 if (!fTable)
                 {
-                    clear(rdstate()|ios::badbit);
+                    clear(rdstate()|std::ios::badbit);
                     return;
                 }
@@ -643,6 +640,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")) ||
-                    ( tableName.empty() && "ZDrsCellOffsets"==fTable.Get<string>("EXTNAME")) ||
+                if ((!tableName.empty() &&         tableName!=fTable.Get<std::string>("EXTNAME")) ||
+                    ( tableName.empty() && "ZDrsCellOffsets"==fTable.Get<std::string>("EXTNAME")) ||
                     (tableNumber != -1))
                 {
@@ -655,5 +652,5 @@
                     }
                     const streamoff skip = fTable.GetTotalBytes();
-                    seekg(skip, ios_base::cur);
+                    seekg(skip, std::ios_base::cur);
 
                     fChkHeader.reset();
@@ -682,9 +679,9 @@
         if (!fCopy)
         {
-            clear(rdstate()|ios::badbit);
+            clear(rdstate()|std::ios::badbit);
 #ifdef __EXCEPTIONS
             throw std::runtime_error("Could not open output file.");
 #else
-            gLog << ___err___ << "ERROR - Failed to open output file." << endl;
+            gLog << ___err___ << "ERROR - Failed to open output file." << std::endl;
 #endif
         }
@@ -698,5 +695,5 @@
         fCopy.write(buf.data(), p);
         if (!fCopy)
-            clear(rdstate()|ios::badbit);
+            clear(rdstate()|std::ios::badbit);
     }
 
@@ -711,7 +708,7 @@
             throw std::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);
+            gLog << ___err___ << "ERROR - You are trying to read a compressed fits with the base fits class. Please use factfits instead." << std::endl;
+#endif
+            clear(rdstate()|std::ios::badbit);
         }
     }
@@ -726,7 +723,7 @@
             throw std::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);
+            gLog << ___err___ << "ERROR - You are trying to read a compressed fits with the base fits class. Please use factfits instead." << std::endl;
+#endif
+            clear(rdstate()|std::ios::badbit);
         }
     }
@@ -762,9 +759,9 @@
                 fCopy.write(fBufferRow.data()+offset, fTable.bytes_per_row);
             if (!fCopy)
-                clear(rdstate()|ios::badbit);
+                clear(rdstate()|std::ios::badbit);
         }
         else
             if (fCopy.is_open())
-                clear(rdstate()|ios::badbit);
+                clear(rdstate()|std::ios::badbit);
     }
 
@@ -804,5 +801,5 @@
         const char *pend = src + num*N;
         for (const char *ptr = src; ptr<pend; ptr+=N, dest+=N)
-            reverse_copy(ptr, ptr+N, dest);
+            std::reverse_copy(ptr, ptr+N, dest);
     }
 
@@ -883,5 +880,5 @@
             throw std::runtime_error(str.str());
 #else
-            gLog << ___err___ << "ERROR - " << str.str() << endl;
+            gLog << ___err___ << "ERROR - " << str.str() << std::endl;
             return NULL;
 #endif
@@ -912,5 +909,5 @@
             throw std::runtime_error(str.str());
 #else
-            gLog << ___err___ << "ERROR - " << str.str() << endl;
+            gLog << ___err___ << "ERROR - " << str.str() << std::endl;
             return false;
 #endif
@@ -925,5 +922,5 @@
             throw std::runtime_error(str.str());
 #else
-            gLog << ___err___ << "ERROR - " << str.str() << endl;
+            gLog << ___err___ << "ERROR - " << str.str() << std::endl;
             return false;
 #endif
@@ -938,5 +935,5 @@
             throw std::runtime_error(str.str());
 #else
-            gLog << ___err___ << "ERROR - " << str.str() << endl;
+            gLog << ___err___ << "ERROR - " << str.str() << std::endl;
             return false;
 #endif
@@ -986,5 +983,5 @@
             throw std::runtime_error(str.str());
 #else
-            gLog << ___err___ << "ERROR - " << str.str() << endl;
+            gLog << ___err___ << "ERROR - " << str.str() << std::endl;
             return false;
 #endif
@@ -999,5 +996,5 @@
             throw std::runtime_error(str.str());
 #else
-            gLog << ___err___ << "ERROR - " << str.str() << endl;
+            gLog << ___err___ << "ERROR - " << str.str() << std::endl;
             return false;
 #endif
@@ -1054,6 +1051,3 @@
 };
 
-#ifndef __MARS__
-};
-#endif
-#endif
+#endif
Index: trunk/Mars/mcore/ofits.h
===================================================================
--- trunk/Mars/mcore/ofits.h	(revision 17269)
+++ trunk/Mars/mcore/ofits.h	(revision 17274)
@@ -18,8 +18,10 @@
 
 #ifndef __MARS__
-#define gLog cerr
+#ifndef gLog
+#define gLog std::cerr
 #define ___err___   ""
 #define ___warn___  ""
 #define ___all___   ""
+#endif
 #else
 #include "MLog.h"
Index: trunk/Mars/mcore/zfits.h
===================================================================
--- trunk/Mars/mcore/zfits.h	(revision 17269)
+++ trunk/Mars/mcore/zfits.h	(revision 17274)
@@ -14,9 +14,4 @@
 #include "FITS.h"
 
-#ifndef __MARS__
-namespace std
-{
-#endif
-
 class zfits : public fits
 {
@@ -24,5 +19,5 @@
 
     // Basic constructor
-    zfits(const string& fname, const string& tableName="", bool force=false)
+    zfits(const std::string& fname, const std::string& tableName="", bool force=false)
         : fNumTiles(0), fNumRowsPerTile(0), fCurrentRow(-1), fHeapOff(0), fTileSize(0)
     {
@@ -33,5 +28,5 @@
 
     // Alternative contstructor
-    zfits(const string& fname, const string& fout, const string& tableName, bool force=false)
+    zfits(const std::string& fname, const std::string& fout, const std::string& tableName, bool force=false)
         : fNumTiles(0), fNumRowsPerTile(0), fCurrentRow(-1), fHeapOff(0), fTileSize(0)
     {
@@ -112,7 +107,7 @@
                     continue;
 
-                clear(rdstate()|ios::badbit);
+                clear(rdstate()|std::ios::badbit);
 #ifdef __EXCEPTIONS
-                throw runtime_error("Only the FACT compression scheme is handled by this reader.");
+                throw std::runtime_error("Only the FACT compression scheme is handled by this reader.");
 #else
                 gLog << ___err___ << "ERROR - Only the FACT compression scheme is handled by this reader." << endl;
@@ -161,7 +156,7 @@
     streamoff fHeapFromDataStart; ///< offset from the beginning of the data table
 
-    std::vector<std::vector<pair<int64_t, int64_t>>> fCatalog;     ///< Catalog, i.e. the main table that points to the compressed data.
-    std::vector<size_t>                              fTileSize;    ///< size in bytes of each compressed tile
-    std::vector<std::vector<size_t>>                 fTileOffsets; ///< offset from start of tile of a given compressed column
+    std::vector<std::vector<std::pair<int64_t, int64_t>>> fCatalog;     ///< Catalog, i.e. the main table that points to the compressed data.
+    std::vector<size_t>                                   fTileSize;    ///< size in bytes of each compressed tile
+    std::vector<std::vector<size_t>>                      fTileOffsets; ///< offset from start of tile of a given compressed column
 
     Checksum fRawsum;   ///< Checksum of the uncompressed, raw data
@@ -212,7 +207,7 @@
                 if (tempValues[0] < 0 || tempValues[1] < 0)
                 {
-                    clear(rdstate()|ios::badbit);
+                    clear(rdstate()|std::ios::badbit);
 #ifdef __EXCEPTIONS
-                    throw runtime_error("Negative value in the catalog");
+                    throw std::runtime_error("Negative value in the catalog");
 #else
                     gLog << ___err___ << "ERROR - negative value in the catalog" << endl;
@@ -266,5 +261,5 @@
         fCopy.write(buf.data(), catSize);
         if (!fCopy)
-            clear(rdstate()|ios::badbit);
+            clear(rdstate()|std::ios::badbit);
     }
 
@@ -321,9 +316,9 @@
                 fCopy.write(fCompressedBuffer.data()+offset, sizeToRead);
                 if (!fCopy)
-                    clear(rdstate()|ios::badbit);
+                    clear(rdstate()|std::ios::badbit);
             }
             else
                 if (fCopy.is_open())
-                    clear(rdstate()|ios::badbit);
+                    clear(rdstate()|std::ios::badbit);
 
             const uint32_t thisRoundNumRows = (GetNumRows()<fCurrentRow + fNumRowsPerTile) ? GetNumRows()%fNumRowsPerTile : fNumRowsPerTile;
@@ -364,7 +359,7 @@
 
                 default:
-                    clear(rdstate()|ios::badbit);
+                    clear(rdstate()|std::ios::badbit);
 #ifdef __EXCEPTIONS
-                    throw runtime_error("Unkown column ordering scheme found");
+                    throw std::runtime_error("Unkown column ordering scheme found");
 #else
                     gLog << ___err___ << "ERROR - unkown column ordering scheme" << endl;
@@ -473,10 +468,10 @@
 
                 default:
-                    clear(rdstate()|ios::badbit);
+                    clear(rdstate()|std::ios::badbit);
 
                     std::ostringstream str;
                     str << "Unkown processing applied to data. Col " << i << " proc " << j << " out of " << (int)head->numProcs;
 #ifdef __EXCEPTIONS
-                    throw runtime_error(str.str());
+                    throw std::runtime_error(str.str());
 #else
                     gLog << ___err___ << "ERROR - Unknown processing applied to data. Aborting" << endl;
@@ -520,5 +515,5 @@
             if (memcmp(tileHead.id, "TILE", 4))
             {
-                clear(rdstate()|ios::badbit);
+                clear(rdstate()|std::ios::badbit);
                 break;
             }
@@ -562,9 +557,9 @@
         if (numRows != fTable.num_rows)
         {
-            clear(rdstate()|ios::badbit);
+            clear(rdstate()|std::ios::badbit);
             std::ostringstream str;
             str << "Heap data does not agree with header: " << numRows << " calculated vs " << fTable.num_rows << " from header.";
 #ifdef __EXCEPTIONS
-                    throw runtime_error(str.str());
+                    throw std::runtime_error(str.str());
 #else
                     gLog << ___err___ << "ERROR - " << str.str() << endl;
@@ -584,7 +579,7 @@
         if (catalog.size() != fCatalog.size())
         {
-                    clear(rdstate()|ios::badbit);
+                    clear(rdstate()|std::ios::badbit);
 #ifdef __EXCEPTIONS
-                    throw runtime_error("Heap data does not agree with header.");
+                    throw std::runtime_error("Heap data does not agree with header.");
 #else
                     gLog << ___err___ << "ERROR - Heap data does not agree with header." << endl;
@@ -599,7 +594,7 @@
                     catalog[i][j].second != fCatalog[i][j].second)
                 {
-                    clear(rdstate()|ios::badbit);
+                    clear(rdstate()|std::ios::badbit);
 #ifdef __EXCEPTIONS
-                    throw runtime_error("Heap data does not agree with header.");
+                    throw std::runtime_error("Heap data does not agree with header.");
 #else
                     gLog << ___err___ << "ERROR - Heap data does not agree with header." << endl;
@@ -616,7 +611,3 @@
 };//class zfits
 
-#ifndef __MARS__
-}; //namespace std
-#endif
-
 #endif 
