TFile/TFileCastor: opening a root file in a compressed file

Hello fellow rooters,

I’m trying to use the TFile::Open method to open a ROOT file stored in a compressed (ZIP) file in a Castor filesystem.

These work for me:

Local filesystem: TFile *localf = TFile::Open("","READONLY");

Remote filesystem: TFile *castorroot = TFile::Open("castor:///castor/", "READONLY");

However, trying to use a mix of the two is not working:

Anyone has an idea of where I’m fouling up?

Thanks in advance.

This is indeed a problem in the recent TCastorFile code. We are preparing a fix.

Cheers, Fons.

Hi again Fons,

Is there a workaround you might recommend in the meantime?


This should work in the svn trunk version, did you try?

Cheers, Fons.

Hi Fons,

Hi checked-out the trunk version today and compiled it. Here’s a sample output. I’ve tried opening:

  • a root file “root.root” at CASTOR (success),
  • a zip file “” at CASTOR (success),
  • a root file inside a zip file “” in the local filesystem (success),
  • the same root file inside a zip file, “”, at CASTOR (this failed).
lxplus215:/tmp/nbatista/root$ export ROOTSYS=`pwd`
lxplus215:/tmp/nbatista/root$ export PATH=$ROOTSYS/bin:$PATH
lxplus215:/tmp/nbatista/root$ export LD_LIBRARY_PATH=$ROOTSYS/lib:$LD_LIBRARY_PATH
lxplus215:/tmp/nbatista$ echo $PATH
lxplus215:/tmp/nbatista$ echo $LD_LIBRARY_PATH
lxplus215:/tmp/nbatista$ echo $CASTOR_HOME 
lxplus215:/tmp/nbatista$ echo $RFIO_USE_CASTOR_V2 
lxplus215:/tmp/nbatista/root$ echo $HOSTNAME
lxplus215:/tmp/nbatista/root$ echo $HOSTTYPE
lxplus215:/tmp/nbatista/root$ echo $STAGE_HOST
lxplus215:/tmp/nbatista/root$ echo $STAGE_SVCCLASS
lxplus215:/tmp/nbatista/root$ root
  *                                         *
  *        W E L C O M E  to  R O O T       *
  *                                         *
  *   Version   5.17/05   16 October 2007   *
  *                                         *
  *  You are welcome to visit our Web site  *
  *            *
  *                                         *

ROOT 5.17/05 (trunk@21031, Nov 24 2007, 12:16:08 on linuxx8664gcc)

CINT/ROOT C/C++ Interpreter version 5.16.27, Oct 25, 2007
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
root [0] TFile *f
root [1] TFile *z
root [2] TFile *fz
root [3] f = TFile::Open("castor:///castor/","READONLY")
(class TFile*)0x86f540
root [4] f->ls()
TCastorFile**           castor:///castor/
 TCastorFile*           castor:///castor/
  KEY: TF1      f;1     sin(x)
root [5] f->Close()
root [6] z = TFile::Open("castor:///castor/","READONLY")
(class TFile*)0x842da0
root [7] z->ls()
TCastorFile**           castor:///castor/
 TCastorFile*           castor:///castor/
root [8] fz = TFile::Open("castor:///castor/","READONLY")
Error in <TCastorFile::FindServerAndPath>: error getting file /castor/ (Request 474816dd-0000-1000-b158-bd9546b10000) 2/No such file or directory
Error in <TCastorFile::Create>: error opening file
Error in <TCastorFile::Create>: failing on file castor:///castor/
(class TFile*)0x0
root [9] fz = TFile::Open("","READONLY")
(class TFile*)0x83c7a0
root [10] fz->ls()
  KEY: TF1      f;1     sin(x)
root [11] fz->Close()
root [12] .q

I hope I’m not missing anything …