TFile and symbolic links

I’d like to open a new TFile in a path previously declared as a symbolic link (ln -sf), pointing to the machine running the batch job (the reason for this is that my analysis program generates root files in my home which I’d like to be readdressed, thus avoiding filling all the available space). In order to do this I tried:

TFile rootfile(“data.root”);

(filling the file with a tree, filling the branches,writing the tree on file…)


where data.root was previously declared as a symbolic link pointing to an empty file created (with touch) in the job’s working directory (e.g. /pool/lsf/…/183083317/data.root, from a ‘pwd’ on the pool machine performed by the batch jobs script) end eventually rfcopied on CASTOR. The error message is:

Error in TFile::ReadBuffer: error reading all requested bytes from file data.root, got 0 of 300
Error in TFile::Init: data.root not a ROOT file

i.e. it is not recognized as a ROOT file.
The root file with its tree inside is correctly created if the symbolic link procedure is not used.
A similar procedure works well in PAW, using HROPEN.
Where’s my (probably silly) mistake?
Thank you.


Rather than touch, you need to initialize the file as follow:echo 'TFile::Open("a.root","NEW");' | root.exe -b -land use it in your code via the link by opening the file in update mode:TFile rootfile("data.root","UPDATE");