# Saving a TTree to a TFile every 100 ms

**URL:** <https://root-forum.cern.ch/t/saving-a-ttree-to-a-tfile-every-100-ms/45407>\
**Category:** Newbie\
**Tags:** tree\
**Created:** [June 15, 2021, 12:48pm UTC](https://root-forum.cern.ch/t/saving-a-ttree-to-a-tfile-every-100-ms/45407 "2021-06-15T12:48:37Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [June 15, 2021, 1:44pm UTC](https://root-forum.cern.ch/t/saving-a-ttree-to-a-tfile-every-100-ms/45407/3 "2021-06-15T13:44:54Z")

</div>

> [@Errors in remote client reading of TTree from TFile via xrootd while simultaneously updating TTree on server](https://root-forum.cern.ch/t/errors-in-remote-client-reading-of-ttree-from-tfile-via-xrootd-while-simultaneously-updating-ttree-on-server/43479/6):
>
> Reading from a TFile is that is being written to is supported to some extent. //////////////////////////////////////////////////////////////////////////////// /// Read the linked list of keys. /// /// Every directory has a linked list (fKeys). This linked list has been /// written on the file via WriteKeys as a single data record. /// /// It is interesting to call this function in the following situation. /// Assume another process1 is connecting this directory in Update mode /// - Process1 i…

> [@Read histogram from TFile while actively writing to it (with example)](https://root-forum.cern.ch/t/read-histogram-from-tfile-while-actively-writing-to-it-with-example/28273/12):
>
> @pcanal : I determined the cause of the segfault was calling Draw() on the TH1I pointer that was still NULL. I realize now my issue with delete file-\>FindObject(name); file-\>ReadKeys(); These commands only work if you have loaded the ROOT file that is actively being written. This does not work if you have opened an old file of the same name. When the file is RECREATEd, I now have two working methods of reading a file from disk while a process is actively writing to it. Below…

> [@TTree and Thread compatibility](https://root-forum.cern.ch/t/ttree-and-thread-compatibility/6050/2):
>
> See an example in the two files fw.C and fr.C in attachment. Although not using threads you should be able to pick the idea. Rene [fr.C](https://root-forum.cern.ch/uploads/default/original/2X/d/d6abdc54cdef2162a1ec24fad82ef8af9bafa16f.C) (845 Bytes) [fw.C](https://root-forum.cern.ch/uploads/default/original/2X/f/f8f16e73c9c140f6fed4ae5e4a6af6f80c93a3d7.C) (1.83 KB)

---

_[View the full topic](https://root-forum.cern.ch/t/saving-a-ttree-to-a-tfile-every-100-ms/45407)._
