Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 4512)
+++ trunk/MagicSoft/Mars/Changelog	(revision 4513)
@@ -21,6 +21,21 @@
  2004/08/05: Thomas Bretz
 
-   * manalysis/MGeomApply.cc:
+   * manalysis/MGeomApply.cc, mimage/MCameraSmooth.[h,cc]:
      - removed dependancy on MBlindPixel
+
+   * macros/sql/readrbk.C, msql/MSQLServer.cc:
+     - fixed some memory leaks - the result of TSQLServer::Query
+       must be deleted
+
+   * mbase/MTaskInteractive.cc:
+     - added some comments
+
+   * mmain/MBrowser.cc:
+     - fixed a bug which caused '/data/MAGIC' not to be shown in
+       the dir-list
+
+   * mmc/MMcEvt.hxx:
+     - added some more particle ids
+
 
 
Index: trunk/MagicSoft/Mars/macros/sql/readrbk.C
===================================================================
--- trunk/MagicSoft/Mars/macros/sql/readrbk.C	(revision 4512)
+++ trunk/MagicSoft/Mars/macros/sql/readrbk.C	(revision 4513)
@@ -51,12 +51,17 @@
     TSQLRow *row;
 
-    TList rows;
+    Bool_t rc = kFALSE;
     while (row=res->Next())
     {
         if ((*row)[0])
-            return kTRUE;
+        {
+            rc = kTRUE;
+            break;
+        }
     }
 
-    return kFALSE;
+    delete res;
+
+    return rc;
 }
 
@@ -146,8 +151,12 @@
         query += "\");";
 
-        if (!serv->Query(query))
+        TSQLResult *res = serv->Query(query);
+        if (!res)
             cout << "ERROR: " << query << endl << endl;
         else
+        {
+            delete res;
             num++;
+        }
 
         entry = "";
Index: trunk/MagicSoft/Mars/mbase/MTaskInteractive.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MTaskInteractive.cc	(revision 4512)
+++ trunk/MagicSoft/Mars/mbase/MTaskInteractive.cc	(revision 4513)
@@ -72,4 +72,5 @@
 // --------------------------------------------------------------------------
 //
+// Default Constructor. Takes name and title of the interactive task
 //
 MTaskInteractive::MTaskInteractive(const char *name, const char *title) :
@@ -84,4 +85,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Destructor. Free all resources.
+//
 MTaskInteractive::~MTaskInteractive()
 {
@@ -91,4 +96,9 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Calls the function and returns its return value.
+// Called by PreProcess, Process, PostProcess and ReInit.
+//
 inline Int_t MTaskInteractive::Return(Int_t no, void *params)
 {
@@ -107,4 +117,9 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Generalized function to set the functions of your interactive task.
+// Called by SetPreProcess, SetProcess, SetPostProcess and SetReInit
+//
 Bool_t MTaskInteractive::Set(void *fcn, Int_t no, const char *params)
 {
@@ -138,4 +153,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+//
+//
 void MTaskInteractive::Free(Int_t no)
 {
Index: trunk/MagicSoft/Mars/mmain/MBrowser.cc
===================================================================
--- trunk/MagicSoft/Mars/mmain/MBrowser.cc	(revision 4512)
+++ trunk/MagicSoft/Mars/mmain/MBrowser.cc	(revision 4513)
@@ -137,6 +137,7 @@
 
     const TGPicture *pic0 = fList->GetPicture("magic_t.xpm");
-    if (!pic0)
+    if (pic0)
     {
+        dir->GetListBox()->Resize(100, 150);
         TGTreeLBEntry *entry = new TGTreeLBEntry(dir->GetListBox()->GetContainer(),
                                                  new TGString("/data/MAGIC"), pic0, 6000,
@@ -144,6 +145,6 @@
         TGLayoutHints *laylb = new TGLayoutHints(kLHintsLeft|kLHintsTop, 14, 0, 0, 0);
         dir->AddEntry(entry, laylb);
-        // Note necessary - deleted in ~TGLBContainer: fList->Add(laylb);
-        fList->Add(entry);
+        // Not necessary - deleted in ~TGLBContainer: fList->Add(laylb);
+        // fList->Add(laylb);
     }
 
Index: trunk/MagicSoft/Mars/msql/MSQLServer.cc
===================================================================
--- trunk/MagicSoft/Mars/msql/MSQLServer.cc	(revision 4512)
+++ trunk/MagicSoft/Mars/msql/MSQLServer.cc	(revision 4513)
@@ -31,4 +31,9 @@
 //  many features usefull working with relational tables.
 //
+//  Use it like TSQlServer:
+//    new MSQLServer("mysql://localhost:3306", "hercules", "stdmagicpassword");
+//    // now start your TBrowser
+//    new TBrowser;
+//
 ////////////////////////////////////////////////////////////////////////
 #include "MSQLServer.h"
@@ -72,5 +77,5 @@
     const TString desc((*row)[1]);
 
-    //cout << "Column Type: " << desc << endl;
+    delete res;
 
     const Bool_t isnum =
@@ -119,4 +124,6 @@
         num++;
     }
+
+    delete res;
 
     if (!isnum)
@@ -297,5 +304,8 @@
     TSQLResult *res = fServ->Query(query);
     if (res)
+    {
         PrintTable(res);
+        delete res;
+    }
     else
         cout << "Query failed: " << query << endl;
@@ -519,16 +529,30 @@
 
     if (res->GetFieldCount()!=1)
+    {
+        delete res;
         return (PrintError("GetEntry - Number of columns != 1", query), "");
+    }
 
     if (res->GetRowCount()>1)
+    {
+        delete res;
         return (PrintError("GetEntry - Number of rows > 1", query), "");
+    }
 
     if (res->GetRowCount()==0)
+    {
+        delete res;
         return "";
+    }
 
     const char *fld = res->Next()->GetField(0);
     if (!fld)
+    {
+        delete res;
         return (PrintError("GetEntry - Entry is empty", query), "");
-
-    return TString(fld);
-}
+    }
+
+    const TString rc(fld);
+    delete res;
+    return rc;
+}
Index: trunk/MagicSoft/include-Classes/MMcFormat/MMcEvt.hxx
===================================================================
--- trunk/MagicSoft/include-Classes/MMcFormat/MMcEvt.hxx	(revision 4512)
+++ trunk/MagicSoft/include-Classes/MMcFormat/MMcEvt.hxx	(revision 4513)
@@ -14,7 +14,11 @@
     enum ParticleId_t
     {
-        kGAMMA  =    1,
+        kGAMMA    =  1,
         kPOSITRON =  2,
         kELECTRON =  3,
+        kANTIMUON =  5,
+        kMUON     =  6,
+        kPI0      =  7,
+        kNEUTRON  = 13,
         kPROTON =   14,
         kHELIUM =  402,
@@ -145,4 +149,8 @@
       case kPOSITRON: return "Positron";
       case kELECTRON: return "Electron";
+      case kANTIMUON: return "Anti-Muon";
+      case kMUON:     return "Muon";
+      case kPI0:      return "Pi-0";
+      case kNEUTRON:  return "Neutron";
       case kPROTON:   return "Proton";
       case kHELIUM:   return "Helium";
@@ -151,5 +159,24 @@
       }
 
-      return Form("%d", fPartId);
+      return Form("Id:%d", fPartId);
+  }
+  TString GetParticleSymbol() const
+  {
+      switch (fPartId)
+      {
+      case kGAMMA:    return "\\gamma";
+      case kPOSITRON: return "e^{+}";
+      case kELECTRON: return "e^{-}";
+      case kANTIMUON: return "\\mu^{+}";
+      case kMUON:     return "\\mu^{-}";
+      case kPI0:      return "\\pi^{0}";
+      case kNEUTRON:  return "n";
+      case kPROTON:   return "p";
+      case kHELIUM:   return "He";
+      case kOXYGEN:   return "O";
+      case kIRON:     return "Fe";
+      }
+
+      return Form("Id:%d", fPartId);
   }
   TString GetEnergyStr() const
