Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 1541)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 1542)
@@ -1,3 +1,33 @@
                                                                   -*-*- END -*-*-
+ 2002/10/16: Thomas Bretz
+
+   * macros/readMagic.C:
+     - added MPrint for MRawEvtHeader
+     - changed to MPrint to new Skip-Style
+
+   * manalysis/MHillasCalc.cc, manalysis/MHillasSrcCalc.cc:
+     - corrected output stream in case of hex or setfill was used
+
+   * mbase/MPrint.[h,cc]:
+     - introduced new behaviour of PreProcess (EnableSkip)
+
+   * mbase/MTaskList.cc:
+     - fixed a bug in Process which caused Histograms to be written
+       after each event
+
+   * meventdisp/MGEvtDisplay.cc:
+     - introduced printing of MRawEvtHeader
+
+   * mmc/MMcEvt.cxx:
+     - some small changes
+     - changed Print output from cout to fLog
+     - changes to the default values
+
+   * mraw/MRawEvtHeader.[h,cc]:
+     - removed the second empty line after Print
+     - added Getter-function for the DAQEvtNumber
+
+
+
  2002/10/15: Thomas Bretz
 
Index: /trunk/MagicSoft/Mars/macros/readMagic.C
===================================================================
--- /trunk/MagicSoft/Mars/macros/readMagic.C	(revision 1541)
+++ /trunk/MagicSoft/Mars/macros/readMagic.C	(revision 1542)
@@ -58,8 +58,12 @@
     plist.AddToList(&tlist);
 
-    MReadMarsFile     read("Events", fname);
+    MReadMarsFile read("Events", fname);
     read.DisableAutoScheme();
 
-    MPrint            print("MMcEvt");
+    MPrint print1("MMcEvt");
+    MPrint print2("MRawEvtHeader");
+    print1.EnableSkip();
+    print2.EnableSkip();
+
     MMcPedestalCopy   pcopy;
     MMcPedestalNSBAdd pnsb;
@@ -73,5 +77,6 @@
 
     tlist.AddToList(&read);
-    tlist.AddToList(&print);
+    tlist.AddToList(&print1);
+    tlist.AddToList(&print2);
     tlist.AddToList(&pcopy);
     tlist.AddToList(&pnsb);
Index: /trunk/MagicSoft/Mars/manalysis/MHillasCalc.cc
===================================================================
--- /trunk/MagicSoft/Mars/manalysis/MHillasCalc.cc	(revision 1541)
+++ /trunk/MagicSoft/Mars/manalysis/MHillasCalc.cc	(revision 1542)
@@ -125,4 +125,5 @@
     *fLog << inf << endl;
     *fLog << GetDescriptor() << " execution statistics:" << endl;
+    *fLog << dec << setfill(' ');
     *fLog << " " << setw(7) << fErrors[1] << " (" << setw(3) << (int)(fErrors[1]*100/GetNumExecutions()) << "%) Evts skipped due to: Event has less than 3 pixels" << endl;
     *fLog << " " << setw(7) << fErrors[2] << " (" << setw(3) << (int)(fErrors[2]*100/GetNumExecutions()) << "%) Evts skipped due to: Calculated Size == 0" << endl;
Index: /trunk/MagicSoft/Mars/manalysis/MHillasSrcCalc.cc
===================================================================
--- /trunk/MagicSoft/Mars/manalysis/MHillasSrcCalc.cc	(revision 1541)
+++ /trunk/MagicSoft/Mars/manalysis/MHillasSrcCalc.cc	(revision 1542)
@@ -122,4 +122,5 @@
     *fLog << inf << endl;
     *fLog << GetDescriptor() << " execution statistics:" << endl;
+    *fLog << dec << setfill(' ');
     *fLog << " " << fErrors << " (" << (int)(fErrors*100/GetNumExecutions()) << "%) Evts skipped due to: Dist==0" << endl;
     *fLog << endl;
Index: /trunk/MagicSoft/Mars/mbase/MPrint.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MPrint.cc	(revision 1541)
+++ /trunk/MagicSoft/Mars/mbase/MPrint.cc	(revision 1542)
@@ -67,4 +67,7 @@
 //  must be overloaded. You can also set an option string to use
 //  when calling TObject::Print
+//  If you want that the MPrint instance is removed from the tasklist
+//  if the container to be printed is not found in the PreProcess, call:
+//     MPrint::EnableSkip();
 //
 MPrint::MPrint(const char *obj, const char *option,
@@ -84,4 +87,6 @@
 //  must be overloaded. You can also set an option string to use
 //  when calling TObject::Print
+//  if the container to be printed is not found in the PreProcess, call:
+//     MPrint::EnableSkip();
 //
 MPrint::MPrint(const TObject *obj, const char *option,
@@ -118,6 +123,15 @@
     // If it couldn't get found stop Eventloop
     //
-    *fLog << err << dbginf << fObjName << " not found... aborting." << endl;
-    return kFALSE;
+    *fLog << err << dbginf << fObjName << " not found... ";
+    if (TestBit(kSKIP))
+    {
+        *fLog << "removing task from list." << endl;
+        return kSKIP;
+    }
+    else
+    {
+        *fLog << "aborting." << endl;
+        return kFALSE;
+    }
 }
 
Index: /trunk/MagicSoft/Mars/mbase/MPrint.h
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MPrint.h	(revision 1541)
+++ /trunk/MagicSoft/Mars/mbase/MPrint.h	(revision 1542)
@@ -15,4 +15,6 @@
     TString fOption;         // Print option
 
+    enum { kSkip = BIT(14) };
+
     void Init(const char *name, const char *title);
 
@@ -22,4 +24,5 @@
 
     void SetOption(Option_t *option) { fOption = option; }
+    void EnableSkip(Bool_t skip=kTRUE) { skip ? SetBit(kSkip) : ResetBit(kSkip); }
 
     Bool_t PreProcess(MParList *pList);
Index: /trunk/MagicSoft/Mars/mbase/MTaskList.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MTaskList.cc	(revision 1541)
+++ /trunk/MagicSoft/Mars/mbase/MTaskList.cc	(revision 1542)
@@ -380,5 +380,5 @@
     if (!noreset)
     {
-        fParList->SetReadyToSave();
+        fParList->SetReadyToSave(kFALSE);
         fParList->Reset();
         fParList->SetBit(MParList::kDoNotReset);
Index: /trunk/MagicSoft/Mars/meventdisp/MGEvtDisplay.cc
===================================================================
--- /trunk/MagicSoft/Mars/meventdisp/MGEvtDisplay.cc	(revision 1541)
+++ /trunk/MagicSoft/Mars/meventdisp/MGEvtDisplay.cc	(revision 1542)
@@ -46,4 +46,5 @@
 #include "MReadMarsFile.h"
 #include "MGeomCamMagic.h"
+#include "MRawEvtHeader.h"
 
 #include "MMcEvt.hxx"
@@ -484,4 +485,11 @@
     txt += "PhEl";
 
+    const MRawEvtHeader *hed = (MRawEvtHeader*)GetParList()->FindObject("MRawEvtHeader");
+    if (hed)
+    {
+        txt += "  DAQEvt #";
+        txt += hed->GetDAQEvtNumber();
+    }
+
     fEvtInfo->SetText(txt);
 }
Index: /trunk/MagicSoft/Mars/mraw/MRawEvtHeader.cc
===================================================================
--- /trunk/MagicSoft/Mars/mraw/MRawEvtHeader.cc	(revision 1541)
+++ /trunk/MagicSoft/Mars/mraw/MRawEvtHeader.cc	(revision 1542)
@@ -214,6 +214,4 @@
         }
     }
-
-    *fLog << endl;
     *fLog << endl;
 }
Index: /trunk/MagicSoft/Mars/mraw/MRawEvtHeader.h
===================================================================
--- /trunk/MagicSoft/Mars/mraw/MRawEvtHeader.h	(revision 1541)
+++ /trunk/MagicSoft/Mars/mraw/MRawEvtHeader.h	(revision 1542)
@@ -54,4 +54,5 @@
 
     UShort_t GetTrigType() const { return fTrigType; }
+    UInt_t GetDAQEvtNumber() const { return fDAQEvtNumber; }
 
     int ReadEvt(istream& fin);
Index: /trunk/MagicSoft/include-Classes/MMcFormat/MMcEvt.cxx
===================================================================
--- /trunk/MagicSoft/include-Classes/MMcFormat/MMcEvt.cxx	(revision 1541)
+++ /trunk/MagicSoft/include-Classes/MMcFormat/MMcEvt.cxx	(revision 1542)
@@ -1,7 +1,6 @@
 #include "MMcEvt.hxx"
 
-#include <iostream.h>
-#include <fstream.h>
-
+#include "MLog.h"
+#include "MLogManip.h"
 
 //==========
@@ -18,31 +17,16 @@
 
 
-MMcEvt::MMcEvt() {
-  //
-  //  default constructor
-  //  set all values to zero
+MMcEvt::MMcEvt()
+{
+    //
+    //  default constructor
+    //  set all values to zero
     fName  = "MMcEvt";
     fTitle = "Event info from Monte Carlo";
 
-  fPartId = 0  ;
-  fEnergy  = 0. ;
-
-  fTheta   = 0. ;
-  fPhi     = 0. ;
-
-  fCoreD   = 0. ;
-  fCoreX   = 0. ;
-  fCoreY   = 0. ;
-  fImpact  = 0. ;
-
-  fPhotIni      = 0 ;
-  fPassPhotAtm  = 0 ;
-  fPassPhotRef  = 0 ;
-  fPassPhotCone = 0 ;
-  fPhotElfromShower = 0 ;
-  fPhotElinCamera = 0 ;
-}
-
-MMcEvt::MMcEvt( UShort_t usPId, 
+    Clear();
+}
+
+MMcEvt::MMcEvt( UShort_t usPId,
 		Float_t  fEner, 
 		Float_t  fThet, 
@@ -99,26 +83,26 @@
 
 
-void MMcEvt::Clear(Option_t *opt) {
-  //
-  //  
-  //  reset all values to zero
-
-  fPartId = 0  ;
-  fEnergy  = 0. ;
-
-  fTheta   = 0. ;
-  fPhi     = 0. ;
-
-  fCoreD   = 0. ;
-  fCoreX   = 0. ;
-  fCoreY   = 0. ;
-  fImpact  = 0. ;
-
-  fPhotIni      = 0 ;
-  fPassPhotAtm  = 0 ;
-  fPassPhotRef  = 0 ;
-  fPassPhotCone = 0 ;
-  fPhotElfromShower = 0 ;
-  fPhotElinCamera   = 0 ;
+void MMcEvt::Clear(Option_t *opt)
+{
+    //
+    //  reset all values to values as nonsense as possible
+    //
+    fPartId = 0;
+    fEnergy = -1;
+
+    fTheta = 0;
+    fPhi   = 0;
+
+    fCoreD  =  0;
+    fCoreX  =  0;
+    fCoreY  =  0;
+    fImpact = -1;
+
+    fPhotIni          = 0;
+    fPassPhotAtm      = 0;
+    fPassPhotRef      = 0;
+    fPassPhotCone     = 0;
+    fPhotElfromShower = 0;
+    fPhotElinCamera   = 0;
 }
 
@@ -186,23 +170,23 @@
     if (str.IsNull())
     {
-        cout << endl;
-        cout << "Monte Carlo output:" << endl;
-        cout << " Particle Id:    ";
+        *fLog << all << endl;
+        *fLog << "Monte Carlo output:" << endl;
+        *fLog << " Particle Id:    ";
         switch(fPartId)
         {
         case kGAMMA:
-            cout << "Gamma" << endl;
+            *fLog << "Gamma" << endl;
             break;
         case kPROTON:
-            cout << "Proton" << endl;
+            *fLog << "Proton" << endl;
             break;
         case kHELIUM:
-            cout << "Helium" << endl;
+            *fLog << "Helium" << endl;
             break;
         }
-        cout << " Energy:         " << fEnergy << "GeV" << endl;
-        cout << " Impactpar.:     " << fImpact/100 << "m" << endl;
-        cout << " Photoelectrons: " << fPhotElfromShower << endl;
-        cout << endl;
+        *fLog << " Energy:         " << fEnergy << "GeV" << endl;
+        *fLog << " Impactpar.:     " << fImpact/100 << "m" << endl;
+        *fLog << " Photoelectrons: " << fPhotElfromShower << endl;
+        *fLog << endl;
         return;
     }
@@ -211,16 +195,16 @@
         {
         case kGAMMA:
-            cout << "Particle: Gamma" << endl;
+            *fLog << "Particle: Gamma" << endl;
             break;
         case kPROTON:
-            cout << "Particle: Proton" << endl;
+            *fLog << "Particle: Proton" << endl;
             break;
         case kHELIUM:
-            cout << "Particle: Helium" << endl;
+            *fLog << "Particle: Helium" << endl;
             break;
         }
     if (str.Contains("energy", TString::kIgnoreCase))
-        cout << "Energy: " << fEnergy << "GeV" << endl;
+        *fLog << "Energy: " << fEnergy << "GeV" << endl;
     if (str.Contains("impact", TString::kIgnoreCase))
-        cout << "Impact: " << fImpact << "cm" << endl;
-}
+        *fLog << "Impact: " << fImpact << "cm" << endl;
+}
