Index: trunk/FACT++/src/fitsdump.cc
===================================================================
--- trunk/FACT++/src/fitsdump.cc	(revision 18837)
+++ trunk/FACT++/src/fitsdump.cc	(revision 18838)
@@ -406,4 +406,18 @@
 
 
+#ifdef HAVE_ROOT
+template<typename T>
+void SetBranch(TTree *ttree, const string &bname, const MyColumn &col)
+{
+    TBranch *b = ttree->GetBranch(bname.c_str());
+
+    T *address = reinterpret_cast<T*>(col.ptr)+col.first;
+    if (b)
+        b->SetAddress(address);
+    else
+        ttree->Branch(bname.c_str(), address);
+}
+#endif
+
 // --------------------------------------------------------------------------
 //
@@ -455,5 +469,12 @@
 
     // FIXME: Add header values
-    TTree *ttree = tfile ? new TTree(fKeyMap.find("EXTNAME")->second.value.c_str(), Tools::Form("From N=%d [cnt=%d] {filter=%s}", first, limit, filter.c_str()).c_str()) : 0;
+    TTree *ttree = 0;
+    if (tfile)
+    {
+        const string tname = fKeyMap.find("EXTNAME")->second.value;
+        tfile->GetObject(tname.c_str(), ttree);
+        if (!ttree)
+            ttree = new TTree(tname.c_str(), Tools::Form("From N=%d [cnt=%d] {filter=%s}", first, limit, filter.c_str()).c_str());
+    }
 #endif
 
@@ -501,23 +522,23 @@
             {
             case 'B':
-                ttree->Branch(branch.c_str(), reinterpret_cast<unsigned char*>(it->ptr)+it->first);
+                SetBranch<unsigned char>(ttree, branch, *it);
                 break;
             case 'L':
-                ttree->Branch(branch.c_str(), reinterpret_cast<bool*>(it->ptr)+it->first);
+                SetBranch<bool>(ttree, branch, *it);
                 break;
             case 'I':
-                ttree->Branch(branch.c_str(), reinterpret_cast<int16_t*>(it->ptr)+it->first);
+                SetBranch<int16_t>(ttree, branch, *it);
                 break;
             case 'J':
-                ttree->Branch(branch.c_str(), reinterpret_cast<int32_t*>(it->ptr)+it->first);
+                SetBranch<int32_t>(ttree, branch, *it);
                 break;
             case 'K':
-                ttree->Branch(branch.c_str(), reinterpret_cast<int64_t*>(it->ptr)+it->first);
+                SetBranch<int64_t>(ttree, branch, *it);
                 break;
             case 'E':
-                ttree->Branch(branch.c_str(), reinterpret_cast<float*>(it->ptr)+it->first);
+                SetBranch<float>(ttree, branch, *it);
                 break;
             case 'D':
-                ttree->Branch(branch.c_str(), reinterpret_cast<double*>(it->ptr)+it->first);
+                SetBranch<double>(ttree, branch, *it);
                 break;
             default:
@@ -630,5 +651,5 @@
         fout << endl;
 
-        ttree->Write();
+        ttree->Write("", TObject::kWriteDelete);
         delete tfile;
     }
@@ -1273,5 +1294,5 @@
         ("filter,f",    var<string>(""),        "Filter to restrict the selection of events (e.g. '[0]>10 && [0]<20';  does not work with stat and minmax yet)")
         ("overwrite",   po_switch(),            "Force overwriting an existing root file ('RECREATE')")
-        ("update",      po_switch(),            "Update an existing root file with the new tree ('UPDATE')")
+        ("update",      po_switch(),            "Update an existing root file ('UPDATE') or an existing tree with more data.")
         ("compression", var<uint16_t>(1),       "zlib compression level for the root file")
 #endif
