You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

Using Xrootd from ROOT

Reading or writing files within ROOT requires the class TXNetFile which is found in the library libNetx.so.
This library is loaded automatically if the static method TFlle::Open() is used to open the file.

      

root [2] TFile *f = TFile::Open("root://glast-rdr//wilko/test/basic.root")     // Reading a file

If  TXnetFile is used directly the library has to be loaded first:

 

      root[2]  .L $ROOTSYS/libNetx.so


       root[3]  TFile *f = new TXNetFile("root://glast-rdr//wilko/test/basic.root", ,"RECREATE"))    // Open a file for writing

 

TChain will also automatically use TXNetFile if the root files are specified using the "root://<xrootdSrv>/..."  names.
The next example will chain three root files and read them from xrootd:

       root[1]  TChain *ch = new TChain(<TreeName>)


       root[2]  ch->Add("root://<xrootdSrv>//test/testtree1.root)


       root[3]  ch->Add("root://<xrootdSrv>//test/testtree2.root)


       root[4]  ch->Add("root://<xrootdSrv>//test/testtree3.root)

Using Xrootd client command line tools

xrdcp:   Copy files to and from XROOTD

 

  • No labels