Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 1664)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 1665)
@@ -1,4 +1,9 @@
                                                                -*-*- END -*-*-
 
+ 2002/11/22: Abelardo Moralejo
+
+   * macros/threshold.C:
+     - 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 1664)
+++ /trunk/MagicSoft/Mars/macros/threshold.C	(revision 1665)
@@ -24,5 +24,5 @@
 
 
-void threshold(char* filename="data/camera.root")
+void threshold(char* filename="data/camera.root", char* outname="")
 {
     //
@@ -104,3 +104,15 @@
     while ((obj=Next()))
         obj->DrawClone();
+
+    // 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();
+	  }
+      }
 }
