Please read tips for efficient and successful posting and posting code
ROOT Version: 5.34.36
Platform: CentOS 7
Compiler: gcc 4.9
I am trying to access files on a DPM disk server using the xrootd interface.
I usually access files with paths like root://atlasse.lnf.infn.it//dpm/lnf.infn.it/home/vo.padme.org/daq/2020/rawdata/run_0030616_20201112_151635/run_0030616_20201112_151635_lvl1_00_000.root
Using this path I can access the files using the GFAL tools:
[leonardi@padmeui OnlineMonitor]$ gfal-ls -l root://atlasse.lnf.infn.it//dpm/lnf.infn.it/home/vo.padme.org/daq/2020/rawdata/run_0030616_20201112_151635/run_0030616_20201112_151635_lvl1_00_000.root
-r-------- 1 600 38116 343687327 Nov 14 09:59 root://atlasse.lnf.infn.it//dpm/lnf.infn.it/home/vo.padme.org/daq/2020/rawdata/run_0030616_20201112_151635/run_0030616_20201112_151635_lvl1_00_000.root
If I try to open these files from within a C++ program, using TChain works fine while I could not find a way to open them using TFile.
The following (short) code demonstrate the problem:
#include "TFile.h"
#include "TChain.h"
#include "TTree.h"
#include "TString.h"
#include "TError.h"
#include "TSystem.h"
int main(int argc, char* argv[])
{
TString treeName = "RawEvents";
TString fileName = "root://atlasse.lnf.infn.it//dpm/lnf.infn.it/home/vo.padme.org/daq/2020/rawdata/run_0030616_20201112_151635/run_0030616_20201112_151635_lvl1_00_000.root";
TFile* ff = new TFile(fileName.Data(),"READ");
delete ff;
ff = 0;
TChain* chain = new TChain(treeName.Data());
chain->AddFile(fileName.Data());
printf("Chain has %lld entries\n",chain->GetEntries());
delete chain;
chain = 0;
}
If I run this code, TFile gives an error:
Error in <TFile::TFile>: file /dpm/lnf.infn.it/home/vo.padme.org/daq/2020/rawdata/run_0030616_20201112_151635/run_0030616_20201112_151635_lvl1_00_000.root does not exist
while TChain works correctly and reports 1000 entries as the content of the file.
What am I doing wrong when I use the TFile command?
Emanuele Leonardi