Index: fact/tools/rootmacros/PulseTemplates/rootfilehandler.C
===================================================================
--- fact/tools/rootmacros/PulseTemplates/rootfilehandler.C	(revision 13736)
+++ fact/tools/rootmacros/PulseTemplates/rootfilehandler.C	(revision 13737)
@@ -6,13 +6,45 @@
 using namespace std;
 
+/*
+  POSSIBLE IMPROVEMENT:
+
+  creat files on the heap and handover pointers
+
+  */
+
+
+
+
 void
 CreateRootFile(
         TString         loc_fname,
+        bool            overwrite,
         int             verbosityLevel
         )
 {
-    TFile output_rootfile(loc_fname,"UPDATE");
+    TFile* output_rootfile;
 
-    if (output_rootfile.IsZombie())
+    if(!overwrite)
+    {
+        output_rootfile = new TFile(loc_fname);
+        if (output_rootfile->IsZombie())
+        {
+            cout << "file does not exist...creating file" << endl;
+            delete output_rootfile;
+            output_rootfile = new TFile(loc_fname,"NEW");
+        }
+        else
+        {
+            cout << "file does exist and will be updated" << endl;
+            output_rootfile->OpenFile(loc_fname,"UPDATE");
+        }
+    }
+    else if(overwrite)
+    {
+        cout << "overwriting file" << endl;
+        output_rootfile = new TFile(loc_fname,"RECREATE");
+    }
+
+    if (output_rootfile->IsZombie())
     {
         cout << "Error opening file" << endl;
@@ -21,6 +53,7 @@
     else {
         if (verbosityLevel > 1) cout << "creating root-file...successfull" << endl;
-        output_rootfile.pwd();
-        output_rootfile.Close();
+        output_rootfile->pwd();
+        output_rootfile->Close();
+        delete output_rootfile;
     }
 }
