Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 2119)
+++ trunk/MagicSoft/Mars/Changelog	(revision 2120)
@@ -1,3 +1,26 @@
                                                  -*-*- END OF LINE -*-*-
+ 2003/05/19: Thomas Bretz
+
+   * mbase/MEvtLoop.cc, mbase/MParList.cc, mbase/MTaskList.cc,
+     mfileio/MReadTree.cc, mfileio/MWriteRootFile.cc:
+     - use new manipulator 'underline'
+
+   * mbase/MLog.cc:
+     - added new underlining
+     - added blue color for debugging
+     
+   * mbase/MLogManip.[h,cc]:
+     - added underline
+     - added dbg and increased all other debug(n) levels by one
+     
+   * mbase/MParContainer.h:
+     - made fDisplay persistent (workaround for a obsolete warning in
+       root 3.02/07)
+
+   * mfileio/MWriteRootFile.[h,cc]:
+     - fixed a bug introduced when implementing UPDATE mode,
+       kIsNewTree set for TTree
+
+
 
  2003/05/16: Abelardo Moralejo
@@ -6,5 +29,13 @@
      - Added SetCoeff
 
+
+
  2003/05/16: Thomas Bretz
+
+   * mfilter/MFEventSelector2.[h,cc]:
+     - added
+
+   * mfilter/Makefile, mfilter/FilterLinkDef.h:
+     - added MFEventSelector2
 
    * mbase/MContinue.cc:
Index: trunk/MagicSoft/Mars/mbase/MEvtLoop.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MEvtLoop.cc	(revision 2119)
+++ trunk/MagicSoft/Mars/mbase/MEvtLoop.cc	(revision 2120)
@@ -108,6 +108,5 @@
     fName = name;
 
-    fLog->Underline();
-    *fLog << inf << "Instantiated MEvtLoop (" << name << "), using ROOT v" << ROOTVER << endl;
+    *fLog << inf << underline << "Instantiated MEvtLoop (" << name << "), using ROOT v" << ROOTVER << endl;
 }
 
Index: trunk/MagicSoft/Mars/mbase/MLog.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MLog.cc	(revision 2119)
+++ trunk/MagicSoft/Mars/mbase/MLog.cc	(revision 2120)
@@ -25,50 +25,71 @@
 
 //////////////////////////////////////////////////////////////////////////////
-//                                                                          //
-// MLog                                                                     //
-//                                                                          //
-// This is what we call the logging-system.                                 //
-//                                                                          //
-// It is derived from the C++ streaming classes and can handle our          //
-// logging. The log output can be redirected to stdout, stderr, any other   //
-// stream or a root window.                                                 //
-//                                                                          //
-// There is a global log-instance which you can use like cout, id is gLog.  //
-// A log-instance of your choice (gLog by default) is destributed to all    //
-// Task which are used in an eventloop, so that you can redirect the output //
-// of one eventloop to where you want..                                     //
-//                                                                          //
-// The MLog stream has the advantage, that it can be used like the common   //
-// C++ streams (for example cout). It can redirect the stream to different  //
-// outputs (console, file, GUI) if necessary at the same time.              //
-//                                                                          //
-// It supports different debug levels. The debug level of the current       //
-// stream contents is set by SetDebugLevel, the output level of the         //
-// current stream can be set by SetOutputLevel.                             //
-//                                                                          //
-// The header file MLogManip.h contains so called manipulators (like flush  //
-// or setw from iomanip.h) which can manipulate these levels from within    //
-// stream, for example:                                                     //
-//    gLog << debug(3) << "Hallo World " << endl;                           //
-// sets the debug level of the following stream to 3                        //
-//                                                                          //
-// edev(), ddev() can be used to enable/disable an output device from       //
-// within the stream. The enumerations are defined in MLog::_flags          //
-//                                                                          //
-// Commonly used abbreviations are also defined:                            //
-//    dbginf  Prints source file name and line number. Used for output      //
-//            which people may like to look up in the code                  //
-//    all     Is streamed to the output in any case. Used for outputs       //
-//            which are requested by the user (eg TObject::Print)           //
-//    err     Should be used for fatal errors which stops the current       //
-//            processing, eg:                                               //
-//              gLog << err << "ERROR: TObject::Copy - Stopped" << endl;    //
-//    warn    Warning means an error occured, but it is not clear whether   //
-//            this results further procesing or not.                        //
-//    inf     Informs the user about what's going on. Mostly usefull for    //
-//            debugging, but in general not necessary at all.               //
-//                                                                          //
-// gLog is a global stream defined like cout or cerr                        //
-//                                                                          //
+//
+// MLog
+//
+// This is what we call the logging-system.
+//
+// It is derived from the C++ streaming classes and can handle our
+// logging. The log output can be redirected to stdout, stderr, any other
+// stream or a root window.
+//
+// There is a global log-instance which you can use like cout, id is gLog.
+// A log-instance of your choice (gLog by default) is destributed to all
+// Task which are used in an eventloop, so that you can redirect the output
+// of one eventloop to where you want..
+//
+// The MLog stream has the advantage, that it can be used like the common
+// C++ streams (for example cout). It can redirect the stream to different
+// outputs (console, file, GUI) if necessary at the same time.
+//
+// It supports different debug levels. The debug level of the current
+// stream contents is set by SetDebugLevel, the output level of the
+// current stream can be set by SetOutputLevel.
+//
+// The header file MLogManip.h contains so called manipulators (like flush
+// or setw from iomanip.h) which can manipulate these levels from within
+// stream, for example:
+//    gLog << debug(3) << "Hallo World " << endl;
+// sets the debug level of the following stream to 3
+//
+// edev(), ddev() can be used to enable/disable an output device from
+// within the stream. The enumerations are defined in MLog::_flags
+//
+// Commonly used abbreviations are also defined:
+//    dbginf  Prints source file name and line number. Used for output
+//            which people may like to look up in the code
+//    all     Is streamed to the output in any case. Used for outputs
+//            which are requested by the user (eg TObject::Print)
+//    err     Should be used for fatal errors which stops the current
+//            processing, eg:
+//              gLog << err << "ERROR: TObject::Copy - Stopped" << endl;
+//    warn    Warning means an error occured, but it is not clear whether
+//            this results further procesing or not.
+//    inf     Informs the user about what's going on. Mostly usefull for
+//            debugging, but in general not necessary at all.
+//    dbg     Use this for your private purpose to mark something as debug
+//            output. This is _not_ ment to be persistent!
+//
+// If your console is capable of ANSI colors the stream is displayed
+// in several colors:
+//    all:    default
+//    err:    red
+//    warn:   yellow/brown
+//    inf:    green
+//    dbg:    blue (and all other levels)
+//
+// If you have a dark background on your console you might want to set
+// an environment variable, eg:
+//    export MARSDEFINES=-DHAVE_DARKBACKGROUND
+// and recompile MLog.
+//
+// If your console can display it also 'underline' can be used. This
+// underlines a text till the next 'endl', eg:
+//    gLog << underline << "This is important!" << endl;
+//
+// To switch off ANSI support call: SetNoColors()
+//
+// gLog is a global stream defined like cout or cerr
+//
 //////////////////////////////////////////////////////////////////////////////
 
@@ -99,4 +120,5 @@
 const char *const MLog::kYellow    = "\033[33m";
 #endif
+const char *const MLog::kBlue      = "\033[34m";
 const char *const MLog::kUnderline = "\033[4m";;
 const char *const MLog::kBlink     = "\033[5m";;
@@ -197,4 +219,6 @@
 void MLog::Underline()
 {
+    SetBit(kIsUnderlined);
+
     if (TestBit(eNoColors))
         return;
@@ -212,8 +236,11 @@
         switch (fOutputLevel)
         {
-        case 0:  out << MLog::kReset;   break;  // all // maybe not necessary?
+            // do not output reset. Otherwise we reset underline in 0-mode
+            // case 1: out << MLog::kReset; break; // all
+        case 0:  break; // all = background color
         case 1:  out << MLog::kRed;     break;  // err
         case 2:  out << MLog::kYellow;  break;  // warn
         case 3:  out << MLog::kGreen;   break;  // inf
+        default: out << MLog::kBlue;    break;  // all others (dbg)
         }
 
@@ -221,7 +248,7 @@
     {
         // Check for EOL
-        const Bool_t endline = fBase[len-1]=='\n';
+        const Int_t endline = fBase[len-1]=='\n' ? 1 : 0;
         // output text to screen (without trailing '\n')
-        out << TString(fBase, endline ? len-1 : len);
+        out << TString(fBase, len-endline);
         // reset colors if working with colors
         if (!TestBit(eNoColors))
@@ -229,7 +256,28 @@
         // output EOL of check found EOL
         if (endline)
+        {
             out << '\n';
+            // Check whether text was underlined
+            if (TestBit(kIsUnderlined) && TestBit(eNoColors))
+            {
+                out << setw(len-1) << setfill('-') << "" << "\n";
+                ResetBit(kIsUnderlined);
+            }
+        }
     }
     out.flush();
+}
+
+void MLog::AddGuiLine(const TString &line)
+{
+    // add a new TString* to the array of gui lines
+    TString **newstr = new TString*[fNumLines+1];
+    memcpy(newstr, fGuiLines, fNumLines*sizeof(TString*));
+    if (fNumLines>0)
+        delete fGuiLines;
+    fGuiLines = newstr;
+
+    // add Gui line as last line of array
+    fGuiLines[fNumLines++] = new TString(line);
 }
 
@@ -263,24 +311,24 @@
     {
         // check whether the current text was flushed or endl'ed
-        const Bool_t flushed = fBase[len-1]!='\n';
+        const Int_t endline = fBase[len-1]=='\n' ? 1 : 0;
 
         // for the gui remove trailing characters ('\n' or '\0')
-        fBase[flushed ? len : len-1]='\0';
+        fBase[len-endline]='\0';
 
         // add new text to line storage
         fGuiLine += fBase;
 
-        if (!flushed)
+        if (endline)
         {
-            // add a new TString* to the array of gui lines
-            TString **newstr = new TString*[fNumLines+1];
-            memcpy(newstr, fGuiLines, fNumLines*sizeof(TString*));
-            if (fNumLines>0)
-                delete fGuiLines;
-            fGuiLines = newstr;
-
-            // add Gui line as last line of array
-            fGuiLines[fNumLines++] = new TString(fGuiLine);
+            AddGuiLine(fGuiLine);
             fGuiLine = "";
+
+            // Check whether text should be underlined
+            if (endline && TestBit(kIsUnderlined))
+            {
+                AddGuiLine("");
+                fGuiLines[fNumLines-1]->Append('-', fGuiLines[fNumLines-2]->Length());
+                ResetBit(kIsUnderlined);
+            }
         }
     }
Index: trunk/MagicSoft/Mars/mbase/MLogManip.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MLogManip.cc	(revision 2119)
+++ trunk/MagicSoft/Mars/mbase/MLogManip.cc	(revision 2120)
@@ -107,2 +107,20 @@
 }
 
+ostream& underline(ostream& lout)
+{
+    //
+    // get the streambuf of the stream
+    // get the pointer to the parent class by casting
+    // Disable an output device of the logging stream, it should
+    // be possible to disable more than one output device at the
+    // same time by oring them together
+    //
+    // Be careful: This manipulator can only be used in MLogging
+    // streams - in other streams SetOutputLevel is a call
+    // of a non existing function
+    //
+    MLog *log=(MLog*)lout.rdbuf();
+    log->Underline();
+    return lout;
+}
+
Index: trunk/MagicSoft/Mars/mbase/MLogManip.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MLogManip.h	(revision 2119)
+++ trunk/MagicSoft/Mars/mbase/MLogManip.h	(revision 2120)
@@ -11,30 +11,33 @@
 // define a general simple macro for manipulator definitions (int)
 //
+#define MANIPULATOR0(name) \
+   extern ostream& ##name(ostream& lout);
+
 #ifndef OMANIP
-
-#define MANIPULATOR(name) \
-    extern ostream& __omanip_##name(ostream& lout, int i); \
-    inline omanip<int> ##name(int i)                \
-    {                                               \
-        return omanip<int>(__omanip_##name, i);    \
-    }
+   #define MANIPULATOR1(name) \
+      extern ostream& __omanip_##name(ostream& lout, int i); \
+      inline omanip<int> ##name(int i)                \
+      {                                               \
+         return omanip<int>(__omanip_##name, i);     \
+      }
 
 #else
-
-#define MANIPULATOR(name) \
-    extern ostream& __omanip_##name(ostream& lout, int i); \
-    inline OMANIP(int) ##name(int i)                \
-    {                                               \
-        return OMANIP(int)(__omanip_##name, i);    \
-    }
+   #define MANIPULATOR1(name) \
+       extern ostream& __omanip_##name(ostream& lout, int i); \
+       inline OMANIP(int) ##name(int i)                \
+       {                                               \
+          return OMANIP(int)(__omanip_##name, i);      \
+       }
 
 #endif
+
 //
 // definitions
 //
-MANIPULATOR(debug);    // set debug level
-MANIPULATOR(device);   // set ouput devices
-MANIPULATOR(edev);     // enable additional output devices
-MANIPULATOR(ddev);     // disable given output
+MANIPULATOR0(underline); // underline output
+MANIPULATOR1(debug);     // set debug level
+MANIPULATOR1(device);    // set ouput devices
+MANIPULATOR1(edev);      // enable additional output devices
+MANIPULATOR1(ddev);      // disable given output
 //#ifndef __CINT__
 //__DEFINE_IOMANIP_FN1(smanip, int, debug);    // set debug level
@@ -53,9 +56,10 @@
 //
 #ifndef __CINT__
-#define dbginf      __FILE__ << " l." << dec << __LINE__ << ": "
-#define all    debug(0)
-#define err    debug(1)
-#define warn   debug(2)
-#define inf    debug(3)
+#define dbginf dbg << __FILE__ << " l." << dec << __LINE__ << ": "
+#define all    debug(0) // use this for output in any case
+#define err    debug(1) // use this for fatal errors (red)
+#define warn   debug(2) // use this for wrnings (yellow)
+#define inf    debug(3) // use this for informations (green)
+#define dbg    debug(4) // use this for debug messages (blue)
 #endif
 //
Index: trunk/MagicSoft/Mars/mbase/MParContainer.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MParContainer.h	(revision 2119)
+++ trunk/MagicSoft/Mars/mbase/MParContainer.h	(revision 2120)
@@ -36,5 +36,10 @@
     MLog   *fLog;         // The general log facility for this object, initialized with the global object
 
-    MStatusDisplay *fDisplay;
+    // This data member was added later, because for calculating the
+    // Checksum root (3.02/07) ignores ClassDef=0 all data members
+    // which are not persistent (//!) are used. To make the two
+    // class versions CheckSum-compatible (only getting rid of a
+    // warning) this member is persistent.
+    MStatusDisplay *fDisplay; //!
 
 private:
Index: trunk/MagicSoft/Mars/mbase/MParList.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MParList.cc	(revision 2119)
+++ trunk/MagicSoft/Mars/mbase/MParList.cc	(revision 2120)
@@ -503,6 +503,5 @@
 void MParList::Print(Option_t *t) const
 {
-    *fLog << all << " " << GetDescriptor() << endl;
-    *fLog << setfill('-') << setw(strlen(GetDescriptor())+2) << "" << endl;
+    *fLog << all << underline << GetDescriptor() << ":" << endl;
 
     MParContainer *obj = NULL;
Index: trunk/MagicSoft/Mars/mbase/MTaskList.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MTaskList.cc	(revision 2119)
+++ trunk/MagicSoft/Mars/mbase/MTaskList.cc	(revision 2120)
@@ -549,7 +549,5 @@
     if (lvl==0)
     {
-        *fLog << all << endl;
-        *fLog << "Execution Statistics: " << endl;
-        *fLog << "---------------------" << endl;
+        *fLog << all << underline << "Execution Statistics:" << endl;
         *fLog << GetDescriptor();
         if (GetFilter())
@@ -580,7 +578,5 @@
 void MTaskList::Print(Option_t *t) const
 {
-    *fLog << all << endl;
-    *fLog << GetDescriptor() << endl;
-    *fLog << setfill('-') << setw(strlen(GetDescriptor())) << "" << endl;
+    *fLog << all << underline << GetDescriptor() << ":" << endl;
 
     fTasks->Print();
Index: trunk/MagicSoft/Mars/mfileio/MReadTree.cc
===================================================================
--- trunk/MagicSoft/Mars/mfileio/MReadTree.cc	(revision 2119)
+++ trunk/MagicSoft/Mars/mfileio/MReadTree.cc	(revision 2120)
@@ -895,6 +895,5 @@
 void MReadTree::Print(Option_t *o) const
 {
-    *fLog << all << GetDescriptor() << dec << endl;
-    *fLog << setfill('-') << setw(strlen(GetDescriptor())) << "" << endl;
+    *fLog << all << underline << GetDescriptor() << ":" << endl << dec;
     *fLog << " Files [Tree]:" << endl;
 
Index: trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc
===================================================================
--- trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc	(revision 2119)
+++ trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc	(revision 2120)
@@ -140,7 +140,5 @@
 void MWriteRootFile::Print(Option_t *) const
 {
-    *fLog << all << " File: " << GetFileName() << endl;
-    *fLog << setfill('-') << setw(strlen(GetFileName())+8) << "" << endl;
-    *fLog << setfill(' '); // FIXME: not resetting setfill results in strange output???
+    *fLog << all << underline << "File: " << GetFileName() << ":" << endl;
 
     TTree *t = NULL;
@@ -278,5 +276,5 @@
             // tree as a branch created by MWriteRootFile
             //
-            entry->SetBit(kIsNewTree);
+            tree->SetBit(kIsNewTree);
 
             gDirectory = save;
@@ -358,6 +356,4 @@
 void MWriteRootFile::CheckAndWrite() const
 {
-    const Int_t kFillTree = BIT(14);
-
     TObject *obj;
 
@@ -380,5 +376,5 @@
         // the corresponding tree entry.
         //
-        if (b->TestBit(kIsNewTree))
+        if (b->GetTree()->TestBit(kIsNewTree))
             b->GetTree()->SetBit(kFillTree);
         else
Index: trunk/MagicSoft/Mars/mfileio/MWriteRootFile.h
===================================================================
--- trunk/MagicSoft/Mars/mfileio/MWriteRootFile.h	(revision 2119)
+++ trunk/MagicSoft/Mars/mfileio/MWriteRootFile.h	(revision 2120)
@@ -81,4 +81,5 @@
 
     enum {
+        kFillTree  = BIT(14),
         kIsNewTree = BIT(15)
     };
