Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 2556)
+++ trunk/MagicSoft/Mars/Changelog	(revision 2557)
@@ -4,4 +4,105 @@
 
                                                  -*-*- END OF LINE -*-*-
+  2003/11/22: Thomas Bretz
+
+   * mreport/MReportCamera.cc:
+     - implemented real reading
+     - changed some loops to poinbter arithmetics
+
+   * mreport/Makefile:
+     - added mcamera
+
+   * merpp.cc:
+     - implemented preliminary support for report-files
+     
+   * star.cc:
+     - small changes to handling of update-mode
+     
+   * mbase/MParList.cc:
+     - fixed a wrong output
+     
+   * mbase/MTask.cc:
+     - fixed AddToBranchList(TString&)
+     
+   * mbase/MTime.[h,cc]:
+     - setfill only once
+     - fixed ()-operator
+     - removed nonsens GetTime()
+     
+   * mcamera/MCameraAUX.h, mcamera/MCameraCalibration.h,
+     mcamera/MCameraCooling.h, mcamera/MCameraHV.h,
+     mcamera/MCameraLV.h, mcamera/MCameraLid.h,
+     mcamera/MCameraLids.h, mcamera/MCameraPowerSupply.h:
+     - set version in ClassDef to 1
+
+   * mcamera/MCameraCooling.h:
+     - added Getter-functions
+
+   * mcamera/MCameraLV.h:
+     - changed fHumidity to Byte_t
+
+   * mcamera/MCameraLid.h:
+     - derived from MParContainer instead of TObject
+     
+   * mfileio/FileIOLinkDef.h, mfileio/Makefile:
+     - added MReadReports
+
+   * mfileio/MReadReports.[h.cc]:
+     - added
+
+   * mfileio/MReadTree.h:
+     - added MReadReports as friend class to allow access to fChain
+
+   * mfileio/MWriteRootFile.cc:
+     - fixed output (didn't have the correct debug flags)
+     
+   * mhist/HistLinkDef.h, mhist/Makefile:
+     - added MHVsTime
+
+   * mhist/MHVsTime.[h,cc];
+     - added 
+     
+   * mhist/MFillH.cc:
+     - add eveything I know to BranchList
+     
+   * mraw/MRawFileWrite.[h,cc]:
+     - changed name of MTime from MRawEvtTime to MTime
+     - changed Tree names to:
+       + Events
+       + Pedestals
+       + Calibration
+     
+   * mreport/MReportTrigger.[h,cc]:
+     - fixed accoring to a discussion with Riccardo
+     - changed version number in ClassDef to 1
+
+   * mreport/Makefile:
+     - added mcamera
+
+   * macros/rootlogon.C:
+     - added colors
+     - changed the search path for libmars.so a bit
+     
+   * mdata/MDataList.[h,cc]:
+     - added support for '%'
+
+   * mhist/MHCamera.[h,cc]:
+     - removed DrawPixelIndices and DrawSectorIndices
+     - replaced by new Draw-options: 'sectorindex' and 'pixelindex'
+     - put together in PaintIndices
+     
+   * mmain/MEventDisplay.cc:
+     - added Sectors to tabs
+     - code for adding tab was in class twice (removed in
+       ReadinFirstEvent, uses AddGeometryTabs instead)
+       
+   * mreport/MReport.[h,cc]:  
+     - prpared to read new DC-REPORT files
+     
+   * mreport/MReportDrive.[h,cc]:
+     - removed debug 'D'
+     - added Getter-functions
+
+
 
   2003/11/21: Thomas Bretz
@@ -36,4 +137,36 @@
    * mmain/MEventDisplay.cc:
      - made 'Mini-Canvas' working in all Tabs by catching kCM_TAB
+
+   * mhist/MFillH.[h,cc], mhist/MH.[h,cc]:
+     - implemented ReInit
+
+   * mbase/MParList.cc:
+     - implemented more sanity check whether a class can be created 
+
+   * Makefile:
+     - added mcamera
+     - added mreport
+     - added status
+     - added OBJS and MCint.o to the shared object
+     
+   * macros/readCT1.C:
+     - do not add non-existing geomcam to parlist
+     - add geomapl to tasklist
+     
+   * mcamera/MCameraCalibration.h, mcamera/MCameraCooling.h,
+     mcamera/MCameraHV.h, mcamera/MCameraLV.h, 
+     mcamera/MCameraLid.h, mcamera/MCameraLids.h,
+     mcamera/MCameraPowerSupply.h, mreport/MReportCamera.h:
+     - changed according to discussion with Pepe
+
+   * mtools/Makefile, mtools/ToolsLinkDef.h:
+     - added MAstro
+     
+   * mtools/MAstro.[h,cc]:
+     - added
+
+   * macros/readMagic.C, macros/readCT1.C:
+     - changed to display relative signal (which is compared to the
+       cleaning levels) and the cleaning levels
 
 
Index: trunk/MagicSoft/Mars/Makefile
===================================================================
--- trunk/MagicSoft/Mars/Makefile	(revision 2556)
+++ trunk/MagicSoft/Mars/Makefile	(revision 2557)
@@ -21,5 +21,5 @@
 
 #PROGRAMS = readraw merpp mars test mona status
-PROGRAMS = readraw merpp star mars
+PROGRAMS = readraw merpp star status mars
 SOLIB    = libmars.so
 CINT     = M
@@ -49,4 +49,6 @@
           mmc \
           mraw \
+          mcamera \
+          mreport \
           mgui \
           mranforest \
@@ -86,5 +88,5 @@
 $(SOLIB): $(LIBRARIES) $(OBJS) $(HEADERS) MCint.o
 	@echo " Linking $(SOLIB) ..."
-	$(CXX) $(DYNLIB) $(CXXFLAGS) $(SUBDIRS:=/*.o) $(ROOTGLIBS) -o $@
+	$(CXX) $(DYNLIB) $(CXXFLAGS) $(OBJS) MCint.o $(SUBDIRS:=/*.o) $(ROOTGLIBS) -o $@
 
 $(PROGRAMS): $(SOLIB) $(PROGRAMS:=.o)
Index: trunk/MagicSoft/Mars/NEWS
===================================================================
--- trunk/MagicSoft/Mars/NEWS	(revision 2556)
+++ trunk/MagicSoft/Mars/NEWS	(revision 2557)
@@ -9,7 +9,23 @@
      (Directory: mreport, Base-Class: MReport, Reader: MReportFileRead, ...)
 
+   - enhanced merpp (the executable) to support .raw and .rep files.
+
    - added classes for light calibration (MCalibration* and 
      MHCalibration*) by Markus Gaug. Further work has to be and will
      be done soon.
+
+   - Added a preliminary 'synchronizer' (MReadReports) which will 
+     replace MReadMarsFile as soon as it is finished.
+
+   - Added a generalized histogram (similar to MH3) called MVsTime
+     which allows to plot variables (or rules - MDataChain - of
+     variables) vs time. For an example have a look at tempvstime.C.
+
+   - Changed the name of the event trees:
+       + Events    --> Events
+       + PedEvents --> Pedestals
+       + CalEvents --> Calibration
+
+  - changed name of MTime in the event trees from MRawEvtTime to MTime
 
 
Index: trunk/MagicSoft/Mars/macros/rootlogon.C
===================================================================
--- trunk/MagicSoft/Mars/macros/rootlogon.C	(revision 2556)
+++ trunk/MagicSoft/Mars/macros/rootlogon.C	(revision 2557)
@@ -42,21 +42,28 @@
 }
 
-void load(TString &dir)
+bool load(TString &dir)
 {
     if (isloaded())
         return;
 
-    cout << "Loading 'libmars.so'... " << flush;
+    cout << "\033[33m\033[1m" << "Loading '" << dir << "libmars.so'... " << "\033[31m" << flush;
 
-    if (gSystem->Load(dir.IsNull() ? "libmars.so" : dir+"libmars.so")!=0)
-        cout << "error." << endl;
+    if (dir.IsNull())
+        dir = "./";
+
+    if (gSystem->Load(dir+"libmars.so")!=0)
+    {
+        cout << "\033[33m\033[1m" << "error." << endl;
+        cout << "\033[0m" << endl;
+        return false;
+    }
     else
     {
         MParContainer::Class()->IgnoreTObjectStreamer();
         MArray::Class()->IgnoreTObjectStreamer();
-        cout << "done." << endl;
+        cout << "\033[33m\033[1m" << "done." << endl;
+        cout << "\033[0m" << endl;
+        return true;
     }
-
-    cout << endl;
 }
 /*
@@ -79,8 +86,7 @@
 
     TString dir = gSystem->Getenv("MARSSYS");
-
     if (!dir.IsNull())
     {
-        cout << "Mars found in " << dir << " (MARSSYS)" << endl << endl;
+        cout << "\033[34m\033[1m" << "Searching Mars in " << dir << " (MARSSYS)" << "\033[0m" << endl << endl;
 
         if (!dir.EndsWith("/"))
@@ -88,5 +94,6 @@
     }
 
-    load(dir);
+    if (!load(dir))
+        return;
 
     gInterpreter->AddIncludePath(dir+"macros");
@@ -119,6 +126,5 @@
     }
 
-    cout << "Welcome to the Mars Root environment." << endl;
-
+    cout << "\033[32m" << "Welcome to the Mars Root environment." << "\033[0m" << endl;
     cout << endl;
 }
Index: trunk/MagicSoft/Mars/mdata/MDataList.cc
===================================================================
--- trunk/MagicSoft/Mars/mdata/MDataList.cc	(revision 2556)
+++ trunk/MagicSoft/Mars/mdata/MDataList.cc	(revision 2557)
@@ -76,4 +76,7 @@
         fSign = kEPlus;
         return;
+    case '%':
+        fSign = kEModul;
+        return;
     default:
         fSign = kENone;
@@ -148,4 +151,17 @@
         }
         break;
+
+    case kEModul:
+        while ((member=(MData*)Next()))
+        {
+            Double_t d = member->GetValue();
+            if (d==0)
+            {
+                *fLog << warn << "Warning: Modulo division by zero (" << member->GetName() << ")" << endl;
+                return 0;
+            }
+            val = fmod(val, d);
+        }
+        break;
     }
     return val;
@@ -315,4 +331,8 @@
             str += "/";
             break;
+
+        case kEModul:
+            str += "%";
+            break;
         }
 
Index: trunk/MagicSoft/Mars/mdata/MDataList.h
===================================================================
--- trunk/MagicSoft/Mars/mdata/MDataList.h	(revision 2556)
+++ trunk/MagicSoft/Mars/mdata/MDataList.h	(revision 2557)
@@ -23,5 +23,5 @@
     TOrdCollection fMembers;	// Container for the filters
 
-    typedef enum { kENone, kEPlus, kEMinus, kEMult, kEDiv } SignType_t;
+    typedef enum { kENone, kEPlus, kEMinus, kEMult, kEDiv, kEModul } SignType_t;
     SignType_t fSign;
 
Index: trunk/MagicSoft/Mars/merpp.cc
===================================================================
--- trunk/MagicSoft/Mars/merpp.cc	(revision 2556)
+++ trunk/MagicSoft/Mars/merpp.cc	(revision 2557)
@@ -7,4 +7,7 @@
 #include "MRawFileRead.h"
 #include "MRawFileWrite.h"
+
+#include "MReportFileRead.h"
+#include "MWriteRootFile.h"
 
 #include "MLog.h"
@@ -55,11 +58,15 @@
     gLog << all << endl;
     gLog << "Sorry the usage is:" << endl;
-    gLog << "   merpp [-h] [-?] [-a0] [-vn] [-cn] inputfile[.raw] [outputfile[.root]]" << endl << endl;
-    gLog << "     input file:   Magic DAQ binary file." << endl;
-    gLog << "     ouput file:   Merpped root file." << endl;
+    gLog << "   merpp [-h] [-?] [-a0] [-vn] [-cn] [-u1]" << endl;
+    gLog << "         inputfile[.rep,[.raw]] [outputfile[.root]]" << endl << endl;
+    gLog << "     inputfile.raw:  Magic DAQ binary file." << endl;
+    gLog << "     inputfile.rep:  Magic Central Control report file." << endl;
+    gLog << "     ouputfile.root: Merpped root file." << endl;
     gLog << "     -a0: Do not use Ansii codes." << endl;
+    gLog << "     -u1: Update file." << endl;
     gLog << "     -cn: Compression level n=1..9 [default=2]" << endl;
     gLog << "     -vn: Verbosity level n [default=2]" << endl;
     gLog << "     -?/-h: This help" << endl << endl;
+    gLog << "   REMARK: At the moment you can process a .raw _or_ a .rep file, only!" << endl << endl;
 }
 
@@ -82,5 +89,6 @@
         gLog.SetNoColors();
 
-    const int kComprlvl = arg.HasOption("-c") ? arg.GetIntAndRemove("-c") : 1;
+    const Int_t kComprlvl = arg.HasOption("-c") ? arg.GetIntAndRemove("-c") : 1;
+    Bool_t kUpdate = arg.HasOption("-u") && arg.GetIntAndRemove("-u")==1;
 
     gLog.SetDebugLevel(arg.HasOption("-v") ? arg.GetIntAndRemove("-v") : 2);
@@ -101,5 +109,7 @@
     TString kNameout = arg.GetArgumentStr(1);
 
-    if (!kNamein.EndsWith(".raw"))
+    const Bool_t isreport = kNamein.EndsWith(".rep");
+
+    if (!kNamein.EndsWith(".raw") && !isreport)
         kNamein += ".raw";
 
@@ -124,12 +134,24 @@
     }
 
-    if (!gSystem->AccessPathName(kNameout, kFileExists))
-        gLog << warn << "Warning: A file '" << kNameout << "' exists." << endl;
-    else
-        if (!gSystem->AccessPathName(kNameout, kWritePermission))
-        {
-            gLog << err << "Sorry, you don't have write permission for '" << kNameout << "'." << endl;
-            return -1;
-        }
+    const Bool_t fileexist = !gSystem->AccessPathName(kNameout, kFileExists);
+    const Bool_t writeperm = !gSystem->AccessPathName(kNameout, kWritePermission);
+
+    if (fileexist && !writeperm)
+    {
+        gLog << err << "Sorry, you don't have write permission for '" << kNameout << "'." << endl;
+        return -1;
+    }
+
+    if (fileexist && !kUpdate)
+    {
+        gLog << err << "Sorry, file '" << kNameout << "' already existing." << endl;
+        return -1;
+    }
+
+    if (!fileexist && kUpdate)
+    {
+        gLog << warn << "File '" << kNameout << "' doesn't yet exist." << endl;
+        kUpdate=kFALSE;
+    }
 
     MArray::Class()->IgnoreTObjectStreamer();
@@ -143,4 +165,5 @@
 
     MTaskList tasks;
+    tasks.SetOwner();
     plist.AddToList(&tasks);
 
@@ -160,5 +183,5 @@
     plist.AddToList(&cratearray);
 
-    MTime evttime("MRawEvtTime");
+    MTime evttime;
     plist.AddToList(&evttime);
 
@@ -168,8 +191,45 @@
     // be created by MRawFileRead::PreProcess
     //
-    MRawFileRead  reader(kNamein);
-    MRawFileWrite writer(kNameout, "RECREATE", "Magic root-file", kComprlvl);
-    tasks.AddToList(&reader);
-    tasks.AddToList(&writer);
+    MTask *read  = 0;
+    MTask *write = 0;
+
+    const TString option(kUpdate ? "UPDATE" : "RECREATE");
+    if (isreport)
+    {
+        MReportFileRead *r = new MReportFileRead(kNamein);
+        r->AddToList("MReportDAQ");
+        r->AddToList("MReportDrive");
+        r->AddToList("MReportCamera");
+        r->AddToList("MReportTrigger");
+        read = r;
+
+        MWriteRootFile *w = new MWriteRootFile(kNameout, option, "Magic root-file", kComprlvl);
+        /*
+         w->AddContainer("MReportDAQ",         "DAQ");
+         w->AddContainer("MTimeDAQ",           "DAQ");
+         w->AddContainer("MReportDrive",       "Drive");
+         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");
+        write = w;
+    }
+    else
+    {
+        read  = new MRawFileRead(kNamein);
+        write = new MRawFileWrite(kNameout, option, "Magic root-file", kComprlvl);
+    }
+    tasks.AddToList(read);
+    tasks.AddToList(write);
 
     //
Index: trunk/MagicSoft/Mars/mhist/MFillH.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MFillH.cc	(revision 2556)
+++ trunk/MagicSoft/Mars/mhist/MFillH.cc	(revision 2557)
@@ -16,7 +16,7 @@
 !
 !
-!   Author(s): Thomas Bretz  07/2001 <mailto:tbretz@astro.uni-wuerzburg.de>
+!   Author(s): Thomas Bretz, 07/2001 <mailto:tbretz@astro.uni-wuerzburg.de>
 !
-!   Copyright: MAGIC Software Development, 2000-2002
+!   Copyright: MAGIC Software Development, 2000-2003
 !
 !
@@ -155,5 +155,6 @@
 
     AddToBranchList(Form("%s.*", (const char*)ExtractName(hist)));
-    AddToBranchList(Form("%s.*", (const char*)ExtractName(par)));
+    if (par)
+        AddToBranchList(Form("%s.*", (const char*)ExtractName(par)));
 
     if (title)
@@ -224,5 +225,6 @@
 
     AddToBranchList(fH->GetDataMember());
-    AddToBranchList(Form("%s.*", (const char*)ExtractName(par)));
+    if (par)
+        AddToBranchList(Form("%s.*", (const char*)ExtractName(par)));
 
     if (title)
Index: trunk/MagicSoft/Mars/mhist/MHCamera.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHCamera.cc	(revision 2556)
+++ trunk/MagicSoft/Mars/mhist/MHCamera.cc	(revision 2557)
@@ -568,4 +568,9 @@
     Update(gPad->GetLogy(), isbox, iscol);
     PaintAxisTitle();
+
+    if (opt.Contains("pixelindex"))
+        PaintIndices(kFALSE);
+    if (opt.Contains("sectorindex"))
+        PaintIndices(kTRUE);
 }
 
@@ -627,15 +632,8 @@
 }
 
-void MHCamera::DrawPixelIndices()
+void MHCamera::PaintIndices(Bool_t sector)
 {
     if (fNcells<=1)
         return;
-
-    // FIXME: Is this correct?
-    for (int i=0; i<kItemsLegend; i++)
-        fColors[i] = 16;
-
-    if (!gPad)
-        Draw();
 
     TText txt;
@@ -645,36 +643,11 @@
     for (Int_t i=0; i<fNcells-2; i++)
     {
+        const MGeomPix &h = (*fGeomCam)[i];
+
         TString num;
-        num += i;
-
-        const MGeomPix &h = (*fGeomCam)[i];
-        TText *nt = txt.DrawText(h.GetX(), h.GetY(), num);
-        nt->SetTextSize(0.3*h.GetD()/fGeomCam->GetMaxRadius()/1.05);
-    }
-}
-
-void MHCamera::DrawSectorIndices()
-{
-    if (fNcells<=1)
-        return;
-
-    for (int i=0; i<kItemsLegend; i++)
-        fColors[i] = 16;
-
-    if (!gPad)
-        Draw();
-
-    TText txt;
-    txt.SetTextFont(122);
-    txt.SetTextAlign(22);   // centered/centered
-
-    for (Int_t i=0; i<fNcells-2; i++)
-    {
-        TString num;
-        num += (*fGeomCam)[i].GetSector();
-
-        const MGeomPix &h = (*fGeomCam)[i];
-        TText *nt = txt.DrawText(h.GetX(), h.GetY(), num);
-        nt->SetTextSize(0.3*h.GetD()/fGeomCam->GetMaxRadius()/1.05);
+        num += sector ? h.GetSector() : i;
+
+        txt.SetTextSize(0.3*h.GetD()/fGeomCam->GetMaxRadius()/1.05);
+        txt.PaintText(h.GetX(), h.GetY(), num);
     }
 }
Index: trunk/MagicSoft/Mars/mhist/MHCamera.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHCamera.h	(revision 2556)
+++ trunk/MagicSoft/Mars/mhist/MHCamera.h	(revision 2557)
@@ -59,4 +59,5 @@
     Int_t GetColor(Float_t val, Float_t min, Float_t max, Bool_t islog);
 
+    void  PaintIndices(Bool_t sector);
     void  Update(Bool_t islog, Bool_t isbox, Bool_t iscol);
     void  UpdateLegend(Float_t min, Float_t max, Bool_t islog);
@@ -144,7 +145,4 @@
     void  FillRandom(TH1 *h, Int_t ntimes=5000) { TH1::FillRandom(h, ntimes); }
     void  FillRandom();
-
-    void  DrawPixelIndices();
-    void  DrawSectorIndices();
 
     void  PrintInfo() const { Print(""); } // *MENU*
Index: trunk/MagicSoft/Mars/mhist/MHVsTime.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHVsTime.cc	(revision 2556)
+++ trunk/MagicSoft/Mars/mhist/MHVsTime.cc	(revision 2557)
@@ -60,5 +60,5 @@
 //
 MHVsTime::MHVsTime(const char *rule)
-    : fHist(NULL), fData(NULL), fScale(1)
+    : fGraph(NULL), fData(NULL), fScale(1)
 {  
     fName  = gsDefName;
@@ -68,5 +68,5 @@
         return;
 
-    fHist = new TGraph;
+    fGraph = new TGraph;
     fData = new MDataChain(rule);
 }
@@ -78,6 +78,6 @@
 MHVsTime::~MHVsTime()
 {
-    if (fHist)
-        delete fHist;
+    if (fGraph)
+        delete fGraph;
 
     if (fData)
@@ -92,5 +92,4 @@
 TString MHVsTime::GetDataMember() const
 {
-    *fLog << dbg << fData->GetDataMember() << endl;
     return fData ? fData->GetDataMember() : (TString)"";
 }
@@ -105,13 +104,13 @@
 {
     // reset histogram (necessary if the same eventloop is run more than once) 
-    //fHist->Reset();
+    //fGraph->Reset();
 
     if (fData && !fData->PreProcess(plist))
         return kFALSE;
 
-    if (fHist)
+    if (fGraph)
     {
-        delete fHist;
-        fHist = new TGraph;
+        delete fGraph;
+        fGraph = new TGraph;
     }
 
@@ -119,5 +118,5 @@
     title += " vs Time";
 
-    fHist->SetNameTitle(fName, title);
+    fGraph->SetNameTitle(fName, title);
 
     return kTRUE;
@@ -130,5 +129,5 @@
 void MHVsTime::SetName(const char *name)
 {
-    fHist->SetName(name);
+    fGraph->SetName(name);
     MParContainer::SetName(name);
 }
@@ -140,5 +139,5 @@
 void MHVsTime::SetTitle(const char *title)
 {
-    fHist->SetTitle(title);
+    fGraph->SetTitle(title);
     MParContainer::SetTitle(title);
 }
@@ -160,5 +159,5 @@
     const Double_t T = (*t);///3600;
 
-    fHist->SetPoint(fHist->GetN(), T>12*3600?T-24*3600:T, v);
+    fGraph->SetPoint(fGraph->GetN(), T>12*3600?T-24*3600:T, v);
 
     return kTRUE;
@@ -182,8 +181,8 @@
 void MHVsTime::Draw(Option_t *opt)
 {
-    if (fHist->GetN()==0)
+    if (fGraph->GetN()==0)
         return;
 
-    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(fHist);
+    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(fGraph);
     pad->SetBorderMode(0);
 
@@ -192,11 +191,11 @@
     TString str(opt);
 
-    fHist->GetHistogram()->SetXTitle("Time");
-    fHist->GetHistogram()->SetYTitle(GetRule());
-    fHist->GetHistogram()->GetXaxis()->SetTimeFormat("%H:%M:%S");
-    fHist->GetHistogram()->GetXaxis()->SetTimeDisplay(1);
-    fHist->GetHistogram()->GetXaxis()->SetLabelSize(0.033);
-    fHist->Draw("AP");
-    if (fHist->TestBit(kIsLogy))
+    fGraph->GetHistogram()->SetXTitle("Time");
+    fGraph->GetHistogram()->SetYTitle(GetRule());
+    fGraph->GetHistogram()->GetXaxis()->SetTimeFormat("%H:%M:%S");
+    fGraph->GetHistogram()->GetXaxis()->SetTimeDisplay(1);
+    fGraph->GetHistogram()->GetXaxis()->SetLabelSize(0.033);
+    fGraph->Draw("AP");
+    if (fGraph->TestBit(kIsLogy))
         pad->SetLogy();
 
@@ -229,15 +228,15 @@
 Int_t MHVsTime::GetNbins() const
 {
-    return fHist->GetN();
-}
-
+    return fGraph->GetN();
+}
+/*
 TH1 *MHVsTime::GetHist()
 {
-    return fHist ? fHist->GetHistogram() : 0;
+    return fGraph ? fGraph->GetHistogram() : 0;
 }
 
 const TH1 *MHVsTime::GetHist() const
 {
-    return fHist ? fHist->GetHistogram() : 0;
+    return fGraph ? fGraph->GetHistogram() : 0;
 }
 
@@ -246,2 +245,3 @@
     return GetHist();
 }
+*/
Index: trunk/MagicSoft/Mars/mhist/MHVsTime.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHVsTime.h	(revision 2556)
+++ trunk/MagicSoft/Mars/mhist/MHVsTime.h	(revision 2557)
@@ -13,5 +13,5 @@
 protected:
     // Could be const but root < 3.02/06 doesn't like this...
-    TGraph     *fHist;  // Histogram to fill
+    TGraph     *fGraph;  // Histogram to fill
     MDataChain *fData;  // Object from which the data is filled
     Double_t    fScale; // Scale for axis (eg unit)
@@ -38,7 +38,12 @@
     TString GetRule() const;
 
-    const TH1 *GetHist() const;
-    TH1 *GetHist();
-    TH1 *GetHistByName(const TString name="");
+    /*
+//    const TH1 *GetHist() const;
+//    TH1 *GetHist();
+//    TH1 *GetHistByName(const TString name="");
+*/
+    const TGraph *GetGraph() const { return fGraph; }
+    TGraph *GetGraph() { return fGraph; }
+
 
     void Draw(Option_t *opt=NULL);
Index: trunk/MagicSoft/Mars/mmain/MEventDisplay.cc
===================================================================
--- trunk/MagicSoft/Mars/mmain/MEventDisplay.cc	(revision 2556)
+++ trunk/MagicSoft/Mars/mmain/MEventDisplay.cc	(revision 2557)
@@ -446,18 +446,5 @@
     // Add Geometry tab
     //
-    MGeomCam *geom = (MGeomCam*)plist->FindObject("MGeomCam");
-
-    TCanvas &c=AddTab("Geometry");
-
-    c.SetFillColor(16);
-
-    MHCamera *cam = new MHCamera(*geom);
-    cam->SetBit(TH1::kNoStats|MHCamera::kNoLegend);
-    cam->Draw();
-    cam->DrawPixelIndices();
-    fList->Add(cam);
-
-    c.Modified();
-    c.Update();
+    AddGeometryTabs();
 
     //
@@ -485,5 +472,5 @@
 //  Adds the geometry tab 
 //
-void MEventDisplay::AddGeometryTab()
+void MEventDisplay::AddGeometryTabs()
 {
     MGeomCam *geom = (MGeomCam*)fEvtLoop->GetParList()->FindObject("MGeomCam");
@@ -491,14 +478,23 @@
         return;
 
-    TCanvas &c=AddTab("Geometry");
+    TCanvas &c1=AddTab("Geometry");
 
     MHCamera *cam = new MHCamera(*geom);
-    cam->SetBit(TH1::kNoStats);
-    cam->Draw();
-    cam->DrawPixelIndices();
+    cam->SetBit(TH1::kNoStats|MHCamera::kNoLegend|kCanDelete);
+    cam->Draw("pixelindex");
     fList->Add(cam);
 
-    c.Modified();
-    c.Update();
+    c1.Modified();
+    c1.Update();
+
+    TCanvas &c2=AddTab("Sectors");
+
+    cam = new MHCamera(*geom);
+    cam->SetBit(TH1::kNoStats|MHCamera::kNoLegend|kCanDelete);
+    cam->Draw("sectorindex");
+    fList->Add(cam);
+
+    c2.Modified();
+    c2.Update();
 }
 
Index: trunk/MagicSoft/Mars/mreport/MReport.cc
===================================================================
--- trunk/MagicSoft/Mars/mreport/MReport.cc	(revision 2556)
+++ trunk/MagicSoft/Mars/mreport/MReport.cc	(revision 2557)
@@ -45,7 +45,8 @@
 
     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 %n" :
+                   " %d %*d %*d %*d %d %d %d %d ",
                    &state, &hor, &min, &sec, &ms, &len);
     if (n!=5)
Index: trunk/MagicSoft/Mars/mreport/MReport.h
===================================================================
--- trunk/MagicSoft/Mars/mreport/MReport.h	(revision 2556)
+++ trunk/MagicSoft/Mars/mreport/MReport.h	(revision 2557)
@@ -12,5 +12,6 @@
 {
 private:
-    const TString fIdentifier; //!
+    const TString fIdentifier;    //!
+    const Bool_t  fHasReportTime; //!
 
     Byte_t  fState;
@@ -21,5 +22,5 @@
 
 public:
-    MReport(const char *id) : fIdentifier(id), fState(0xff), fTime(0) { }
+    MReport(const char *id, Bool_t time=kTRUE) : fIdentifier(id), fHasReportTime(time), fState(0xff), fTime(0) { }
 
     virtual Bool_t SetupReading(MParList &plist);
Index: trunk/MagicSoft/Mars/mreport/MReportCamera.cc
===================================================================
--- trunk/MagicSoft/Mars/mreport/MReportCamera.cc	(revision 2556)
+++ trunk/MagicSoft/Mars/mreport/MReportCamera.cc	(revision 2557)
@@ -106,8 +106,14 @@
         return kFALSE;
 
-    for (int i=0; i<577; i++)
-    {
-        const Char_t hex[4] = { str[i*3], str[i*3+1], str[i*3+2], 0 };
-        const Int_t n=sscanf(hex, "%3hx", &fHV->fHV[i]);
+    const char *pos = str.Data();
+    const char *end = str.Data()+577*3;
+
+    Int_t i=0;
+    while (pos<end)
+    {
+        const Char_t hex[4] = { pos[0], pos[1], pos[2], 0 };
+        pos += 3;
+
+        const Int_t n=sscanf(hex, "%3hx", &fHV->fHV[i++]);
         if (n==1)
             continue;
@@ -116,5 +122,6 @@
         return kFALSE;
     }
-    str.Remove(0, 577*3); // Remove DC currents
+
+    str.Remove(0, end-str.Data()); // Remove DC currents
     str=str.Strip(TString::kLeading);
     return kTRUE;
Index: trunk/MagicSoft/Mars/mreport/MReportDrive.cc
===================================================================
--- trunk/MagicSoft/Mars/mreport/MReportDrive.cc	(revision 2556)
+++ trunk/MagicSoft/Mars/mreport/MReportDrive.cc	(revision 2557)
@@ -69,6 +69,4 @@
     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 2556)
+++ trunk/MagicSoft/Mars/mreport/MReportDrive.h	(revision 2557)
@@ -28,5 +28,19 @@
     Bool_t InterpreteBody(TString &str);
 
-    ClassDef(MReportDrive, 0) // Base class for control reports
+    Double_t GetMjd() const           { return fMjd;       }
+
+    Double_t GetRa() const            { return fRa;        }
+    Double_t GetDec() const           { return fDec;       }
+    Double_t GetHa() const            { return fHa;        }
+
+        Double_t GetNominalZd() const { return fNominalZd; }
+    Double_t GetNominalAz() const     { return fNominalAz; }
+    Double_t GetCurrentZd() const     { return fCurrentZd; }
+    Double_t GetCurrentAz() const     { return fCurrentAz; }
+
+    Double_t GetErrorZd() const       { return fErrorZd;   }
+    Double_t GetErrorAz() const       { return fErrorAz;   }
+
+    ClassDef(MReportDrive, 1) // Base class for control reports
 };
 
Index: trunk/MagicSoft/Mars/star.cc
===================================================================
--- trunk/MagicSoft/Mars/star.cc	(revision 2556)
+++ trunk/MagicSoft/Mars/star.cc	(revision 2557)
@@ -58,5 +58,5 @@
     gLog << "     -cn: Compression level n=1..9 [default=2]" << endl;
     gLog << "     -vn: Verbosity level n [default=2]" << endl;
-    gLog << "     -u1: Update File (instead or Recreate)" << endl;
+    gLog << "     -u1: Update File (instead of Recreate)" << endl;
     gLog << "     -tn: Telescope Serial Number n [default=0]" << endl << endl;
     gLog << " -> Further setup is not possible at the moment, please use" << endl;
@@ -123,8 +123,9 @@
     if (!gSystem->AccessPathName(kNameout, kFileExists))
     {
-        if (!kUpdate)
-            gLog << warn << "Warning: A file '" << kNameout << "' exists." << endl;
-    }
-    else
+        if (kUpdate)
+            gLog << warn << "Warning: File doesn't '" << kNameout << "' exist... recreating." << endl;
+    }
+
+    if (kUpdate || gSystem->AccessPathName(kNameout, kFileExists))
         if (!gSystem->AccessPathName(kNameout, kWritePermission))
         {
@@ -140,5 +141,5 @@
     // The tasklist is identified in the eventloop by its name
     //
-    MParList  plist;
+    MParList plist;
 
     MTaskList tlist;
