Simultaneously writing & reading TTree's

Hi,

I am writing an application that generates lots of output data in a time loop, which I would like to organize in several asynchronous TTree’s (i.e. not all the trees are updated in each time step) and write all the trees in a single file. At the same time algorithms elsewhere in the code need to read from these trees applying filters to select and retrieve data from anywhere from the most recent entries back.

Is what I am describing possible with TTree’s? Specifically:

  1. Can I simultaneously have several independent and asynchronous TTree’s written in a single file, or should I be using separate files? If such trees are written in a single file and grow very large, will automatic file splitting work or will it cause crashes and data loss?

  2. While maintaining live trees, branches and data structures for writing, can I also simultaneously use these to read data elsewhere? Would I be entering loops over entries as one does for simply reading from ROOT files, or should this be done differently?

Thanks for any advice or examples if available.

Marios

[quote]1) Can I simultaneously have several independent and asynchronous TTree’s written in a single file, [/quote]Yes.

[quote]If such trees are written in a single file and grow very large, will automatic file splitting work or will it cause crashes and data loss?[/quote]It should work.

[quote]2) While maintaining live trees, branches and data structures for writing, can I also simultaneously use these to read data elsewhere? [/quote]It should work as long as it is in the same thread … however note that unless you make special arrangement, the same ‘object’ will be used for reading and writing.

Cheers,
Philippe.