Index: trunk/MagicSoft/Mars/mraw/MRawFileRead.cc
===================================================================
--- trunk/MagicSoft/Mars/mraw/MRawFileRead.cc	(revision 9369)
+++ trunk/MagicSoft/Mars/mraw/MRawFileRead.cc	(revision 9433)
@@ -218,4 +218,6 @@
     fNumFile++;
 
+    MRawRunHeader h(*fRawRunHeader);
+
     //
     // Read RUN HEADER (see specification) from input stream
@@ -228,4 +230,11 @@
     {
         *fLog << err << "Error: Accessing file '" << name << "'" << endl;
+        return kERROR;
+    }
+
+    if (h.IsValidRun() && !fRawRunHeader->IsConsistent(h))
+    {
+        *fLog << err << "Error: Inconsistency between previous header and '" << name << "' found." << endl;
+        fRawRunHeader->Print();
         return kERROR;
     }
Index: trunk/MagicSoft/Mars/mraw/MRawRunHeader.cc
===================================================================
--- trunk/MagicSoft/Mars/mraw/MRawRunHeader.cc	(revision 9369)
+++ trunk/MagicSoft/Mars/mraw/MRawRunHeader.cc	(revision 9433)
@@ -210,4 +210,39 @@
 }
 
+MRawRunHeader::MRawRunHeader(const MRawRunHeader &h)
+{
+    fMagicNumber=h.fMagicNumber;                       // File type identifier
+
+    fHeaderSizeRun=h.fHeaderSizeRun;                   // Size of run header
+    fHeaderSizeEvt=h.fHeaderSizeEvt;                   // Size of evt header
+    fHeaderSizeCrate=h.fHeaderSizeCrate;               // Size of crate header
+
+    fFormatVersion=h.fFormatVersion;                   // File format version
+    fSoftVersion=h.fSoftVersion;                       // DAQ software version
+    fFadcType=h.fFadcType;                             // FADC type (1=Siegen, 2=MUX)
+    fCameraVersion=h.fCameraVersion;                   // Camera Version (1=MAGIC I)
+    fTelescopeNumber=h.fTelescopeNumber;               // Telescope number (1=Magic I)
+    fRunType=h.fRunType;                               // Run Type
+    fRunNumber=h.fRunNumber;                           // Run number
+    fFileNumber=h.fFileNumber;                         // File number
+    memcpy(fProjectName, h.fProjectName, 101);         // Project name
+    memcpy(fSourceName, h.fSourceName, 81);            // Source name
+    memcpy(fObservationMode, h.fObservationMode, 61);  // observation mode
+    memcpy(fSourceEpochChar, h.fSourceEpochChar, 4);   // epoch char of the source
+    fSourceEpochDate=h.fSourceEpochDate;               // epoch date of the source
+    fNumCrates=h.fNumCrates;                           // number of electronic boards
+    fNumPixInCrate=h.fNumPixInCrate;                   // number of pixels in crate
+    fNumSamplesLoGain=h.fNumSamplesLoGain;             // number of logain samples stored
+    fNumSamplesHiGain=h.fNumSamplesHiGain;             // number of higain samples stored
+    fNumBytesPerSample=h.fNumBytesPerSample;           // number of bytes per sample
+    fNumEvents=h.fNumEvents;                           // number of events stored
+    fNumEventsRead=h.fNumEventsRead;                   // number of events read by the electronics
+    fSamplingFrequency=h.fSamplingFrequency;           // Sampling Frequency [MHz]
+    fFadcResolution=h.fFadcResolution;                 // number of significant bits
+    fRunStart=h.fRunStart;                             // time of run start
+    fRunStop=h.fRunStop;                               // time of run stop
+    fPixAssignment = new MArrayS(*h.fPixAssignment);   //-> pixel assignment table
+}
+
 // --------------------------------------------------------------------------
 //
@@ -217,4 +252,22 @@
 {
     delete fPixAssignment;
+}
+
+// --------------------------------------------------------------------------
+//
+// Checks for consistency between two run headers. Checks:
+//    fNumCrates
+//    fNumPixInCrate
+//    fNumSamplesLoGain
+//    fNumSamplesHiGain
+//    fNumBytesPerSample
+//
+Bool_t MRawRunHeader::IsConsistent(const MRawRunHeader &h) const
+{
+    return fNumCrates==h.fNumCrates &&
+        fNumPixInCrate==h.fNumPixInCrate &&
+        fNumSamplesLoGain==h.fNumSamplesLoGain &&
+        fNumSamplesHiGain==h.fNumSamplesHiGain &&
+        fNumBytesPerSample==h.fNumBytesPerSample;
 }
 
Index: trunk/MagicSoft/Mars/mraw/MRawRunHeader.h
===================================================================
--- trunk/MagicSoft/Mars/mraw/MRawRunHeader.h	(revision 9369)
+++ trunk/MagicSoft/Mars/mraw/MRawRunHeader.h	(revision 9433)
@@ -84,4 +84,5 @@
 public:
     MRawRunHeader(const char *name=NULL, const char *title=NULL);
+    MRawRunHeader(const MRawRunHeader &h);
     ~MRawRunHeader();
 
@@ -169,4 +170,8 @@
     Bool_t IsPointRun() const       { return (fRunType&0xff)==kRTPointRun; }
 
+    Bool_t IsValidRun() const { return fRunType!=kRTNone; }
+
+    Bool_t IsConsistent(const MRawRunHeader &h) const;
+
     void Print(Option_t *t=NULL) const;
 
