Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 2528)
+++ trunk/MagicSoft/Mars/Changelog	(revision 2529)
@@ -3,4 +3,46 @@
 
                                                  -*-*- END OF LINE -*-*-
+ 2003/11/18: Thomas Bretz
+
+   * mars.cc:
+     - changed Usage to standard Usage
+     
+   * merpp.cc, mona.cc, readraw.cc, star.cc, status.cc,
+     mbase/MArgs.[h,cc]:
+     - removed const-qualifier for argv
+     
+   * mbase/MTask.cc:
+     - fixed a bug in PrintStatistics (setfill was not set)
+     
+   * mbase/MTaskList.cc:
+     - simplified PrintStatistics
+   
+   * mbase/MTime.h:
+     - added Getter
+     
+   * mfileio/MReadTree.cc:
+     - remove a leading "*" when checking whether a branch which 
+       should be enabled exists
+       
+   * mfileio/MWriteRootFile.cc:
+     - fixed a crash when Print is called and GetTree() returns NULL
+     
+   * mhist/MHEvent.cc:
+     - implemented more levels (MeV, GeV, etc) for energy display
+     
+   * mraw/MRawSocketRead.cc:
+     - removed some obsolete comment
+     
+   * mreport/MReport.[h,cc]:
+     - added FindTime
+     - removed an invalid line (ReadAngle) in the header file
+     - Set class version to 1
+     - do not write fTime '//!'
+     
+   * mreport/MReportFileRead.cc:
+     - fixed handling of MTimes
+
+
+
  2003/11/18: Abelardo Moralejo
 
@@ -8,48 +50,56 @@
      - Fixed missing initialization of fLongitmax
 
+
+
  2003/11/18: Markus Gaug
 
    * manalysis/MCalibrationCalc: 
-	- performs the eventloop and fills the calibration classes
+     - performs the eventloop and fills the calibration classes
 
    * manalysis/MCalibrationCam: 
-	- holds the classes: MCalibrationPix and MCalibrationBlindPix and MCalibrationPINDiode
-	- one MCalibrationPix per pixel
+     - holds the classes: MCalibrationPix and MCalibrationBlindPix
+       and MCalibrationPINDiode
+     - one MCalibrationPix per pixel
 
    * manalysis/MCalibrationPix:
-	- holds the fit results and conversion factors, etc per pixel
-	- hold histograms MHCalibrationPixel
+     - holds the fit results and conversion factors, etc per pixel
+     - hold histograms MHCalibrationPixel
 
    * manalysis/MCalibrationBlindPix:
-	- holds fit results and derived number of photons, etc
-	- hold histogram MHCalibrationBlindPixel
+     - holds fit results and derived number of photons, etc
+     - hold histogram MHCalibrationBlindPixel
 
    * manalysis/MCalibrationPINDiode:
-	- holds fit results and derived number of photons, etc
-	- hold histogram MHCalibrationPINDiode
+     - holds fit results and derived number of photons, etc
+     - hold histogram MHCalibrationPINDiode
 
    * mhist/MHCalibrationPix:
-	- histograms with sum of charges, time slices and reduced charges vs. event number
-	- fit functions
+     - histograms with sum of charges, time slices and reduced
+       charges vs. event number
+     - fit functions
 
    * mhist/MHCalibrationPixel:
-	- histograms with sum of charges, time slices and reduced charges vs. event number
-	- fit functions
+     - histograms with sum of charges, time slices and reduced
+       charges vs. event number
+     - fit functions
 
    * mhist/MHCalibrationBlindPixel:
-	- histograms with sum of charges, time slices and reduced charges vs. event number
-	- fit functions
+     - histograms with sum of charges, time slices and reduced
+       charges vs. event number
+     - fit functions
 
    * mhist/MHCalibrationPINDiode:
-	- histograms with sum of charges, time slices and reduced charges vs. event number
-	- fit functions
-
-   *mhist/MH:
-	- new function: CutEdges
-
-   *macros/calibration.C
-	- simple macro showing the functionning
-
- 
+     - histograms with sum of charges, time slices and reduced
+       charges vs. event number
+     - fit functions
+
+   * mhist/MH:
+     - new function: CutEdges
+
+   * macros/calibration.C
+     - simple macro showing the functionning
+
+
+
  2003/11/17: Thomas Bretz
  
Index: trunk/MagicSoft/Mars/mbase/MArgs.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MArgs.cc	(revision 2528)
+++ trunk/MagicSoft/Mars/mbase/MArgs.cc	(revision 2529)
@@ -54,6 +54,8 @@
 //  fArgv: A TList containing all other command line arguments
 //
-MArgs::MArgs(int argc, const char **argv) : fArgc(argc)
-{
+MArgs::MArgs(int argc, char **argv) : fArgc(argc)
+{
+    // FIXME: argv has no const-qualifier to be idetical with
+    //        TApplication.
     fName = argv[0];
 
Index: trunk/MagicSoft/Mars/mbase/MArgs.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MArgs.h	(revision 2528)
+++ trunk/MagicSoft/Mars/mbase/MArgs.h	(revision 2529)
@@ -31,5 +31,5 @@
 
 public:
-    MArgs(int argc, const char **argv);
+    MArgs(int argc, char **argv);
     ~MArgs();
 
Index: trunk/MagicSoft/Mars/mbase/MTask.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MTask.cc	(revision 2528)
+++ trunk/MagicSoft/Mars/mbase/MTask.cc	(revision 2529)
@@ -328,5 +328,5 @@
 void MTask::PrintStatistics(const Int_t lvl, Bool_t title) const
 {
-    *fLog << all << setw(lvl) << " " << GetDescriptor() << "\t";
+    *fLog << all << setfill(' ') << setw(lvl) << " " << GetDescriptor() << "\t";
     *fLog << dec << fNumExecutions;
     if (fFilter)
Index: trunk/MagicSoft/Mars/mbase/MTaskList.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MTaskList.cc	(revision 2528)
+++ trunk/MagicSoft/Mars/mbase/MTaskList.cc	(revision 2529)
@@ -592,10 +592,5 @@
     }
     else
-    {
-        *fLog << setw(lvl) << " " << GetDescriptor();
-        if (title)
-            *fLog << "\t" << fTitle;
-        *fLog << endl;
-    }
+        MTask::PrintStatistics(lvl, title);
 
     //
Index: trunk/MagicSoft/Mars/mbase/MTime.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MTime.h	(revision 2528)
+++ trunk/MagicSoft/Mars/mbase/MTime.h	(revision 2529)
@@ -83,5 +83,5 @@
     }
 
-    void SetTime(Byte_t h, Byte_t m, Byte_t s, UShort_t ns)
+    void SetTime(Byte_t h, Byte_t m, Byte_t s, UInt_t ns)
     {
         fHour    = h;
@@ -114,4 +114,9 @@
         return operator double();
     }
+
+    Byte_t GetHour() const { return fHour; }
+    Byte_t GetMin() const { return fMin; }
+    Byte_t GetSec() const { return fSec; }
+    UInt_t GetNanoSec() const { return fNanoSec; }
 
     ClassDef(MTime, 2)	//A generalized MARS time stamp
Index: trunk/MagicSoft/Mars/mfileio/MReadTree.cc
===================================================================
--- trunk/MagicSoft/Mars/mfileio/MReadTree.cc	(revision 2528)
+++ trunk/MagicSoft/Mars/mfileio/MReadTree.cc	(revision 2529)
@@ -409,5 +409,9 @@
     // Check whether this branch really exists
     //
-    if (fChain->GetBranch(name))
+    TString bn(name);
+    if (bn.EndsWith("*"))
+        bn.Remove(bn.Length()-1);
+
+    if (fChain->GetBranch(bn))
         SetBranchStatus(name, status);
 
@@ -905,4 +909,9 @@
 }
 
+TString MReadTree::GetTreeName() const
+{
+    return fChain->GetName();
+}
+
 // --------------------------------------------------------------------------
 //
Index: trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc
===================================================================
--- trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc	(revision 2528)
+++ trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc	(revision 2529)
@@ -161,5 +161,5 @@
         MRootFileBranch *b = (MRootFileBranch*)obj;
 
-        if (b->GetTree()->TestBit(kIsNewTree))
+        if (!b->GetTree() || b->GetTree()->TestBit(kIsNewTree))
             continue;
 
Index: trunk/MagicSoft/Mars/mhist/MHEvent.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHEvent.cc	(revision 2528)
+++ trunk/MagicSoft/Mars/mhist/MHEvent.cc	(revision 2529)
@@ -226,18 +226,30 @@
         s.Insert(0, txt);
 
-        s += "}{";
-        s += "  E=";
+        s += "}{  E=";
+
         if (fMcEvt->GetEnergy()>1000)
             s += Form("%.1fTeV", fMcEvt->GetEnergy()/1000);
         else
-            s += Form("%dGeV", fMcEvt->GetEnergy()+.5);
+            if (fMcEvt->GetEnergy()>10)
+                s += Form("%dGeV", (Int_t)(fMcEvt->GetEnergy()+.5));
+            else
+                if (fMcEvt->GetEnergy()>1)
+                    s += Form("%.1fGeV", fMcEvt->GetEnergy());
+                else
+                    s += Form("%dMeV", (Int_t)(fMcEvt->GetEnergy()*1000+.5));
+
         s += " r=";
         s += (int)(fMcEvt->GetImpact()/100+.5);
-        s += "m ZA=";
+        s += "m Zd=";
         s += (int)(fMcEvt->GetTheta()*180/TMath::Pi()+.5);
-        s += "\xb0 ";
-        s += fMcEvt->GetPhotElfromShower();
-        s += "PhEl";
-        s += "}";
+        s += "\\circ ";
+        if (fMcEvt->GetPhotElfromShower()>=10000)
+            s += Form("%dk", (Int_t)(fMcEvt->GetPhotElfromShower()/1000.+.5));
+        else
+            if (fMcEvt->GetPhotElfromShower()>=1000)
+                s += Form("%.1fk", fMcEvt->GetPhotElfromShower()/1000.);
+            else
+                s += fMcEvt->GetPhotElfromShower();
+        s += "PhEl}";
     }
 
Index: trunk/MagicSoft/Mars/mraw/MRawSocketRead.cc
===================================================================
--- trunk/MagicSoft/Mars/mraw/MRawSocketRead.cc	(revision 2528)
+++ trunk/MagicSoft/Mars/mraw/MRawSocketRead.cc	(revision 2529)
@@ -135,4 +135,5 @@
 
     *fLog << err << "ERROR - Cannot open port #" << fPort << endl;
+
     return kFALSE;
 }
@@ -187,9 +188,4 @@
     fEvtNumber = (UInt_t)-1;
 
-    /*
-    MEvtLoop *loop=(MEvtLoop*)pList->FindObject("Evtloop");
-    if (loop)
-        loop->SetProgressBar((TGProgressBar*)NULL);
-     */
     return kTRUE;
 }
Index: trunk/MagicSoft/Mars/mreport/MReport.cc
===================================================================
--- trunk/MagicSoft/Mars/mreport/MReport.cc	(revision 2528)
+++ trunk/MagicSoft/Mars/mreport/MReport.cc	(revision 2529)
@@ -33,4 +33,5 @@
 
 #include "MTime.h"
+#include "MParList.h"
 
 ClassImp(MReport);
@@ -82,2 +83,27 @@
     return kTRUE;
 }
+
+MTime *MReport::FindTime(MParList &plist)
+{
+    fTime = NULL;
+
+    TString id(ClassName());
+    if (!id.BeginsWith("MReport"))
+    {
+        *fLog << warn << " WARNING - Class name '" << id << "' ";
+        *fLog << " doesn't begin with 'MReport'... no MTime assigned." << endl;
+        return NULL;
+    }
+
+    id.Remove(0, 7);
+    if (id.IsNull())
+    {
+        *fLog << warn << " WARNING - No postfix existing... no MTime assigned." << endl;
+        return NULL;
+    }
+
+    id.Prepend("MTime");
+
+    fTime = (MTime*)plist.FindCreateObj("MTime", id);
+    return fTime;
+}
Index: trunk/MagicSoft/Mars/mreport/MReport.h
===================================================================
--- trunk/MagicSoft/Mars/mreport/MReport.h	(revision 2528)
+++ trunk/MagicSoft/Mars/mreport/MReport.h	(revision 2529)
@@ -7,4 +7,5 @@
 
 class MTime;
+class MParList;
 
 class MReport : public MParContainer
@@ -14,5 +15,5 @@
 
     Byte_t  fState;
-    MTime  *fTime;
+    MTime  *fTime;             //!
 
     ULong_t Hash() const { return fIdentifier.Hash(); }
@@ -39,7 +40,7 @@
     void SetTime(MTime *t) { fTime = t; }
 
-    static Bool_t ReadAngle(TString &str, Double_t &ret);
+    MTime *FindTime(MParList &plist);
 
-    ClassDef(MReport, 0) // Base class for control reports
+    ClassDef(MReport, 1) // Base class for control reports
 };
 
Index: trunk/MagicSoft/Mars/mreport/MReportFileRead.cc
===================================================================
--- trunk/MagicSoft/Mars/mreport/MReportFileRead.cc	(revision 2528)
+++ trunk/MagicSoft/Mars/mreport/MReportFileRead.cc	(revision 2529)
@@ -60,5 +60,5 @@
     ULong_t Hash() const { return fReport->GetIdentifier().Hash(); }
     MReport *GetReport() { return fReport; }
-    void SetTime(MTime *t) { fReport->SetTime(t); }
+    //void SetTime(MTime *t) { fReport->SetTime(t); }
     Bool_t Interprete(TString &str)
     {
@@ -69,4 +69,6 @@
         return kTRUE;
     }
+    void SetTime(MParList &plist) { fReport->FindTime(plist); }
+    void AddToList(MParList &plist) { plist.AddToList(fReport); }
 };
 
@@ -178,9 +180,10 @@
 Int_t MReportFileRead::PreProcess(MParList *pList)
 {
-    MTime *time = (MTime*)pList->FindCreateObj("MTime");
-    if (!time)
-        return kFALSE;
-
-    fList->ForEach(MReportHelp, SetTime)(time);
+    //MTime *time = (MTime*)pList->FindCreateObj("MTime");
+    //if (!time)
+    //    return kFALSE;
+
+    fList->ForEach(MReportHelp, SetTime)(*pList);
+    fList->ForEach(MReportHelp, AddToList)(*pList);
 
     //
@@ -249,4 +252,7 @@
     fIn->close();
 
+    if (!GetNumExecutions())
+        return kTRUE;
+
     *fLog << inf << endl;
     *fLog << GetDescriptor() << " statistics:" << endl;
