Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 2631)
+++ trunk/MagicSoft/Mars/Changelog	(revision 2632)
@@ -8,4 +8,26 @@
    * manalysis/MPedPhotPix.[h,cc], manalysis/MPedPhotCam.[h,cc]:
      - added
+
+   * merpp.cc:
+     - added support for dc report files
+     
+   * mcamera/CameraLinkDef.h, mcamera/Makefile:
+     - added MCameraDC
+     
+   * mhist/MHVsTime.cc:
+     - fixed a missing initialisation
+
+   * mraw/MRawFileRead.cc:
+     - fixed wrong MRawEvtTime name
+     
+   * mreport/MReport.cc:
+     - fixed reading of dc files
+     
+   * mreport/MReportCurrents.[h,cc]:
+     - do not store currents here. store it in MCameraDC
+     
+   * mreport/MReportFileRead.[h,cc]:
+     - replaced non working ReadLine by ReadToDelim (reason unknown!)
+     - added SetHasNoHeader and kHasNoHeader
 
 
Index: trunk/MagicSoft/Mars/macros/readcurrents.C
===================================================================
--- trunk/MagicSoft/Mars/macros/readcurrents.C	(revision 2631)
+++ trunk/MagicSoft/Mars/macros/readcurrents.C	(revision 2632)
@@ -50,5 +50,5 @@
 
     MGeomCamMagic geomcam;
-    MCurrents     cur;
+    MCameraDC     cur;
     MTaskList     tlist;
 
@@ -57,16 +57,8 @@
     plist.AddToList(&tlist);
 
-    MReadCurrents read(fname);
-    /*
-     read.AddFile("../currents/dcs_arcturus2.dat");
-     read.AddFile("../currents/dcs_arcturus3.dat");
-     read.AddFile("../currents/dcs_arcturus4.dat");
-     read.AddFile("../currents/dcs_arcturus5.dat");
-     read.AddFile("../currents/dcs_arcturus6.dat");
-     read.AddFile("../currents/dcs_arcturus7.dat");
-     read.AddFile("../currents/dcs_arcturus8.dat");
-     read.AddFile("../currents/dcs_arcturus9.dat");
-     read.AddFile("../currents/dcs_arcturus10.dat");
-     */
+    MReportFileRead read(fname);
+    read.SetHasNoHeader();
+    read.AddToList("MReportCurrents");
+
     tlist.AddToList(&read);
 
@@ -91,6 +83,6 @@
         // Remove the comments if you want to go through the file
         // event-by-event:
-        //        if (!HandleInput())
-        //            break;
+        if (!HandleInput())
+            break;
     } 
 
Index: trunk/MagicSoft/Mars/mcamera/CameraLinkDef.h
===================================================================
--- trunk/MagicSoft/Mars/mcamera/CameraLinkDef.h	(revision 2631)
+++ trunk/MagicSoft/Mars/mcamera/CameraLinkDef.h	(revision 2632)
@@ -11,4 +11,5 @@
 #pragma link C++ class MCameraHV+;
 #pragma link C++ class MCameraLV+;
+#pragma link C++ class MCameraDC+;
 #pragma link C++ class MCameraCalibration+;
 #pragma link C++ class MCameraPowerSupply+;
Index: trunk/MagicSoft/Mars/mcamera/MCameraDC.cc
===================================================================
--- trunk/MagicSoft/Mars/mcamera/MCameraDC.cc	(revision 2632)
+++ trunk/MagicSoft/Mars/mcamera/MCameraDC.cc	(revision 2632)
@@ -0,0 +1,78 @@
+/* ======================================================================== *\
+!
+! *
+! * 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, 5/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2003
+!
+!
+\* ======================================================================== */
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// MCameraDC (PRELIMINARY)
+//
+/////////////////////////////////////////////////////////////////////////////
+#include "MCameraDC.h"
+
+#include <TMath.h>
+
+#include "MLog.h"
+#include "MLogManip.h"
+
+ClassImp(MCameraDC);
+
+using namespace std;
+
+// --------------------------------------------------------------------------
+//
+// Default constructor.
+//
+MCameraDC::MCameraDC(Int_t size, const char *name, const char *title)
+    : fArray(size)
+{
+    fName  = name  ? name  : "MCameraDC";
+    fTitle = title ? title : "Storage container for the pixel currents";
+}
+
+// --------------------------------------------------------------------------
+//
+// Print the hillas Parameters to *fLog
+//
+void MCameraDC::Print(Option_t *) const
+{
+    *fLog << all << underline << GetDescriptor() << endl;
+    for (int i=0; i<fArray.GetSize(); i++)
+        *fLog << " " << GetCurrent(i);
+    *fLog << endl;
+}
+
+Float_t MCameraDC::GetMin() const
+{
+    Float_t val = (UInt_t)-1;
+    for (int i=0; i<fArray.GetSize(); i++)
+        val = TMath::Min(val, GetCurrent(i));
+    return val;
+}
+
+Float_t MCameraDC::GetMax() const
+{
+    Float_t val = 0;
+    for (int i=0; i<fArray.GetSize(); i++)
+        val = TMath::Max(val, GetCurrent(i));
+    return val;
+}
Index: trunk/MagicSoft/Mars/mcamera/MCameraDC.h
===================================================================
--- trunk/MagicSoft/Mars/mcamera/MCameraDC.h	(revision 2632)
+++ trunk/MagicSoft/Mars/mcamera/MCameraDC.h	(revision 2632)
@@ -0,0 +1,42 @@
+#ifndef MARS_MCameraDC
+#define MARS_MCameraDC
+
+#ifndef MARS_MCamEvent
+#include "MCamEvent.h"
+#endif
+
+#ifndef ROOT_TArrayF
+#include <TArrayF.h>
+#endif
+
+class MCameraDC : public MCamEvent
+{
+private:
+    TArrayF fArray; // [nA] Unsigned Int!
+
+public:
+    MCameraDC(Int_t size=577, const char *name=NULL, const char *title=NULL);
+
+    void SetCurrent(Int_t i, Float_t val) { fArray[i] = (Int_t)val; }
+    Float_t GetCurrent(Int_t i) const { return (*this)[i]; }
+    Float_t &operator[](Int_t i) { return (Float_t&)fArray[i]; }
+    const Float_t &operator[](Int_t i) const { return (*const_cast<MCameraDC*>(this))[i]; }
+
+    Float_t GetMin() const;
+    Float_t GetMax() const;
+
+    void Print(Option_t *opt=NULL) const;
+
+    Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const
+    {
+        val = (*this)[idx];
+        return val>0;
+    }
+    void DrawPixelContent(Int_t num) const
+    {
+    }
+
+    ClassDef(MCameraDC, 1) // Storage Container for the Currents (PRELIMINARY)
+};
+
+#endif
Index: trunk/MagicSoft/Mars/mcamera/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mcamera/Makefile	(revision 2631)
+++ trunk/MagicSoft/Mars/mcamera/Makefile	(revision 2632)
@@ -22,5 +22,6 @@
 #  connect the include files defined in the config.mk file
 #
-INCLUDES = -I. -I../mbase
+INCLUDES = -I. -I../mbase -I../mgui
+# mgui - MCameraDC <MCamEvent>
 
 #------------------------------------------------------------------------------
@@ -33,4 +34,5 @@
 	   MCameraHV.cc \
 	   MCameraLV.cc \
+	   MCameraDC.cc \
 	   MCameraLid.cc \
 	   MCameraLids.cc \
Index: trunk/MagicSoft/Mars/merpp.cc
===================================================================
--- trunk/MagicSoft/Mars/merpp.cc	(revision 2631)
+++ trunk/MagicSoft/Mars/merpp.cc	(revision 2632)
@@ -59,7 +59,8 @@
     gLog << "Sorry the usage is:" << endl;
     gLog << "   merpp [-h] [-?] [-a0] [-vn] [-cn] [-u1]" << endl;
-    gLog << "         inputfile[.rep,[.raw]] [outputfile[.root]]" << endl << endl;
+    gLog << "         inputfile[.rep,[.raw],[.txt]] [outputfile[.root]]" << endl << endl;
     gLog << "     inputfile.raw:  Magic DAQ binary file." << endl;
     gLog << "     inputfile.rep:  Magic Central Control report file." << endl;
+    gLog << "     inputfile.txt:  Magic DC currents file." << endl;
     gLog << "     ouputfile.root: Merpped root file." << endl;
     gLog << "     -a0: Do not use Ansii codes." << endl;
@@ -110,6 +111,7 @@
 
     const Bool_t isreport = kNamein.EndsWith(".rep");
-
-    if (!kNamein.EndsWith(".raw") && !isreport)
+    const Bool_t isdc     = kNamein.EndsWith(".txt");
+
+    if (!kNamein.EndsWith(".raw") && !isreport && !isdc)
         kNamein += ".raw";
 
@@ -195,11 +197,19 @@
 
     const TString option(kUpdate ? "UPDATE" : "RECREATE");
-    if (isreport)
+    if (isreport || isdc)
     {
         MReportFileRead *r = new MReportFileRead(kNamein);
-        r->AddToList("MReportDAQ");
-        r->AddToList("MReportDrive");
-        r->AddToList("MReportCamera");
-        r->AddToList("MReportTrigger");
+        if (isdc)
+        {
+            r->SetHasNoHeader();
+            r->AddToList("MReportCurrents");
+        }
+        else
+        {
+            r->AddToList("MReportDAQ");
+            r->AddToList("MReportDrive");
+            r->AddToList("MReportCamera");
+            r->AddToList("MReportTrigger");
+        }
         read = r;
 
@@ -211,16 +221,25 @@
          w->AddContainer("MTimeDrive",         "Drive");
          */
-        w->AddContainer("MReportCamera",      "Camera");
-        w->AddContainer("MTimeCamera",        "Camera");
-        w->AddContainer("MCameraAUX",         "Camera");
-        w->AddContainer("MCameraCalibration", "Camera");
-        w->AddContainer("MCameraCooling",     "Camera");
-        w->AddContainer("MCameraHV",          "Camera");
-        w->AddContainer("MCameraLV",          "Camera");
-        w->AddContainer("MCameraLids",        "Camera");
-        w->AddContainer("MReportTrigger",     "Trigger");
-        w->AddContainer("MTimeTrigger",       "Trigger");
-        w->AddContainer("MReportDrive",       "Drive");
-        w->AddContainer("MTimeDrive",         "Drive");
+        if (isdc)
+        {
+            w->AddContainer("MTimeCurrents",   "DC");
+            w->AddContainer("MCameraDC",       "DC");
+            w->AddContainer("MReportCurrents", "DC");
+        }
+        else
+        {
+            w->AddContainer("MReportCamera",      "Camera");
+            w->AddContainer("MTimeCamera",        "Camera");
+            w->AddContainer("MCameraAUX",         "Camera");
+            w->AddContainer("MCameraCalibration", "Camera");
+            w->AddContainer("MCameraCooling",     "Camera");
+            w->AddContainer("MCameraHV",          "Camera");
+            w->AddContainer("MCameraLV",          "Camera");
+            w->AddContainer("MCameraLids",        "Camera");
+            w->AddContainer("MReportTrigger",     "Trigger");
+            w->AddContainer("MTimeTrigger",       "Trigger");
+            w->AddContainer("MReportDrive",       "Drive");
+            w->AddContainer("MTimeDrive",         "Drive");
+        }
         write = w;
     }
@@ -252,4 +271,6 @@
         return -1;
     }
+
+    tasks.PrintStatistics();
 
     gLog << all << "Merpp finished successfull!" << endl;
Index: trunk/MagicSoft/Mars/mhist/MHVsTime.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHVsTime.cc	(revision 2631)
+++ trunk/MagicSoft/Mars/mhist/MHVsTime.cc	(revision 2632)
@@ -61,5 +61,5 @@
 //
 MHVsTime::MHVsTime(const char *rule)
-    : fGraph(NULL), fData(NULL), fScale(1)
+    : fGraph(NULL), fData(NULL), fScale(1), fUseEventNumber(0)
 {  
     fName  = gsDefName;
Index: trunk/MagicSoft/Mars/mraw/MRawFileRead.cc
===================================================================
--- trunk/MagicSoft/Mars/mraw/MRawFileRead.cc	(revision 2631)
+++ trunk/MagicSoft/Mars/mraw/MRawFileRead.cc	(revision 2632)
@@ -162,5 +162,5 @@
         return kFALSE;
 
-    fRawEvtTime = (MTime*)pList->FindCreateObj("MTime", "MRawEvtTime");
+    fRawEvtTime = (MTime*)pList->FindCreateObj("MTime");
     if (!fRawEvtTime)
         return kTRUE;
@@ -241,5 +241,4 @@
         const Double_t mhz = 9.375;                        // [1e6 ticks/s]
         const Double_t t   = tm/mhz;                       // [us]
-        //cout << (ULong_t)t << endl;
         const UInt_t ns    = (UInt_t)fmod(t*1e3, 1e6);
         const UShort_t ms  = (UShort_t)fmod(t/1e3, 1e3);
@@ -256,7 +255,4 @@
                          fRawRunHeader->GetDateDay(),
                          m/60, m%60, s, ms, ns);
-
-        //cout << tm << ": ";
-        //fRawEvtTime->Print();
     }
 
Index: trunk/MagicSoft/Mars/mreport/MReport.cc
===================================================================
--- trunk/MagicSoft/Mars/mreport/MReport.cc	(revision 2631)
+++ trunk/MagicSoft/Mars/mreport/MReport.cc	(revision 2632)
@@ -60,11 +60,10 @@
     int n = sscanf(str.Data(),
                    fHasReportTime ?
-                   " %d %d %d %d %d %d %d %d "
-                   "%*d %*d %*d %*d %*d %*d %*d %*d %n" :
-                   " %d %*d %*d %*d %d %d %d %d ",
+                   " %d %d %d %d %d %d %d %d %*d %*d %*d %*d %*d %*d %*d %*d %n" :
+                   " %d %d %d %d %d %d %d %d %n",
                    &state, &yea, &mon, &day, &hor, &min, &sec, &ms, &len);
     if (n!=8)
     {
-        *fLog << err << "ERROR - Cannot interprete Body of " << fIdentifier << endl;
+        *fLog << err << "ERROR - Cannot interprete Body of " << fIdentifier << " (n=" << n << ")" << endl;
         return kFALSE;
     }
@@ -81,4 +80,5 @@
 
     str.Remove(0, len);
+
     return kTRUE;
 }
Index: trunk/MagicSoft/Mars/mreport/MReportCurrents.cc
===================================================================
--- trunk/MagicSoft/Mars/mreport/MReportCurrents.cc	(revision 2631)
+++ trunk/MagicSoft/Mars/mreport/MReportCurrents.cc	(revision 2632)
@@ -36,5 +36,6 @@
 #include "MLogManip.h"
 
-#include "MAstro.h"
+#include "MParList.h"
+#include "MCameraDC.h"
 
 ClassImp(MReportCurrents);
@@ -42,9 +43,19 @@
 using namespace std;
 
-MReportCurrents::MReportCurrents() : MReport("DC-REPORT"), fCurrents(577)
+MReportCurrents::MReportCurrents() : MReport("DC-REPORT", kFALSE)
 {
     fName  = "MReportCurrents";
     fTitle = "Class for DC-REPORT information";
 }
+
+Bool_t MReportCurrents::SetupReading(MParList &plist)
+{
+    fDC = (MCameraDC*)plist.FindCreateObj("MCameraDC");
+    if (!fDC)
+        return kFALSE;
+
+    return MReport::SetupReading(plist);
+}
+
 
 // Currents-REPORT 02 2003 11 04 23 53 34 951 00 0000 00 00 23 53 32 466
@@ -54,9 +65,8 @@
     Int_t len;
     Short_t err1, err2;
-    const Int_t n=sscanf(str.Data(), " %hd %hd %n",
-                         &err1, &err2, &len);
+    const Int_t n=sscanf(str.Data(), " %hd %hd %n", &err1, &err2, &len);
     if (n!=2)
     {
-        *fLog << err << "ERROR - Reading information of 'LV' section." << endl;
+        *fLog << err << "ERROR - Reading status information." << endl;
         return kFALSE;
     }
@@ -82,5 +92,5 @@
         }
 
-        fCurrents[i++] = 0.001*c;
+        (*fDC)[i++] = 0.001*c;
     }
 
@@ -88,4 +98,4 @@
     str=str.Strip(TString::kLeading);
 
-    return kTRUE;
+    return str.IsNull();
 }
Index: trunk/MagicSoft/Mars/mreport/MReportCurrents.h
===================================================================
--- trunk/MagicSoft/Mars/mreport/MReportCurrents.h	(revision 2631)
+++ trunk/MagicSoft/Mars/mreport/MReportCurrents.h	(revision 2632)
@@ -6,7 +6,5 @@
 #endif
 
-#ifndef ROOT_TArrayF
-#include <TArrayF.h>
-#endif
+class MCameraDC;
 
 class MReportCurrents : public MReport
@@ -16,12 +14,13 @@
     Byte_t fStatus2;
 
-    TArrayF fCurrents;
+    MCameraDC *fDC; //!
+
+    Bool_t SetupReading(MParList &plist);
+    Bool_t InterpreteBody(TString &str);
 
 public:
     MReportCurrents();
 
-    Bool_t InterpreteBody(TString &str);
-
-    ClassDef(MReportCurrents, 0) // Class for DC-REPORT information
+    ClassDef(MReportCurrents, 1) // Class for DC-REPORT information
 };
 
Index: trunk/MagicSoft/Mars/mreport/MReportFileRead.cc
===================================================================
--- trunk/MagicSoft/Mars/mreport/MReportFileRead.cc	(revision 2631)
+++ trunk/MagicSoft/Mars/mreport/MReportFileRead.cc	(revision 2632)
@@ -270,4 +270,6 @@
         return kFALSE;
     }
+    if (TestBit(kHasNoHeader))
+        return kTRUE;
 
     return CheckFileHeader();
@@ -287,5 +289,7 @@
     while (!GetReport(rep))
     {
-        str.ReadLine(*fIn);
+        // Don't know the reason, but ReadLine and ReadString don't work
+        // for the (at least: converted) DC files.
+        str.ReadToDelim(*fIn);
         if (!*fIn)
         {
Index: trunk/MagicSoft/Mars/mreport/MReportFileRead.h
===================================================================
--- trunk/MagicSoft/Mars/mreport/MReportFileRead.h	(revision 2631)
+++ trunk/MagicSoft/Mars/mreport/MReportFileRead.h	(revision 2632)
@@ -27,4 +27,6 @@
     THashTable *fList;
 
+    enum { kHasNoHeader = BIT(14) };
+
     Int_t PreProcess(MParList *pList);
     Int_t Process();
@@ -40,4 +42,6 @@
     ~MReportFileRead();
 
+    void SetHasNoHeader() { SetBit(kHasNoHeader); }
+
     Bool_t AddToList(const char *name) const;
 
Index: trunk/MagicSoft/Mars/mreport/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mreport/Makefile	(revision 2631)
+++ trunk/MagicSoft/Mars/mreport/Makefile	(revision 2632)
@@ -22,5 +22,6 @@
 #  connect the include files defined in the config.mk file
 #
-INCLUDES = -I. -I../mbase -I../mtools -I../mcamera
+INCLUDES = -I. -I../mbase -I../mtools -I../mcamera -I../mgui
+# mgui - MCameraDC <MCamEvent>
 
 #------------------------------------------------------------------------------
