Sequentially write TTree data to TFile

I am using a filesystem that only suports sequential write. So web could not append, random write, overwrite or truncate a file in this file system.

When I was writing a TTree to TTfile on this file system, I got I/O errors.

@pcanal Is there a way that I can create a TFile with sequential writing policy? Or can I firstly write TTree data to some data buffer, and then sequentially write those data to a root file?

I find a solution:

  1. Use TMemFile instead of TFile class.
  2. After writing a complete tree, copy data from TMemFile to a buffer.
  3. Store data in buffer to a file using std::ofstream.

So, is there a better way?

@pcanal should know.

Out of curiosity, what file system is that?

So, is there a better way?

Currently, this is probably indeed the best.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.