Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 2983)
+++ trunk/MagicSoft/Mars/Changelog	(revision 2984)
@@ -18,4 +18,6 @@
        calibrated pixel information.
 
+
+
  2004/01/30: Thomas Bretz
  
@@ -26,4 +28,22 @@
      - added a dynamic_cast from MParContainer to MCamEvent to get the
        correct pointer to the correct base-class.
+
+   * mbase/MStatusDisplay.cc:
+     - In EventInfo check whether gPad==0
+     
+   * mfileio/MReadMarsFile.cc:
+     - removed reading RunHeaders from PreProcess, this resulted
+       in strange behaviour of writing RunHeaders
+     - fixed consistency check for RunType accordingly
+
+   * mfilter/MFilterList.cc:
+     - do not skip adding filter if only a filter with the same name 
+       exists
+       
+   * mraw/MRawFileRead.cc:
+     - added an output message if run header is not accessible
+     
+   * mraw/MRawRunHeader.[h,cc]:
+     - initialize fRunType to new enum kRTNone
 
 
Index: trunk/MagicSoft/Mars/mbase/MStatusDisplay.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MStatusDisplay.cc	(revision 2983)
+++ trunk/MagicSoft/Mars/mbase/MStatusDisplay.cc	(revision 2984)
@@ -532,4 +532,5 @@
     if (gROOT->IsBatch())
         return;
+
     fStatusBar->SetText(txt, 1);
 
@@ -816,11 +817,12 @@
         return;
 
-    TCanvas *c = (TCanvas *)gTQSender;
+    TCanvas *c = (TCanvas*)gTQSender;
 
     TVirtualPad* save=gPad;
 
-    gPad = c->GetSelectedPad();
-
-    SetStatusLine2(selected->GetObjectInfo(px,py));
+    gPad = c ? c->GetSelectedPad() : NULL;
+
+    if (gPad)
+        SetStatusLine2(selected->GetObjectInfo(px,py));
 
     gPad=save;
Index: trunk/MagicSoft/Mars/mfileio/MReadMarsFile.cc
===================================================================
--- trunk/MagicSoft/Mars/mfileio/MReadMarsFile.cc	(revision 2983)
+++ trunk/MagicSoft/Mars/mfileio/MReadMarsFile.cc	(revision 2984)
@@ -124,5 +124,5 @@
 Bool_t MReadMarsFile::Notify()
 {
-    Int_t runtype = -1;
+    UInt_t runtype = 0xffff;
 
     const MRawRunHeader *rawheader = (MRawRunHeader*)fParList->FindObject("MRawRunHeader");
@@ -145,4 +145,10 @@
     if (!MReadTree::Notify())
         return kFALSE;
+
+    if (rawheader && runtype!=0xffff && runtype != rawheader->GetRunType())
+    {
+        *fLog << warn << "Warning - You are mixing files with different run types (";
+        *fLog << runtype << ", " << rawheader->GetRunType() << ")" << endl;
+    }
 
     if (fDisplay)
@@ -152,10 +158,4 @@
         txt += GetNumEntry()-1;
         fDisplay->SetStatusLine2(txt);
-    }
-
-    if (rawheader)
-    {
-        if (runtype != rawheader->GetRunType())
-            *fLog << warn << "Warning - You are mixing files with different run types!" << endl;
     }
 
@@ -209,4 +209,5 @@
     }
 
+    /*
     const Int_t idx = GetFileIndex();
     fRun->SetEventNum(idx<0?0:idx); // Assumption: One Entry per File!
@@ -216,5 +217,5 @@
         return kFALSE;
     }
-
+    */
     return MReadTree::PreProcess(pList);
 }
Index: trunk/MagicSoft/Mars/mfilter/MFilterList.cc
===================================================================
--- trunk/MagicSoft/Mars/mfilter/MFilterList.cc	(revision 2983)
+++ trunk/MagicSoft/Mars/mfilter/MFilterList.cc	(revision 2984)
@@ -188,8 +188,5 @@
 
     if (fFilters.FindObject(name))
-    {
         *fLog << warn << dbginf << "'" << name << "' exists in List already... skipped." << endl;
-        return kTRUE;
-    }
 
     *fLog << inf << "Adding " << name << " to " << GetName() << "... " << flush;
Index: trunk/MagicSoft/Mars/mraw/MRawFileRead.cc
===================================================================
--- trunk/MagicSoft/Mars/mraw/MRawFileRead.cc	(revision 2983)
+++ trunk/MagicSoft/Mars/mraw/MRawFileRead.cc	(revision 2984)
@@ -149,8 +149,13 @@
     //
     fRawRunHeader->ReadEvt(*fIn);
+    if (!(*fIn))
+    {
+        *fLog << err << "Error: Accessing file '" << fFileName << "'" << endl;
+        return kFALSE;
+    }
+    if (fRawRunHeader->GetMagicNumber()!=kMagicNumber)
+        return kFALSE;
+
     fRawRunHeader->Print();
-
-    if (fRawRunHeader->GetMagicNumber()!=kMagicNumber)
-        return kFALSE;
 
     *fRawEvtTime = fRawRunHeader->GetRunStart();
Index: trunk/MagicSoft/Mars/mraw/MRawRunHeader.cc
===================================================================
--- trunk/MagicSoft/Mars/mraw/MRawRunHeader.cc	(revision 2983)
+++ trunk/MagicSoft/Mars/mraw/MRawRunHeader.cc	(revision 2984)
@@ -75,5 +75,5 @@
     fFormatVersion=0;
     fSoftVersion=0;
-    fRunType=0;
+    fRunType=kRTNone;  // use 0xffff for invalidation, 0 means: Data run
     fRunNumber=0;
     fProjectName[0]=0;
@@ -184,4 +184,6 @@
     case kRTMonteCarlo:
         return "Monte Carlo";
+    case kRTNone:
+        return "<none>";
     default:
         return "<unknown>";
Index: trunk/MagicSoft/Mars/mraw/MRawRunHeader.h
===================================================================
--- trunk/MagicSoft/Mars/mraw/MRawRunHeader.h	(revision 2983)
+++ trunk/MagicSoft/Mars/mraw/MRawRunHeader.h	(revision 2984)
@@ -24,8 +24,9 @@
 //
 enum {
-    kRTData        = 0,
-    kRTPedestal    = 1,
-    kRTCalibration = 2,
-    kRTMonteCarlo  = 256
+    kRTData        = 0x0000,
+    kRTPedestal    = 0x0001,
+    kRTCalibration = 0x0002,
+    kRTMonteCarlo  = 0x0100,
+    kRTNone        = 0xffff
 };
 
