Open non-root file from dCache


I was reading here [*] that you can open non-root binaries with root.

More specifically, I’d like to access (python) numpy binaries on a storage element, that is from dCache.

Ideally, I’d like to have something like this:

array = numpy.load(f_path, 'r')

where f_path is a dCache address, for example f_path = 'root://'.

From the link above I’ve tried to do this

array = ROOT.TFile.Open('dcap://')

which worked fine. But now I’m wondering how to proceed?

How can I get a numpy array out of this “plain” TFile?

Maybe there’s also easier ways to do this?

Like omitting ROOT and directly using gfal-tools or xrootd in python?

I’ve also tried but couldn’t manage.

Any help is very much appreciated!


[*] How to open a non-root file

Once you have a TFile to a non-root binary you can use:

TFile::SetOffset  // Similar to seek 
ReadBuffer(char *buf, Int_t len); // Similar to fread
ReadBuffer(char *buf, Long64_t pos, Int_t len); // Similar to seek+fread.

hi pcanal, thanks for your reply

sorry for my naive question, how would i proceed from there?

The same way (except for using TFile functions instead of posix function) than you would for a local file …