Index: trunk/MagicSoft/Mars/macros/dohtml.C
===================================================================
--- trunk/MagicSoft/Mars/macros/dohtml.C	(revision 455)
+++ trunk/MagicSoft/Mars/macros/dohtml.C	(revision 456)
@@ -16,6 +16,6 @@
 
   html.SetSourceDir("macros");
-  html.Convert("merpp.C", "MARS - Merging and Preprocessing Macro");
-  html.Convert("readraw.C", "MARS - Read a raw file macro");
+  html.Convert("merpp.C", "MARS - Merging and Preprocessing");
+  html.Convert("readraw.C", "MARS - How To Read A Raw");
   html.Convert("rootlogon.C", "MARS - rootlogon.C");
 }
Index: trunk/MagicSoft/Mars/mraw/MRawEvtData.cc
===================================================================
--- trunk/MagicSoft/Mars/mraw/MRawEvtData.cc	(revision 455)
+++ trunk/MagicSoft/Mars/mraw/MRawEvtData.cc	(revision 456)
@@ -127,64 +127,66 @@
 void MRawEvtData::Draw(Option_t *opt)
 {
-    TString str(opt);
-
-    UInt_t num = 0;
-
-    if (str.BeginsWith("GRAPH", TString::kIgnoreCase))
+  // ----- AppendPad(opt);
+   
+  TString str(opt);
+  
+  UInt_t num = 0;
+  
+  if (str.BeginsWith("GRAPH", TString::kIgnoreCase))
+  {
+    if (str.Length()>5)
+      sscanf(&str[5], "%d", &num);
+    
+    if (num>=GetNumPixels())
+      num= GetNumPixels();
+    
+    cout << "Drawing Graph of Pixel " << num << endl;
+    
+    const Int_t n = GetNumHiGainSamples();
+    
+    Float_t *x = new Float_t[n];
+    Float_t *y = new Float_t[n];
+    
+    for (int i=0; i<n; i++)
     {
-        if (str.Length()>5)
-            sscanf(&str[5], "%d", &num);
-
-        if (num>=GetNumPixels())
-            num= GetNumPixels();
-
-        cout << "Drawing Graph of Pixel " << num << endl;
-
-        const Int_t n = GetNumHiGainSamples();
-
-        Float_t *x = new Float_t[n];
-        Float_t *y = new Float_t[n];
-
-        for (int i=0; i<n; i++)
-        {
-            x[i] = i;
-            y[i] = (*fHiGainFadcSamples)[i + num*GetNumHiGainSamples()];
-        }
-
-        TGraph *graph = new TGraph(n, x, y);
-        graph->Draw("AC*");
-
-        return;
+      x[i] = i;
+      y[i] = (*fHiGainFadcSamples)[i + num*GetNumHiGainSamples()];
     }
-
-    if (str.BeginsWith("HIST", TString::kIgnoreCase))
-    {
-        cout << "Length: " << str.Length() << endl;
-
-        if (str.Length()>4)
-            sscanf(&str[4], "%d", &num);
-
-        if (num>=GetNumPixels())
-            num= GetNumPixels();
-
-        cout << "Drawing Histogram of Pixel " << num << endl;
-
-        const Int_t n = GetNumHiGainSamples();
-
-        char *name = new char[16];
-
-        sprintf(name, "Pixel No.%d", (*fHiGainPixId)[num]);
-
-        TH1F *hist = new TH1F(name, "Hi Gain Samples FADC", n, 0, n);
-
-        for (int i=0; i<n; i++)
-            hist->Fill(0.5+i, (*fHiGainFadcSamples)[i + num*GetNumHiGainSamples()]);
-
-        hist->Draw();
-
-        return;
-    }
-
-    cout << "MRawEvtData::Draw: Warning: You must specify either 'GRAPH' or 'HIST'" << endl;
+    
+    TGraph *graph = new TGraph(n, x, y);
+    graph->Draw("AC*");
+    
+    return;
+  }
+  
+  if (str.BeginsWith("HIST", TString::kIgnoreCase))
+  {
+    cout << "Length: " << str.Length() << endl;
+    
+    if (str.Length()>4)
+      sscanf(&str[4], "%d", &num);
+    
+    if (num>=GetNumPixels())
+      num= GetNumPixels();
+    
+    cout << "Drawing Histogram of Pixel " << num << endl;
+    
+    const Int_t n = GetNumHiGainSamples();
+    
+    char *name = new char[16];
+    
+    sprintf(name, "Pixel No.%d", (*fHiGainPixId)[num]);
+    
+    TH1F *hist = new TH1F(name, "Hi Gain Samples FADC", n, 0, n);
+    
+    for (int i=0; i<n; i++)
+      hist->Fill(0.5+i, (*fHiGainFadcSamples)[i + num*GetNumHiGainSamples()]);
+    
+    hist->Draw();
+
+    return;
+  }
+  
+  cout << "MRawEvtData::Draw: Warning: You must specify either 'GRAPH' or 'HIST'" << endl;
 }
 
Index: trunk/MagicSoft/Mars/mraw/MRawEvtPixelIter.cc
===================================================================
--- trunk/MagicSoft/Mars/mraw/MRawEvtPixelIter.cc	(revision 455)
+++ trunk/MagicSoft/Mars/mraw/MRawEvtPixelIter.cc	(revision 456)
@@ -1,2 +1,26 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+//  MRawEvtPixelIter
+//
+//  class to iterate over all pixels of one event.
+//  The calling is similar to a root iterator:
+//  
+//  MRawEvtData *evtdata;            // must be filled with data from somewhere
+//  MRawEvtPixelIter pixel(evtdata); // evtdata: ptr to event you want to iterate
+//
+//  while (pixel.Next())
+//  {
+//     // here you can access the actual time slices by using
+//     //   pixel.GetPixelId();
+//     //   pixel.GetHiGainFadcSamples()[i]; // i is the number of the slice
+//     //   pixel.IsLoGain();                // check if pixel has
+//     //   pixel.GetLoGainFadcSamples()[i]; // i is the number of the slice
+//
+//     // WARNING: Don't acces more time slices than available.
+//     //   Get the numbers by calling: evtdata->GetNum[Lo,Hi]GainSamples()
+//     //   This number is constant for one event
+//  }
+//
+///////////////////////////////////////////////////////////////////////////////
 #include "MRawEvtPixelIter.h"
 
@@ -8,10 +32,10 @@
 ClassImp(MRawEvtPixelIter)
 
-TObject *MRawEvtPixelIter::Next()
+MRawEvtData *MRawEvtPixelIter::Next()
 {
     //
     // if we are already at the last entry there is no 'next' entry anymore
     //
-    if (fNumHiGainEntry==fData->fHiGainPixId->GetSize()-1)
+    if (fNumHiGainEntry==fData->fHiGainPixId->GetSize())
         return NULL;
 
@@ -19,5 +43,5 @@
     // if we are already at the last entry there is no 'next' entry anymore
     //
-    if (fNumLoGainEntry != fData->fLoGainPixId->GetSize()-1)
+    if (fNumLoGainEntry != fData->fLoGainPixId->GetSize())
         if (*fHiGainId == *fLoGainId)
         {
@@ -56,7 +80,24 @@
     // set pointer to first entry of arrays
     //
-    fHiGainId   = (UShort_t*)fData->fHiGainPixId->GetArray();
-    fLoGainId   = (UShort_t*)fData->fLoGainPixId->GetArray();
-    fHiGainPos  = (Byte_t*)fData->fHiGainFadcSamples->GetArray();
-    fLoGainPos  = (Byte_t*)fData->fLoGainFadcSamples->GetArray();
+    fHiGainId   = fData->fHiGainPixId->GetArray()-1;
+    fLoGainId   = fData->fLoGainPixId->GetArray()-1;
+    fHiGainPos  = fData->fHiGainFadcSamples->GetArray()-fData->GetNumHiGainSamples();
+    fLoGainPos  = fData->fLoGainFadcSamples->GetArray()-fData->GetNumLoGainSamples();
 }
+
+void MRawEvtPixelIter::Draw(Option_t *t)
+{ 
+  //
+  // Draw the actual pixel (for options see: MRawEvtData::Draw)
+  //
+  char *txt = new char[6+strlen(t)];
+  sprintf(txt, "%s%d", t, *fHiGainId);
+  fData->Draw(txt);
+  delete txt; 
+}
+
+
+
+
+
+
Index: trunk/MagicSoft/Mars/mraw/MRawEvtPixelIter.h
===================================================================
--- trunk/MagicSoft/Mars/mraw/MRawEvtPixelIter.h	(revision 455)
+++ trunk/MagicSoft/Mars/mraw/MRawEvtPixelIter.h	(revision 456)
@@ -1,15 +1,18 @@
 #ifndef MRAWEVTPIXELITER_H
 #define MRAWEVTPIXELITER_H
-
+///////////////////////////////////////////////////////////////////////////////
+//
+//  MRawEvtPixelIter
+//
+//  class to iterate over all pixels of one event.
+//
+///////////////////////////////////////////////////////////////////////////////
 #ifndef MAGIC_H
 #include "MAGIC.h"
-#endif
-#ifndef ROOT_TIterator
-#include <TIterator.h>
 #endif
 
 class MRawEvtData;
 
-class MRawEvtPixelIter : public TIterator
+class MRawEvtPixelIter
 {
 private:
@@ -28,13 +31,8 @@
     MRawEvtPixelIter(MRawEvtData *dat) : fData(dat)
     {
-        //
-        // WARNING: The Iterator now points to the FIRST entry.
-        //          This means that you have to use a do...while loop
-        //          NOT a while() loop.
-        //
         Reset();
     }
 
-    TObject *Next();
+    MRawEvtData *Next();
 
     UShort_t GetPixelId() const
@@ -76,5 +74,7 @@
     void Reset();
 
-    ClassDef(MRawEvtPixelIter, 1)
+    void Draw(Option_t *t="GRAPH");
+
+    ClassDef(MRawEvtPixelIter, 1) // iterates over all pixels of one MRawEvtData object
 };
 
Index: trunk/MagicSoft/Mars/mraw/MRawRunHeader.cc
===================================================================
--- trunk/MagicSoft/Mars/mraw/MRawRunHeader.cc	(revision 455)
+++ trunk/MagicSoft/Mars/mraw/MRawRunHeader.cc	(revision 456)
@@ -12,4 +12,6 @@
 #include <iomanip.h>
 
+//#include <TClass.h>
+
 #include "MArrayS.h"
 
@@ -22,4 +24,7 @@
 
     fPixAssignment = new MArrayS(0);
+
+    // This is only valid for root > 3.0
+    // IsA()->CanIgnoreTObjectStreamer();
 }
 
Index: trunk/MagicSoft/Mars/readraw.cc
===================================================================
--- trunk/MagicSoft/Mars/readraw.cc	(revision 455)
+++ trunk/MagicSoft/Mars/readraw.cc	(revision 456)
@@ -11,22 +11,14 @@
 #include "MEvtLoop.h"
 
+#include "MTime.h"
 #include "MRawRunHeader.h"
 #include "MRawEvtHeader.h"
 #include "MRawEvtData.h"
 #include "MRawCrateArray.h"
-#include "MTime.h"
 #include "MInputStreamID.h"
 
 /////////////////////////////////////////////////////////////////////////////
 //
-// This is an easy implementation of the Merging process (as compilable prog)
-//
-// at the moment it reads a binary file ("rawtest.bin") which was written
-// in the DAQ raw format.
-//
-// The data are stored in root container objects (classes derived from
-// TObject like MRawRunHeader)
-//
-// This containers are written to a root file ("rawtest.root")
+// This is an demonstration how to read in a merpped root file
 //
 /////////////////////////////////////////////////////////////////////////////
@@ -35,5 +27,5 @@
 {
     cout << "==================================================" << endl ;
-    cout << "                   MERPP v0.1" << endl;
+    cout << "                   ReadRaw v0.1" << endl;
     cout << "      MARS Merging and Preprocessing Program" << endl ;
     cout << "            Compiled on <" << __DATE__ << ">" << endl ;
@@ -44,9 +36,24 @@
     // check for the right usage of the program
     //
+    if (argc!=2)
+    {
+        cout << "Sorry the usage is:" << endl;
+        cout << "   readraw inputfile" << endl << endl;
+        return -1;
+    }
 
     //
     //     initialize ROOT  (this is obligatory here)
     //
-    TROOT simple("Merpp","Mars - Merging and Preprocessing Program");
+    TROOT simple("Readraw","Mars - Merging and Preprocessing Program");
+
+    //
+    // check whether the given files are OK.
+    //
+    if (gSystem->AccessPathName(argv[1], kFileExists))
+    {
+        cout << "Sorry, the file '" << argv[1] << "' doesn't exist." << endl;
+        return -1;
+    }
 
     MRawRunHeader  *runheader = new MRawRunHeader();
@@ -88,8 +95,8 @@
     evttree->GetBranch("MRawCrateArray")->SetAddress(&evtcrate);
 
-    Int_t iEnt = (Int_t)evttree->GetEntries();
-    cout << " Entries in Tree Data: " << dec << iEnt << endl;
+    Int_t nent = (Int_t)evttree->GetEntries();
+    cout << " Entries in Tree Data: " << dec << nent << endl;
 
-    for (Int_t i = 0; i<iEnt; i++)
+    for (Int_t i = 0; i<nent; i++)
     {
         cout << "Entry: " << i << endl;
