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("myarchive.zip#0","READONLY");

Remote filesystem: TFile *castorroot = TFile::Open("castor:///castor/cern.ch/user/u/user/rootfile.root", "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?

Cheers
Joao

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 “zip.zip” at CASTOR (success),
  • a root file inside a zip file “localcopy_zip.zip” in the local filesystem (success),
    and
  • the same root file inside a zip file, “zip.zip#0”, 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
/tmp/nbatista/root/bin:/afs/cern.ch/user/n/nbatista/bin:/afs/cern.ch/user/n/nbatista/scripts:/usr/sue/bin:/afs/cern.ch/atlas/@sys/bin:/afs/cern.ch/atlas/scripts:/usr/local/bin:/usr/local/bin/X11:/usr/bin:/bin:/usr/bin/X11:/cern/pro/bin:/usr/kerberos/bin:/usr/X11R6/bin
lxplus215:/tmp/nbatista$ echo $LD_LIBRARY_PATH
/tmp/nbatista/root/lib:
lxplus215:/tmp/nbatista$ echo $CASTOR_HOME 
/castor/cern.ch/user/n/nbatista
lxplus215:/tmp/nbatista$ echo $RFIO_USE_CASTOR_V2 
YES
lxplus215:/tmp/nbatista/root$ echo $HOSTNAME
lxplus215.cern.ch
lxplus215:/tmp/nbatista/root$ echo $HOSTTYPE
x86_64
lxplus215:/tmp/nbatista/root$ echo $STAGE_HOST
castoratlas
lxplus215:/tmp/nbatista/root$ echo $STAGE_SVCCLASS
default
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  *
  *          http://root.cern.ch            *
  *                                         *
  *******************************************

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/cern.ch/user/n/nbatista/root.root","READONLY")
(class TFile*)0x86f540
root [4] f->ls()
TCastorFile**           castor:///castor/cern.ch/user/n/nbatista/root.root
 TCastorFile*           castor:///castor/cern.ch/user/n/nbatista/root.root
  KEY: TF1      f;1     sin(x)
root [5] f->Close()
root [6] z = TFile::Open("castor:///castor/cern.ch/user/n/nbatista/zip.zip","READONLY")
(class TFile*)0x842da0
root [7] z->ls()
TCastorFile**           castor:///castor/cern.ch/user/n/nbatista/zip.zip
 TCastorFile*           castor:///castor/cern.ch/user/n/nbatista/zip.zip
root [8] fz = TFile::Open("castor:///castor/cern.ch/user/n/nbatista/zip.zip#0","READONLY")
Error in <TCastorFile::FindServerAndPath>: error getting file /castor/cern.ch/user/n/nbatista/zip.zip#0 (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/cern.ch/user/n/nbatista/zip.zip#0
(class TFile*)0x0
root [9] fz = TFile::Open("localcopy_zip.zip#0","READONLY")
(class TFile*)0x83c7a0
root [10] fz->ls()
TFile**         localcopy_zip.zip#0
 TFile*         localcopy_zip.zip#0
  KEY: TF1      f;1     sin(x)
root [11] fz->Close()
root [12] .q
lxplus215:/tmp/nbatista$ 

I hope I’m not missing anything …