Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 2603)
+++ trunk/MagicSoft/Mars/Changelog	(revision 2604)
@@ -4,19 +4,65 @@
 
                                                  -*-*- END OF LINE -*-*-
+ 2003/12/05: Thomas Bretz
+
+   * mpointing/*:
+     - added
+
+   * Makefile:
+     - added mpointing
+
+   * NEWS:
+     - updated
+
+   * mbase/MTime.[h,cc]:
+     - complere rewrite of the data members
+     - ClassDef=3
+
+   * mfileio/MCT1ReadPreProc.cc, mfileio/MReadCurrents.cc,
+     mfileio/MReadReports.cc, mhist/MHPixVsTime.cc,
+     mhist/MHVsTime.cc, mmain/MOnlineDump.cc,
+     mmontecarlo/MMcTimeGenerate.cc, mreport/MReport.cc
+
+     - adapted to new MTime
+
+   * mfileio/MReadReports.[h,cc]:
+     - added the possibility to enable Auto Scheme
+     - delete the TChains when removed
+
+   * mfileio/MWriteRootFile.[h,cc]:
+     - automaticalle create title for Trees
+     - added a 'Must-Have' flag for the added containers
+
+   * mreport/MReportCamera.h:
+     - added //! to all pointers
+
+   * mtools/MAstro.[h,cc]:
+     - added calculations from and to MJD
+     - moved to mbase
+
+   * mfileio/Makefile, mfileio/FileIOLinkDef.h:
+     - removed MReadCurrent
+
+
+
  2003/12/04: Markus Gaug
 
-  * manalysis/MCalibration*
-     - implemented some of Thomas Bretz suggestions to make the code nicer
-     - implemented the possibility to have cosmics in the calibration data 
-       and remove it
+   * manalysis/MCalibration*
+     - implemented some of Thomas Bretz suggestions to make the code
+       nicer
+     - implemented the possibility to have cosmics in the calibration
+       data and remove it
      - implemented the conversion factors for the blind pixel method
 
-  * mhist/MHCalibration*
-     - implemented some of Thomas Bretz suggestions to make the code nicer
-     - implemented the possibility to have cosmics in the calibration data 
-       and still fit it
-
-  * macros/calibration.C
+   * mhist/MHCalibration*
+     - implemented some of Thomas Bretz suggestions to make the code
+       nicer
+     - implemented the possibility to have cosmics in the calibration
+       data and still fit it
+
+   * macros/calibration.C
      - MStatusDisplay of calibration histograms a little bit more readable
+
+
 
  2003/12/03: Abelardo Moralejo
@@ -26,4 +72,6 @@
        time, instead of fmcevt2).
 
+
+
  2003/12/02: Abelardo Moralejo
 
@@ -31,4 +79,6 @@
      - changed names of variables (removed underscores). Use new
        function MTask::AddSerialNumber  (see below).
+
+
 
  2003/12/02: Thomas Bretz
Index: trunk/MagicSoft/Mars/mbase/BaseLinkDef.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/BaseLinkDef.h	(revision 2603)
+++ trunk/MagicSoft/Mars/mbase/BaseLinkDef.h	(revision 2604)
@@ -17,4 +17,5 @@
 
 #pragma link C++ class MIter+;
+#pragma link C++ class MAstro+;
 #pragma link C++ class MDirIter+;
 
Index: trunk/MagicSoft/Mars/mbase/MAstro.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MAstro.cc	(revision 2604)
+++ trunk/MagicSoft/Mars/mbase/MAstro.cc	(revision 2604)
@@ -0,0 +1,238 @@
+/* ======================================================================== *\
+!
+! *
+! * 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
+!
+!
+\* ======================================================================== */
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// MAstro
+// ------
+//
+////////////////////////////////////////////////////////////////////////////
+#include "MAstro.h"
+
+ClassImp(MAstro);
+
+Double_t MAstro::Trunc(Double_t val)
+{
+    /* dint(A) - truncate to nearest whole number towards zero (double) */
+    return val<0 ? TMath::Ceil(val) : TMath::Floor(val);
+}
+
+Double_t MAstro::Round(Double_t val)
+{
+    /* dnint(A) - round to nearest whole number (double) */
+    return val<0 ? TMath::Ceil(val-0.5) : TMath::Floor(val+0.5);
+}
+
+Double_t MAstro::Hms2Sec(Int_t deg, UInt_t min, Double_t sec, Char_t sgn)
+{
+    const Double_t rc = TMath::Sign((60.0 * (60.0 * (Double_t)TMath::Abs(deg) + (Double_t)min) + sec), (Double_t)deg);
+    return sgn=='-' ? -rc : rc;
+}
+
+Double_t MAstro::Dms2Rad(Int_t deg, UInt_t min, Double_t sec, Char_t sgn)
+{
+    /* pi/(180*3600):  arcseconds to radians */
+#define DAS2R 4.8481368110953599358991410235794797595635330237270e-6
+    return Hms2Sec(deg, min, sec, sgn)*DAS2R;
+}
+
+Double_t MAstro::Hms2Rad(Int_t hor, UInt_t min, Double_t sec, Char_t sgn)
+{
+    /* pi/(12*3600):  seconds of time to radians */
+#define DS2R 7.2722052166430399038487115353692196393452995355905e-5
+    return Hms2Sec(hor, min, sec, sgn)*DS2R;
+}
+
+Double_t MAstro::Dms2Deg(Int_t deg, UInt_t min, Double_t sec, Char_t sgn)
+{
+    return Hms2Sec(deg, min, sec, sgn)/3600.;
+}
+
+Double_t MAstro::Hms2Deg(Int_t hor, UInt_t min, Double_t sec, Char_t sgn)
+{
+    return Hms2Sec(hor, min, sec, sgn)/240.;
+}
+
+Double_t MAstro::Dms2Hor(Int_t deg, UInt_t min, Double_t sec, Char_t sgn)
+{
+    return Hms2Sec(deg, min, sec, sgn)/15.;
+}
+
+Double_t MAstro::Hms2Hor(Int_t hor, UInt_t min, Double_t sec, Char_t sgn)
+{
+    return Hms2Sec(hor, min, sec, sgn)/3600.;
+}
+
+void MAstro::Day2Hms(Double_t day, Char_t &sgn, UShort_t &hor, UShort_t &min, UShort_t &sec)
+{
+    /* Handle sign */
+    sgn = day<0?'-':'+';
+
+    /* Round interval and express in smallest units required */
+    Double_t a = Round(86400. * TMath::Abs(day)); // Days to seconds
+
+    /* Separate into fields */
+    const Double_t ah = Trunc(a/3600.);
+    a -= ah * 3600.;
+    const Double_t am = Trunc(a/60.);
+    a -= am * 60.;
+    const Double_t as = Trunc(a);
+
+    /* Return results */
+    hor = (UShort_t)ah;
+    min = (UShort_t)am;
+    sec = (UShort_t)as;
+}
+
+void MAstro::Rad2Hms(Double_t rad, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec)
+{
+    Day2Hms(rad/(TMath::Pi()*2), sgn, deg, min, sec);
+}
+
+void MAstro::Rad2Dms(Double_t rad, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec)
+{
+    Rad2Hms(rad*15, sgn, deg, min, sec);
+}
+
+void MAstro::Deg2Dms(Double_t d, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec)
+{
+    Day2Hms(d/24, sgn, deg, min, sec);
+}
+
+void MAstro::Deg2Hms(Double_t d, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec)
+{
+    Rad2Hms(d/360, sgn, deg, min, sec);
+}
+
+void MAstro::Hor2Dms(Double_t h, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec)
+{
+    Day2Hms(h*15/24, sgn, deg, min, sec);
+}
+
+void MAstro::Hor2Hms(Double_t h, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec)
+{
+    Day2Hms(h/24, sgn, deg, min, sec);
+}
+
+void MAstro::Day2Hm(Double_t day, Char_t &sgn, UShort_t &hor, Double_t &min)
+{
+    /* Handle sign */
+    sgn = day<0?'-':'+';
+
+    /* Round interval and express in smallest units required */
+    Double_t a = Round(86400. * TMath::Abs(day)); // Days to seconds
+
+    /* Separate into fields */
+    const Double_t ah = Trunc(a/3600.);
+    a -= ah * 3600.;
+
+    /* Return results */
+    hor = (UShort_t)ah;
+    min = a/60.;
+}
+
+void MAstro::Rad2Hm(Double_t rad, Char_t &sgn, UShort_t &deg, Double_t &min)
+{
+    Day2Hm(rad/(TMath::Pi()*2), sgn, deg, min);
+}
+
+void MAstro::Rad2Dm(Double_t rad, Char_t &sgn, UShort_t &deg, Double_t &min)
+{
+    Rad2Hm(rad*15, sgn, deg, min);
+}
+
+void MAstro::Deg2Dm(Double_t d, Char_t &sgn, UShort_t &deg, Double_t &min)
+{
+    Day2Hm(d/24, sgn, deg, min);
+}
+
+void MAstro::Deg2Hm(Double_t d, Char_t &sgn, UShort_t &deg, Double_t &min)
+{
+    Rad2Hm(d/360, sgn, deg, min);
+}
+
+void MAstro::Hor2Dm(Double_t h, Char_t &sgn, UShort_t &deg, Double_t &min)
+{
+    Day2Hm(h*15/24, sgn, deg, min);
+}
+
+void MAstro::Hor2Hm(Double_t h, Char_t &sgn, UShort_t &deg, Double_t &min)
+{
+    Day2Hm(h/24, sgn, deg, min);
+}
+
+Bool_t MAstro::String2Angle(TString &str, Double_t &ret)
+{
+    Char_t  sgn;
+    Int_t   d, len;
+    UInt_t  m;
+    Float_t s;
+
+    // Skip whitespaces before %c and after %f
+    int n=sscanf(str.Data(), " %c %d %d %f %n", &sgn, &d, &m, &s, &len);
+
+    if (n!=4 || (sgn!='+' && sgn!='-'))
+        return kFALSE;
+
+    str.Remove(0, len);
+
+    ret = Dms2Deg(d, m, s, sgn);
+    return kTRUE;
+}
+
+void MAstro::Mjd2Ymd(UInt_t mjd, UShort_t &y, Byte_t &m, Byte_t &d)
+{
+    // Express day in Gregorian calendar
+    const ULong_t jd   = mjd + 2400001;
+    const ULong_t n4   = 4*(jd+((6*((4*jd-17918)/146097))/4+1)/2-37);
+    const ULong_t nd10 = 10*(((n4-237)%1461)/4)+5;
+
+    y = n4/1461L-4712;
+    m = ((nd10/306+2)%12)+1;
+    d = (nd10%306)/10+1;
+}
+
+Int_t MAstro::Ymd2Mjd(UShort_t y, Byte_t m, Byte_t d)
+{
+   // Month lengths in days
+   static int months[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+
+    // Validate month
+    if (m<1 || m>12)
+        return -1;
+
+    // Allow for leap year
+    months[1] = (y%4==0 && (y%100!=0 || y%400==0)) ? 29 : 28;
+
+    // Validate day
+    if (d<1 || d>months[m-1])
+        return -1;
+
+    // Lengthen year and month numbers to avoid overflow
+    const Byte_t  lm = 12-m;
+    const ULong_t lm10 = 4712 + y + lm/10;
+
+    // Perform the conversion
+    return 1461L*lm10/4 + (306*((21-lm)%12)+5)/10 - (3*((lm10+188)/100))/4 + d - 2399904;
+}
Index: trunk/MagicSoft/Mars/mbase/MAstro.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MAstro.h	(revision 2604)
+++ trunk/MagicSoft/Mars/mbase/MAstro.h	(revision 2604)
@@ -0,0 +1,47 @@
+#ifndef MARS_MAstro
+#define MARS_MAstro
+
+#ifndef ROOT_TROOT
+#include <TROOT.h>
+#endif
+
+class MAstro
+{
+private:
+    static Double_t Round(Double_t val);
+    static Double_t Trunc(Double_t val);
+
+public:
+    static Double_t Hms2Sec(Int_t deg, UInt_t min, Double_t sec, char sgn='+');
+    static Double_t Dms2Rad(Int_t deg, UInt_t min, Double_t sec, Char_t sgn='+');
+    static Double_t Hms2Rad(Int_t hor, UInt_t min, Double_t sec, Char_t sgn='+');
+    static Double_t Dms2Deg(Int_t deg, UInt_t min, Double_t sec, Char_t sgn='+');
+    static Double_t Hms2Deg(Int_t hor, UInt_t min, Double_t sec, Char_t sgn='+');
+    static Double_t Dms2Hor(Int_t deg, UInt_t min, Double_t sec, Char_t sgn='+');
+    static Double_t Hms2Hor(Int_t hor, UInt_t min, Double_t sec, Char_t sgn='+');
+
+    static void Day2Hms(Double_t rad, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec);
+    static void Rad2Dms(Double_t rad, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec);
+    static void Rad2Hms(Double_t rad, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec);
+    static void Deg2Dms(Double_t rad, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec);
+    static void Deg2Hms(Double_t rad, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec);
+    static void Hor2Dms(Double_t rad, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec);
+    static void Hor2Hms(Double_t rad, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec);
+
+    static void Day2Hm(Double_t rad, Char_t &sgn, UShort_t &deg, Double_t &min);
+    static void Rad2Dm(Double_t rad, Char_t &sgn, UShort_t &deg, Double_t &min);
+    static void Rad2Hm(Double_t rad, Char_t &sgn, UShort_t &deg, Double_t &min);
+    static void Deg2Dm(Double_t rad, Char_t &sgn, UShort_t &deg, Double_t &min);
+    static void Deg2Hm(Double_t rad, Char_t &sgn, UShort_t &deg, Double_t &min);
+    static void Hor2Dm(Double_t rad, Char_t &sgn, UShort_t &deg, Double_t &min);
+    static void Hor2Hm(Double_t rad, Char_t &sgn, UShort_t &deg, Double_t &min);
+
+    static Bool_t String2Angle(TString &str, Double_t &ret);
+
+    static void  Mjd2Ymd(UInt_t mjd, UShort_t &y, Byte_t &m, Byte_t &d);
+    static Int_t Ymd2Mjd(UShort_t y, Byte_t m, Byte_t d);
+
+    ClassDef(MAstro, 0)
+};
+
+#endif
Index: trunk/MagicSoft/Mars/mbase/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mbase/Makefile	(revision 2603)
+++ trunk/MagicSoft/Mars/mbase/Makefile	(revision 2604)
@@ -21,6 +21,6 @@
 
 INCLUDES = -I. -I../mfileio -I../mfilter
-# mfileio:  MRead (MEvtLoop)
-# mfilter:  MF (MContinue)
+# mfileio:  MRead  (MEvtLoop)
+# mfilter:  MF     (MContinue)
 
 # @code 
@@ -36,4 +36,5 @@
 	   MLog.cc \
            MArgs.cc \
+           MAstro.cc \
 	   MParContainer.cc \
 	   MParList.cc \
Index: trunk/MagicSoft/Mars/mfileio/FileIOLinkDef.h
===================================================================
--- trunk/MagicSoft/Mars/mfileio/FileIOLinkDef.h	(revision 2603)
+++ trunk/MagicSoft/Mars/mfileio/FileIOLinkDef.h	(revision 2604)
@@ -10,5 +10,4 @@
 #pragma link C++ class MReadReports+;
 #pragma link C++ class MReadMarsFile+;
-#pragma link C++ class MReadCurrents+;
 #pragma link C++ class MReadRflFile+;
 
Index: trunk/MagicSoft/Mars/mfileio/MCT1ReadPreProc.cc
===================================================================
--- trunk/MagicSoft/Mars/mfileio/MCT1ReadPreProc.cc	(revision 2603)
+++ trunk/MagicSoft/Mars/mfileio/MCT1ReadPreProc.cc	(revision 2604)
@@ -905,6 +905,5 @@
     //  int   isecs_since_midday; // seconds passed since midday before sunset (JD of run start)
     //  int   isecfrac_200ns;     // fractional part of isecs_since_midday
-    fTime->SetCT1Time(event.isecfrac_200ns, event.isecs_since_midday);
-    fTime->SetDuration((Int_t)fRawRunHeader->GetMJD());
+    fTime->SetCT1Time((UInt_t)fRawRunHeader->GetMJD(), event.isecfrac_200ns, event.isecs_since_midday);
     fTime->SetReadyToSave();
 
Index: trunk/MagicSoft/Mars/mfileio/MReadCurrents.cc
===================================================================
--- trunk/MagicSoft/Mars/mfileio/MReadCurrents.cc	(revision 2603)
+++ trunk/MagicSoft/Mars/mfileio/MReadCurrents.cc	(revision 2604)
@@ -223,5 +223,5 @@
     Int_t h, m, s, ms;
     *fIn >> h >> m >> s >> ms;
-    fTime->SetTime(h, m, s, ms*1000000);
+    fTime->Set(0, 0, 0, h, m, s, ms);
 
     for (int i=0; i<fNumPixel; i++)
Index: trunk/MagicSoft/Mars/mfileio/MReadReports.cc
===================================================================
--- trunk/MagicSoft/Mars/mfileio/MReadReports.cc	(revision 2603)
+++ trunk/MagicSoft/Mars/mfileio/MReadReports.cc	(revision 2604)
@@ -82,5 +82,5 @@
 // Call SetOwner for fTrees and fChains
 //
-MReadReports::MReadReports()
+MReadReports::MReadReports() : fEnableAutoScheme(kFALSE)
 {
     fName  = "MRead";
@@ -140,4 +140,7 @@
     t->SetTitle(time?time:"");
 
+    if (!fEnableAutoScheme)
+        t->DisableAutoScheme();
+
     //FIXME!
     //t->DisableAutoScheme();
@@ -257,7 +260,4 @@
             MTime &t = **GetTime(c);
 
-            if (t.GetHour()<12)
-                t.SetTime((Byte_t)(t.GetHour()+24), t.GetMin(), t.GetSec(), t.GetNanoSec());
-
             if (i==0)
                 tmin = t;
@@ -276,14 +276,7 @@
 
         // FIXME: Use Stream ID and call CallProcess() ?
-        if (((MTask*)fTrees->GetList()->At(nmin))->CallProcess())
+        Bool_t rc = ((MTask*)fTrees->GetList()->At(nmin))->CallProcess();
+        if (rc)
         {
-            /*
-             *fLog << dbg << ((MReadTree*)fTrees->At(nmin))->GetTreeName() << " " << flush;
-
-             if (tmin.GetHour()>=24)
-             tmin.SetTime((Byte_t)(tmin.GetHour()-24), tmin.GetMin(), tmin.GetSec(), tmin.GetNanoSec());
-             tmin.Print();
-             */
-
             fList->SetStreamId(fTrees->GetList()->At(nmin)->GetName());
             return kTRUE;
@@ -292,6 +285,5 @@
         delete *GetTime(chain);
         delete  GetTime(chain);
-        // FIXME: Is it really deleted?
-        fChains->Remove(chain);
+        delete fChains->Remove(chain);
     }
 
Index: trunk/MagicSoft/Mars/mfileio/MReadReports.h
===================================================================
--- trunk/MagicSoft/Mars/mfileio/MReadReports.h	(revision 2603)
+++ trunk/MagicSoft/Mars/mfileio/MReadReports.h	(revision 2604)
@@ -24,4 +24,6 @@
     MTask     *fList;   // pointer to the task list to set the stream id
 
+    Bool_t     fEnableAutoScheme;
+
     MTime** GetTime(TChain *c) const;
 
@@ -42,4 +44,6 @@
     void  PrintStatistics(const Int_t lvl=0, Bool_t title=kFALSE) const;
 
+    void  EnableAutoScheme(Bool_t e=kTRUE) { fEnableAutoScheme = e; }
+
     ClassDef(MReadReports, 0) // Reads events and reports from a root file ordered in time
 };
Index: trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc
===================================================================
--- trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc	(revision 2603)
+++ trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc	(revision 2604)
@@ -192,5 +192,5 @@
 // is the name of the tree.
 //
-void MWriteRootFile::AddContainer(const char *cname, const char *tname, const char *ttitle)
+void MWriteRootFile::AddContainer(const char *cname, const char *tname, Bool_t must)
 {
     //
@@ -198,5 +198,5 @@
     // add the entry to the list.
     //
-    MRootFileBranch *entry = new MRootFileBranch(cname, tname, ttitle);
+    MRootFileBranch *entry = new MRootFileBranch(cname, tname, must);
     fBranches.AddLast(entry);
 
@@ -216,5 +216,5 @@
 //
 void MWriteRootFile::AddContainer(MParContainer *cont, const char *tname,
-                                  const char *ttitle)
+                                  Bool_t must)
 {
     //
@@ -222,5 +222,5 @@
     // add the entry to the list.
     //
-    MRootFileBranch *entry = new MRootFileBranch(cont, tname, ttitle);
+    MRootFileBranch *entry = new MRootFileBranch(cont, tname, must);
     fBranches.AddLast(entry);
 }
@@ -264,7 +264,15 @@
                 // No corresponding container is found
                 //
-                *fLog << err << "Cannot find parameter container '" << cname << "'." << endl;
-                return kFALSE;
+                if (entry->MustHave())
+                {
+                    *fLog << err << "Cannot find parameter container '" << cname << "'." << endl;
+                    return kFALSE;
+                }
+
+                *fLog << inf << "Unnecessary parameter container '" << cname << "' not found..." << endl;
+                delete fBranches.Remove(entry);
+                continue;
             }
+
             //
             // The container is found. Put the pointer into the entry.
@@ -276,7 +284,7 @@
         // Get container name, tree name and tree title of this entry.
         //
-        const char *cname  = cont->GetName();
-        const char *tname  = entry->GetName();
-        const char *ttitle = entry->GetTitle();
+        const char *cname = cont->GetName();
+        const char *tname = entry->GetName();
+        const TString ttitle(Form("Tree containing %s", cont->GetDescriptor()));
 
         //
@@ -301,5 +309,5 @@
             fOut->cd();
 
-            tree = new TTree(tname, ttitle ? ttitle : tname);
+            tree = new TTree(tname, ttitle);
             fTrees.AddLast(tree);
 
@@ -494,6 +502,6 @@
 
         out << ", \"" << entry->GetName() << "\"";
-        if ((TString)entry->GetTitle()!="")
-            out << ", \"" << entry->GetTitle() << "\"";
+        if (!entry->MustHave())
+            out << ", kFALSE";
 
         out <<");" << endl;
Index: trunk/MagicSoft/Mars/mfileio/MWriteRootFile.h
===================================================================
--- trunk/MagicSoft/Mars/mfileio/MWriteRootFile.h	(revision 2603)
+++ trunk/MagicSoft/Mars/mfileio/MWriteRootFile.h	(revision 2604)
@@ -22,28 +22,30 @@
     TString        fContName;
 
-    void Init(const char *name, const char *title)
+    Bool_t         fMust;
+
+    void Init(const char *name, Bool_t must)
     {
         SetName(name?name:"");
-        SetTitle(title?title:"");
+        fMust = must;
     }
 
 public:
-    MRootFileBranch() : fTree(NULL), fBranch(NULL), fContainer(NULL)
+    MRootFileBranch() : fTree(NULL), fBranch(NULL), fContainer(NULL), fMust(0)
     {
-        Init(NULL, NULL);
+        Init(NULL, kFALSE);
         fContName = "";
     }
 
-    MRootFileBranch(const char *cname, const char *tname=NULL, const char *ttitle=NULL)
-        : fTree(NULL), fBranch(NULL), fContainer(NULL)
+    MRootFileBranch(const char *cname, const char *tname=NULL, Bool_t must=kFALSE)
+        : fTree(NULL), fBranch(NULL), fContainer(NULL), fMust(0)
     {
-        Init(tname, ttitle);
+        Init(tname, must);
         fContName = cname;
     }
 
-    MRootFileBranch(MParContainer *cont, const char *tname=NULL, const char *ttitle=NULL)
-        : fTree(NULL), fBranch(NULL), fContName("")
+    MRootFileBranch(MParContainer *cont, const char *tname=NULL, Bool_t must=kFALSE)
+        : fTree(NULL), fBranch(NULL), fContName(""), fMust(0)
     {
-        Init(tname, ttitle);
+        Init(tname, must);
         fContainer = cont;
     }
@@ -54,4 +56,5 @@
     TBranch       *GetBranch() const    { return fBranch; }
     const char    *GetContName() const  { return fContName; }
+    Bool_t         MustHave() const     { return fMust; }
 
     void SetContainer(MParContainer *cont) { fContainer = cont; }
@@ -98,8 +101,6 @@
 
 
-    void AddContainer(const char *cname,
-                      const char *tname=NULL, const char *ttitle=NULL);
-    void AddContainer(MParContainer *cont,
-                      const char *tname=NULL, const char *ttitle=NULL);
+    void AddContainer(const char *cname,   const char *tname=NULL, Bool_t must=kTRUE);
+    void AddContainer(MParContainer *cont, const char *tname=NULL, Bool_t must=kTRUE);
 
 
Index: trunk/MagicSoft/Mars/mfileio/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mfileio/Makefile	(revision 2603)
+++ trunk/MagicSoft/Mars/mfileio/Makefile	(revision 2604)
@@ -36,5 +36,4 @@
 	   MReadTree.cc \
            MReadReports.cc \
-           MReadCurrents.cc \
            MReadMarsFile.cc \
            MReadRflFile.cc \
Index: trunk/MagicSoft/Mars/mhist/MHPixVsTime.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHPixVsTime.cc	(revision 2603)
+++ trunk/MagicSoft/Mars/mhist/MHPixVsTime.cc	(revision 2604)
@@ -150,5 +150,5 @@
     Double_t t = 0;
     if (fUseEventTime)
-        t = (*fTime);
+        t = fTime->GetTime();
     else
         t = fHeader ? fHeader->GetDAQEvtNumber() : fGraph.GetN();
Index: trunk/MagicSoft/Mars/mhist/MHVsTime.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHVsTime.cc	(revision 2603)
+++ trunk/MagicSoft/Mars/mhist/MHVsTime.cc	(revision 2604)
@@ -165,6 +165,5 @@
             return kFALSE;
         }
-        const Double_t T = (*tm);///3600;
-        t = T>12*3600?T-24*3600:T;
+        t = tm->GetTime();
     }
 
Index: trunk/MagicSoft/Mars/mmain/MOnlineDump.cc
===================================================================
--- trunk/MagicSoft/Mars/mmain/MOnlineDump.cc	(revision 2603)
+++ trunk/MagicSoft/Mars/mmain/MOnlineDump.cc	(revision 2604)
@@ -40,5 +40,5 @@
     if (*fEvtTime==0)
     {
-        fEvtTime->SetTime((ULong_t)gSystem->Now());
+        fEvtTime->Now();
         set = kTRUE;
     }
@@ -54,5 +54,5 @@
 
     if (set)
-        fEvtTime->SetTime((ULong_t)0);
+        fEvtTime->Reset();
 }
 
Index: trunk/MagicSoft/Mars/mmontecarlo/MMcTimeGenerate.cc
===================================================================
--- trunk/MagicSoft/Mars/mmontecarlo/MMcTimeGenerate.cc	(revision 2603)
+++ trunk/MagicSoft/Mars/mmontecarlo/MMcTimeGenerate.cc	(revision 2604)
@@ -84,5 +84,6 @@
     while (dt < fDeadTime);
 
-    fTime->SetTime(*fTime+dt/1e4); // [0.1ms]
+#warning SetTime not valid anymore!
+//    fTime->SetTime(*fTime+dt/1e4); // [0.1ms]
 
     return kTRUE;
Index: trunk/MagicSoft/Mars/mreport/MReport.cc
===================================================================
--- trunk/MagicSoft/Mars/mreport/MReport.cc	(revision 2603)
+++ trunk/MagicSoft/Mars/mreport/MReport.cc	(revision 2604)
@@ -56,13 +56,13 @@
 {
     int len, state;
-    int hor, min, sec, ms;
+    int yea, mon, day, hor, min, sec, ms;
 
     int n = sscanf(str.Data(),
                    fHasReportTime ?
-                   " %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 ",
-                   &state, &hor, &min, &sec, &ms, &len);
-    if (n!=5)
+                   &state, &yea, &mon, &day, &hor, &min, &sec, &ms, &len);
+    if (n!=8)
     {
         *fLog << err << "ERROR - Cannot interprete Body of " << fIdentifier << endl;
@@ -72,5 +72,11 @@
     fState=state;
     if (fTime)
-        fTime->SetTime(hor, min, sec, ms*1000000);
+        if (!fTime->Set(yea, mon, day, hor, min, sec, ms))
+        {
+            *fLog << err << "ERROR - Event has invalid time: ";
+            *fLog << Form("%d.%d.%d %02s:%02d:%02d.%03d", day, mon, yea, hor, min, sec, ms);
+            *fLog << "... abort." << endl;
+            return kFALSE;
+        }
 
     str.Remove(0, len);
Index: trunk/MagicSoft/Mars/mreport/MReportCamera.h
===================================================================
--- trunk/MagicSoft/Mars/mreport/MReportCamera.h	(revision 2603)
+++ trunk/MagicSoft/Mars/mreport/MReportCamera.h	(revision 2604)
@@ -19,10 +19,10 @@
     Byte_t fStatusDC; // CaCo monitored status of the DC currents (0-9), Cam.DC_state
 
-    MCameraCooling     *fCooling;
-    MCameraLids        *fLids;
-    MCameraAUX         *fAUX;
-    MCameraHV          *fHV;
-    MCameraLV          *fLV;
-    MCameraCalibration *fCalibration;
+    MCameraCooling     *fCooling;     //!
+    MCameraLids        *fLids;        //!
+    MCameraAUX         *fAUX;         //!
+    MCameraHV          *fHV;          //!
+    MCameraLV          *fLV;          //!
+    MCameraCalibration *fCalibration; //!
 
     Bool_t SetupReading(MParList &plist);
Index: trunk/MagicSoft/Mars/mtools/MAstro.cc
===================================================================
--- trunk/MagicSoft/Mars/mtools/MAstro.cc	(revision 2603)
+++ 	(revision )
@@ -1,202 +1,0 @@
-/* ======================================================================== *\
-!
-! *
-! * 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
-!
-!
-\* ======================================================================== */
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// MAstro
-// ------
-//
-////////////////////////////////////////////////////////////////////////////
-#include "MAstro.h"
-
-ClassImp(MAstro);
-
-Double_t MAstro::Trunc(Double_t val)
-{
-    /* dint(A) - truncate to nearest whole number towards zero (double) */
-    return val<0 ? TMath::Ceil(val) : TMath::Floor(val);
-}
-
-Double_t MAstro::Round(Double_t val)
-{
-    /* dnint(A) - round to nearest whole number (double) */
-    return val<0 ? TMath::Ceil(val-0.5) : TMath::Floor(val+0.5);
-}
-
-Double_t MAstro::Hms2Sec(Int_t deg, UInt_t min, Double_t sec, Char_t sgn)
-{
-    const Double_t rc = TMath::Sign((60.0 * (60.0 * (Double_t)TMath::Abs(deg) + (Double_t)min) + sec), (Double_t)deg);
-    return sgn=='-' ? -rc : rc;
-}
-
-Double_t MAstro::Dms2Rad(Int_t deg, UInt_t min, Double_t sec, Char_t sgn)
-{
-    /* pi/(180*3600):  arcseconds to radians */
-#define DAS2R 4.8481368110953599358991410235794797595635330237270e-6
-    return Hms2Sec(deg, min, sec, sgn)*DAS2R;
-}
-
-Double_t MAstro::Hms2Rad(Int_t hor, UInt_t min, Double_t sec, Char_t sgn)
-{
-    /* pi/(12*3600):  seconds of time to radians */
-#define DS2R 7.2722052166430399038487115353692196393452995355905e-5
-    return Hms2Sec(hor, min, sec, sgn)*DS2R;
-}
-
-Double_t MAstro::Dms2Deg(Int_t deg, UInt_t min, Double_t sec, Char_t sgn)
-{
-    return Hms2Sec(deg, min, sec, sgn)/3600.;
-}
-
-Double_t MAstro::Hms2Deg(Int_t hor, UInt_t min, Double_t sec, Char_t sgn)
-{
-    return Hms2Sec(hor, min, sec, sgn)/240.;
-}
-
-Double_t MAstro::Dms2Hor(Int_t deg, UInt_t min, Double_t sec, Char_t sgn)
-{
-    return Hms2Sec(deg, min, sec, sgn)/15.;
-}
-
-Double_t MAstro::Hms2Hor(Int_t hor, UInt_t min, Double_t sec, Char_t sgn)
-{
-    return Hms2Sec(hor, min, sec, sgn)/3600.;
-}
-
-void MAstro::Day2Hms(Double_t day, Char_t &sgn, UShort_t &hor, UShort_t &min, UShort_t &sec)
-{
-    /* Handle sign */
-    sgn = day<0?'-':'+';
-
-    /* Round interval and express in smallest units required */
-    Double_t a = Round(86400. * TMath::Abs(day)); // Days to seconds
-
-    /* Separate into fields */
-    const Double_t ah = Trunc(a/3600.);
-    a -= ah * 3600.;
-    const Double_t am = Trunc(a/60.);
-    a -= am * 60.;
-    const Double_t as = Trunc(a);
-
-    /* Return results */
-    hor = (UShort_t)ah;
-    min = (UShort_t)am;
-    sec = (UShort_t)as;
-}
-
-void MAstro::Rad2Hms(Double_t rad, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec)
-{
-    Day2Hms(rad/(TMath::Pi()*2), sgn, deg, min, sec);
-}
-
-void MAstro::Rad2Dms(Double_t rad, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec)
-{
-    Rad2Hms(rad*15, sgn, deg, min, sec);
-}
-
-void MAstro::Deg2Dms(Double_t d, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec)
-{
-    Day2Hms(d/24, sgn, deg, min, sec);
-}
-
-void MAstro::Deg2Hms(Double_t d, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec)
-{
-    Rad2Hms(d/360, sgn, deg, min, sec);
-}
-
-void MAstro::Hor2Dms(Double_t h, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec)
-{
-    Day2Hms(h*15/24, sgn, deg, min, sec);
-}
-
-void MAstro::Hor2Hms(Double_t h, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec)
-{
-    Day2Hms(h/24, sgn, deg, min, sec);
-}
-
-void MAstro::Day2Hm(Double_t day, Char_t &sgn, UShort_t &hor, Double_t &min)
-{
-    /* Handle sign */
-    sgn = day<0?'-':'+';
-
-    /* Round interval and express in smallest units required */
-    Double_t a = Round(86400. * TMath::Abs(day)); // Days to seconds
-
-    /* Separate into fields */
-    const Double_t ah = Trunc(a/3600.);
-    a -= ah * 3600.;
-
-    /* Return results */
-    hor = (UShort_t)ah;
-    min = a/60.;
-}
-
-void MAstro::Rad2Hm(Double_t rad, Char_t &sgn, UShort_t &deg, Double_t &min)
-{
-    Day2Hm(rad/(TMath::Pi()*2), sgn, deg, min);
-}
-
-void MAstro::Rad2Dm(Double_t rad, Char_t &sgn, UShort_t &deg, Double_t &min)
-{
-    Rad2Hm(rad*15, sgn, deg, min);
-}
-
-void MAstro::Deg2Dm(Double_t d, Char_t &sgn, UShort_t &deg, Double_t &min)
-{
-    Day2Hm(d/24, sgn, deg, min);
-}
-
-void MAstro::Deg2Hm(Double_t d, Char_t &sgn, UShort_t &deg, Double_t &min)
-{
-    Rad2Hm(d/360, sgn, deg, min);
-}
-
-void MAstro::Hor2Dm(Double_t h, Char_t &sgn, UShort_t &deg, Double_t &min)
-{
-    Day2Hm(h*15/24, sgn, deg, min);
-}
-
-void MAstro::Hor2Hm(Double_t h, Char_t &sgn, UShort_t &deg, Double_t &min)
-{
-    Day2Hm(h/24, sgn, deg, min);
-}
-
-Bool_t MAstro::String2Angle(TString &str, Double_t &ret)
-{
-    Char_t  sgn;
-    Int_t   d, len;
-    UInt_t  m;
-    Float_t s;
-
-    // Skip whitespaces before %c and after %f
-    int n=sscanf(str.Data(), " %c %d %d %f %n", &sgn, &d, &m, &s, &len);
-
-    if (n!=4 || (sgn!='+' && sgn!='-'))
-        return kFALSE;
-
-    str.Remove(0, len);
-
-    ret = Dms2Deg(d, m, s, sgn);
-    return kTRUE;
-}
Index: trunk/MagicSoft/Mars/mtools/MAstro.h
===================================================================
--- trunk/MagicSoft/Mars/mtools/MAstro.h	(revision 2603)
+++ 	(revision )
@@ -1,44 +1,0 @@
-#ifndef MARS_MAstro
-#define MARS_MAstro
-
-#ifndef ROOT_TROOT
-#include <TROOT.h>
-#endif
-
-class MAstro
-{
-private:
-    static Double_t Round(Double_t val);
-    static Double_t Trunc(Double_t val);
-
-public:
-    static Double_t Hms2Sec(Int_t deg, UInt_t min, Double_t sec, char sgn='+');
-    static Double_t Dms2Rad(Int_t deg, UInt_t min, Double_t sec, Char_t sgn='+');
-    static Double_t Hms2Rad(Int_t hor, UInt_t min, Double_t sec, Char_t sgn='+');
-    static Double_t Dms2Deg(Int_t deg, UInt_t min, Double_t sec, Char_t sgn='+');
-    static Double_t Hms2Deg(Int_t hor, UInt_t min, Double_t sec, Char_t sgn='+');
-    static Double_t Dms2Hor(Int_t deg, UInt_t min, Double_t sec, Char_t sgn='+');
-    static Double_t Hms2Hor(Int_t hor, UInt_t min, Double_t sec, Char_t sgn='+');
-
-    static void Day2Hms(Double_t rad, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec);
-    static void Rad2Dms(Double_t rad, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec);
-    static void Rad2Hms(Double_t rad, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec);
-    static void Deg2Dms(Double_t rad, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec);
-    static void Deg2Hms(Double_t rad, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec);
-    static void Hor2Dms(Double_t rad, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec);
-    static void Hor2Hms(Double_t rad, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec);
-
-    static void Day2Hm(Double_t rad, Char_t &sgn, UShort_t &deg, Double_t &min);
-    static void Rad2Dm(Double_t rad, Char_t &sgn, UShort_t &deg, Double_t &min);
-    static void Rad2Hm(Double_t rad, Char_t &sgn, UShort_t &deg, Double_t &min);
-    static void Deg2Dm(Double_t rad, Char_t &sgn, UShort_t &deg, Double_t &min);
-    static void Deg2Hm(Double_t rad, Char_t &sgn, UShort_t &deg, Double_t &min);
-    static void Hor2Dm(Double_t rad, Char_t &sgn, UShort_t &deg, Double_t &min);
-    static void Hor2Hm(Double_t rad, Char_t &sgn, UShort_t &deg, Double_t &min);
-
-    static Bool_t String2Angle(TString &str, Double_t &ret);
-
-    ClassDef(MAstro, 0)
-};
-
-#endif
Index: trunk/MagicSoft/Mars/mtools/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mtools/Makefile	(revision 2603)
+++ trunk/MagicSoft/Mars/mtools/Makefile	(revision 2604)
@@ -34,5 +34,4 @@
            MagicDomino.cc \
            MagicCivilization.cc \
-           MAstro.cc \
            MineSweeper.cc
 
Index: trunk/MagicSoft/Mars/mtools/ToolsLinkDef.h
===================================================================
--- trunk/MagicSoft/Mars/mtools/ToolsLinkDef.h	(revision 2603)
+++ trunk/MagicSoft/Mars/mtools/ToolsLinkDef.h	(revision 2604)
@@ -5,5 +5,4 @@
 #pragma link off all functions;
 
-#pragma link C++ class MAstro+;
 #pragma link C++ class MChisqEval+;
 #pragma link C++ class MineSweeper+;
