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();
 }
