TChain and castor

I am trying to read a ROOT file with TTrees in it via TChain. The file is in the castor.
I can set the branch addresses with SetBranchAddress but when I want to retrieve the
TBranch* pointers via

b_RunNumber = fChain->GetBranch(“RunNumber”);

my code crashes and I get:

Error in TFile::TFile: file does not exist
Error in TFile::TFile: file does not exist

*** Break *** segmentation violation
Generating stack trace…
0xf6e4768c in TTree::LoadTree(long long) + 0xf0 from /afs/

I attached the header of my code: Info.h

Thank you,
Info.h (11.5 KB)

Please send more information:
-your file Info.C
-at least one small data file

Do you get the crash when connecting the first file?



I attached the package that I use. After unpacking it, you only have to run CppAnaMain.C:
root [0] .x CppAnaMain.C

In the CppAnaMain.C file the example 2 root files on the castor are loaded (and the root files on castor are readable so if you are on lxplus you can run it). This root files are a bit large and they were generated by others so I cannot prepare a small one for you but I hope you can run the code on the lxplus as well.
An interesting feature of this problem that the code crashes only if I want to load the root files from castor, otherwise it works. Still, the idea would be to load them all from the castor because after a point I have to load tens or hundreds of such files to get statistics…

Castor.tar.gz (16.3 KB)

Dear Balint,

I have started investigating the problem but, unfortunately, so far I could not reproduce the segv. However, my attempts to open the files also failed.

The point is that they fail not only within ROOT (both with 5.10.00e and with a more recent version 5.15.04), but also with standard Castor commands. I can in fact list the files

but when I try to copy them locally I get this

(I have enabled tracing to get the details). I get similar messages within ROOT.
Unless this is weirdly related with the fact that I am not part of the ‘zp’, ATLAS, group (but accordingly to ‘nsls’ I should be able to read the file),
this may indicate a problem on the server side. Restaging the files may help in this cases.

A last question: how do you set the environment to use ROOT 5.10.00e ?
Could you post the output of ’ ldd $ROOTSYS/lib/ ’ ?

G. Ganis


If you tell me where I can copy a sample file where you would be able to access it (e.g. some public folder in my home dir or else on castor) then I am happy to copy it there.



Please don’t investigate further, I think I found a bug in the code that I have sent!
I’ll send you later on the corrected version.

Thank you,


The problem is solved in a somewhat interesting manner. It was true that the castor callings crashed when I wanted to get the branchaddress via:

TBranch * b_RunNumber = fChain->GetBranch(“RunNumber”);

but it turned out that I don’t need these variables so I just commented out every such call, and now everything works. I can read lot of root files from castor without problem.