Index: /fact/tools/rootmacros/PulseTemplates/rootfilehandler.C
===================================================================
--- /fact/tools/rootmacros/PulseTemplates/rootfilehandler.C	(revision 13786)
+++ /fact/tools/rootmacros/PulseTemplates/rootfilehandler.C	(revision 13787)
@@ -1,3 +1,4 @@
 #include <iostream>
+#include <string>
 #include "TObjArray.h"
 
@@ -111,10 +112,12 @@
         TString         loc_fname,
         TString         subdirectory,
-        TObjArray*      histList,
+        TList*          histList,
         bool            saveResults,
         int             verbosityLevel
         )
 {
+
     if (!saveResults) return;
+    if (histList==NULL) return;
     if (verbosityLevel > 2) cout << endl
                                  << "...saving pixel histograms to subdirectory: "
@@ -127,6 +130,14 @@
                                  << "...writing histogram list to root file "
                                  << endl ;
-    gFile->WriteTObject(histList, subdirectory); // write the histograms into one Key in the top level directory
-
+    gFile->mkdir(subdirectory.Data());
+    gFile->cd(subdirectory.Data());
+    gDirectory->pwd();
+    cout << histList;
+    for ( int idx = 0; idx < histList->GetSize(); idx++)
+    {
+        histList->At(idx)->Write();
+    }
+//    gFile->WriteTObject(histList, subdirectory); // write the histograms into one Key in the top level directory
+    gFile->cd("..");
 
     if (verbosityLevel > 3) output_rootfile->ls();
@@ -175,5 +186,4 @@
         cout << "...opening root-file: ";
     }
-
     path += filename;
     TFile* file = TFile::Open( path );
@@ -186,2 +196,46 @@
     return file;
 }
+
+TString
+SetHostsPaths(
+        bool    isInHomeDir,
+        TString path
+        )
+{
+    TString hostName = gSystem->HostName();
+    TString dataDirectory;
+    TString homeDirectory;
+
+    TString temp_filename;
+
+    if ( hostName.Contains("isdc") ) //IF ONE IS WORKING AT ISDC
+    {
+
+        dataDirectory = "/fact/";
+        homeDirectory = "/home_nfs/isdc/jbbuss/";
+    }
+    if ( hostName.Contains("hpc")||hostName.Contains("node") ) //IF ONE IS WORKING AT PHIDO
+    {
+
+        dataDirectory = "/fhgfs/groups/app/fact-construction/";
+        homeDirectory = "/home/jbuss/";
+    }
+    else
+    {
+        exit(-1);
+    }
+    if (!isInHomeDir)
+    {
+        temp_filename = dataDirectory;
+        temp_filename += path;
+        path = temp_filename;
+    }
+    else if (isInHomeDir)
+    {
+        temp_filename = homeDirectory;
+        temp_filename += path;
+        path = temp_filename;
+    }
+
+    return path;
+}
