Building XTNetFile
Introduction
BaBar has implemented
a client for the xrootd server called XTNetFile which can be used within the ROOT framework. It was designed as a plugin
replacement for the TNetFile class used to access files via the original rootd.
In Summer 2004, this client was integrated into the ROOT framework itself in
version 4.01/02 with a slight name change, from XTNetFile to TXNetFile,
to follow the ROOT coding guidelines. If you are using that ROOT version or a
later one, you can stop reading now. You should be able to access files
via xrootd from ROOT out-of-the-box using the usual root://host:port//blahblah
syntax. The client will also be supported on all platforms supported by ROOT
itself.
For use with ROOT versions before version 4.01/02 we provide a download
tarball of the last XTNetFile version made before we began the integration
into ROOT (as "TXNetFile"). This is linked from the main
xrootd page.
Building the XTNetFile plugin
As the XTNetFile client is being integrated into ROOT, only a very simple
build makefile is provided and only a limited set of platforms are supported
for this standalone version:
- RH7.2, gcc 2.95.3
- RHEL3, gcc 3.2.3
- Sol8, Workshop 6 Update 1
- Sol9, Forte7
and it should work with (at least) ROOT 3.10-xx and 4.00-08.
The first thing you need to do is set your ROOTSYS envvar to point to the
version of ROOT against which you would like to build. Then unpack the source
code:
noric01> gtar xzvf XTNetFile-V00-01-01.src.tgz
XTNetFile-V00-01-01/
XTNetFile-V00-01-01/XTNetFile/
XTNetFile-V00-01-01/XTNetFile/AbsUnsolicitedMsgHandler.hh
XTNetFile-V00-01-01/XTNetFile/AbsXTNetCommon.cc
XTNetFile-V00-01-01/XTNetFile/AbsXTNetCommon.hh
<...>
XTNetFile-V00-01-01/XProtocol/XPtypes.hh
XTNetFile-V00-01-01/Experiment/
XTNetFile-V00-01-01/Experiment/Experiment.hh
noric01> cd XTNetFile-V00-01-01/XTNetFile/
noric01> gmake
g++ -D__linux__ -D_ALL_SOURCE -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
-D_FILE_OFFSET_BITS=64 -fPIC -shared -D_REENTRANT -D_GNU_SOURCE -O3 -I. -I..
-I/afs/slac.stanford.edu/g/babar/package/root/4.00-08/Linux24RH72_i386_gcc2953/include
-I/afs/slac.stanford.edu/g/babar/package/root/4.00-08/Linux24RH72_i386_gcc2953/thread/inc
-o ../obj/Linux/AbsXTNetCommon.o -c AbsXTNetCommon.cc
Compiling TXCacheList.cc
Compiling TXConnectionMgr.cc
<...>
Compiling TXNetReadCache_Body.cc
Compiling TXMutexLocker.cc
Creating archive ../lib/Linux/libXTNetFile.a ...
Creating shared library ../lib/Linux/libXTNetFile.so ...
Make client done.
The shared library plugin is created in the "lib" directory one level up:
noric01> cd ..
noric01> ls
Experiment XProtocol XTNetFile lib obj
noric01> ls lib/Linux/
libXTNetFile.a libXTNetFile.so
The only thing you need to do to use the libXTNetFile.so plugin is make sure
that the directory which contains it is added to your LD_LIBRARY_PATH envvar.
Using the XTNetFile plugin in ROOT
Once you have built the library and made sure that it can be found via
LD_LIBRARY_PATH, you can start ROOT. The only other thing left to do
is to tell the ROOT TPluginManager that you want to use XTNetFile instead
of TNetFile for all file accesses beginning with "root://". This can be
within ROOT with:
root [0] gROOT->GetPluginManager()->AddHandler("TFile","^root:","XTNetFile", "XTNetFile", "XTNetFile(const char*,Option_t*,const char*,Int_t,Int_t)");
Having done this, you should be setup to use XTNetFile to access files via
xrootd. (See the examples.)
Summary
This page describes how to build and use the XTNetFile standalone plugin. This
is meant primarily for those who cannot yet move to ROOT version 4.01/02 or
later where the client is availble out-of-the-box from the ROOT build itself.
Last modified 06-Oct-2004,
Peter.Elmer@cern.ch