Index: trunk/MagicSoft/Mars/macros/readrep.C
===================================================================
--- trunk/MagicSoft/Mars/macros/readrep.C	(revision 2520)
+++ trunk/MagicSoft/Mars/macros/readrep.C	(revision 2520)
@@ -0,0 +1,72 @@
+/* ======================================================================== *\
+!
+! *
+! * This file is part of MARS, the MAGIC Analysis and Reconstruction
+! * Software. It is distributed to you in the hope that it can be a useful
+! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
+! * It is distributed WITHOUT ANY WARRANTY.
+! *
+! * Permission to use, copy, modify and distribute this software and its
+! * documentation for any purpose is hereby granted without fee,
+! * provided that the above copyright notice appear in all copies and
+! * that both that copyright notice and this permission notice appear
+! * in supporting documentation. It is provided "as is" without express
+! * or implied warranty.
+! *
+!
+!
+!   Author(s): Thomas Bretz, 11/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2003
+!
+!
+\* ======================================================================== */
+/*
+Bool_t HandleInput()
+{
+    TTimer timer("gSystem->ProcessEvents();", 50, kFALSE);
+    while (1)
+    {
+        //
+        // While reading the input process gui events asynchronously
+        //
+        timer.TurnOn();
+        TString input = Getline("Type 'q' to exit, <return> to go on: ");
+        timer.TurnOff();
+
+        if (input=="q\n")
+            return kFALSE;
+
+        if (input=="\n")
+            return kTRUE;
+    };
+
+    return kFALSE;
+}
+*/
+void readrep(const char *fname="CC_2003_11_04_23_53_18.rep")
+{
+    MParList  plist;
+    MTaskList tlist;
+    plist.AddToList(&tlist);
+
+    MReportFileRead read(fname);
+    tlist.AddToList(&read);
+
+    MReportDAQ daq;
+    MReportDrive drive;
+    MReportCamera camera;
+    MReportTrigger trigger;
+    read.AddToList(&daq);
+    read.AddToList(&drive);
+    read.AddToList(&camera);
+    read.AddToList(&trigger);
+
+    MEvtLoop evtloop;
+    evtloop.SetParList(&plist);
+
+    if (!evtloop.Eventloop())
+        return;
+
+    tlist.PrintStatistics();
+}
Index: trunk/MagicSoft/Mars/mreport/MReport.cc
===================================================================
--- trunk/MagicSoft/Mars/mreport/MReport.cc	(revision 2520)
+++ trunk/MagicSoft/Mars/mreport/MReport.cc	(revision 2520)
@@ -0,0 +1,76 @@
+/* ======================================================================== *\
+!
+! *
+! * This file is part of MARS, the MAGIC Analysis and Reconstruction
+! * Software. It is distributed to you in the hope that it can be a useful
+! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
+! * It is distributed WITHOUT ANY WARRANTY.
+! *
+! * Permission to use, copy, modify and distribute this software and its
+! * documentation for any purpose is hereby granted without fee,
+! * provided that the above copyright notice appear in all copies and
+! * that both that copyright notice and this permission notice appear
+! * in supporting documentation. It is provided "as is" without express
+! * or implied warranty.
+! *
+!
+!
+!   Author(s): Thomas Bretz, 11/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2003
+!
+!
+\* ======================================================================== */
+
+//////////////////////////////////////////////////////////////////////////////
+//
+//  MReport
+//
+//////////////////////////////////////////////////////////////////////////////
+#include "MReport.h"
+
+#include "MLogManip.h"
+
+#include "MTime.h"
+
+ClassImp(MReport);
+
+using namespace std;
+
+Bool_t MReport::Interprete(TString &str)
+{
+    if (!InterpreteHeader(str))
+        return kFALSE;
+
+    return InterpreteBody(str);
+}
+
+Bool_t MReport::InterpreteBody(TString &str)
+{
+    *fLog << warn << "No interpreter existing for: " << fIdentifier << endl;
+    return kTRUE;
+}
+
+Bool_t MReport::InterpreteHeader(TString &str)
+{
+    int len, state;
+    int hor, min, sec, ms;
+
+    int n = sscanf(str.Data(),
+                   " %d %*d %*d %*d %d %d %d %d "
+                   "%*d %*d %*d %*d %*d %*d %*d %*d"
+                   "%n",
+                   &state, &hor, &min, &sec, &ms, &len);
+    if (n!=5)
+    {
+        *fLog << err << "ERROR - Cannot interprete Body of " << fIdentifier << endl;
+        return kFALSE;
+    }
+
+    fState=state;
+    if (fTime)
+        fTime->SetTime(hor, min, sec, ms*1000000);
+
+    str.Remove(0, len);
+    return kTRUE;
+}
Index: trunk/MagicSoft/Mars/mreport/MReport.h
===================================================================
--- trunk/MagicSoft/Mars/mreport/MReport.h	(revision 2520)
+++ trunk/MagicSoft/Mars/mreport/MReport.h	(revision 2520)
@@ -0,0 +1,46 @@
+#ifndef MARS_MReport
+#define MARS_MReport
+
+#ifndef MARS_MParContainer
+#include "MParContainer.h"
+#endif
+
+class MTime;
+
+class MReport : public MParContainer
+{
+private:
+    const TString fIdentifier; //!
+
+    Byte_t  fState;
+    MTime  *fTime;
+
+    ULong_t Hash() const { return fIdentifier.Hash(); }
+    Bool_t InterpreteHeader(TString &str);
+
+public:
+    MReport(const char *id) : fIdentifier(id), fState(0xff), fTime(0) { }
+
+    virtual Bool_t InterpreteBody(TString &str);
+    Bool_t Interprete(TString &str);
+    Bool_t CheckIdentifier(TString &str) const
+    {
+        if (!str.BeginsWith(fIdentifier))
+            return kFALSE;
+
+        str.Remove(0, fIdentifier.Length());
+        str = str.Strip(TString::kBoth);
+
+        return kTRUE;
+    }
+
+    const TString &GetIdentifier() const { return fIdentifier; }
+
+    void SetTime(MTime *t) { fTime = t; }
+
+    static Bool_t ReadAngle(TString &str, Double_t &ret);
+
+    ClassDef(MReport, 0) // Base class for control reports
+};
+
+#endif
Index: trunk/MagicSoft/Mars/mreport/MReportCamera.cc
===================================================================
--- trunk/MagicSoft/Mars/mreport/MReportCamera.cc	(revision 2520)
+++ trunk/MagicSoft/Mars/mreport/MReportCamera.cc	(revision 2520)
@@ -0,0 +1,51 @@
+/* ======================================================================== *\
+!
+! *
+! * This file is part of MARS, the MAGIC Analysis and Reconstruction
+! * Software. It is distributed to you in the hope that it can be a useful
+! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
+! * It is distributed WITHOUT ANY WARRANTY.
+! *
+! * Permission to use, copy, modify and distribute this software and its
+! * documentation for any purpose is hereby granted without fee,
+! * provided that the above copyright notice appear in all copies and
+! * that both that copyright notice and this permission notice appear
+! * in supporting documentation. It is provided "as is" without express
+! * or implied warranty.
+! *
+!
+!
+!   Author(s): Thomas Bretz, 11/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2003
+!
+!
+\* ======================================================================== */
+
+//////////////////////////////////////////////////////////////////////////////
+//
+//  MReportCamera
+//
+//////////////////////////////////////////////////////////////////////////////
+#include "MReportCamera.h"
+
+#include "MLogManip.h"
+
+#include "MAstro.h"
+
+ClassImp(MReportCamera);
+
+using namespace std;
+
+MReportCamera::MReportCamera() : MReport("CAMERA-REPORT")
+{
+    fName = "MReportCamera";
+}
+
+// CAMERA-REPORT 06 2003 11 04 23 53 34 438 00 0000 00 00 00 00 00 000
+// 0 1 4 4 5 5 4 5 4 9 0 2 3 DC 00000025001E000000070000000F00250025001E0016000000000007000700000007000000070025002D002D001E001E001E0000000000000000000F0007000700000000000F0007000F002D0034002D0034001E001E001E001E00000000000000000007000F000F000F00070000000000000007000F000F0007003400340034003400340016002D0016001E001E0007000F000000070201001E000F000F000F000F00070007000701DB00000007000F00070007000F002D002D0034002D00340025001E001E001E002D001E001E000700000007000000000000000F0016000F000F000F000F00000000000000000007000000070007000F0416000F020B002D0034002D002D002D0034002D002D001E00250025002D001E0025000700070000000F0007000F0000000F000F0007000F000F00160007000000070007000F0000000700070007000F00070007000F000700070025002D0025002D0025002500250034001E001E001E002500250025002D002500070016000F00070016000F000F0007000700070007000F000F00070007000F00000007000F000000000000000000000007000700070007000F0000000F000F002D002D0025002500250025002D0025002D001E001E00250025001E0025001E002D001E00070000000700070007000700070000000700070007000F000000070000000F000700070000000000070000000000070007000F00000007000700000007000700070007000F0007002D0025002D0034002D002500250025002D0025001E001E001E001E001E0025001E001E001E00250000000000000000000000000000000000000007000F0000000F000F00070000000F0007000F00000007000F0007000000000007000000070000000F0007000700070007000000070007000700000000002D0034002D003400340034002D0034003400340034002D001E0025001E0025001E001E001E002D001E001E0000000700000007000700000000000F000700000000000F000F000F0016000F0016000F0007000700070007000000070000000F000F00070000000F0007000F000700070007000F0007001600070000000700070007000F002D003400340034002D0034001E002D002D002500250025000F000F000000070007000F001E001E0016001E001E001E00160016000F0016001600160016000F000F000F000F0007002D00250034002D0034002D00340025002D001E002D001E002D0025000F000F000F0007000700000007001E001E001E0016001E001E001E000F000F0016000F000F000F000F0000000700070016000F000F000F002D00250025002D00340025002D002D001E002D002D002D0025002D0025002D0007025B00070007000F000000070007001E001E00160016001E0016001E001600160007000F0000000F000F0007000F00070000000F000700070000000700070025002D0025002D002500340025002D0025001E0016001E001E0025001E002D001E0025000000070007000000070000000700070000001E001E001E001E00160016001600160016022E0016000F0016000F000F000F000F0007000000070007000700070000000700070007 HV 00006906806B06B06C06906906906806806C06C06B06B06C06C06906906906906906806806806B06C06C06B06B06B06C06C06C06906906906906906906906806806806806B06C06C06C06A06B06A06B06C00106C06C06806906906906906906906906906806806806806806C06B06B06C06B06A06A06A06A06B06C06C06B06C06C06906906906906906906906906806906906806906806806806806C06C06C06B06B06C06A06B06A06A06A06B06B06C06C06B06C06C06906A06806900006906906906906906906906906806806806806806806806C06C06C06B06B06B06C06A06A06A06A06A06A06A06B06B06B06B06B06B06C05C06906906906906906806906906906906906906906906806806806806806806806806C06B06C06C06C06C06B06C06A06A06A06A06906A06A06A06B06B06B06B06B06B06B06B06906906906906906906906906906906906906906906906906906806806806806806806806806806B06C06B06B06B06B06B06B06B06A06A06906906A06A06A06A06906B06C06B06B06B08906B06B06B06906906906906906906906906906806806906906906906806906906906806806806806806806806806806806C06B06C06C06B06C06B06B06B06B06906906A06A06A06A06A06906906A06B06B06B06B06B06B06B06B06B06B06806906906906906906906906906906806906906906906906906806906906906806806806806806806806806806806806B06B06B06B06B06B06C06A06C06B06C06A06A06A06A06A06A06A06A06A06A06A06B06B09B06B06B06B06B06B06B06B06B06906906906906906906906906906906806906906906906A06906806806806806906806B06B06B06B06A06B06A06A06906A06B06A08F06B06C06B06B06B06906906906906906906906906906906906906906806806806806806806806B06B06B06B06B06B06B06906A06A06A06A06A06A06B06B06B06B06B06B06B06906906906906906906906906906906906906906906906806806806806806806806806B06B06B06B06B06B06B06B06906A06906906A06906A06A06B06B06B06B06B06B06B06B06906906906906906906A06906906906906906906906906906906806806806806806806806806806B06B06B06B06B06B06B06B06B06A06906906A06906906A06906A06B06B06B06B06B06B07306B06B069069069069069069069069069 COOL 219 228 250 110 038 032 0 0 1 1 0 0 0 LID 0 1 0 1 0 0 0 0 2 2 0 0 HVPS 0105 0113 000 000 LV 00556 01120 -1190 00528 01080 -1209 01072 01064 03825 07350 02880 04779 06650 02898 09750 09150 1 204 031 AUX 0 0 CAL 0 1 0 0 OVER
+Bool_t MReportCamera::InterpreteBody(TString &str)
+{
+    *fLog << dbg << "C" << flush;
+    return kTRUE;
+}
Index: trunk/MagicSoft/Mars/mreport/MReportCamera.h
===================================================================
--- trunk/MagicSoft/Mars/mreport/MReportCamera.h	(revision 2520)
+++ trunk/MagicSoft/Mars/mreport/MReportCamera.h	(revision 2520)
@@ -0,0 +1,19 @@
+#ifndef MARS_MReportCamera
+#define MARS_MReportCamera
+
+#ifndef MARS_MReport
+#include "MReport.h"
+#endif
+
+class MReportCamera : public MReport
+{
+private:
+public:
+    MReportCamera();
+
+    Bool_t InterpreteBody(TString &str);
+
+    ClassDef(MReportCamera, 0) // Base class for control reports
+};
+
+#endif
Index: trunk/MagicSoft/Mars/mreport/MReportDAQ.cc
===================================================================
--- trunk/MagicSoft/Mars/mreport/MReportDAQ.cc	(revision 2520)
+++ trunk/MagicSoft/Mars/mreport/MReportDAQ.cc	(revision 2520)
@@ -0,0 +1,51 @@
+/* ======================================================================== *\
+!
+! *
+! * This file is part of MARS, the MAGIC Analysis and Reconstruction
+! * Software. It is distributed to you in the hope that it can be a useful
+! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
+! * It is distributed WITHOUT ANY WARRANTY.
+! *
+! * Permission to use, copy, modify and distribute this software and its
+! * documentation for any purpose is hereby granted without fee,
+! * provided that the above copyright notice appear in all copies and
+! * that both that copyright notice and this permission notice appear
+! * in supporting documentation. It is provided "as is" without express
+! * or implied warranty.
+! *
+!
+!
+!   Author(s): Thomas Bretz, 11/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2003
+!
+!
+\* ======================================================================== */
+
+//////////////////////////////////////////////////////////////////////////////
+//
+//  MReportDAQ
+//
+//////////////////////////////////////////////////////////////////////////////
+#include "MReportDAQ.h"
+
+#include "MLogManip.h"
+
+#include "MAstro.h"
+
+ClassImp(MReportDAQ);
+
+using namespace std;
+
+MReportDAQ::MReportDAQ() : MReport("DAQ-REPORT")
+{
+    fName = "MReportDAQ";
+}
+
+// DAQ-REPORT 02 2003 11 04 23 53 34 951 00 0000 00 00 23 53 32 466
+// 00000000 05394281 066555    0.0    0.0 000000  0.0000 00099999 099999 00450010003c008d0106000000000007000000000002000000f200120006000000a4008a0050001400000000000b000a0003005400000041004d000700110005000000000000000000010000004a0000000f0000000000150091000200eb000000a000000000001400000000009f006b00f7003d000300c0000000000019001d0008001c000d0018001605ad004700ef0000008b000900000052000000000000000f000000000011000000000000000000ed0070000000000012000400000012000000000000000300350011000000000049000000050000000000000000002e000400200000000a001c0005004000f600390000008d0000004700af000000000004000000840019000000000000009400cc00ea005500df0031008500000082000c000e0000000100000000001d00000001000001150000001200000000000200080000008400b0000000140000007e0000000000000000005e00000000000a00000000003100000000000000000000000000000039005300000000000f0000000f000502b9001a00000002000b00000000007900ec006600d4004d010100630110003f0000000000fd00a400070109000000000055000001090000000000000002000000f000bd0069003f00fe002f000000000001000a0000000c00fd0000000000110000000c0000000000000009000000000462000000a7008a00000000000d00ed00f001970000000a0000000200000011005700670003003f000000de0035008e00550000000000fb0095003a00f4005500c100ff00920000000000000000004500590011001b055300000000000000000013000300120000000b001600050068004100000000001000000000000a000b00d7006600f3004400ec0051001b002800090182000d000b00fb00b30002008700a2000000000000000a0000000a003b0052003600e4014b015b00de00000000002c000800010000000000000042000000000004006b0000000e001b0000001000000000000000000000000000ae00f2000b000000000000001600000000000000900012000000000000000000000000000000030000000000000000004c00690000000400570000000300360103004f009400e2004a000000030000000000f3003600000000000000000000000d003e00cc0017008000000000003500ed003e008200000000004900f90043008a0000005000f90035009400000000003d00000000000000000098003c003500070000000000000075003e0000005500ef003e007e000000000000004700f6002d0075000000000003003e010500380094000000000000004800ec007b000000000000000000410005000000000000007f003900e000550000000000000005008c004c00e10008004c011d003f0085000a00030000000000470162008200000000000000000000004500f70038008d0000000000000000000000000000000000000000004f01090099004000f700dc003c000400000000000000830025010e0102005300250000000000000013000100090000000000000000004c009b0000000000000000000000000000003b00f50000000000000000000000000000003400fc OVER
+Bool_t MReportDAQ::InterpreteBody(TString &str)
+{
+    *fLog << dbg << "D" << flush;
+    return kTRUE;
+}
Index: trunk/MagicSoft/Mars/mreport/MReportDAQ.h
===================================================================
--- trunk/MagicSoft/Mars/mreport/MReportDAQ.h	(revision 2520)
+++ trunk/MagicSoft/Mars/mreport/MReportDAQ.h	(revision 2520)
@@ -0,0 +1,19 @@
+#ifndef MARS_MReportDAQ
+#define MARS_MReportDAQ
+
+#ifndef MARS_MReport
+#include "MReport.h"
+#endif
+
+class MReportDAQ : public MReport
+{
+private:
+public:
+    MReportDAQ();
+
+    Bool_t InterpreteBody(TString &str);
+
+    ClassDef(MReportDAQ, 0) // Base class for control reports
+};
+
+#endif
Index: trunk/MagicSoft/Mars/mreport/MReportDrive.cc
===================================================================
--- trunk/MagicSoft/Mars/mreport/MReportDrive.cc	(revision 2520)
+++ trunk/MagicSoft/Mars/mreport/MReportDrive.cc	(revision 2520)
@@ -0,0 +1,74 @@
+/* ======================================================================== *\
+!
+! *
+! * This file is part of MARS, the MAGIC Analysis and Reconstruction
+! * Software. It is distributed to you in the hope that it can be a useful
+! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
+! * It is distributed WITHOUT ANY WARRANTY.
+! *
+! * Permission to use, copy, modify and distribute this software and its
+! * documentation for any purpose is hereby granted without fee,
+! * provided that the above copyright notice appear in all copies and
+! * that both that copyright notice and this permission notice appear
+! * in supporting documentation. It is provided "as is" without express
+! * or implied warranty.
+! *
+!
+!
+!   Author(s): Thomas Bretz, 11/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2003
+!
+!
+\* ======================================================================== */
+
+//////////////////////////////////////////////////////////////////////////////
+//
+//  MReportDrive
+//
+//////////////////////////////////////////////////////////////////////////////
+#include "MReportDrive.h"
+
+#include "MLogManip.h"
+
+#include "MAstro.h"
+
+ClassImp(MReportDrive);
+
+using namespace std;
+
+MReportDrive::MReportDrive() : MReport("DRIVE-REPORT")
+{
+    fName = "MReportDrive";
+}
+
+Bool_t MReportDrive::InterpreteBody(TString &str)
+{
+    MAstro::String2Angle(str, fRa);
+    MAstro::String2Angle(str, fDec);
+    MAstro::String2Angle(str, fHa);
+
+    Int_t len;
+    Int_t n=sscanf(str.Data(), "%lf %n", &fMjd, &len);
+    if (n!=1)
+        return kFALSE;
+
+    str.Remove(0, len);
+
+    MAstro::String2Angle(str, fNominalZd);
+    MAstro::String2Angle(str, fNominalAz);
+    MAstro::String2Angle(str, fCurrentZd);
+    MAstro::String2Angle(str, fCurrentAz);
+
+    n=sscanf(str.Data(), "%lf %lf %n", &fErrorZd, &fErrorAz, &len);
+    if (n!=2)
+        return kFALSE;
+
+    str.Remove(0, len);
+
+    str = str.Strip(TString::kBoth);
+
+    *fLog << dbg << "D" << flush;
+
+    return str.IsNull();
+}
Index: trunk/MagicSoft/Mars/mreport/MReportDrive.h
===================================================================
--- trunk/MagicSoft/Mars/mreport/MReportDrive.h	(revision 2520)
+++ trunk/MagicSoft/Mars/mreport/MReportDrive.h	(revision 2520)
@@ -0,0 +1,33 @@
+#ifndef MARS_MReportDrive
+#define MARS_MReportDrive
+
+#ifndef MARS_MReport
+#include "MReport.h"
+#endif
+
+class MReportDrive : public MReport
+{
+private:
+    Double_t fMjd;
+
+    Double_t fRa;         // [h]
+    Double_t fDec;        // [deg]
+    Double_t fHa;         // [h]
+
+    Double_t fNominalZd;  // [deg]
+    Double_t fNominalAz;  // [deg]
+    Double_t fCurrentZd;  // [deg]
+    Double_t fCurrentAz;  // [deg]
+
+    Double_t fErrorZd;    // [?]
+    Double_t fErrorAz;    // [?]
+
+public:
+    MReportDrive();
+
+    Bool_t InterpreteBody(TString &str);
+
+    ClassDef(MReportDrive, 0) // Base class for control reports
+};
+
+#endif
Index: trunk/MagicSoft/Mars/mreport/MReportFileRead.cc
===================================================================
--- trunk/MagicSoft/Mars/mreport/MReportFileRead.cc	(revision 2520)
+++ trunk/MagicSoft/Mars/mreport/MReportFileRead.cc	(revision 2520)
@@ -0,0 +1,252 @@
+/* ======================================================================== *\
+!
+! *
+! * This file is part of MARS, the MAGIC Analysis and Reconstruction
+! * Software. It is distributed to you in the hope that it can be a useful
+! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
+! * It is distributed WITHOUT ANY WARRANTY.
+! *
+! * Permission to use, copy, modify and distribute this software and its
+! * documentation for any purpose is hereby granted without fee,
+! * provided that the above copyright notice appear in all copies and
+! * that both that copyright notice and this permission notice appear
+! * in supporting documentation. It is provided "as is" without express
+! * or implied warranty.
+! *
+!
+!
+!   Author(s): Thomas Bretz, 11/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2003
+!
+!
+\* ======================================================================== */
+
+//////////////////////////////////////////////////////////////////////////////
+//
+//  MReportFileRead                                                            //
+//
+//////////////////////////////////////////////////////////////////////////////
+#include "MReportFileRead.h"
+
+#include <fstream>
+
+#include <TRegexp.h>
+#include <THashTable.h>
+
+#include "MLog.h"
+#include "MLogManip.h"
+
+#include "MReport.h"
+#include "MParList.h"
+
+/*
+#include "MTime.h"
+#include "MParList.h"
+#include "MRawRunHeader.h"
+#include "MRawEvtHeader.h"
+#include "MRawEvtData.h"
+#include "MRawCrateData.h"
+#include "MRawCrateArray.h"
+*/
+ClassImp(MReportFileRead);
+
+using namespace std;
+
+const TString MReportFileRead::gsReportHeader ="[CC Report File]";
+const TString MReportFileRead::gsVersionPrefix="Arehucas Version Number";
+
+class MReportHelp : public TObject
+{
+private:
+    MReport *fReport;
+
+public:
+    MReportHelp(MReport *rep) : fReport(rep) { }
+    const char *GetName() const { return fReport->GetIdentifier(); }
+    ULong_t Hash() const { return fReport->GetIdentifier().Hash(); }
+    MReport *GetReport() { return fReport; }
+    void SetTime(MTime *t) { fReport->SetTime(t); }
+};
+
+// --------------------------------------------------------------------------
+//
+// Default constructor. It tries to open the given file.
+//
+MReportFileRead::MReportFileRead(const char *fname, const char *name, const char *title)
+    : fFileName(fname), fIn(NULL)
+{
+    fName  = name  ? name  : "MReportFileRead";
+    fTitle = title ? title : "Read task to read Central Control report files";
+
+    fIn = new ifstream;
+    fList = new THashTable(1,1);
+    fList->SetOwner();
+}
+
+// --------------------------------------------------------------------------
+//
+// Destructor. Delete input stream.
+//
+MReportFileRead::~MReportFileRead()
+{
+    delete fIn;
+    delete fList;
+}
+
+MReport *MReportFileRead::GetReport(const TString &str) const
+{
+    MReportHelp *rep = (MReportHelp*)fList->FindObject(str);
+    return rep ? rep->GetReport() : 0;
+}
+
+Bool_t MReportFileRead::AddToList(MReport *rep) const
+{
+    if (GetReport(rep->GetIdentifier()))
+    {
+        *fLog << warn << "WARNING - Report with Identifier '";
+        *fLog << rep->GetIdentifier() << "' already added to the list... ";
+        *fLog << "ignored." << endl;
+        return kFALSE;
+    }
+
+    fList->Add(new MReportHelp(rep));
+    return kTRUE;
+}
+
+Bool_t MReportFileRead::CheckFileHeader() const
+{
+    TString str;
+    str.ReadLine(*fIn);   // Read to EOF or newline
+    if (str != gsReportHeader)
+    {
+        *fLog << err << "ERROR - First line doesn't match '" << gsReportHeader <<"' ";
+        *fLog << "in file '" << fFileName << "'"<<endl;
+        return kFALSE;
+    }
+
+    str.ReadLine(*fIn);   // Read to EOF or newline
+    if (!str.BeginsWith(gsVersionPrefix))
+    {
+        *fLog << err << "ERROR - Version prefix '" << gsVersionPrefix <<"' ";
+        *fLog << "not found in second line of file '" << fFileName << "'"<<endl;
+        return kFALSE;
+    }
+
+    str.Remove(0, gsVersionPrefix.Length());
+    str = str.Strip(TString::kBoth);
+
+    TString ver = str(TRegexp("^[0-9][0-9][0-9][0-9][0-9][0-9]-[0-9]$"));
+    if (ver.IsNull())
+    {
+        *fLog << err << "ERROR - Version string '" << str <<"' doesn't ";
+        *fLog << "match regular expression." << endl;
+        return kFALSE;
+    }
+
+    *fLog << dbg << "Report File version: <" << ver << ">" << endl;
+
+    return kTRUE;
+}
+
+// --------------------------------------------------------------------------
+//
+// The PreProcess of this task checks for the following containers in the
+// list:
+//   MRawRunHeader <output>   if not found it is created
+//   MRawEvtHeader <output>   if not found it is created
+//   MRawEvtData <output>     if not found it is created
+//   MRawCrateArray <output>  if not found it is created
+//   MRawEvtTime <output>     if not found it is created (MTime)
+//
+// If all containers are found or created the run header is read from the
+// binary file and printed.  If the Magic-Number (file identification)
+// doesn't match we stop the eventloop.
+//
+// Now the EvtHeader and EvtData containers are initialized.
+//
+Int_t MReportFileRead::PreProcess(MParList *pList)
+{
+    MTime *time = (MTime*)pList->FindCreateObj("MTime");
+    if (!time)
+        return kFALSE;
+
+    fList->ForEach(MReportHelp, SetTime)(time);
+
+    //
+    // open the input stream
+    // first of all check if opening the file in the constructor was
+    // successfull
+    //
+    fIn->open(fFileName);
+    if (!(*fIn))
+    {
+        *fLog << err << "Error: Cannot open file '" << fFileName << "'" << endl;
+        return kFALSE;
+    }
+
+    return CheckFileHeader();
+}
+
+// --------------------------------------------------------------------------
+//
+// The Process reads one event from the binary file:
+//  - The event header is read
+//  - the run header is read
+//  - all crate information is read
+//  - the raw data information of one event is read
+//
+Int_t MReportFileRead::Process()
+{
+    TString str;
+
+    MReport *rep=NULL;
+    while (!rep)
+    {
+        str.ReadLine(*fIn);
+        if (!*fIn)
+        {
+            *fLog << dbg << "EOF detected." << endl;
+            return kFALSE;
+        }
+
+        const Int_t pos = str.First(' ');
+        if (pos<=0)
+            continue;
+
+        rep = GetReport(str(0,pos));
+        if (rep)
+            str.Remove(0, pos);
+    }
+
+    if (!rep->Interprete(str))
+    {
+        *fLog << err << "ERROR - Interpretation of '" << rep->GetIdentifier() << "' failed." << endl;
+        return kFALSE;
+    }
+
+    return kTRUE;
+}
+
+// --------------------------------------------------------------------------
+//
+//  Close the file. Check whether the number of read events differs from
+//  the number the file should containe (MRawRunHeader). Prints a warning
+//  if it doesn't match.
+//
+Int_t MReportFileRead::PostProcess()
+{
+    /*
+    //
+    // Sanity check for the number of events
+    //
+    if (fRawRunHeader->GetNumEvents() == GetNumExecutions()-1)
+        return kTRUE;
+
+    *fLog << warn << "Warning - number of read events (" << GetNumExecutions()-1;
+    *fLog << ") doesn't match number in run header (";
+    *fLog << fRawRunHeader->GetNumEvents() << ")." << endl;
+    */
+    fIn->close();
+    return kTRUE;
+}
Index: trunk/MagicSoft/Mars/mreport/MReportFileRead.h
===================================================================
--- trunk/MagicSoft/Mars/mreport/MReportFileRead.h	(revision 2520)
+++ trunk/MagicSoft/Mars/mreport/MReportFileRead.h	(revision 2520)
@@ -0,0 +1,44 @@
+#ifndef MARS_MReportFileRead
+#define MARS_MReportFileRead
+
+#ifndef MARS_MTask
+#include "MTask.h"
+#endif
+
+// gcc 3.2
+//class ifstream;
+#include <iosfwd>
+
+class THashTable;
+
+class MTime;
+class MReport;
+
+class MReportFileRead : public MTask
+{
+private:
+    static const TString gsReportHeader;
+    static const TString gsVersionPrefix;
+
+    TString         fFileName;
+    ifstream       *fIn;            //! buffered input stream (file to read from)
+
+    THashTable *fList;
+
+    Int_t PreProcess(MParList *pList);
+    Int_t Process();
+    Int_t PostProcess();
+
+    Bool_t CheckFileHeader() const;
+    MReport *GetReport(const TString &str) const;
+
+public:
+    MReportFileRead(const char *filename, const char *name=NULL, const char *title=NULL);
+    ~MReportFileRead();
+
+    Bool_t AddToList(MReport *rep) const;
+
+    ClassDef(MReportFileRead, 0)	// Task to read the raw data binary file
+};
+
+#endif
Index: trunk/MagicSoft/Mars/mreport/MReportTrigger.cc
===================================================================
--- trunk/MagicSoft/Mars/mreport/MReportTrigger.cc	(revision 2520)
+++ trunk/MagicSoft/Mars/mreport/MReportTrigger.cc	(revision 2520)
@@ -0,0 +1,93 @@
+/* ======================================================================== *\
+!
+! *
+! * This file is part of MARS, the MAGIC Analysis and Reconstruction
+! * Software. It is distributed to you in the hope that it can be a useful
+! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
+! * It is distributed WITHOUT ANY WARRANTY.
+! *
+! * Permission to use, copy, modify and distribute this software and its
+! * documentation for any purpose is hereby granted without fee,
+! * provided that the above copyright notice appear in all copies and
+! * that both that copyright notice and this permission notice appear
+! * in supporting documentation. It is provided "as is" without express
+! * or implied warranty.
+! *
+!
+!
+!   Author(s): Thomas Bretz, 11/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2003
+!
+!
+\* ======================================================================== */
+
+//////////////////////////////////////////////////////////////////////////////
+//
+//  MReportTrigger
+//
+//////////////////////////////////////////////////////////////////////////////
+#include "MReportTrigger.h"
+
+#include "MLogManip.h"
+
+ClassImp(MReportTrigger);
+
+using namespace std;
+
+MReportTrigger::MReportTrigger() : MReport("TRIGGER-REPORT")
+{
+    fName = "MReportTrigger";
+}
+
+Bool_t MReportTrigger::InterpreteBody(TString &str)
+{
+    str = str.Strip(TString::kLeading);
+    Int_t pos = str.First(' ');
+    if (pos<=0)
+    {
+        *fLog << err << "ERROR - Cannot determin name of trigger table." << endl;
+        return kFALSE;
+    }
+
+    TString tablename = str(0, pos);
+    str.Remove(0, pos);
+
+    Int_t len, n;
+
+    pos = 0;
+    for (int i=0; i<19; i++)
+    {
+        n = sscanf(str.Data()+pos, " %f %n", &fScalerRate[i], &len);
+        if (n!=1)
+        {
+            *fLog << err << "ERROR - Scaler Value #" << i << " missing." << endl;
+            return kFALSE;
+        }
+        pos += len;
+    }
+    n = sscanf(str.Data()+pos, " %f %f %n", &fL1TriggerRate,
+               &fL2TriggerRate, &len);
+    if (n!=2)
+    {
+        *fLog << err << "ERROR - Couldn't read Trigger rates." << endl;
+        return kFALSE;
+    }
+    pos += len;
+    for (int i=0; i<11; i++)
+    {
+        n = sscanf(str.Data()+pos, " %f %n", &fRates[i], &len);
+        if (n!=1)
+        {
+            *fLog << err << "ERROR - Rate #" << i << " missing." << endl;
+            return kFALSE;
+        }
+        pos += len;
+    }
+    str.Remove(0, pos);
+    str.Strip(TString::kBoth);
+
+    *fLog << "T" << flush;
+
+    return str==(TString)"OVER";
+}
Index: trunk/MagicSoft/Mars/mreport/MReportTrigger.h
===================================================================
--- trunk/MagicSoft/Mars/mreport/MReportTrigger.h	(revision 2520)
+++ trunk/MagicSoft/Mars/mreport/MReportTrigger.h	(revision 2520)
@@ -0,0 +1,24 @@
+#ifndef MARS_MReportTrigger
+#define MARS_MReportTrigger
+
+#ifndef MARS_MReport
+#include "MReport.h"
+#endif
+
+class MReportTrigger : public MReport
+{
+private:
+    Float_t fScalerRate[19];
+    Float_t fL1TriggerRate;
+    Float_t fL2TriggerRate;
+    Float_t fRates[13];
+
+public:
+    MReportTrigger();
+
+    Bool_t InterpreteBody(TString &str);
+
+    ClassDef(MReportTrigger, 0) // Base class for control reports
+};
+
+#endif
Index: trunk/MagicSoft/Mars/mreport/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mreport/Makefile	(revision 2520)
+++ trunk/MagicSoft/Mars/mreport/Makefile	(revision 2520)
@@ -0,0 +1,52 @@
+##################################################################
+#
+#   makefile
+# 
+#   for the MARS software
+#
+##################################################################
+include ../Makefile.conf.$(OSTYPE)
+include ../Makefile.conf.general
+
+#
+# Handling name of the Root Dictionary Files
+#
+CINT  = Report
+
+#
+# Library name to creatre
+#
+LIB   = mreport.a
+
+#
+#  connect the include files defined in the config.mk file
+#
+INCLUDES = -I. -I../mbase -I../mtools
+
+#------------------------------------------------------------------------------
+
+.SUFFIXES: .c .cc .cxx .h .hxx .o 
+
+SRCFILES = MReport.cc \
+           MReportDAQ.cc \
+           MReportDrive.cc \
+           MReportCamera.cc \
+           MReportTrigger.cc \
+           MReportFileRead.cc
+
+SRCS    = $(SRCFILES)
+HEADERS = $(SRCFILES:.cc=.h)
+OBJS    = $(SRCFILES:.cc=.o) 
+
+############################################################
+
+all: $(LIB)
+
+include ../Makefile.rules
+
+clean:	rmcint rmobjs rmcore rmlib
+
+mrproper:	clean rmbak
+
+# @endcode
+
Index: trunk/MagicSoft/Mars/mreport/ReportIncl.h
===================================================================
--- trunk/MagicSoft/Mars/mreport/ReportIncl.h	(revision 2520)
+++ trunk/MagicSoft/Mars/mreport/ReportIncl.h	(revision 2520)
@@ -0,0 +1,3 @@
+#ifndef __CINT__
+
+#endif // __CINT__
Index: trunk/MagicSoft/Mars/mreport/ReportLinkDef.h
===================================================================
--- trunk/MagicSoft/Mars/mreport/ReportLinkDef.h	(revision 2520)
+++ trunk/MagicSoft/Mars/mreport/ReportLinkDef.h	(revision 2520)
@@ -0,0 +1,16 @@
+#ifdef __CINT__
+
+#pragma link off all globals;
+#pragma link off all classes;
+#pragma link off all functions;
+
+#pragma link C++ class MReport+;
+
+#pragma link C++ class MReportDAQ+;
+#pragma link C++ class MReportDrive+;
+#pragma link C++ class MReportCamera+;
+#pragma link C++ class MReportTrigger+;
+
+#pragma link C++ class MReportFileRead+;
+
+#endif
