Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 603)
+++ trunk/MagicSoft/Mars/Changelog	(revision 604)
@@ -1,3 +1,39 @@
                                                                   -*-*- END -*-*-
+ 
+ 2000/02/21: Thomas Bretz
+
+   * MRawEvtData.cc: Changed ReadEvt according to the new 
+     raw binary format 2001/02/20
+     
+   * Added MLog.[h,cc], MLogManip.[h,cc]
+   
+   * Adde SetStreamer and fLog to the MParContainer base class
+   
+   * Derived MEvtLoop from MParContainer
+
+   * Makefile: added 'tar'
+
+   * mbase/BaseIncl.h: added fstream.h, TGListBox.h
+ 
+   * mbase/BaseLinkDef.h: added pragma for gLog and MLog
+ 
+   * mbase/MAGIC.h: added forward definition for gLog
+ 
+   * mbase/MEvtLoop.cc: exchanged cout with *fLog, added statements 
+     to provide log-facility to all tasks als parameter containers
+    
+   * mbase/MEvtLoop.h: Small changes
+  
+   * mbase/MParContainer.h: Added definitions necessary for use of Log-Facility
+  
+   * mbase/MParList.[h,cc]: Added SetLogStream
+  
+   * mbase/MTask.h: added fLog
+  
+   * mbase/MTaskList.[h,cc]: added SetLogStream
+  
+   * mbase/Makefile: Added MLog.cc, MLogManip.cc
+
+
  2000/02/19: Harald Kornmayer	
 
@@ -12,4 +48,5 @@
 	macros/readCT1.C
  
+
  2000/02/19: Thomas Bretz
 
Index: trunk/MagicSoft/Mars/Makefile
===================================================================
--- trunk/MagicSoft/Mars/Makefile	(revision 603)
+++ trunk/MagicSoft/Mars/Makefile	(revision 604)
@@ -101,4 +101,8 @@
 	@echo "cd .."
 
+tar:	mrproper
+	@echo "Making tar-file"
+	@tar -cvf ../mars.tar *
+	@gzip -9 ../mars.tar
 
 # @endcode
Index: trunk/MagicSoft/Mars/mbase/BaseIncl.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/BaseIncl.h	(revision 603)
+++ trunk/MagicSoft/Mars/mbase/BaseIncl.h	(revision 604)
@@ -1,6 +1,10 @@
 #ifndef __CINT__
+
+#include <fstream.h>
 
 #include <TFile.h>
 #include <TTree.h>
 
+#include <TGListBox.h>
+
 #endif // __CINT__
Index: trunk/MagicSoft/Mars/mbase/BaseLinkDef.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/BaseLinkDef.h	(revision 603)
+++ trunk/MagicSoft/Mars/mbase/BaseLinkDef.h	(revision 604)
@@ -4,4 +4,8 @@
 #pragma link off all classes;
 #pragma link off all functions;
+
+#pragma link C++ global gLog;
+
+#pragma link C++ class MLog;
 
 #pragma link C++ class MTask;
Index: trunk/MagicSoft/Mars/mbase/MAGIC.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MAGIC.h	(revision 603)
+++ trunk/MagicSoft/Mars/mbase/MAGIC.h	(revision 604)
@@ -30,3 +30,10 @@
 const Int_t kIRON   = 5626;
 
+//
+// This is the definition of a global output stream, which by
+// default pipes all output to the stdout
+//
+class MLog;
+extern MLog gLog;
+
 #endif
Index: trunk/MagicSoft/Mars/mbase/MEvtLoop.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MEvtLoop.cc	(revision 603)
+++ trunk/MagicSoft/Mars/mbase/MEvtLoop.cc	(revision 604)
@@ -28,4 +28,5 @@
 #include <TStopwatch.h>
 
+#include "MLog.h"
 #include "MParList.h"
 #include "MTaskList.h"
@@ -33,5 +34,5 @@
 ClassImp(MEvtLoop)
 
-MEvtLoop::MEvtLoop() : fParlist(NULL)
+MEvtLoop::MEvtLoop() : fParList(NULL)
 {
 }
@@ -39,9 +40,4 @@
 MEvtLoop::~MEvtLoop()
 {
-}
-
-void MEvtLoop::SetParList(MParList *p)
-{
-    fParlist = p;
 }
 
@@ -56,7 +52,7 @@
     // check if the needed parameter list is set.
     //
-    if (!fParlist)
+    if (!fParList)
     {
-        cout << "MEvtLoop::Eventloop - Error: Parlist not initialized." << endl;
+        *fLog << "MEvtLoop::Eventloop - Error: Parlist not initialized." << endl;
         return kFALSE;
     }
@@ -66,9 +62,15 @@
     //  the default name is "MTaskList"
     //
-    fTaskList = (MTaskList*)fParlist->FindObject(tlist);
+    fTaskList = (MTaskList*)fParList->FindObject(tlist);
     if (!fTaskList)
     {
-        cout << "MEvtLoop::Eventloop - Error: Cannot find tasklist '" << tlist << "' in parameter list." << endl;
+        *fLog << "MEvtLoop::Eventloop - Error: Cannot find tasklist '" << tlist << "' in parameter list." << endl;
         return kFALSE;
+    }
+
+    if (fLog != &gLog)
+    {
+        fParList ->SetLogStream(fLog);
+        fTaskList->SetLogStream(fLog);
     }
 
@@ -78,7 +80,7 @@
     //  the parameter list
     //
-    if (!fTaskList->PreProcess(fParlist))
+    if (!fTaskList->PreProcess(fParList))
     {
-        cout << "Error detected while PreProcessing" << endl;
+        *fLog << "Error detected while PreProcessing" << endl;
         return kFALSE;
     }
@@ -98,12 +100,12 @@
     //   each event
     //
-    cout << endl << "Eventloop running (";
+    *fLog << endl << "Eventloop running (";
 
     if (maxcnt<0)
-        cout << "all";
+        *fLog << "all";
     else
-        cout << dec << maxcnt;
+        *fLog << dec << maxcnt;
 
-    cout << " events)..." << flush;
+    *fLog << " events)..." << flush;
 
     Int_t dummy = maxcnt<0 ? 0 : maxcnt;
@@ -130,9 +132,9 @@
     clock.Stop();
 
-    cout << "Ready!" << endl << endl;
+    *fLog << "Ready!" << endl << endl;
 
     clock.Print();
 
-    cout << dec << endl
+    *fLog << dec << endl
         << "Time: " << clock.CpuTime() << "s"
         << " for " << (maxcnt<0?dummy:maxcnt) << " Events"
Index: trunk/MagicSoft/Mars/mbase/MEvtLoop.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MEvtLoop.h	(revision 603)
+++ trunk/MagicSoft/Mars/mbase/MEvtLoop.h	(revision 604)
@@ -14,11 +14,15 @@
 #endif
 
+#ifndef MPARCONTAINER_H
+#include "MParContainer.h"
+#endif
+
 class MParList;
 class MTaskList;
 
-class MEvtLoop
+class MEvtLoop : public MParContainer
 {
 private:
-    MParList  *fParlist;
+    MParList  *fParList;
     MTaskList *fTaskList;
 
@@ -27,5 +31,5 @@
     virtual ~MEvtLoop();
 
-    void SetParList(MParList *p);
+    void SetParList(MParList *p)  { fParList = p; }
 
     Bool_t PreProcess(const char *tlist="MTaskList");
Index: trunk/MagicSoft/Mars/mbase/MLog.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MLog.cc	(revision 604)
+++ trunk/MagicSoft/Mars/mbase/MLog.cc	(revision 604)
@@ -0,0 +1,149 @@
+#include "MLog.h"
+
+#include <fstream.h>
+#include <TGListBox.h>
+
+#include "MLogManip.h"
+
+ClassImp(MLog)
+
+//
+// This is the definition of the global log facility
+//
+MLog gLog;
+
+void MLog::Init()
+{
+    //
+    // this strange usage of an unbufferd buffer is a workaround
+    // to make it work on Alpha and Linux!
+    //
+    setp(&fBuffer, &fBuffer+1);
+    *this << '\0';
+}
+
+MLog::MLog(int i) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(i), fout(NULL), fOutAllocated(kFALSE), fgui(NULL)
+{
+    Init();
+}
+
+MLog::MLog(ofstream &out) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(eFile), fout(&out), fOutAllocated(kFALSE), fgui(NULL)
+{
+    Init();
+}
+
+MLog::MLog(TGListBox &out) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(eGui), fout(NULL), fOutAllocated(kFALSE), fgui(&out)
+{
+    Init();
+}
+
+MLog::MLog(const char *fname, int flag) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(eFile), fgui(NULL)
+{
+    Init();
+
+    AllocateFile(fname);
+    CheckFlag(eFile, flag);
+}
+
+void MLog::Write()
+{
+    const int len = fPPtr - fBase;
+
+    if (fDevice&eStdout)
+        cout.write(fBase, len);
+
+    if (fDevice&eStderr)
+        cerr.write(fBase, len);
+
+    if (fDevice&eFile && fout)
+        fout->write(fBase, len);
+
+    if (fDevice&eGui && fgui)
+    {
+        char dummy[bsz+1];
+        memcpy(dummy, fBase, bsz);
+        *(dummy+bsz)='\0';
+        fgui->AddEntry(dummy, -1);
+    }
+
+    //
+    // restart writing to the buffer at its first char
+    //
+    fPPtr = fBase;
+}
+
+int MLog::sync()
+{
+//    cout << "*sync*";
+    Write();
+
+    if (fDevice&eStdout)
+        cout.flush();
+
+    if (fDevice&eStderr)
+        cerr.flush();
+
+    if (fDevice&eFile && fout)
+        fout->flush();
+
+    return 0;
+}
+
+int MLog::overflow(int i) // i=EOF means not a real overflow
+{
+    //
+    // This function comes from streambuf and should
+    // output the buffer to the device (flush, endl)
+    // or handle a buffer overflow (too many chars)
+    // If a real overflow happens i contains the next
+    // chars which doesn't fit into the buffer anymore.
+    // If the buffer is not really filled i is EOF(-1).
+    //
+    if (fOutputLevel < fDebugLevel)
+    {
+        *fPPtr++ = (char)i;
+
+        if (fPPtr == fEPtr)
+            Write();
+    }
+
+    return 0;
+}
+
+void MLog::AllocateFile(const char *fname)
+{
+    //
+    // Create a new instance of an file output stream
+    // an set the corresponding flag
+    //
+    fout = new ofstream(fname);
+    fOutAllocated = kTRUE;
+}
+
+void MLog::DeallocateFile()
+{
+    //
+    // if fout was allocated by this instance of MLooging
+    // delete it.
+    //
+    if (fOutAllocated)
+        delete fout;
+}
+
+void MLog::ReallocateFile(const char *fname)
+{
+    //
+    // if necessary delete the old in stance of the file
+    // output stream and create a new one
+    //
+    DeallocateFile();
+    AllocateFile(fname);
+}
+
+void MLog::CheckFlag(Flags_t chk, int flag)
+{
+    if (flag==-1)
+        return;
+
+    flag ? EnableOutputDevice(chk) : DisableOutputDevice(chk);
+}
Index: trunk/MagicSoft/Mars/mbase/MLog.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MLog.h	(revision 604)
+++ trunk/MagicSoft/Mars/mbase/MLog.h	(revision 604)
@@ -0,0 +1,121 @@
+#ifndef MLOG_H
+#define MLOG_H
+
+#ifndef MAGIC_H
+#include "MAGIC.h"
+#endif
+
+#include <TObject.h>
+
+#include <stdio.h>     // tmpname
+#include <iostream.h>  // base classes for MLog
+
+#define bsz    160 // two standard lines
+
+class TGListBox;
+
+class MLog : public streambuf, public ostream, public TObject
+{
+public:
+    typedef enum _flags { eStdout = 0x1, eStderr = 0x2, eFile = 0x4, eGui = 0x8 } Flags_t;
+
+private:
+    char        fBuffer;     //!
+    char        fBase[bsz];  //! Buffer to store the data in
+    char       *fPPtr;       //! Pointer to present position in buffer
+    const char *fEPtr;       //! Pointer to end of buffer
+
+    UInt_t fOutputLevel;     //! Present output level of the stream
+    UInt_t fDebugLevel;      //! Present global debug level
+    UInt_t fDevice;          //! Flag to indicate the present streams
+
+    ofstream  *fout;          //! possible file output stream
+    Bool_t     fOutAllocated; //! flag if fout is created by MLogging
+    TGListBox *fgui;          //! Listbox output
+
+    void Init();
+
+    void Write();
+    int sync();
+    int overflow(int i); // i=EOF means not a real overflow
+
+    void AllocateFile(const char *f);
+    void DeallocateFile();
+    void ReallocateFile(const char *f);
+    void CheckFlag(Flags_t chk, int flag);
+
+public:
+    MLog(int i=eStdout);
+    MLog(ofstream &out);
+    MLog(TGListBox &out);
+    MLog(const char *fname, int flag=-1);
+
+    MLog(MLog &log) { }
+
+    ~MLog()
+    {
+        DeallocateFile();
+    }
+
+    void SetDebugLevel(int i)           { fDebugLevel  =  i;  }
+    void SetOutputLevel(int i)          { fOutputLevel =  i;  }
+    void SetOutputDevice(int i)         { fDevice      =  i;  }
+    void EnableOutputDevice(Flags_t f)  { fDevice     |=  f;  }
+    void DisableOutputDevice(Flags_t f) { fDevice     &= ~f;  }
+    void operator=(ofstream &out)       { SetOutputFile(out); }
+    void operator=(TGListBox *out)      { SetOutputGui(out);  }
+
+    void SetOutputGui(TGListBox *out, int flag=-1)
+    {
+        fgui = out;
+        CheckFlag(eGui, flag);
+    }
+
+    void SetOutputFile(ofstream &out, int flag=-1)
+    {
+        //
+        // Set new output file by a given stream. The new output
+        // file is not deleted automatically. If no flag is specified
+        // the state of the file-device stream is unchanged.
+        // if the a flag is specified the state is changed
+        // in correspondance to the flag
+        //
+        DeallocateFile();
+        fout = &out;
+        CheckFlag(eFile, flag);
+    }
+
+    void SetOutputFile(const char *f=tmpnam(NULL), int flag=-1)
+    {
+        //
+        // Set new output file by name. The new output file must
+        // not be deleted by the user. If no flag is specified
+        // the state of the file-device stream is unchanged.
+        // if the a flag is specified the state is changed
+        // in correspondance to the flag
+        //
+        ReallocateFile(f);
+        CheckFlag(eFile, flag);
+    }
+
+    ofstream &GetOutputFile()
+    {
+        //
+        // Get the file output stream from MLogging
+        // if no file output stream is existing yet it will be created.
+        // For the creating a C-Temporary file name is used.
+        // if the stream is created here the user must not delete it
+        //
+        // What a pitty, but it seems, that there is now way to ask
+        // an ofstream for the corresponding file name. Elsewhise
+        // I would implement a GetFileName-function, too.
+        //
+        if (!fout)
+            ReallocateFile(tmpnam(NULL));
+        return *fout;
+    }
+
+    ClassDef(MLog, 1)
+};
+
+#endif
Index: trunk/MagicSoft/Mars/mbase/MLogManip.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MLogManip.cc	(revision 604)
+++ trunk/MagicSoft/Mars/mbase/MLogManip.cc	(revision 604)
@@ -0,0 +1,85 @@
+#include "MLog.h"
+#include "MLogManip.h"
+
+// ----------------------------------------------------------------
+//            Definitions of the manipulator functions
+// ----------------------------------------------------------------
+
+ostream& __omanip_debug(ostream& lout, int i)
+{
+    //
+    // get the streambuf of the stream
+    // get the pointer to the parent class by casting
+    // set the output level of the logging stream
+    //
+    // Be careful: This manipulator can only be used in MLogging
+    // streams - in other streams SetOutputLevel is a call
+    // of a non existing function
+    //
+    // Be careful 2: The change is valid for everything which is
+    // in the present buffer. This means it can also affect a
+    // part of the stream which is already in the stream but not flushed
+    // to the output device. A flush occures either if you tell a stream
+    // to flush (flush, endl) or if an buffer overflow occures, the
+    // last behaviour could be changed if someone want to have a dynamic
+    // buffer.
+    //
+    MLog *log=(MLog*)lout.rdbuf();
+//    cout << " -" << i << "- ";
+    log->SetOutputLevel(i);
+    return lout;
+}
+
+ostream& __omanip_device(ostream& lout, int i)
+{
+    //
+    // get the streambuf of the stream
+    // get the pointer to the parent class by casting
+    // set the output device of the logging stream, more than
+    // one output device can be ored together
+    //
+    // Be careful: This manipulator can only be used in MLogging
+    // streams - in other streams SetOutputLevel is a call
+    // of a non existing function
+    //
+    MLog *log=(MLog*)lout.rdbuf();
+    log->SetOutputDevice(i);
+    return lout;
+}
+
+ostream& __omanip_edev(ostream& lout, int i)
+{
+    //
+    // get the streambuf of the stream
+    // get the pointer to the parent class by casting
+    // Enable an output device of the logging stream, it should
+    // be possible to enable more than one output device at the
+    // same time by oring them together
+    //
+    // Be careful: This manipulator can only be used in MLogging
+    // streams - in other streams SetOutputLevel is a call
+    // of a non existing function
+    //
+    MLog *log=(MLog*)lout.rdbuf();
+    log->EnableOutputDevice((MLog::_flags)i);
+    return lout;
+}
+
+ostream& __omanip_ddev(ostream& lout, int i)
+{
+    //
+    // get the streambuf of the stream
+    // get the pointer to the parent class by casting
+    // Disable an output device of the logging stream, it should
+    // be possible to disable more than one output device at the
+    // same time by oring them together
+    //
+    // Be careful: This manipulator can only be used in MLogging
+    // streams - in other streams SetOutputLevel is a call
+    // of a non existing function
+    //
+    MLog *log=(MLog*)lout.rdbuf();
+    log->DisableOutputDevice((MLog::_flags)i);
+    return lout;
+}
+
Index: trunk/MagicSoft/Mars/mbase/MLogManip.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MLogManip.h	(revision 604)
+++ trunk/MagicSoft/Mars/mbase/MLogManip.h	(revision 604)
@@ -0,0 +1,88 @@
+#ifndef MLOGMANIP_H
+#define MLOGMANIP_H
+
+#include <iomanip.h>
+
+// ----------------------------------------------------------------
+//                 Definitions of the manipulators
+// ----------------------------------------------------------------
+
+//
+// define a general simple macro for manipulator definitions (int)
+//
+#ifndef OMANIP
+
+#define MANIPULATOR(name) \
+    extern ostream& __omanip_##name(ostream& lout, int i); \
+    inline omanip<int> ##name(int i)                \
+    {                                               \
+        return omanip<int>(__omanip_##name, i);    \
+    }
+
+#else
+
+#define MANIPULATOR(name) \
+    extern ostream& __omanip_##name(ostream& lout, int i); \
+    inline OMANIP(int) ##name(int i)                \
+    {                                               \
+        return OMANIP(int)(__omanip_##name, i);    \
+    }
+
+#endif
+//
+// definitions
+//
+MANIPULATOR(debug);    // set debug level
+MANIPULATOR(device);   // set ouput devices
+MANIPULATOR(edev);     // enable additional output devices
+MANIPULATOR(ddev);     // disable given output
+//#ifndef __CINT__
+//__DEFINE_IOMANIP_FN1(smanip, int, debug);    // set debug level
+//__DEFINE_IOMANIP_FN1(smanip, int, device);   // set ouput devices
+//__DEFINE_IOMANIP_FN1(smanip, int, edev);     // enable additional output devices
+//__DEFINE_IOMANIP_FN1(smanip, int, ddev);     // disable given output
+//#endif
+
+// ----------------------------------------------------------------
+//                         Debug helper macros
+// ----------------------------------------------------------------
+
+//
+// Output debug information into the stream
+//  - this can only be done by a macro
+//
+#ifndef __CINT__
+#define __DINF__        __FILE__ << " " << __LINE__ << ": "
+#endif
+//
+// flush the old buffer, set a new debug level
+// and output the debug information code
+//
+// Be careful: Only use them with a MLogging stream facility.
+// Remark:     All this is compiled into the code.
+//
+#ifndef __CINT__
+#define DEBUG(lvl)      flush << debug(lvl) << __DINF__
+#endif
+
+/*
+class SMANIP(T) {
+    ios& (*fct)(ios&,T) ;
+    T arg ;
+public:
+    SMANIP(T)(ios& (*f)(ios&, T), T a) :
+        fct(f), arg(a) { }
+        friend istream& operator>>(istream& i, const SMANIP(T)& m)
+        {
+            ios* s = &i ;
+            (*m.fct)(*s,m.arg) ; return i ;
+        }
+        friend ostream& operator<<(ostream& o, const SMANIP(T)& m)
+        {
+            ios* s = &o ;
+            (*m.fct)(*s,m.arg) ; return o ;
+        }
+} ;
+*/
+
+#endif
Index: trunk/MagicSoft/Mars/mbase/MParContainer.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MParContainer.h	(revision 603)
+++ trunk/MagicSoft/Mars/mbase/MParContainer.h	(revision 604)
@@ -9,6 +9,7 @@
 //                                                                      //
 //////////////////////////////////////////////////////////////////////////
-
-#include <fstream.h>
+#ifndef MAGIC_H
+#include "MAGIC.h"
+#endif
 
 #ifndef ROOT_TObject
@@ -18,4 +19,8 @@
 #include <TString.h>
 #endif
+
+class MLog;
+class ofstream;
+class ifstream;
 
 class MParContainer : public TObject
@@ -31,12 +36,17 @@
 
 protected:
-    TString   *fName;            //! parameter container identifier (name)
-    TString   *fTitle;           //! parameter container title
+    MLog    *fLog;    //! The general log facility for this object, initialized with the global object
+
+    TString *fName;   //! parameter container identifier (name)
+    TString *fTitle;  //! parameter container title
 
 public:
-    MParContainer(const char *name="", const char *title="") { Init(name, title); }
-    MParContainer(const TString &name, const TString &title)  { Init(name, title); }
+    MParContainer(const char *name="", const char *title="") : fLog(&gLog) { Init(name, title); }
+    MParContainer(const TString &name, const TString &title) : fLog(&gLog) { Init(name, title); }
     MParContainer(const MParContainer &named);
     MParContainer& operator=(const MParContainer& rhs);
+
+    void SetLogStream(MLog *log) { fLog = log; }
+
     virtual ~MParContainer() { 
       //delete fName; delete fTitle;
Index: trunk/MagicSoft/Mars/mbase/MParList.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MParList.cc	(revision 603)
+++ trunk/MagicSoft/Mars/mbase/MParList.cc	(revision 604)
@@ -42,4 +42,19 @@
 }
 
+void MParList::SetLogStream(MLog *log)
+{
+    //
+    //  create the Iterator over the tasklist
+    //
+    TIter Next(&fContainer);
+
+    MParContainer *cont=NULL;
+
+    //
+    // loop over all tasks for preproccesing
+    //
+    while ( (cont=(MParContainer*)Next()) )
+        cont->SetLogStream(log);
+}
 
 Bool_t MParList::AddToList(MParContainer *obj, MParContainer *where)
Index: trunk/MagicSoft/Mars/mbase/MParList.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MParList.h	(revision 603)
+++ trunk/MagicSoft/Mars/mbase/MParList.h	(revision 604)
@@ -20,4 +20,5 @@
 #endif
 
+class MLog;
 class MParContainer;
 
@@ -40,4 +41,6 @@
     Bool_t AddToList(MParContainer *obj, MParContainer *where = NULL);
 
+    void SetLogStream(MLog *log);
+
     TObject *FindObject(const char *name) const;
 
Index: trunk/MagicSoft/Mars/mbase/MTask.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MTask.h	(revision 603)
+++ trunk/MagicSoft/Mars/mbase/MTask.h	(revision 604)
@@ -18,4 +18,5 @@
 class MTask : public MInputStreamID
 {
+    MLog *fLog; //!
 
 public:
Index: trunk/MagicSoft/Mars/mbase/MTaskList.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MTaskList.cc	(revision 603)
+++ trunk/MagicSoft/Mars/mbase/MTaskList.cc	(revision 604)
@@ -41,4 +41,21 @@
 }
 
+void MTaskList::SetLogStream(MLog *log)
+{
+    //
+    //  create the Iterator over the tasklist
+    //
+    TIter Next(&fTasks);
+
+    MTask *task=NULL;
+
+    //
+    // loop over all tasks for preproccesing
+    //
+    while ( (task=(MTask*)Next()) )
+        task->SetLogStream(log);
+}
+
+
 Bool_t MTaskList::AddToList(MTask *task, const char *type, MTask *where)
 {
@@ -94,5 +111,5 @@
     //  create the Iterator over the tasklist
     //
-    TIter next(&fTasks);
+    TIter Next(&fTasks);
 
     MTask *task=NULL;
@@ -101,5 +118,5 @@
     // loop over all tasks for preproccesing
     //
-    while ( (task=(MTask*)next()) )
+    while ( (task=(MTask*)Next()) )
     {
         cout << task->GetName() << "... " << flush;
@@ -123,5 +140,5 @@
   //  create the Iterator for the TaskList
   //
-  TIter next(&fTasks);
+  TIter Next(&fTasks);
   MTask *task=NULL;
     
@@ -129,5 +146,5 @@
   // loop over all tasks for processing 
   //
-  while ( (task=(MTask*)next()) )
+  while ( (task=(MTask*)Next()) )
   {
       if (!strcmp(GetStreamId(), task->GetStreamId()) ||
@@ -170,5 +187,5 @@
   //  create the Iterator for the TaskList
   //
-  TIter next(&fTasks);
+  TIter Next(&fTasks);
   
   MTask *task=NULL;
@@ -177,5 +194,5 @@
   //  loop over all tasks for postprocessing
   //  
-  while ( (task=(MTask*)next()) )
+  while ( (task=(MTask*)Next()) )
   {
       cout << task->GetName() << "... " << flush;
Index: trunk/MagicSoft/Mars/mbase/MTaskList.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MTaskList.h	(revision 603)
+++ trunk/MagicSoft/Mars/mbase/MTaskList.h	(revision 604)
@@ -17,4 +17,5 @@
 #endif
 
+class MLog;
 class MParList;
 class MInputStreamID;
@@ -31,4 +32,6 @@
     MTaskList(MTaskList &ts);
 
+    void SetLogStream(MLog *log);
+
     Bool_t AddToList(MTask *task, const char *tType="All", MTask *where = NULL);
 
Index: trunk/MagicSoft/Mars/mbase/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mbase/Makefile	(revision 603)
+++ trunk/MagicSoft/Mars/mbase/Makefile	(revision 604)
@@ -41,5 +41,7 @@
 	   MArrayB.cc \
 	   MArrayS.cc \
-           MTime.cc
+           MTime.cc \
+           MLog.cc \
+           MLogManip.cc
 
 SRCS    = $(SRCFILES)
Index: trunk/MagicSoft/Mars/mraw/MRawEvtData.cc
===================================================================
--- trunk/MagicSoft/Mars/mraw/MRawEvtData.cc	(revision 603)
+++ trunk/MagicSoft/Mars/mraw/MRawEvtData.cc	(revision 604)
@@ -317,4 +317,7 @@
         const UShort_t npix = fRunHeader->GetPixAssignment(i);
 
+        fin.read((Byte_t*)hi.GetArray(), nhi);
+        AddPixel(npix, &hi, kFALSE);
+
         // FIXME: Not implemented in the raw files yet
         //if (IsLoGainOn(i, j))
@@ -323,7 +326,4 @@
         AddPixel(npix, &lo, kTRUE);
         //}
-
-        fin.read((Byte_t*)hi.GetArray(), nhi);
-        AddPixel(npix, &hi, kFALSE);
     }
 }
