Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Using  Using Xrootd from ROOT

Open a File 

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.

...

 

Wiki Markup
      root\[2\]  .L $ROOTSYS/libNetx.so

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

The above commands were tested using ROOT version 5.12. Test with a previous version (v5.10) showed that opening a file with the
"RECREATE" option fails, with a segmentation violation. The file is opened with zero length but further access to the file fails.
Using "NEW" to open the file works but this means the open will fail if the file already exists.

Using TChain 

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:

...