Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 1665)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 1666)
@@ -1,3 +1,26 @@
                                                                -*-*- END -*-*-
+
+ 2002/11/22: Thomas Bretz
+
+   * macros/threshold.C:
+     - Simplified the new writing routine
+
+   * mbase/MLog.h:
+     - added a Getter-function for the debug level
+
+   * mbase/MTaskList.cc: 
+     - added another debugging output
+
+   * mfilter/MF.[h,cc]:
+     - made the automatically created chain names unique
+
+   * mfilter/MFDataChain.cc:
+     - corrected the GetRule stuff ({} were missing)
+
+   * mhist/MH3.cc:
+     - added MBinning as class type to FindObject
+     - added BinningHist (without the X) as binning name for a 1D histogram
+
+
 
  2002/11/22: Abelardo Moralejo
@@ -6,4 +29,6 @@
      - Added 2nd argument to write an output file containing the 
        energy spectrum histogram.
+
+
 
  2002/11/21: Thomas Bretz
Index: /trunk/MagicSoft/Mars/macros/threshold.C
===================================================================
--- /trunk/MagicSoft/Mars/macros/threshold.C	(revision 1665)
+++ /trunk/MagicSoft/Mars/macros/threshold.C	(revision 1666)
@@ -24,5 +24,5 @@
 
 
-void threshold(char* filename="data/camera.root", char* outname="")
+void threshold(TString filename="data/camera.root", TString outname="")
 {
     //
@@ -106,13 +106,11 @@
 
     // Write histogram to a file in case an output filename has been supplied:
-    if (strlen(outname) > 0)
-      {
-	TFile* f = new TFile(outname,"recreate");
-	if (f)
-	  {
-	    TH1F* hc = ((MHMcEnergy*)parlist.FindObject("MHMcEnergy"))->GetHistByName("MHMcEnergy");
-	    hc->Write();
-	    f.Close();
-	  }
-      }
+    if (outname.IsNull())
+        return;
+
+    TFile f(outname, "recreate");
+    if (!f)
+        return;
+
+    parlist.FindObject("MHMcEnergy")->Write();
 }
Index: /trunk/MagicSoft/Mars/mbase/MLog.h
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MLog.h	(revision 1665)
+++ /trunk/MagicSoft/Mars/mbase/MLog.h	(revision 1666)
@@ -65,4 +65,5 @@
 
     void SetDebugLevel(int i)           { fDebugLevel  =  i;  }
+    int GetDebugLevel() const           { return fDebugLevel; }
     void SetOutputLevel(int i)          { fOutputLevel =  i;  }
     void SetOutputDevice(int i)         { fDevice      =  i;  }
Index: /trunk/MagicSoft/Mars/mbase/MTaskList.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MTaskList.cc	(revision 1665)
+++ /trunk/MagicSoft/Mars/mbase/MTaskList.cc	(revision 1666)
@@ -141,5 +141,8 @@
     //
     if (!task)
+    {
+        *fLog << err << "ERROR - task argument=NULL." << endl;
         return kFALSE;
+    }
 
     //
Index: /trunk/MagicSoft/Mars/mfileio/MCT1ReadPreProc.cc
===================================================================
--- /trunk/MagicSoft/Mars/mfileio/MCT1ReadPreProc.cc	(revision 1665)
+++ /trunk/MagicSoft/Mars/mfileio/MCT1ReadPreProc.cc	(revision 1666)
@@ -540,9 +540,10 @@
     fin.read(cheadertitle, iHEADERTITLELENGTH);
 
-    Float_t fpreprocversion, structversion, dummy;
+    Float_t fpreprocversion, structversion;
+    Int_t dummyi;
 
     sscanf(cheadertitle, cTITLE_TEMPLATE,
            &fpreprocversion, &structversion,
-           &dummy, &dummy, &dummy, &dummy);
+           &dummyi, &dummyi, &dummyi, &dummyi);
 
     if (fpreprocversion < 0.6)
Index: /trunk/MagicSoft/Mars/mfilter/MF.cc
===================================================================
--- /trunk/MagicSoft/Mars/mfilter/MF.cc	(revision 1665)
+++ /trunk/MagicSoft/Mars/mfilter/MF.cc	(revision 1666)
@@ -155,5 +155,5 @@
 }
 
-MFilter *MF::ParseRule(TString &txt, MFilter *filter0) const
+MFilter *MF::ParseRule(TString &txt, MFilter *filter0, Int_t level) const
 {
     TString text;
@@ -243,9 +243,13 @@
     MFilter *newfilter;
     if (isrule)
+    {
         newfilter = new MFDataChain(text.Data(), c, num);
+        newfilter->SetName(Form("Chain%02d%c%f", level, c, num));
+    }
     else
+    {
         newfilter = new MFDataMember(text.Data(), c, num);
-
-    newfilter->SetName(Form("%s%c%f", text.Data(), c, num));
+        newfilter->SetName(Form("%s%c%f", text.Data(), c, num));
+    }
 
     return newfilter;
@@ -367,5 +371,5 @@
 
         default:
-            newfilter = ParseRule(txt, filter0);
+            newfilter = ParseRule(txt, filter0, level++);
             if (!newfilter)
             {
Index: /trunk/MagicSoft/Mars/mfilter/MF.h
===================================================================
--- /trunk/MagicSoft/Mars/mfilter/MF.h	(revision 1665)
+++ /trunk/MagicSoft/Mars/mfilter/MF.h	(revision 1666)
@@ -25,5 +25,5 @@
     Int_t IsAlNum(TString txt) const;
 
-    MFilter *ParseRule(TString &txt, MFilter *filter0) const;
+    MFilter *ParseRule(TString &txt, MFilter *filter0, Int_t level) const;
     MFilter *ParseString(TString txt, Int_t level);
 
Index: /trunk/MagicSoft/Mars/mfilter/MFDataChain.cc
===================================================================
--- /trunk/MagicSoft/Mars/mfilter/MFDataChain.cc	(revision 1665)
+++ /trunk/MagicSoft/Mars/mfilter/MFDataChain.cc	(revision 1666)
@@ -64,5 +64,5 @@
     fTitle = title ? title : "Filter using any data member of a class";
 
-    AddToBranchList(member);
+    //AddToBranchList(member);
 
     fFilterType = (type=='<' ? kELowerThan : kEGreaterThan);
@@ -111,5 +111,7 @@
 TString MFDataChain::GetRule() const
 {
-    TString ret = fData.GetRule();
+    TString ret = "{";
+    ret += fData.GetRule();
+    ret += "}";
     ret += fFilterType==kELowerThan?"<":">";
 
Index: /trunk/MagicSoft/Mars/mhist/MH3.cc
===================================================================
--- /trunk/MagicSoft/Mars/mhist/MH3.cc	(revision 1665)
+++ /trunk/MagicSoft/Mars/mhist/MH3.cc	(revision 1666)
@@ -223,5 +223,5 @@
     {
     case 3:
-        binsz = (MBinning*)plist->FindObject(bname+"Z");
+        binsz = (MBinning*)plist->FindObject(bname+"Z", "MBinning");
         if (!binsz)
         {
@@ -235,5 +235,5 @@
             return kFALSE;
     case 2:
-        binsy = (MBinning*)plist->FindObject(bname+"Y");
+        binsy = (MBinning*)plist->FindObject(bname+"Y", "MBinning");
         if (!binsy)
         {
@@ -247,9 +247,15 @@
             return kFALSE;
     case 1:
-        binsx = (MBinning*)plist->FindObject(bname+"X");
+        binsx = (MBinning*)plist->FindObject(bname+"X", "MBinning");
         if (!binsx)
         {
-            *fLog << err << dbginf << "MBinning '" << bname << "X' not found... aborting." << endl;
-            return kFALSE;
+            if (fDimension==1)
+                binsx = (MBinning*)plist->FindObject(bname, "MBinning");
+
+            if (!binsx)
+            {
+                *fLog << err << dbginf << "Neither MBinning '" << bname << "X' nor '" << bname << "' found... aborting." << endl;
+                return kFALSE;
+            }
         }
         if (binsx->IsLogarithmic())
