Please read tips for efficient and successful posting and posting code
ROOT Version: 5.34.36
Platform: CentOS 7
Compiler: gcc 4.9
My data acquisition system writes data to ROOT files using the following code:
fTFileHandle = TFile::Open(fOutFile,"NEW","PADME Merged Raw Events");
if ( (!fTFileHandle) || fTFileHandle->IsZombie() ) {
delete fTFileHandle;
return ROOTIO_ERROR;
}
fTTreeMain = new TTree("RawEvents","PADME Raw Events Tree");
fTTreeMain->Branch("RawEvent",&fTRawEvent);
...write many events to file...
fTTreeMain->Write();
fTFileHandle->Close();
It would be very useful for me if I could monitor the content of the events WHILE they are being written, i.e. doing something similar to the Unix command “tail -f”.
If I open the file that is being written with an external program I get some warning messages:
Warning in <TFile::Init>: file rawdata1/run_0030611_20201111_120928/run_0030611_20201111_120928_lvl1_00_006.root probably not closed, trying to recover
Info in <TFile::Recover>: rawdata1/run_0030611_20201111_120928/run_0030611_20201111_120928_lvl1_00_006.root, recovered key TTree:RawEvents at address 115620453
Warning in <TFile::Init>: successfully recovered 1 keys
I can then read the events only up to a certain point.
If I close and reopen the file I get similar warning messages and can read a bit more events.
Is there a way to open the file and keep it open while progressively reading the events shortly after they have been written to the file?
Thank you
Emanuele Leonardi